[cairo] filters/image processing

MenTaLguY mental at rydia.net
Fri Mar 24 18:20:03 PST 2006


Okay, here's what I'm thinking at the moment.  We keep the composable
pattern stuff, but add pipelines, which are composable pattern
factories:

 typedef struct _cairo_pipeline_t cairo_pipeline_t;

 cairo_pipeline_t *
 cairo_pipeline_create_from_pattern (cairo_pattern_t *pattern);

 cairo_pipeline_t *
 cairo_pipeline_copy (cairo_pipeline_t *pipeline);

 cairo_pipeline_t *
 cairo_pipeline_reference (cairo_pipeline_t *pipeline);

 void
 cairo_pipeline_destroy (cairo_pipeline_t *pipeline);

 /* singleton representing pipeline input */
 cairo_pipeline_t *
 cairo_pipeline_input (void);

 /* should variables be flyweights? */
 cairo_pipeline_t *
 cairo_pipeline_variable (const char *name);

 /* each nontrivial cairo_pipeline_t has its own symbol table
    which inherits from downstream at evaluation time */
 void
 cairo_pipeline_assign (cairo_pipeline_t *pipeline,
                        const char *name,
                        cairo_pipeline_t *value);

 void
 cairo_pipeline_assign_from_pattern (cairo_pipeline_t *pipeline,
                                     const char *name,
                                     cairo_pattern_t *value);

 cairo_pattern_t *
 cairo_pattern_create_from_pipeline (cairo_pipeline_t *pipeline,
                                     cairo_pattern_t *input);

 /* parallel to cairo_gaussian_blur_pattern_create() */
 cairo_pipeline_t *
 cairo_gaussian_blur_pipeline_create (cairo_pipeline_t *source,
                                      double radius);

 /* and maybe? */
 void
 cairo_set_mask_pipeline (cairo_t *ctx, cairo_pipeline_t *pipeline);

So then:

 cairo_pipeline_t *blur=
   cairo_gaussian_blur_pipeline_create (cairo_pipeline_input(), 3.0);
 cairo_set_mask_pipeline (ctx, blur);
 cairo_pipeline_destroy (blur);

What do you think?

-mental

-------------- 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/20060324/bbaa2229/attachment.pgp


More information about the cairo mailing list