class ChunkyPNG::Canvas
def initialize(width, height, initial = ChunkyPNG::Color::TRANSPARENT)
-
initial
(Array
) -- The initial pizel values. Must be an array with -
height
(Integer
) -- The height in pixels of this canvas -
width
(Integer
) -- The width in pixels of this canvas -
background_color
(Integer, ...
) -- The initial background color of this canvas. -
height
(Integer
) -- The height in pixels of this canvas -
width
(Integer
) -- The width in pixels of this canvas
Overloads:
-
initialize(width, height, initial)
-
initialize(width, height, background_color)
def initialize(width, height, initial = ChunkyPNG::Color::TRANSPARENT) @width, @height = width, height if initial.kind_of?(Array) raise ArgumentError, "The initial array should have #{width}x#{height} = #{width*height} elements!" unless initial.length == width * height @pixels = initial else @pixels = Array.new(width * height, ChunkyPNG::Color.parse(initial)) end end