lib/chunky_png/canvas/png_decoding.rb
# Returns the method name to use to decode scanlines into pixels.
# @param [Integer] color_mode The color mode of the image.
# @param [Integer] depth The bit depth of the image.
# @return [Symbol] The method name to use for decoding, to be called on the canvas class.
# @raise [ChunkyPNG::NotSupported] when the color_mode and/or bit depth is not supported.
Returns the method name to use to decode scanlines into pixels.
Returns the method name to use to decode scanlines into pixels .
def decode_png_pixels_from_scanline_method(color_mode, depth)
        decoder_method = case color_mode
          when ChunkyPNG::COLOR_TRUECOLOR       then :"decode_png_pixels_from_scanline_truecolor_#{depth}bit"
          when ChunkyPNG::COLOR_TRUECOLOR_ALPHA then :"decode_png_pixels_from_scanline_truecolor_alpha_#{depth}bit"
          when ChunkyPNG::COLOR_INDEXED         then :"decode_png_pixels_from_scanline_indexed_#{depth}bit"
          when ChunkyPNG::COLOR_GRAYSCALE       then :"decode_png_pixels_from_scanline_grayscale_#{depth}bit"
          when ChunkyPNG::COLOR_GRAYSCALE_ALPHA then :"decode_png_pixels_from_scanline_grayscale_alpha_#{depth}bit"
        end
        raise ChunkyPNG::NotSupported, "No decoder found for color mode #{color_mode} and #{depth}-bit depth!" unless respond_to?(decoder_method, true)
        decoder_method
      end
def decode_png_pixels_from_scanline_method ( color_mode , depth ) decoder_method = case color_mode when ChunkyPNG :: COLOR_TRUECOLOR then :" decode_png_pixels_from_scanline_truecolor_ #{ depth } bit " when ChunkyPNG :: COLOR_TRUECOLOR_ALPHA then :" decode_png_pixels_from_scanline_truecolor_alpha_ #{ depth } bit " when ChunkyPNG :: COLOR_INDEXED then :" decode_png_pixels_from_scanline_indexed_ #{ depth } bit " when ChunkyPNG :: COLOR_GRAYSCALE then :" decode_png_pixels_from_scanline_grayscale_ #{ depth } bit " when ChunkyPNG :: COLOR_GRAYSCALE_ALPHA then :" decode_png_pixels_from_scanline_grayscale_alpha_ #{ depth } bit " end raise ChunkyPNG :: NotSupported , "No decoder found for color mode #{color_mode} and #{depth}-bit depth!" unless respond_to? ( decoder_method , true ) decoder_method end
Returns the method name to use to decode scanlines into pixels.
Returns the method name to use to decode scanlines into pixels .
The method name to use for decoding, to be called on the canvas class.
The method name to use for decoding to be called on the canvas class .
Symbol
[ChunkyPNG::NotSupported] when the color_mode and/or bit depth is not supported.
[ ChunkyPNG :: NotSupported ] when the color_mode and / or bit depth is not supported .
color_mode
<not_specific>
depth
<not_specific>
<not_specific>
depth The bit depth of the image.
depth The bit depth of the image .