Issues with transparency in an offscreen graphic
in
Programming Questions
•
6 months ago
Hey, I'm trying to make a paint program, but for some reason when I try to use the transparency it shows up as a darker shade of what I want. The code I attached shows the issue. the commented out section is the desired effect, and I need to have multiple PGraphics. Each PGraphic is a different layer, so the actual program with display them on top of each other. Any suggestions or things I didn't explain well?
- void setup(){
- size(400,400);
- img=createGraphics(width,height,P2D);
- noStroke();
- }
- PGraphics img;
- void draw(){
- if(mousePressed){
- img.beginDraw();
- img.noStroke();
- img.fill(255,0,0,40);
- img.ellipse(mouseX,mouseY,30,30);
- img.endDraw();
- }
- image(img,0,0);
- }
- /*
- void draw(){
- if(mousePressed){
- fill(255,0,0,40);
- ellipse(mouseX,mouseY,30,30);
- }
- }
- */
1