Jump to content
  • Advertisement
Sign in to follow this  

programming layer blend modes

This topic is 3968 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi I am programming the pin light blend mode found in photoshop. What the transfer mode does is pretty much compare 2 pixels and keep the darker one. Im not sure how to convert and compare vectors with scalars This is the algorithm: A - foreground RGB B - background RGB C - composite RGB vectors tonal values are normalized as such 1 = 255/255 ...scalar There are three conditional statements in the algorithm if(B < 2 * A - 1) { C = 2 * A - 1;// the 1 in the equation is throwing me off } else if ( ( B > 2 * A - 1 ) && ( B < 2 * A ) ) { C = B; } else if ( B > 2 * A ) { C = 2 * A; } How do I convert RGB values, which are vectors, to tonal values which are scalars? 2 * vector gives you a result vector. How do I subtract 1 from a result vector? Do I subtract 1 from each element or from the magnitude of the result vector?... I'm not sure. or is 1 the magnitude of the vector which has to be subtracted from the result vector. The second statement compares which vector is greater ( B < 2*A ). Is it comparing the magnitudes of the vectors? Please help Nikos

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!