Default Blend Mode?
in
Programming Questions
•
2 months ago
I'm using a technique for continually fading drawings to black. I never call background, but instead I call:
- fill(0,10);
- rect(0, 0, width, height);
This worked well for simply drawing to the canvas, but things have become more complicated. I have the original dynamic drawing that I want to continue to fade, but I also want to draw something else on the canvas which does not fade.
My default solution is to maintain
that continually fading image as a separate PImage or pixel array. I would draw to that stored PImage as if it was the canvas, then fade it, draw that PImage to the canvas, and then draw my new content.
(if someone has a better way to do that I'd love to hear, but that's not my question)...
I have no idea how the fading effect of drawing a black rectangle is achieved. For example, I wrote this is an effort to create the same effect but I've been unable to replicate it:
- void fade(int[] src, int[] dst, int w, int h, int alpha) {
- int c = color(255, alpha);
- for(int i = 0; i < w * h; i++) {
- dst[i] = blendColor(src[i], c, [??]); // is there a blending mode that replicates the original effect?
- }
- }
I guess another way of asking this question is, what is the default blending mode that processing uses when drawing something to the canvas?
Thanks for any help...
1