summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 36ae58c)
raw | patch | inline | side by side (parent: 36ae58c)
author | johanengelen <johanengelen@users.sourceforge.net> | |
Wed, 16 Jul 2008 21:42:46 +0000 (21:42 +0000) | ||
committer | johanengelen <johanengelen@users.sourceforge.net> | |
Wed, 16 Jul 2008 21:42:46 +0000 (21:42 +0000) |
src/live_effects/CMakeLists.txt | patch | blob | history | |
src/live_effects/Makefile_insert | patch | blob | history | |
src/live_effects/effect.cpp | patch | blob | history | |
src/live_effects/effect.h | patch | blob | history | |
src/live_effects/lpe-boolops.cpp | [new file with mode: 0644] | patch | blob |
src/live_effects/lpe-boolops.h | [new file with mode: 0644] | patch | blob |
index c50c103575fb475d24e01d53ae849f8ccd13aa67..79d403601e73bf289c3f9dc23a6bbc718bcc7577 100644 (file)
bezctx.cpp
effect.cpp
lpe-bendpath.cpp
+lpe-boolops.cpp
lpe-circle_with_radius.cpp
lpe-constructgrid.cpp
lpe-curvestitch.cpp
index d3f50cd9a6043c3fb69d171cfc37d76a4140cfda..e651418d38aec39f3169146dd4ea594ac48998a4 100644 (file)
live_effects/lpe-patternalongpath.h \
live_effects/lpe-bendpath.cpp \
live_effects/lpe-bendpath.h \
+ live_effects/lpe-boolops.cpp \
+ live_effects/lpe-boolops.h \
live_effects/lpe-sketch.cpp \
live_effects/lpe-sketch.h \
live_effects/lpe-knot.cpp \
index 4c74d56a6f39d50acfb3b11613335e7809471d46..ad9024772bd0483c8fec0d223c231530941b3176 100644 (file)
#include "live_effects/lpe-copy_rotate.h"
#include "live_effects/lpe-offset.h"
#include "live_effects/lpe-ruler.h"
+#include "live_effects/lpe-boolops.h"
// end of includes
namespace Inkscape {
{COPY_ROTATE, N_("Rotate copies"), "copy_rotate"},
{OFFSET, N_("Offset"), "offset"},
{RULER, N_("Ruler"), "ruler"},
+ {BOOLOPS, N_("Boolops"), "boolops"},
};
const Util::EnumDataConverter<EffectType> LPETypeConverter(LPETypeData, INVALID_LPE);
case RULER:
neweffect = static_cast<Effect*> ( new LPERuler(lpeobj) );
break;
+ case BOOLOPS:
+ neweffect = static_cast<Effect*> ( new LPEBoolops(lpeobj) );
+ break;
default:
g_warning("LivePathEffect::Effect::New called with invalid patheffect type (%d)", lpenr);
neweffect = NULL;
index fbaf8f86719d5ff9d9b91af8b8a8ae8f95aa2413..c72f659f7c95193e7a85e455805b2745cb674b19 100644 (file)
COPY_ROTATE,
OFFSET,
RULER,
+ BOOLOPS,
INVALID_LPE // This must be last
};
diff --git a/src/live_effects/lpe-boolops.cpp b/src/live_effects/lpe-boolops.cpp
--- /dev/null
@@ -0,0 +1,80 @@
+#define INKSCAPE_LPE_BOOLOPS_CPP
+/** \file
+ * LPE boolops implementation
+ */
+/*
+ * Authors:
+ * Johan Engelen
+ *
+ * Copyright (C) Johan Engelen 2007-2008 <j.b.c.engelen@utwente.nl>
+ *
+ * Released under GNU GPL, read the file 'COPYING' for more information
+ */
+
+#include "live_effects/lpe-boolops.h"
+
+#include <2geom/path.h>
+#include <2geom/shape.h>
+
+namespace Inkscape {
+namespace LivePathEffect {
+
+static const Util::EnumData<unsigned> BoolopTypeData[] = {
+ {Geom::BOOLOP_NULL , N_("Null"), "null"},
+ {Geom::BOOLOP_INTERSECT , N_("Intersect"), "intersect"},
+ {Geom::BOOLOP_SUBTRACT_A_B , N_("Subtract A-B"), "subtract_a_b"},
+ {Geom::BOOLOP_IDENTITY_A , N_("Identity A"), "identity_a"},
+ {Geom::BOOLOP_SUBTRACT_B_A , N_("Subtract B-A"), "subtract_b_a"},
+ {Geom::BOOLOP_IDENTITY_B , N_("Identity B"), "identity_b"},
+ {Geom::BOOLOP_EXCLUSION , N_("Exclusion"), "Exclusion"},
+ {Geom::BOOLOP_UNION , N_("Union"), "Union"}
+};
+static const Util::EnumDataConverter<unsigned> BoolopTypeConverter(BoolopTypeData, sizeof(BoolopTypeData)/sizeof(*BoolopTypeData));
+
+LPEBoolops::LPEBoolops(LivePathEffectObject *lpeobject) :
+ Effect(lpeobject),
+ bool_path(_("2nd path"), _("Path to which the original path will be boolop'ed."), "path_2nd", &wr, this, "M0,0 L1,0"),
+ boolop_type(_("Boolop type"), _("Determines which kind of boolop will be performed."), "boolop_type", BoolopTypeConverter, &wr, this, Geom::BOOLOP_UNION)
+{
+ show_orig_path = true;
+
+ registerParameter( dynamic_cast<Parameter *>(&boolop_type) );
+ registerParameter( dynamic_cast<Parameter *>(&bool_path) );
+}
+
+LPEBoolops::~LPEBoolops()
+{
+
+}
+
+
+Geom::PathVector
+LPEBoolops::doEffect_path (Geom::PathVector const & path_in)
+{
+ std::vector<Geom::Path> path_out;
+
+ Geom::Shape shape_in = Geom::sanitize(path_in);
+
+ Geom::Shape shape_param = Geom::sanitize(bool_path.get_pathvector());
+
+ Geom::Shape shape_out = Geom::boolop(shape_in, shape_param, boolop_type.get_value());
+
+ path_out = Geom::desanitize(shape_out);
+
+ return path_out;
+}
+
+
+} //namespace LivePathEffect
+} /* namespace Inkscape */
+
+/*
+ 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 :
diff --git a/src/live_effects/lpe-boolops.h b/src/live_effects/lpe-boolops.h
--- /dev/null
@@ -0,0 +1,53 @@
+#ifndef INKSCAPE_LPE_BOOLOPS_H
+#define INKSCAPE_LPE_BOOLOPS_H
+
+/** \file
+ * LPE boolops implementation, see lpe-boolops.cpp.
+ */
+
+/*
+ * Authors:
+ * Johan Engelen
+ *
+ * Copyright (C) Johan Engelen 2007-2008 <j.b.c.engelen@utwente.nl>
+ *
+ * Released under GNU GPL, read the file 'COPYING' for more information
+ */
+
+#include "live_effects/effect.h"
+#include "live_effects/parameter/enum.h"
+#include "live_effects/parameter/path.h"
+
+namespace Inkscape {
+namespace LivePathEffect {
+
+class LPEBoolops : public Effect {
+public:
+ LPEBoolops(LivePathEffectObject *lpeobject);
+ virtual ~LPEBoolops();
+
+ virtual std::vector<Geom::Path> doEffect_path (std::vector<Geom::Path> const & path_in);
+
+private:
+ PathParam bool_path;
+ EnumParam<unsigned> boolop_type;
+
+ LPEBoolops(const LPEBoolops&);
+ LPEBoolops& operator=(const LPEBoolops&);
+};
+
+} //namespace LivePathEffect
+} //namespace Inkscape
+
+#endif // INKSCAPE_LPE_BOOLOPS_H
+
+/*
+ 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 :