Class: Fox::Canvas::ImageShape
Instance Attribute Summary collapse
-
#image ⇒ Object
Returns the value of attribute image.
Attributes inherited from Shape
#foreground, #selector, #target, #x, #y
Instance Method Summary collapse
- #draw(dc) ⇒ Object
- #height ⇒ Object
-
#initialize(x, y, image) ⇒ ImageShape
constructor
A new instance of ImageShape.
- #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, image) ⇒ ImageShape
Returns a new instance of ImageShape.
311 312 313 314 |
# File 'lib/fox16/canvas.rb', line 311 def initialize(x, y, image) super(x, y) @image = image end |
Instance Attribute Details
#image ⇒ Object
Returns the value of attribute image.
309 310 311 |
# File 'lib/fox16/canvas.rb', line 309 def image @image end |
Instance Method Details
#draw(dc) ⇒ Object
324 325 326 327 328 329 330 331 332 |
# File 'lib/fox16/canvas.rb', line 324 def draw(dc) apply_dc(dc) do if selected? dc.lineWidth = 5 dc.drawRectangle(x - 3, y - 3, width + 5, height + 5) end dc.drawImage(image, x, y) end end |
#height ⇒ Object
320 321 322 |
# File 'lib/fox16/canvas.rb', line 320 def height @image.height end |
#width ⇒ Object
316 317 318 |
# File 'lib/fox16/canvas.rb', line 316 def width @image.width end |