summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 57e8d5f)
raw | patch | inline | side by side (parent: 57e8d5f)
author | JazzyNico <nicoduf@yahoo.fr> | |
Fri, 10 Sep 2010 20:18:10 +0000 (22:18 +0200) | ||
committer | JazzyNico <nicoduf@yahoo.fr> | |
Fri, 10 Sep 2010 20:18:10 +0000 (22:18 +0200) |
src/extension/internal/filter/drop-shadow.h | patch | blob | history | |
src/extension/internal/filter/filter-all.cpp | patch | blob | history |
diff --git a/src/extension/internal/filter/drop-shadow.h b/src/extension/internal/filter/drop-shadow.h
index 12f0c60559a4b5e57f9a726d32226521bb2faa4c..914d9cf9d21464ba08b10a824a358a36bc124023 100644 (file)
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(
+ "<inkscape-extension xmlns=\"" INKSCAPE_EXTENSION_URI "\">\n"
+ "<name>" N_("Drop shadow, color -EXP-") "</name>\n"
+ "<id>org.inkscape.effect.filter.colorizable-drop-shadow</id>\n"
+ "<param name=\"blur\" gui-text=\"" N_("Blur radius (px):") "\" type=\"float\" min=\"0.0\" max=\"200.0\">3.0</param>\n"
+ "<param name=\"xoffset\" gui-text=\"" N_("Horizontal offset (px):") "\" type=\"float\" min=\"-50.0\" max=\"50.0\">6.0</param>\n"
+ "<param name=\"yoffset\" gui-text=\"" N_("Vertical offset (px):") "\" type=\"float\" min=\"-50.0\" max=\"50.0\">6.0</param>\n"
+ "<param name=\"color\" gui-text=\"" N_("Color") "\" type=\"color\">0</param>\n"
+ "<effect>\n"
+ "<object-type>all</object-type>\n"
+ "<effects-menu>\n"
+ "<submenu name=\"" N_("Filters") "\">\n"
+ "<submenu name=\"" N_("Shadows and Glows") "\"/>\n"
+ "</submenu>\n"
+ "</effects-menu>\n"
+ "<menu-tip>" N_("Colorizable Drop shadow") "</menu-tip>\n"
+ "</effect>\n"
+ "</inkscape-extension>\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(
+ "<filter xmlns:inkscape=\"http://www.inkscape.org/namespaces/inkscape\" color-interpolation-filters=\"sRGB\" height=\"1.2\" width=\"1.2\" y=\"-0.1\" x=\"-0.1\" inkscape:label=\"Drop shadow, color -EXP-\">\n"
+ "<feFlood flood-opacity=\"%s\" result=\"flood\" flood-color=\"rgb(%s,%s,%s)\" />\n"
+ "<feComposite in2=\"SourceGraphic\" in=\"flood\" result=\"composite\" operator=\"in\" />\n"
+ "<feGaussianBlur result=\"blur\" stdDeviation=\"%s\" in=\"composite\" />\n"
+ "<feOffset result=\"offsetBlur\" dx=\"%s\" dy=\"%s\" />\n"
+ "<feComposite in2=\"offsetBlur\" in=\"SourceGraphic\" operator=\"over\" result=\"compositeBlur\" />\n"
+ "</filter>\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 */
diff --git a/src/extension/internal/filter/filter-all.cpp b/src/extension/internal/filter/filter-all.cpp
index b4b8caf81d3d67a8c4e3bd80b621aa7aad9a9bb1..6d61501fb5e94609864f66f2f9481aa3fc2380de 100644 (file)
// Here come the filters which are coded in C++ in order to present a parameters dialog
DropShadow::init();
DropGlow::init();
+ ColorizableDropShadow::init();
Snow::init();
// Here come the rest of the filters that are read from SVG files in share/filters and