On Sunday 2007-05-20 17:53 +0100, Philip Taylor wrote:
> If you care about alpha, and take cX as premultiplied colour
> components (and CX as non-premul, and aX as alpha), then you get:
> Mozilla:
>  cO = cA * min(1, (1-aB)/aA) + cB
>  aO = aA * min(1, (1-aB)/aA) + aB

Correct.  This is the cairo "saturate" operator, which I think is
the same as Xrender's saturate operator.

> Safari:
>  CO = 1 - (1-CA)*aA - (1-CB)*aB  except not quite
>  aO = aA + aB

I thought what Safari does is basically "lighter", but with the
color components inverted (where inverting is CX = 1-CX, or cX = aX
- cX), so that it comes out to:

 aO = min(1, aA + aB)
 cO = aO - min(1, aA - cA + aB - cB)

> you change alpha from 0.0 to 0.01. In all the implementations,
> 'lighter' is confusingly unlike 'darker' - names like 'plus' and
> 'multiply' make much more sense.)

Hrm.  I thought lighter was confusingly *like* darker, in that they
act exactly the same when the alphas add to less than or equal to 1.
(I think that's true for plus (a.k.a. lighter), Cocoa's darker, and
for saturate.)

-David

-- 
L. David Baron                                <URL: http://dbaron.org/ >
           Technical Lead, Layout & CSS, Mozilla Corporation

Attachment: pgpIxMGYtZA1W.pgp
Description: PGP signature

Reply via email to