50 return static_cast<SPPattern*
>(URIReference::getObject());
55 return is<SPPattern>(obj) && URIReference::_acceptObject(obj);
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)
121 if (!std::strcmp(value,
"userSpaceOnUse")) {
124 }
else if (!std::strcmp(value,
"objectBoundingBox")) {
137 if (!std::strcmp(value,
"userSpaceOnUse")) {
139 }
else if (!std::strcmp(value,
"objectBoundingBox")) {
235 for (
auto &v :
views) {
252 tile_x *= v.bbox->width();
253 tile_y *= v.bbox->height();
282 v.drawingitem->setPatternToUserTransform(
ps2user);
314 v.drawingitem->appendChild(ac);
324 v.drawingitem->prependChild(ac);
325 ac->setZOrder(position);
381 for (
auto &v :
views) {
391 for (
auto &v :
views) {
416 return v.drawingitem == di;
460 Glib::ustring
parent_ref = Glib::ustring::compose(
"#%1",
getRepr()->attribute(
"id"));
543 if (
auto paint = copy->style->getFillOrStroke(
true)) {
544 if (paint->isColor() && paint->getColor().toRGBA() == 255) {
575 for (
auto p =
this; p; p = p->ref.getObject()) {
576 if (p->firstChild()) {
585 return const_cast<SPPattern*
>(std::as_const(*this).rootPattern());
592 for (
auto p =
this; p; p = p->ref.getObject()) {
593 if (p->_pattern_units_set)
601 for (
auto p =
this; p; p = p->ref.getObject()) {
602 if (p->_pattern_content_units_set)
603 return p->_pattern_content_units;
610 for (
auto p =
this; p; p = p->ref.getObject()) {
611 if (p->_pattern_transform_set)
612 return p->_pattern_transform;
623 for (
auto p =
this; p; p = p->ref.getObject()) {
625 return p->_x.computed;
632 for (
auto p =
this; p; p = p->ref.getObject()) {
634 return p->_y.computed;
641 for (
auto p =
this; p; p = p->ref.getObject()) {
643 return p->_width.computed;
650 for (
auto p =
this; p; p = p->ref.getObject()) {
652 return p->_height.computed;
660 for (
auto p =
this; p; p = p->ref.getObject()) {
661 if (p->viewBox_set) {
672 [](
SPObject const &
child) ->
bool { return is<SPItem>(&child); });
683 auto &v =
views.back();
684 auto root = v.drawingitem.get();
699 auto it = std::find_if(
views.begin(),
views.end(), [=] (
auto &v) {
716 auto it = std::find_if(
views.begin(),
views.end(), [=] (
auto &v) {
Lookup dictionary for attributes/properties.
TODO: insert short description here.
Cairo integration helpers.
3x3 matrix representing an affine transformation.
bool isIdentity(Coord eps=EPSILON) const
Check whether this matrix is an identity matrix.
void setIdentity()
Sets this matrix to be the Identity Affine.
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.
Axis aligned, non-empty rectangle.
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.
Interface for refcounted XML nodes.
void setAttributeOrRemoveIfEmpty(Inkscape::Util::const_char_ptr key, Inkscape::Util::const_char_ptr value)
Change an attribute of this node.
void setAttribute(Util::const_char_ptr key, Util::const_char_ptr value)
Change an attribute of this node.
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.
Typed SVG document implementation.
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.
Inkscape::XML::Document * getReprDoc()
Our Inkscape::XML::Document.
SPObject * getObjectByRepr(Inkscape::XML::Node *repr) const
Base class for visual SVG elements.
Inkscape::DrawingItem * invoke_show(Inkscape::Drawing &drawing, unsigned int key, unsigned int flags)
Inkscape::DrawingItem * get_arenaitem(unsigned key) const
Return the arenaitem corresponding to the given item in the display with the given key.
unsigned int pos_in_parent() const
SPObject is an abstract base class of all of the document nodes at the SVG document level.
Inkscape::XML::Node * repr
void setAttributeOrRemoveIfEmpty(Inkscape::Util::const_char_ptr key, Inkscape::Util::const_char_ptr value)
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 * get_child_by_repr(Inkscape::XML::Node *repr)
Return object's child whose node pointer equals repr.
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,...
sigc::connection connectRelease(sigc::slot< void(SPObject *)> slot)
Connects to the release request signal.
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)
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
void _onRefChanged(SPObject *old_ref, SPObject *ref)
Gets called when the pattern is reattached to another <pattern>
SPPattern::PatternUnits patternContentUnits() const
SPPattern const * rootPattern() const
Geom::Affine _pattern_transform
void unattach_view(Inkscape::DrawingPattern *di)
bool hasItemChildren() const
sigc::connection _modified_connection
void child_added(Inkscape::XML::Node *child, Inkscape::XML::Node *ref) override
void set_shown(SPPattern *new_shown)
bool isValid() const override
SPPattern * shown
The pattern at the end of the href chain, currently tasked with keeping our DrawingPattern up to date...
PatternUnits _pattern_units
void hide(unsigned key) override
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
bool _pattern_content_units_set
std::vector< View > views
SPPattern * clone_if_necessary(SPItem *item, char const *property)
Geom::OptRect viewbox() const
std::vector< AttachedView > attached_views
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
PatternUnits _pattern_content_units
Geom::Affine const & getTransform() const
@ UNITS_OBJECTBOUNDINGBOX
void remove_child(Inkscape::XML::Node *child) override
SPPattern * _chain() const
const Geom::Affine & get_this_transform() const
void set(SPAttr key, char const *value) override
T< SPAttr::FILL, SPIPaint > fill
fill
T< SPAttr::STROKE, SPIPaint > stroke
stroke
void set_viewBox(const gchar *value)
void set_preserveAspectRatio(const gchar *value)
void apply_viewbox(const Geom::Rect &in, double scale_none=1.0)
void readOrUnset(char const *str, Unit u=NONE, float v=0, float c=0)
std::shared_ptr< Css const > css
Cairo drawing context with Inkscape extensions.
Group belonging to an SVG drawing element.
Canvas belonging to SVG pattern.
Cairo surface that remembers its origin.
Inkscape::XML::Node * node
Affine identity()
Create an identity matrix.
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
SPCSSAttr * sp_repr_css_attr_new()
Creates an empty SPCSSAttr (a class for manipulating CSS style properties).
void sp_repr_css_change_recursive(Node *repr, SPCSSAttr *css, gchar const *attr)
void sp_repr_css_set_property(SPCSSAttr *css, gchar const *name, gchar const *value)
Set a style property to a new value (e.g.
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)
static std::string write_transform(const Geom::Affine &transform)
SVG <pattern> implementation.
Interface for XML documents.
bool sp_svg_transform_read(gchar const *str, Geom::Affine *transform)
std::string sp_svg_transform_write(Geom::Affine const &transform)