Class: Fox::Canvas::CircleShape
Instance Attribute Summary collapse
-
#radius ⇒ Object
Returns the value of attribute radius.
Attributes inherited from Shape
#foreground, #selector, #target, #x, #y
Instance Method Summary collapse
- #draw(dc) ⇒ Object
- #height ⇒ Object
-
#initialize(x, y, radius) ⇒ CircleShape
constructor
A new instance of CircleShape.
- #width ⇒ Object
Methods inherited from Shape
#apply_dc, #bounds, #deselect, #disable, #draggable=, #draggable?, #drawOutline, #enable, #enabled?, #hide, #hit?, #makeControlPoints, #move, #position, #resize, #select, #selected?, #show, #visible?
Constructor Details
#initialize(x, y, radius) ⇒ CircleShape
Returns a new instance of CircleShape.
280 281 282 283 |
# File 'lib/fox16/canvas.rb', line 280 def initialize(x, y, radius) super(x, y) @radius = radius end |
Instance Attribute Details
#radius ⇒ Object
Returns the value of attribute radius.
278 279 280 |
# File 'lib/fox16/canvas.rb', line 278 def radius @radius end |
Instance Method Details
#draw(dc) ⇒ Object
293 294 295 296 297 298 299 300 301 |
# File 'lib/fox16/canvas.rb', line 293 def draw(dc) apply_dc(dc) do oldLineWidth = dc.lineWidth dc.lineWidth = 5 if selected? dc.drawArc(x, y, width, height, 0, 64*180) dc.drawArc(x, y, width, height, 64*180, 64*360) dc.lineWidth = oldLineWidth end end |
#height ⇒ Object
289 290 291 |
# File 'lib/fox16/canvas.rb', line 289 def height 2*radius end |
#width ⇒ Object
285 286 287 |
# File 'lib/fox16/canvas.rb', line 285 def width 2*radius end |