[cairo] Compositing strategies and pre-multiplied alpha
Behdad Esfahbod
behdad at cs.toronto.edu
Wed Sep 21 15:21:00 PDT 2005
On Wed, 21 Sep 2005, Mauricio Piacentini wrote:
> to compare two scenarios:
>
> a) Get a red background
> b) Render shape directly, antialias would be calculated to red
>
> versus
>
> a) Get a red background
> b) Composite a pre-multiplied image (rendered over a black background)
> over it.
>
> The second scenario (in my twisted mind) would produce worse antialias,
> since colors would already be altered by the precompositing to black.
No.
> But now thinking about it I can see that maybe the results would be the
> same, namely red + a given transparency since black would not skew the
> results... doh. Maybe this makes a difference only if you need to
> process the image further, like trying to increase brightness, as some
> color information (resolution) in the pre-multiplied pixels would be
> lost. But quality would actually be the same for the common scenario of
> simply compositing the layers.
This is all true. Note that the whole pre-multiplied idea is
only about representation and computation. The results are the
same analytically, and almost the same up to some precision.
> I will experiment with this a bit more in a prototype.
>
> Regards,
> Mauricio
--behdad
http://behdad.org/
More information about the cairo
mailing list