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.



141
142
143
144
# File 'lib/gd2/canvas.rb', line 141

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

Instance Method Details

#draw(image, mode) ⇒ Object



146
147
148
149
150
151
152
# File 'lib/gd2/canvas.rb', line 146

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



154
155
156
# File 'lib/gd2/canvas.rb', line 154

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