Code

Fixed const/non-const mismatch loop.
[inkscape.git] / src / sp-pattern.h
1 #ifndef SEEN_SP_PATTERN_H
2 #define SEEN_SP_PATTERN_H
4 /*
5  * SVG <pattern> implementation
6  *
7  * Author:
8  *   Lauris Kaplinski <lauris@kaplinski.com>
9  *   Abhishek Sharma
10  *
11  * Copyright (C) 2002 Lauris Kaplinski
12  *
13  * Released under GNU GPL, read the file 'COPYING' for more information
14  */
16 #include <gtk/gtktypeutils.h>
18 #include "forward.h"
19 #include "sp-item.h"
20 #define SP_TYPE_PATTERN (sp_pattern_get_type ())
21 #define SP_PATTERN(o) (GTK_CHECK_CAST ((o), SP_TYPE_PATTERN, SPPattern))
22 #define SP_PATTERN_CLASS(k) (GTK_CHECK_CLASS_CAST ((k), SP_TYPE_PATTERN, SPPatternClass))
23 #define SP_IS_PATTERN(o) (GTK_CHECK_TYPE ((o), SP_TYPE_PATTERN))
24 #define SP_IS_PATTERN_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), SP_TYPE_PATTERN))
26 GType sp_pattern_get_type (void);
28 class SPPatternClass;
30 #include <libnr/nr-rect.h>
31 #include <libnr/nr-matrix.h>
32 #include "svg/svg-length.h"
33 #include "sp-paint-server.h"
34 #include "uri-references.h"
36 #include <sigc++/connection.h>
38 class SPPatternReference : public Inkscape::URIReference {
39 public:
40     SPPatternReference (SPObject *obj) : URIReference(obj) {}
41     SPPattern *getObject() const {
42         return (SPPattern *)URIReference::getObject();
43     }
45 protected:
46     virtual bool _acceptObject(SPObject *obj) const {
47         return SP_IS_PATTERN (obj);
48     }
49 };
51 enum {
52     SP_PATTERN_UNITS_USERSPACEONUSE,
53     SP_PATTERN_UNITS_OBJECTBOUNDINGBOX
54 };
56 struct SPPattern : public SPPaintServer {
57     /* Reference (href) */
58     gchar *href;
59     SPPatternReference *ref;
61     /* patternUnits and patternContentUnits attribute */
62     guint patternUnits : 1;
63     guint patternUnits_set : 1;
64     guint patternContentUnits : 1;
65     guint patternContentUnits_set : 1;
66     /* patternTransform attribute */
67     Geom::Matrix patternTransform;
68     guint patternTransform_set : 1;
69     /* Tile rectangle */
70     SVGLength x;
71     SVGLength y;
72     SVGLength width;
73     SVGLength height;
74     /* VieBox */
75     NRRect viewBox;
76     guint viewBox_set : 1;
78     sigc::connection modified_connection;
79 };
81 struct SPPatternClass {
82     SPPaintServerClass parent_class;
83 };
85 guint pattern_users (SPPattern *pattern);
86 SPPattern *pattern_chain (SPPattern *pattern);
87 SPPattern *sp_pattern_clone_if_necessary (SPItem *item, SPPattern *pattern, const gchar *property);
88 void sp_pattern_transform_multiply (SPPattern *pattern, Geom::Matrix postmul, bool set);
90 const gchar *pattern_tile (GSList *reprs, Geom::Rect bounds, SPDocument *document, Geom::Matrix transform, Geom::Matrix move);
92 SPPattern *pattern_getroot (SPPattern *pat);
94 guint pattern_patternUnits (SPPattern *pat);
95 guint pattern_patternContentUnits (SPPattern *pat);
96 Geom::Matrix const &pattern_patternTransform(SPPattern const *pat);
97 gdouble pattern_x (SPPattern *pat);
98 gdouble pattern_y (SPPattern *pat);
99 gdouble pattern_width (SPPattern *pat);
100 gdouble pattern_height (SPPattern *pat);
101 NRRect *pattern_viewBox (SPPattern *pat);
103 #endif // SEEN_SP_PATTERN_H
105 /*
106   Local Variables:
107   mode:c++
108   c-file-style:"stroustrup"
109   c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
110   indent-tabs-mode:nil
111   fill-column:99
112   End:
113 */
114 // vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 :