Class: GD2::Canvas::Wedge

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

Direct Known Subclasses

FilledWedge

Constant Summary collapse

ARC =

Arc styles

0
PIE =
ARC
CHORD =
1
NO_FILL =
2
EDGED =
4

Instance Method Summary collapse

Constructor Details

#initialize(center, width, height, range, chord = false) ⇒ Wedge

Returns a new instance of Wedge


123
124
125
126
# File 'lib/gd2/canvas.rb', line 123

def initialize(center, width, height, range, chord = false)
  super(center, width, height, range)
  @chord = chord
end

Instance Method Details

#draw(image, mode) ⇒ Object


128
129
130
131
132
133
134
# File 'lib/gd2/canvas.rb', line 128

def draw(image, mode)
  ::GD2::GD2FFI.send(:gdImageFilledArc, 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, style.to_i)
  nil
end

#styleObject


136
137
138
# File 'lib/gd2/canvas.rb', line 136

def style
  (@chord ? CHORD : ARC) | NO_FILL | EDGED
end