Class: Dare::ImageTile
- Inherits:
-
Object
- Object
- Dare::ImageTile
- Defined in:
- lib/dare/image.rb
Instance Attribute Summary collapse
-
#height ⇒ Object
readonly
Returns the value of attribute height.
-
#width ⇒ Object
readonly
Returns the value of attribute width.
Instance Method Summary collapse
- #draw(x = 0, y = 0, opts = {}) ⇒ Object
- #draw_rot(x = 0, y = 0, angle = 90, opts = {}) ⇒ Object
-
#initialize(image = Image.new, x = 0, y = 0, width = 0, height = 0) ⇒ ImageTile
constructor
A new instance of ImageTile.
Constructor Details
#initialize(image = Image.new, x = 0, y = 0, width = 0, height = 0) ⇒ ImageTile
Returns a new instance of ImageTile.
202 203 204 205 206 207 208 |
# File 'lib/dare/image.rb', line 202 def initialize(image = Image.new, x = 0, y = 0, width = 0, height = 0) @image = image @x = x @y = y @width = width @height = height end |
Instance Attribute Details
#height ⇒ Object (readonly)
Returns the value of attribute height.
201 202 203 |
# File 'lib/dare/image.rb', line 201 def height @height end |
#width ⇒ Object (readonly)
Returns the value of attribute width.
201 202 203 |
# File 'lib/dare/image.rb', line 201 def width @width end |
Instance Method Details
#draw(x = 0, y = 0, opts = {}) ⇒ Object
210 211 212 |
# File 'lib/dare/image.rb', line 210 def draw(x = 0, y = 0, opts = {}) @image.draw_tile(x, y, opts.merge({sx: @x, sy: @y, swidth: @width, sheight: @height})) end |
#draw_rot(x = 0, y = 0, angle = 90, opts = {}) ⇒ Object
214 215 216 |
# File 'lib/dare/image.rb', line 214 def draw_rot(x = 0, y = 0, angle = 90, opts = {}) @image.draw_tile_rot(x, y, angle, opts.merge({sx: @x, sy: @y, swidth: @width, sheight: @height})) end |