module ChunkyPNG::Canvas::Operations
def replace!(other, offset_x = 0, offset_y = 0)
- See: #replace -
See: #compose! -
Raises:
-
(ChunkyPNG::OutOfBounds)
- when the other canvas doesn't fit on
Returns:
-
(ChunkyPNG::Canvas)
- Returns itself, but with the other canvas
Parameters:
-
offset_y
(Integer
) -- The y-offset to apply the new foreground on. -
offset_x
(Integer
) -- The x-offset to apply the new foreground on. -
other
(ChunkyPNG::Canvas
) -- The foreground canvas to get the
def replace!(other, offset_x = 0, offset_y = 0) check_size_constraints!(other, offset_x, offset_y) for y in 0...other.height do for d in 0...other.width pixels[(y + offset_y) * width + offset_x + d] = other.pixels[y * other.width + d] end end self end