summaryrefslogtreecommitdiffstats
path: root/src/live_effects/lpe-transform_2pts.h
blob: d72e69a6c38a328e95cf9265378b327fadab147a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
// SPDX-License-Identifier: GPL-2.0-or-later
#ifndef INKSCAPE_LPE_TRANSFORM_2PTS_H
#define INKSCAPE_LPE_TRANSFORM_2PTS_H

/** \file
 * LPE "Transform through 2 points" implementation
 */

/*
 * Authors:
 *
 *
 *
 * Released under GNU GPL v2+, read the file 'COPYING' for more information.
 */

#include "live_effects/effect.h"
#include "live_effects/lpegroupbbox.h"
#include "live_effects/parameter/parameter.h"
#include "live_effects/parameter/togglebutton.h"
#include "live_effects/parameter/point.h"

namespace Inkscape {
namespace LivePathEffect {

class LPETransform2Pts : public Effect, GroupBBoxEffect {
public:
    LPETransform2Pts(LivePathEffectObject *lpeobject);
    ~LPETransform2Pts() override;

    void doOnApply (SPLPEItem const* lpeitem) override;

    Geom::Piecewise<Geom::D2<Geom::SBasis> > doEffect_pwd2 (Geom::Piecewise<Geom::D2<Geom::SBasis> > const & pwd2_in) override;

    void doBeforeEffect (SPLPEItem const* lpeitem) override;

    void transform_multiply(Geom::Affine const &postmul, bool set) override;

    Gtk::Widget *newWidget() override;

    void updateIndex();

    size_t nodeCount(Geom::PathVector pathvector) const;

    Geom::Point pointAtNodeIndex(Geom::PathVector pathvector, size_t index) const;

    Geom::Path pathAtNodeIndex(Geom::PathVector pathvector, size_t index) const;

    void reset();

protected:
    void addCanvasIndicators(SPLPEItem const *lpeitem, std::vector<Geom::PathVector> &hp_vec) override;

private:
    ToggleButtonParam elastic;
    ToggleButtonParam from_original_width;
    ToggleButtonParam lock_length;
    ToggleButtonParam lock_angle;
    ToggleButtonParam flip_horizontal;
    ToggleButtonParam flip_vertical;
    PointParam start;
    PointParam end;
    ScalarParam stretch;
    ScalarParam offset;
    ScalarParam first_knot;
    ScalarParam last_knot;
    ScalarParam helper_size;
    bool from_original_width_toggler;
    Geom::Point point_a;
    Geom::Point point_b;
    Geom::PathVector pathvector;
    bool append_path;
    Geom::Angle previous_angle;
    Geom::Point previous_start;
    double previous_length;
    LPETransform2Pts(const LPETransform2Pts&) = delete;
    LPETransform2Pts& operator=(const LPETransform2Pts&) = delete;
};

} //namespace LivePathEffect
} //namespace Inkscape

#endif

/*
  Local Variables:
  mode:c++
  c-file-style:"stroustrup"
  c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
  indent-tabs-mode:nil
  fill-column:99
  End:
*/
// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4 :