From: JazzyNico Date: Sun, 5 Dec 2010 15:42:49 +0000 (+0100) Subject: Filters. New Chromolitho custom predefined filter (experimental). Some UI (notebooks... X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=2bef6fe34f9c5a62857761ed6f7b4bb2593d2b3f;p=inkscape.git Filters. New Chromolitho custom predefined filter (experimental). Some UI (notebooks) and comment tweaks on the other filters. --- diff --git a/src/extension/internal/filter/color.h b/src/extension/internal/filter/color.h index 3bf2f6307..54312685c 100644 --- a/src/extension/internal/filter/color.h +++ b/src/extension/internal/filter/color.h @@ -7,6 +7,13 @@ * Ivan Louette (filters) * Nicolas Dufour (UI) * + * Color filters + * Colorize + * Duochrome + * Quadritone + * Solarize + * Tritone + * * Released under GNU GPL, read the file 'COPYING' for more information */ /* ^^^ Change the copyright to be you and your e-mail address ^^^ */ @@ -151,6 +158,8 @@ public: "\n" "" N_("Duochrome, custom -EXP-") "\n" "org.inkscape.effect.filter.Duochrome\n" + "\n" + "\n" "0\n" "\n" "<_item value=\"none\">No swap\n" @@ -158,10 +167,14 @@ public: "<_item value=\"color\">Color only\n" "<_item value=\"alpha\">Alpha only\n" "\n" - "<_param name=\"header1\" type=\"groupheader\">Color 1\n" + "\n" + "\n" "1364325887\n" - "<_param name=\"header2\" type=\"groupheader\">Color 2\n" + "\n" + "\n" "-65281\n" + "\n" + "\n" "\n" "all\n" "\n" @@ -445,14 +458,14 @@ public: "\n" "" N_("Tritone, custom -EXP-") "\n" "org.inkscape.effect.filter.Tritone\n" + "\n" + "\n" "\n" "<_item value=\"normal\">Normal\n" "<_item value=\"enhue\">Enhance hue\n" "<_item value=\"rad\">Radiation\n" "<_item value=\"htb\">Hue to background\n" "\n" - "0\n" - "-73203457\n" "\n" "<_item value=\"lighten\">Lighten\n" "<_item value=\"screen\">Screen\n" @@ -467,6 +480,12 @@ public: "\n" "0\n" "1\n" + "\n" + "\n" + "0\n" + "-73203457\n" + "\n" + "\n" "\n" "all\n" "\n" diff --git a/src/extension/internal/filter/experimental.h b/src/extension/internal/filter/experimental.h index 6acf59f82..a8879720b 100644 --- a/src/extension/internal/filter/experimental.h +++ b/src/extension/internal/filter/experimental.h @@ -7,6 +7,12 @@ * Ivan Louette (filters) * Nicolas Dufour (UI) * + * Experimental filters (no assigned menu) + * Chromolitho + * Drawing + * Posterize + * Test filter (should no be used...) + * * Released under GNU GPL, read the file 'COPYING' for more information */ /* ^^^ Change the copyright to be you and your e-mail address ^^^ */ @@ -22,6 +28,182 @@ namespace Extension { namespace Internal { namespace Filter { +/** + \brief Custom predefined Chromolitho filter. + + Chromo effect with customizable edge drawing and graininess + + Filter's parameters: + * Drawing (boolean, default checked) -> Checked = blend1 (in="convolve1"), unchecked = blend1 (in="composite1") + * Transparent (boolean, default unchecked) -> Checked = colormatrix5 (in="colormatrix4"), Unchecked = colormatrix5 (in="component1") + * Invert (boolean, default false) -> component1 (tableValues) [adds a trailing 0] + * Dented (boolean, default false) -> component1 (tableValues) [adds intermediate 0s] + * Expand white (0->5, default 1) -> component1 (tableValues) [0="0 1", 5="0 1 1 1 1 1 1"] + * Lightness (0->10, default 0) -> composite1 (k1) + * Saturation (0.->1., default 1.) -> colormatrix3 (values) + * Noise reduction (1->1000, default 20) -> convolve (kernelMatrix, central value -1001->-2000, default -1020) + * Drawing blend (enum, default Normal) -> blend1 (mode) + * Smoothness (0.01->10, default 1) -> blur1 (stdDeviation) + * Grain (boolean, default unchecked) -> Checked = blend2 (in="colormatrix2"), Unchecked = blend2 (in="blur1") + * Grain x frequency (0.->100, default 100) -> turbulence1 (baseFrequency, first value) + * Grain y frequency (0.->100, default 100) -> turbulence1 (baseFrequency, second value) + * Grain complexity (1->5, default 1) -> turbulence1 (numOctaves) + * Grain variation (0->1000, default 0) -> turbulence1 (seed) + * Grain expansion (1.->50., default 1.) -> colormatrix1 (n-1 value) + * Grain erosion (0.->40., default 0.) -> colormatrix1 (nth value) [inverted] + * Grain color (boolean, default true) -> colormatrix2 (values) + * Grain blend (enum, default Normal) -> blend2 (mode) +*/ +class Chromolitho : public Inkscape::Extension::Internal::Filter::Filter { +protected: + virtual gchar const * get_filter_text (Inkscape::Extension::Extension * ext); + +public: + Chromolitho ( ) : Filter() { }; + virtual ~Chromolitho ( ) { if (_filter != NULL) g_free((void *)_filter); return; } + + static void init (void) { + Inkscape::Extension::build_from_mem( + "\n" + "" N_("Chromolitho, custom -EXP-") "\n" + "org.inkscape.effect.filter.Chromolitho\n" + "\n" + "\n" + "true\n" + "\n" + "<_item value=\"normal\">Normal\n" + "<_item value=\"multiply\">Multiply\n" + "<_item value=\"screen\">Screen\n" + "<_item value=\"lighten\">Lighten\n" + "<_item value=\"darken\">Darken\n" + "\n" + "false\n" + "false\n" + "false\n" + "0\n" + "1\n" + "20\n" + "1\n" + "\n" + "\n" + "true\n" + "100\n" + "100\n" + "1\n" + "0\n" + "1\n" + "0\n" + "true\n" + "\n" + "<_item value=\"normal\">Normal\n" + "<_item value=\"multiply\">Multiply\n" + "<_item value=\"screen\">Screen\n" + "<_item value=\"lighten\">Lighten\n" + "<_item value=\"darken\">Darken\n" + "\n" + "\n" + "\n" + "\n" + "all\n" + "\n" + "\n" + "\n" + "\n" + "\n" + "" N_("Chromo effect with customizable edge drawing and graininess") "\n" + "\n" + "\n", new Chromolitho()); + }; +}; + +gchar const * +Chromolitho::get_filter_text (Inkscape::Extension::Extension * ext) +{ + if (_filter != NULL) g_free((void *)_filter); + + std::ostringstream b1in; + std::ostringstream b2in; + std::ostringstream col3in; + std::ostringstream transf; + std::ostringstream light; + std::ostringstream saturation; + std::ostringstream noise; + std::ostringstream dblend; + std::ostringstream smooth; + std::ostringstream grain; + std::ostringstream grainxf; + std::ostringstream grainyf; + std::ostringstream grainc; + std::ostringstream grainv; + std::ostringstream gblend; + std::ostringstream grainexp; + std::ostringstream grainero; + std::ostringstream graincol; + + if (ext->get_param_bool("drawing")) + b1in << "convolve1"; + else + b1in << "composite1"; + + if (ext->get_param_bool("transparent")) + col3in << "colormatrix4"; + else + col3in << "component1"; + light << ext->get_param_int("light"); + saturation << ext->get_param_float("saturation"); + noise << (-1000 - ext->get_param_int("noise")); + dblend << ext->get_param_enum("dblend"); + smooth << ext->get_param_float("smooth"); + + if (ext->get_param_bool("dented")) { + transf << "0 1 0 1"; + } else { + transf << "0 1 1"; + } + if (ext->get_param_bool("inverted")) + transf << " 0"; + + if (ext->get_param_bool("grain")) + b2in << "colormatrix2"; + else + b2in << "blur1"; + grainxf << (ext->get_param_float("grainxf") / 100); + grainyf << (ext->get_param_float("grainyf") / 100); + grainc << ext->get_param_int("grainc"); + grainv << ext->get_param_int("grainv"); + gblend << ext->get_param_enum("gblend"); + grainexp << ext->get_param_float("grainexp"); + grainero << (-ext->get_param_float("grainero")); + if (ext->get_param_bool("graincol")) + graincol << "1"; + else + graincol << "0"; + + _filter = g_strdup_printf( + "\n" + + "\n" + "\n" + "\n" + "\n" + "\n" + "\n" + "\n" + "\n" + "\n" + "\n" + "\n" + "\n" + "\n" + "\n" + "\n" + "\n" + "\n" + "\n", light.str().c_str(), noise.str().c_str(), b1in.str().c_str(), dblend.str().c_str(), smooth.str().c_str(), grainxf.str().c_str(), grainyf.str().c_str(), grainc.str().c_str(), grainv.str().c_str(), grainexp.str().c_str(), grainero.str().c_str(), graincol.str().c_str(), b2in.str().c_str(), gblend.str().c_str(), saturation.str().c_str(), transf.str().c_str(), transf.str().c_str(), transf.str().c_str(), col3in.str().c_str()); + + return _filter; +}; /* Chromolitho filter */ + /** \brief Custom predefined Drawing filter. @@ -33,7 +215,7 @@ namespace Filter { * Smoothness (0.01->10, default 0.7) -> blur2 (stdDeviation) * Dilatation (3->100, default 6) -> colormatrix3 (n-1th value) - * Blur (0.01->10., default 5.) -> blur3 (stdDeviation) + * Blur (0.01->10., default 1.) -> blur3 (stdDeviation) * Blur spread (3->20, default 6) -> colormatrix5 (n-1th value) * Blur erosion (-2->0, default -2) -> colormatrix5 (nth value) @@ -58,21 +240,28 @@ public: "\n" "" N_("Drawing, custom -EXP-") "\n" "org.inkscape.effect.filter.Drawing\n" + "\n" + "\n" "0.7\n" "5\n" "0.7\n" "6\n" - "5\n" - "6\n" - "-2\n" - "<_param name=\"fillcolorheader\" type=\"groupheader\">Fill color\n" - "-3473153\n" - "false\n" - "1\n" - "<_param name=\"strokecolorheader\" type=\"groupheader\">Stroke color\n" - "-855637761\n" - "false\n" - "1\n" + "<_param name=\"blurheader\" type=\"groupheader\">Blur\n" + "1\n" + "6\n" + "-2\n" + "\n" + "\n" + "-3473153\n" + "false\n" + "1\n" + "\n" + "\n" + "-855637761\n" + "false\n" + "1\n" + "\n" + "\n" "\n" "all\n" "\n" @@ -84,7 +273,6 @@ public: "\n" "\n", new Drawing()); }; - }; gchar const * @@ -144,7 +332,7 @@ Drawing::get_filter_text (Inkscape::Extension::Extension * ext) ioso << ext->get_param_float("ioso"); _filter = g_strdup_printf( - "\n" + "\n" "\n" "\n" "\n" @@ -178,8 +366,8 @@ Drawing::get_filter_text (Inkscape::Extension::Extension * ext) Poster and painting effects. - Filter's parameters: - * Type (enum, default "Normal") -> + Filter's parameters (not finished yet): + * Effect type (enum, default "Normal") -> Normal = feComponentTransfer Dented = Normal + intermediate values * Blur (0.01->10., default 5.) -> blur3 (stdDeviation) @@ -228,7 +416,6 @@ public: "\n" "\n", new Posterize()); }; - }; gchar const * @@ -252,7 +439,6 @@ Posterize::get_filter_text (Inkscape::Extension::Extension * ext) presat << ext->get_param_float("presaturation"); postsat << ext->get_param_float("postsaturation"); - // TransfertComponent table values are calculated based on the poster type. transf << "0"; int levels = ext->get_param_int("levels") + 1; @@ -271,7 +457,6 @@ Posterize::get_filter_text (Inkscape::Extension::Extension * ext) antialias << "0.5"; else antialias << "0.01"; - _filter = g_strdup_printf( "\n" @@ -319,7 +504,6 @@ public: "\n" "\n", new TestFilter()); }; - }; gchar const * @@ -345,7 +529,8 @@ TestFilter::get_filter_text (Inkscape::Extension::Extension * ext) "\n"); return _filter; -}; +}; /* Test filter */ + }; /* namespace Filter */ }; /* namespace Internal */ }; /* namespace Extension */ diff --git a/src/extension/internal/filter/filter-all.cpp b/src/extension/internal/filter/filter-all.cpp index d04e423ff..06b942a1f 100644 --- a/src/extension/internal/filter/filter-all.cpp +++ b/src/extension/internal/filter/filter-all.cpp @@ -45,6 +45,7 @@ Filter::filters_all (void ) ColorizableDropShadow::init(); // TDB + Chromolitho::init(); Drawing::init(); Posterize::init(); diff --git a/src/extension/internal/filter/morphology.h b/src/extension/internal/filter/morphology.h index e0f544c76..93d44d6fa 100644 --- a/src/extension/internal/filter/morphology.h +++ b/src/extension/internal/filter/morphology.h @@ -7,6 +7,9 @@ * Ivan Louette (filters) * Nicolas Dufour (UI) * + * Morphology filters + * Cross-smooth + * * Released under GNU GPL, read the file 'COPYING' for more information */ /* ^^^ Change the copyright to be you and your e-mail address ^^^ */ @@ -23,7 +26,7 @@ namespace Internal { namespace Filter { /** - \brief Custom predefined Crosssmooth filter. + \brief Custom predefined Cross-smooth filter. Smooth the outside of shapes and pictures. @@ -84,7 +87,7 @@ Crosssmooth::get_filter_text (Inkscape::Extension::Extension * ext) } _filter = g_strdup_printf( - "\n" + "\n" "\n" "\n" "\n"