1 // SPDX-License-Identifier: GPL-2.0-or-later 2 #ifndef INKSCAPE_LPE_OFFSET_H 3 #define INKSCAPE_LPE_OFFSET_H 4 5 /** \file 6 * LPE <offset> implementation, see lpe-offset.cpp. 7 */ 8 9 /* 10 * Authors: 11 * Maximilian Albert 12 * Jabiertxo Arraiza 13 * 14 * Copyright (C) Johan Engelen 2007 <j.b.c.engelen@utwente.nl> 15 * Copyright (C) Maximilian Albert 2008 <maximilian.albert@gmail.com> 16 * 17 * Released under GNU GPL v2+, read the file 'COPYING' for more information. 18 */ 19 20 #include "live_effects/effect.h" 21 #include "live_effects/lpegroupbbox.h" 22 #include "live_effects/parameter/enum.h" 23 #include "live_effects/parameter/parameter.h" 24 #include "live_effects/parameter/unit.h" 25 // this is only to flatten nonzero fillrule 26 #include "livarot/Path.h" 27 #include "livarot/Shape.h" 28 29 namespace Inkscape { 30 namespace LivePathEffect { 31 32 namespace OfS { 33 // we need a separate namespace to avoid clashes with other LPEs 34 class KnotHolderEntityOffsetPoint; 35 } 36 37 typedef FillRule FillRuleFlatten; 38 39 class LPEOffset : public Effect, GroupBBoxEffect { 40 public: 41 LPEOffset(LivePathEffectObject *lpeobject); 42 ~LPEOffset() override; 43 void doBeforeEffect (SPLPEItem const* lpeitem) override; 44 void doAfterEffect(SPLPEItem const * /*lpeitem*/, SPCurve *curve) override; 45 Geom::PathVector doEffect_path (Geom::PathVector const & path_in) override; 46 void transform_multiply(Geom::Affine const &postmul, bool set) override; 47 void addKnotHolderEntities(KnotHolder * knotholder, SPItem * item) override; 48 void addCanvasIndicators(SPLPEItem const *lpeitem, std::vector<Geom::PathVector> &hp_vec) override; 49 void calculateOffset (Geom::PathVector const & path_in); 50 Geom::Path cleanupPathSelfIntersects(Geom::Path path, size_t originpos, double tolerance); 51 Geom::Point get_default_point(Geom::PathVector pathv); 52 double sp_get_offset(Geom::Point origin); 53 friend class OfS::KnotHolderEntityOffsetPoint; 54 55 private: 56 UnitParam unit; 57 ScalarParam offset; 58 EnumParam<unsigned> linejoin_type; 59 ScalarParam miter_limit; 60 BoolParam attempt_force_join; 61 62 BoolParam update_on_knot_move; 63 Geom::Point offset_pt; 64 Glib::ustring prev_unit; 65 double scale = 1; //take document scale and additional parent transformations into account 66 KnotHolderEntity * _knot_entity; 67 Geom::PathVector mix_pathv_all; 68 Geom::PathVector helper_path; 69 Inkscape::UI::Widget::Scalar *offset_widget; 70 FillRuleFlatten fillrule; 71 bool liveknot; 72 void modified(SPObject */*obj*/, guint flags); 73 sigc::connection modified_connection; 74 LPEOffset(const LPEOffset&); 75 LPEOffset& operator=(const LPEOffset&); 76 }; 77 78 } //namespace LivePathEffect 79 } //namespace Inkscape 80 81 #endif 82 83 /* 84 Local Variables: 85 mode:c++ 86 c-file-style:"stroustrup" 87 c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +)) 88 indent-tabs-mode:nil 89 fill-column:99 90 End: 91 */ 92 // vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4 : 93