module ChunkyPNG::Canvas::Operations
def compose(other, offset_x = 0, offset_y = 0)
- See: #replace -
Raises:
-
(ChunkyPNG::OutOfBounds)
- when the other canvas doesn't fit on this one,
Returns:
-
(ChunkyPNG::Canvas)
- Returns itself, but with the other canvas composed 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 compose on the
def compose(other, offset_x = 0, offset_y = 0) check_size_constraints!(other, offset_x, offset_y) for y in 0...other.height do for x in 0...other.width do set_pixel(x + offset_x, y + offset_y, ChunkyPNG::Color.compose(other.get_pixel(x, y), get_pixel(x + offset_x, y + offset_y))) end end self end