Class: CooCoo::Image::Scale

Inherits:
Transform show all
Defined in:
lib/coo-coo/image.rb

Instance Method Summary collapse

Methods inherited from Transform

#*

Constructor Details

#initialize(sx, sy) ⇒ Scale

Returns a new instance of Scale.



189
190
191
192
193
# File 'lib/coo-coo/image.rb', line 189

def initialize(sx, sy)
  super()
  @sx = sx
  @sy = sy || sx
end

Instance Method Details

#call(x, y) ⇒ Object



195
196
197
# File 'lib/coo-coo/image.rb', line 195

def call(x, y)
  [ (x / @sx).floor, (y / @sy).floor ]
end