[cairo] Alpha masks

Carl Worth cworth at redhat.com
Thu Jan 6 10:23:20 PST 2005


On Thu, 06 Jan 2005 11:58:51 -0500, Owen Taylor wrote:
> Well, with the "mask is shape model", then the natural way to represent
> that for arbitrary masks is using the surface as a pattern and drawing
> the mask. 

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.

I'd like both operations to be convenient. So I think we'll need at
least one new function call.

> Another possibility is that the alpha value *multiplies* the alpha value for patterns
> with an alpha value. That complicates implementation, but probably less so than the
> generalizing the alpha to a mask operand.

I think I like that. Allowing set_alpha to affect all drawing
operations strengthens my original inclination to keep it separate
from set_rgb_color.

> So the drawing equation becomes something like:
> 
>  ((PATTERN IN ALPHA) IN (SHAPE IN CLIP)) OP DEST

Looks good.

> [Of course, we still need to deal with the issue that of clips that
> don't clip for certain operators]

Yes. And that thread's still in my inbox too. I'm into September now,
and catching up...

> Which is another strong argument for a separate show_surface_mask()
> operator, rather than just wedging it into the unused corners of
> show_surface(). 

Good. I feel consensus forming.

> I don't think show_surface_mask() is decomposable into other operators,
> unless we add a separate mask operand. (And I wouldn't recommend doing that.)

OK, I can live with that.

-Carl



More information about the cairo mailing list