Method: Pixelart::Pixelator#pixelate

Defined in:
lib/pixelart/pixelator.rb

#pixelateObject



104
105
106
107
108
109
110
111
112
113
114
115
116
# File 'lib/pixelart/pixelator.rb', line 104

def pixelate
  img = ChunkyPNG::Image.new( @width, @height )

  @width.times do |x|
    @height.times do |y|
      pixel = pixel( x, y )
      color = pixel.keys[0]
      img[x,y] = color
    end
  end

  Image.new( img.width, img.height, img )  ## wrap in Pixelart::Image - why? why not?
end