[cairo] [RFC] Cairo operators expressed in shader syntax

Behdad Esfahbod behdad at behdad.org
Sat May 12 12:13:12 PDT 2007


On Fri, 2007-05-11 at 19:22 -0400, Daniel Amelang wrote:
> 
> As you can see below, I define a new operator "COMPONENT_IN", and
> illustrate its behavior by example. It's likely that I'll just use
> this new operator internally for the purposes of this project, but I
> thought it might be worth discussing. If you follow the reasoning
> further, you'll notice that COMPONENT_OUT and COMPONENT_DEST_OUT
> operators are also possible, although I don't know how useful they
> would be. 

We've been talking about Render-style component-alpha masks for a while.
I even recently added it to TODO.

Ok, lets propose some API:

cairo_public void
cairo_paint_with_component_alpha (cairo_t *cr,
                                  double   red,
                                  double   green,
                                  double   blue,
                                  double   alpha);

cairo_public void
cairo_mask_components (cairo_t         *cr,
                       cairo_pattern_t *pattern);

cairo_public void
cairo_mask_surface_components (cairo_t         *cr,
                               cairo_surface_t *surface,
                               double           surface_x,
                               double           surface_y);

Better name suggestions?  Another approach is to make it a pattern
property.  That doesn't solve the paint_with_component_alpha usecase,
nor would it remove need for convenience cairo_mask_surface_components()
to go with cairo_mask_surface().  The implementation will be more
straightforward with a pattern property I guess, and doesn't need
extending backend interface/

Do PDF/AVG support component alpha masking?  PS, Quartz, Win32?

-- 
behdad
http://behdad.org/

"Those who would give up Essential Liberty to purchase a little
 Temporary Safety, deserve neither Liberty nor Safety."
        -- Benjamin Franklin, 1759





More information about the cairo mailing list