pub static blendMode: BlendModeInternalTypeExpand description
Blends the pixels in the display window according to the defined mode. There is a choice of the following modes to blend the source pixels (A) with the ones of pixels already in the display window (B):
BLEND- linear interpolation of colours: C = A\*factor + B. This is the default blending mode.ADD- sum of A and BDARKEST- only the darkest colour succeeds: C = min(A\*factor, B).LIGHTEST- only the lightest colour succeeds: C = max(A\*factor, B).DIFFERENCE- subtract colors from underlying image.EXCLUSION- similar toDIFFERENCE, but less extreme.MULTIPLY- multiply the colors, result will always be darker.SCREEN- opposite multiply, uses inverse values of the colors.REPLACE- the pixels entirely replace the others and don't utilize alpha (transparency) values.REMOVE- removes pixels from B with the alpha strength of A.OVERLAY- mix ofMULTIPLYandSCREEN. Multiplies dark values, and screens light values. (2D)HARD_LIGHT-SCREENwhen greater than 50% gray,MULTIPLYwhen lower. (2D)SOFT_LIGHT- mix ofDARKESTandLIGHTEST. Works likeOVERLAY, but not as harsh. (2D)DODGE- lightens light tones and increases contrast, ignores darks. (2D)BURN- darker areas are applied, increasing contrast, ignores lights. (2D)SUBTRACT- remainder of A and B (3D)
(2D) indicates that this blend mode only works in the 2D renderer.
(3D) indicates that this blend mode only works in the WEBGL renderer.
Examples
blendMode(LIGHTEST);
strokeWeight(30);
stroke(80, 150, 255);
line(25, 25, 75, 75);
stroke(255, 50, 50);
line(75, 25, 25, 75);blendMode(MULTIPLY);
strokeWeight(30);
stroke(80, 150, 255);
line(25, 25, 75, 75);
stroke(255, 50, 50);
line(75, 25, 25, 75);Parameters
mode blend mode to set for canvas.
either BLEND, DARKEST, LIGHTEST, DIFFERENCE, MULTIPLY,
EXCLUSION, SCREEN, REPLACE, OVERLAY, HARD_LIGHT,
SOFT_LIGHT, DODGE, BURN, ADD, REMOVE or SUBTRACT