22#include <sigc++/functors/mem_fun.h>
41 _hatchUnits(UNITS_OBJECTBOUNDINGBOX),
42 _hatchUnits_set(false),
43 _hatchContentUnits(UNITS_USERSPACEONUSE),
44 _hatchContentUnits_set(false),
45 _hatchTransform_set(false)
85 for (
auto &v :
views) {
89 v.drawingitem.reset();
110 for (
auto &v :
views) {
112 auto ac =
path_child->show(v.drawingitem->drawing(), v.key, extents);
116 v.drawingitem->prependChild(ac);
128 if (!std::strcmp(value,
"userSpaceOnUse")) {
144 if (!std::strcmp(value,
"userSpaceOnUse")) {
193 if (value &&
href == value) {
241 std::vector<SPHatchPath*> list;
257 std::vector<SPHatchPath const*> list;
287 for (
auto &v :
views) {
299 for (
auto &v :
views) {
318 child->emitModified(flags);
353 for (
auto &v :
views) {
360 auto cai =
child->show(v.drawingitem->drawing(), v.key, extents);
363 v.drawingitem->appendChild(
cai);
383 return src ? src :
this;
393 if (
pat_i->_hatchUnits_set) {
405 if (
pat_i->_hatchContentUnits_set) {
406 units =
pat_i->_hatchContentUnits;
416 if (
pat_i->_hatchTransform_set) {
417 return pat_i->_hatchTransform;
427 if (
pat_i->_x._set) {
428 val =
pat_i->_x.computed;
439 if (
pat_i->_y._set) {
440 val =
pat_i->_y.computed;
451 if (
pat_i->_pitch._set) {
452 val =
pat_i->_pitch.computed;
463 if (
pat_i->_rotate._set) {
464 val =
pat_i->_rotate.computed;
504 Glib::ustring
parent_ref = Glib::ustring::compose(
"#%1",
getRepr()->attribute(
"id"));
514 Glib::ustring
href = Glib::ustring::compose(
"url(#%1)",
hatch->getRepr()->attribute(
"id"));
546 valid =
c->isValid();
560 auto &v =
views.back();
561 auto ai = v.drawingitem.get();
586 auto it = std::find_if(
views.begin(),
views.end(), [=] (
auto &v) {
604 if (
result.extent() == 0) {
616 for (
auto const &v :
views) {
635 view.
drawingitem->setPatternToUserTransform(
info.pattern_to_user_transform);
638 view.
drawingitem->setOverflow(
info.overflow_initial_transform,
info.overflow_steps,
info.overflow_step_transform);
650 double tile_height = extents->max() - extents->min();
698 info.overflow_steps = 1;
708 if (!bbox || (bbox->
area() == 0)) {
719 for (
int i = 0; i < 4; ++i) {
731 extents /= bbox->height();
740 for (
auto &v :
views) {
bool SP_ATTRIBUTE_IS_CSS(SPAttr k)
True iff k is a property in SVG, i.e.
Lookup dictionary for attributes/properties.
TODO: insert short description here.
3x3 matrix representing an affine transformation.
Affine inverse() const
Compute the inverse matrix.
constexpr void setMin(C val)
Set the lower boundary of the interval.
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.
Range of real numbers that can be empty.
Axis-aligned rectangle that can be empty.
Two-dimensional point that doubles as a vector.
Axis aligned, non-empty rectangle.
static Rotate from_degrees(Coord deg)
Construct a rotation from its angle in degrees.
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.
Interface for refcounted XML nodes.
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.
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
SPHatch * getObject() const
std::vector< View > views
@ UNITS_OBJECTBOUNDINGBOX
void transform_multiply(Geom::Affine postmul, bool set)
RenderInfo calculateRenderInfo(unsigned key) const
static bool _hasHatchPatchChildren(SPHatch const *hatch)
void modified(unsigned int flags) override
void build(SPDocument *doc, Inkscape::XML::Node *repr) override
void _updateView(View &view)
void update(SPCtx *ctx, unsigned int flags) override
Geom::Affine _hatchTransform
bool isValid() const override
void set(SPAttr key, const gchar *value) override
Inkscape::DrawingPattern * show(Inkscape::Drawing &drawing, unsigned key, Geom::OptRect const &bbox) override
void hide(unsigned key) override
void setBBox(unsigned int key, Geom::OptRect const &bbox) override
void _onRefModified(SPObject *ref, guint flags)
Gets called when the referenced <hatch> is changed.
std::vector< SPHatchPath * > hatchPaths()
sigc::connection _modified_connection
RenderInfo _calculateRenderInfo(View const &view) const
Geom::Interval bounds() const
HatchUnits _hatchContentUnits
Geom::OptInterval _calculateStripExtents(Geom::OptRect const &bbox) const
Geom::Affine const & hatchTransform() const
HatchUnits hatchUnits() const
void _onRefChanged(SPObject *old_ref, SPObject *ref)
Gets called when the hatch is reattached to another <hatch>
HatchUnits hatchContentUnits() const
SPHatch * clone_if_necessary(SPItem *item, const gchar *property)
guint _countHrefs(SPObject *o) const
Count how many times hatch is used by the styles of o and its descendants.
void child_added(Inkscape::XML::Node *child, Inkscape::XML::Node *ref) override
bool _hatchContentUnits_set
Base class for visual SVG elements.
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.
virtual void set(SPAttr key, const char *value)
SPStyle * style
Represents the style properties, whether from presentation attributes, the style attribute,...
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)
void requestDisplayUpdate(unsigned int flags)
Queues an deferred update of this object's display.
T< SPAttr::FILL, SPIPaint > fill
fill
T< SPAttr::STROKE, SPIPaint > stroke
stroke
T< SPAttr::OVERFLOW_, SPIEnum< SPOverflow > > overflow
overflow
void unset(Unit u=Unit::NONE, double v=0, double c=0)
void readOrUnset(gchar const *str, Unit u=Unit::NONE, double v=0, double c=0)
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
Canvas belonging to SVG pattern.
auto floor(Geom::Rect const &rect)
Affine identity()
Create an identity matrix.
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.
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.
DrawingItemPtr< DrawingItemType > drawingitem
@ 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)