Code

use all 2geom typed pathv_matrix_point_bbox_wind_distance
[inkscape.git] / src / display / nr-filter-units.h
1 #ifndef __NR_FILTER_UNITS_H__
2 #define __NR_FILTER_UNITS_H__
4 /*
5  * Utilities for handling coordinate system transformations in filters
6  *
7  * Author:
8  *   Niko Kiirala <niko@kiirala.com>
9  *
10  * Copyright (C) 2007 Niko Kiirala
11  *
12  * Released under GNU GPL, read the file 'COPYING' for more information
13  */
15 #include "sp-filter-units.h"
16 #include "libnr/nr-matrix.h"
17 #include "libnr/nr-rect.h"
18 #include "libnr/nr-rect-l.h"
20 namespace NR {
22 class FilterUnits {
23 public:
24     FilterUnits();
25     FilterUnits(SPFilterUnits const filterUnits, SPFilterUnits const primitiveUnits);
27     /**
28      * Sets the current transformation matrix, i.e. transformation matrix
29      * from object's user coordinates to screen coordinates
30      */
31     void set_ctm(Matrix const &ctm);
33     /**
34      * Sets the resolution, the filter should be rendered with.
35      */
36     void set_resolution(double const x_res, double const y_res);
38     /**
39      * Sets the item bounding box in user coordinates
40      */
41     void set_item_bbox(Rect const &bbox);
43     /**
44      * Sets the filter effects area in user coordinates
45      */
46     void set_filter_area(Rect const &area);
48     /**
49      * Sets, if x and y axis in pixblock coordinates should be paraller
50      * to x and y of user coordinates.
51      */
52     void set_paraller(bool const paraller);
54     /**
55      * Sets, if filter resolution is automatic.
56      * NOTE: even if resolution is automatic, it must be set with
57      * set_resolution. This only tells, if the set value is automatic.
58      */
59     void set_automatic_resolution(bool const automatic);
61     /**
62      * Gets the user coordinates to pixblock coordinates transformation matrix.
63      */
64     Matrix get_matrix_user2pb() const;
66     /**
67      * Gets the filterUnits to pixblock coordinates transformation matrix.
68      */
69     Matrix get_matrix_filterunits2pb() const;
71     /**
72      * Gets the primitiveUnits to pixblock coordinates transformation matrix.
73      */
74     Matrix get_matrix_primitiveunits2pb() const;
76     /**
77      * Gets the display coordinates to pixblock coordinates transformation
78      * matrix.
79      */
80     Matrix get_matrix_display2pb() const;
82     /**
83      * Gets the pixblock coordinates to display coordinates transformation
84      * matrix
85      */
86     Matrix get_matrix_pb2display() const;
88     /**
89      * Gets the user coordinates to filterUnits transformation matrix.
90      */
91     Matrix get_matrix_user2filterunits() const;
93     /**
94      * Gets the user coordinates to primitiveUnits transformation matrix.
95      */
96     Matrix get_matrix_user2primitiveunits() const;
98     /**
99      * Returns the filter area in pixblock coordinates.
100      * NOTE: use only in filters, that define TRAIT_PARALLER in
101      * get_input_traits. The filter effects area may not be representable
102      * by simple rectangle otherwise. */
103     IRect get_pixblock_filterarea_paraller() const;
105     FilterUnits& operator=(FilterUnits const &other);
107 private:
108     Matrix get_matrix_units2pb(SPFilterUnits units) const;
109     Matrix get_matrix_user2units(SPFilterUnits units) const;
111     SPFilterUnits filterUnits, primitiveUnits;
112     double resolution_x, resolution_y;
113     bool paraller_axis;
114     bool automatic_resolution;
115     Matrix ctm;
116     Rect item_bbox;
117     Rect filter_area;
119 };
122 } // namespace NR
125 #endif /* __NR_FILTER_UNITS_H__ */
126 /*
127   Local Variables:
128   mode:c++
129   c-file-style:"stroustrup"
130   c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
131   indent-tabs-mode:nil
132   fill-column:99
133   End:
134 */
135 // vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 :