class ChunkyPNG::Canvas
def initialize(width, height, initial = ChunkyPNG::Color::TRANSPARENT)
-
initial
(ChunkyPNG::Pixel, Array
) -- The initial value of te pixels: -
width
(Integer
) -- The height in pixels of this canvas -
width
(Integer
) -- The width in pixels of this canvas
def initialize(width, height, initial = ChunkyPNG::Color::TRANSPARENT) @width, @height = width, height if initial.kind_of?(Fixnum) @pixels = Array.new(width * height, initial) elsif initial.kind_of?(Array) && initial.size == width * height @pixels = initial.map(&:to_i) else raise "Cannot use this value as initial canvas: #{initial.inspect}!" end end