Class: Hokusai::Commands::Image

Inherits:
Base
  • Object
show all
Defined in:
ui/src/hokusai/commands/image.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Base

#after_draw, draw, #draw, on_draw

Constructor Details

#initialize(source, x, y, width, height) ⇒ Image

Returns a new instance of Image.



5
6
7
8
9
10
11
# File 'ui/src/hokusai/commands/image.rb', line 5

def initialize(source, x, y, width, height)
  @source = source
  @x = x
  @y = y
  @width = width
  @height = height
end

Instance Attribute Details

#heightObject (readonly)

Returns the value of attribute height.



3
4
5
# File 'ui/src/hokusai/commands/image.rb', line 3

def height
  @height
end

#sourceObject (readonly)

Returns the value of attribute source.



3
4
5
# File 'ui/src/hokusai/commands/image.rb', line 3

def source
  @source
end

#widthObject (readonly)

Returns the value of attribute width.



3
4
5
# File 'ui/src/hokusai/commands/image.rb', line 3

def width
  @width
end

#xObject (readonly)

Returns the value of attribute x.



3
4
5
# File 'ui/src/hokusai/commands/image.rb', line 3

def x
  @x
end

#yObject (readonly)

Returns the value of attribute y.



3
4
5
# File 'ui/src/hokusai/commands/image.rb', line 3

def y
  @y
end

Instance Method Details

#cacheObject



17
18
19
# File 'ui/src/hokusai/commands/image.rb', line 17

def cache
  [source, width, height].hash
end

#hashObject



13
14
15
# File 'ui/src/hokusai/commands/image.rb', line 13

def hash
  [self.class, x, y, width, height, source].hash
end