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.



100
101
102
103
104
# File 'lib/gd2/canvas.rb', line 100

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



106
107
108
109
110
111
# File 'lib/gd2/canvas.rb', line 106

def draw(image, mode)
  ::GD2::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