We are about to switch to a new forum software. Until then we have removed the registration on this forum.
Hello, This is my first program to write a code to mask an image and show portion of background image only on mousepress event. The Java code works just fine on desktop(In Java mode). Whereas in Andriod mode, I don't know what I am missing or where the mistake is, but the background image is displayed and the pg objects paints itself over and over - how do I correct this? Although mousepress events work just fine. Thanks!!
PGraphics pg;
PImage bgimage;
void setup() {
size(640, 480);
bgimage = loadImage("background.jpg");
bgimage.resize(640,480);
pg = createGraphics(640, 480);
pg.beginDraw();
pg.background(0);
pg.smooth();
pg.noStroke();
pg.fill(255);
pg.endDraw();
}
void draw()
{
image(bgimage,640,480);
pg.beginDraw();
if (mousePressed)
pg.ellipse(mouseX, mouseY, 100, 100);
pg.endDraw();
bgimage.mask(pg);
image(bgimage,0,0);
}
Answers
Duplicate post: https://forum.processing.org/two/discussion/20333/masking-images-processing-for-android#latest
Kf