lib/chunky_png/canvas/adam7_interlacing.rb
# Extracts a pass from a complete image
# @param [Integer] pass The pass number, should be in 0..6.
# @param [ChunkyPNG::Canvas] canvas The image that is being deconstructed.
# @return [ChunkyPNG::Canvas] The extracted pass image.
Extracts a pass from a complete image
Extracts a pass from a complete image
def adam7_extract_pass(pass, canvas)
        x_shift, x_offset, y_shift, y_offset = adam7_multiplier_offset(pass)
        sm_pixels = []
        y_offset.step(canvas.height - 1, 1 << y_shift) do |y|
          x_offset.step(canvas.width - 1, 1 << x_shift) do |x|
            sm_pixels << canvas[x, y]
          end
        end
        new_canvas_args = adam7_pass_size(pass, canvas.width, canvas.height) + [sm_pixels]
        ChunkyPNG::Canvas.new(*new_canvas_args)
      end
def adam7_extract_pass ( pass , canvas ) x_shift , x_offset , y_shift , y_offset = adam7_multiplier_offset ( pass ) sm_pixels = [ ] y_offset . step ( canvas . height - 1 , 1 << y_shift ) do | y | x_offset . step ( canvas . width - 1 , 1 << x_shift ) do | x | sm_pixels << canvas [ x , y ] end end new_canvas_args = adam7_pass_size ( pass , canvas . width , canvas . height ) + [ sm_pixels ] ChunkyPNG :: Canvas . new ( * new_canvas_args ) end
Extracts a pass from a complete image
Extracts a pass from a complete image
The extracted pass image.
The extracted pass image .
ChunkyPNG::Canvas
pass
<not_specific>
canvas
<not_specific>
<not_specific>
canvas The image that is being deconstructed.
canvas The image that is being deconstructed .