Slight alpha problem with mask().
in
Programming Questions
•
3 years ago
Hello All,
I'm having a bit of a problem with using mask() at the moment. Im working on a painter style program which at the moment uses a mask over a blank image to create the brush. The issue is - hover over one area for too long and the masked area becomes visible. Am I missing something or is this unavoidable? Here is the code;
int num = 1;
PImage myImage;
PImage[] brush = new PImage[2];
PImage[] brushMask = new PImage[2];
String img;
color brushTint;
int brushSize = 40;
color mySwatch =color (255,0,0);- void setup(){
size(400, 400, P2D); - for (int i = 0; i < 2; i++){
brush[i] = loadImage("brush" + i + ".bmp");
brushMask[i] = loadImage("brushMask" + i + ".bmp");
}
} - void draw() {
if (mousePressed){
noStroke();
imageMode(CENTER);
tint(mySwatch);
brush[0].mask(brushMask[0]);
image(brush[0],mouseX,mouseY,brushSize,brushSize);
updatePixels(); - }
}
Here are the brushMask and brush images im trying to use as well;
brushMask0.jpeg
brush.jpeg (just a blank image :P)
Hope you can help
-Dave D
1