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

Daniel Amelang daniel.amelang at gmail.com
Sat May 12 14:23:42 PDT 2007


On 5/12/07, Behdad Esfahbod <behdad at behdad.org> wrote:
>
> 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);

Why not leverage our underlying mathematical model to solve the
problem? I propose this instead:

cairo_public
void cairo_set_mask_operator (cairo_t *cr,
                                            cairo_operator_t op);

and add CAIRO_OPERATOR_COMPONENT_IN to cairo_operator_t.

Current cairo would only support CAIRO_OPERATOR_IN and
CAIRO_OPERATOR_COMPONENT_IN as arguments for the moment. Although if I
succeed in my current endeavours, this restriction could be lifted.

Your proposed "cairo_paint_with_component_alpha" might still be
useful, although I would wait until someone asked for it. AFAIK,
component alpha at the moment is only used for text rendering (e.g.
cleartype), so a whole surface paint with component alpha may not make
sense (yet). I say wait and see.

Dan Amelang


More information about the cairo mailing list