blendMode does not mention blending happens per channel
Closed this issue · 2 comments
I think it might be good to mention in the documentation that blending operations are done on each channel separately. Red is compared with red, green with green, blue with blue.
From http://processing.org/reference/blendMode_.html , "only the lightest colour succeeds" may lead to believe that when blending two colors using LIGHTEST or DARKEST, it will result in one of the two original colors (the lighter one or the darker one). The truth is that we may get a third color, which is the combination of both. "#FF00FF LIGHTEST #008800" results in #FF88FF (and not in the brighter of the two colors, which is #FF00FF), because each channel is processed separately.
Here one might expect to see the magenta prevail because the green box is darker:
size(100, 100, P2D); // (JAVA2D + blendMode = unexpected stuff)
background(0);
noStroke();
blendMode(LIGHTEST);
fill(#FF00FF);
rect(10, 10, 60, 60);
fill(#008800);
rect(30, 30, 60, 60);
@codeanticode This sounds right to me. Can you confirm this matches your understanding of how the blend modes work? If so, I can rephrase the reference description.
Hi guys, yes, the blending calculation operates on each channel separately.
