processing-docs icon indicating copy to clipboard operation
processing-docs copied to clipboard

blendMode() reference

Open processing-bugs opened this issue 11 years ago • 4 comments

Issue by shiffman Tuesday Oct 08, 2013 at 14:31 GMT Originally opened as https://github.com/processing/processing-web-archive/issues/265


I was going over blendMode with a couple students today and noticed it would be nice if we added some visual aids to the blend mode reference page.

Also, @codeanticode can you clarify what "factor" is referring to?. I would be happy to help document this in the reference.

processing-bugs avatar Jun 09 '14 23:06 processing-bugs

Comment by codeanticode Tuesday Oct 08, 2013 at 15:15 GMT


factor refers to the alpha channel of the source color (denoted as B in the reference), at least that's the case in OpenGL.

A related note regarding blendMode() in P2D and P3D is that not all the blending modes are available with those renderers (because some blending operations like burn or overlay cannot be modeled using the standard blending equations in OpenGL), see the discussion in this issue from the processing repo https://github.com/processing/processing/issues/2075

processing-bugs avatar Jun 09 '14 23:06 processing-bugs

re http://processing.org/reference/javadoc/core/processing/core/PImage.html#blendColor(int,%20int,%20int)

The documentation could be made much clearer with just a few changes. If you call the parameters c1 and c2, use the same names in the BLEND formula, C = A_factor + B. Can you say instead "returns c1_factor + c2"? And then you simple must explain what "factor" is. It's not a parameter. Is it a global variable? Are you sure that's even the right formula? Shouldn't it be "c1 + factor*(c2 - c1)"? Where factor ranges from 0 to 1.

mvs202 avatar Nov 30 '14 04:11 mvs202

I am provisionally adding @alignedleft to this. He's great at this. I think the priority is to get the blendMode() reference visual and on par with the blend(). If anything changes to explain what factor is or to modify the equations, they should happen with both reference entries.

REAS avatar Oct 02 '15 23:10 REAS

Here's an awesome reference for this from @JakubValtar: processing/processing#2921

REAS avatar Oct 02 '15 23:10 REAS