13
15
* Released under GNU GPL, read the file 'COPYING' for more information
16
#define SP_TYPE_CLIPPATH (sp_clippath_get_type ())
17
#define SP_CLIPPATH(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), SP_TYPE_CLIPPATH, SPClipPath))
18
#define SP_CLIPPATH_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), SP_TYPE_CLIPPATH, SPClipPathClass))
19
#define SP_IS_CLIPPATH(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SP_TYPE_CLIPPATH))
20
#define SP_IS_CLIPPATH_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), SP_TYPE_CLIPPATH))
18
#define SP_TYPE_CLIPPATH (SPClipPath::sp_clippath_get_type())
19
#define SP_CLIPPATH(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), SP_TYPE_CLIPPATH, SPClipPath))
20
#define SP_CLIPPATH_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), SP_TYPE_CLIPPATH, SPClipPathClass))
21
#define SP_IS_CLIPPATH(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), SP_TYPE_CLIPPATH))
22
#define SP_IS_CLIPPATH_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), SP_TYPE_CLIPPATH))
22
24
class SPClipPathView;
24
#include "display/nr-arena-forward.h"
25
#include "libnr/nr-forward.h"
26
#include "display/display-forward.h"
26
27
#include "sp-object-group.h"
27
28
#include "uri-references.h"
28
29
#include "xml/node.h"
30
struct SPClipPath : public SPObjectGroup {
33
unsigned int clipPathUnits_set : 1;
34
unsigned int clipPathUnits : 1;
36
SPClipPathView *display;
39
struct SPClipPathClass {
40
SPObjectGroupClass parent_class;
43
GType sp_clippath_get_type (void);
31
class SPClipPath : public SPObjectGroup {
35
unsigned int clipPathUnits_set : 1;
36
unsigned int clipPathUnits : 1;
38
SPClipPathView *display;
39
static const gchar *create(GSList *reprs, SPDocument *document, Geom::Affine const* applyTransform);
40
static GType sp_clippath_get_type(void);
42
Inkscape::DrawingItem *show(Inkscape::Drawing &drawing, unsigned int key);
43
void hide(unsigned int key);
45
void setBBox(unsigned int key, Geom::OptRect const &bbox);
46
Geom::OptRect geometricBounds(Geom::Affine const &transform);
49
static void init(SPClipPath *clippath);
51
static void build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr);
52
static void release(SPObject * object);
53
static void set(SPObject *object, unsigned int key, gchar const *value);
54
static void childAdded(SPObject *object, Inkscape::XML::Node *child, Inkscape::XML::Node *ref);
55
static void update(SPObject *object, SPCtx *ctx, guint flags);
56
static void modified(SPObject *object, guint flags);
57
static Inkscape::XML::Node *write(SPObject *object, Inkscape::XML::Document *doc, Inkscape::XML::Node *repr, guint flags);
59
friend class SPClipPathClass;
62
class SPClipPathClass {
64
SPObjectGroupClass parent_class;
67
static void sp_clippath_class_init(SPClipPathClass *klass);
68
static SPObjectGroupClass *static_parent_class;
70
friend class SPClipPath;
45
73
class SPClipPathReference : public Inkscape::URIReference {
47
SPClipPathReference(SPObject *obj) : URIReference(obj) {}
48
SPClipPath *getObject() const {
49
return (SPClipPath *)URIReference::getObject();
75
SPClipPathReference(SPObject *obj) : URIReference(obj) {}
76
SPClipPath *getObject() const {
77
return (SPClipPath *)URIReference::getObject();
53
82
* If the owner element of this reference (the element with <... clippath="...">)
55
84
* \return false if obj is not a clippath or if obj is a parent of this
56
85
* reference's owner element. True otherwise.
58
virtual bool _acceptObject(SPObject *obj) const {
59
if (!SP_IS_CLIPPATH(obj)) {
62
SPObject * const owner = this->getOwner();
87
virtual bool _acceptObject(SPObject *obj) const {
88
if (!SP_IS_CLIPPATH(obj)) {
91
SPObject * const owner = this->getOwner();
63
92
if (obj->isAncestorOf(owner)) {
64
Inkscape::XML::Node * const owner_repr = owner->repr;
65
Inkscape::XML::Node * const obj_repr = obj->repr;
93
//XML Tree being used directly here while it shouldn't be...
94
Inkscape::XML::Node * const owner_repr = owner->getRepr();
95
//XML Tree being used directly here while it shouldn't be...
96
Inkscape::XML::Node * const obj_repr = obj->getRepr();
66
97
gchar const * owner_name = NULL;
67
98
gchar const * owner_clippath = NULL;
68
99
gchar const * obj_name = NULL;
88
NRArenaItem *sp_clippath_show(SPClipPath *cp, NRArena *arena, unsigned int key);
89
void sp_clippath_hide(SPClipPath *cp, unsigned int key);
91
void sp_clippath_set_bbox(SPClipPath *cp, unsigned int key, NRRect *bbox);
92
void sp_clippath_get_bbox(SPClipPath *cp, NRRect *bbox, Geom::Matrix const &transform, unsigned const flags);
94
const gchar *sp_clippath_create (GSList *reprs, SPDocument *document, Geom::Matrix const* applyTransform);
119
#endif // SEEN_SP_CLIPPATH_H
124
c-file-style:"stroustrup"
125
c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
130
// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 :