Code

Filter effects dialog:
authornicholasbishop <nicholasbishop@users.sourceforge.net>
Mon, 6 Aug 2007 00:58:34 +0000 (00:58 +0000)
committernicholasbishop <nicholasbishop@users.sourceforge.net>
Mon, 6 Aug 2007 00:58:34 +0000 (00:58 +0000)
* Added controls for scale and channel selection to the filter dialog for feDisplacementMap

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

index a688ecc1920a07d5bbae7095382cadd0b1c1eb5b..bd855d102b9964ca08a6c71eed27172ff724e584 100644 (file)
@@ -80,11 +80,20 @@ const EnumDataConverter<FeCompositeOperator> CompositeOperatorConverter(Composit
 // 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"}
+    {NR::CONVOLVEMATRIX_EDGEMODE_WRAP,      _("Wrap"),      "wrap"},
+    {NR::CONVOLVEMATRIX_EDGEMODE_NONE,      _("None"),      "none"}
 };
 const EnumDataConverter<NR::FilterConvolveMatrixEdgeMode> ConvolveMatrixEdgeModeConverter(ConvolveMatrixEdgeModeData, NR::CONVOLVEMATRIX_EDGEMODE_ENDTYPE);
 
+// feDisplacementMap
+const EnumData<int> DisplacementMapChannelData[4] = {
+    {0, _("Red"),   "R"},
+    {1, _("Green"), "G"},
+    {2, _("Blue"),  "B"},
+    {3, _("Alpha"), "A"}
+};
+const EnumDataConverter<int> DisplacementMapChannelConverter(DisplacementMapChannelData, 4);
+
 // Light source
 const EnumData<LightSource> LightSourceData[LIGHT_ENDSOURCE] = {
     {LIGHT_DISTANT, _("Distance Light"), "svg:feDistanceLight"},
index 8a6a568414e09a3c69ed2e4dc8dd1e8dc920adf7..7e5a641c88511176386e10e0973574c2cae76981 100644 (file)
@@ -48,6 +48,9 @@ extern const Inkscape::Util::EnumDataConverter<FeCompositeOperator> CompositeOpe
 // ConvolveMatrix edgeMode
 extern const Inkscape::Util::EnumData<NR::FilterConvolveMatrixEdgeMode> ConvolveMatrixEdgeModeData[NR::CONVOLVEMATRIX_EDGEMODE_ENDTYPE];
 extern const Inkscape::Util::EnumDataConverter<NR::FilterConvolveMatrixEdgeMode> ConvolveMatrixEdgeModeConverter;
+// DisplacementMap channel
+extern const Inkscape::Util::EnumData<int> DisplacementMapChannelData[4];
+extern const Inkscape::Util::EnumDataConverter<int> DisplacementMapChannelConverter;
 // Lighting
 enum LightSource {
     LIGHT_DISTANT,
index 3c306d382176cce6ca820689c5d909fcc676c2e2..edcb1e9ca653ad501c4c0dc4f76ad75a9a921e9a 100644 (file)
@@ -1678,6 +1678,11 @@ void FilterEffectsDialog::init_settings_widgets()
     _settings->add_spinslider(SP_ATTR_DIFFUSECONSTANT, _("Constant"), 0, 100, 1, 0.01, 1);
     _settings->add_dualspinslider(SP_ATTR_KERNELUNITLENGTH, _("Kernel Unit Length"), 0.01, 10, 1, 0.01, 1);
     _settings->add_lightsource(_("Light Source"));
+
+    _settings->type(NR_FILTER_DISPLACEMENTMAP);
+    _settings->add_spinslider(SP_ATTR_SCALE, _("Scale"), 0, 100, 1, 0.01, 1);
+    _settings->add_combo(SP_ATTR_XCHANNELSELECTOR, _("X Channel"), DisplacementMapChannelConverter);
+    _settings->add_combo(SP_ATTR_YCHANNELSELECTOR, _("Y Channel"), DisplacementMapChannelConverter);
     
     _settings->type(NR_FILTER_GAUSSIANBLUR);
     _settings->add_dualspinslider(SP_ATTR_STDDEVIATION, _("Standard Deviation"), 0.01, 100, 1, 0.01, 1);