Inkscape
Vector Graphics Editor
Loading...
Searching...
No Matches
sp-hatch.cpp
Go to the documentation of this file.
1// SPDX-License-Identifier: GPL-2.0-or-later
6/*
7 * Authors:
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#include "sp-hatch.h"
17
18#include <cstring>
19#include <string>
20
21#include <2geom/transforms.h>
22#include <sigc++/functors/mem_fun.h>
23
24#include "style.h"
25#include "attributes.h"
26#include "bad-uri-exception.h"
27#include "document.h"
28
29#include "display/drawing.h"
31
32#include "sp-defs.h"
33#include "sp-hatch-path.h"
34#include "sp-item.h"
35
36#include "svg/svg.h"
38
40 : ref(nullptr), // avoiding 'this' in initializer list
41 _hatchUnits(UNITS_OBJECTBOUNDINGBOX),
42 _hatchUnits_set(false),
43 _hatchContentUnits(UNITS_USERSPACEONUSE),
44 _hatchContentUnits_set(false),
45 _hatchTransform_set(false)
46{
47 ref = new SPHatchReference(this);
48 ref->changedSignal().connect(sigc::mem_fun(*this, &SPHatch::_onRefChanged));
49
50 // TODO check that these should start already as unset:
51 _x.unset();
52 _y.unset();
53 _pitch.unset();
54 _rotate.unset();
55}
56
57SPHatch::~SPHatch() = default;
58
76
78{
79 if (document) {
80 // Unregister ourselves
81 document->removeResource("hatch", this);
82 }
83
84 auto children = hatchPaths();
85 for (auto &v : views) {
86 for (auto child : children) {
87 child->hide(v.key);
88 }
89 v.drawingitem.reset();
90 }
91 views.clear();
92
93 if (ref) {
94 _modified_connection.disconnect();
95 ref->detach();
96 delete ref;
97 ref = nullptr;
98 }
99
101}
102
104{
106
108
109 if (path_child) {
110 for (auto &v : views) {
112 auto ac = path_child->show(v.drawingitem->drawing(), v.key, extents);
113
114 path_child->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG);
115 if (ac) {
116 v.drawingitem->prependChild(ac);
117 }
118 }
119 }
120 //FIXME: notify all hatches that refer to this child set
121}
122
123void SPHatch::set(SPAttr key, const gchar* value)
124{
125 switch (key) {
127 if (value) {
128 if (!std::strcmp(value, "userSpaceOnUse")) {
130 } else {
132 }
133
134 _hatchUnits_set = true;
135 } else {
136 _hatchUnits_set = false;
137 }
138
140 break;
141
143 if (value) {
144 if (!std::strcmp(value, "userSpaceOnUse")) {
146 } else {
148 }
149
151 } else {
153 }
154
156 break;
157
159 Geom::Affine t;
160
161 if (value && sp_svg_transform_read(value, &t)) {
162 _hatchTransform = t;
163 _hatchTransform_set = true;
164 } else {
166 _hatchTransform_set = false;
167 }
168
170 break;
171 }
172 case SPAttr::X:
173 _x.readOrUnset(value);
175 break;
176
177 case SPAttr::Y:
178 _y.readOrUnset(value);
180 break;
181
182 case SPAttr::PITCH:
183 _pitch.readOrUnset(value);
185 break;
186
187 case SPAttr::ROTATE:
188 _rotate.readOrUnset(value);
190 break;
191
193 if (value && href == value) {
194 // Href unchanged, do nothing.
195 } else {
196 href.clear();
197
198 if (value) {
199 // First, set the href field; it's only used in the "unchanged" check above.
200 href = value;
201 // Now do the attaching, which emits the changed signal.
202 if (value) {
203 try {
204 ref->attach(Inkscape::URI(value));
205 } catch (Inkscape::BadURIException &e) {
206 g_warning("%s", e.what());
207 ref->detach();
208 }
209 } else {
210 ref->detach();
211 }
212 }
213 }
215 break;
216
217 default:
219 style->clear(key);
221 } else {
222 SPPaintServer::set(key, value);
223 }
224 break;
225 }
226}
227
229{
230 for (auto &child: hatch->children) {
232 if (hatchPath) {
233 return true;
234 }
235 }
236 return false;
237}
238
239std::vector<SPHatchPath*> SPHatch::hatchPaths()
240{
241 std::vector<SPHatchPath*> list;
242 SPHatch *src = chase_hrefs<SPHatch>(this, sigc::ptr_fun(&_hasHatchPatchChildren));
243
244 if (src) {
245 for (auto &child: src->children) {
247 if (hatchPath) {
248 list.push_back(hatchPath);
249 }
250 }
251 }
252 return list;
253}
254
255std::vector<SPHatchPath const*> SPHatch::hatchPaths() const
256{
257 std::vector<SPHatchPath const*> list;
258 SPHatch const *src = chase_hrefs<SPHatch const>(this, sigc::ptr_fun(&_hasHatchPatchChildren));
259
260 if (src) {
261 for (auto &child: src->children) {
263 if (hatchPath) {
264 list.push_back(hatchPath);
265 }
266 }
267 }
268 return list;
269}
270
271// TODO: ::remove_child and ::order_changed handles - see SPPattern
272
273
274void SPHatch::update(SPCtx* ctx, unsigned int flags)
275{
276 if (flags & SP_OBJECT_MODIFIED_FLAG) {
278 }
279
281
282 std::vector<SPHatchPath *> children(hatchPaths());
283
284 for (auto child : children) {
285 sp_object_ref(child, nullptr);
286
287 for (auto &v : views) {
289 child->setStripExtents(v.key, strip_extents);
290 }
291
292 if (flags || (child->mflags & (SP_OBJECT_MODIFIED_FLAG | SP_OBJECT_CHILD_MODIFIED_FLAG))) {
293 child->updateDisplay(ctx, flags);
294 }
295
296 sp_object_unref(child, nullptr);
297 }
298
299 for (auto &v : views) {
300 _updateView(v);
301 }
302}
303
304void SPHatch::modified(unsigned int flags)
305{
306 if (flags & SP_OBJECT_MODIFIED_FLAG) {
308 }
309
311
312 std::vector<SPHatchPath *> children(hatchPaths());
313
314 for (auto child : children) {
315 sp_object_ref(child, nullptr);
316
317 if (flags || (child->mflags & (SP_OBJECT_MODIFIED_FLAG | SP_OBJECT_CHILD_MODIFIED_FLAG))) {
318 child->emitModified(flags);
319 }
320
321 sp_object_unref(child, nullptr);
322 }
323}
324
326{
327 if (old_ref) {
328 _modified_connection.disconnect();
329 }
330
331 auto hatch = cast<SPHatch>(ref);
332 if (hatch) {
333 _modified_connection = ref->connectModified(sigc::mem_fun(*this, &SPHatch::_onRefModified));
334 }
335
336 if (!_hasHatchPatchChildren(this)) {
337 SPHatch *old_shown = nullptr;
338 SPHatch *new_shown = nullptr;
339 std::vector<SPHatchPath *> oldhatchPaths;
340 std::vector<SPHatchPath *> newhatchPaths;
341
343 if (old_hatch) {
344 old_shown = old_hatch->rootHatch();
345 oldhatchPaths = old_shown->hatchPaths();
346 }
347 if (hatch) {
348 new_shown = hatch->rootHatch();
349 newhatchPaths = new_shown->hatchPaths();
350 }
351 if (old_shown != new_shown) {
352
353 for (auto &v : views) {
355
356 for (auto child : oldhatchPaths) {
357 child->hide(v.key);
358 }
359 for (auto child : newhatchPaths) {
360 auto cai = child->show(v.drawingitem->drawing(), v.key, extents);
361 child->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG);
362 if (cai) {
363 v.drawingitem->appendChild(cai);
364 }
365
366 }
367 }
368 }
369 }
370
372}
373
374void SPHatch::_onRefModified(SPObject */*ref*/, guint /*flags*/)
375{
377 // Conditional to avoid causing infinite loop if there's a cycle in the href chain.
378}
379
381{
382 SPHatch *src = chase_hrefs<SPHatch>(this, sigc::ptr_fun(&_hasHatchPatchChildren));
383 return src ? src : this; // document is broken, we can't get to root; but at least we can return pat which is supposedly a valid hatch
384}
385
386// Access functions that look up fields up the chain of referenced hatchs and return the first one which is set
387// FIXME: all of them must use chase_hrefs as children() and rootHatch()
388
390{
391 HatchUnits units = _hatchUnits;
392 for (SPHatch const *pat_i = this; pat_i; pat_i = (pat_i->ref) ? pat_i->ref->getObject() : nullptr) {
393 if (pat_i->_hatchUnits_set) {
394 units = pat_i->_hatchUnits;
395 break;
396 }
397 }
398 return units;
399}
400
402{
404 for (SPHatch const *pat_i = this; pat_i; pat_i = (pat_i->ref) ? pat_i->ref->getObject() : nullptr) {
405 if (pat_i->_hatchContentUnits_set) {
406 units = pat_i->_hatchContentUnits;
407 break;
408 }
409 }
410 return units;
411}
412
414{
415 for (SPHatch const *pat_i = this; pat_i; pat_i = (pat_i->ref) ? pat_i->ref->getObject() : nullptr) {
416 if (pat_i->_hatchTransform_set) {
417 return pat_i->_hatchTransform;
418 }
419 }
420 return _hatchTransform;
421}
422
423gdouble SPHatch::x() const
424{
425 gdouble val = 0;
426 for (SPHatch const *pat_i = this; pat_i; pat_i = (pat_i->ref) ? pat_i->ref->getObject() : nullptr) {
427 if (pat_i->_x._set) {
428 val = pat_i->_x.computed;
429 break;
430 }
431 }
432 return val;
433}
434
435gdouble SPHatch::y() const
436{
437 gdouble val = 0;
438 for (SPHatch const *pat_i = this; pat_i; pat_i = (pat_i->ref) ? pat_i->ref->getObject() : nullptr) {
439 if (pat_i->_y._set) {
440 val = pat_i->_y.computed;
441 break;
442 }
443 }
444 return val;
445}
446
447gdouble SPHatch::pitch() const
448{
449 gdouble val = 0;
450 for (SPHatch const *pat_i = this; pat_i; pat_i = (pat_i->ref) ? pat_i->ref->getObject() : nullptr) {
451 if (pat_i->_pitch._set) {
452 val = pat_i->_pitch.computed;
453 break;
454 }
455 }
456 return val;
457}
458
459gdouble SPHatch::rotate() const
460{
461 gdouble val = 0;
462 for (SPHatch const *pat_i = this; pat_i; pat_i = (pat_i->ref) ? pat_i->ref->getObject() : nullptr) {
463 if (pat_i->_rotate._set) {
464 val = pat_i->_rotate.computed;
465 break;
466 }
467 }
468 return val;
469}
470
472{
473 if (!o)
474 return 1;
475
476 guint i = 0;
477
478 SPStyle *style = o->style;
479 if (style && style->fill.isPaintserver() && is<SPHatch>(SP_STYLE_FILL_SERVER(style)) &&
481 i++;
482 }
483 if (style && style->stroke.isPaintserver() && is<SPHatch>(SP_STYLE_STROKE_SERVER(style)) &&
485 i++;
486 }
487
488 for (auto &child : o->children) {
489 i += _countHrefs(&child);
490 }
491
492 return i;
493}
494
496{
497 SPHatch *hatch = this;
498 if (hatch->href.empty() || hatch->hrefcount > _countHrefs(item)) {
501
502 Inkscape::XML::Node *repr = xml_doc->createElement("svg:hatch");
503 repr->setAttribute("inkscape:collect", "always");
504 Glib::ustring parent_ref = Glib::ustring::compose("#%1", getRepr()->attribute("id"));
506
507 defsrepr->addChild(repr, nullptr);
508 const gchar *child_id = repr->attribute("id");
511
513
514 Glib::ustring href = Glib::ustring::compose("url(#%1)", hatch->getRepr()->attribute("id"));
515
517 sp_repr_css_set_property(css, property, href.c_str());
519 }
520
521 return hatch;
522}
523
525{
526 if (set) {
528 } else {
530 }
531
532 _hatchTransform_set = true;
533
535}
536
538{
539 bool valid = false;
540
541 if (pitch() > 0) {
542 auto children = hatchPaths();
543 if (!children.empty()) {
544 valid = true;
545 for (auto c : children) {
546 valid = c->isValid();
547 if (!valid) {
548 break;
549 }
550 }
551 }
552 }
553
554 return valid;
555}
556
558{
559 views.emplace_back(make_drawingitem<Inkscape::DrawingPattern>(drawing), bbox, key);
560 auto &v = views.back();
561 auto ai = v.drawingitem.get();
562
563 auto children = hatchPaths();
564
566 for (auto child : children) {
567 Inkscape::DrawingItem *cai = child->show(drawing, key, extents);
568 if (cai) {
570 }
571 }
572
573 _updateView(v);
574
575 return ai;
576}
577
578void SPHatch::hide(unsigned int key)
579{
580 std::vector<SPHatchPath *> children(hatchPaths());
581
582 for (auto child : children) {
583 child->hide(key);
584 }
585
586 auto it = std::find_if(views.begin(), views.end(), [=] (auto &v) {
587 return v.key == key;
588 });
589
590 if (it != views.end()) {
591 views.erase(it);
592 return;
593 }
594
596}
597
599{
601 auto children = hatchPaths();
602
603 for (auto child : children) {
604 if (result.extent() == 0) {
605 result = child->bounds();
606 } else {
607 result |= child->bounds();
608 }
609 }
610 return result;
611}
612
614{
616 for (auto const &v : views) {
617 if (v.key == key) {
618 return _calculateRenderInfo(v);
619 }
620 }
622 return info;
623}
624
626{
628 //The rendering of hatch overflow is implemented by repeated drawing
629 //of hatch paths over one strip. Within each iteration paths are moved by pitch value.
630 //The movement progresses from right to left. This gives the same result
631 //as drawing whole strips in left-to-right order.
632
633
634 view.drawingitem->setChildTransform(info.child_transform);
635 view.drawingitem->setPatternToUserTransform(info.pattern_to_user_transform);
636 view.drawingitem->setTileRect(info.tile_rect);
637 view.drawingitem->setStyle(style);
638 view.drawingitem->setOverflow(info.overflow_initial_transform, info.overflow_steps, info.overflow_step_transform);
639}
640
642{
644
646 if (extents) {
647 double tile_x = x();
648 double tile_y = y();
649 double tile_width = pitch();
650 double tile_height = extents->max() - extents->min();
651 double tile_rotate = rotate();
652 double tile_render_y = extents->min();
653
654 if (view.bbox && (hatchUnits() == UNITS_OBJECTBOUNDINGBOX)) {
655 tile_x *= view.bbox->width();
656 tile_y *= view.bbox->height();
657 tile_width *= view.bbox->width();
658 }
659
660 // Extent calculated using content units, need to correct.
662 tile_height *= view.bbox->height();
663 tile_render_y *= view.bbox->height();
664 }
665
666 // Pattern size in hatch space
668
669 // Content to bbox
672 content2ps = Geom::Affine(view.bbox->width(), 0.0, 0.0, view.bbox->height(), 0, 0);
673 }
674
675 // Tile (hatch space) to user.
677
678 info.child_transform = content2ps;
679 info.pattern_to_user_transform = ps2user;
680 info.tile_rect = hatch_tile;
681
682 if (style->overflow.computed == SP_CSS_OVERFLOW_VISIBLE) {
683 Geom::Interval bounds = this->bounds();
684 gdouble pitch = this->pitch();
685 if (view.bbox) {
687 pitch *= view.bbox->width();
688 }
690 bounds *= view.bbox->width();
691 }
692 }
694 info.overflow_steps = ceil((overflow_right_strip - bounds.min()) / pitch) + 1;
695 info.overflow_step_transform = Geom::Translate(pitch, 0.0);
696 info.overflow_initial_transform = Geom::Translate(-overflow_right_strip, 0.0);
697 } else {
698 info.overflow_steps = 1;
699 }
700 }
701
702 return info;
703}
704
705//calculates strip extents in content space
707{
708 if (!bbox || (bbox->area() == 0)) {
709 return Geom::OptInterval();
710 } else {
711 double tile_x = x();
712 double tile_y = y();
713 double tile_rotate = rotate();
714
717
718 Geom::Interval extents;
719 for (int i = 0; i < 4; ++i) {
720 Geom::Point corner = bbox->corner(i);
721 Geom::Point corner_ps = corner * user2ps;
722 if (i == 0 || corner_ps.y() < extents.min()) {
723 extents.setMin(corner_ps.y());
724 }
725 if (i == 0 || corner_ps.y() > extents.max()) {
726 extents.setMax(corner_ps.y());
727 }
728 }
729
731 extents /= bbox->height();
732 }
733
734 return extents;
735 }
736}
737
738void SPHatch::setBBox(unsigned int key, Geom::OptRect const &bbox)
739{
740 for (auto &v : views) {
741 if (v.key == key) {
742 v.bbox = bbox;
743 break;
744 }
745 }
746}
747
748/*
749 Local Variables:
750 mode:c++
751 c-file-style:"stroustrup"
752 c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
753 indent-tabs-mode:nil
754 fill-column:99
755 End:
756 */
757// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 :
bool SP_ATTRIBUTE_IS_CSS(SPAttr k)
True iff k is a property in SVG, i.e.
Lookup dictionary for attributes/properties.
SPAttr
Definition attributes.h:27
@ HATCHTRANSFORM
@ XLINK_HREF
@ HATCHCONTENTUNITS
@ HATCHUNITS
TODO: insert short description here.
3x3 matrix representing an affine transformation.
Definition affine.h:70
Affine inverse() const
Compute the inverse matrix.
Definition affine.cpp:388
constexpr void setMin(C val)
Set the lower boundary of the interval.
constexpr C min() const
constexpr C max() const
constexpr void setMax(C val)
Set the upper boundary of the interval.
C area() const
Compute the rectangle's area.
static CRect from_xywh(Coord x, Coord y, Coord w, Coord h)
Create rectangle from origin and dimensions.
Range of real numbers that is never empty.
Definition interval.h:59
Range of real numbers that can be empty.
Definition interval.h:199
Axis-aligned rectangle that can be empty.
Definition rect.h:203
Two-dimensional point that doubles as a vector.
Definition point.h:66
Axis aligned, non-empty rectangle.
Definition rect.h:92
static Rotate from_degrees(Coord deg)
Construct a rotation from its angle in degrees.
Definition transforms.h:218
Translation by a vector.
Definition transforms.h:115
SVG drawing item for display.
void appendChild(DrawingItem *item)
Drawing tree node used for rendering paints.
void detach()
Detaches from the currently attached URI target, if any; the current referrent is signaled as NULL.
sigc::signal< void(SPObject *, SPObject *)> changedSignal()
Accessor for the referrent change notification signal; this signal is emitted whenever the URIReferen...
void attach(URI const &uri)
Attaches to a URI, relative to the specified document.
Represents an URI as per RFC 2396.
Definition uri.h:36
Interface for refcounted XML nodes.
Definition node.h:80
void setAttribute(Util::const_char_ptr key, Util::const_char_ptr value)
Change an attribute of this node.
Definition node.cpp:25
virtual char const * attribute(char const *key) const =0
Get the string representation of a node's attribute.
Typed SVG document implementation.
Definition document.h:103
bool removeResource(char const *key, SPObject *object)
bool addResource(char const *key, SPObject *object)
SPObject * getObjectById(std::string const &id) const
SPDefs * getDefs()
Return the main defs object for the document.
Definition document.cpp:245
Inkscape::XML::Document * getReprDoc()
Our Inkscape::XML::Document.
Definition document.h:213
SPObject * getObjectByRepr(Inkscape::XML::Node *repr) const
SPHatch * getObject() const
Definition sp-hatch.h:151
std::vector< View > views
Definition sp-hatch.h:102
@ UNITS_OBJECTBOUNDINGBOX
Definition sp-hatch.h:46
@ UNITS_USERSPACEONUSE
Definition sp-hatch.h:45
SVGLength _x
Definition sp-hatch.h:136
void transform_multiply(Geom::Affine postmul, bool set)
Definition sp-hatch.cpp:524
gdouble x() const
Definition sp-hatch.cpp:423
RenderInfo calculateRenderInfo(unsigned key) const
Definition sp-hatch.cpp:613
Glib::ustring href
Definition sp-hatch.h:65
static bool _hasHatchPatchChildren(SPHatch const *hatch)
Definition sp-hatch.cpp:228
void modified(unsigned int flags) override
Definition sp-hatch.cpp:304
void release() override
Definition sp-hatch.cpp:77
void build(SPDocument *doc, Inkscape::XML::Node *repr) override
Definition sp-hatch.cpp:59
SVGLength _pitch
Definition sp-hatch.h:138
void _updateView(View &view)
Definition sp-hatch.cpp:625
void update(SPCtx *ctx, unsigned int flags) override
Definition sp-hatch.cpp:274
Geom::Affine _hatchTransform
Definition sp-hatch.h:132
bool isValid() const override
Definition sp-hatch.cpp:537
bool _hatchUnits_set
Definition sp-hatch.h:127
bool _hatchTransform_set
Definition sp-hatch.h:133
void set(SPAttr key, const gchar *value) override
Definition sp-hatch.cpp:123
Inkscape::DrawingPattern * show(Inkscape::Drawing &drawing, unsigned key, Geom::OptRect const &bbox) override
Definition sp-hatch.cpp:557
void hide(unsigned key) override
Definition sp-hatch.cpp:578
SVGLength _y
Definition sp-hatch.h:137
void setBBox(unsigned int key, Geom::OptRect const &bbox) override
Definition sp-hatch.cpp:738
void _onRefModified(SPObject *ref, guint flags)
Gets called when the referenced <hatch> is changed.
Definition sp-hatch.cpp:374
std::vector< SPHatchPath * > hatchPaths()
Definition sp-hatch.cpp:239
SPHatch * rootHatch()
Definition sp-hatch.cpp:380
sigc::connection _modified_connection
Definition sp-hatch.h:141
RenderInfo _calculateRenderInfo(View const &view) const
Definition sp-hatch.cpp:641
Geom::Interval bounds() const
Definition sp-hatch.cpp:598
HatchUnits _hatchUnits
Definition sp-hatch.h:126
gdouble rotate() const
Definition sp-hatch.cpp:459
HatchUnits _hatchContentUnits
Definition sp-hatch.h:128
~SPHatch() override
Geom::OptInterval _calculateStripExtents(Geom::OptRect const &bbox) const
Definition sp-hatch.cpp:706
Geom::Affine const & hatchTransform() const
Definition sp-hatch.cpp:413
gdouble y() const
Definition sp-hatch.cpp:435
HatchUnits hatchUnits() const
Definition sp-hatch.cpp:389
void _onRefChanged(SPObject *old_ref, SPObject *ref)
Gets called when the hatch is reattached to another <hatch>
Definition sp-hatch.cpp:325
HatchUnits hatchContentUnits() const
Definition sp-hatch.cpp:401
SPHatch * clone_if_necessary(SPItem *item, const gchar *property)
Definition sp-hatch.cpp:495
gdouble pitch() const
Definition sp-hatch.cpp:447
guint _countHrefs(SPObject *o) const
Count how many times hatch is used by the styles of o and its descendants.
Definition sp-hatch.cpp:471
void child_added(Inkscape::XML::Node *child, Inkscape::XML::Node *ref) override
Definition sp-hatch.cpp:103
SVGAngle _rotate
Definition sp-hatch.h:139
bool _hatchContentUnits_set
Definition sp-hatch.h:129
SPHatchReference * ref
Definition sp-hatch.h:66
Base class for visual SVG elements.
Definition sp-item.h:109
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
void setAttributeOrRemoveIfEmpty(Inkscape::Util::const_char_ptr key, Inkscape::Util::const_char_ptr value)
Definition sp-object.h:785
void requestModified(unsigned int flags)
Requests that a modification notification signal be emitted later (e.g.
SPDocument * document
Definition sp-object.h:188
virtual void set(SPAttr key, const char *value)
SPStyle * style
Represents the style properties, whether from presentation attributes, the style attribute,...
Definition sp-object.h:248
virtual void release()
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.
virtual void child_added(Inkscape::XML::Node *child, Inkscape::XML::Node *ref)
virtual void build(SPDocument *doc, Inkscape::XML::Node *repr)
ChildrenList children
Definition sp-object.h:907
void requestDisplayUpdate(unsigned int flags)
Queues an deferred update of this object's display.
An SVG style object.
Definition style.h:45
void clear()
Definition style.cpp:505
T< SPAttr::FILL, SPIPaint > fill
fill
Definition style.h:240
T< SPAttr::STROKE, SPIPaint > stroke
stroke
Definition style.h:247
T< SPAttr::OVERFLOW_, SPIEnum< SPOverflow > > overflow
overflow
Definition style.h:210
void unset(Unit u=Unit::NONE, double v=0, double c=0)
Definition svg-angle.cpp:57
void readOrUnset(gchar const *str, Unit u=Unit::NONE, double v=0, double c=0)
Definition svg-angle.cpp:64
void readOrUnset(char const *str, Unit u=NONE, float v=0, float c=0)
void unset(Unit u=NONE, float v=0, float c=0)
std::shared_ptr< Css const > css
Css & result
double c[8][4]
Canvas belonging to SVG pattern.
SVG drawing for display.
auto floor(Geom::Rect const &rect)
Definition geom.h:130
SPItem * item
Affine identity()
Create an identity matrix.
Definition affine.h:210
void setHrefAttribute(XML::Node &node, Util::const_char_ptr value)
If the 'href' attribute already exists for the given node, then set a new value for it.
static cairo_user_data_key_t key
Ocnode * child[8]
Definition quantize.cpp:33
Ocnode ** ref
Definition quantize.cpp:32
SPCSSAttr * sp_repr_css_attr_new()
Creates an empty SPCSSAttr (a class for manipulating CSS style properties).
Definition repr-css.cpp:67
void sp_repr_css_change_recursive(Node *repr, SPCSSAttr *css, gchar const *attr)
Definition repr-css.cpp:371
void sp_repr_css_set_property(SPCSSAttr *css, gchar const *name, gchar const *value)
Set a style property to a new value (e.g.
Definition repr-css.cpp:191
SVG <hatchPath> implementation.
SVG <hatch> implementation.
Some things pertinent to all visible shapes: SPItem, SPItemView, SPItemCtx.
SPObject * sp_object_unref(SPObject *object, SPObject *owner)
Decrease reference count of object, with possible debugging and finalization.
SPObject * sp_object_ref(SPObject *object, SPObject *owner)
Increase reference count of object, with possible debugging.
Interface for XML documents.
Definition document.h:43
DrawingItemPtr< DrawingItemType > drawingitem
Definition object-view.h:23
Geom::OptRect bbox
Definition object-view.h:24
Unused.
Definition sp-object.h:94
@ SP_CSS_OVERFLOW_VISIBLE
SPStyle - a style object for SPItem objects.
bool sp_svg_transform_read(gchar const *str, Geom::Affine *transform)
std::string sp_svg_transform_write(Geom::Affine const &transform)
Affine transformation classes.