lib/chunky_png/canvas/adam7_interlacing.rb
# Merges a pass image into a total image that is being constructed.
# @param [Integer] pass The pass number, should be in 0..6.
# @param [ChunkyPNG::Canvas] canvas The image that is being constructed.
# @param [ChunkyPNG::Canvas] subcanvas The pass image that should be merged
Merges a pass image into a total image that is being constructed.
Merges a pass image into a total image that is being constructed .
def adam7_merge_pass(pass, canvas, subcanvas)
        x_shift, x_offset, y_shift, y_offset = adam7_multiplier_offset(pass)
        for y in 0...subcanvas.height do
          for x in 0...subcanvas.width do
            new_x = (x << x_shift) | x_offset
            new_y = (y << y_shift) | y_offset
            canvas[new_x, new_y] = subcanvas[x, y]
          end
        end
      end
def adam7_merge_pass ( pass , canvas , subcanvas ) x_shift , x_offset , y_shift , y_offset = adam7_multiplier_offset ( pass ) for y in 0 ... subcanvas . height do for x in 0 ... subcanvas . width do new_x = ( x << x_shift ) | x_offset new_y = ( y << y_shift ) | y_offset canvas [ new_x , new_y ] = subcanvas [ x , y ] end end end
Merges a pass image into a total image that is being constructed.
Merges a pass image into a total image that is being constructed .
pass
<not_specific>
canvas
<not_specific>
subcanvas
<not_specific>
<not_specific>
subcanvas The pass image that should be merged
subcanvas The pass image that should be merged