- From: L. David Baron <dbaron@dbaron.org>
- Date: Sun, 20 May 2007 15:30:15 -0700
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 -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 189 bytes Desc: not available URL: <http://lists.whatwg.org/pipermail/whatwg-whatwg.org/attachments/20070520/b9486d16/attachment.pgp>
Received on Sunday, 20 May 2007 15:30:15 UTC