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 this one,
Returns:
-
(ChunkyPNG::Canvas)
- Returns itself, but with the other canvas placed onto it.
Parameters:
-
offset_y
(Integer
) -- The y-offset to apply the new forgeround on. -
offset_x
(Integer
) -- The x-offset to apply the new forgeround on. -
other
(ChunkyPNG::Canvas
) -- The foreground canvas to get the pixels from.
def replace!(other, offset_x = 0, offset_y = 0) check_size_constraints!(other, offset_x, offset_y) for y in 0...other.height do pixels[(y + offset_y) * width + offset_x, other.width] = other.pixels[y * other.width, other.width] end self end