Problem with tint in an off-screen graphics buffer
in
Programming Questions
•
3 years ago
Hi
I'm working at a larger projekt in which i make use of off-screen graphic buffers (of type PGraphics).
But there is a problem when I want to blend one ('g') to another ('graphics') with transparancy (changed by factor 'afcator')
This is what would work but is really slow:
- g.loadPixels();
- for (int i=0; i<g.pixels.length; i++) {
- int c=g.pixels[i];
- g.pixels[i]=color(red(c), green(c), blue(c), (int)Math.round(alpha(c)*afactor));
- }
- graphics.blend(g,0,0,g.width,g.height,0,0,graphics.width,graphics.height,ADD);
Since this was much to slow I tried to work with tint.
- tint(255,(int)Math.round(afactor*255));
- image(g,0,0);
- graphics.tint(255,(int)Math.round(afactor*255));
- graphics.image(g,0,0);
So if anybody knows what went wrong, I really dont konw what to do next.
1
