1+1 == 0
, which is not
semantically correct behavior.
Note also that 1-x == NOT(x)
.
Two points were lost if one of the two was right and one was wrong; both wrong was minus 5 points.
Cr = Ca * Fa + Cb * FbNote that this formula assumes premultiplied alpha; given that the pixel (0,1) is undefined (from the question), this is the correct assumption.
In the compositing forumla, Cr is the resulting images and Ca and Cb are the two input images. Fa and Fb vary based on the compositing operator being used. The relevant values of Fa and Fb are:
Operator Fa Fb Over 1 1 - alpha(A) In alpha(B) 0 Out 1 - alpha(B) 0Now on to applying the formula and simplifying:
bitmap(R) = (bitmap(A) AND 1) OR (NOT(alpha(A)) AND bitmap(B)) = (bitmap(A)) OR (NOT(alpha(A)) AND bitmap(B)) alpha(R) = (alpha(A) AND 1) OR (NOT(alpha(A)) AND alpha(B)) = (alpha(A)) OR (alpha(B))
bitmap(R) = (bitmap(A) AND alpha(B)) OR (bitmap(B) AND 0) = (bitmap(A) AND alpha(B)) alpha(R) = (alpha(A) AND alpha(B)) OR (alpha(B) AND 0) = (alpha(A) AND alpha(B))
bitmap(R) = (bitmap(A) AND (NOT(alpha(B)))) OR (bitmap(B) AND 0) = (bitmap(A) AND (NOT(alpha(B)))) alpha(R) = (alpha(A) AND (NOT(alpha(B)))) OR (alpha(B) AND 0) = (alpha(A) AND (NOT(alpha(B))))