[cairo] filters/image processing
mental at rydia.net
Fri Mar 24 10:23:28 PST 2006
On Fri, 24 Mar 2006 08:31:17 -0800, Carl Worth <cworth at cworth.org> wrote:
> As for what filter types to add, I think that "can be accelerated in
> hardware" is a pretty good criterion for inclusion in cairo.
> As for a bunch of the other SVG filter types, I'm less confident that
> we'll see a lot of hardware support for them. I don't think it makes
> sense to complicate the cairo API for these if they're all going to
> end up in software anyway. (Though, if someone can convince
> programmable GPUs to do these, then there's a different question to be
> asked---so let me know if you know someone that has figured that out.)
Hmm, as far as I can tell pretty much all the SVG filter types (which are actually filters versus those like e.g. feFlood or feTile) _can_ be implemented on modern GPUs. IIRC, people already write shaders that generate perlin noise, so there's no reason to suppose the GPU couldn't be used to implement even feTurbulence.
I think it would also be good to provide some general-purpose (acceleratable) building blocks atop which some of the standard SVG filters (perhaps aside from stuff like e.g. feTurbulence) could be implemented. Probably something like the set of primitives offered by most vector/matrix libraries.
That probably means the following (maskable) operations:
- apply convolution matrix to selected channel(s)
- set selected channel(s) to a scalar
- add/subtract/multiply/divide selected channel(s) by a scalar
- copy selected channel(s) from selected channel (in same or other pattern?)
- add/subtract/multiply/divide selected channel(s) by a selected channel
(in same or other pattern?)
- selected channel (in same or other pattern?) to mask
- mask to selected channel(s) (in same or other pattern?)
- generate mask from predicate (greater than/less than/etc?)
Bonus points if these were composable into pipelines somehow.
What do you think?
More information about the cairo