From 20f5fdf0157485e4a606449bea6ea07ab4b25b64 Mon Sep 17 00:00:00 2001 From: Nicolas Dufour Date: Tue, 23 Aug 2011 21:50:21 +0200 Subject: UI. Adding a digit in the blur spinbox (F&S dialog, see Bug #414767, More precision to Blur filter value). Filters. Some CPF improvements (including a new Cross-smooth version). (bzr r10577) --- src/extension/internal/filter/color.h | 8 ++-- src/extension/internal/filter/morphology.h | 67 +++++++++++++++++++--------- src/extension/internal/filter/transparency.h | 8 ++-- src/ui/widget/filter-effect-chooser.cpp | 2 +- 4 files changed, 56 insertions(+), 29 deletions(-) (limited to 'src') diff --git a/src/extension/internal/filter/color.h b/src/extension/internal/filter/color.h index 9cc009b3a..ecdf25f39 100644 --- a/src/extension/internal/filter/color.h +++ b/src/extension/internal/filter/color.h @@ -153,10 +153,10 @@ public: "\n" "\n" "1\n" - "-1\n" - "0.5\n" - "0.5\n" - "1\n" + "-1\n" + "0.5\n" + "0.5\n" + "1\n" "false\n" "\n" "\n" diff --git a/src/extension/internal/filter/morphology.h b/src/extension/internal/filter/morphology.h index c57cb3618..7dde0002d 100644 --- a/src/extension/internal/filter/morphology.h +++ b/src/extension/internal/filter/morphology.h @@ -33,9 +33,15 @@ namespace Filter { Filter's parameters: * Type (enum, default "Smooth edges") -> - Smooth edges = composite1 (in="SourceGraphic", in2="blur") - Smooth all = composite1 (in="blur", in2="blur") - * Blur (0.01->10., default 5.) -> blur (stdDeviation) + Inner = composite1 (operator="in") + Outer = composite1 (operator="over") + Open = composite1 (operator="XOR") + * Width (0.01->30., default 10.) -> blur (stdDeviation) + * Level (0.2->2., default 1.) -> composite2 (k2) + * Dilatation (1.->100., default 10.) -> colormatrix1 (last-1 value) + * Erosion (1.->100., default 1.) -> colormatrix1 (last value) + * Antialiasing (0.01->1., default 1) -> blur2 (stdDeviation) + * Blur content (boolean, default false) -> blend (true: in="colormatrix2", false: in="SourceGraphic") */ class Crosssmooth : public Inkscape::Extension::Internal::Filter::Filter { @@ -52,10 +58,17 @@ public: "" N_("Cross-smooth") "\n" "org.inkscape.effect.filter.crosssmooth\n" "\n" - "<_item value=\"edges\">Smooth edges\n" - "<_item value=\"all\">Smooth all\n" + "<_item value=\"in\">Inner\n" + "<_item value=\"over\">Outer\n" + "<_item value=\"xor\">Open\n" "\n" - "5\n" + "10\n" + "1\n" + "10\n" + "1\n" + "1\n" + "false\n" + "\n" "all\n" "\n" @@ -75,29 +88,43 @@ Crosssmooth::get_filter_text (Inkscape::Extension::Extension * ext) { if (_filter != NULL) g_free((void *)_filter); - std::ostringstream blur; - std::ostringstream c1in; + std::ostringstream type; + std::ostringstream width; + std::ostringstream level; + std::ostringstream dilat; + std::ostringstream erosion; + std::ostringstream antialias; + std::ostringstream content; - blur << ext->get_param_float("blur"); + type << ext->get_param_enum("type"); + width << ext->get_param_float("width"); + level << ext->get_param_float("level"); + dilat << ext->get_param_float("dilat"); + erosion << (1 - ext->get_param_float("erosion")); + antialias << ext->get_param_float("antialias"); - const gchar *type = ext->get_param_enum("type"); - if((g_ascii_strcasecmp("all", type) == 0)) { - c1in << "blur"; + if (ext->get_param_bool("content")) { + content << "colormatrix2"; } else { - c1in << "SourceGraphic"; + content << "SourceGraphic"; } _filter = g_strdup_printf( "\n" - "\n" - "\n" - "\n" - "\n" - "\n" - "\n", blur.str().c_str(), c1in.str().c_str()); + "\n" + "\n" + "\n" + "\n" + "\n" + "\n" + "\n" + "\n" + "\n", width.str().c_str(), type.str().c_str(), level.str().c_str(), + dilat.str().c_str(), erosion.str().c_str(), antialias.str().c_str(), + content.str().c_str()); return _filter; -}; /* Crosssmooth filter */ +}; /* Cross-smooth filter */ /** \brief Custom predefined Outline filter. diff --git a/src/extension/internal/filter/transparency.h b/src/extension/internal/filter/transparency.h index 1397b726d..add50b169 100644 --- a/src/extension/internal/filter/transparency.h +++ b/src/extension/internal/filter/transparency.h @@ -129,10 +129,10 @@ public: "\n" "" N_("Channel Transparency") "\n" "org.inkscape.effect.filter.ChannelTransparency\n" - "-1\n" - "0.5\n" - "0.5\n" - "1\n" + "-1\n" + "0.5\n" + "0.5\n" + "1\n" "false\n" "\n" "all\n" diff --git a/src/ui/widget/filter-effect-chooser.cpp b/src/ui/widget/filter-effect-chooser.cpp index 37202c8b4..52ce0b5bc 100644 --- a/src/ui/widget/filter-effect-chooser.cpp +++ b/src/ui/widget/filter-effect-chooser.cpp @@ -25,7 +25,7 @@ SimpleFilterModifier::SimpleFilterModifier(int flags) : _lb_blend(_("Blend mode:")), _lb_blur(_("_Blur:"), Gtk::ALIGN_LEFT, Gtk::ALIGN_CENTER, true), _blend(BlendModeConverter, SP_ATTR_INVALID, false), - _blur(0, 0, 100, 1, 0.01, 1) + _blur(0, 0, 100, 1, 0.01, 2) { _flags = flags; -- cgit v1.2.3