We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
Page Index Toggle Pages: 1
blend OVERLAY mode (Read 1916 times)
blend OVERLAY mode
Aug 15th, 2005, 3:24pm
 
There seems to be no good/easy way to layer two PImage's together.  I have a dst PImage and I want to put overtop of it a src PImage.  I had to write a custom Overlay() function to do it.  Why not add an OVERLAY mode to PImage's blend() function?

I used the following blend function:

C = A * factor + B * (1 - factor)
where factor is a fraction based on A's alpha level.

Thus, the more transparent A becomes, the more B shows through.  I suppose it would be almost functionally equivalent to PGraphics.image() except that you'd have more control over starting coordinates and widths.
Re: blend OVERLAY mode
Reply #1 - Aug 17th, 2005, 7:49pm
 
it's slated for beta, along with DIFFERENCE, MULTIPLY, SCREEN, HARD_LIGHT and SOFT_LIGHT, but they're just not finished yet.

although this was the function that quasimondo dug up for OVERLAY:
OVERLAY: C = B < 128 ? (2*A*B/255) : 255-2*(255-A)*(255-B)/255
which doesn't appear to be doing the same thing, though perhaps you aren't referring to what's "technically" called overlay.

previous thread on blend modes:
http://processing.org/discourse/yabb/YaBB.cgi?board=Proce55ing_Software;action=display;num=1082056702
Re: blend OVERLAY mode
Reply #2 - Aug 17th, 2005, 8:07pm
 
better yet, since it's on the todo list, i've added it to the bugs db along with more details: http://dev.processing.org/bugs/show_bug.cgi?id=132

so if y'all can follow up there, that would be helpful. i'll just close this thread.
Page Index Toggle Pages: 1