[cairo] filters/image processing

Mirco Müller macslow at bangang.de
Thu Aug 31 20:56:56 PDT 2006


Greetings MenTaLguY!

	Is the pipeline-able filter-API you wish for cairo "feature-complete"
from your point of view (see end of email for reference)?

I think a call like:

cairo_pipeline_t*
cairo_convolve_pipeline_create (cairo_pipeline_t* source,
				int m,
				int n,
				double** kernel);

should be added too. This could be our working-horse for...

	sharpen
	edge-detect
	emboss
	
and other general image-processing effects. Furthermore I would also
like to see some turbulence- or noise-generator in here (thinking of
"stealing" some parts of libpcg from Eric Anholt). I'm asking all this
because I wonder how bloated (read: convenient) we want the API to be
for making the jobs of the authors of librsvg, inkscape and the like
easier. Thus we see a quick adoption filters put forth by...

	http://www.w3.org/TR/SVG11/filters.html

in the domain of OpenSource-apps. Also I like to get input form anybody
regarding the mapping of filters to the GPU. Because I don't want this
to be just and afterthought. I'm mainly thinking of glitz here. So
davidr, were are you? :)

The suggested API from MenTaLguY:

>  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);

Best regards...

Mirco "MacSlow" Müller

-- 
email - macslow at bangang.de
www - http://macslow.thepimp.net
lowfat - http://macslow.thepimp.net/sponsor-it



More information about the cairo mailing list