[cairo] Alpha masks
Owen Taylor
otaylor at redhat.com
Thu Jan 6 12:22:47 PST 2005
On Thu, 2005-01-06 at 11:51 -0800, Keith Packard wrote:
> 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.
I think in terms of the original requested operation (basically, use
an A8 surface in place of a polygon or set of glyphs), this doesn't
fit very will.
In order to allow the alpha value to affect images/patterns with
alpha, it needs to replace 'mask' in the above, rather than being
the 4th component of 'src'. That's why show_surface_mask() should
replace 'path' in the above.
(Replacing 'path' also makes it very natural to do path arithmetic
on a temporary surface and then use the result as a path-like object)
Given the ability to replace 'path' in the above with an image, I
don't think it hurts to have a generalized mask rather than an
alpha value as I had it. But I don't think it's that useful either.
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/20050106/3b2ff2cf/attachment.pgp
More information about the cairo
mailing list