Code

use LoadPathVector instead of LoadArtBPath everywhere
[inkscape.git] / src / display / nr-filter-convolve-matrix.h
1 #ifndef __NR_FILTER_CONVOLVE_MATRIX_H__
2 #define __NR_FILTER_CONVOLVE_MATRIX_H__
4 /*
5  * feConvolveMatrix filter primitive renderer
6  *
7  * Authors:
8  *   Felipe CorrĂȘa da Silva Sanches <felipe.sanches@gmail.com>
9  *
10  * Copyright (C) 2007 authors
11  *
12  * Released under GNU GPL, read the file 'COPYING' for more information
13  */
15 #include "display/nr-filter-primitive.h"
16 #include "display/nr-filter-slot.h"
17 #include "display/nr-filter-units.h"
18 #include "libnr/nr-matrix.h"
19 #include "libnr/nr-rect-l.h"
20 #include <vector>
22 namespace NR {
24 enum FilterConvolveMatrixEdgeMode {
25     CONVOLVEMATRIX_EDGEMODE_DUPLICATE,
26     CONVOLVEMATRIX_EDGEMODE_WRAP,
27     CONVOLVEMATRIX_EDGEMODE_NONE,
28     CONVOLVEMATRIX_EDGEMODE_ENDTYPE
29 };
31 class FilterConvolveMatrix : public FilterPrimitive {
32 public:
33     FilterConvolveMatrix();
34     static FilterPrimitive *create();
35     virtual ~FilterConvolveMatrix();
37     virtual int render(FilterSlot &slot, FilterUnits const &units);
38     virtual void area_enlarge(NRRectL &area, Matrix const &trans);
39     virtual FilterTraits get_input_traits();
41     void set_targetY(int coord);
42     void set_targetX(int coord);
43     void set_orderY(int coord);
44     void set_orderX(int coord);
45     void set_kernelMatrix(std::vector<gdouble>& km);
46     void set_bias(double b);
47     void set_divisor(double d);
48     void set_edgeMode(FilterConvolveMatrixEdgeMode mode);    
49     void set_preserveAlpha(bool pa);
51 private:
52     std::vector<gdouble> kernelMatrix;
53     int targetX, targetY;
54     int orderX, orderY;
55     gdouble divisor, bias;
56     int dx, dy, kernelUnitLength;
57     FilterConvolveMatrixEdgeMode edgeMode;
58     bool preserveAlpha;
59 };
61 } /* namespace NR */
63 #endif /* __NR_FILTER_CONVOLVE_MATRIX_H__ */
64 /*
65   Local Variables:
66   mode:c++
67   c-file-style:"stroustrup"
68   c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
69   indent-tabs-mode:nil
70   fill-column:99
71   End:
72 */
73 // vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 :