[cairo] Alpha masks

Keith Packard keithp at keithp.com
Thu Jan 6 11:51:34 PST 2005


Around 13 o'clock on Jan 6, Carl Worth wrote:

> Right. But I'm thinking about "display image at 50% opacity". Having
> to create a pattern and a mask for this operation would make it just
> as hard as the original complaint about drawing a solid color through
> a mask.

As cairo_set_rgb_color creates a source pattern, should cairo_set_alpha 
create a mask pattern?  Should we expose this 'mask pattern' as a part of 
the drawing pipeline?

	dst = (src IN (path IN mask IN CLIP)) OP dst

This has the minor advantage of clarifying the relationship between 
cairo_set_rgb_color and cairo_set_alpha as to whether the rgb values 
should be premultiplied.

We would then add:

	cairo_set_mask_pattern (cairo_t *cr, cairo_pattern_t *pattern)

and you could get at the Plan 9 operator with:

	cairo_set_pattern (cr, source);
	cairo_set_mask_pattern (cr, mask);
	cairo_rectangle (cr, x, y, w, h);
	cairo_fill (cr)

At this point, making common operations more convenient really is just a 
matter of convenience functions.

-keith


-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 228 bytes
Desc: not available
Url : http://lists.freedesktop.org/archives/cairo/attachments/20050106/255e3cb2/attachment.pgp


More information about the cairo mailing list