Code

Filter effects:
authornicholasbishop <nicholasbishop@users.sourceforge.net>
Mon, 6 Aug 2007 00:24:31 +0000 (00:24 +0000)
committernicholasbishop <nicholasbishop@users.sourceforge.net>
Mon, 6 Aug 2007 00:24:31 +0000 (00:24 +0000)
* Added edge mode setting to the filter dialog
* Changed type of edgeMode in SPFeConvolveMatrix to use the enum type

src/filter-enums.cpp
src/filter-enums.h
src/sp-feconvolvematrix.h
src/ui/dialog/filter-effects-dialog.cpp

index 2d26095a47f5c6ff660aae135e9fa79397916fdd..a688ecc1920a07d5bbae7095382cadd0b1c1eb5b 100644 (file)
@@ -77,6 +77,14 @@ const EnumData<FeCompositeOperator> CompositeOperatorData[COMPOSITE_ENDOPERATOR]
 };
 const EnumDataConverter<FeCompositeOperator> CompositeOperatorConverter(CompositeOperatorData, COMPOSITE_ENDOPERATOR);
 
+// feConvolveMatrix
+const EnumData<NR::FilterConvolveMatrixEdgeMode> ConvolveMatrixEdgeModeData[NR::CONVOLVEMATRIX_EDGEMODE_ENDTYPE] = {
+    {NR::CONVOLVEMATRIX_EDGEMODE_DUPLICATE, _("Duplicate"), "duplicate"},
+    {NR::CONVOLVEMATRIX_EDGEMODE_WRAP, _("Wrap"), "wrap"},
+    {NR::CONVOLVEMATRIX_EDGEMODE_NONE, _("None"), "none"}
+};
+const EnumDataConverter<NR::FilterConvolveMatrixEdgeMode> ConvolveMatrixEdgeModeConverter(ConvolveMatrixEdgeModeData, NR::CONVOLVEMATRIX_EDGEMODE_ENDTYPE);
+
 // Light source
 const EnumData<LightSource> LightSourceData[LIGHT_ENDSOURCE] = {
     {LIGHT_DISTANT, _("Distance Light"), "svg:feDistanceLight"},
index cbea5545b59bc4b7fb83e4398d02927a46f862a3..8a6a568414e09a3c69ed2e4dc8dd1e8dc920adf7 100644 (file)
@@ -15,6 +15,7 @@
 #include "display/nr-filter-blend.h"
 #include "display/nr-filter-colormatrix.h"
 #include "display/nr-filter-composite.h"
+#include "display/nr-filter-convolve-matrix.h"
 #include "display/nr-filter-types.h"
 #include "util/enums.h"
 
@@ -44,6 +45,9 @@ extern const Inkscape::Util::EnumDataConverter<NR::FilterColorMatrixType> ColorM
 // Composite operator
 extern const Inkscape::Util::EnumData<FeCompositeOperator> CompositeOperatorData[COMPOSITE_ENDOPERATOR];
 extern const Inkscape::Util::EnumDataConverter<FeCompositeOperator> CompositeOperatorConverter;
+// ConvolveMatrix edgeMode
+extern const Inkscape::Util::EnumData<NR::FilterConvolveMatrixEdgeMode> ConvolveMatrixEdgeModeData[NR::CONVOLVEMATRIX_EDGEMODE_ENDTYPE];
+extern const Inkscape::Util::EnumDataConverter<NR::FilterConvolveMatrixEdgeMode> ConvolveMatrixEdgeModeConverter;
 // Lighting
 enum LightSource {
     LIGHT_DISTANT,
index 0cb4abc67e5bf0782bb162ada9e82d67842fd753..d757d7b3d83e2f30e7f0168e34ec650107e864c6 100644 (file)
@@ -17,9 +17,8 @@
 #include "sp-filter.h"
 #include "sp-feconvolvematrix-fns.h"
 #include "number-opt-number.h"
+#include "display/nr-filter-convolve-matrix.h"
 #include <vector>
-//#include <glib.h>
-
 
 /* FeConvolveMatrix base class */
 class SPFeConvolveMatrixClass;
@@ -30,7 +29,7 @@ struct SPFeConvolveMatrix : public SPFilterPrimitive {
     std::vector<gdouble> kernelMatrix;
     double divisor, bias;
     int targetX, targetY;
-    int edgeMode;
+    NR::FilterConvolveMatrixEdgeMode edgeMode;
     NumberOptNumber kernelUnitLength;
     bool preserveAlpha;
 };
index edbae518dc752bbefdd8730b45fed752d623445a..3c306d382176cce6ca820689c5d909fcc676c2e2 100644 (file)
@@ -1670,6 +1670,7 @@ void FilterEffectsDialog::init_settings_widgets()
     _convolve_order->signal_attr_changed().connect(sigc::mem_fun(*this, &FilterEffectsDialog::convolve_order_changed));
     _settings->add_spinslider(SP_ATTR_DIVISOR, _("Divisor"), 0.01, 10, 1, 0.01, 1);
     _settings->add_spinslider(SP_ATTR_BIAS, _("Bias"), -10, 10, 1, 0.01, 1);
+    _settings->add_combo(SP_ATTR_EDGEMODE, _("Edge Mode"), ConvolveMatrixEdgeModeConverter);
 
     _settings->type(NR_FILTER_DIFFUSELIGHTING);
     _settings->add_color(SP_PROP_LIGHTING_COLOR, _("Diffuse Color"));