[cairo] filters/image processing

MenTaLguY mental at rydia.net
Fri Mar 24 16:03:57 PST 2006

On Fri, 2006-03-24 at 10:44 -0800, Carl Worth wrote:
> On Fri, 24 Mar 2006 13:23:28 -0500, MenTaLguY wrote:
> > 
> > Bonus points if these were composable into pipelines somehow.
> > 
> This is the kind of thing I've always ended up wanting when I've given
> any thought to this.
> Any idea how that might look in a way which "fits" within cairo's
> rendering model? or even just its API?

Hmm.  After some consideration, I think the existing
cairo_pattern_{set,get}_filter stuff is totally orthogonal to what we
really want for SVG filters and should be left as-is.

How about "filters" as composed patterns?  I suspect that shouldn't
require any changes to existing APIs, at least not external ones.

For example (not the best function name, but it'll do for discussion):

 cairo_pattern_t *cairo_filter_gaussian_blur(cairo_pattern_t *source, 
                                             double radius);

This would create a new pattern which was the gaussian blurred version
of the source pattern.

As you can see, since the input and output are both patterns, we get
chaining/composition/pipelines for free (from an API perspective).

I think the output of such filter patterns should generally be infinite
(source data not supplied by the source patterns(s) would be assumed to
be transparent black, or whatever makes the most sense for the
particular filter).

For simplicity's sake, caching/memoization should probably be done
explicitly by painting to an intermediate surface.  By itself,
intermediate pattern wouldn't introduce any persistent intermediate
image, so we don't have to worry about invalidation logic etc.

What do you think?

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

More information about the cairo mailing list