Class: GD2::Canvas::Arc

Inherits:
Object
  • Object
show all
Defined in:
lib/gd2/canvas.rb

Direct Known Subclasses

Wedge

Instance Method Summary collapse

Constructor Details

#initialize(center, width, height, range) ⇒ Arc

Returns a new instance of Arc.



118
119
120
121
122
# File 'lib/gd2/canvas.rb', line 118

def initialize(center, width, height, range)
  @center, @width, @height = center, width, height
  @range = Range.new(360.degrees - range.end, 360.degrees - range.begin,
    range.exclude_end?)
end

Instance Method Details

#draw(image, mode) ⇒ Object



124
125
126
127
128
129
# File 'lib/gd2/canvas.rb', line 124

def draw(image, mode)
  GD2FFI.send(:gdImageArc, image.image_ptr, @center.x.to_i, @center.y.to_i,
    @width.to_i, @height.to_i,
    @range.begin.to_degrees.round.to_i, @range.end.to_degrees.round.to_i, mode.to_i)
  nil
end