Code

the SP_IS_GAUSSIANBLUR fix is not only for shapes. fixme: this boilerplate definitely...
[inkscape.git] / src / display / nr-filter-primitive.h
1 #ifndef __NR_FILTER_PRIMITIVE_H__
2 #define __NR_FILTER_PRIMITIVE_H__
4 /*
5  * SVG filters rendering
6  *
7  * Author:
8  *   Niko Kiirala <niko@kiirala.com>
9  *
10  * Copyright (C) 2006 Niko Kiirala
11  *
12  * Released under GNU GPL, read the file 'COPYING' for more information
13  */
15 #include "display/nr-filter-slot.h"
16 #include "libnr/nr-pixblock.h"
17 #include "libnr/nr-matrix.h"
18 #include "svg/svg-length.h"
20 namespace NR {
22 class FilterPrimitive {
23 public:
24     FilterPrimitive();
25     virtual ~FilterPrimitive();
27     int render(FilterSlot &slot, NRMatrix const *trans);
28     virtual int render(FilterSlot &slot, Matrix const &trans) = 0;
29     virtual int get_enlarge(Matrix const &m);
31     /**
32      * Sets the input slot number 'slot' to be used as input in rendering
33      * filter primitive 'primitive'
34      * For filter primitive types accepting more than one input, this sets the
35      * first input.
36      * If any of the required input slots is not set, the output of previous
37      * filter primitive is used, or SourceGraphic if this is the first
38      * primitive for this filter.
39      */
40     virtual void set_input(int slot);
42     /**
43      * Sets the input slot number 'slot' to be user as input number 'input' in
44      * rendering filter primitive 'primitive'
45      * First input for a filter primitive is number 0. For primitives with
46      * attributes 'in' and 'in2', these are numbered 0 and 1, respectively.
47      * If any of required input slots for a filter is not set, the output of
48      * previous filter primitive is used, or SourceGraphic if this is the first
49      * filter primitive for this filter.
50      */
51     virtual void set_input(int input, int slot);
53     /**
54      * Sets the slot number 'slot' to be used as output from filter primitive
55      * 'primitive'
56      * If output slot for a filter element is not set, one of the unused image
57      * slots is used.
58      * It is an error to specify a pre-defined slot as 'slot'. Such call does
59      * not have any effect to the state of filter or its primitives.
60      */
61     virtual void set_output(int slot);
63     void set_x(SVGLength &length);
64     void set_y(SVGLength &length);
65     void set_width(SVGLength &length);
66     void set_height(SVGLength &length);
68     /**
69      * Sets the filter primitive subregion. Passing an unset length
70      * (length._set == false) as any parameter results in that parameter
71      * not being changed.
72      * Filter primitive will not hold any references to the passed
73      * SVGLength object after function returns.
74      * If any of the parameters does not get set the default value, as
75      * defined in SVG standard, for that parameter is used instead.
76      */
77     void set_region(SVGLength &x, SVGLength &y,
78                     SVGLength &width, SVGLength &height);
80     /**
81      * Resets the filter primitive subregion to its default value
82      */
83     void reset_region();
85 protected:
86     int _input;
87     int _output;
89     SVGLength _region_x;
90     SVGLength _region_y;
91     SVGLength _region_width;
92     SVGLength _region_height;
93 };
96 } /* namespace NR */
101 #endif /* __NR_FILTER_PRIMITIVE_H__ */
102 /*
103   Local Variables:
104   mode:c++
105   c-file-style:"stroustrup"
106   c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
107   indent-tabs-mode:nil
108   fill-column:99
109   End:
110 */
111 // vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 :