Inkscape
Vector Graphics Editor
Loading...
Searching...
No Matches
sp-clippath.h
Go to the documentation of this file.
1// SPDX-License-Identifier: GPL-2.0-or-later
2#ifndef SEEN_SP_CLIPPATH_H
3#define SEEN_SP_CLIPPATH_H
4
5/*
6 * SVG <clipPath> implementation
7 *
8 * Authors:
9 * Lauris Kaplinski <lauris@kaplinski.com>
10 * Abhishek Sharma
11 * Jon A. Cruz <jon@joncruz.org>
12 *
13 * Copyright (C) 2001-2002 authors
14 * Copyright (C) 2001 Ximian, Inc.
15 *
16 * Released under GNU GPL v2+, read the file 'COPYING' for more information.
17 */
18
19#include <vector>
20#include <2geom/rect.h>
21
22#include "object-view.h"
23#include "sp-object-group.h"
24#include "uri-references.h"
25
26namespace Inkscape {
27class Drawing;
28class DrawingItem;
29class DrawingGroup;
30} // namespace Inkscape
31
32class SPClipPath final
33 : public SPObjectGroup
34{
35public:
36 SPClipPath();
37 ~SPClipPath() override;
38 int tag() const override { return tag_of<decltype(*this)>; }
39
40 bool clippath_units() const { return clipPathUnits; }
41
42 // Fixme: Hack used by cairo-renderer.
43 Geom::OptRect get_last_bbox() const { return views.back().bbox; }
44
45 static char const *create(std::vector<Inkscape::XML::Node*> &reprs, SPDocument *document);
46
47 Inkscape::DrawingItem *show(Inkscape::Drawing &drawing, unsigned key, Geom::OptRect const &bbox);
48 void hide(unsigned key);
49 void setBBox(unsigned key, Geom::OptRect const &bbox);
50
51 Geom::OptRect geometricBounds(Geom::Affine const &transform) const;
52 Geom::PathVector getPathVector(Geom::Affine const &transform) const;
53 SPText const *getTextObject() const;
54 void transform_multiply(Geom::Affine postmul, bool set = true);
56
57protected:
58 void build(SPDocument *doc, Inkscape::XML::Node *repr) override;
59 void release() override;
60 void set(SPAttr key, char const *value) override;
61 void update(SPCtx *ctx, unsigned flags) override;
62 void modified(unsigned flags) override;
64
66
67private:
69 bool clipPathUnits : 1;
70
72 std::vector<View> views;
73 void update_view(View &v);
74};
75
78{
79public:
82
84 {
85 return static_cast<SPClipPath*>(URIReference::getObject());
86 }
87
88 sigc::connection modified_connection;
89
90protected:
97 bool _acceptObject(SPObject *obj) const override;
98};
99
100#endif // SEEN_SP_CLIPPATH_H
101
102/*
103 Local Variables:
104 mode:c++
105 c-file-style:"stroustrup"
106 c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
107 indent-tabs-mode:nil
108 fill-column:99
109 End:
110*/
111// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 :
SPAttr
Definition attributes.h:27
constexpr int tag_of
Convenience function to retrieve the tag (class id) of a given type.
Definition cast.h:26
3x3 matrix representing an affine transformation.
Definition affine.h:70
Axis-aligned rectangle that can be empty.
Definition rect.h:203
Sequence of subpaths.
Definition pathvector.h:122
SVG drawing item for display.
A class encapsulating a reference to a particular URI; observers can be notified when the URI comes t...
URIReference(SPObject *owner)
Constructor.
Interface for refcounted XML nodes.
Definition node.h:80
SPClipPathReference(SPObject *obj)
Definition sp-clippath.h:80
bool _acceptObject(SPObject *obj) const override
If the owner element of this reference (the element with <... clippath="...">) is a child of the clip...
sigc::connection modified_connection
Definition sp-clippath.h:88
SPClipPath * getObject() const
Definition sp-clippath.h:83
void modified(unsigned flags) override
Inkscape::XML::Node * write(Inkscape::XML::Document *doc, Inkscape::XML::Node *repr, unsigned flags) override
void setBBox(unsigned key, Geom::OptRect const &bbox)
~SPClipPath() override
Geom::OptRect geometricBounds(Geom::Affine const &transform) const
void removeTransformsRecursively(SPObject const *root)
Geom::PathVector getPathVector(Geom::Affine const &transform) const
This gets a compiled path vector from all the objects.
bool clipPathUnits
Definition sp-clippath.h:69
void transform_multiply(Geom::Affine postmul, bool set=true)
void build(SPDocument *doc, Inkscape::XML::Node *repr) override
Geom::OptRect get_last_bbox() const
Definition sp-clippath.h:43
bool clippath_units() const
Definition sp-clippath.h:40
bool clipPathUnits_set
Definition sp-clippath.h:68
SPText const * getTextObject() const
This gets a text object, if the clip path is made up of a single sp-text.
void update(SPCtx *ctx, unsigned flags) override
void hide(unsigned key)
void update_view(View &v)
void child_added(Inkscape::XML::Node *child, Inkscape::XML::Node *ref) override
void release() override
Inkscape::DrawingItem * show(Inkscape::Drawing &drawing, unsigned key, Geom::OptRect const &bbox)
std::vector< View > views
Definition sp-clippath.h:72
int tag() const override
Definition sp-clippath.h:38
Typed SVG document implementation.
Definition document.h:101
SPObject is an abstract base class of all of the document nodes at the SVG document level.
Definition sp-object.h:160
Inkscape::XML::Node * repr
Definition sp-object.h:193
SPDocument * document
Definition sp-object.h:188
RootCluster root
Helper class to stream background task notifications as a series of messages.
static cairo_user_data_key_t key
View helper class used by hatch, clippath, mask and pattern.
Ocnode * child[8]
Definition quantize.cpp:33
Ocnode ** ref
Definition quantize.cpp:32
Axis-aligned rectangle.
Interface for XML documents.
Definition document.h:43
Unused.
Definition sp-object.h:94
std::unique_ptr< Toolbar >(* create)()
Definition toolbars.cpp:56