Class: RIImage
- Inherits:
-
Object
- Object
- RIImage
- Defined in:
- lib/RIUI/RIImage.rb
Instance Attribute Summary collapse
-
#color ⇒ Object
Returns the value of attribute color.
-
#height ⇒ Object
Returns the value of attribute height.
-
#image ⇒ Object
Returns the value of attribute image.
-
#width ⇒ Object
Returns the value of attribute width.
-
#x ⇒ Object
Returns the value of attribute x.
-
#y ⇒ Object
Returns the value of attribute y.
Instance Method Summary collapse
-
#initialize(opts = {}) ⇒ RIImage
constructor
A new instance of RIImage.
- #setColor(opts = [:color]) ⇒ Object
- #setSize(opts = [:width, :height]) ⇒ Object
Constructor Details
#initialize(opts = {}) ⇒ RIImage
Returns a new instance of RIImage.
5 6 7 8 9 10 11 12 |
# File 'lib/RIUI/RIImage.rb', line 5 def initialize(opts={}) @path = opts[:image] || "/" @x = opts[:x] || 0 @y = opts[:y] || 0 @width = opts[:width] || 0 @height = opts[:height] || 0 @image = Image.new(path: @path, x: @x, y: @y, width: @width, height: @height) end |
Instance Attribute Details
#color ⇒ Object
Returns the value of attribute color.
3 4 5 |
# File 'lib/RIUI/RIImage.rb', line 3 def color @color end |
#height ⇒ Object
Returns the value of attribute height.
3 4 5 |
# File 'lib/RIUI/RIImage.rb', line 3 def height @height end |
#image ⇒ Object
Returns the value of attribute image.
3 4 5 |
# File 'lib/RIUI/RIImage.rb', line 3 def image @image end |
#width ⇒ Object
Returns the value of attribute width.
3 4 5 |
# File 'lib/RIUI/RIImage.rb', line 3 def width @width end |
#x ⇒ Object
Returns the value of attribute x.
3 4 5 |
# File 'lib/RIUI/RIImage.rb', line 3 def x @x end |
#y ⇒ Object
Returns the value of attribute y.
3 4 5 |
# File 'lib/RIUI/RIImage.rb', line 3 def y @y end |
Instance Method Details
#setColor(opts = [:color]) ⇒ Object
19 20 21 |
# File 'lib/RIUI/RIImage.rb', line 19 def setColor(opts=[:color]) @image.color = opts[:color] end |
#setSize(opts = [:width, :height]) ⇒ Object
13 14 15 16 17 18 |
# File 'lib/RIUI/RIImage.rb', line 13 def setSize(opts=[:width, :height]) @width = opts[:width] @height = opts[:height] @image.remove @image = Image.new(path: @path, x: @x-@width/2, y: @y-@height/2, width: @width, height: @height) end |