Code

Fix change in revision 9947 to be consistent with rest of the codebase.
[inkscape.git] / src / livarot / path-description.cpp
1 #include "libnr/nr-point-matrix-ops.h"
2 #include "livarot/path-description.h"
4 PathDescr *PathDescrMoveTo::clone() const
5 {
6     return new PathDescrMoveTo(*this);
7 }
9 void PathDescrMoveTo::dumpSVG(Inkscape::SVGOStringStream& s, Geom::Point const &/*last*/) const
10 {
11     s << "M " << p[Geom::X] << " " << p[Geom::Y] << " ";
12 }
14 void PathDescrMoveTo::transform(Geom::Matrix const& t)
15 {
16     p = p * t;
17 }
19 void PathDescrMoveTo::dump(std::ostream &s) const
20 {
21     /* localizing ok */
22     s << "  m " << p[Geom::X] << " " << p[Geom::Y];
23 }
25 void PathDescrLineTo::dumpSVG(Inkscape::SVGOStringStream& s, Geom::Point const &/*last*/) const
26 {
27     s << "L " << p[Geom::X] << " " << p[Geom::Y] << " ";
28 }
30 PathDescr *PathDescrLineTo::clone() const
31 {
32     return new PathDescrLineTo(*this);
33 }
35 void PathDescrLineTo::transform(Geom::Matrix const& t)
36 {
37     p = p * t;
38 }
40 void PathDescrLineTo::dump(std::ostream &s) const
41 {
42     /* localizing ok */
43     s << "  l " << p[Geom::X] << " " << p[Geom::Y];
44 }
46 PathDescr *PathDescrBezierTo::clone() const
47 {
48     return new PathDescrBezierTo(*this);
49 }
51 void PathDescrBezierTo::transform(Geom::Matrix const& t)
52 {
53     p = p * t;
54 }
56 void PathDescrBezierTo::dump(std::ostream &s) const
57 {
58     /* localizing ok */
59     s << "  b " << p[Geom::X] << " " << p[Geom::Y] << " " << nb;
60 }
62 PathDescr *PathDescrIntermBezierTo::clone() const
63 {
64     return new PathDescrIntermBezierTo(*this);
65 }
67 void PathDescrIntermBezierTo::transform(Geom::Matrix const& t)
68 {
69     p = p * t;
70 }
72 void PathDescrIntermBezierTo::dump(std::ostream &s) const
73 {
74     /* localizing ok */
75     s << "  i " << p[Geom::X] << " " << p[Geom::Y];
76 }
78 void PathDescrCubicTo::dumpSVG(Inkscape::SVGOStringStream& s, Geom::Point const &last) const
79 {
80     s << "C "
81       << last[Geom::X] + start[0] / 3 << " "
82       << last[Geom::Y] + start[1] / 3 << " "
83       << p[Geom::X] - end[0] / 3 << " "
84       << p[Geom::Y] - end[1] / 3 << " "
85       << p[Geom::X] << " "
86       << p[Geom::Y] << " ";
87 }
89 PathDescr *PathDescrCubicTo::clone() const
90 {
91     return new PathDescrCubicTo(*this);
92 }
94 void PathDescrCubicTo::dump(std::ostream &s) const
95 {
96     /* localizing ok */
97     s << "  c "
98       << p[Geom::X] << " " << p[Geom::Y] << " "
99       << start[Geom::X] << " " << start[Geom::Y] << " "
100       << end[Geom::X] << " " << end[Geom::Y] << " ";
103 void PathDescrCubicTo::transform(Geom::Matrix const& t)
105     Geom::Matrix tr = t;
106     tr[4] = tr[5] = 0;
107     start = start * tr;
108     end = end * tr;
109     
110     p = p * t;
113 void PathDescrArcTo::dumpSVG(Inkscape::SVGOStringStream& s, Geom::Point const &/*last*/) const
115     s << "A "
116       << rx << " "
117       << ry << " "
118       << angle << " "
119       << (large ? "1" : "0") << " "
120       << (clockwise ? "0" : "1") << " "
121       << p[Geom::X] << " "
122       << p[Geom::Y] << " ";
125 PathDescr *PathDescrArcTo::clone() const
127     return new PathDescrArcTo(*this);
130 void PathDescrArcTo::transform(Geom::Matrix const& t)
132     p = p * t;
135 void PathDescrArcTo::dump(std::ostream &s) const
137     /* localizing ok */
138     s << "  a "
139       << p[Geom::X] << " " << p[Geom::Y] << " "
140       << rx << " " << ry << " "
141       << angle << " "
142       << (clockwise ? 1 : 0) << " "
143       << (large ? 1 : 0);
146 PathDescr *PathDescrForced::clone() const
148     return new PathDescrForced(*this);
151 void PathDescrClose::dumpSVG(Inkscape::SVGOStringStream& s, Geom::Point const &/*last*/) const
153     s << "z ";
156 PathDescr *PathDescrClose::clone() const
158     return new PathDescrClose(*this);
162 /*
163   Local Variables:
164   mode:c++
165   c-file-style:"stroustrup"
166   c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
167   indent-tabs-mode:nil
168   fill-column:99
169   End:
170 */
171 // vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4 :