diff options
| author | vanntile <valentin.ionita1201@gmail.com> | 2019-08-02 16:23:28 +0000 |
|---|---|---|
| committer | vanntile <valentin.ionita1201@gmail.com> | 2019-08-17 15:33:45 +0000 |
| commit | 56d76b4861d034dad8b4eeb25e86308e233202e4 (patch) | |
| tree | 9edc93e1ac61c7e176fdb7050594f0c8ee43ad57 /src/object/sp-item.cpp | |
| parent | Hatch knot editing initial commit (diff) | |
| download | inkscape-56d76b4861d034dad8b4eeb25e86308e233202e4.tar.gz inkscape-56d76b4861d034dad8b4eeb25e86308e233202e4.zip | |
Added knot holder entities
Diffstat (limited to 'src/object/sp-item.cpp')
| -rw-r--r-- | src/object/sp-item.cpp | 32 |
1 files changed, 28 insertions, 4 deletions
diff --git a/src/object/sp-item.cpp b/src/object/sp-item.cpp index dfc482267..003562269 100644 --- a/src/object/sp-item.cpp +++ b/src/object/sp-item.cpp @@ -34,11 +34,12 @@ #include "sp-clippath.h" #include "sp-desc.h" #include "sp-guide.h" +#include "sp-hatch.h" #include "sp-item-rm-unsatisfied-cns.h" #include "sp-mask.h" #include "sp-pattern.h" -#include "sp-root.h" #include "sp-rect.h" +#include "sp-root.h" #include "sp-switch.h" #include "sp-text.h" #include "sp-textpath.h" @@ -730,7 +731,7 @@ Inkscape::XML::Node* SPItem::write(Inkscape::XML::Document *xml_doc, Inkscape::X } } } - + gchar *c = sp_svg_transform_write(item->transform); repr->setAttribute("transform", c); g_free(c); @@ -825,7 +826,7 @@ Geom::OptRect SPItem::visualBounds(Geom::Affine const &transform) const double len_x = bbox ? bbox->width() : 0; double len_y = bbox ? bbox->height() : 0; - + x.update(12, 6, len_x); y.update(12, 6, len_y); w.update(12, 6, len_x); @@ -1233,7 +1234,7 @@ void SPItem::invoke_hide(unsigned key) // Adjusters -void SPItem::adjust_pattern(Geom::Affine const &postmul, bool set, PatternTransform pt) +void SPItem::adjust_pattern(Geom::Affine const &postmul, bool set, PaintServerTransform pt) { bool fill = (pt == TRANSFORM_FILL || pt == TRANSFORM_BOTH); if (fill && style && (style->fill.isPaintserver())) { @@ -1256,6 +1257,29 @@ void SPItem::adjust_pattern(Geom::Affine const &postmul, bool set, PatternTransf } } +void SPItem::adjust_hatch(Geom::Affine const &postmul, bool set, PaintServerTransform pt) +{ + bool fill = (pt == TRANSFORM_FILL || pt == TRANSFORM_BOTH); + if (fill && style && (style->fill.isPaintserver())) { + SPObject *server = style->getFillPaintServer(); + SPHatch *serverHatch = dynamic_cast<SPHatch *>(server); + if (serverHatch) { + SPHatch *hatch = serverHatch->clone_if_necessary(this, "fill"); + hatch->transform_multiply(postmul, set); + } + } + + bool stroke = (pt == TRANSFORM_STROKE || pt == TRANSFORM_BOTH); + if (stroke && style && (style->stroke.isPaintserver())) { + SPObject *server = style->getStrokePaintServer(); + SPHatch *serverHatch = dynamic_cast<SPHatch *>(server); + if (serverHatch) { + SPHatch *hatch = serverHatch->clone_if_necessary(this, "stroke"); + hatch->transform_multiply(postmul, set); + } + } +} + void SPItem::adjust_gradient( Geom::Affine const &postmul, bool set ) { if ( style && style->fill.isPaintserver() ) { |
