Inkscape
Vector Graphics Editor
Loading...
Searching...
No Matches
sp-pattern.cpp
Go to the documentation of this file.
1// SPDX-License-Identifier: GPL-2.0-or-later
2/*
3 * SVG <pattern> implementation
4 *
5 * Author:
6 * Lauris Kaplinski <lauris@kaplinski.com>
7 * bulia byak <buliabyak@users.sf.net>
8 * Jon A. Cruz <jon@joncruz.org>
9 * Abhishek Sharma
10 *
11 * Copyright (C) 2002 Lauris Kaplinski
12 *
13 * Released under GNU GPL v2+, read the file 'COPYING' for more information.
14 */
15
16#include "sp-pattern.h"
17
18#include <string>
19#include <cstring>
20
21#include <2geom/transforms.h>
22
23#include <glibmm.h>
24
25#include "attributes.h"
26#include "bad-uri-exception.h"
27#include "document.h"
28
29#include "sp-defs.h"
30#include "sp-factory.h"
31#include "sp-item.h"
32
33#include "display/cairo-utils.h"
36#include "display/drawing.h"
39
40#include "svg/svg.h"
42
44 : URIReference(owner)
45{
46}
47
49{
50 return static_cast<SPPattern*>(URIReference::getObject());
51}
52
54{
55 return is<SPPattern>(obj) && URIReference::_acceptObject(obj);
56}
57
58/*
59 *
60 */
61
63 : ref(this)
64 , _pattern_units(UNITS_OBJECTBOUNDINGBOX)
65 , _pattern_units_set(false)
66 , _pattern_content_units(UNITS_USERSPACEONUSE)
67 , _pattern_content_units_set(false)
68 , _pattern_transform_set(false)
69 , shown(nullptr)
70{
71 ref.changedSignal().connect(sigc::mem_fun(*this, &SPPattern::_onRefChanged));
72}
73
74SPPattern::~SPPattern() = default;
75
94
96{
97 if (document) {
98 document->removeResource("pattern", this);
99 }
100
101 // Should have been unattached by their owners on the release signal.
102 assert(attached_views.empty());
103
104 set_shown(nullptr);
105 views.clear();
106
107 _modified_connection.disconnect();
108 ref.detach();
109
111}
112
113void SPPattern::set(SPAttr key, char const *value)
114{
115 switch (key) {
118 _pattern_units_set = false;
119
120 if (value) {
121 if (!std::strcmp(value, "userSpaceOnUse")) {
123 _pattern_units_set = true;
124 } else if (!std::strcmp(value, "objectBoundingBox")) {
125 _pattern_units_set = true;
126 }
127 }
128
130 break;
131
135
136 if (value) {
137 if (!std::strcmp(value, "userSpaceOnUse")) {
139 } else if (!std::strcmp(value, "objectBoundingBox")) {
142 }
143 }
144
146 break;
147
151
152 if (value) {
153 Geom::Affine t;
154 if (sp_svg_transform_read(value, &t)) {
157 }
158 }
159
161 break;
162 }
163 case SPAttr::X:
164 _x.readOrUnset(value);
166 break;
167
168 case SPAttr::Y:
169 _y.readOrUnset(value);
171 break;
172
173 case SPAttr::WIDTH:
174 _width.readOrUnset(value);
176 break;
177
178 case SPAttr::HEIGHT:
179 _height.readOrUnset(value);
181 break;
182
183 case SPAttr::VIEWBOX:
184 set_viewBox(value);
186 break;
187
191 break;
192
194 if (!value) {
195 if (href.empty()) {
196 break;
197 }
198 href.clear();
199 ref.detach();
200 } else {
201 if (href == value) {
202 break;
203 }
204 href = value;
205
206 // Attempt to attach ref, which emits the changed signal.
207 try {
208 ref.attach(Inkscape::URI(href.data()));
209 } catch (Inkscape::BadURIException const &e) {
210 g_warning("%s", e.what());
211 href.clear();
212 ref.detach();
213 }
214 }
216 break;
217
218 default:
219 SPPaintServer::set(key, value);
220 break;
221 }
222}
223
224void SPPattern::update(SPCtx *ctx, unsigned flags)
225{
226 auto const cflags = cascade_flags(flags);
227
228 for (auto c : childList(true)) {
230 c->updateDisplay(ctx, cflags);
231 }
232 sp_object_unref(c, nullptr);
233 }
234
235 for (auto &v : views) {
236 update_view(v);
237 }
238}
239
241{
242 // * "width" and "height" determine tile size.
243 // * "viewBox" (if defined) or "patternContentUnits" determines placement of content inside tile.
244 // * "x", "y", and "patternTransform" transform tile to user space after tile is generated.
245
246 // These functions recursively search up the tree to find the values.
247 double tile_x = x();
248 double tile_y = y();
249 double tile_width = width();
250 double tile_height = height();
251 if (v.bbox && patternUnits() == UNITS_OBJECTBOUNDINGBOX) {
252 tile_x *= v.bbox->width();
253 tile_y *= v.bbox->height();
254 tile_width *= v.bbox->width();
255 tile_height *= v.bbox->height();
256 }
257
258 // Pattern size in pattern space
260
261 // Content to tile (pattern space)
263 if (auto effective_view_box = viewbox()) {
264 // viewBox to pattern server (using SPViewBox)
268 content2ps = c2p;
269 }
270 else {
271 // Content to bbox
272 if (v.bbox && patternContentUnits() == UNITS_OBJECTBOUNDINGBOX) {
273 content2ps = Geom::Affine(v.bbox->width(), 0.0, 0.0, v.bbox->height(), 0, 0);
274 }
275 }
276
277 // Tile (pattern space) to user.
279
280 v.drawingitem->setTileRect(pattern_tile);
281 v.drawingitem->setChildTransform(content2ps);
282 v.drawingitem->setPatternToUserTransform(ps2user);
283}
284
285void SPPattern::modified(unsigned flags)
286{
287 auto const cflags = cascade_flags(flags);
288
289 for (auto c : childList(true)) {
290 if (auto lpeitem = cast<SPLPEItem>(c)) {
292 }
294 c->emitModified(cflags);
295 }
297 }
298
300}
301
302// The following three functions are based on SPGroup.
303
305{
307
308 auto last_child = lastChild();
309 if (last_child && last_child->getRepr() == child) {
310 if (auto item = cast<SPItem>(last_child)) {
311 for (auto &v : attached_views) {
312 auto ac = item->invoke_show(v.drawingitem->drawing(), v.key, SP_ITEM_SHOW_DISPLAY);
313 if (ac) {
314 v.drawingitem->appendChild(ac);
315 }
316 }
317 }
318 } else {
320 unsigned position = item->pos_in_parent();
321 for (auto &v : attached_views) {
322 auto ac = item->invoke_show(v.drawingitem->drawing(), v.key, SP_ITEM_SHOW_DISPLAY);
323 if (ac) {
324 v.drawingitem->prependChild(ac);
325 ac->setZOrder(position);
326 }
327 }
328 }
329 }
330
332}
333
335{
337 // no need to do anything as child will automatically remove itself
339}
340
342{
344
346 unsigned position = item->pos_in_parent();
347 for (auto &v : attached_views) {
348 auto ac = item->get_arenaitem(v.key);
349 ac->setZOrder(position);
350 }
351 }
352
354}
355
357{
358 if (old_ref) {
359 _modified_connection.disconnect();
360 }
361
362 if (is<SPPattern>(ref)) {
363 _modified_connection = ref->connectModified(sigc::mem_fun(*this, &SPPattern::_onRefModified));
364 }
365
367}
368
369void SPPattern::_onRefModified(SPObject */*ref*/, unsigned /*flags*/)
370{
372}
373
375{
376 if (shown == new_shown) {
377 return;
378 }
379
380 if (shown) {
381 for (auto &v : views) {
382 shown->unattach_view(v.drawingitem.get());
383 }
384
385 shown_released_connection.disconnect();
386 }
387
389
390 if (shown) {
391 for (auto &v : views) {
392 shown->attach_view(v.drawingitem.get(), v.key);
393 }
394
396 set_shown(nullptr);
397 });
398 }
399}
400
402{
403 attached_views.push_back({di, key});
404
405 for (auto &c : children) {
406 if (auto child = cast<SPItem>(&c)) {
407 auto item = child->invoke_show(di->drawing(), key, SP_ITEM_SHOW_DISPLAY);
409 }
410 }
411}
412
414{
415 auto it = std::find_if(attached_views.begin(), attached_views.end(), [di] (auto const &v) {
416 return v.drawingitem == di;
417 });
418 assert(it != attached_views.end());
419
420 for (auto &c : children) {
421 if (auto child = cast<SPItem>(&c)) {
422 child->invoke_hide(it->key);
423 }
424 }
425
426 attached_views.erase(it);
427}
428
430{
431 if (!o)
432 return 1;
433
434 guint i = 0;
435
436 SPStyle *style = o->style;
437 if (style && style->fill.isPaintserver() && is<SPPattern>(SP_STYLE_FILL_SERVER(style)) &&
439 i++;
440 }
441 if (style && style->stroke.isPaintserver() && is<SPPattern>(SP_STYLE_STROKE_SERVER(style)) &&
443 i++;
444 }
445
446 for (auto& child: o->children) {
447 i += _countHrefs(&child);
448 }
449
450 return i;
451}
452
454{
457
458 Inkscape::XML::Node *repr = xml_doc->createElement("svg:pattern");
459 repr->setAttribute("inkscape:collect", "always");
460 Glib::ustring parent_ref = Glib::ustring::compose("#%1", getRepr()->attribute("id"));
462 // this attribute is used to express uniform pattern scaling in pattern editor, so keep it
463 repr->setAttribute("preserveAspectRatio", getRepr()->attribute("preserveAspectRatio"));
464
465 defsrepr->addChild(repr, nullptr);
469
470 return cast<SPPattern>(child);
471}
472
474{
475 SPPattern *pattern = this;
476 if (pattern->href.empty() || pattern->hrefcount > _countHrefs(item)) {
477 pattern = _chain();
478 Glib::ustring href = Glib::ustring::compose("url(#%1)", pattern->getRepr()->attribute("id"));
479
481 sp_repr_css_set_property(css, property, href.c_str());
483 }
484 return pattern;
485}
486
487// do not remove identity transform in pattern elements; when patterns are referenced then linking
488// pattern transform overrides root/referenced pattern transform; if it disappears then root transform
489// takes over and that's not what we want
490static std::string write_transform(const Geom::Affine& transform) {
491 if (transform.isIdentity()) {
492 return "scale(1)";
493 }
494 return sp_svg_transform_write(transform);
495}
496
498{
499 // this formula is for a different interpretation of pattern transforms as described in (*) in sp-pattern.cpp
500 // for it to work, we also need sp_object_read_attr( item, "transform");
501 // pattern->patternTransform = premul * item->transform * pattern->patternTransform * item->transform.inverse() *
502 // postmul;
503
504 // otherwise the formula is much simpler
505 if (set) {
507 }
508 else {
510 }
512
514}
515
516char const *SPPattern::produce(std::vector<Inkscape::XML::Node*> const &reprs, Geom::Rect const &bounds,
517 SPDocument *document, Geom::Affine const &transform, Geom::Affine const &move)
518{
521
522 Inkscape::XML::Node *repr = xml_doc->createElement("svg:pattern");
523 repr->setAttribute("patternUnits", "userSpaceOnUse");
526 repr->setAttributeOrRemoveIfEmpty("patternTransform", write_transform(transform));
527 // by default use uniform scaling
528 repr->setAttribute("preserveAspectRatio", "xMidYMid");
529 defsrepr->appendChild(repr);
530 const gchar *pd = repr->attribute("id");
532 bool can_colorize = false;
533
534 for (auto node : reprs) {
535 auto copy = cast<SPItem>(pat_object->appendChildRepr(node));
536
537 if (!repr->attribute("inkscape:label") && node->attribute("inkscape:label")) {
538 repr->setAttribute("inkscape:label", node->attribute("inkscape:label"));
539 }
540
541 // if some elements have undefined color or solid black, then their fill color is customizable
542 if (copy->style && copy->style->isSet(SPAttr::FILL)) {
543 if (auto paint = copy->style->getFillOrStroke(true)) {
544 if (paint->isColor() && paint->getColor().toRGBA() == 255) { // black color set?
545 can_colorize = true;
546 // remove black fill, it will be inherited from pattern
547 paint->clear();
548 }
549 }
550 }
551 else {
552 // no color - it will be inherited
553 can_colorize = true;
554 }
555
559 dup_transform *= move;
560
561 copy->doWriteTransform(dup_transform, nullptr, false);
562 }
563
564 if (can_colorize && pat_object->style) {
565 // add black fill style to the pattern object - it will tell pattern editor to enable color selector
566 pat_object->style->readIfUnset(SPAttr::FILL, "black");
567 }
568
570 return pd;
571}
572
574{
575 for (auto p = this; p; p = p->ref.getObject()) {
576 if (p->firstChild()) { // find the first one with children
577 return p;
578 }
579 }
580 return this; // document is broken, we can't get to root; but at least we can return ourself which is supposedly a valid pattern
581}
582
584{
585 return const_cast<SPPattern*>(std::as_const(*this).rootPattern());
586}
587
588// Access functions that look up fields up the chain of referenced patterns and return the first one which is set
589
591{
592 for (auto p = this; p; p = p->ref.getObject()) {
593 if (p->_pattern_units_set)
594 return p->_pattern_units;
595 }
596 return _pattern_units;
597}
598
600{
601 for (auto p = this; p; p = p->ref.getObject()) {
602 if (p->_pattern_content_units_set)
603 return p->_pattern_content_units;
604 }
606}
607
609{
610 for (auto p = this; p; p = p->ref.getObject()) {
611 if (p->_pattern_transform_set)
612 return p->_pattern_transform;
613 }
614 return _pattern_transform;
615}
616
620
621double SPPattern::x() const
622{
623 for (auto p = this; p; p = p->ref.getObject()) {
624 if (p->_x._set)
625 return p->_x.computed;
626 }
627 return 0;
628}
629
630double SPPattern::y() const
631{
632 for (auto p = this; p; p = p->ref.getObject()) {
633 if (p->_y._set)
634 return p->_y.computed;
635 }
636 return 0;
637}
638
639double SPPattern::width() const
640{
641 for (auto p = this; p; p = p->ref.getObject()) {
642 if (p->_width._set)
643 return p->_width.computed;
644 }
645 return 0;
646}
647
648double SPPattern::height() const
649{
650 for (auto p = this; p; p = p->ref.getObject()) {
651 if (p->_height._set)
652 return p->_height.computed;
653 }
654 return 0;
655}
656
658{
660 for (auto p = this; p; p = p->ref.getObject()) {
661 if (p->viewBox_set) {
662 viewbox = p->viewBox;
663 break;
664 }
665 }
666 return viewbox;
667}
668
670{
671 return std::any_of(children.begin(), children.end(),
672 [](SPObject const &child) -> bool { return is<SPItem>(&child); });
673}
674
676{
677 return width() > 0 && height() > 0;
678}
679
681{
682 views.emplace_back(make_drawingitem<Inkscape::DrawingPattern>(drawing), bbox, key);
683 auto &v = views.back();
684 auto root = v.drawingitem.get();
685
686 if (shown) {
688 }
689
690 root->setStyle(style);
691
692 update_view(v);
693
694 return root;
695}
696
697void SPPattern::hide(unsigned key)
698{
699 auto it = std::find_if(views.begin(), views.end(), [=] (auto &v) {
700 return v.key == key;
701 });
702
703 if (it == views.end()) {
704 return;
705 }
706
707 if (shown) {
708 shown->unattach_view(it->drawingitem.get());
709 }
710
711 views.erase(it);
712}
713
714void SPPattern::setBBox(unsigned key, Geom::OptRect const &bbox)
715{
716 auto it = std::find_if(views.begin(), views.end(), [=] (auto &v) {
717 return v.key == key;
718 });
719 assert(it != views.end());
720 auto &v = *it;
721
722 v.bbox = bbox;
723 update_view(v);
724}
725
726/*
727 Local Variables:
728 mode:c++
729 c-file-style:"stroustrup"
730 c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
731 indent-tabs-mode:nil
732 fill-column:99
733 End:
734*/
735// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 :
Lookup dictionary for attributes/properties.
SPAttr
Definition attributes.h:27
@ PATTERNUNITS
@ XLINK_HREF
@ PRESERVEASPECTRATIO
@ PATTERNCONTENTUNITS
@ PATTERNTRANSFORM
TODO: insert short description here.
Cairo integration helpers.
Geom::IntRect bounds
Definition canvas.cpp:182
3x3 matrix representing an affine transformation.
Definition affine.h:70
bool isIdentity(Coord eps=EPSILON) const
Check whether this matrix is an identity matrix.
Definition affine.cpp:109
void setIdentity()
Sets this matrix to be the Identity Affine.
Definition affine.cpp:96
static CRect from_xywh(Coord x, Coord y, Coord w, Coord h)
Create rectangle from origin and dimensions.
CPoint dimensions() const
Get rectangle's width and height as a point.
Axis-aligned rectangle that can be empty.
Definition rect.h:203
Axis aligned, non-empty rectangle.
Definition rect.h:92
Translation by a vector.
Definition transforms.h:115
void appendChild(DrawingItem *item)
void setZOrder(unsigned zorder)
Move this item to the given place in the Z order of siblings. Does nothing if the item is not a norma...
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 setAttributeOrRemoveIfEmpty(Inkscape::Util::const_char_ptr key, Inkscape::Util::const_char_ptr value)
Change an attribute of this node.
Definition node.cpp:167
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.
bool setAttributeSvgDouble(Util::const_char_ptr key, double val)
For attributes where an exponent is allowed.
Definition node.cpp:111
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
Base class for visual SVG elements.
Definition sp-item.h:109
Inkscape::DrawingItem * invoke_show(Inkscape::Drawing &drawing, unsigned int key, unsigned int flags)
Definition sp-item.cpp:1269
Inkscape::DrawingItem * get_arenaitem(unsigned key) const
Return the arenaitem corresponding to the given item in the display with the given key.
Definition sp-item.cpp:1848
unsigned int pos_in_parent() const
Definition sp-item.cpp:1076
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.
std::vector< SPObject * > childList(bool add_ref, Action action=ActionGeneral)
Retrieves the children as a std vector object, optionally ref'ing the children in the process,...
SPObject * lastChild()
Definition sp-object.h:318
SPObject * get_child_by_repr(Inkscape::XML::Node *repr)
Return object's child whose node pointer equals repr.
SPDocument * document
Definition sp-object.h:188
virtual void set(SPAttr key, const char *value)
virtual void remove_child(Inkscape::XML::Node *child)
SPStyle * style
Represents the style properties, whether from presentation attributes, the style attribute,...
Definition sp-object.h:248
sigc::connection connectRelease(sigc::slot< void(SPObject *)> slot)
Connects to the release request signal.
Definition sp-object.h:237
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)
virtual void order_changed(Inkscape::XML::Node *child, Inkscape::XML::Node *old_repr, Inkscape::XML::Node *new_repr)
ChildrenList children
Definition sp-object.h:907
unsigned int hrefcount
Definition sp-object.h:186
void requestDisplayUpdate(unsigned int flags)
Queues an deferred update of this object's display.
bool _acceptObject(SPObject *obj) const override
SPPattern * getObject() const
SPPatternReference(SPPattern *owner)
void setBBox(unsigned key, Geom::OptRect const &bbox) override
void order_changed(Inkscape::XML::Node *child, Inkscape::XML::Node *old_ref, Inkscape::XML::Node *new_ref) override
unsigned _countHrefs(SPObject *o) const
Count how many times pattern is used by the styles of o and its descendants.
SPPattern::PatternUnits patternUnits() const
static char const * produce(std::vector< Inkscape::XML::Node * > const &reprs, Geom::Rect const &bounds, SPDocument *document, Geom::Affine const &transform, Geom::Affine const &move)
create a new pattern in XML tree
void transform_multiply(Geom::Affine postmul, bool set)
sigc::connection shown_released_connection
Definition sp-pattern.h:153
void _onRefChanged(SPObject *old_ref, SPObject *ref)
Gets called when the pattern is reattached to another <pattern>
void release() override
double width() const
SPPattern::PatternUnits patternContentUnits() const
SPPattern const * rootPattern() const
SVGLength _width
Definition sp-pattern.h:141
Geom::Affine _pattern_transform
Definition sp-pattern.h:136
void unattach_view(Inkscape::DrawingPattern *di)
SVGLength _y
Definition sp-pattern.h:140
bool hasItemChildren() const
SVGLength _x
Definition sp-pattern.h:139
sigc::connection _modified_connection
Definition sp-pattern.h:144
void child_added(Inkscape::XML::Node *child, Inkscape::XML::Node *ref) override
void set_shown(SPPattern *new_shown)
bool isValid() const override
double x() const
SPPattern * shown
The pattern at the end of the href chain, currently tasked with keeping our DrawingPattern up to date...
Definition sp-pattern.h:152
PatternUnits _pattern_units
Definition sp-pattern.h:131
void hide(unsigned key) override
double y() const
bool _pattern_units_set
Definition sp-pattern.h:132
SVGLength _height
Definition sp-pattern.h:142
void attach_view(Inkscape::DrawingPattern *di, unsigned key)
Inkscape::DrawingPattern * show(Inkscape::Drawing &drawing, unsigned key, Geom::OptRect const &bbox) override
void update_view(View &v)
void modified(unsigned flags) override
bool _pattern_transform_set
Definition sp-pattern.h:137
bool _pattern_content_units_set
Definition sp-pattern.h:134
std::vector< View > views
Definition sp-pattern.h:170
SPPattern * clone_if_necessary(SPItem *item, char const *property)
Geom::OptRect viewbox() const
std::vector< AttachedView > attached_views
Definition sp-pattern.h:165
void update(SPCtx *ctx, unsigned flags) override
void _onRefModified(SPObject *ref, unsigned flags)
Gets called when the referenced <pattern> is changed.
void build(SPDocument *doc, Inkscape::XML::Node *repr) override
double height() const
PatternUnits _pattern_content_units
Definition sp-pattern.h:133
Geom::Affine const & getTransform() const
@ UNITS_OBJECTBOUNDINGBOX
Definition sp-pattern.h:57
@ UNITS_USERSPACEONUSE
Definition sp-pattern.h:56
Glib::ustring href
Definition sp-pattern.h:65
void remove_child(Inkscape::XML::Node *child) override
SPPatternReference ref
Definition sp-pattern.h:66
SPPattern * _chain() const
const Geom::Affine & get_this_transform() const
void set(SPAttr key, char const *value) override
~SPPattern() override
An SVG style object.
Definition style.h:45
T< SPAttr::FILL, SPIPaint > fill
fill
Definition style.h:240
T< SPAttr::STROKE, SPIPaint > stroke
stroke
Definition style.h:247
void set_viewBox(const gchar *value)
Definition viewbox.cpp:50
Geom::Rect viewBox
Definition viewbox.h:35
Geom::Affine c2p
Definition viewbox.h:43
void set_preserveAspectRatio(const gchar *value)
Definition viewbox.cpp:98
void apply_viewbox(const Geom::Rect &in, double scale_none=1.0)
Definition viewbox.cpp:182
void readOrUnset(char const *str, Unit u=NONE, float v=0, float c=0)
RootCluster root
std::shared_ptr< Css const > css
double c[8][4]
Cairo drawing context with Inkscape extensions.
Group belonging to an SVG drawing element.
Canvas belonging to SVG pattern.
Cairo surface that remembers its origin.
SVG drawing for display.
@ Y
Definition coord.h:48
@ X
Definition coord.h:48
SPItem * item
Inkscape::XML::Node * node
Affine identity()
Create an identity matrix.
Definition affine.h:210
static R & release(R &r)
Decrements the reference count of a anchored object.
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
Some things pertinent to all visible shapes: SPItem, SPItemView, SPItemCtx.
void sp_lpe_item_enable_path_effects(SPLPEItem *lpeitem, bool enable)
SPObject * sp_object_unref(SPObject *object, SPObject *owner)
Decrease reference count of object, with possible debugging and finalization.
unsigned cascade_flags(unsigned flags)
Definition sp-object.h:60
static std::string write_transform(const Geom::Affine &transform)
SVG <pattern> implementation.
Interface for XML documents.
Definition document.h:43
Unused.
Definition sp-object.h:94
bool sp_svg_transform_read(gchar const *str, Geom::Affine *transform)
std::string sp_svg_transform_write(Geom::Affine const &transform)
Affine transformation classes.