module ChunkyPNG::Canvas::Adam7Interlacing
def adam7_extract_pass(pass, canvas)
-
(ChunkyPNG::Canvas)
- The extracted pass image.
Parameters:
-
canvas
(ChunkyPNG::Canvas
) -- The image that is being deconstructed. -
pass
(Integer
) -- The pass number, should be in 0..6.
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