Hey there,
I guess this topic has already been discussed, but I couldnt find any matching topic.
Could it be that it's not possible to use >1bit alpha in PGraphics objects?
here is an example to demonstrate my problem:
Code:
PGraphics bg;
PGraphics element;
void setup() {
size(400, 400);
bg = createGraphics(width, height, JAVA2D);
element = createGraphics(width, height, JAVA2D);
}
void draw() {
background(0);
bg.beginDraw();
bg.smooth();
bg.background(0, 20);
bg.stroke(255);
bg.line(0, 0, mouseX, mouseY);
bg.endDraw();
element.beginDraw();
element.smooth();
element.background(0, 0);
element.fill(255);
element.ellipse(random(width), height / 2, 20, 20);
element.endDraw();
image(bg, 0, 0);
image(element, 0, 0);
}
this doesnt apply any fading to background, instead the whole frame is redrawn, but from my understanding the logic is as following:
* clear the frame
* apply a fading to background
* draw on background
* clear elements
* redraw elements
* draw both graphics on the empty frame
Id like to achieve the effect, that the background graphic is fading, whereas the elements are redrawn, but it doesnt seem possible this way. I thought PGraphics were sort of a graphics buffer? Could someone point me in the right direction?
thanks in advance!
-daniel