User:Spitzak/sandbox

Alpha Compositing
https://printtechnologies.org/wp-content/uploads/2020/03/pdf-reference-1.6-addendum-blend-modes.pdf

Color C = f(A1/undefineda, B1/undefinedb)ab + YA(1 - b) + ZB(1 - a)

Alpha c = Xab + Ya(1 - b) + Zb(1 - a)

X is almost always equal to f(1,1), the only exceptions here are the PDF definition of Difference and Exclusion.

Y and Z are either 0 or 1, depending on whether you get transparent or the other image when one image is transparent. Some compositing libraries have options to force one or the other to 1 or 0 in all cases.

In non-premultiplied colors, the function is as follows:

Color C = $f(A, B)ab + YA(a - ab) + ZB(b - ab)⁄Xab + Ya(1 - b) + Zb(1 - a)$

Color C = $(f(A, B) - YA - ZB)ab + YAa + ZBb⁄(X - Y - Z)ab + Ya + Zb$

examples

 * samp: M M
 * lang:
 * var: M
 * Unichar:
 * kbd: M M
 * code: M
 * char (current): M
 * char (box): M
 * char (serif): M
 * xt: M
 * bxt: M
 * mxt: M
 * xtd: M
 * xtn: M
 * strongbad: M