X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=src%2Fextension%2Finternal%2Ffilter%2Fdrop-shadow.h;h=0cd2a8eeb34c166a788c2d61e28d890ce9ffd16e;hb=9dc68827cbd515262ecb8d5ae8547d9e82c72e00;hp=a48175fdeeb488c7e586f982458c958061961443;hpb=a5d4ad5bb1f7aef41ad04b5b35c41bf9f47a8795;p=inkscape.git diff --git a/src/extension/internal/filter/drop-shadow.h b/src/extension/internal/filter/drop-shadow.h index a48175fde..0cd2a8eeb 100644 --- a/src/extension/internal/filter/drop-shadow.h +++ b/src/extension/internal/filter/drop-shadow.h @@ -34,10 +34,10 @@ public: "\n" "" N_("Drop Shadow") "\n" "org.inkscape.effect.filter.drop-shadow\n" - "2.0\n" - "50\n" - "4.0\n" - "4.0\n" + "2.0\n" + "50\n" + "4.0\n" + "4.0\n" "\n" "all\n" "\n" @@ -94,10 +94,10 @@ public: "\n" "" N_("Drop Glow") "\n" "org.inkscape.effect.filter.drop-glow\n" - "2.0\n" - "50\n" - "4.0\n" - "4.0\n" + "2.0\n" + "50\n" + "4.0\n" + "4.0\n" "\n" "all\n" "\n" @@ -141,6 +141,71 @@ DropGlow::get_filter_text (Inkscape::Extension::Extension * ext) return _filter; }; +class ColorizableDropShadow : public Inkscape::Extension::Internal::Filter::Filter { +protected: + virtual gchar const * get_filter_text (Inkscape::Extension::Extension * ext); + +public: + ColorizableDropShadow ( ) : Filter() { }; + virtual ~ColorizableDropShadow ( ) { if (_filter != NULL) g_free((void *)_filter); return; } + + static void init (void) { + Inkscape::Extension::build_from_mem( + "\n" + "" N_("Drop shadow, color -EXP-") "\n" + "org.inkscape.effect.filter.colorizable-drop-shadow\n" + "3.0\n" + "6.0\n" + "6.0\n" + "127\n" + "\n" + "all\n" + "\n" + "\n" + "\n" + "\n" + "\n" + "" N_("Colorizable Drop shadow") "\n" + "\n" + "\n", new ColorizableDropShadow()); + }; + +}; + +gchar const * +ColorizableDropShadow::get_filter_text (Inkscape::Extension::Extension * ext) +{ + if (_filter != NULL) g_free((void *)_filter); + + std::ostringstream blur; + std::ostringstream a; + std::ostringstream r; + std::ostringstream g; + std::ostringstream b; + std::ostringstream x; + std::ostringstream y; + + guint32 color = ext->get_param_color("color"); + + blur << ext->get_param_float("blur"); + x << ext->get_param_float("xoffset"); + y << ext->get_param_float("yoffset"); + a << (color & 0xff) / 255.0F; + r << ((color >> 24) & 0xff); + g << ((color >> 16) & 0xff); + b << ((color >> 8) & 0xff); + + _filter = g_strdup_printf( + "\n" + "\n" + "\n" + "\n" + "\n" + "\n" + "\n", a.str().c_str(), r.str().c_str(), g.str().c_str(), b.str().c_str(), blur.str().c_str(), x.str().c_str(), y.str().c_str()); + + return _filter; +}; }; /* namespace Filter */ }; /* namespace Internal */ }; /* namespace Extension */