[cairo] Alpha masks

Carl Worth cworth at cworth.org
Thu Jan 6 15:03:48 PST 2005


On Thu, 06 Jan 2005 13:38:16 -0800, Keith Packard wrote:
> Carl and I discussed this a bit last year and came up with a very simple 
> proposal, which is well defined, but may not be as useful as we'd like.  
> 
> That is to simply treat the 'clip' as another part of the 'mask' and 
> accept the fact that areas beyond the clip will be modified in the 
> destination.  All of the operations remain well defined, although their 
> utility may be strongly compromised in some cases.  Do an 'IN' operation 
> with an empty clip and the entire destination surface will be
> erased.

Actually, I recall a slightly different conversation. What I started
with was an example of a defect in the RENDER implementation of its
fundamental operator:

	dest = (src IN mask) OP dest

I first ran into the bug when I tried using this operator with mask ==
clip_surface in cairo. The bug is that with OP == IN, the current
implementation computes "(src IN mask) IN dest" within the region of
the union of src and mask bounding boxes, but leaves dest unchanged
elsewhere.

So, given the above definition of the operator, this is just a bug,
and the correct result would clear everything in dest outside of that
bounding region.

However, the question of how to get clipping to behave as desired in
cairo is completely separate. I've got some new thoughts on that which
I will save for a later message.

I will say, however, that I've identified a compelling reason for
exposing the fundamental operator in the cairo API. It would be really
nice to have it available for doing the exploration and testing I want
to do right now.

-Carl



More information about the cairo mailing list