Here’s a code snippet to help troubleshoot:
PGraphics brush;
void setup() {
size(800, 800);
brush = createGraphics(400, 400);
brush.beginDraw();
brush.background(255, 255, 0);
brush.endDraw();
}
void draw() {
background(255);
fill(255, 0, 0);
noStroke();
rect(0, 0, 400, 400);
//blend(brush, 0, 0, brush.width, brush.height, mouseX, mouseY, brush.width, brush.height, BLEND);
blend(brush, 0, 0, brush.width, brush.height, mouseX, mouseY, brush.width, brush.height, OVERLAY);
}
In setup()
I’m filling a PGraphics
with a yellow background. In draw()
I’m drawing a red square and using blend()
to add that yellow image using OVERLAY
as blend mode but nothing happens? The yellow image isn’t even showing?
To test if blend()
is indeed working, I tried to use BLEND
as the blend mode (see the commented line) and the yellow image appears as expected.
OVERLAY is such an important blend mode for anyone who want to simulate the behaviour of pigment based ink on paper. I’m really hoping someone can help me shed some light on this.
(I’m on a Mac 12.6.7 using Processing 4.2)