If I have a bottom layer color and an alpha value (C&A) and want to create a custom C&A on the screen, what is the function to determine what C&A has to be added as a layer on top of the bottom layer?
edit:
I want to duplicate photoshop’s “normal” mode so that I match a designer’s graphic design.
For example:
BASE LAYER rgb: 255-0-0 alpha: 51/256
+
NEW LAYER rgb: ??? alpha: ???
=
DESIRED LAYER rgb: 114-0-141 alpha: 92/256
P.S.: the answer is 0-0-255 alpha: 51/256… but I only know this because I wrote the problem and verified it in photoshop.
This would depend on the Blend Mode used between the two layers (bottom and top). The wiki page lists some formulae that may be of interest to you.
The PDF Reference manual has a nice explanation too:
where
and the subscripts
Also,
In case of Normal Blend Mode: B(Cb, Cs) = Cs
The blended alpha is given by: