lib/chunky_png/canvas/operations.rb
# Composes another image onto this image using alpha blending. This will
# modify the current canvas.
#
# If you simply want to replace pixels or when the other image does not
# have transparency, it is faster to use {#replace!}.
#
# @param [ChunkyPNG::Canvas] other The foreground canvas to compose on
#   the current canvas, using alpha compositing.
# @param [Integer] offset_x The x-offset to apply the new foreground on.
# @param [Integer] offset_y The y-offset to apply the new foreground on.
# @return [ChunkyPNG::Canvas] Returns itself, but with the other canvas
#   composed onto it.
# @raise [ChunkyPNG::OutOfBounds] when the other canvas doesn't fit on
#   this one, given the offset and size of the other canvas.
# @see #replace!
# @see #compose
Composes another image onto this image using alpha blending. This will
modify the current canvas.

If you simply want to replace pixels or when the other image does not
have transparency, it is faster to use {#replace!}.
Composes another image onto this image using alpha blending . This will modify the current canvas . If you simply want to replace pixels or when the other image does not have transparency it is faster to use { #replace! } .
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
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
Composes another image onto this image using alpha blending.
Composes another image onto this image using alpha blending .
Returns itself, but with the other canvas composed onto it.
Returns itself but with the other canvas composed onto it .
ChunkyPNG::Canvas
[ChunkyPNG::OutOfBounds] when the other canvas doesn't fit on this one, given the offset and size of the other canvas.
[ ChunkyPNG :: OutOfBounds ] when the other canvas doesn ' t fit on this one given the offset and size of the other canvas .
other
<not_specific>
offset_x
<not_specific>
offset_y
<not_specific>
<not_specific>
offset_y The y-offset to apply the new foreground on.
offset_y The y - offset to apply the new foreground on .
see
None
see
None