8c647e5994840c942e46d16b9ff585402d5bef5b
1 #ifndef INKSCAPE_LIVEPATHEFFECT_H
2 #define INKSCAPE_LIVEPATHEFFECT_H
4 /*
5 * Inkscape::LivePathEffect
6 *
7 * Copyright (C) Johan Engelen 2007 <j.b.c.engelen@utwente.nl>
8 *
9 * Released under GNU GPL, read the file 'COPYING' for more information
10 */
13 #include "display/display-forward.h"
14 #include <map>
15 #include <glibmm/ustring.h>
16 #include <2geom/path.h>
17 #include "ui/widget/registry.h"
18 #include "util/enums.h"
20 #define LPE_CONVERSION_TOLERANCE 0.01 // FIXME: find good solution for this.
22 //#define LPE_ENABLE_TEST_EFFECTS
24 struct SPShape;
25 struct SPDocument;
26 class NArtBpath;
27 struct LivePathEffectObject;
29 namespace Gtk {
30 class Widget;
31 class VBox;
32 class Tooltips;
33 }
35 namespace Inkscape {
37 namespace XML {
38 class Node;
39 }
41 namespace LivePathEffect {
43 enum EffectType {
44 SKELETAL_STROKES = 0,
45 #ifdef LPE_ENABLE_TEST_EFFECTS
46 SLANT,
47 DOEFFECTSTACK_TEST,
48 #endif
49 GEARS,
50 CURVE_STITCH,
51 INVALID_LPE // This must be last
52 };
54 extern const Util::EnumData<EffectType> LPETypeData[INVALID_LPE];
55 extern const Util::EnumDataConverter<EffectType> LPETypeConverter;
57 class Parameter;
59 class Effect {
60 public:
61 virtual ~Effect();
63 Glib::ustring getName();
65 virtual void doEffect (SPCurve * curve);
67 static Effect* New(EffectType lpenr, LivePathEffectObject *lpeobj);
69 virtual Gtk::Widget * getWidget();
71 Inkscape::XML::Node * getRepr();
72 SPDocument * getSPDoc();
73 LivePathEffectObject * getLPEObj() {return lpeobj;};
75 void readallParameters(Inkscape::XML::Node * repr);
76 void setParameter(const gchar * key, const gchar * new_value);
78 protected:
79 Effect(LivePathEffectObject *lpeobject);
81 // provide a set of doEffect functions so the developer has a choice
82 // of what kind of input/output parameters he desires.
83 // the order in which they appear is the order in which they are
84 // called by this base class. (i.e. doEffect(SPCurve * curve) defaults to calling
85 // doEffect(std::vector<Geom::Path> )
86 virtual NArtBpath *
87 doEffect (NArtBpath * path_in);
88 virtual std::vector<Geom::Path>
89 doEffect (std::vector<Geom::Path> & path_in);
90 virtual Geom::Piecewise<Geom::D2<Geom::SBasis> >
91 doEffect (Geom::Piecewise<Geom::D2<Geom::SBasis> > & pwd2_in);
93 void registerParameter(Parameter * param);
95 typedef std::map<Glib::ustring, Parameter *> param_map_type;
96 param_map_type param_map;
98 Inkscape::UI::Widget::Registry wr;
99 Gtk::VBox * vbox;
100 Gtk::Tooltips * tooltips;
102 LivePathEffectObject *lpeobj;
104 private:
105 Effect(const Effect&);
106 Effect& operator=(const Effect&);
107 };
110 } //namespace LivePathEffect
111 } //namespace Inkscape
113 #endif