Inkscape
Vector Graphics Editor
Loading...
Searching...
No Matches
sp-rect.cpp
Go to the documentation of this file.
1// SPDX-License-Identifier: GPL-2.0-or-later
2/*
3 * SVG <rect> implementation
4 *
5 * Authors:
6 * Lauris Kaplinski <lauris@kaplinski.com>
7 * bulia byak <buliabyak@users.sf.net>
8 *
9 * Copyright (C) 1999-2002 Lauris Kaplinski
10 * Copyright (C) 2000-2001 Ximian, Inc.
11 *
12 * Released under GNU GPL v2+, read the file 'COPYING' for more information.
13 */
14
15#include "sp-rect.h"
16
17#include <glibmm/i18n.h>
18
19#include "attributes.h"
20#include "document.h"
21#include "preferences.h"
22#include "snap-candidate.h"
23#include "snap-preferences.h"
24#include "sp-guide.h"
25#include "style.h"
26
27#include "display/curve.h"
28#include "svg/svg.h"
29
30#define noRECT_VERBOSE
31
32//#define OBJECT_TRACE
33
38
39SPRect::~SPRect() = default;
40
41/*
42* Ellipse and rects are the only SP object who's repr element tag name changes
43* during it's lifetime. During undo and redo these changes can cause
44* the SP object to become unstuck from the repr's true state.
45*/
46void SPRect::tag_name_changed(gchar const* oldname, gchar const* newname)
47{
48 const std::string typeString = newname;
49 if (typeString == "svg:rect") {
51 } else if (typeString == "svg:path") {
53 }
54}
55
57#ifdef OBJECT_TRACE
58 objectTrace( "SPRect::build" );
59#endif
60
61 SPShape::build(doc, repr);
62
63 this->readAttr(SPAttr::X);
64 this->readAttr(SPAttr::Y);
67 this->readAttr(SPAttr::RX);
68 this->readAttr(SPAttr::RY);
69
70#ifdef OBJECT_TRACE
71 objectTrace( "SPRect::build", false );
72#endif
73}
74
75void SPRect::set(SPAttr key, gchar const *value) {
76
77#ifdef OBJECT_TRACE
78 std::stringstream temp;
79 temp << "SPRect::set: " << sp_attribute_name(key) << " " << (value?value:"null");
80 objectTrace( temp.str() );
81#endif
82
83 /* fixme: We need real error processing some time */
84
85 // We must update the SVGLengths immediately or nodes may be misplaced after they are moved.
86 double const w = viewport.width();
87 double const h = viewport.height();
88 double const em = style->font_size.computed;
89 double const ex = em * 0.5;
90
91 switch (key) {
92 case SPAttr::X:
93 this->x.readOrUnset(value);
94 this->x.update( em, ex, w );
96 break;
97
98 case SPAttr::Y:
99 this->y.readOrUnset(value);
100 this->y.update( em, ex, h );
102 break;
103
104 case SPAttr::WIDTH:
105 if (!this->width.read(value) || this->width.value < 0.0) {
106 this->width.unset();
107 }
108 this->width.update( em, ex, w );
110 break;
111
112 case SPAttr::HEIGHT:
113 if (!this->height.read(value) || this->height.value < 0.0) {
114 this->height.unset();
115 }
116 this->height.update( em, ex, h );
118 break;
119
120 case SPAttr::RX:
121 if (!this->rx.read(value) || this->rx.value <= 0.0) {
122 this->rx.unset();
123 }
124 this->rx.update( em, ex, w );
126 break;
127
128 case SPAttr::RY:
129 if (!this->ry.read(value) || this->ry.value <= 0.0) {
130 this->ry.unset();
131 }
132 this->ry.update( em, ex, h );
134 break;
135
136 default:
137 SPShape::set(key, value);
138 break;
139 }
140#ifdef OBJECT_TRACE
141 objectTrace( "SPRect::set", false );
142#endif
143}
144
145void SPRect::update(SPCtx* ctx, unsigned int flags) {
146
147#ifdef OBJECT_TRACE
148 objectTrace( "SPRect::update", true, flags );
149#endif
150
152 SPItemCtx const *ictx = reinterpret_cast<SPItemCtx const *>(ctx);
153
154 double const w = ictx->viewport.width();
155 double const h = ictx->viewport.height();
156 double const em = style->font_size.computed;
157 double const ex = 0.5 * em; // fixme: get x height from pango or libnrtype.
158
159 this->x.update(em, ex, w);
160 this->y.update(em, ex, h);
161 this->width.update(em, ex, w);
162 this->height.update(em, ex, h);
163 this->rx.update(em, ex, w);
164 this->ry.update(em, ex, h);
165 this->set_shape();
166
167 flags &= ~SP_OBJECT_USER_MODIFIED_FLAG_B; // since we change the description, it's not a "just translation" anymore
168 }
169
170 SPShape::update(ctx, flags);
171#ifdef OBJECT_TRACE
172 objectTrace( "SPRect::update", false, flags );
173#endif
174}
175
177
178#ifdef OBJECT_TRACE
179 objectTrace( "SPRect::write", true, flags );
180#endif
184 }
185 if ((flags & SP_OBJECT_WRITE_BUILD) && !repr) {
186
187 switch ( new_type ) {
188
189 case SP_GENERIC_RECT:
190 repr = xml_doc->createElement("svg:rect");
191 break;
192 case SP_GENERIC_PATH:
193 repr = xml_doc->createElement("svg:path");
194 break;
195 default:
196 std::cerr << "SPGenericRect::write(): unknown type." << std::endl;
197 }
198 }
199 if (type != new_type) {
200 switch (new_type) {
201 case SP_GENERIC_RECT:
203 break;
204 case SP_GENERIC_PATH:
206 repr->setAttribute("sodipodi:type", "rect");
207 break;
208 default:
209 std::cerr << "SPGenericRect::write(): unknown type." << std::endl;
210 }
211 type = new_type;
212 }
213 repr->setAttributeSvgLength("width", this->width);
214 repr->setAttributeSvgLength("height", this->height);
215
216 if (this->rx._set) {
217 repr->setAttributeSvgLength("rx", this->rx);
218 }
219
220 if (this->ry._set) {
221 repr->setAttributeSvgLength("ry", this->ry);
222 }
223
224 repr->setAttributeSvgLength("x", this->x);
225 repr->setAttributeSvgLength("y", this->y);
226 // write d=
227 if (type == SP_GENERIC_PATH) {
228 set_rect_path_attribute(repr); // include set_shape()
229 } else {
230 this->set_shape(); // evaluate SPCurve
231 }
232 SPShape::write(xml_doc, repr, flags);
233
234#ifdef OBJECT_TRACE
235 objectTrace( "SPRect::write", false, flags );
236#endif
237
238 return repr;
239}
240
241const char* SPRect::typeName() const {
242 return "rect";
243}
244
245const char* SPRect::displayName() const {
246 return _("Rectangle");
247}
248
249#define C1 0.554
250
252 if (checkBrokenPathEffect()) {
253 return;
254 }
255 if ((this->height.computed < 1e-18) || (this->width.computed < 1e-18)) {
256 this->setCurveInsync(nullptr);
257 this->setCurveBeforeLPE(nullptr);
258 return;
259 }
260
261 SPCurve c;
262
263 double const x = this->x.computed;
264 double const y = this->y.computed;
265 double const w = this->width.computed;
266 double const h = this->height.computed;
267 double const w2 = w / 2;
268 double const h2 = h / 2;
269 double const rx = std::min(( this->rx._set
270 ? this->rx.computed
271 : ( this->ry._set
272 ? this->ry.computed
273 : 0.0 ) ),
274 .5 * this->width.computed);
275 double const ry = std::min(( this->ry._set
276 ? this->ry.computed
277 : ( this->rx._set
278 ? this->rx.computed
279 : 0.0 ) ),
280 .5 * this->height.computed);
281 /* TODO: Handle negative rx or ry as per
282 * http://www.w3.org/TR/SVG11/shapes.html#RectElementRXAttribute once Inkscape has proper error
283 * handling (see http://www.w3.org/TR/SVG11/implnote.html#ErrorProcessing).
284 */
285
286 /* We don't use proper circular/elliptical arcs, but bezier curves can approximate a 90-degree
287 * arc fairly well.
288 */
289 if ((rx > 1e-18) && (ry > 1e-18)) {
290 c.moveto(x + rx, y);
291
292 if (rx < w2) {
293 c.lineto(x + w - rx, y);
294 }
295
296 c.curveto(x + w - rx * (1 - C1), y, x + w, y + ry * (1 - C1), x + w, y + ry);
297
298 if (ry < h2) {
299 c.lineto(x + w, y + h - ry);
300 }
301
302 c.curveto(x + w, y + h - ry * (1 - C1), x + w - rx * (1 - C1), y + h, x + w - rx, y + h);
303
304 if (rx < w2) {
305 c.lineto(x + rx, y + h);
306 }
307
308 c.curveto(x + rx * (1 - C1), y + h, x, y + h - ry * (1 - C1), x, y + h - ry);
309
310 if (ry < h2) {
311 c.lineto(x, y + ry);
312 }
313
314 c.curveto(x, y + ry * (1 - C1), x + rx * (1 - C1), y, x + rx, y);
315 } else {
316 c.moveto(x + 0.0, y + 0.0);
317 c.lineto(x + w, y + 0.0);
318 c.lineto(x + w, y + h);
319 c.lineto(x + 0.0, y + h);
320 }
321
322 c.closepath();
323
325}
326
328{
329 // Make sure our pathvector is up to date.
330 this->set_shape();
331
332 if (_curve) {
333 repr->setAttribute("d", sp_svg_write_path(_curve->get_pathvector()));
334 } else {
335 repr->removeAttribute("d");
336 }
337
338 return true;
339}
340
341void SPRect::modified(guint flags)
342{
344 this->set_shape();
345 }
346
347 SPShape::modified(flags);
348}
349
350/* fixme: Think (Lauris) */
351
352void SPRect::setPosition(gdouble x, gdouble y, gdouble width, gdouble height) {
353 this->x = x;
354 this->y = y;
355 this->width = width;
356 this->height = height;
357
359}
360
361void SPRect::setRx(bool set, gdouble value) {
362 this->rx._set = set;
363
364 if (set) {
365 this->rx = value;
366 }
367
369}
370
371void SPRect::setRy(bool set, gdouble value) {
372 this->ry._set = set;
373
374 if (set) {
375 this->ry = value;
376 }
377
379}
380
387
390 return xform;
391 }
392 /* Calculate rect start in parent coords. */
393 Geom::Point pos(Geom::Point(this->x.computed, this->y.computed) * xform);
394
395 /* This function takes care of translation and scaling, we return whatever parts we can't
396 handle. */
397 Geom::Affine ret(Geom::Affine(xform).withoutTranslation());
398 gdouble const sw = hypot(ret[0], ret[1]);
399 gdouble const sh = hypot(ret[2], ret[3]);
400
401 if (sw > 1e-9) {
402 ret[0] /= sw;
403 ret[1] /= sw;
404 } else {
405 ret[0] = 1.0;
406 ret[1] = 0.0;
407 }
408
409 if (sh > 1e-9) {
410 ret[2] /= sh;
411 ret[3] /= sh;
412 } else {
413 ret[2] = 0.0;
414 ret[3] = 1.0;
415 }
416
417 /* Preserve units */
418 this->width.scale( sw );
419 this->height.scale( sh );
420
421 if (this->rx._set) {
422 this->rx.scale( sw );
423 }
424
425 if (this->ry._set) {
426 this->ry.scale( sh );
427 }
428
429 /* Find start in item coords */
430 pos = pos * ret.inverse();
431 this->x = pos[Geom::X];
432 this->y = pos[Geom::Y];
433
434 this->set_shape();
435
436 // Adjust stroke width
437 this->adjust_stroke(sqrt(fabs(sw * sh)));
438
439 // Adjust pattern fill
440 this->adjust_pattern(xform * ret.inverse());
441
442 // Adjust gradient fill
443 this->adjust_gradient(xform * ret.inverse());
444
445 return ret;
446}
447
448
453 if (p0 == p1) {
454 return 0;
455 }
456
457 return (Geom::distance(p0 * xform, p1 * xform) / Geom::distance(p0, p1));
458}
459
460void SPRect::setVisibleRx(gdouble rx) {
461 if (rx == 0) {
462 this->rx.unset();
463 } else {
464 this->rx = rx / SPRect::vectorStretch(
465 Geom::Point(this->x.computed + 1, this->y.computed),
467 this->i2doc_affine());
468 }
469
470 this->updateRepr();
471}
472
473void SPRect::setVisibleRy(gdouble ry) {
474 if (ry == 0) {
475 this->ry.unset();
476 } else {
477 this->ry = ry / SPRect::vectorStretch(
478 Geom::Point(this->x.computed, this->y.computed + 1),
480 this->i2doc_affine());
481 }
482
483 this->updateRepr();
484}
485
486gdouble SPRect::getVisibleRx() const {
487 if (!this->rx._set) {
488 return 0;
489 }
490
491 return this->rx.computed * SPRect::vectorStretch(
492 Geom::Point(this->x.computed + 1, this->y.computed),
494 this->i2doc_affine());
495}
496
497gdouble SPRect::getVisibleRy() const {
498 if (!this->ry._set) {
499 return 0;
500 }
501
502 return this->ry.computed * SPRect::vectorStretch(
503 Geom::Point(this->x.computed, this->y.computed + 1),
505 this->i2doc_affine());
506}
507
510 Geom::Point p2 = Geom::Point(this->x.computed + this->width.computed, this->y.computed + this->height.computed);
511
512 return Geom::Rect(p0, p2);
513}
514
516 if (this->rx.computed == 0 && this->ry.computed == 0) {
517 return; // nothing to compensate
518 }
519
520 // test unit vectors to find out compensation:
521 Geom::Point c(this->x.computed, this->y.computed);
522 Geom::Point cx = c + Geom::Point(1, 0);
523 Geom::Point cy = c + Geom::Point(0, 1);
524
525 // apply previous transform if any
526 c *= this->transform;
527 cx *= this->transform;
528 cy *= this->transform;
529
530 // find out stretches that we need to compensate
531 gdouble eX = SPRect::vectorStretch(cx, c, xform);
532 gdouble eY = SPRect::vectorStretch(cy, c, xform);
533
534 // If only one of the radii is set, set both radii so they have the same visible length
535 // This is needed because if we just set them the same length in SVG, they might end up unequal because of transform
536 if ((this->rx._set && !this->ry._set) || (this->ry._set && !this->rx._set)) {
537 gdouble r = MAX(this->rx.computed, this->ry.computed);
538 this->rx = r / eX;
539 this->ry = r / eY;
540 } else {
541 this->rx = this->rx.computed / eX;
542 this->ry = this->ry.computed / eY;
543 }
544
545 // Note that a radius may end up larger than half-side if the rect is scaled down;
546 // that's ok because this preserves the intended radii in case the rect is enlarged again,
547 // and set_shape will take care of trimming too large radii when generating d=
548}
549
551 this->width = width / SPRect::vectorStretch(
552 Geom::Point(this->x.computed + 1, this->y.computed),
554 this->i2doc_affine());
555
556 this->updateRepr();
557}
558
560 this->height = height / SPRect::vectorStretch(
561 Geom::Point(this->x.computed, this->y.computed + 1),
563 this->i2doc_affine());
564
565 this->updateRepr();
566}
567
568gdouble SPRect::getVisibleWidth() const {
569 if (!this->width._set) {
570 return 0;
571 }
572
573 return this->width.computed * SPRect::vectorStretch(
574 Geom::Point(this->x.computed + 1, this->y.computed),
576 this->i2doc_affine());
577}
578
580 if (!this->height._set) {
581 return 0;
582 }
583
585 Geom::Point(this->x.computed, this->y.computed + 1),
587 this->i2doc_affine());
588}
589
590void SPRect::snappoints(std::vector<Inkscape::SnapCandidatePoint> &p, Inkscape::SnapPreferences const *snapprefs) const {
591 /* This method overrides sp_shape_snappoints, which is the default for any shape. The default method
592 returns all eight points along the path of a rounded rectangle, but not the real corners. Snapping
593 the startpoint and endpoint of each rounded corner is not very useful and really confusing. Instead
594 we could snap either the real corners, or not snap at all. Bulia Byak opted to snap the real corners,
595 but it should be noted that this might be confusing in some cases with relatively large radii. With
596 small radii though the user will easily understand which point is snapping. */
597
598 Geom::Affine const i2dt (this->i2dt_affine ());
599
601 Geom::Point p1 = Geom::Point(this->x.computed, this->y.computed + this->height.computed) * i2dt;
602 Geom::Point p2 = Geom::Point(this->x.computed + this->width.computed, this->y.computed + this->height.computed) * i2dt;
603 Geom::Point p3 = Geom::Point(this->x.computed + this->width.computed, this->y.computed) * i2dt;
604
610 }
611
617 }
618
621 }
622}
623
626
627 if (!prefs->getBool("/tools/shapes/rect/convertguides", true)) {
628 // Use bounding box instead of edges
630 return;
631 }
632
633 std::list<std::pair<Geom::Point, Geom::Point> > pts;
634
635 Geom::Affine const i2dt(this->i2dt_affine());
636
637 Geom::Point A1(Geom::Point(this->x.computed, this->y.computed) * i2dt);
638 Geom::Point A2(Geom::Point(this->x.computed, this->y.computed + this->height.computed) * i2dt);
639 Geom::Point A3(Geom::Point(this->x.computed + this->width.computed, this->y.computed + this->height.computed) * i2dt);
640 Geom::Point A4(Geom::Point(this->x.computed + this->width.computed, this->y.computed) * i2dt);
641
642 pts.emplace_back(A1, A2);
643 pts.emplace_back(A2, A3);
644 pts.emplace_back(A3, A4);
645 pts.emplace_back(A4, A1);
646
648}
649
650/*
651 Local Variables:
652 mode:c++
653 c-file-style:"stroustrup"
654 c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
655 indent-tabs-mode:nil
656 fill-column:99
657 End:
658*/
659// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4 :
gchar const * sp_attribute_name(SPAttr id)
Get attribute name by id.
Lookup dictionary for attributes/properties.
SPAttr
Definition attributes.h:27
3x3 matrix representing an affine transformation.
Definition affine.h:70
C height() const
Get the vertical extent of the rectangle.
C width() const
Get the horizontal extent of the rectangle.
Two-dimensional point that doubles as a vector.
Definition point.h:66
Axis aligned, non-empty rectangle.
Definition rect.h:92
Preference storage class.
Definition preferences.h:66
bool getBool(Glib::ustring const &pref_path, bool def=false)
Retrieve a Boolean value.
static Preferences * get()
Access the singleton Preferences object.
Storing of snapping preferences.
bool isTargetSnappable(Inkscape::SnapTargetType const target) const
Interface for refcounted XML nodes.
Definition node.h:80
bool setAttributeSvgLength(Util::const_char_ptr key, SVGLength const &val)
Definition node.cpp:131
virtual void setCodeUnsafe(int code)=0
Set the integer GQuark code for the name of the node.
void setAttribute(Util::const_char_ptr key, Util::const_char_ptr value)
Change an attribute of this node.
Definition node.cpp:25
void removeAttribute(Inkscape::Util::const_char_ptr key)
Remove an attribute of this node.
Definition node.h:280
Wrapper around a Geom::PathVector object.
Definition curve.h:28
Typed SVG document implementation.
Definition document.h:101
Inkscape::XML::Document * getReprDoc()
Our Inkscape::XML::Document.
Definition document.h:211
Geom::Affine i2dt_affine() const
Returns the transformation from item to desktop coords.
Definition sp-item.cpp:1837
void adjust_gradient(Geom::Affine const &postmul, bool set=false)
Definition sp-item.cpp:1442
Geom::Affine transform
Definition sp-item.h:138
Geom::Rect viewport
Definition sp-item.h:140
void adjust_pattern(Geom::Affine const &postmul, bool set=false, PaintServerTransform=TRANSFORM_BOTH)
Definition sp-item.cpp:1396
void adjust_stroke(double ex)
Definition sp-item.cpp:1488
virtual void convert_to_guides() const
Definition sp-item.cpp:1896
bool hasPathEffectOnClipOrMaskRecursive(SPLPEItem *shape) const
returns true when any LPE apply to clip or mask.
bool pathEffectsEnabled() const
bool optimizeTransforms()
returns false when LPE write unoptimiced
Inkscape::XML::Node * repr
Definition sp-object.h:193
SPDocument * document
Definition sp-object.h:188
SPStyle * style
Represents the style properties, whether from presentation attributes, the style attribute,...
Definition sp-object.h:248
Inkscape::XML::Node * updateRepr(unsigned int flags=SP_OBJECT_WRITE_EXT)
Updates the object's repr based on the object's state.
void readAttr(char const *key)
Read value of key attribute from XML node into object.
Inkscape::XML::Node * getRepr()
Returns the XML representation of tree.
unsigned int cloned
Definition sp-object.h:180
void objectTrace(std::string const &, bool in=true, unsigned flags=0)
void requestDisplayUpdate(unsigned int flags)
Queues an deferred update of this object's display.
void convert_to_guides() const override
Definition sp-rect.cpp:624
void setVisibleHeight(double ry)
Definition sp-rect.cpp:559
Inkscape::XML::Node * write(Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, unsigned int flags) override
Definition sp-rect.cpp:176
bool set_rect_path_attribute(Inkscape::XML::Node *repr)
Definition sp-rect.cpp:327
SVGLength rx
Definition sp-rect.h:80
void setRx(bool set, double value)
Definition sp-rect.cpp:361
double getVisibleHeight() const
Definition sp-rect.cpp:579
void setVisibleRx(double rx)
Definition sp-rect.cpp:460
double getVisibleRx() const
Definition sp-rect.cpp:486
void build(SPDocument *doc, Inkscape::XML::Node *repr) override
Definition sp-rect.cpp:56
void set(SPAttr key, char const *value) override
Definition sp-rect.cpp:75
const char * typeName() const override
The item's type name, not node tag name.
Definition sp-rect.cpp:241
SVGLength height
Definition sp-rect.h:79
SVGLength width
Definition sp-rect.h:78
const char * displayName() const override
The item's type name as a translated human string.
Definition sp-rect.cpp:245
void tag_name_changed(gchar const *oldname, gchar const *newname) override
Definition sp-rect.cpp:46
SVGLength x
Definition sp-rect.h:76
double getVisibleRy() const
Definition sp-rect.cpp:497
GenericRectType type
Definition sp-rect.h:75
~SPRect() override
void setVisibleWidth(double rx)
Definition sp-rect.cpp:550
void modified(unsigned int flags) override
Definition sp-rect.cpp:341
SPRect()
Definition sp-rect.cpp:34
void update_patheffect(bool write) override
Definition sp-rect.cpp:381
void setVisibleRy(double ry)
Definition sp-rect.cpp:473
Geom::Affine set_transform(Geom::Affine const &xform) override
Definition sp-rect.cpp:388
void setRy(bool set, double value)
Definition sp-rect.cpp:371
SVGLength ry
Definition sp-rect.h:81
void snappoints(std::vector< Inkscape::SnapCandidatePoint > &p, Inkscape::SnapPreferences const *snapprefs) const override
Definition sp-rect.cpp:590
void compensateRxRy(Geom::Affine xform)
Definition sp-rect.cpp:515
Geom::Rect getRect() const
Definition sp-rect.cpp:508
void set_shape() override
Definition sp-rect.cpp:251
void setPosition(double x, double y, double width, double height)
Definition sp-rect.cpp:352
void update(SPCtx *ctx, unsigned int flags) override
Definition sp-rect.cpp:145
SVGLength y
Definition sp-rect.h:77
static double vectorStretch(Geom::Point p0, Geom::Point p1, Geom::Affine xform)
Returns the ratio in which the vector from p0 to p1 is stretched by transform.
Definition sp-rect.cpp:452
double getVisibleWidth() const
Definition sp-rect.cpp:568
Base class for shapes, including <path> element.
Definition sp-shape.h:38
void update(SPCtx *ctx, unsigned int flags) override
Definition sp-shape.cpp:125
void setCurveInsync(SPCurve const *)
Definition sp-shape.cpp:958
bool prepareShapeForLPE(SPCurve const *c)
Definition sp-shape.cpp:479
void modified(unsigned int flags) override
Definition sp-shape.cpp:427
void set(SPAttr key, char const *value) override
Definition sp-shape.cpp:115
void setCurveBeforeLPE(SPCurve const *)
Definition sp-shape.cpp:942
void build(SPDocument *document, Inkscape::XML::Node *repr) override
Definition sp-shape.cpp:63
void update_patheffect(bool write) override
Definition sp-shape.cpp:650
std::shared_ptr< SPCurve const > _curve
Definition sp-shape.h:70
Inkscape::XML::Node * write(Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, unsigned int flags) override
Definition sp-shape.cpp:120
bool checkBrokenPathEffect()
Definition sp-shape.cpp:459
T< SPAttr::FONT_SIZE, SPIFontSize > font_size
Size of the font.
Definition style.h:116
void scale(double scale)
bool read(char const *str)
float value
Definition svg-length.h:47
void readOrUnset(char const *str, Unit u=NONE, float v=0, float c=0)
bool _set
Definition svg-length.h:41
void unset(Unit u=NONE, float v=0, float c=0)
float computed
Definition svg-length.h:50
void update(double em, double ex, double scale)
const double w
Definition conic-4.cpp:19
double c[8][4]
@ Y
Definition coord.h:48
@ X
Definition coord.h:48
Angle distance(Angle const &a, Angle const &b)
Definition angle.h:163
@ SNAPSOURCE_RECT_CORNER
Definition snap-enums.h:40
@ SNAPSOURCE_OBJECT_MIDPOINT
Definition snap-enums.h:53
@ SNAPSOURCE_LINE_MIDPOINT
Definition snap-enums.h:38
@ SNAPTARGET_RECT_CORNER
Definition snap-enums.h:93
@ SNAPTARGET_LINE_MIDPOINT
Definition snap-enums.h:84
@ SNAPTARGET_OBJECT_MIDPOINT
Definition snap-enums.h:115
static cairo_user_data_key_t key
Singleton class to access the preferences file in a convenient way.
Some utility classes to store various kinds of snap candidates.
void sp_guide_pt_pairs_to_guides(SPDocument *doc, std::list< std::pair< Geom::Point, Geom::Point > > &pts)
Definition sp-guide.cpp:268
SPGuide – a guideline.
GenericRectType
Definition sp-rect.h:23
@ SP_GENERIC_RECT
Definition sp-rect.h:25
@ SP_GENERIC_PATH
Definition sp-rect.h:26
@ SP_GENERIC_RECT_UNDEFINED
Definition sp-rect.h:24
Interface for XML documents.
Definition document.h:43
Unused.
Definition sp-object.h:94
Contains transformations to document/viewport and the viewport size.
Definition sp-item.h:92
SPStyle - a style object for SPItem objects.
static void sp_svg_write_path(Inkscape::SVG::PathString &str, Geom::Path const &p, bool normalize=false)
Definition svg-path.cpp:109
double height
double width