From 56d3279ce493f79922fbc7200f670237fcf45ff2 Mon Sep 17 00:00:00 2001 From: Nicolas Dufour Date: Fri, 28 Sep 2012 13:14:02 +0200 Subject: Filters. Some filters fixes, renaming and simplifications. (bzr r11713) --- src/extension/internal/filter/color.h | 63 +++++++++++++++++------------------ src/extension/internal/filter/paint.h | 52 ++++++++++++----------------- 2 files changed, 53 insertions(+), 62 deletions(-) (limited to 'src') diff --git a/src/extension/internal/filter/color.h b/src/extension/internal/filter/color.h index b6b194c8b..22b77a8cc 100644 --- a/src/extension/internal/filter/color.h +++ b/src/extension/internal/filter/color.h @@ -615,9 +615,8 @@ Duochrome::get_filter_text (Inkscape::Extension::Extension * ext) Filter's parameters: * Channel (enum, all colors, default Red) -> colormatrix (values) - * Background blend (enum, all blend modes, default Multiply) -> blend (mode) + * Background blend (enum, Normal, Multiply, Screen, default Normal) -> blend (mode) * Channel to alpha (boolean, default false) -> colormatrix (values) - * Invert (boolean, default false) -> colormatrix (values) */ class ExtractChannel : public Inkscape::Extension::Internal::Filter::Filter { @@ -637,16 +636,16 @@ public: "<_item value=\"r\">" N_("Red") "\n" "<_item value=\"g\">" N_("Green") "\n" "<_item value=\"b\">" N_("Blue") "\n" + "<_item value=\"c\">" N_("Cyan") "\n" + "<_item value=\"m\">" N_("Majenta") "\n" + "<_item value=\"y\">" N_("Yellow") "\n" "\n" "\n" "<_item value=\"multiply\">" N_("Multiply") "\n" "<_item value=\"normal\">" N_("Normal") "\n" "<_item value=\"screen\">" N_("Screen") "\n" - "<_item value=\"darken\">" N_("Darken") "\n" - "<_item value=\"lighten\">" N_("Lighten") "\n" "\n" "false\n" - "false\n" "\n" "all\n" "\n" @@ -667,45 +666,45 @@ ExtractChannel::get_filter_text (Inkscape::Extension::Extension * ext) std::ostringstream blend; std::ostringstream colors; - std::ostringstream alpha; - std::ostringstream invert; blend << ext->get_param_enum("blend"); const gchar *channel = ext->get_param_enum("source"); if (ext->get_param_bool("alpha")) { - colors << "0 0 0 0 0 0 0 0 0 0 0 0 0 0 0"; - } else if ((g_ascii_strcasecmp("r", channel) == 0)) { - colors << "0 0 0 0 1 0 0 0 0 0 0 0 0 0 0"; - } else if ((g_ascii_strcasecmp("g", channel) == 0)) { - colors << "0 0 0 0 0 0 0 0 0 1 0 0 0 0 0"; - } else { - colors << "0 0 0 0 0 0 0 0 0 0 0 0 0 0 1"; - } - - if (ext->get_param_bool("invert")) { if ((g_ascii_strcasecmp("r", channel) == 0)) { - alpha << "-1 0 0 1"; + colors << "0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0"; } else if ((g_ascii_strcasecmp("g", channel) == 0)) { - alpha << "0 -1 0 1"; + colors << "0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0"; + } else if ((g_ascii_strcasecmp("b", channel) == 0)) { + colors << "0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0"; + } else if ((g_ascii_strcasecmp("c", channel) == 0)) { + colors << "0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -1 0 0 1 0"; + } else if ((g_ascii_strcasecmp("m", channel) == 0)) { + colors << "0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -1 0 1 0"; } else { - alpha << "0 0 -1 1"; + colors << "0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -1 1 0"; } } else { if ((g_ascii_strcasecmp("r", channel) == 0)) { - alpha << "1 0 0 0"; + colors << "0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0"; } else if ((g_ascii_strcasecmp("g", channel) == 0)) { - alpha << "0 1 0 0"; + colors << "0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 1 0 0 0"; + } else if ((g_ascii_strcasecmp("b", channel) == 0)) { + colors << "0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 1 0 0"; + } else if ((g_ascii_strcasecmp("c", channel) == 0)) { + colors << "0 0 0 0 0 0 0 0 0 1 0 0 0 0 1 -1 0 0 1 0"; + } else if ((g_ascii_strcasecmp("m", channel) == 0)) { + colors << "0 0 0 0 1 0 0 0 0 0 0 0 0 0 1 0 -1 0 1 0"; } else { - alpha << "0 0 1 0"; + colors << "0 0 0 0 1 0 0 0 0 1 0 0 0 0 0 0 0 -1 1 0"; } } _filter = g_strdup_printf( "\n" - "\n" + "\n" "\n" - "\n", colors.str().c_str(), alpha.str().c_str(), invert.str().c_str(), blend.str().c_str() ); + "\n", colors.str().c_str(), blend.str().c_str() ); return _filter; }; /* ExtractChannel filter */ @@ -1157,9 +1156,9 @@ LightnessContrast::get_filter_text (Inkscape::Extension::Extension * ext) }; /* Lightness-Contrast filter */ /** - \brief Custom predefined Nudge filter. + \brief Custom predefined Nudge RGB filter. - Nudge separately RGB channels and blend them to different types of backgrounds + Nudge RGB channels separately and blend them to different types of backgrounds Filter's parameters: Offsets @@ -1193,8 +1192,8 @@ public: static void init (void) { Inkscape::Extension::build_from_mem( "\n" - "" N_("Nudge") "\n" - "org.inkscape.effect.filter.Nudge\n" + "" N_("Nudge RGB") "\n" + "org.inkscape.effect.filter.NudgeRGB\n" "\n" "\n" "<_param name=\"redOffset\" type=\"description\" appearance=\"header\">" N_("Red offset") "\n" @@ -1232,7 +1231,7 @@ public: "\n" "\n" "\n" - "" N_("Nudge separately RGB channels and blend them to different types of backgrounds") "\n" + "" N_("Nudge RGB channels separately and blend them to different types of backgrounds") "\n" "\n" "\n", new Nudge()); }; @@ -1277,7 +1276,7 @@ Nudge::get_filter_text (Inkscape::Extension::Extension * ext) a << (color & 0xff) / 255.0F; _filter = g_strdup_printf( - "\n" + "\n" "\n" "\n" "\n" @@ -1297,7 +1296,7 @@ Nudge::get_filter_text (Inkscape::Extension::Extension * ext) return _filter; -}; /* Nudge filter */ +}; /* Nudge RGB filter */ /** \brief Custom predefined Quadritone filter. diff --git a/src/extension/internal/filter/paint.h b/src/extension/internal/filter/paint.h index debdd7d79..dcc51c815 100644 --- a/src/extension/internal/filter/paint.h +++ b/src/extension/internal/filter/paint.h @@ -3,7 +3,7 @@ /* Change the 'PAINT' above to be your file name */ /* - * Copyright (C) 2011 Authors: + * Copyright (C) 2012 Authors: * Ivan Louette (filters) * Nicolas Dufour (UI) * @@ -563,13 +563,13 @@ Electrize::get_filter_text (Inkscape::Extension::Extension * ext) Filter's parameters: * Lines type (enum, default smooth) -> - smooth = component1 (type="table"), component2 (type="table"), composite1 (in2="blur2") - hard = component1 (type="discrete"), component2 (type="discrete"), composite1 (in2="component1") - * Simplify (0.01->20., default 1.5) -> blur1 (stdDeviation) - * Line width (0.01->20., default 1.5) -> blur2 (stdDeviation) - * Lightness (0.->10., default 0.5) -> composite1 (k3) + smooth = component2 (type="table"), composite1 (in2="blur2") + hard = component2 (type="discrete"), composite1 (in2="component1") + * Simplify (0.01->20., default 3) -> blur1 (stdDeviation) + * Line width (0.01->20., default 3) -> blur2 (stdDeviation) + * Lightness (0.->10., default 1) -> composite1 (k2) * Blend (enum [normal, multiply, screen], default normal) -> blend (mode) - * Dark mode (boolean, default false) -> composite1 (true: in2="component2") + * Dark mode (boolean, default false) -> composite2 (true: in2="component2") */ class NeonDraw : public Inkscape::Extension::Internal::Filter::Filter { protected: @@ -588,15 +588,14 @@ public: "<_item value=\"table\">" N_("Smoothed") "\n" "<_item value=\"discrete\">" N_("Contrasted") "\n" "\n" - "1.5\n" - "1.5\n" - "0.5\n" + "3\n" + "3\n" + "1\n" "\n" "<_item value=\"normal\">Normal\n" "<_item value=\"multiply\">Multiply\n" "<_item value=\"screen\">Screen\n" "\n" - "false\n" "\n" "all\n" "\n" @@ -620,7 +619,6 @@ NeonDraw::get_filter_text (Inkscape::Extension::Extension * ext) std::ostringstream width; std::ostringstream lightness; std::ostringstream type; - std::ostringstream dark; type << ext->get_param_enum("type"); blend << ext->get_param_enum("blend"); @@ -628,33 +626,27 @@ NeonDraw::get_filter_text (Inkscape::Extension::Extension * ext) width << ext->get_param_float("width"); lightness << ext->get_param_float("lightness"); - const gchar *typestr = ext->get_param_enum("type"); - if (ext->get_param_bool("dark")) { - dark << "component2"; - } else if ((g_ascii_strcasecmp("table", typestr) == 0)) { - dark << "blur2"; - } else { - dark << "component1"; - } - _filter = g_strdup_printf( "\n" "\n" "\n" + "\n" "\n" - "\n" - "\n" - "\n" + "\n" + "\n" + "\n" "\n" "\n" - "\n" - "\n" - "\n" - "\n" + "\n" + "\n" + "\n" + "\n" + "\n" "\n" - "\n" + "\n" + "\n" "\n" - "\n", blend.str().c_str(), simply.str().c_str(), width.str().c_str(), type.str().c_str(), type.str().c_str(), type.str().c_str(), dark.str().c_str(), lightness.str().c_str()); + "\n", blend.str().c_str(), simply.str().c_str(), width.str().c_str(), type.str().c_str(), type.str().c_str(), type.str().c_str(), lightness.str().c_str()); return _filter; }; /* NeonDraw filter */ -- cgit v1.2.3