lib/chunky_png/canvas/png_decoding.rb
# Decodes a scanline if it was encoded using filtering.
#
# It will extract the filtering method from the first byte of the scanline, and uses the
# method to change the subsequent bytes to unfiltered values. This will modify the pixelstream.
#
# The bytes of the scanline can then be used to construct pixels, based on the color mode..
#
# @param [String] stream The pixelstream to undo the filtering in.
# @param [Integer] pos The starting position of the scanline to decode.
# @param [Integer, nil] prev_pos The starting position of the previously decoded scanline, or <tt>nil</tt>
#     if this is the first scanline of the image.
# @param [Integer] line_length The number of bytes in the scanline, discounting the filter method byte.
# @param [Integer] pixel_size The number of bytes used per pixel, based on the color mode.
# @return [void]
Decodes a scanline if it was encoded using filtering.
It will extract the filtering method from the first byte of the scanline, and uses the
method to change the subsequent bytes to unfiltered values. This will modify the pixelstream.

The bytes of the scanline can then be used to construct pixels, based on the color mode
Decodes a scanline if it was encoded using filtering . It will extract the filtering method from the first byte of the scanline and uses the method to change the subsequent bytes to unfiltered values . This will modify the pixelstream . The bytes of the scanline can then be used to construct pixels based on the color mode
def decode_png_str_scanline(stream, pos, prev_pos, line_length, pixel_size)
        case stream.getbyte(pos)
          when ChunkyPNG::FILTER_NONE    then 
          when ChunkyPNG::FILTER_SUB     then decode_png_str_scanline_sub(stream, pos, prev_pos, line_length, pixel_size)
          when ChunkyPNG::FILTER_UP      then decode_png_str_scanline_up(stream, pos, prev_pos, line_length, pixel_size)
          when ChunkyPNG::FILTER_AVERAGE then decode_png_str_scanline_average(stream, pos, prev_pos, line_length, pixel_size)
          when ChunkyPNG::FILTER_PAETH   then decode_png_str_scanline_paeth(stream, pos, prev_pos, line_length, pixel_size)
          else raise ChunkyPNG::NotSupported, "Unknown filter type: #{stream.getbyte(pos)}!"
        end
      end
def decode_png_str_scanline ( stream , pos , prev_pos , line_length , pixel_size ) case stream . getbyte ( pos ) when ChunkyPNG :: FILTER_NONE then when ChunkyPNG :: FILTER_SUB then decode_png_str_scanline_sub ( stream , pos , prev_pos , line_length , pixel_size ) when ChunkyPNG :: FILTER_UP then decode_png_str_scanline_up ( stream , pos , prev_pos , line_length , pixel_size ) when ChunkyPNG :: FILTER_AVERAGE then decode_png_str_scanline_average ( stream , pos , prev_pos , line_length , pixel_size ) when ChunkyPNG :: FILTER_PAETH then decode_png_str_scanline_paeth ( stream , pos , prev_pos , line_length , pixel_size ) else raise ChunkyPNG :: NotSupported , "Unknown filter type: #{stream.getbyte(pos)}!" end end
Decodes a scanline if it was encoded using filtering.
Decodes a scanline if it was encoded using filtering .
# rubocop:disable Lint/EmptyWhen # no-op
None
void
stream
<not_specific>
pos
<not_specific>
prev_pos
<not_specific>
line_length
<not_specific>
pixel_size
<not_specific>
<not_specific>
pixel_size The number of bytes used per pixel, based on the color mode.
pixel_size The number of bytes used per pixel based on the color mode .