1 // SPDX-License-Identifier: GPL-2.0-or-later
2 /** @file
3  * @brief Taper Stroke path effect (meant as a replacement for using Power Strokes for tapering)
4  */
5 /* Authors:
6  *   Liam P White <inkscapebrony@gmail.com>
7  * Copyright (C) 2014 Authors
8  *
9  * Released under GNU GPL v2+, read the file 'COPYING' for more information.
10  */
11 
12 #ifndef INKSCAPE_LPE_TAPERSTROKE_H
13 #define INKSCAPE_LPE_TAPERSTROKE_H
14 
15 #include "live_effects/parameter/enum.h"
16 #include "live_effects/effect.h"
17 #include "live_effects/parameter/parameter.h"
18 #include "live_effects/parameter/vector.h"
19 
20 namespace Inkscape {
21 namespace LivePathEffect {
22 
23 namespace TpS {
24 // we need a separate namespace to avoid clashes with other LPEs
25 class KnotHolderEntityAttachBegin;
26 class KnotHolderEntityAttachEnd;
27 }
28 
29 class LPETaperStroke : public Effect {
30 public:
31     LPETaperStroke(LivePathEffectObject *lpeobject);
32     ~LPETaperStroke() override = default;
33 
34     void doOnApply(SPLPEItem const* lpeitem) override;
35     void doOnRemove(SPLPEItem const* lpeitem) override;
36 
37     Geom::PathVector doEffect_path (Geom::PathVector const& path_in) override;
38     Geom::PathVector doEffect_simplePath(Geom::PathVector const& path_in);
39     void transform_multiply(Geom::Affine const &postmul, bool set) override;
40 
41     void addKnotHolderEntities(KnotHolder * knotholder, SPItem * item) override;
42 
43     friend class TpS::KnotHolderEntityAttachBegin;
44     friend class TpS::KnotHolderEntityAttachEnd;
45 private:
46     ScalarParam line_width;
47     ScalarParam attach_start;
48     ScalarParam attach_end;
49     ScalarParam start_smoothing;
50     ScalarParam end_smoothing;
51     EnumParam<unsigned> join_type;
52     EnumParam<unsigned> start_shape;
53     EnumParam<unsigned> end_shape;
54     ScalarParam miter_limit;
55 
56     Geom::Point start_attach_point;
57     Geom::Point end_attach_point;
58 
59     LPETaperStroke(const LPETaperStroke&) = delete;
60     LPETaperStroke& operator=(const LPETaperStroke&) = delete;
61 };
62 
63 } //namespace LivePathEffect
64 } //namespace Inkscape
65 
66 #endif
67 
68 /*
69   Local Variables:
70   mode:c++
71   c-file-style:"stroustrup"
72   c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
73   indent-tabs-mode:nil
74   fill-column:99
75   End:
76 */
77 // vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8 :
78