module ChunkyPNG::Canvas::PNGEncoding
def encode_png_pixelstream(color_mode = ChunkyPNG::COLOR_TRUECOLOR, interlace = ChunkyPNG::INTERLACING_NONE)
-
The
(String
) -- PNG encoded canvas as string. -
interlace
(Integer
) -- The interlacing method to use. -
color_mode
(Integer
) -- The color mode to use for encoding.
def encode_png_pixelstream(color_mode = ChunkyPNG::COLOR_TRUECOLOR, interlace = ChunkyPNG::INTERLACING_NONE) if color_mode == ChunkyPNG::COLOR_INDEXED && (encoding_palette.nil? || !encoding_palette.can_encode?) raise "This palette is not suitable for encoding!" end case interlace when ChunkyPNG::INTERLACING_NONE then encode_png_image_without_interlacing(color_mode) when ChunkyPNG::INTERLACING_ADAM7 then encode_png_image_with_interlacing(color_mode) else raise "Unknown interlacing method!" end end