Inkscape
Vector Graphics Editor
Loading...
Searching...
No Matches
path-description.h
Go to the documentation of this file.
1// SPDX-License-Identifier: GPL-2.0-or-later
/*
5 * Authors: see git history
6 *
7 * Copyright (C) 2018 Authors
8 * Released under GNU GPL v2+, read the file 'COPYING' for more information.
9 */
10#ifndef SEEN_INKSCAPE_LIVAROT_PATH_DESCRIPTION_H
11#define SEEN_INKSCAPE_LIVAROT_PATH_DESCRIPTION_H
12
13#include <2geom/point.h>
14#include "svg/stringstream.h"
15
16// path description commands
17/* FIXME: these should be unnecessary once the refactoring of the path
18** description stuff is finished.
19*/
20
25enum
26{
32 descr_forced = 7,
36 descr_type_mask = 15
40};
41
47{
48 PathDescr() : flags(0), associated(-1), tSt(0), tEn(1) {}
49 PathDescr(int f) : flags(f), associated(-1), tSt(0), tEn(1) {}
50 virtual ~PathDescr() = default;
51
52 int getType() const { return flags & descr_type_mask; }
53 void setType(int t) {
54 flags &= ~descr_type_mask;
55 flags |= t;
56 }
57
66 virtual void dumpSVG(Inkscape::SVGOStringStream &/*s*/, Geom::Point const &/*last*/) const {}
67
72 virtual PathDescr *clone() const = 0;
73
80 virtual void dump(std::ostream &/*s*/) const {}
81
82 int flags;
86 double tSt;
87 double tEn;
88};
89
94{
97
98 void dumpSVG(Inkscape::SVGOStringStream &s, Geom::Point const &last) const override;
99 PathDescr *clone() const override;
100 void dump(std::ostream &s) const override;
101
103};
104
109{
112
113 void dumpSVG(Inkscape::SVGOStringStream &s, Geom::Point const &last) const override;
114 PathDescr *clone() const override;
115 void dump(std::ostream &s) const override;
116
118};
119
131{
133 : PathDescr(descr_cubicto), p(pp), start(s), end(e) {}
134
135 void dumpSVG(Inkscape::SVGOStringStream &s, Geom::Point const &last) const override;
136 PathDescr *clone() const override;
137 void dump(std::ostream &s) const override;
138
144};
145
152{
153 PathDescrArcTo(Geom::Point const &pp, double x, double y, double a, bool l, bool c)
154 : PathDescr(descr_arcto), p(pp), rx(x), ry(y), angle(a), large(l), clockwise(c) {}
155
156 void dumpSVG(Inkscape::SVGOStringStream &s, Geom::Point const &last) const override;
157 PathDescr *clone() const override;
158 void dump(std::ostream &s) const override;
159
161 double rx;
162 double ry;
163 double angle;
164 bool large;
166};
167
174{
176
177 PathDescr *clone() const override;
178
179 /* FIXME: not sure whether _forced should have a point associated with it;
180 ** Path::ConvertForcedToMoveTo suggests that maybe it should.
181 */
183};
184
185
190{
192
193 void dumpSVG(Inkscape::SVGOStringStream &s, Geom::Point const &last) const override;
194 PathDescr *clone() const override;
195
196 /* FIXME: not sure whether _forced should have a point associated with it;
197 ** Path::ConvertForcedToMoveTo suggests that maybe it should.
198 */
200};
201
202#endif
203
204
205/*
206 Local Variables:
207 mode:c++
208 c-file-style:"stroustrup"
209 c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
210 indent-tabs-mode:nil
211 fill-column:99
212 End:
213*/
214// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 :
Cartesian point / 2D vector and related operations.
Two-dimensional point that doubles as a vector.
Definition point.h:66
double c[8][4]
@ descr_lineto
@ descr_type_mask
@ descr_arcto
@ descr_moveto
@ descr_cubicto
@ descr_close
@ descr_forced
Elliptical Arc path command.
PathDescrArcTo(Geom::Point const &pp, double x, double y, double a, bool l, bool c)
void dump(std::ostream &s) const override
A virtual function that derived classes will implement.
void dumpSVG(Inkscape::SVGOStringStream &s, Geom::Point const &last) const override
A virtual function that derived classes will implement.
PathDescr * clone() const override
A virtual function that derived classes will implement.
Close Path instruction.
PathDescr * clone() const override
A virtual function that derived classes will implement.
void dumpSVG(Inkscape::SVGOStringStream &s, Geom::Point const &last) const override
A virtual function that derived classes will implement.
Cubic Bezier path command.
void dumpSVG(Inkscape::SVGOStringStream &s, Geom::Point const &last) const override
A virtual function that derived classes will implement.
void dump(std::ostream &s) const override
A virtual function that derived classes will implement.
PathDescrCubicTo(Geom::Point const &pp, Geom::Point const &s, Geom::Point const &e)
PathDescr * clone() const override
A virtual function that derived classes will implement.
A forced point path command.
PathDescr * clone() const override
A virtual function that derived classes will implement.
A LineTo path command.
PathDescr * clone() const override
A virtual function that derived classes will implement.
void dumpSVG(Inkscape::SVGOStringStream &s, Geom::Point const &last) const override
A virtual function that derived classes will implement.
void dump(std::ostream &s) const override
A virtual function that derived classes will implement.
PathDescrLineTo(Geom::Point const &pp)
A MoveTo path command.
void dump(std::ostream &s) const override
A virtual function that derived classes will implement.
PathDescr * clone() const override
A virtual function that derived classes will implement.
PathDescrMoveTo(Geom::Point const &pp)
void dumpSVG(Inkscape::SVGOStringStream &s, Geom::Point const &last) const override
A virtual function that derived classes will implement.
A base class for Livarot's path commands.
int getType() const
virtual ~PathDescr()=default
void setType(int t)
virtual void dumpSVG(Inkscape::SVGOStringStream &, Geom::Point const &) const
A virtual function that derived classes will implement.
virtual void dump(std::ostream &) const
A virtual function that derived classes will implement.
virtual PathDescr * clone() const =0
A virtual function that derived classes will implement.
TODO: insert short description here.