~inkscape.dev/inkscape/trunk

9945.1.1 by Jon A. Cruz
Merge and cleanup of GSoC C++-ification project.
1
#ifndef SEEN_SP_PATTERN_H
2
#define SEEN_SP_PATTERN_H
1 by mental
moving trunk for module inkscape
3
4
/*
5
 * SVG <pattern> implementation
6
 *
7
 * Author:
8
 *   Lauris Kaplinski <lauris@kaplinski.com>
9945.1.1 by Jon A. Cruz
Merge and cleanup of GSoC C++-ification project.
9
 *   Abhishek Sharma
1 by mental
moving trunk for module inkscape
10
 *
11
 * Copyright (C) 2002 Lauris Kaplinski
12
 *
13
 * Released under GNU GPL, read the file 'COPYING' for more information
14
 */
15
11608.1.123 by Markus Engel
Added runtime check in SP_-cast macros.
16
#define SP_PATTERN(obj) (dynamic_cast<SPPattern*>((SPObject*)obj))
11608.1.122 by Markus Engel
Modified SP_IS_ macros.
17
#define SP_IS_PATTERN(obj) (dynamic_cast<const SPPattern*>((SPObject*)obj) != NULL)
1 by mental
moving trunk for module inkscape
18
11608.1.111 by Markus Engel
Cleaned up a bit; fixed struct vs. class forward declarations.
19
class SPPatternReference;
13341.5.15 by Liam P. White
Update to experimental r13527
20
class SPItem;
13341.1.190 by Liam P. White
Header cleanup: stop using Glib types where they aren't truly needed. Eases GThread deprecation errors.
21
typedef struct _GSList GSList;
1 by mental
moving trunk for module inkscape
22
23
#include "svg/svg-length.h"
24
#include "sp-paint-server.h"
25
#include "uri-references.h"
13002 by tavmjong-free
Added new base class to handle viewBox and preserveAspectRatio.
26
#include "viewbox.h"
1 by mental
moving trunk for module inkscape
27
1509 by mental
switch to sigc++ SPObject signals for SPPattern
28
#include <sigc++/connection.h>
29
10667 by Jon A. Cruz
Cleanup for src/forward.h. (About 19 of the affected files did not require the contents forward.h at all).
30
13002 by tavmjong-free
Added new base class to handle viewBox and preserveAspectRatio.
31
class SPPattern : public SPPaintServer, public SPViewBox {
11608.1.35 by Markus Engel
Added "virtual pad" to
32
public:
11608.1.67 by Markus Engel
Added constructors to SP classes.
33
	SPPattern();
11608.1.82 by Markus Engel
Merged PaintServer and subclasses; moved Gradient classes to own files.
34
	virtual ~SPPattern();
11608.1.35 by Markus Engel
Added "virtual pad" to
35
6527 by johanengelen
whitespace
36
    /* Reference (href) */
13341.1.190 by Liam P. White
Header cleanup: stop using Glib types where they aren't truly needed. Eases GThread deprecation errors.
37
    char *href;
6527 by johanengelen
whitespace
38
    SPPatternReference *ref;
39
40
    /* patternUnits and patternContentUnits attribute */
13341.1.190 by Liam P. White
Header cleanup: stop using Glib types where they aren't truly needed. Eases GThread deprecation errors.
41
    unsigned int patternUnits : 1;
42
    unsigned int patternUnits_set : 1;
43
    unsigned int patternContentUnits : 1;
44
    unsigned int patternContentUnits_set : 1;
6527 by johanengelen
whitespace
45
    /* patternTransform attribute */
10025 by Johan Engelen
update to latest 2geom !
46
    Geom::Affine patternTransform;
13341.1.190 by Liam P. White
Header cleanup: stop using Glib types where they aren't truly needed. Eases GThread deprecation errors.
47
    unsigned int patternTransform_set : 1;
6527 by johanengelen
whitespace
48
    /* Tile rectangle */
49
    SVGLength x;
50
    SVGLength y;
51
    SVGLength width;
52
    SVGLength height;
53
54
    sigc::connection modified_connection;
11608.1.35 by Markus Engel
Added "virtual pad" to
55
13341.1.34 by Tomasz Boczkowski
fix compliance test pservers-pattern-03-f - using fallback when pattern is empty
56
    bool isValid() const;
57
11608.1.117 by Markus Engel
Cleaned up.
58
	virtual cairo_pattern_t* pattern_new(cairo_t *ct, Geom::OptRect const &bbox, double opacity);
59
60
protected:
11608.1.57 by Markus Engel
Renamed virtual function names.
61
	virtual void build(SPDocument* doc, Inkscape::XML::Node* repr);
62
	virtual void release();
63
	virtual void set(unsigned int key, const gchar* value);
64
	virtual void update(SPCtx* ctx, unsigned int flags);
65
	virtual void modified(unsigned int flags);
11608.1.35 by Markus Engel
Added "virtual pad" to
66
};
67
68
11608.1.64 by Markus Engel
Replaced all casting macros with glib-independent ones.
69
class SPPatternReference : public Inkscape::URIReference {
70
public:
71
    SPPatternReference (SPObject *obj) : URIReference(obj) {}
72
    SPPattern *getObject() const {
73
        return reinterpret_cast<SPPattern *>(URIReference::getObject());
74
    }
75
76
protected:
77
    virtual bool _acceptObject(SPObject *obj) const {
78
        return SP_IS_PATTERN (obj);
79
    }
80
};
81
82
enum {
83
    SP_PATTERN_UNITS_USERSPACEONUSE,
84
    SP_PATTERN_UNITS_OBJECTBOUNDINGBOX
85
};
86
13341.1.190 by Liam P. White
Header cleanup: stop using Glib types where they aren't truly needed. Eases GThread deprecation errors.
87
unsigned int pattern_users (SPPattern *pattern);
1 by mental
moving trunk for module inkscape
88
SPPattern *pattern_chain (SPPattern *pattern);
13341.1.190 by Liam P. White
Header cleanup: stop using Glib types where they aren't truly needed. Eases GThread deprecation errors.
89
SPPattern *sp_pattern_clone_if_necessary (SPItem *item, SPPattern *pattern, const char *property);
10025 by Johan Engelen
update to latest 2geom !
90
void sp_pattern_transform_multiply (SPPattern *pattern, Geom::Affine postmul, bool set);
1 by mental
moving trunk for module inkscape
91
13341.1.190 by Liam P. White
Header cleanup: stop using Glib types where they aren't truly needed. Eases GThread deprecation errors.
92
const char *pattern_tile (GSList *reprs, Geom::Rect bounds, SPDocument *document, Geom::Affine transform, Geom::Affine move);
1 by mental
moving trunk for module inkscape
93
94
SPPattern *pattern_getroot (SPPattern *pat);
95
13341.1.190 by Liam P. White
Header cleanup: stop using Glib types where they aren't truly needed. Eases GThread deprecation errors.
96
unsigned int pattern_patternUnits (SPPattern const *pat);
97
unsigned int pattern_patternContentUnits (SPPattern const *pat);
10025 by Johan Engelen
update to latest 2geom !
98
Geom::Affine const &pattern_patternTransform(SPPattern const *pat);
13341.1.190 by Liam P. White
Header cleanup: stop using Glib types where they aren't truly needed. Eases GThread deprecation errors.
99
double pattern_x (SPPattern const *pat);
100
double pattern_y (SPPattern const *pat);
101
double pattern_width (SPPattern const *pat);
102
double pattern_height (SPPattern const *pat);
12039 by Johan B. C. Engelen
const ....
103
Geom::OptRect pattern_viewBox (SPPattern const *pat);
1 by mental
moving trunk for module inkscape
104
9945.1.1 by Jon A. Cruz
Merge and cleanup of GSoC C++-ification project.
105
#endif // SEEN_SP_PATTERN_H
1 by mental
moving trunk for module inkscape
106
6527 by johanengelen
whitespace
107
/*
108
  Local Variables:
109
  mode:c++
110
  c-file-style:"stroustrup"
111
  c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
112
  indent-tabs-mode:nil
113
  fill-column:99
114
  End:
115
*/
9900 by Chris Morgan
Super duper mega (fun!) commit: replaced encoding=utf-8 with fileencoding=utf-8 in all 1074 Vim modelines.
116
// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 :