From 073995c772424b27f3e63a38e0cc5f3bc800d1d0 Mon Sep 17 00:00:00 2001 From: Nicolas Dufour Date: Tue, 23 Aug 2011 19:56:40 +0200 Subject: Filters. Filters clean-up again. Filters. Outline CPF improvements. Translations. Translation template and file list, French translation update. (bzr r10575) --- src/extension/internal/filter/color.h | 22 +++---- src/extension/internal/filter/filter-all.cpp | 2 +- src/extension/internal/filter/morphology.h | 94 +++++++++++++++++----------- 3 files changed, 71 insertions(+), 47 deletions(-) (limited to 'src') diff --git a/src/extension/internal/filter/color.h b/src/extension/internal/filter/color.h index a026e686a..9cc009b3a 100644 --- a/src/extension/internal/filter/color.h +++ b/src/extension/internal/filter/color.h @@ -18,7 +18,7 @@ * Fade to black or white * Greyscale * Invert - * Lightness + * Lighting * Lightness-contrast * Nudge * Quadritone @@ -1017,7 +1017,7 @@ Invert::get_filter_text (Inkscape::Extension::Extension * ext) }; /* Invert filter */ /** - \brief Custom predefined Lightness filter. + \brief Custom predefined Lighting filter. Modify lights and shadows separately. @@ -1026,19 +1026,19 @@ Invert::get_filter_text (Inkscape::Extension::Extension * ext) * Shadow (0.->20., default 1.) -> component (exponent) * Offset (-1.->1., default 0.) -> component (offset) */ -class Lightness : public Inkscape::Extension::Internal::Filter::Filter { +class Lighting : public Inkscape::Extension::Internal::Filter::Filter { protected: virtual gchar const * get_filter_text (Inkscape::Extension::Extension * ext); public: - Lightness ( ) : Filter() { }; - virtual ~Lightness ( ) { if (_filter != NULL) g_free((void *)_filter); return; } + Lighting ( ) : Filter() { }; + virtual ~Lighting ( ) { if (_filter != NULL) g_free((void *)_filter); return; } static void init (void) { Inkscape::Extension::build_from_mem( "\n" - "" N_("Lightness") "\n" - "org.inkscape.effect.filter.Lightness\n" + "" N_("Lighting") "\n" + "org.inkscape.effect.filter.Lighting\n" "1\n" "1\n" "0\n" @@ -1051,12 +1051,12 @@ public: "\n" "" N_("Modify lights and shadows separately") "\n" "\n" - "\n", new Lightness()); + "\n", new Lighting()); }; }; gchar const * -Lightness::get_filter_text (Inkscape::Extension::Extension * ext) +Lighting::get_filter_text (Inkscape::Extension::Extension * ext) { if (_filter != NULL) g_free((void *)_filter); @@ -1069,7 +1069,7 @@ Lightness::get_filter_text (Inkscape::Extension::Extension * ext) offset << ext->get_param_float("offset"); _filter = g_strdup_printf( - "\n" + "\n" "\n" "\n" "\n" @@ -1080,7 +1080,7 @@ Lightness::get_filter_text (Inkscape::Extension::Extension * ext) amplitude.str().c_str(), exponent.str().c_str(), offset.str().c_str() ); return _filter; -}; /* Lightness filter */ +}; /* Lighting filter */ /** \brief Custom predefined Lightness-Contrast filter. diff --git a/src/extension/internal/filter/filter-all.cpp b/src/extension/internal/filter/filter-all.cpp index 17c22c0cb..b5d47ae45 100755 --- a/src/extension/internal/filter/filter-all.cpp +++ b/src/extension/internal/filter/filter-all.cpp @@ -62,7 +62,7 @@ Filter::filters_all (void ) FadeToBW::init(); Greyscale::init(); Invert::init(); - Lightness::init(); + Lighting::init(); LightnessContrast::init(); Nudge::init(); Quadritone::init(); diff --git a/src/extension/internal/filter/morphology.h b/src/extension/internal/filter/morphology.h index 4b69f564b..c57cb3618 100644 --- a/src/extension/internal/filter/morphology.h +++ b/src/extension/internal/filter/morphology.h @@ -105,20 +105,21 @@ Crosssmooth::get_filter_text (Inkscape::Extension::Extension * ext) Adds a colorizable outline Filter's parameters: - * Stroke type (enum, default single) - * single -> composite4 (in="composite3"), composite2 (operator="atop") - * double -> composite4 (in="SourceGraphic"), composite2 (operator="xor") + * Fill image (boolean, default false) -> true: composite2 (in="SourceGraphic"), false: composite2 (in="blur2") + * Hide image (boolean, default false) -> true: composite4 (in="composite3"), false: composite4 (in="SourceGraphic") + * Stroke type (enum, default over) -> composite2 (operator) * Stroke position (enum, default inside) * inside -> composite1 (operator="out", in="SourceGraphic", in2="blur1") * outside -> composite1 (operator="out", in="blur1", in2="SourceGraphic") * overlayed -> composite1 (operator="xor", in="blur1", in2="SourceGraphic") - * Width 1(0.01->20., default 4) -> blur1 (stdDeviation) - * Width 2 (0.01->20., default 0.5) -> blur2 (stdDeviation) + * Width 1 (0.01->20., default 4) -> blur1 (stdDeviation) * Dilatation 1 (1.->100., default 100) -> colormatrix1 (n-1th value) * Erosion 1 (0.->100., default 1) -> colormatrix1 (nth value 0->-100) + * Width 2 (0.01->20., default 0.5) -> blur2 (stdDeviation) * Dilatation 2 (1.->100., default 50) -> colormatrix2 (n-1th value) * Erosion 2 (0.->100., default 5) -> colormatrix2 (nth value 0->-100) - * Color (guint, default 200,55,55,255) -> flood (flood-color, flood-opacity) + * Antialiasing (0.01->1., default 1) -> blur3 (stdDeviation) + * Color (guint, default 0,0,0,255) -> flood (flood-color, flood-opacity) * Fill opacity (0.->1., default 1) -> composite5 (k2) * Stroke opacity (0.->1., default 1) -> composite5 (k3) @@ -139,9 +140,14 @@ public: "org.inkscape.effect.filter.Outline\n" "\n" "\n" - "\n" - "<_item value=\"single\">" N_("Single") "\n" - "<_item value=\"double\">" N_("Double") "\n" + "false\n" + "false\n" + "\n" + "<_item value=\"over\">" N_("Over") "\n" + "<_item value=\"in\">" N_("In") "\n" + "<_item value=\"out\">" N_("Out") "\n" + "<_item value=\"atop\">" N_("Atop") "\n" + "<_item value=\"xor\">" N_("XOR") "\n" "\n" "\n" "<_item value=\"inside\">" N_("Inside") "\n" @@ -149,14 +155,16 @@ public: "<_item value=\"overlayed\">" N_("Overlayed") "\n" "\n" "4\n" - "0.5\n" "100\n" "1\n" + "0.5\n" "50\n" "5\n" + "1\n" + "false\n" "\n" "\n" - "1029214207\n" + "255\n" "1\n" "1\n" "\n" @@ -181,30 +189,35 @@ Outline::get_filter_text (Inkscape::Extension::Extension * ext) if (_filter != NULL) g_free((void *)_filter); std::ostringstream width1; - std::ostringstream width2; std::ostringstream dilat1; std::ostringstream erosion1; + std::ostringstream width2; std::ostringstream dilat2; std::ostringstream erosion2; + std::ostringstream antialias; std::ostringstream r; std::ostringstream g; std::ostringstream b; std::ostringstream a; std::ostringstream fopacity; std::ostringstream sopacity; - std::ostringstream c4in; - std::ostringstream c4op; + std::ostringstream smooth; + std::ostringstream c1in; std::ostringstream c1in2; std::ostringstream c1op; + std::ostringstream c2in; + std::ostringstream c2op; + std::ostringstream c4in; + width1 << ext->get_param_float("width1"); - width2 << ext->get_param_float("width2"); dilat1 << ext->get_param_float("dilat1"); erosion1 << (- ext->get_param_float("erosion1")); + width2 << ext->get_param_float("width2"); dilat2 << ext->get_param_float("dilat2"); erosion2 << (- ext->get_param_float("erosion2")); - + antialias << ext->get_param_float("antialias"); guint32 color = ext->get_param_color("color"); r << ((color >> 24) & 0xff); g << ((color >> 16) & 0xff); @@ -214,21 +227,10 @@ Outline::get_filter_text (Inkscape::Extension::Extension * ext) fopacity << ext->get_param_float("fopacity"); sopacity << ext->get_param_float("sopacity"); - const gchar *type = ext->get_param_enum("type"); - if((g_ascii_strcasecmp("single", type) == 0)) { - // Single - c4in << "composite3"; - c4op << "atop"; - } else { - // Double - c4in << "SourceGraphic"; - c4op << "xor"; - } - const gchar *position = ext->get_param_enum("position"); if((g_ascii_strcasecmp("inside", position) == 0)) { // Indide - c1in << "SourceGraphic3"; + c1in << "SourceGraphic"; c1in2 << "blur1"; c1op << "out"; } else if((g_ascii_strcasecmp("outside", position) == 0)) { @@ -243,24 +245,46 @@ Outline::get_filter_text (Inkscape::Extension::Extension * ext) c1op << "xor"; } + if (ext->get_param_bool("fill")) { + c2in << "SourceGraphic"; + } else { + c2in << "blur2"; + } + + c2op << ext->get_param_enum("type"); + + if (ext->get_param_bool("outline")) { + c4in << "composite3"; + } else { + c4in << "SourceGraphic"; + } + + if (ext->get_param_bool("smooth")) { + smooth << "1 0"; + } else { + smooth << "5 -1"; + } + _filter = g_strdup_printf( "\n" "\n" "\n" "\n" "\n" - "\n" - "\n" + "\n" + "\n" + "\n" + "\n" "\n" - "\n" - "\n" + "\n" + "\n" "\n" "\n", width1.str().c_str(), c1in.str().c_str(), c1in2.str().c_str(), c1op.str().c_str(), dilat1.str().c_str(), erosion1.str().c_str(), - width2.str().c_str(), dilat2.str().c_str(), erosion2.str().c_str(), + width2.str().c_str(), c2in.str().c_str(), c2op.str().c_str(), + dilat2.str().c_str(), erosion2.str().c_str(), antialias.str().c_str(), smooth.str().c_str(), a.str().c_str(), r.str().c_str(), g.str().c_str(), b.str().c_str(), - c4in.str().c_str(), c4op.str().c_str(), - fopacity.str().c_str(), sopacity.str().c_str() ); + c4in.str().c_str(), fopacity.str().c_str(), sopacity.str().c_str() ); return _filter; }; /* Outline filter */ -- cgit v1.2.3