Class: Fox::Canvas::CircleShape

Inherits:
Shape
  • Object
show all
Defined in:
lib/fox16/canvas.rb

Instance Attribute Summary collapse

Attributes inherited from Shape

#foreground, #selector, #target, #x, #y

Instance Method Summary collapse

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


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

#radiusObject

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

#heightObject


272
273
274
# File 'lib/fox16/canvas.rb', line 272

def height
  2*radius
end

#widthObject


268
269
270
# File 'lib/fox16/canvas.rb', line 268

def width
  2*radius
end