From: nicholasbishop Date: Mon, 6 Aug 2007 00:24:31 +0000 (+0000) Subject: Filter effects: X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=a14ff477fb6d8003e2817a894e4b63bb2773e407;p=inkscape.git Filter effects: * Added edge mode setting to the filter dialog * Changed type of edgeMode in SPFeConvolveMatrix to use the enum type --- diff --git a/src/filter-enums.cpp b/src/filter-enums.cpp index 2d26095a4..a688ecc19 100644 --- a/src/filter-enums.cpp +++ b/src/filter-enums.cpp @@ -77,6 +77,14 @@ const EnumData CompositeOperatorData[COMPOSITE_ENDOPERATOR] }; const EnumDataConverter CompositeOperatorConverter(CompositeOperatorData, COMPOSITE_ENDOPERATOR); +// feConvolveMatrix +const EnumData 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 ConvolveMatrixEdgeModeConverter(ConvolveMatrixEdgeModeData, NR::CONVOLVEMATRIX_EDGEMODE_ENDTYPE); + // Light source const EnumData LightSourceData[LIGHT_ENDSOURCE] = { {LIGHT_DISTANT, _("Distance Light"), "svg:feDistanceLight"}, diff --git a/src/filter-enums.h b/src/filter-enums.h index cbea5545b..8a6a56841 100644 --- a/src/filter-enums.h +++ b/src/filter-enums.h @@ -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 ColorM // Composite operator extern const Inkscape::Util::EnumData CompositeOperatorData[COMPOSITE_ENDOPERATOR]; extern const Inkscape::Util::EnumDataConverter CompositeOperatorConverter; +// ConvolveMatrix edgeMode +extern const Inkscape::Util::EnumData ConvolveMatrixEdgeModeData[NR::CONVOLVEMATRIX_EDGEMODE_ENDTYPE]; +extern const Inkscape::Util::EnumDataConverter ConvolveMatrixEdgeModeConverter; // Lighting enum LightSource { LIGHT_DISTANT, diff --git a/src/sp-feconvolvematrix.h b/src/sp-feconvolvematrix.h index 0cb4abc67..d757d7b3d 100644 --- a/src/sp-feconvolvematrix.h +++ b/src/sp-feconvolvematrix.h @@ -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 -//#include - /* FeConvolveMatrix base class */ class SPFeConvolveMatrixClass; @@ -30,7 +29,7 @@ struct SPFeConvolveMatrix : public SPFilterPrimitive { std::vector kernelMatrix; double divisor, bias; int targetX, targetY; - int edgeMode; + NR::FilterConvolveMatrixEdgeMode edgeMode; NumberOptNumber kernelUnitLength; bool preserveAlpha; }; diff --git a/src/ui/dialog/filter-effects-dialog.cpp b/src/ui/dialog/filter-effects-dialog.cpp index edbae518d..3c306d382 100644 --- a/src/ui/dialog/filter-effects-dialog.cpp +++ b/src/ui/dialog/filter-effects-dialog.cpp @@ -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"));