From cca66b9ec4e494c1d919bff0f71a820d8afab1fa Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 7 Apr 2024 20:24:48 +0200 Subject: Adding upstream version 1.2.2. Signed-off-by: Daniel Baumann --- src/live_effects/lpe-roughen.h | 80 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 80 insertions(+) create mode 100644 src/live_effects/lpe-roughen.h (limited to 'src/live_effects/lpe-roughen.h') diff --git a/src/live_effects/lpe-roughen.h b/src/live_effects/lpe-roughen.h new file mode 100644 index 0000000..8940f93 --- /dev/null +++ b/src/live_effects/lpe-roughen.h @@ -0,0 +1,80 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/** @file + * @brief Roughen LPE effect, see lpe-roughen.cpp. + */ +/* Authors: + * Jabier Arraiza Cenoz + * + * Copyright (C) 2014 Authors + * + * Released under GNU GPL v2+, read the file 'COPYING' for more information. + */ + +#ifndef INKSCAPE_LPE_ROUGHEN_H +#define INKSCAPE_LPE_ROUGHEN_H + +#include "live_effects/effect.h" +#include "live_effects/parameter/enum.h" +#include "live_effects/parameter/parameter.h" +#include "live_effects/parameter/path.h" +#include "live_effects/parameter/bool.h" +#include "live_effects/parameter/random.h" + +#include + +namespace Inkscape { +namespace LivePathEffect { + +enum DivisionMethod { + DM_SEGMENTS, + DM_SIZE, + DM_END +}; + +enum HandlesMethod { + HM_ALONG_NODES, + HM_RAND, + HM_RETRACT, + HM_SMOOTH, + HM_END +}; + + +class LPERoughen : public Effect { + +public: + LPERoughen(LivePathEffectObject *lpeobject); + ~LPERoughen() override; + + void doOnApply(SPLPEItem const *lpeitem) override; + void doEffect(SPCurve *curve) override; + virtual double sign(double randNumber); + virtual Geom::Point randomize(double max_length, bool is_node = false); + void doBeforeEffect(SPLPEItem const * lpeitem) override; + virtual Geom::Point tPoint(Geom::Point A, Geom::Point B, double t = 0.5); + Gtk::Widget *newWidget() override; + +private: + std::unique_ptr addNodesAndJitter(Geom::Curve const *A, Geom::Point &prev, Geom::Point &last_move, + double t, bool last); + std::unique_ptr jitter(Geom::Curve const *A, Geom::Point &prev, Geom::Point &last_move); + + EnumParam method; + ScalarParam max_segment_size; + ScalarParam segments; + RandomParam displace_x; + RandomParam displace_y; + RandomParam global_randomize; + EnumParam handles; + BoolParam shift_nodes; + BoolParam fixed_displacement; + BoolParam spray_tool_friendly; + long seed; + LPERoughen(const LPERoughen &) = delete; + LPERoughen &operator=(const LPERoughen &) = delete; + +}; + +}; //namespace LivePathEffect +}; //namespace Inkscape +#endif -- cgit v1.2.3