[cairo] Inefficiency of _cairo_xlib_surface_composite

Owen Taylor otaylor at redhat.com
Thu Jan 27 21:08:38 PST 2005


On Thu, 2005-01-27 at 21:04 -0800, Bill Spitzak wrote:
> 
> Jason Dorje Short wrote:
> 
> >>> - If the operation is OVER or SRC and there is a mask, but the mask is
> >>> only 1-bit (all alpha values either 255 or 0), then XCopyArea can be
> >>> used with a monochrome bitmap as a mask.
> 
> >> This is wrong if Cairo assumes images are premultiplied. It would only 
> >> work if the rgb is 0 where the alpha is 0.
> > 
> > I don't understand this.
> 
> The function for OVER is A+B*(1-a) where A and B are the color and a is 
> the alpha. If a is zero, this reduces to A+B which is not equal to B 
> unless A==0.
> 
> Notice that in non-premultiplied compositing, the result is A*a+B*(1-a) 
> which does reduce to just B when a is zero. For this and some other 
> reasons I think it may be a good idea to support non-premultiplied images.

But separate masks (what is discussed here) are implicitly 
non-premultiplied alpha.

The RENDER/Cairo equation of 

 (SRC IN MASK) OP DEST

Will give R,G,B components of 0 for (SRC IN MASK) where MASK is 0.

Regards,
						Owen

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
Url : http://lists.freedesktop.org/archives/cairo/attachments/20050128/23ef5c8b/attachment.pgp


More information about the cairo mailing list