36a048753a41b465ae130b361fb3b68c605e3e86kiirala * SVG filters rendering
36a048753a41b465ae130b361fb3b68c605e3e86kiirala * Niko Kiirala <niko@kiirala.com>
fb86717633bfcfe161571aed7058ea6a39b7a69bkiirala * Copyright (C) 2006-2007 Niko Kiirala
36a048753a41b465ae130b361fb3b68c605e3e86kiirala * Released under GNU GPL, read the file 'COPYING' for more information
4d2111f1991274cf80f89219637fca969697e661Krzysztof Kosiński virtual void render_cairo(FilterSlot &slot);
7f18e8ab01ce21c98cc7b9f58ffe5e771ebbb64eLiam P. White virtual int render(FilterSlot & /*slot*/, FilterUnits const & /*units*/) { return 0; } // pure virtual?
7bda77e763c0af49270427593108b66455dfd125Krzysztof Kosinski virtual void area_enlarge(Geom::IntRect &area, Geom::Affine const &m);
36a048753a41b465ae130b361fb3b68c605e3e86kiirala * Sets the input slot number 'slot' to be used as input in rendering
36a048753a41b465ae130b361fb3b68c605e3e86kiirala * filter primitive 'primitive'
36a048753a41b465ae130b361fb3b68c605e3e86kiirala * For filter primitive types accepting more than one input, this sets the
36a048753a41b465ae130b361fb3b68c605e3e86kiirala * first input.
36a048753a41b465ae130b361fb3b68c605e3e86kiirala * If any of the required input slots is not set, the output of previous
36a048753a41b465ae130b361fb3b68c605e3e86kiirala * filter primitive is used, or SourceGraphic if this is the first
36a048753a41b465ae130b361fb3b68c605e3e86kiirala * primitive for this filter.
36a048753a41b465ae130b361fb3b68c605e3e86kiirala * Sets the input slot number 'slot' to be user as input number 'input' in
36a048753a41b465ae130b361fb3b68c605e3e86kiirala * rendering filter primitive 'primitive'
36a048753a41b465ae130b361fb3b68c605e3e86kiirala * First input for a filter primitive is number 0. For primitives with
36a048753a41b465ae130b361fb3b68c605e3e86kiirala * attributes 'in' and 'in2', these are numbered 0 and 1, respectively.
36a048753a41b465ae130b361fb3b68c605e3e86kiirala * If any of required input slots for a filter is not set, the output of
36a048753a41b465ae130b361fb3b68c605e3e86kiirala * previous filter primitive is used, or SourceGraphic if this is the first
36a048753a41b465ae130b361fb3b68c605e3e86kiirala * filter primitive for this filter.
36a048753a41b465ae130b361fb3b68c605e3e86kiirala * Sets the slot number 'slot' to be used as output from filter primitive
36a048753a41b465ae130b361fb3b68c605e3e86kiirala * 'primitive'
36a048753a41b465ae130b361fb3b68c605e3e86kiirala * If output slot for a filter element is not set, one of the unused image
36a048753a41b465ae130b361fb3b68c605e3e86kiirala * slots is used.
36a048753a41b465ae130b361fb3b68c605e3e86kiirala * It is an error to specify a pre-defined slot as 'slot'. Such call does
36a048753a41b465ae130b361fb3b68c605e3e86kiirala * not have any effect to the state of filter or its primitives.
1cf2607271f83cc4b20ccace552395d793055c90Krzysztof Kosiński // returns cache score factor, reflecting the cost of rendering this filter
1cf2607271f83cc4b20ccace552395d793055c90Krzysztof Kosiński // this should return how many times slower this primitive is that normal rendering
1cf2607271f83cc4b20ccace552395d793055c90Krzysztof Kosiński virtual double complexity(Geom::Affine const &/*ctm*/) { return 1.0; }
d1eeafe871c5909edd05ee72dfa603533ad39a87Krzysztof Kosiński if (_input == NR_FILTER_BACKGROUNDIMAGE || _input == NR_FILTER_BACKGROUNDALPHA) {
36a048753a41b465ae130b361fb3b68c605e3e86kiirala * Sets the filter primitive subregion. Passing an unset length
7c89b734639fa72a5d2ffdc9cf1f7ab22eff67f1tavmjong-free * (length._set == false) WILL change the parameter as it is
7c89b734639fa72a5d2ffdc9cf1f7ab22eff67f1tavmjong-free * important to know if a parameter is unset.
7c89b734639fa72a5d2ffdc9cf1f7ab22eff67f1tavmjong-free void set_subregion(SVGLength const &x, SVGLength const &y,
7c89b734639fa72a5d2ffdc9cf1f7ab22eff67f1tavmjong-free SVGLength const &width, SVGLength const &height);
36a048753a41b465ae130b361fb3b68c605e3e86kiirala * Resets the filter primitive subregion to its default value
7c89b734639fa72a5d2ffdc9cf1f7ab22eff67f1tavmjong-free * Returns the filter primitive area in user coordinate system.
7c89b734639fa72a5d2ffdc9cf1f7ab22eff67f1tavmjong-free Geom::Rect filter_primitive_area(FilterUnits const &units);
712a383b4aa88de4041f1d6247719e2c3a5800d8Jon A. Cruz *Indicate whether the filter primitive can handle the given affine.
7059798b454ecd2386eb02769ad8d9c6d9d5f98eKrzysztof Kosiński * Results of some filter primitives depend on the coordinate system used when rendering.
8635140fb4734dae6ae5f42e1db9778749ef024aKrzysztof Kosiński * A gaussian blur with equal x and y deviation will remain unchanged by rotations.
7059798b454ecd2386eb02769ad8d9c6d9d5f98eKrzysztof Kosiński * Per-pixel filters like color matrix and blend will not change regardless of
7059798b454ecd2386eb02769ad8d9c6d9d5f98eKrzysztof Kosiński * the transformation.
7059798b454ecd2386eb02769ad8d9c6d9d5f98eKrzysztof Kosiński * When any filter returns false, filter rendering is performed on an intermediate surface
7059798b454ecd2386eb02769ad8d9c6d9d5f98eKrzysztof Kosiński * with edges parallel to the axes of the user coordinate system. This means
7059798b454ecd2386eb02769ad8d9c6d9d5f98eKrzysztof Kosiński * the matrices from FilterUnits will contain at most a (possibly non-uniform) scale
1cf2607271f83cc4b20ccace552395d793055c90Krzysztof Kosiński * and a translation. When all primitives of the filter return true, the rendering is
712a383b4aa88de4041f1d6247719e2c3a5800d8Jon A. Cruz * performed in display coordinate space and no intermediate surface is used.
dff9bb0d25ad38c515c32e2c76a20e747c8eed10Krzysztof Kosiński virtual bool can_handle_affine(Geom::Affine const &) { return false; }
9f6f7e74a1ded383518676e0ecb2ccc5caa73d25tavmjong-free * Sets style for access to properties used by filter primitives.
7c89b734639fa72a5d2ffdc9cf1f7ab22eff67f1tavmjong-free /* Filter primitive subregion */
d9a7c806ee7f408ddb61ff4f233c9d96111ee2b5johanengelen} /* namespace Filters */
d9a7c806ee7f408ddb61ff4f233c9d96111ee2b5johanengelen} /* namespace Inkscape */
36a048753a41b465ae130b361fb3b68c605e3e86kiirala#endif /* __NR_FILTER_PRIMITIVE_H__ */
36a048753a41b465ae130b361fb3b68c605e3e86kiirala Local Variables:
36a048753a41b465ae130b361fb3b68c605e3e86kiirala c-file-style:"stroustrup"
36a048753a41b465ae130b361fb3b68c605e3e86kiirala c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
36a048753a41b465ae130b361fb3b68c605e3e86kiirala indent-tabs-mode:nil
36a048753a41b465ae130b361fb3b68c605e3e86kiirala fill-column:99
a4030d5ca449e7e384bc699cd249ee704faaeab0Chris Morgan// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 :