Code

Filter effects dialog:
authornicholasbishop <nicholasbishop@users.sourceforge.net>
Thu, 9 Aug 2007 06:06:33 +0000 (06:06 +0000)
committernicholasbishop <nicholasbishop@users.sourceforge.net>
Thu, 9 Aug 2007 06:06:33 +0000 (06:06 +0000)
* Added controls for feMorphology

src/display/nr-filter-morphology.h
src/filter-enums.cpp
src/filter-enums.h
src/ui/dialog/filter-effects-dialog.cpp

index be9ad20310f43465ebead48e1ebe66dbf1565175..be182203ca0697cc1034c0c406451fd2e6c2e5b7 100644 (file)
@@ -19,7 +19,8 @@ namespace NR {
 
 enum FilterMorphologyOperator {
     MORPHOLOGY_OPERATOR_ERODE,
-    MORPHOLOGY_OPERATOR_DILATE
+    MORPHOLOGY_OPERATOR_DILATE,
+    MORPHOLOGY_OPERATOR_END
 };
 
 class FilterMorphology : public FilterPrimitive {
index bd855d102b9964ca08a6c71eed27172ff724e584..d9f0a39861787ce03472b75e0e457d2694a13bd7 100644 (file)
@@ -94,6 +94,13 @@ const EnumData<int> DisplacementMapChannelData[4] = {
 };
 const EnumDataConverter<int> DisplacementMapChannelConverter(DisplacementMapChannelData, 4);
 
+// feMorphology
+const EnumData<NR::FilterMorphologyOperator> MorphologyOperatorData[NR::MORPHOLOGY_OPERATOR_END] = {
+    {NR::MORPHOLOGY_OPERATOR_ERODE,  _("Erode"),   "erode"},
+    {NR::MORPHOLOGY_OPERATOR_DILATE, _("Dilate"),  "dilate"}
+};
+const EnumDataConverter<NR::FilterMorphologyOperator> MorphologyOperatorConverter(MorphologyOperatorData, NR::MORPHOLOGY_OPERATOR_END);
+
 // Light source
 const EnumData<LightSource> LightSourceData[LIGHT_ENDSOURCE] = {
     {LIGHT_DISTANT, _("Distance Light"), "svg:feDistanceLight"},
index 7e5a641c88511176386e10e0973574c2cae76981..37c7e6f0d7b677e195757f2f05dbde115f82d4f4 100644 (file)
@@ -16,6 +16,7 @@
 #include "display/nr-filter-colormatrix.h"
 #include "display/nr-filter-composite.h"
 #include "display/nr-filter-convolve-matrix.h"
+#include "display/nr-filter-morphology.h"
 #include "display/nr-filter-types.h"
 #include "util/enums.h"
 
@@ -51,6 +52,9 @@ extern const Inkscape::Util::EnumDataConverter<NR::FilterConvolveMatrixEdgeMode>
 // DisplacementMap channel
 extern const Inkscape::Util::EnumData<int> DisplacementMapChannelData[4];
 extern const Inkscape::Util::EnumDataConverter<int> DisplacementMapChannelConverter;
+// Morphology operator
+extern const Inkscape::Util::EnumData<NR::FilterMorphologyOperator> MorphologyOperatorData[NR::MORPHOLOGY_OPERATOR_END];
+extern const Inkscape::Util::EnumDataConverter<NR::FilterMorphologyOperator> MorphologyOperatorConverter;
 // Lighting
 enum LightSource {
     LIGHT_DISTANT,
index af413bc0ebfd9197f01af3e731052e594c51fb1d..3c5a351e67be9cb9b396ff449f678fec3eec3145 100644 (file)
@@ -1791,6 +1791,10 @@ void FilterEffectsDialog::init_settings_widgets()
     _settings->type(NR_FILTER_GAUSSIANBLUR);
     _settings->add_dualspinslider(SP_ATTR_STDDEVIATION, _("Standard Deviation"), 0.01, 100, 1, 0.01, 1);
 
+    _settings->type(NR_FILTER_MORPHOLOGY);
+    _settings->add_combo(SP_ATTR_OPERATOR, _("Operator"), MorphologyOperatorConverter);
+    _settings->add_dualspinslider(SP_ATTR_RADIUS, _("Radius"), 0, 100, 1, 0.01, 1);
+
     _settings->type(NR_FILTER_OFFSET);
     _settings->add_spinslider(SP_ATTR_DX, _("Delta X"), -100, 100, 1, 0.01, 1);
     _settings->add_spinslider(SP_ATTR_DY, _("Delta Y"), -100, 100, 1, 0.01, 1);