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
#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.
263 264 265 266 |
# File 'lib/fox16/canvas.rb', line 263 def initialize(x, y, radius) super(x, y) @radius = radius end |
Instance Attribute Details
#radius ⇒ Object
Returns the value of attribute radius.
261 262 263 |
# File 'lib/fox16/canvas.rb', line 261 def radius @radius end |
Instance Method Details
#draw(dc) ⇒ Object
276 277 278 279 280 281 282 283 284 285 |
# File 'lib/fox16/canvas.rb', line 276 def draw(dc) oldForeground = dc.foreground oldLineWidth = dc.lineWidth dc.foreground = foreground 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.foreground = oldForeground dc.lineWidth = oldLineWidth end |
#height ⇒ Object
272 273 274 |
# File 'lib/fox16/canvas.rb', line 272 def height 2*radius end |
#width ⇒ Object
268 269 270 |
# File 'lib/fox16/canvas.rb', line 268 def width 2*radius end |