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-perspective-envelope.h | 80 +++++++++++++++++++++++++++++ 1 file changed, 80 insertions(+) create mode 100644 src/live_effects/lpe-perspective-envelope.h (limited to 'src/live_effects/lpe-perspective-envelope.h') diff --git a/src/live_effects/lpe-perspective-envelope.h b/src/live_effects/lpe-perspective-envelope.h new file mode 100644 index 0000000..7aa32ec --- /dev/null +++ b/src/live_effects/lpe-perspective-envelope.h @@ -0,0 +1,80 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +#ifndef INKSCAPE_LPE_PERSPECTIVE_ENVELOPE_H +#define INKSCAPE_LPE_PERSPECTIVE_ENVELOPE_H + +/** \file + * LPE implementation , see lpe-perspective-envelope.cpp. + + */ +/* + * Authors: + * Jabiertxof Code migration from python extensions envelope and perspective + * Aaron Spike, aaron@ekips.org from envelope and perspective python code + * Dmitry Platonov, shadowjack@mail.ru, 2006 perspective approach & math + * Jose Hevia (freon) Transform algorithm from envelope + * + * Copyright (C) 2007-2014 Authors + * + * Released under GNU GPL v2+, read the file 'COPYING' for more information. + */ + +#include "live_effects/parameter/enum.h" +#include "live_effects/effect.h" +#include "live_effects/parameter/point.h" +#include "live_effects/lpegroupbbox.h" + +namespace Inkscape { +namespace LivePathEffect { + +class LPEPerspectiveEnvelope : public Effect, GroupBBoxEffect { +public: + + LPEPerspectiveEnvelope(LivePathEffectObject *lpeobject); + + ~LPEPerspectiveEnvelope() override; + + void doEffect(SPCurve *curve) override; + + virtual Geom::Point projectPoint(Geom::Point p); + + void transform_multiply(Geom::Affine const &postmul, bool set) override; + + virtual Geom::Point projectPoint(Geom::Point p, double m[][3]); + + virtual Geom::Point pointAtRatio(Geom::Coord ratio,Geom::Point A, Geom::Point B); + + void resetDefaults(SPItem const* item) override; + + virtual void vertical(PointParam ¶mA,PointParam ¶mB, Geom::Line vert); + + virtual void horizontal(PointParam ¶mA,PointParam ¶mB,Geom::Line horiz); + + void doBeforeEffect(SPLPEItem const* lpeitem) override; + + Gtk::Widget * newWidget() override; + + virtual void setDefaults(); + + virtual void resetGrid(); + +protected: + void addCanvasIndicators(SPLPEItem const */*lpeitem*/, std::vector &hp_vec) override; +private: + + BoolParam horizontal_mirror; + BoolParam vertical_mirror; + BoolParam overflow_perspective; + EnumParam deform_type; + PointParam up_left_point; + PointParam up_right_point; + PointParam down_left_point; + PointParam down_right_point; + std::vector handles; + LPEPerspectiveEnvelope(const LPEPerspectiveEnvelope&) = delete; + LPEPerspectiveEnvelope& operator=(const LPEPerspectiveEnvelope&) = delete; +}; + +} //namespace LivePathEffect +} //namespace Inkscape + +#endif -- cgit v1.2.3