I am working on the blend modes formulas and
I am not sure what to do with a/0:

A = a/aa

A - non-pre-multiplied color
a - pre-multiplied color
aa - alpha value

The only reasonable thing to do that I can think of is:

Let 'ba' mean alpha value for a pixel in the other input image B.

1. if (aa==0 && ba!=0) then copy the values from image B at that pixel, to
result image R.
2. if (aa!=0 && ba==0) then copy the values from image A at that pixel, to
result image R.
3. if (aa==0 && ba==0) then set that pixel to (0,0,0,0) in result image R.

So, if only one alpha value is 0, for a pixel in image A or B,
then that is the same case as if one of the iterators for the input images
is not valid, and the other one is valid, so we just copy values from the
valid one.
But if both alpha values are 0, then that is the same as if both
iterators are invalid, in which case the result is (0,0,0,0).
_______________________________________________
Oiio-dev mailing list
[email protected]
http://lists.openimageio.org/listinfo.cgi/oiio-dev-openimageio.org

Reply via email to