From: JazzyNico Date: Tue, 16 Nov 2010 15:25:15 +0000 (+0100) Subject: Filters. Experimental duochrome version 2 (new structure, presence parameters and... X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=a5f2544e0e5d6e4355b5c24391d2a71cf441dac5;p=inkscape.git Filters. Experimental duochrome version 2 (new structure, presence parameters and fluorescence level). All EXP filters moved to the experimental group. --- diff --git a/src/extension/internal/filter/color.h b/src/extension/internal/filter/color.h index 82a37a6aa..17815f006 100644 --- a/src/extension/internal/filter/color.h +++ b/src/extension/internal/filter/color.h @@ -52,7 +52,7 @@ public: "all\n" "\n" "\n" - "\n" + "\n" "\n" "\n" "" N_("Change colors to a two colors palette") "\n" @@ -118,6 +118,105 @@ Duochrome::get_filter_text (Inkscape::Extension::Extension * ext) return _filter; }; + + +class Duochrome2 : public Inkscape::Extension::Internal::Filter::Filter { +protected: + virtual gchar const * get_filter_text (Inkscape::Extension::Extension * ext); + +public: + Duochrome2 ( ) : Filter() { }; + virtual ~Duochrome2 ( ) { if (_filter != NULL) g_free((void *)_filter); return; } + + static void init (void) { + Inkscape::Extension::build_from_mem( + "\n" + "" N_("Duochrome2, custom -EXP-") "\n" + "org.inkscape.effect.filter.Duochrome2\n" + "0\n" + "1\n" + "1\n" + "false\n" + "<_param name=\"header1\" type=\"groupheader\">Color 1\n" + "1364325887\n" + "<_param name=\"header2\" type=\"groupheader\">Color 2\n" + "-65281\n" + "\n" + "all\n" + "\n" + "\n" + "\n" + "\n" + "\n" + "" N_("Convert luminance values to a duochrome palette") "\n" + "\n" + "\n", new Duochrome2()); + }; + +}; + +gchar const * +Duochrome2::get_filter_text (Inkscape::Extension::Extension * ext) +{ + if (_filter != NULL) g_free((void *)_filter); + + std::ostringstream a1; + std::ostringstream r1; + std::ostringstream g1; + std::ostringstream b1; + std::ostringstream a2; + std::ostringstream r2; + std::ostringstream g2; + std::ostringstream b2; + std::ostringstream fluo; + std::ostringstream pres1; + std::ostringstream pres2; + std::ostringstream swap1; + std::ostringstream swap2; + + guint32 color1 = ext->get_param_color("color1"); + guint32 color2 = ext->get_param_color("color2"); + float fluorescence = ext->get_param_float("fluo"); + float presence1 = ext->get_param_float("pres1"); + float presence2 = ext->get_param_float("pres2"); + bool swapcolors = ext->get_param_bool("swapcolors"); + + a1 << (color1 & 0xff) / 255.0F; + r1 << ((color1 >> 24) & 0xff); + g1 << ((color1 >> 16) & 0xff); + b1 << ((color1 >> 8) & 0xff); + a2 << (color2 & 0xff) / 255.0F; + r2 << ((color2 >> 24) & 0xff); + g2 << ((color2 >> 16) & 0xff); + b2 << ((color2 >> 8) & 0xff); + fluo << fluorescence; + pres1 << presence1; + pres2 << presence2; + + if (swapcolors) { + swap1 << "in"; + swap2 << "out"; + } else { + swap2 << "in"; + swap1 << "out"; + } + + _filter = g_strdup_printf( + "\n" + "\n" + "\n" + "\n" + "\n" + "\n" + "\n" + "\n" + "\n" + "\n" + "\n" + "\n", a1.str().c_str(), r1.str().c_str(), g1.str().c_str(), b1.str().c_str(), swap1.str().c_str(), a2.str().c_str(), r2.str().c_str(), g2.str().c_str(), b2.str().c_str(), swap2.str().c_str(), pres2.str().c_str(), pres1.str().c_str(), fluo.str().c_str()); + + return _filter; +}; }; /* namespace Filter */ }; /* namespace Internal */ }; /* namespace Extension */ diff --git a/src/extension/internal/filter/drop-shadow.h b/src/extension/internal/filter/drop-shadow.h index d8c79e3cc..0cd2a8eeb 100644 --- a/src/extension/internal/filter/drop-shadow.h +++ b/src/extension/internal/filter/drop-shadow.h @@ -162,7 +162,7 @@ public: "all\n" "\n" "\n" - "\n" + "\n" "\n" "\n" "" N_("Colorizable Drop shadow") "\n" diff --git a/src/extension/internal/filter/filter-all.cpp b/src/extension/internal/filter/filter-all.cpp index 6920e1bac..287d0a097 100644 --- a/src/extension/internal/filter/filter-all.cpp +++ b/src/extension/internal/filter/filter-all.cpp @@ -24,6 +24,7 @@ Filter::filters_all (void ) { // Here come the filters which are coded in C++ in order to present a parameters dialog Duochrome::init(); + Duochrome2::init(); DropShadow::init(); DropGlow::init(); ColorizableDropShadow::init();