Inkscape
Vector Graphics Editor
Loading...
Searching...
No Matches
sp-hatch-path.h
Go to the documentation of this file.
1// SPDX-License-Identifier: GPL-2.0-or-later
6/*
7 * Author:
8 * Tomasz Boczkowski <penginsbacon@gmail.com>
9 * Jon A. Cruz <jon@joncruz.org>
10 *
11 * Copyright (C) 2014 Tomasz Boczkowski
12 *
13 * Released under GNU GPL v2+, read the file 'COPYING' for more information.
14 */
15
16#ifndef SEEN_SP_HATCH_PATH_H
17#define SEEN_SP_HATCH_PATH_H
18
19#include <vector>
20#include <cstddef>
21#include <optional>
22#include <glibmm/ustring.h>
23#include <sigc++/connection.h>
25#include <2geom/pathvector.h>
26
27#include "svg/svg-length.h"
28#include "object/sp-object.h"
30
31namespace Inkscape {
32
33class Drawing;
34class DrawingShape;
35class DrawingItem;
36
37} // namespace Inkscape
38
39class SPHatchPath final : public SPObject
40{
41public:
43 ~SPHatchPath() override;
44 int tag() const override { return tag_of<decltype(*this)>; }
45
47
48 bool isValid() const;
49
50 Inkscape::DrawingItem *show(Inkscape::Drawing &drawing, unsigned int key, Geom::OptInterval extents);
51 void hide(unsigned int key);
52
53 void setStripExtents(unsigned int key, Geom::OptInterval const &extents);
54 Geom::Interval bounds() const;
55
57
58protected:
59 void build(SPDocument* doc, Inkscape::XML::Node* repr) override;
60 void release() override;
61 void set(SPAttr key, const gchar* value) override;
62 void update(SPCtx* ctx, unsigned int flags) override;
63
64private:
72 std::vector<View> views;
73
74 gdouble _repeatLength() const;
75 void _updateView(View &view);
77
78 void _readHatchPathVector(char const *str, Geom::PathVector &pathv, bool &continous_join);
79
80 std::optional<Geom::PathVector> _curve;
81 bool _continuous = false;
82};
83
84#endif // SEEN_SP_HATCH_PATH_H
85
86/*
87 Local Variables:
88 mode:c++
89 c-file-style:"stroustrup"
90 c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
91 indent-tabs-mode:nil
92 fill-column:99
93 End:
94*/
95// 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
Range of real numbers that is never empty.
Definition interval.h:59
Range of real numbers that can be empty.
Definition interval.h:199
Sequence of subpaths.
Definition pathvector.h:122
SVG drawing item for display.
Interface for refcounted XML nodes.
Definition node.h:80
Typed SVG document implementation.
Definition document.h:101
std::optional< Geom::PathVector > _curve
void release() override
SVGLength offset
void _readHatchPathVector(char const *str, Geom::PathVector &pathv, bool &continous_join)
void build(SPDocument *doc, Inkscape::XML::Node *repr) override
Inkscape::DrawingItem * show(Inkscape::Drawing &drawing, unsigned int key, Geom::OptInterval extents)
int tag() const override
void setStripExtents(unsigned int key, Geom::OptInterval const &extents)
void update(SPCtx *ctx, unsigned int flags) override
void hide(unsigned int key)
void _updateView(View &view)
Geom::PathVector calculateRenderCurve(unsigned key) const
std::vector< View > views
Geom::Interval bounds() const
~SPHatchPath() override
Geom::PathVector _calculateRenderCurve(View const &view) const
bool isValid() const
gdouble _repeatLength() const
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
SVG length type.
Definition svg-length.h:22
std::unique_ptr< T, UnlinkDeleter > DrawingItemPtr
Smart pointer used by the Object Tree to hold items in the Display Tree, like std::unique_ptr.
Closed interval of generic values.
Helper class to stream background task notifications as a series of messages.
static cairo_user_data_key_t key
PathVector - a sequence of subpaths.
Unused.
Definition sp-object.h:94
DrawingItemPtr< Inkscape::DrawingShape > drawingitem
Geom::OptInterval extents