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)
  SYM[:gdImageFilledArc].call(image.image_ptr, @center.x, @center.y,
    @width, @height,
    @range.begin.to_degrees.round, @range.end.to_degrees.round,
    mode, style)
  nil
end

#styleObject



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

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