Method: Pixelart::Image#initialize

Defined in:
lib/pixelart/image.rb

#initialize(width, height, initial = Color::TRANSPARENT) ⇒ Image

Returns a new instance of Image.


127
128
129
130
131
132
133
134
135
136
137
138
# File 'lib/pixelart/image.rb', line 127

def initialize( width, height, initial=Color::TRANSPARENT )
   ### todo/fix:
   ##  change params to *args only - why? why not?
   ##     make width/height optional if image passed in?

  if initial.is_a?( ChunkyPNG::Image )
    @img = initial
  else
    ## todo/check - initial - use parse_color here too e.g. allow "#fff" too etc.
    @img = ChunkyPNG::Image.new( width, height, initial )
  end
end