Copies a region of pixels from one image to another.
The first parameter, srcImage
, is the p5.Image object to blend.
The next four parameters, sx
, sy
, sw
, and sh
determine the region to blend from the source image. (sx, sy)
is the top-left corner of the region. sw
and sh
are the regions width and height.
The next four parameters, dx
, dy
, dw
, and dh
determine the region of the canvas to blend into. (dx, dy)
is the top-left corner of the region. dw
and dh
are the regions width and height.
The tenth parameter, blendMode
, sets the effect used to blend the images' colors. The options are BLEND
, DARKEST
, LIGHTEST
, DIFFERENCE
, MULTIPLY
, EXCLUSION
, SCREEN
, REPLACE
, OVERLAY
, HARD_LIGHT
, SOFT_LIGHT
, DODGE
, BURN
, ADD
, or NORMAL
Examples
Syntax
blend(srcImage, sx, sy, sw, sh, dx, dy, dw, dh, blendMode)
blend(sx, sy, sw, sh, dx, dy, dw, dh, blendMode)
Parameters
source image.
x-coordinate of the source's upper-left corner.
y-coordinate of the source's upper-left corner.
source image width.
source image height.
x-coordinate of the destination's upper-left corner.
y-coordinate of the destination's upper-left corner.
destination image width.
destination image height.
the blend mode. either BLEND, DARKEST, LIGHTEST, DIFFERENCE, MULTIPLY, EXCLUSION, SCREEN, REPLACE, OVERLAY, HARD_LIGHT, SOFT_LIGHT, DODGE, BURN, ADD or NORMAL.