Class: CooCoo::Transformers::Image::Rotation

Inherits:
Base show all
Defined in:
lib/coo-coo/transformer.rb

Instance Attribute Summary

Attributes inherited from Base

#height, #width

Instance Method Summary collapse

Methods inherited from Base

#rotate, #scale, #translate

Methods inherited from Base

bin_op, bin_op_inner, #drop, #first

Constructor Details

#initialize(enum, width, height, ox, oy, radians) ⇒ Rotation

Returns a new instance of Rotation.



142
143
144
145
146
147
# File 'lib/coo-coo/transformer.rb', line 142

def initialize(enum, width, height, ox, oy, radians)
  super(enum, width, height)
  @ox = ox
  @oy = oy
  @radians = radians
end

Instance Method Details

#nextObject



149
150
151
152
153
154
155
156
157
158
# File 'lib/coo-coo/transformer.rb', line 149

def next
  i = super()
  r = NMatrix.zeroes([1, width * height])
  height.times do |y|
    width.times do |x|
      r[0, map_pixel(x, y)] = sample(i, x, y)
    end
  end
  r
end