The Processing reference for blend suggests there is flexibility of specifying the destination image as well as the source image.
> Blends a region of pixels from one image into another (or in itself again) with full alpha channel support. There is a choice of the following modes to blend the source pixels (A) with the ones of pixels in the destination image (B)
But in the syntax you only get to specify the source image. The destination image seems hardwired to be the image in the sketch window.
But what if I want the destination image to be another PGraphics? Can I do this? What would be the syntax?
thanks!
micycle
November 23, 2020, 11:55am
2
You can call blend()
on a PGraphics
object.
1 Like
Aha, good. What is the syntax? As I said, the Processing documentation for Blend just tells you how to specify source, not the destination. And in the examples it’s aways the Pimage that’s being operated on. How would you get it to operate on a PGraphics that you specify?
Chrisir
November 23, 2020, 4:13pm
5
PImage c1, c2;
void setup() {
size(500, 500);
c1 = loadImage("c1.jpg");
c2 = loadImage("c2.jpg");
}
void draw() {
image(c1, 0, 0);
c1.blend(c2,
mouseX, mouseY, 100, 100,
mouseX, mouseY, 100, 100,
DARKEST); // LIGHTEST
image(c1, 0, 0);
}
1 Like
Great your example is the answer to the question I meant to ask!
1 Like
glv
November 24, 2020, 12:16pm
7
2 Likes