summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 24a9a5b)
raw | patch | inline | side by side (parent: 24a9a5b)
author | JazzyNico <nicoduf@yahoo.fr> | |
Tue, 11 Jan 2011 13:47:53 +0000 (14:47 +0100) | ||
committer | JazzyNico <nicoduf@yahoo.fr> | |
Tue, 11 Jan 2011 13:47:53 +0000 (14:47 +0100) |
index c93bbb7f7b3b600b89dc66d11da49438a2907f1a..b965851135ee0db6a74920159a261635eb276555 100755 (executable)
*
* Basic filters
* Blur
+ * Clean edges
+ * Color shift
* Diffuse light
+ * Feather
+ * Matte jelly
+ * Noise fill
+ * Outline
* Roughen
+ * Silhouette
* Specular light
*
* Released under GNU GPL, read the file 'COPYING' for more information
/**
\brief Custom predefined Blur filter.
- Simple horizontal and vertical blur.
+ Simple horizontal and vertical blur
Filter's parameters:
* Horizontal blur (0.01->100., default 2) -> blur (stdDeviation)
class Blur : public Inkscape::Extension::Internal::Filter::Filter {
protected:
- virtual gchar const * get_filter_text (Inkscape::Extension::Extension * ext);
+ virtual gchar const * get_filter_text (Inkscape::Extension::Extension * ext);
public:
- Blur ( ) : Filter() { };
- virtual ~Blur ( ) { 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_("Blur, custom (ABCs)") "</name>\n"
- "<id>org.inkscape.effect.filter.blur</id>\n"
- "<param name=\"hblur\" gui-text=\"" N_("Horizontal blur:") "\" type=\"float\" min=\"0.01\" max=\"100\">2</param>\n"
- "<param name=\"vblur\" gui-text=\"" N_("Vertical blur:") "\" type=\"float\" min=\"0.01\" max=\"100\">2</param>\n"
- "<effect>\n"
- "<object-type>all</object-type>\n"
- "<effects-menu>\n"
- "<submenu name=\"" N_("Filters") "\">\n"
- "<submenu name=\"" N_("Experimental") "\"/>\n"
- "</submenu>\n"
- "</effects-menu>\n"
- "<menu-tip>" N_("Simple vertical and horizontal blur effect") "</menu-tip>\n"
- "</effect>\n"
- "</inkscape-extension>\n", new Blur());
- };
+ Blur ( ) : Filter() { };
+ virtual ~Blur ( ) { 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_("Blur, custom (ABCs)") "</name>\n"
+ "<id>org.inkscape.effect.filter.Blur</id>\n"
+ "<param name=\"hblur\" gui-text=\"" N_("Horizontal blur:") "\" type=\"float\" min=\"0.01\" max=\"100\">2</param>\n"
+ "<param name=\"vblur\" gui-text=\"" N_("Vertical blur:") "\" type=\"float\" min=\"0.01\" max=\"100\">2</param>\n"
+ "<effect>\n"
+ "<object-type>all</object-type>\n"
+ "<effects-menu>\n"
+ "<submenu name=\"" N_("Filters") "\">\n"
+ "<submenu name=\"" N_("Experimental") "\"/>\n"
+ "</submenu>\n"
+ "</effects-menu>\n"
+ "<menu-tip>" N_("Simple vertical and horizontal blur effect") "</menu-tip>\n"
+ "</effect>\n"
+ "</inkscape-extension>\n", new Blur());
+ };
};
gchar const *
Blur::get_filter_text (Inkscape::Extension::Extension * ext)
{
- if (_filter != NULL) g_free((void *)_filter);
+ if (_filter != NULL) g_free((void *)_filter);
std::ostringstream hblur;
std::ostringstream vblur;
hblur << ext->get_param_float("hblur");
vblur << ext->get_param_float("vblur");
- _filter = g_strdup_printf(
- "<filter xmlns:inkscape=\"http://www.inkscape.org/namespaces/inkscape\" color-interpolation-filters=\"sRGB\" inkscape:label=\"Blur, custom\">\n"
- "<feGaussianBlur stdDeviation=\"%s %s\" result=\"blur\" />\n"
+ _filter = g_strdup_printf(
+ "<filter xmlns:inkscape=\"http://www.inkscape.org/namespaces/inkscape\" color-interpolation-filters=\"sRGB\" inkscape:label=\"Blur, custom\">\n"
+ "<feGaussianBlur stdDeviation=\"%s %s\" result=\"blur\" />\n"
"</filter>\n", hblur.str().c_str(), vblur.str().c_str());
- return _filter;
+ return _filter;
}; /* Blur filter */
+/**
+ \brief Custom predefined Clean edges filter.
+
+ Removes or decreases glows and jaggeries around objects edges after applying some filters
+
+ Filter's parameters:
+ * Strength (0.01->100., default 0.4) -> blur (stdDeviation)
+*/
+
+class CleanEdges : public Inkscape::Extension::Internal::Filter::Filter {
+protected:
+ virtual gchar const * get_filter_text (Inkscape::Extension::Extension * ext);
+
+public:
+ CleanEdges ( ) : Filter() { };
+ virtual ~CleanEdges ( ) { 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_("Clean edges, custom (ABCs)") "</name>\n"
+ "<id>org.inkscape.effect.filter.CleanEdges</id>\n"
+ "<param name=\"blur\" gui-text=\"" N_("Strength:") "\" type=\"float\" min=\"0.01\" max=\"100\">0.4</param>\n"
+ "<effect>\n"
+ "<object-type>all</object-type>\n"
+ "<effects-menu>\n"
+ "<submenu name=\"" N_("Filters") "\">\n"
+ "<submenu name=\"" N_("Experimental") "\"/>\n"
+ "</submenu>\n"
+ "</effects-menu>\n"
+ "<menu-tip>" N_("Removes or decreases glows and jaggeries around objects edges after applying some filters") "</menu-tip>\n"
+ "</effect>\n"
+ "</inkscape-extension>\n", new CleanEdges());
+ };
+
+};
+
+gchar const *
+CleanEdges::get_filter_text (Inkscape::Extension::Extension * ext)
+{
+ if (_filter != NULL) g_free((void *)_filter);
+
+ std::ostringstream blur;
+
+ blur << ext->get_param_float("blur");
+
+ _filter = g_strdup_printf(
+ "<filter xmlns:inkscape=\"http://www.inkscape.org/namespaces/inkscape\" color-interpolation-filters=\"sRGB\" inkscape:label=\"Clean edges, custom\">\n"
+ "<feGaussianBlur stdDeviation=\"%s\" result=\"blur\" />\n"
+ "<feComposite in=\"SourceGraphic\" in2=\"blur\" operator=\"in\" result=\"composite1\" />\n"
+ "<feComposite in=\"composite1\" in2=\"composite1\" k2=\"1\" operator=\"in\" result=\"composite2\" />\n"
+ "</filter>\n", blur.str().c_str());
+
+ return _filter;
+}; /* CleanEdges filter */
+
+
+/**
+ \brief Custom predefined Color shift filter.
+
+ Rotate and desaturate hue
+
+ Filter's parameters:
+ * Shift (0->360, default 330) -> color1 (values)
+ * Saturation (0.->10., default 6) -> color2 (values [/10])
+*/
+
+class ColorShift : public Inkscape::Extension::Internal::Filter::Filter {
+protected:
+ virtual gchar const * get_filter_text (Inkscape::Extension::Extension * ext);
+
+public:
+ ColorShift ( ) : Filter() { };
+ virtual ~ColorShift ( ) { 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_("Color shift, custom (ABCs)") "</name>\n"
+ "<id>org.inkscape.effect.filter.ColorShift</id>\n"
+ "<param name=\"shift\" gui-text=\"" N_("Shift:") "\" type=\"int\" min=\"0\" max=\"360\">330</param>\n"
+ "<param name=\"sat\" gui-text=\"" N_("Saturation:") "\" type=\"float\" min=\"0.\" max=\"10\">6</param>\n"
+ "<effect>\n"
+ "<object-type>all</object-type>\n"
+ "<effects-menu>\n"
+ "<submenu name=\"" N_("Filters") "\">\n"
+ "<submenu name=\"" N_("Experimental") "\"/>\n"
+ "</submenu>\n"
+ "</effects-menu>\n"
+ "<menu-tip>" N_("Rotate and desaturate hue") "</menu-tip>\n"
+ "</effect>\n"
+ "</inkscape-extension>\n", new ColorShift());
+ };
+
+};
+
+gchar const *
+ColorShift::get_filter_text (Inkscape::Extension::Extension * ext)
+{
+ if (_filter != NULL) g_free((void *)_filter);
+
+ std::ostringstream shift;
+ std::ostringstream sat;
+
+ shift << ext->get_param_int("shift");
+ sat << (ext->get_param_float("sat") / 10);
+
+ _filter = g_strdup_printf(
+ "<filter xmlns:inkscape=\"http://www.inkscape.org/namespaces/inkscape\" color-interpolation-filters=\"sRGB\" height=\"1\" width=\"1\" y=\"0\" x=\"0\" inkscape:label=\"Color shift, custom\">\n"
+ "<feColorMatrix type=\"hueRotate\" values=\"%s\" result=\"color1\" />\n"
+ "<feColorMatrix type=\"saturate\" values=\"%s\" result=\"color2\" />\n"
+ "</filter>\n", shift.str().c_str(), sat.str().c_str());
+
+ return _filter;
+}; /* ColorShift filter */
+
/**
\brief Custom predefined Diffuse light filter.
* Elevation (0->360, default 25) -> feDistantLight (elevation)
* Azimuth (0->360, default 235) -> feDistantLight (azimuth)
* Lightning color (guint, default -1 [white]) -> diffuse (lighting-color)
-
- TODO: use the alpha channel to calculate the lightning color
*/
class DiffuseLight : public Inkscape::Extension::Internal::Filter::Filter {
protected:
- virtual gchar const * get_filter_text (Inkscape::Extension::Extension * ext);
+ virtual gchar const * get_filter_text (Inkscape::Extension::Extension * ext);
public:
- DiffuseLight ( ) : Filter() { };
- virtual ~DiffuseLight ( ) { 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_("Diffuse light, custom (ABCs)") "</name>\n"
- "<id>org.inkscape.effect.filter.diffuselight</id>\n"
- "<param name=\"smooth\" gui-text=\"" N_("Smoothness:") "\" type=\"float\" min=\"0.0\" max=\"10\">6</param>\n"
- "<param name=\"elevation\" gui-text=\"" N_("Elevation:") "\" type=\"int\" min=\"0\" max=\"360\">25</param>\n"
- "<param name=\"azimuth\" gui-text=\"" N_("Azimuth:") "\" type=\"int\" min=\"0\" max=\"360\">235</param>\n"
- "<param name=\"color\" gui-text=\"" N_("Lightning color") "\" type=\"color\">-1</param>\n"
- "<effect>\n"
- "<object-type>all</object-type>\n"
- "<effects-menu>\n"
- "<submenu name=\"" N_("Filters") "\">\n"
- "<submenu name=\"" N_("Experimental") "\"/>\n"
- "</submenu>\n"
- "</effects-menu>\n"
- "<menu-tip>" N_("Basic diffuse bevel to use for building textures") "</menu-tip>\n"
- "</effect>\n"
- "</inkscape-extension>\n", new DiffuseLight());
- };
+ DiffuseLight ( ) : Filter() { };
+ virtual ~DiffuseLight ( ) { 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_("Diffuse light, custom (ABCs)") "</name>\n"
+ "<id>org.inkscape.effect.filter.DiffuseLight</id>\n"
+ "<param name=\"smooth\" gui-text=\"" N_("Smoothness:") "\" type=\"float\" min=\"0.0\" max=\"10\">6</param>\n"
+ "<param name=\"elevation\" gui-text=\"" N_("Elevation:") "\" type=\"int\" min=\"0\" max=\"360\">25</param>\n"
+ "<param name=\"azimuth\" gui-text=\"" N_("Azimuth:") "\" type=\"int\" min=\"0\" max=\"360\">235</param>\n"
+ "<param name=\"color\" gui-text=\"" N_("Lightning color") "\" type=\"color\">-1</param>\n"
+ "<effect>\n"
+ "<object-type>all</object-type>\n"
+ "<effects-menu>\n"
+ "<submenu name=\"" N_("Filters") "\">\n"
+ "<submenu name=\"" N_("Experimental") "\"/>\n"
+ "</submenu>\n"
+ "</effects-menu>\n"
+ "<menu-tip>" N_("Basic diffuse bevel to use for building textures") "</menu-tip>\n"
+ "</effect>\n"
+ "</inkscape-extension>\n", new DiffuseLight());
+ };
};
gchar const *
DiffuseLight::get_filter_text (Inkscape::Extension::Extension * ext)
{
- if (_filter != NULL) g_free((void *)_filter);
+ if (_filter != NULL) g_free((void *)_filter);
std::ostringstream smooth;
std::ostringstream elevation;
b << ((color >> 8) & 0xff);
a << (color & 0xff) / 255.0F;
- _filter = g_strdup_printf(
- "<filter xmlns:inkscape=\"http://www.inkscape.org/namespaces/inkscape\" color-interpolation-filters=\"sRGB\" inkscape:label=\"Diffuse light, custom\">\n"
- "<feGaussianBlur in=\"SourceGraphic\" stdDeviation=\"%s\" result=\"blur\" />\n"
- "<feDiffuseLighting diffuseConstant=\"1\" surfaceScale=\"10\" lighting-color=\"rgb(%s,%s,%s)\" result=\"diffuse\">\n"
+ _filter = g_strdup_printf(
+ "<filter xmlns:inkscape=\"http://www.inkscape.org/namespaces/inkscape\" color-interpolation-filters=\"sRGB\" inkscape:label=\"Diffuse light, custom\">\n"
+ "<feGaussianBlur in=\"SourceGraphic\" stdDeviation=\"%s\" result=\"blur\" />\n"
+ "<feDiffuseLighting diffuseConstant=\"1\" surfaceScale=\"10\" lighting-color=\"rgb(%s,%s,%s)\" result=\"diffuse\">\n"
"<feDistantLight elevation=\"%s\" azimuth=\"%s\" />\n"
- "</feDiffuseLighting>\n"
- "<feComposite in=\"diffuse\" in2=\"diffuse\" operator=\"arithmetic\" k1=\"1\" result=\"composite1\" />\n"
- "<feComposite in=\"composite1\" in2=\"SourceGraphic\" k1=\"%s\" operator=\"arithmetic\" k3=\"1\" result=\"composite2\" />\n"
+ "</feDiffuseLighting>\n"
+ "<feComposite in=\"diffuse\" in2=\"diffuse\" operator=\"arithmetic\" k1=\"1\" result=\"composite1\" />\n"
+ "<feComposite in=\"composite1\" in2=\"SourceGraphic\" k1=\"%s\" operator=\"arithmetic\" k3=\"1\" result=\"composite2\" />\n"
"</filter>\n", smooth.str().c_str(), r.str().c_str(), g.str().c_str(), b.str().c_str(), elevation.str().c_str(), azimuth.str().c_str(), a.str().c_str());
- return _filter;
+ return _filter;
}; /* DiffuseLight filter */
+/**
+ \brief Custom predefined Feather filter.
+
+ Blurred mask on the edge without altering the contents
+
+ Filter's parameters:
+ * Strength (0.01->100., default 5) -> blur (stdDeviation)
+*/
+
+class Feather : public Inkscape::Extension::Internal::Filter::Filter {
+protected:
+ virtual gchar const * get_filter_text (Inkscape::Extension::Extension * ext);
+
+public:
+ Feather ( ) : Filter() { };
+ virtual ~Feather ( ) { 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_("Feather, custom (ABCs)") "</name>\n"
+ "<id>org.inkscape.effect.filter.Feather</id>\n"
+ "<param name=\"blur\" gui-text=\"" N_("Strength:") "\" type=\"float\" min=\"0.01\" max=\"100\">5</param>\n"
+ "<effect>\n"
+ "<object-type>all</object-type>\n"
+ "<effects-menu>\n"
+ "<submenu name=\"" N_("Filters") "\">\n"
+ "<submenu name=\"" N_("Experimental") "\"/>\n"
+ "</submenu>\n"
+ "</effects-menu>\n"
+ "<menu-tip>" N_("Blurred mask on the edge without altering the contents") "</menu-tip>\n"
+ "</effect>\n"
+ "</inkscape-extension>\n", new Feather());
+ };
+
+};
+
+gchar const *
+Feather::get_filter_text (Inkscape::Extension::Extension * ext)
+{
+ if (_filter != NULL) g_free((void *)_filter);
+
+ std::ostringstream blur;
+
+ blur << ext->get_param_float("blur");
+
+ _filter = g_strdup_printf(
+ "<filter xmlns:inkscape=\"http://www.inkscape.org/namespaces/inkscape\" color-interpolation-filters=\"sRGB\" inkscape:label=\"Black outline, custom\">\n"
+ "<feGaussianBlur stdDeviation=\"%s\" result=\"blur\" />\n"
+ "<feComposite in=\"SourceGraphic\" in2=\"blur\" operator=\"atop\" result=\"composite1\" />\n"
+ "<feComposite in2=\"composite1\" operator=\"in\" result=\"composite2\" />\n"
+ "<feComposite in2=\"composite2\" operator=\"in\" result=\"composite3\" />\n"
+ "</filter>\n", blur.str().c_str());
+
+ return _filter;
+}; /* Feather filter */
+
+/**
+ \brief Custom predefined Matte jelly filter.
+
+ Bulging, matte jelly covering
+
+ Filter's parameters:
+ * Smoothness (0.0->10., default 7.) -> blur (stdDeviation)
+ * Brightness (0.0->5., default .9) -> specular (specularConstant)
+ * Elevation (0->360, default 60) -> feDistantLight (elevation)
+ * Azimuth (0->360, default 225) -> feDistantLight (azimuth)
+ * Lightning color (guint, default -1 [white]) -> specular (lighting-color)
+*/
+
+class MatteJelly : public Inkscape::Extension::Internal::Filter::Filter {
+protected:
+ virtual gchar const * get_filter_text (Inkscape::Extension::Extension * ext);
+
+public:
+ MatteJelly ( ) : Filter() { };
+ virtual ~MatteJelly ( ) { 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_("Matte jelly, custom (ABCs)") "</name>\n"
+ "<id>org.inkscape.effect.filter.MatteJelly</id>\n"
+ "<param name=\"smooth\" gui-text=\"" N_("Smoothness:") "\" type=\"float\" min=\"0.0\" max=\"10\">7</param>\n"
+ "<param name=\"bright\" gui-text=\"" N_("Brightness:") "\" type=\"float\" min=\"0.0\" max=\"5\">0.9</param>\n"
+ "<param name=\"elevation\" gui-text=\"" N_("Elevation:") "\" type=\"int\" min=\"0\" max=\"360\">60</param>\n"
+ "<param name=\"azimuth\" gui-text=\"" N_("Azimuth:") "\" type=\"int\" min=\"0\" max=\"360\">225</param>\n"
+ "<param name=\"color\" gui-text=\"" N_("Lightning color") "\" type=\"color\">-1</param>\n"
+ "<effect>\n"
+ "<object-type>all</object-type>\n"
+ "<effects-menu>\n"
+ "<submenu name=\"" N_("Filters") "\">\n"
+ "<submenu name=\"" N_("Experimental") "\"/>\n"
+ "</submenu>\n"
+ "</effects-menu>\n"
+ "<menu-tip>" N_("Bulging, matte jelly covering") "</menu-tip>\n"
+ "</effect>\n"
+ "</inkscape-extension>\n", new MatteJelly());
+ };
+
+};
+
+gchar const *
+MatteJelly::get_filter_text (Inkscape::Extension::Extension * ext)
+{
+ if (_filter != NULL) g_free((void *)_filter);
+
+ std::ostringstream smooth;
+ std::ostringstream bright;
+ std::ostringstream elevation;
+ std::ostringstream azimuth;
+ std::ostringstream r;
+ std::ostringstream g;
+ std::ostringstream b;
+ std::ostringstream a;
+
+ smooth << ext->get_param_float("smooth");
+ bright << ext->get_param_float("bright");
+ elevation << ext->get_param_int("elevation");
+ azimuth << ext->get_param_int("azimuth");
+ guint32 color = ext->get_param_color("color");
+
+ r << ((color >> 24) & 0xff);
+ g << ((color >> 16) & 0xff);
+ b << ((color >> 8) & 0xff);
+ a << (color & 0xff) / 255.0F;
+
+ _filter = g_strdup_printf(
+ "<filter xmlns:inkscape=\"http://www.inkscape.org/namespaces/inkscape\" color-interpolation-filters=\"sRGB\" inkscape:label=\"Matte jelly, custom\">\n"
+ "<feColorMatrix values=\"1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 0.85 0\" result=\"color\" in=\"SourceGraphic\" />\n"
+ "<feGaussianBlur in=\"SourceAlpha\" stdDeviation=\"%s\" result=\"blur\" />\n"
+ "<feSpecularLighting in=\"blur\" specularExponent=\"25\" specularConstant=\"%s\" surfaceScale=\"5\" lighting-color=\"rgb(%s,%s,%s)\" result=\"specular\">\n"
+ "<feDistantLight elevation=\"%s\" azimuth=\"%s\" />\n"
+ "</feSpecularLighting>\n"
+ "<feComposite in=\"specular\" in2=\"SourceGraphic\" k3=\"1\" k2=\"%s\" operator=\"arithmetic\" result=\"composite1\" />\n"
+ "<feComposite in=\"composite1\" in2=\"color\" operator=\"atop\" result=\"composite2\" />\n"
+ "</filter>\n", smooth.str().c_str(), bright.str().c_str(), r.str().c_str(), g.str().c_str(), b.str().c_str(), elevation.str().c_str(), azimuth.str().c_str(), a.str().c_str());
+
+ return _filter;
+}; /* MatteJelly filter */
+
+/**
+ \brief Custom predefined Noise fill filter.
+
+ Basic noise fill and transparency texture
+
+ Filter's parameters:
+ * Turbulence type (enum, default fractalNoise else turbulence) -> turbulence (type)
+ * Horizontal frequency (*100) (0.001->1000., default 2) -> turbulence (baseFrequency [/100])
+ * Vertical frequency (*100) (0.001->1000., default 4) -> turbulence (baseFrequency [/100])
+ * Complexity (1->5, default 5) -> turbulence (numOctaves)
+ * Variation (1->360, default 1) -> turbulence (seed)
+ * Dilatation (1.->50., default 3) -> color (n-1th value)
+ * Erosion (0.->50., default 1) -> color (nth value 0->-50)
+ * Color (guint, default 148,115,39,255) -> flood (flood-color, flood-opacity)
+ * Inverted (boolean, default false) -> composite1 (operator, true="in", false="out")
+*/
+
+class NoiseFill : public Inkscape::Extension::Internal::Filter::Filter {
+protected:
+ virtual gchar const * get_filter_text (Inkscape::Extension::Extension * ext);
+
+public:
+ NoiseFill ( ) : Filter() { };
+ virtual ~NoiseFill ( ) { 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_("Noise fill, custom (ABCs)") "</name>\n"
+ "<id>org.inkscape.effect.filter.NoiseFill</id>\n"
+ "<param name=\"tab\" type=\"notebook\">\n"
+ "<page name=\"optionstab\" _gui-text=\"Options\">\n"
+ "<param name=\"type\" gui-text=\"" N_("Turbulence type:") "\" type=\"enum\">\n"
+ "<_item value=\"fractalNoise\">Fractal noise</_item>\n"
+ "<_item value=\"turbulence\">Turbulence</_item>\n"
+ "</param>\n"
+ "<param name=\"hfreq\" gui-text=\"" N_("Horizontal frequency (x100):") "\" type=\"float\" min=\"0.001\" max=\"1000\">2</param>\n"
+ "<param name=\"vfreq\" gui-text=\"" N_("Vertical frequency (x100):") "\" type=\"float\" min=\"0.001\" max=\"1000\">4</param>\n"
+ "<param name=\"complexity\" gui-text=\"" N_("Complexity:") "\" type=\"int\" min=\"1\" max=\"5\">5</param>\n"
+ "<param name=\"variation\" gui-text=\"" N_("Variation:") "\" type=\"int\" min=\"1\" max=\"360\">0</param>\n"
+ "<param name=\"dilat\" gui-text=\"" N_("Dilatation:") "\" type=\"float\" min=\"1\" max=\"50\">3</param>\n"
+ "<param name=\"erosion\" gui-text=\"" N_("Erosion:") "\" type=\"float\" min=\"0\" max=\"50\">1</param>\n"
+ "<param name=\"inverted\" gui-text=\"" N_("Inverted") "\" type=\"boolean\" >false</param>\n"
+ "</page>\n"
+ "<page name=\"co11tab\" _gui-text=\"Noise color\">\n"
+ "<param name=\"color\" gui-text=\"" N_("Color") "\" type=\"color\">354957823</param>\n"
+ "</page>\n"
+ "</param>\n"
+ "<effect>\n"
+ "<object-type>all</object-type>\n"
+ "<effects-menu>\n"
+ "<submenu name=\"" N_("Filters") "\">\n"
+ "<submenu name=\"" N_("Experimental") "\"/>\n"
+ "</submenu>\n"
+ "</effects-menu>\n"
+ "<menu-tip>" N_("Basic noise fill and transparency texture") "</menu-tip>\n"
+ "</effect>\n"
+ "</inkscape-extension>\n", new NoiseFill());
+ };
+
+};
+
+gchar const *
+NoiseFill::get_filter_text (Inkscape::Extension::Extension * ext)
+{
+ if (_filter != NULL) g_free((void *)_filter);
+
+ std::ostringstream type;
+ std::ostringstream hfreq;
+ std::ostringstream vfreq;
+ std::ostringstream complexity;
+ std::ostringstream variation;
+ std::ostringstream dilat;
+ std::ostringstream erosion;
+ std::ostringstream r;
+ std::ostringstream g;
+ std::ostringstream b;
+ std::ostringstream a;
+ std::ostringstream inverted;
+
+ type << ext->get_param_enum("type");
+ hfreq << (ext->get_param_float("hfreq") / 100);
+ vfreq << (ext->get_param_float("vfreq") / 100);
+ complexity << ext->get_param_int("complexity");
+ variation << ext->get_param_int("variation");
+ dilat << ext->get_param_float("dilat");
+ erosion << (- ext->get_param_float("erosion"));
+ guint32 color = ext->get_param_color("color");
+ r << ((color >> 24) & 0xff);
+ g << ((color >> 16) & 0xff);
+ b << ((color >> 8) & 0xff);
+ a << (color & 0xff) / 255.0F;
+ if (ext->get_param_bool("inverted"))
+ inverted << "out";
+ else
+ inverted << "in";
+
+ _filter = g_strdup_printf(
+ "<filter xmlns:inkscape=\"http://www.inkscape.org/namespaces/inkscape\" color-interpolation-filters=\"sRGB\" inkscape:label=\"Noise fill, custom\">\n"
+ "<feTurbulence type=\"%s\" baseFrequency=\"%s %s\" numOctaves=\"%s\" seed=\"%s\" result=\"turbulence\"/>\n"
+ "<feComposite in=\"SourceGraphic\" in2=\"turbulence\" operator=\"%s\" result=\"composite1\" />\n"
+ "<feColorMatrix values=\"1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 %s %s \" result=\"color\" />\n"
+ "<feFlood in=\"color\" flood-opacity=\"%s\" flood-color=\"rgb(%s,%s,%s)\" result=\"flood\" />\n"
+ "<feMerge result=\"merge\">\n"
+ "<feMergeNode in=\"flood\" />\n"
+ "<feMergeNode in=\"color\" />\n"
+ "</feMerge>\n"
+ "<feComposite in2=\"SourceGraphic\" operator=\"in\" result=\"composite2\" />\n"
+ "</filter>\n", type.str().c_str(), hfreq.str().c_str(), vfreq.str().c_str(), complexity.str().c_str(), variation.str().c_str(), inverted.str().c_str(), dilat.str().c_str(), erosion.str().c_str(), a.str().c_str(), r.str().c_str(), g.str().c_str(), b.str().c_str());
+
+ return _filter;
+}; /* NoiseFill filter */
+
+/**
+ \brief Custom predefined Outline filter.
+
+ Adds a colorizable outline
+
+ Filter's parameters:
+ * Width (0.01->50., default 5) -> blur1 (stdDeviation)
+ * Melt (0.01->50., default 2) -> blur2 (stdDeviation)
+ * Dilatation (1.->50., default 8) -> color2 (n-1th value)
+ * Erosion (0.->50., default 5) -> color2 (nth value 0->-50)
+ * Color (guint, default 156,102,102,255) -> flood (flood-color, flood-opacity)
+ * Blend (enum, default Normal) -> blend (mode)
+*/
+
+class Outline : public Inkscape::Extension::Internal::Filter::Filter {
+protected:
+ virtual gchar const * get_filter_text (Inkscape::Extension::Extension * ext);
+
+public:
+ Outline ( ) : Filter() { };
+ virtual ~Outline ( ) { 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_("Outline, custom (ABCs)") "</name>\n"
+ "<id>org.inkscape.effect.filter.Outline</id>\n"
+ "<param name=\"tab\" type=\"notebook\">\n"
+ "<page name=\"optionstab\" _gui-text=\"Options\">\n"
+ "<param name=\"width\" gui-text=\"" N_("Width:") "\" type=\"float\" min=\"0.01\" max=\"50\">5</param>\n"
+ "<param name=\"melt\" gui-text=\"" N_("Melt:") "\" type=\"float\" min=\"0.01\" max=\"50\">2</param>\n"
+ "<param name=\"dilat\" gui-text=\"" N_("Dilatation:") "\" type=\"float\" min=\"1\" max=\"50\">8</param>\n"
+ "<param name=\"erosion\" gui-text=\"" N_("Erosion:") "\" type=\"float\" min=\"0\" max=\"50\">5</param>\n"
+ "</page>\n"
+ "<page name=\"co11tab\" _gui-text=\"Color\">\n"
+ "<param name=\"color\" gui-text=\"" N_("Color") "\" type=\"color\">1029214207</param>\n"
+ "</page>\n"
+ "</param>\n"
+ "<effect>\n"
+ "<object-type>all</object-type>\n"
+ "<effects-menu>\n"
+ "<submenu name=\"" N_("Filters") "\">\n"
+ "<submenu name=\"" N_("Experimental") "\"/>\n"
+ "</submenu>\n"
+ "</effects-menu>\n"
+ "<menu-tip>" N_("Adds a colorizable outline") "</menu-tip>\n"
+ "</effect>\n"
+ "</inkscape-extension>\n", new Outline());
+ };
+
+};
+
+gchar const *
+Outline::get_filter_text (Inkscape::Extension::Extension * ext)
+{
+ if (_filter != NULL) g_free((void *)_filter);
+
+ std::ostringstream width;
+ std::ostringstream melt;
+ std::ostringstream dilat;
+ std::ostringstream erosion;
+ std::ostringstream r;
+ std::ostringstream g;
+ std::ostringstream b;
+ std::ostringstream a;
+ std::ostringstream blend;
+
+ width << ext->get_param_float("width");
+ melt << ext->get_param_float("melt");
+ dilat << ext->get_param_float("dilat");
+ erosion << (- ext->get_param_float("erosion"));
+ guint32 color = ext->get_param_color("color");
+ r << ((color >> 24) & 0xff);
+ g << ((color >> 16) & 0xff);
+ b << ((color >> 8) & 0xff);
+ a << (color & 0xff) / 255.0F;
+
+ _filter = g_strdup_printf(
+ "<filter xmlns:inkscape=\"http://www.inkscape.org/namespaces/inkscape\" color-interpolation-filters=\"sRGB\" height=\"1.3\" width=\"1.3\" y=\"-0.15\" x=\"-0.15\" inkscape:label=\"Outline, custom\">\n"
+ "<feGaussianBlur in=\"SourceAlpha\" stdDeviation=\"%s\" result=\"blur1\" />\n"
+ "<feColorMatrix result=\"color1\" values=\"0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 200 -1 \" />\n"
+ "<feGaussianBlur in=\"color1\" stdDeviation=\"%s\" result=\"blur2\" />\n"
+ "<feColorMatrix values=\"1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 %s %s \" result=\"color2\" />\n"
+ "<feFlood in=\"color2\" result=\"flood\" flood-opacity=\"%s\" flood-color=\"rgb(%s,%s,%s)\" />\n"
+ "<feComposite in=\"flood\" in2=\"color2\" operator=\"in\" result=\"composite\" />\n"
+ "<feBlend in=\"SourceGraphic\" in2=\"composite\" mode=\"normal\" blend=\"normal\" />\n"
+ "</filter>\n", width.str().c_str(), melt.str().c_str(), dilat.str().c_str(), erosion.str().c_str(), a.str().c_str(), r.str().c_str(), g.str().c_str(), b.str().c_str());
+
+ return _filter;
+}; /* Outline filter */
+
/**
\brief Custom predefined Roughen filter.
Small-scale roughening to edges and content
Filter's parameters:
- * Frequency (*100) (0.0->40., default 1.3) -> turbulence (baseFrequency)
+ * Turbulence type (enum, default fractalNoise else turbulence) -> turbulence (type)
+ * Horizontal frequency (*100) (0.001->1000., default 1.3) -> turbulence (baseFrequency)
+ * Vertical frequency (*100) (0.001->1000., default 1.3) -> turbulence (baseFrequency)
+ * Complexity (1->5, default 5) -> turbulence (numOctaves)
+ * Variation (1->360, default 1) -> turbulence (seed)
* Intensity (0.0->50., default 6.6) -> displacement (scale)
*/
class Roughen : public Inkscape::Extension::Internal::Filter::Filter {
protected:
- virtual gchar const * get_filter_text (Inkscape::Extension::Extension * ext);
+ virtual gchar const * get_filter_text (Inkscape::Extension::Extension * ext);
public:
- Roughen ( ) : Filter() { };
- virtual ~Roughen ( ) { 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_("Roughen, custom (ABCs)") "</name>\n"
- "<id>org.inkscape.effect.filter.roughen</id>\n"
- "<param name=\"hfreq\" gui-text=\"" N_("Horizontal frequency (x100):") "\" type=\"float\" min=\"0.0\" max=\"40\">1.3</param>\n"
- "<param name=\"vfreq\" gui-text=\"" N_("Vertical frequency (x100):") "\" type=\"float\" min=\"0.0\" max=\"40\">1.3</param>\n"
- "<param name=\"intensity\" gui-text=\"" N_("Intensity:") "\" type=\"float\" min=\"0.0\" max=\"50\">6.6</param>\n"
- "<effect>\n"
- "<object-type>all</object-type>\n"
- "<effects-menu>\n"
- "<submenu name=\"" N_("Filters") "\">\n"
- "<submenu name=\"" N_("Experimental") "\"/>\n"
- "</submenu>\n"
- "</effects-menu>\n"
- "<menu-tip>" N_("Small-scale roughening to edges and content") "</menu-tip>\n"
- "</effect>\n"
- "</inkscape-extension>\n", new Roughen());
- };
+ Roughen ( ) : Filter() { };
+ virtual ~Roughen ( ) { 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_("Roughen, custom (ABCs)") "</name>\n"
+ "<id>org.inkscape.effect.filter.Roughen</id>\n"
+ "<param name=\"type\" gui-text=\"" N_("Turbulence type:") "\" type=\"enum\">\n"
+ "<_item value=\"fractalNoise\">Fractal noise</_item>\n"
+ "<_item value=\"turbulence\">Turbulence</_item>\n"
+ "</param>\n"
+ "<param name=\"hfreq\" gui-text=\"" N_("Horizontal frequency (x100):") "\" type=\"float\" min=\"0.001\" max=\"1000\">1.3</param>\n"
+ "<param name=\"vfreq\" gui-text=\"" N_("Vertical frequency (x100):") "\" type=\"float\" min=\"0.001\" max=\"1000\">1.3</param>\n"
+ "<param name=\"complexity\" gui-text=\"" N_("Complexity:") "\" type=\"int\" min=\"1\" max=\"5\">5</param>\n"
+ "<param name=\"variation\" gui-text=\"" N_("Variation:") "\" type=\"int\" min=\"1\" max=\"360\">0</param>\n"
+ "<param name=\"intensity\" gui-text=\"" N_("Intensity:") "\" type=\"float\" min=\"0.0\" max=\"50\">6.6</param>\n"
+ "<effect>\n"
+ "<object-type>all</object-type>\n"
+ "<effects-menu>\n"
+ "<submenu name=\"" N_("Filters") "\">\n"
+ "<submenu name=\"" N_("Experimental") "\"/>\n"
+ "</submenu>\n"
+ "</effects-menu>\n"
+ "<menu-tip>" N_("Small-scale roughening to edges and content") "</menu-tip>\n"
+ "</effect>\n"
+ "</inkscape-extension>\n", new Roughen());
+ };
};
gchar const *
Roughen::get_filter_text (Inkscape::Extension::Extension * ext)
{
- if (_filter != NULL) g_free((void *)_filter);
-
+ if (_filter != NULL) g_free((void *)_filter);
+
+ std::ostringstream type;
std::ostringstream hfreq;
std::ostringstream vfreq;
+ std::ostringstream complexity;
+ std::ostringstream variation;
std::ostringstream intensity;
-
+
+ type << ext->get_param_enum("type");
hfreq << (ext->get_param_float("hfreq") / 100);
vfreq << (ext->get_param_float("vfreq") / 100);
+ complexity << ext->get_param_int("complexity");
+ variation << ext->get_param_int("variation");
intensity << ext->get_param_float("intensity");
- _filter = g_strdup_printf(
- "<filter xmlns:inkscape=\"http://www.inkscape.org/namespaces/inkscape\" color-interpolation-filters=\"sRGB\" inkscape:label=\"Roughen, custom\">\n"
- "<feTurbulence numOctaves=\"3\" seed=\"0\" type=\"turbulence\" baseFrequency=\"%s %s\" result=\"turbulence\" />\n"
- "<feDisplacementMap in=\"SourceGraphic\" in2=\"turbulence\" scale=\"%s\" yChannelSelector=\"G\" xChannelSelector=\"R\" />\n"
- "</filter>\n", hfreq.str().c_str(), vfreq.str().c_str(), intensity.str().c_str());
+ _filter = g_strdup_printf(
+ "<filter xmlns:inkscape=\"http://www.inkscape.org/namespaces/inkscape\" color-interpolation-filters=\"sRGB\" inkscape:label=\"Roughen, custom\">\n"
+ "<feTurbulence type=\"%s\" numOctaves=\"%s\" seed=\"%s\" baseFrequency=\"%s %s\" result=\"turbulence\" />\n"
+ "<feDisplacementMap in=\"SourceGraphic\" in2=\"turbulence\" scale=\"%s\" yChannelSelector=\"G\" xChannelSelector=\"R\" />\n"
+ "</filter>\n", type.str().c_str(), complexity.str().c_str(), variation.str().c_str(), hfreq.str().c_str(), vfreq.str().c_str(), intensity.str().c_str());
- return _filter;
+ return _filter;
}; /* Roughen filter */
+/**
+ \brief Custom predefined Silhouette filter.
+
+ Repaint anything visible monochrome
+
+ Filter's parameters:
+ * Blur (0.->50., default 0) -> blur (stdDeviation)
+ * Cutout (boolean, default False) -> composite (false=in, true=out)
+ * Color (guint, default 0,0,0,255) -> flood (flood-color, flood-opacity)
+*/
+
+class Silhouette : public Inkscape::Extension::Internal::Filter::Filter {
+protected:
+ virtual gchar const * get_filter_text (Inkscape::Extension::Extension * ext);
+
+public:
+ Silhouette ( ) : Filter() { };
+ virtual ~Silhouette ( ) { 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_("Silhouette, custom (ABCs)") "</name>\n"
+ "<id>org.inkscape.effect.filter.Silhouette</id>\n"
+ "<param name=\"blur\" gui-text=\"" N_("Blur:") "\" type=\"float\" min=\"0.\" max=\"50\">0</param>\n"
+ "<param name=\"cutout\" gui-text=\"" N_("Cutout") "\" type=\"boolean\">false</param>\n"
+ "<param name=\"color\" gui-text=\"" N_("Color") "\" type=\"color\">255</param>\n"
+ "<effect>\n"
+ "<object-type>all</object-type>\n"
+ "<effects-menu>\n"
+ "<submenu name=\"" N_("Filters") "\">\n"
+ "<submenu name=\"" N_("Experimental") "\"/>\n"
+ "</submenu>\n"
+ "</effects-menu>\n"
+ "<menu-tip>" N_("Repaint anything visible monochrome") "</menu-tip>\n"
+ "</effect>\n"
+ "</inkscape-extension>\n", new Silhouette());
+ };
+
+};
+
+gchar const *
+Silhouette::get_filter_text (Inkscape::Extension::Extension * ext)
+{
+ if (_filter != NULL) g_free((void *)_filter);
+
+ std::ostringstream a;
+ std::ostringstream r;
+ std::ostringstream g;
+ std::ostringstream b;
+ std::ostringstream cutout;
+ std::ostringstream blur;
+
+ guint32 color = ext->get_param_color("color");
+ r << ((color >> 24) & 0xff);
+ g << ((color >> 16) & 0xff);
+ b << ((color >> 8) & 0xff);
+ a << (color & 0xff) / 255.0F;
+ if (ext->get_param_bool("cutout"))
+ cutout << "out";
+ else
+ cutout << "in";
+ blur << ext->get_param_float("blur");
+
+ _filter = g_strdup_printf(
+ "<filter xmlns:inkscape=\"http://www.inkscape.org/namespaces/inkscape\" color-interpolation-filters=\"sRGB\" inkscape:label=\"Silhouette, custom\">\n"
+ "<feFlood in=\"SourceGraphic\" flood-opacity=\"%s\" flood-color=\"rgb(%s,%s,%s)\" result=\"flood\" />\n"
+ "<feComposite in=\"flood\" in2=\"SourceGraphic\" operator=\"%s\" result=\"composite\" />\n"
+ "<feGaussianBlur stdDeviation=\"%s\" />\n"
+ "</filter>\n", a.str().c_str(), r.str().c_str(), g.str().c_str(), b.str().c_str(), cutout.str().c_str(), blur.str().c_str());
+
+ return _filter;
+}; /* Silhouette filter */
+
/**
\brief Custom predefined Specular light filter.
Filter's parameters:
* Smoothness (0.0->10., default 6.) -> blur (stdDeviation)
* Brightness (0.0->5., default 1.) -> specular (specularConstant)
- * Elevation (0->360, default 25) -> feDistantLight (elevation)
+ * Elevation (0->360, default 45) -> feDistantLight (elevation)
* Azimuth (0->360, default 235) -> feDistantLight (azimuth)
* Lightning color (guint, default -1 [white]) -> specular (lighting-color)
-
- TODO: use the alpha channel to calculate the lightning color (but do we really need a lightning color here?)
*/
class SpecularLight : public Inkscape::Extension::Internal::Filter::Filter {
protected:
- virtual gchar const * get_filter_text (Inkscape::Extension::Extension * ext);
+ virtual gchar const * get_filter_text (Inkscape::Extension::Extension * ext);
public:
- SpecularLight ( ) : Filter() { };
- virtual ~SpecularLight ( ) { 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_("Specular light, custom (ABCs)") "</name>\n"
- "<id>org.inkscape.effect.filter.specularlight</id>\n"
- "<param name=\"smooth\" gui-text=\"" N_("Smoothness:") "\" type=\"float\" min=\"0.0\" max=\"10\">6</param>\n"
- "<param name=\"bright\" gui-text=\"" N_("Brightness:") "\" type=\"float\" min=\"0.0\" max=\"5\">1</param>\n"
- "<param name=\"elevation\" gui-text=\"" N_("Elevation:") "\" type=\"int\" min=\"0\" max=\"360\">45</param>\n"
- "<param name=\"azimuth\" gui-text=\"" N_("Azimuth:") "\" type=\"int\" min=\"0\" max=\"360\">235</param>\n"
- "<param name=\"color\" gui-text=\"" N_("Lightning color") "\" type=\"color\">-1</param>\n"
- "<effect>\n"
- "<object-type>all</object-type>\n"
- "<effects-menu>\n"
- "<submenu name=\"" N_("Filters") "\">\n"
- "<submenu name=\"" N_("Experimental") "\"/>\n"
- "</submenu>\n"
- "</effects-menu>\n"
- "<menu-tip>" N_("Basic specular bevel to use for building textures") "</menu-tip>\n"
- "</effect>\n"
- "</inkscape-extension>\n", new SpecularLight());
- };
+ SpecularLight ( ) : Filter() { };
+ virtual ~SpecularLight ( ) { 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_("Specular light, custom (ABCs)") "</name>\n"
+ "<id>org.inkscape.effect.filter.SpecularLight</id>\n"
+ "<param name=\"smooth\" gui-text=\"" N_("Smoothness:") "\" type=\"float\" min=\"0.0\" max=\"10\">6</param>\n"
+ "<param name=\"bright\" gui-text=\"" N_("Brightness:") "\" type=\"float\" min=\"0.0\" max=\"5\">1</param>\n"
+ "<param name=\"elevation\" gui-text=\"" N_("Elevation:") "\" type=\"int\" min=\"0\" max=\"360\">45</param>\n"
+ "<param name=\"azimuth\" gui-text=\"" N_("Azimuth:") "\" type=\"int\" min=\"0\" max=\"360\">235</param>\n"
+ "<param name=\"color\" gui-text=\"" N_("Lightning color") "\" type=\"color\">-1</param>\n"
+ "<effect>\n"
+ "<object-type>all</object-type>\n"
+ "<effects-menu>\n"
+ "<submenu name=\"" N_("Filters") "\">\n"
+ "<submenu name=\"" N_("Experimental") "\"/>\n"
+ "</submenu>\n"
+ "</effects-menu>\n"
+ "<menu-tip>" N_("Basic specular bevel to use for building textures") "</menu-tip>\n"
+ "</effect>\n"
+ "</inkscape-extension>\n", new SpecularLight());
+ };
};
gchar const *
SpecularLight::get_filter_text (Inkscape::Extension::Extension * ext)
{
- if (_filter != NULL) g_free((void *)_filter);
+ if (_filter != NULL) g_free((void *)_filter);
std::ostringstream smooth;
std::ostringstream bright;
b << ((color >> 8) & 0xff);
a << (color & 0xff) / 255.0F;
- _filter = g_strdup_printf(
- "<filter xmlns:inkscape=\"http://www.inkscape.org/namespaces/inkscape\" color-interpolation-filters=\"sRGB\" inkscape:label=\"Specular light, custom\">\n"
- "<feGaussianBlur in=\"SourceAlpha\" stdDeviation=\"%s\" result=\"blur\" />\n"
- "<feSpecularLighting in=\"blur\" specularExponent=\"25\" specularConstant=\"%s\" surfaceScale=\"10\" lighting-color=\"rgb(%s,%s,%s)\" result=\"specular\">\n"
- "<feDistantLight elevation=\"%s\" azimuth=\"%s\" />\n"
- "</feSpecularLighting>\n"
- "<feComposite in=\"specular\" in2=\"SourceGraphic\" k3=\"1\" k2=\"%s\" operator=\"arithmetic\" result=\"composite1\" />\n"
- "<feComposite in=\"composite1\" in2=\"SourceAlpha\" operator=\"in\" result=\"composite2\" />\n"
+ _filter = g_strdup_printf(
+ "<filter xmlns:inkscape=\"http://www.inkscape.org/namespaces/inkscape\" color-interpolation-filters=\"sRGB\" inkscape:label=\"Specular light, custom\">\n"
+ "<feGaussianBlur in=\"SourceAlpha\" stdDeviation=\"%s\" result=\"blur\" />\n"
+ "<feSpecularLighting in=\"blur\" specularExponent=\"25\" specularConstant=\"%s\" surfaceScale=\"10\" lighting-color=\"rgb(%s,%s,%s)\" result=\"specular\">\n"
+ "<feDistantLight elevation=\"%s\" azimuth=\"%s\" />\n"
+ "</feSpecularLighting>\n"
+ "<feComposite in=\"specular\" in2=\"SourceGraphic\" k3=\"1\" k2=\"%s\" operator=\"arithmetic\" result=\"composite1\" />\n"
+ "<feComposite in=\"composite1\" in2=\"SourceAlpha\" operator=\"in\" result=\"composite2\" />\n"
"</filter>\n", smooth.str().c_str(), bright.str().c_str(), r.str().c_str(), g.str().c_str(), b.str().c_str(), elevation.str().c_str(), azimuth.str().c_str(), a.str().c_str());
- return _filter;
+ return _filter;
}; /* SpecularLight filter */
}; /* namespace Extension */
}; /* namespace Inkscape */
-/* Change the 'COLOR' below to be your file name */
+/* Change the 'ABC' below to be your file name */
#endif /* __INKSCAPE_EXTENSION_INTERNAL_FILTER_ABC_H__ */
index 05173b6843a810715fd95d70533d3e8284391598..559ecd3cc84763b359403e6e437ea1a4f31adf5f 100755 (executable)
/* Change the 'COLOR' above to be your file name */
/*
- * Copyright (C) 2010 Authors:
+ * Copyright (C) 2011 Authors:
* Ivan Louette (filters)
* Nicolas Dufour (UI) <nicoduf@yahoo.fr>
*
* Color filters
* Colorize
* Duochrome
+ * Electrize
* Quadritone
* Solarize
* Tritone
class Colorize : public Inkscape::Extension::Internal::Filter::Filter {
protected:
- virtual gchar const * get_filter_text (Inkscape::Extension::Extension * ext);
+ virtual gchar const * get_filter_text (Inkscape::Extension::Extension * ext);
public:
- Colorize ( ) : Filter() { };
- virtual ~Colorize ( ) { 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_("Colorize, custom (color)") "</name>\n"
- "<id>org.inkscape.effect.filter.Colorize</id>\n"
- "<param name=\"hlight\" gui-text=\"" N_("Harsh light:") "\" type=\"float\" min=\"0\" max=\"10\">0</param>\n"
- "<param name=\"nlight\" gui-text=\"" N_("Normal light:") "\" type=\"float\" min=\"0\" max=\"10\">1</param>\n"
- "<param name=\"duotone\" gui-text=\"" N_("Duotone") "\" type=\"boolean\" >false</param>\n"
- "<param name=\"blend1\" gui-text=\"" N_("Blend1:") "\" type=\"enum\">\n"
- "<_item value=\"multiply\">Multiply</_item>\n"
- "<_item value=\"normal\">Normal</_item>\n"
- "<_item value=\"screen\">Screen</_item>\n"
- "<_item value=\"lighten\">Lighten</_item>\n"
- "<_item value=\"darken\">Darken</_item>\n"
- "</param>\n"
- "<param name=\"blend2\" gui-text=\"" N_("Blend2:") "\" type=\"enum\">\n"
- "<_item value=\"screen\">Screen</_item>\n"
- "<_item value=\"multiply\">Multiply</_item>\n"
- "<_item value=\"normal\">Normal</_item>\n"
- "<_item value=\"lighten\">Lighten</_item>\n"
- "<_item value=\"darken\">Darken</_item>\n"
- "</param>\n"
- "<param name=\"color\" gui-text=\"" N_("Color 1") "\" type=\"color\">-1639776001</param>\n"
- "<effect>\n"
- "<object-type>all</object-type>\n"
- "<effects-menu>\n"
- "<submenu name=\"" N_("Filters") "\">\n"
- "<submenu name=\"" N_("Experimental") "\"/>\n"
- "</submenu>\n"
- "</effects-menu>\n"
- "<menu-tip>" N_("Blend image or object with a flood color") "</menu-tip>\n"
- "</effect>\n"
- "</inkscape-extension>\n", new Colorize());
- };
+ Colorize ( ) : Filter() { };
+ virtual ~Colorize ( ) { 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_("Colorize, custom (Color)") "</name>\n"
+ "<id>org.inkscape.effect.filter.Colorize</id>\n"
+ "<param name=\"tab\" type=\"notebook\">\n"
+ "<page name=\"optionstab\" _gui-text=\"Options\">\n"
+ "<param name=\"hlight\" gui-text=\"" N_("Harsh light:") "\" type=\"float\" min=\"0\" max=\"10\">0</param>\n"
+ "<param name=\"nlight\" gui-text=\"" N_("Normal light:") "\" type=\"float\" min=\"0\" max=\"10\">1</param>\n"
+ "<param name=\"duotone\" gui-text=\"" N_("Duotone") "\" type=\"boolean\" >false</param>\n"
+ "<param name=\"blend1\" gui-text=\"" N_("Blend 1:") "\" type=\"enum\">\n"
+ "<_item value=\"multiply\">Multiply</_item>\n"
+ "<_item value=\"normal\">Normal</_item>\n"
+ "<_item value=\"screen\">Screen</_item>\n"
+ "<_item value=\"lighten\">Lighten</_item>\n"
+ "<_item value=\"darken\">Darken</_item>\n"
+ "</param>\n"
+ "<param name=\"blend2\" gui-text=\"" N_("Blend 2:") "\" type=\"enum\">\n"
+ "<_item value=\"screen\">Screen</_item>\n"
+ "<_item value=\"multiply\">Multiply</_item>\n"
+ "<_item value=\"normal\">Normal</_item>\n"
+ "<_item value=\"lighten\">Lighten</_item>\n"
+ "<_item value=\"darken\">Darken</_item>\n"
+ "</param>\n"
+ "</page>\n"
+ "<page name=\"colortab\" _gui-text=\"Color\">\n"
+ "<param name=\"color\" gui-text=\"" N_("Color") "\" type=\"color\">-1639776001</param>\n"
+ "</page>\n"
+ "</param>\n"
+ "<effect>\n"
+ "<object-type>all</object-type>\n"
+ "<effects-menu>\n"
+ "<submenu name=\"" N_("Filters") "\">\n"
+ "<submenu name=\"" N_("Experimental") "\"/>\n"
+ "</submenu>\n"
+ "</effects-menu>\n"
+ "<menu-tip>" N_("Blend image or object with a flood color") "</menu-tip>\n"
+ "</effect>\n"
+ "</inkscape-extension>\n", new Colorize());
+ };
};
gchar const *
Colorize::get_filter_text (Inkscape::Extension::Extension * ext)
{
- if (_filter != NULL) g_free((void *)_filter);
+ if (_filter != NULL) g_free((void *)_filter);
std::ostringstream a;
std::ostringstream r;
else
duotone << "1";
- _filter = g_strdup_printf(
- "<filter xmlns:inkscape=\"http://www.inkscape.org/namespaces/inkscape\" color-interpolation-filters=\"sRGB\" height=\"1\" width=\"1\" y=\"0\" x=\"0\" inkscape:label=\"Colorize, custom\">\n"
- "<feComposite in2=\"SourceGraphic\" operator=\"arithmetic\" k1=\"%s\" k2=\"%s\" result=\"composite1\" />\n"
- "<feColorMatrix in=\"composite1\" values=\"%s\" type=\"saturate\" result=\"colormatrix1\" />\n"
- "<feFlood flood-opacity=\"%s\" flood-color=\"rgb(%s,%s,%s)\" result=\"flood1\" />\n"
- "<feBlend in=\"flood1\" in2=\"colormatrix1\" mode=\"%s\" result=\"blend1\" />\n"
- "<feBlend in2=\"blend1\" mode=\"%s\" result=\"blend2\" />\n"
- "<feColorMatrix in=\"blend2\" values=\"1\" type=\"saturate\" result=\"colormatrix2\" />\n"
- "<feComposite in=\"colormatrix2\" in2=\"SourceGraphic\" operator=\"in\" k2=\"1\" result=\"composite2\" />\n"
+ _filter = g_strdup_printf(
+ "<filter xmlns:inkscape=\"http://www.inkscape.org/namespaces/inkscape\" color-interpolation-filters=\"sRGB\" height=\"1\" width=\"1\" y=\"0\" x=\"0\" inkscape:label=\"Colorize, custom\">\n"
+ "<feComposite in2=\"SourceGraphic\" operator=\"arithmetic\" k1=\"%s\" k2=\"%s\" result=\"composite1\" />\n"
+ "<feColorMatrix in=\"composite1\" values=\"%s\" type=\"saturate\" result=\"colormatrix1\" />\n"
+ "<feFlood flood-opacity=\"%s\" flood-color=\"rgb(%s,%s,%s)\" result=\"flood1\" />\n"
+ "<feBlend in=\"flood1\" in2=\"colormatrix1\" mode=\"%s\" result=\"blend1\" />\n"
+ "<feBlend in2=\"blend1\" mode=\"%s\" result=\"blend2\" />\n"
+ "<feColorMatrix in=\"blend2\" values=\"1\" type=\"saturate\" result=\"colormatrix2\" />\n"
+ "<feComposite in=\"colormatrix2\" in2=\"SourceGraphic\" operator=\"in\" k2=\"1\" result=\"composite2\" />\n"
"</filter>\n", hlight.str().c_str(), nlight.str().c_str(), duotone.str().c_str(), a.str().c_str(), r.str().c_str(), g.str().c_str(), b.str().c_str(), blend1.str().c_str(), blend2.str().c_str());
- return _filter;
+ return _filter;
}; /* Colorize filter */
class Duochrome : public Inkscape::Extension::Internal::Filter::Filter {
protected:
- virtual gchar const * get_filter_text (Inkscape::Extension::Extension * ext);
+ virtual gchar const * get_filter_text (Inkscape::Extension::Extension * ext);
public:
- Duochrome ( ) : Filter() { };
- virtual ~Duochrome ( ) { 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_("Duochrome, custom (color)") "</name>\n"
- "<id>org.inkscape.effect.filter.Duochrome</id>\n"
- "<param name=\"tab\" type=\"notebook\">\n"
- "<page name=\"optionstab\" _gui-text=\"Options\">\n"
- "<param name=\"fluo\" gui-text=\"" N_("Fluorescence level:") "\" type=\"float\" min=\"0\" max=\"2\">0</param>\n"
- "<param name=\"swap\" gui-text=\"" N_("Swap:") "\" type=\"enum\">\n"
- "<_item value=\"none\">No swap</_item>\n"
- "<_item value=\"full\">Color and alpha</_item>\n"
- "<_item value=\"color\">Color only</_item>\n"
- "<_item value=\"alpha\">Alpha only</_item>\n"
- "</param>\n"
- "</page>\n"
- "<page name=\"co11tab\" _gui-text=\"Color 1\">\n"
- "<param name=\"color1\" gui-text=\"" N_("Color 1") "\" type=\"color\">1364325887</param>\n"
- "</page>\n"
- "<page name=\"co12tab\" _gui-text=\"Color 2\">\n"
- "<param name=\"color2\" gui-text=\"" N_("Color 2") "\" type=\"color\">-65281</param>\n"
- "</page>\n"
- "</param>\n"
- "<effect>\n"
- "<object-type>all</object-type>\n"
- "<effects-menu>\n"
- "<submenu name=\"" N_("Filters") "\">\n"
- "<submenu name=\"" N_("Experimental") "\"/>\n"
- "</submenu>\n"
- "</effects-menu>\n"
- "<menu-tip>" N_("Convert luminance values to a duochrome palette") "</menu-tip>\n"
- "</effect>\n"
- "</inkscape-extension>\n", new Duochrome());
- };
+ Duochrome ( ) : Filter() { };
+ virtual ~Duochrome ( ) { 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_("Duochrome, custom (Color)") "</name>\n"
+ "<id>org.inkscape.effect.filter.Duochrome</id>\n"
+ "<param name=\"tab\" type=\"notebook\">\n"
+ "<page name=\"optionstab\" _gui-text=\"Options\">\n"
+ "<param name=\"fluo\" gui-text=\"" N_("Fluorescence level:") "\" type=\"float\" min=\"0\" max=\"2\">0</param>\n"
+ "<param name=\"swap\" gui-text=\"" N_("Swap:") "\" type=\"enum\">\n"
+ "<_item value=\"none\">No swap</_item>\n"
+ "<_item value=\"full\">Color and alpha</_item>\n"
+ "<_item value=\"color\">Color only</_item>\n"
+ "<_item value=\"alpha\">Alpha only</_item>\n"
+ "</param>\n"
+ "</page>\n"
+ "<page name=\"co11tab\" _gui-text=\"Color 1\">\n"
+ "<param name=\"color1\" gui-text=\"" N_("Color 1") "\" type=\"color\">1364325887</param>\n"
+ "</page>\n"
+ "<page name=\"co12tab\" _gui-text=\"Color 2\">\n"
+ "<param name=\"color2\" gui-text=\"" N_("Color 2") "\" type=\"color\">-65281</param>\n"
+ "</page>\n"
+ "</param>\n"
+ "<effect>\n"
+ "<object-type>all</object-type>\n"
+ "<effects-menu>\n"
+ "<submenu name=\"" N_("Filters") "\">\n"
+ "<submenu name=\"" N_("Experimental") "\"/>\n"
+ "</submenu>\n"
+ "</effects-menu>\n"
+ "<menu-tip>" N_("Convert luminance values to a duochrome palette") "</menu-tip>\n"
+ "</effect>\n"
+ "</inkscape-extension>\n", new Duochrome());
+ };
};
gchar const *
Duochrome::get_filter_text (Inkscape::Extension::Extension * ext)
{
- if (_filter != NULL) g_free((void *)_filter);
+ if (_filter != NULL) g_free((void *)_filter);
std::ostringstream a1;
std::ostringstream r1;
a2 << (color2 & 0xff) / 255.0F;
}
- _filter = g_strdup_printf(
- "<filter xmlns:inkscape=\"http://www.inkscape.org/namespaces/inkscape\" color-interpolation-filters=\"sRGB\" height=\"1\" width=\"1\" y=\"0\" x=\"0\" inkscape:label=\"Duochrome, custom\">\n"
- "<feColorMatrix type=\"luminanceToAlpha\" result=\"colormatrix1\" />\n"
- "<feFlood flood-opacity=\"%s\" flood-color=\"rgb(%s,%s,%s)\" result=\"flood1\" />\n"
- "<feComposite in2=\"colormatrix1\" operator=\"%s\" result=\"composite1\" />\n"
- "<feFlood in=\"colormatrix1\" flood-opacity=\"%s\" flood-color=\"rgb(%s,%s,%s)\" result=\"flood2\" />\n"
- "<feComposite in2=\"colormatrix1\" result=\"composite2\" operator=\"%s\" />\n"
- "<feComposite in=\"composite2\" in2=\"composite1\" k2=\"1\" k3=\"1\" operator=\"arithmetic\" result=\"composite3\" />\n"
- "<feColorMatrix in=\"composite3\" type=\"matrix\" values=\"2 -1 0 0 0 0 2 -1 0 0 -1 0 2 0 0 0 0 0 1 0 \" result=\"colormatrix2\" />\n"
- "<feComposite in=\"colormatrix2\" in2=\"composite3\" operator=\"arithmetic\" k2=\"%s\" result=\"composite4\" />\n"
- "<feBlend in=\"composite4\" in2=\"composite3\" blend=\"normal\" mode=\"normal\" result=\"blend\" />\n"
- "<feComposite in2=\"SourceGraphic\" operator=\"in\" />\n"
+ _filter = g_strdup_printf(
+ "<filter xmlns:inkscape=\"http://www.inkscape.org/namespaces/inkscape\" color-interpolation-filters=\"sRGB\" height=\"1\" width=\"1\" y=\"0\" x=\"0\" inkscape:label=\"Duochrome, custom\">\n"
+ "<feColorMatrix type=\"luminanceToAlpha\" result=\"colormatrix1\" />\n"
+ "<feFlood flood-opacity=\"%s\" flood-color=\"rgb(%s,%s,%s)\" result=\"flood1\" />\n"
+ "<feComposite in2=\"colormatrix1\" operator=\"%s\" result=\"composite1\" />\n"
+ "<feFlood in=\"colormatrix1\" flood-opacity=\"%s\" flood-color=\"rgb(%s,%s,%s)\" result=\"flood2\" />\n"
+ "<feComposite in2=\"colormatrix1\" result=\"composite2\" operator=\"%s\" />\n"
+ "<feComposite in=\"composite2\" in2=\"composite1\" k2=\"1\" k3=\"1\" operator=\"arithmetic\" result=\"composite3\" />\n"
+ "<feColorMatrix in=\"composite3\" type=\"matrix\" values=\"2 -1 0 0 0 0 2 -1 0 0 -1 0 2 0 0 0 0 0 1 0 \" result=\"colormatrix2\" />\n"
+ "<feComposite in=\"colormatrix2\" in2=\"composite3\" operator=\"arithmetic\" k2=\"%s\" result=\"composite4\" />\n"
+ "<feBlend in=\"composite4\" in2=\"composite3\" blend=\"normal\" mode=\"normal\" result=\"blend\" />\n"
+ "<feComposite in2=\"SourceGraphic\" operator=\"in\" />\n"
"</filter>\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(), fluo.str().c_str());
- return _filter;
+ return _filter;
}; /* Duochrome filter */
+/**
+ \brief Custom predefined Electrize filter.
+
+ Electro solarization effects.
+
+ Filter's parameters:
+ * Simplify (0.01->10., default 2.) -> blur (stdDeviation)
+ * Effect type (enum: table or discrete, default "table") -> component (type)
+ * Level (0->10, default 3) -> component (tableValues)
+ * Inverted (boolean, default false) -> component (tableValues)
+*/
+class Electrize : public Inkscape::Extension::Internal::Filter::Filter {
+protected:
+ virtual gchar const * get_filter_text (Inkscape::Extension::Extension * ext);
+
+public:
+ Electrize ( ) : Filter() { };
+ virtual ~Electrize ( ) { 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_("Electrize, custom (Color)") "</name>\n"
+ "<id>org.inkscape.effect.filter.Electrize</id>\n"
+ "<param name=\"blur\" gui-text=\"" N_("Simplify:") "\" type=\"float\" min=\"0.01\" max=\"10.0\">2.0</param>\n"
+ "<param name=\"type\" gui-text=\"" N_("Effect type:") "\" type=\"enum\">\n"
+ "<_item value=\"table\">Table</_item>\n"
+ "<_item value=\"discrete\">Discrete</_item>\n"
+ "</param>\n"
+ "<param name=\"levels\" gui-text=\"" N_("Levels:") "\" type=\"int\" min=\"0\" max=\"10\">3</param>\n"
+ "<param name=\"invert\" gui-text=\"" N_("Inverted") "\" type=\"boolean\">false</param>\n"
+ "<effect>\n"
+ "<object-type>all</object-type>\n"
+ "<effects-menu>\n"
+ "<submenu name=\"" N_("Filters") "\">\n"
+ "<submenu name=\"" N_("Experimental") "\"/>\n"
+ "</submenu>\n"
+ "</effects-menu>\n"
+ "<menu-tip>" N_("Electro solarization effects") "</menu-tip>\n"
+ "</effect>\n"
+ "</inkscape-extension>\n", new Electrize());
+ };
+};
+
+gchar const *
+Electrize::get_filter_text (Inkscape::Extension::Extension * ext)
+{
+ if (_filter != NULL) g_free((void *)_filter);
+
+ std::ostringstream blur;
+ std::ostringstream type;
+ std::ostringstream values;
+
+ blur << ext->get_param_float("blur");
+ type << ext->get_param_enum("type");
+
+ // TransfertComponent table values are calculated based on the effect level and inverted parameters.
+ int val = 0;
+ int levels = ext->get_param_int("levels") + 1;
+ if (ext->get_param_bool("invert"))
+ val = 1;
+ values << val;
+ for ( int step = 1 ; step <= levels ; step++ ) {
+ if (val == 1) {
+ val = 0;
+ }
+ else {
+ val = 1;
+ }
+ values << " " << val;
+ }
+
+ _filter = g_strdup_printf(
+ "<filter xmlns:inkscape=\"http://www.inkscape.org/namespaces/inkscape\" color-interpolation-filters=\"sRGB\" height=\"1\" width=\"1\" y=\"0\" x=\"0\" inkscape:label=\"Electrize, custom\">\n"
+ "<feGaussianBlur stdDeviation=\"%s\" result=\"blur\" />\n"
+ "<feComponentTransfer in=\"blur\" stdDeviation=\"2\" result=\"component\" >\n"
+ "<feFuncR type=\"%s\" tableValues=\"%s\" />\n"
+ "<feFuncG type=\"%s\" tableValues=\"%s\" />\n"
+ "<feFuncB type=\"%s\" tableValues=\"%s\" />\n"
+ "</feComponentTransfer>\n"
+ "</filter>\n", blur.str().c_str(), type.str().c_str(), values.str().c_str(), type.str().c_str(), values.str().c_str(), type.str().c_str(), values.str().c_str());
+
+ return _filter;
+}; /* Electrize filter */
/**
\brief Custom predefined Quadritone filter.
class Quadritone : public Inkscape::Extension::Internal::Filter::Filter {
protected:
- virtual gchar const * get_filter_text (Inkscape::Extension::Extension * ext);
+ virtual gchar const * get_filter_text (Inkscape::Extension::Extension * ext);
public:
- Quadritone ( ) : Filter() { };
- virtual ~Quadritone ( ) { 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_("Quadritone fantasy, custom (color)") "</name>\n"
- "<id>org.inkscape.effect.filter.Quadritone</id>\n"
- "<param name=\"dist\" gui-text=\"" N_("Hue distribution:") "\" type=\"int\" min=\"0\" max=\"360\">280</param>\n"
- "<param name=\"colors\" gui-text=\"" N_("Colors:") "\" type=\"int\" min=\"0\" max=\"360\">100</param>\n"
- "<param name=\"blend1\" gui-text=\"" N_("Blend1:") "\" type=\"enum\">\n"
- "<_item value=\"normal\">Normal</_item>\n"
- "<_item value=\"multiply\">Multiply</_item>\n"
- "<_item value=\"screen\">Screen</_item>\n"
- "</param>\n"
- "<param name=\"sat\" gui-text=\"" N_("Over-saturation:") "\" type=\"float\" min=\"0\" max=\"1\">0</param>\n"
- "<param name=\"blend2\" gui-text=\"" N_("Blend2:") "\" type=\"enum\">\n"
- "<_item value=\"normal\">Normal</_item>\n"
- "<_item value=\"screen\">Screen</_item>\n"
- "<_item value=\"multiply\">Multiply</_item>\n"
- "<_item value=\"lighten\">Lighten</_item>\n"
- "<_item value=\"darken\">Darken</_item>\n"
- "</param>\n"
- "<effect>\n"
- "<object-type>all</object-type>\n"
- "<effects-menu>\n"
- "<submenu name=\"" N_("Filters") "\">\n"
- "<submenu name=\"" N_("Experimental") "\"/>\n"
- "</submenu>\n"
- "</effects-menu>\n"
- "<menu-tip>" N_("Replace hue by two colors") "</menu-tip>\n"
- "</effect>\n"
- "</inkscape-extension>\n", new Quadritone());
- };
+ Quadritone ( ) : Filter() { };
+ virtual ~Quadritone ( ) { 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_("Quadritone fantasy, custom (Color)") "</name>\n"
+ "<id>org.inkscape.effect.filter.Quadritone</id>\n"
+ "<param name=\"dist\" gui-text=\"" N_("Hue distribution:") "\" type=\"int\" min=\"0\" max=\"360\">280</param>\n"
+ "<param name=\"colors\" gui-text=\"" N_("Colors:") "\" type=\"int\" min=\"0\" max=\"360\">100</param>\n"
+ "<param name=\"blend1\" gui-text=\"" N_("Blend 1:") "\" type=\"enum\">\n"
+ "<_item value=\"normal\">Normal</_item>\n"
+ "<_item value=\"multiply\">Multiply</_item>\n"
+ "<_item value=\"screen\">Screen</_item>\n"
+ "</param>\n"
+ "<param name=\"sat\" gui-text=\"" N_("Over-saturation:") "\" type=\"float\" min=\"0\" max=\"1\">0</param>\n"
+ "<param name=\"blend2\" gui-text=\"" N_("Blend 2:") "\" type=\"enum\">\n"
+ "<_item value=\"normal\">Normal</_item>\n"
+ "<_item value=\"screen\">Screen</_item>\n"
+ "<_item value=\"multiply\">Multiply</_item>\n"
+ "<_item value=\"lighten\">Lighten</_item>\n"
+ "<_item value=\"darken\">Darken</_item>\n"
+ "</param>\n"
+ "<effect>\n"
+ "<object-type>all</object-type>\n"
+ "<effects-menu>\n"
+ "<submenu name=\"" N_("Filters") "\">\n"
+ "<submenu name=\"" N_("Experimental") "\"/>\n"
+ "</submenu>\n"
+ "</effects-menu>\n"
+ "<menu-tip>" N_("Replace hue by two colors") "</menu-tip>\n"
+ "</effect>\n"
+ "</inkscape-extension>\n", new Quadritone());
+ };
};
gchar const *
Quadritone::get_filter_text (Inkscape::Extension::Extension * ext)
{
- if (_filter != NULL) g_free((void *)_filter);
+ if (_filter != NULL) g_free((void *)_filter);
std::ostringstream dist;
std::ostringstream colors;
sat << ext->get_param_float("sat");
blend2 << ext->get_param_enum("blend2");
- _filter = g_strdup_printf(
- "<filter xmlns:inkscape=\"http://www.inkscape.org/namespaces/inkscape\" color-interpolation-filters=\"sRGB\" height=\"1\" width=\"1\" y=\"0\" x=\"0\" inkscape:label=\"Quadritone fantasy, custom\">\n"
- "<feColorMatrix in=\"SourceGraphic\" type=\"hueRotate\" values=\"%s\" result=\"colormatrix1\" />\n"
- "<feColorMatrix type=\"matrix\" values=\"0.5 0 0.5 0 0 0 1 0 0 0 0.5 0 0.5 0 0 0 0 0 1 0 \" result=\"colormatrix2\" />\n"
- "<feColorMatrix type=\"hueRotate\" values=\"%s\" result=\"colormatrix3\" />\n"
- "<feBlend in2=\"colormatrix3\" blend=\"normal\" mode=\"%s\" result=\"blend1\" />\n"
- "<feColorMatrix type=\"matrix\" values=\"2.5 -0.75 -0.75 0 0 -0.75 2.5 -0.75 0 0 -0.75 -0.75 2.5 0 0 0 0 0 1 0 \" result=\"colormatrix4\" />\n"
- "<feComposite in=\"colormatrix4\" in2=\"blend1\" operator=\"arithmetic\" k2=\"%s\" result=\"composite1\" />\n"
- "<feBlend in2=\"blend1\" blend=\"normal\" mode=\"%s\" result=\"blend2\" />\n"
+ _filter = g_strdup_printf(
+ "<filter xmlns:inkscape=\"http://www.inkscape.org/namespaces/inkscape\" color-interpolation-filters=\"sRGB\" height=\"1\" width=\"1\" y=\"0\" x=\"0\" inkscape:label=\"Quadritone fantasy, custom\">\n"
+ "<feColorMatrix in=\"SourceGraphic\" type=\"hueRotate\" values=\"%s\" result=\"colormatrix1\" />\n"
+ "<feColorMatrix type=\"matrix\" values=\"0.5 0 0.5 0 0 0 1 0 0 0 0.5 0 0.5 0 0 0 0 0 1 0 \" result=\"colormatrix2\" />\n"
+ "<feColorMatrix type=\"hueRotate\" values=\"%s\" result=\"colormatrix3\" />\n"
+ "<feBlend in2=\"colormatrix3\" blend=\"normal\" mode=\"%s\" result=\"blend1\" />\n"
+ "<feColorMatrix type=\"matrix\" values=\"2.5 -0.75 -0.75 0 0 -0.75 2.5 -0.75 0 0 -0.75 -0.75 2.5 0 0 0 0 0 1 0 \" result=\"colormatrix4\" />\n"
+ "<feComposite in=\"colormatrix4\" in2=\"blend1\" operator=\"arithmetic\" k2=\"%s\" result=\"composite1\" />\n"
+ "<feBlend in2=\"blend1\" blend=\"normal\" mode=\"%s\" result=\"blend2\" />\n"
"</filter>\n", dist.str().c_str(), colors.str().c_str(), blend1.str().c_str(), sat.str().c_str(), blend2.str().c_str());
- return _filter;
+ return _filter;
}; /* Quadritone filter */
class Solarize : public Inkscape::Extension::Internal::Filter::Filter {
protected:
- virtual gchar const * get_filter_text (Inkscape::Extension::Extension * ext);
+ virtual gchar const * get_filter_text (Inkscape::Extension::Extension * ext);
public:
- Solarize ( ) : Filter() { };
- virtual ~Solarize ( ) { 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_("Solarize, custom (color)") "</name>\n"
- "<id>org.inkscape.effect.filter.Solarize</id>\n"
- "<param name=\"rotate\" gui-text=\"" N_("Hue rotation:") "\" type=\"int\" min=\"0\" max=\"360\">0</param>\n"
- "<param name=\"type\" gui-text=\"" N_("Type:") "\" type=\"enum\">\n"
- "<_item value=\"solarize\">Solarize</_item>\n"
- "<_item value=\"moonarize\">Moonarize</_item>\n"
- "</param>\n"
- "<effect>\n"
- "<object-type>all</object-type>\n"
- "<effects-menu>\n"
- "<submenu name=\"" N_("Filters") "\">\n"
- "<submenu name=\"" N_("Experimental") "\"/>\n"
- "</submenu>\n"
- "</effects-menu>\n"
- "<menu-tip>" N_("Classic photographic solarization effect") "</menu-tip>\n"
- "</effect>\n"
- "</inkscape-extension>\n", new Solarize());
- };
+ Solarize ( ) : Filter() { };
+ virtual ~Solarize ( ) { 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_("Solarize, custom (Color)") "</name>\n"
+ "<id>org.inkscape.effect.filter.Solarize</id>\n"
+ "<param name=\"rotate\" gui-text=\"" N_("Hue rotation:") "\" type=\"int\" min=\"0\" max=\"360\">0</param>\n"
+ "<param name=\"type\" gui-text=\"" N_("Type:") "\" type=\"enum\">\n"
+ "<_item value=\"solarize\">Solarize</_item>\n"
+ "<_item value=\"moonarize\">Moonarize</_item>\n"
+ "</param>\n"
+ "<effect>\n"
+ "<object-type>all</object-type>\n"
+ "<effects-menu>\n"
+ "<submenu name=\"" N_("Filters") "\">\n"
+ "<submenu name=\"" N_("Experimental") "\"/>\n"
+ "</submenu>\n"
+ "</effects-menu>\n"
+ "<menu-tip>" N_("Classic photographic solarization effect") "</menu-tip>\n"
+ "</effect>\n"
+ "</inkscape-extension>\n", new Solarize());
+ };
};
gchar const *
Solarize::get_filter_text (Inkscape::Extension::Extension * ext)
{
- if (_filter != NULL) g_free((void *)_filter);
+ if (_filter != NULL) g_free((void *)_filter);
std::ostringstream rotate;
std::ostringstream blend1;
blend2 << "multiply";
}
- _filter = g_strdup_printf(
- "<filter xmlns:inkscape=\"http://www.inkscape.org/namespaces/inkscape\" color-interpolation-filters=\"sRGB\" height=\"1\" width=\"1\" y=\"0\" x=\"0\" inkscape:label=\"Solarize, custom\">\n"
- "<feColorMatrix values=\"1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 1 \" />\n"
- "<feColorMatrix type=\"hueRotate\" values=\"%s\" result=\"colormatrix2\" />\n"
- "<feColorMatrix in=\"colormatrix2\" values=\"-1 0 0 0 1 0 -1 0 0 1 0 0 -1 0 1 0 0 0 1 0 \" result=\"colormatrix3\" />\n"
- "<feBlend in=\"colormatrix3\" in2=\"colormatrix2\" mode=\"%s\" result=\"blend1\" />\n"
- "<feBlend in2=\"blend1\" mode=\"%s\" result=\"blend2\" />\n"
- "<feComposite in2=\"SourceGraphic\" operator=\"in\" />\n"
+ _filter = g_strdup_printf(
+ "<filter xmlns:inkscape=\"http://www.inkscape.org/namespaces/inkscape\" color-interpolation-filters=\"sRGB\" height=\"1\" width=\"1\" y=\"0\" x=\"0\" inkscape:label=\"Solarize, custom\">\n"
+ "<feColorMatrix values=\"1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 1 \" />\n"
+ "<feColorMatrix type=\"hueRotate\" values=\"%s\" result=\"colormatrix2\" />\n"
+ "<feColorMatrix in=\"colormatrix2\" values=\"-1 0 0 0 1 0 -1 0 0 1 0 0 -1 0 1 0 0 0 1 0 \" result=\"colormatrix3\" />\n"
+ "<feBlend in=\"colormatrix3\" in2=\"colormatrix2\" mode=\"%s\" result=\"blend1\" />\n"
+ "<feBlend in2=\"blend1\" mode=\"%s\" result=\"blend2\" />\n"
+ "<feComposite in2=\"SourceGraphic\" operator=\"in\" />\n"
"</filter>\n", rotate.str().c_str(), blend1.str().c_str(), blend2.str().c_str());
- return _filter;
+ return _filter;
}; /* Solarize filter */
class Tritone : public Inkscape::Extension::Internal::Filter::Filter {
protected:
- virtual gchar const * get_filter_text (Inkscape::Extension::Extension * ext);
+ virtual gchar const * get_filter_text (Inkscape::Extension::Extension * ext);
public:
- Tritone ( ) : Filter() { };
- virtual ~Tritone ( ) { 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_("Tritone, custom (color)") "</name>\n"
- "<id>org.inkscape.effect.filter.Tritone</id>\n"
- "<param name=\"tab\" type=\"notebook\">\n"
- "<page name=\"optionstab\" _gui-text=\"Options\">\n"
- "<param name=\"type\" gui-text=\"" N_("Type:") "\" type=\"enum\">\n"
- "<_item value=\"normal\">Normal</_item>\n"
- "<_item value=\"enhue\">Enhance hue</_item>\n"
- "<_item value=\"rad\">Radiation</_item>\n"
- "<_item value=\"htb\">Hue to background</_item>\n"
- "</param>\n"
- "<param name=\"globalblend\" gui-text=\"" N_("Global blend:") "\" type=\"enum\">\n"
- "<_item value=\"lighten\">Lighten</_item>\n"
- "<_item value=\"screen\">Screen</_item>\n"
- "<_item value=\"multiply\">Multiply</_item>\n"
- "<_item value=\"darken\">Darken</_item>\n"
- "</param>\n"
- "<param name=\"glow\" gui-text=\"" N_("Glow:") "\" type=\"float\" min=\"0.01\" max=\"10\">0.01</param>\n"
- "<param name=\"glowblend\" gui-text=\"" N_("Glow blend:") "\" type=\"enum\">\n"
- "<_item value=\"normal\">Normal</_item>\n"
- "<_item value=\"multiply\">Multiply</_item>\n"
- "<_item value=\"darken\">Darken</_item>\n"
- "</param>\n"
- "<param name=\"llight\" gui-text=\"" N_("Local light:") "\" type=\"float\" min=\"0\" max=\"10\">0</param>\n"
- "<param name=\"glight\" gui-text=\"" N_("Global light:") "\" type=\"float\" min=\"0\" max=\"10\">1</param>\n"
- "</page>\n"
- "<page name=\"co1tab\" _gui-text=\"Color\">\n"
- "<param name=\"dist\" gui-text=\"" N_("Hue distribution:") "\" type=\"int\" min=\"0\" max=\"360\">0</param>\n"
- "<param name=\"color\" gui-text=\"" N_("Color") "\" type=\"color\">-73203457</param>\n"
- "</page>\n"
- "</param>\n"
- "<effect>\n"
- "<object-type>all</object-type>\n"
- "<effects-menu>\n"
- "<submenu name=\"" N_("Filters") "\">\n"
- "<submenu name=\"" N_("Experimental") "\"/>\n"
- "</submenu>\n"
- "</effects-menu>\n"
- "<menu-tip>" N_("Create a custom tritone palette with additional glow, blend modes and hue moving") "</menu-tip>\n"
- "</effect>\n"
- "</inkscape-extension>\n", new Tritone());
- };
+ Tritone ( ) : Filter() { };
+ virtual ~Tritone ( ) { 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_("Tritone, custom (Color)") "</name>\n"
+ "<id>org.inkscape.effect.filter.Tritone</id>\n"
+ "<param name=\"tab\" type=\"notebook\">\n"
+ "<page name=\"optionstab\" _gui-text=\"Options\">\n"
+ "<param name=\"type\" gui-text=\"" N_("Type:") "\" type=\"enum\">\n"
+ "<_item value=\"normal\">Normal</_item>\n"
+ "<_item value=\"enhue\">Enhance hue</_item>\n"
+ "<_item value=\"rad\">Radiation</_item>\n"
+ "<_item value=\"htb\">Hue to background</_item>\n"
+ "</param>\n"
+ "<param name=\"globalblend\" gui-text=\"" N_("Global blend:") "\" type=\"enum\">\n"
+ "<_item value=\"lighten\">Lighten</_item>\n"
+ "<_item value=\"screen\">Screen</_item>\n"
+ "<_item value=\"multiply\">Multiply</_item>\n"
+ "<_item value=\"darken\">Darken</_item>\n"
+ "</param>\n"
+ "<param name=\"glow\" gui-text=\"" N_("Glow:") "\" type=\"float\" min=\"0.01\" max=\"10\">0.01</param>\n"
+ "<param name=\"glowblend\" gui-text=\"" N_("Glow blend:") "\" type=\"enum\">\n"
+ "<_item value=\"normal\">Normal</_item>\n"
+ "<_item value=\"multiply\">Multiply</_item>\n"
+ "<_item value=\"darken\">Darken</_item>\n"
+ "</param>\n"
+ "<param name=\"llight\" gui-text=\"" N_("Local light:") "\" type=\"float\" min=\"0\" max=\"10\">0</param>\n"
+ "<param name=\"glight\" gui-text=\"" N_("Global light:") "\" type=\"float\" min=\"0\" max=\"10\">1</param>\n"
+ "</page>\n"
+ "<page name=\"co1tab\" _gui-text=\"Color\">\n"
+ "<param name=\"dist\" gui-text=\"" N_("Hue distribution:") "\" type=\"int\" min=\"0\" max=\"360\">0</param>\n"
+ "<param name=\"color\" gui-text=\"" N_("Color") "\" type=\"color\">-73203457</param>\n"
+ "</page>\n"
+ "</param>\n"
+ "<effect>\n"
+ "<object-type>all</object-type>\n"
+ "<effects-menu>\n"
+ "<submenu name=\"" N_("Filters") "\">\n"
+ "<submenu name=\"" N_("Experimental") "\"/>\n"
+ "</submenu>\n"
+ "</effects-menu>\n"
+ "<menu-tip>" N_("Create a custom tritone palette with additional glow, blend modes and hue moving") "</menu-tip>\n"
+ "</effect>\n"
+ "</inkscape-extension>\n", new Tritone());
+ };
};
gchar const *
Tritone::get_filter_text (Inkscape::Extension::Extension * ext)
{
- if (_filter != NULL) g_free((void *)_filter);
+ if (_filter != NULL) g_free((void *)_filter);
std::ostringstream dist;
std::ostringstream a;
b6in2 << "qminpc";
}
- _filter = g_strdup_printf(
- "<filter xmlns:inkscape=\"http://www.inkscape.org/namespaces/inkscape\" color-interpolation-filters=\"sRGB\" height=\"1\" width=\"1\" y=\"0\" x=\"0\" inkscape:label=\"Tritone, custom\">\n"
- "<feColorMatrix type=\"hueRotate\" result=\"colormatrix1\" values=\"%s\" />\n"
- "<feColorMatrix in=\"colormatrix1\" result=\"r\" type=\"matrix\" values=\"1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 0 0 0 0 1 \" />\n"
- "<feColorMatrix in=\"colormatrix1\" result=\"g\" type=\"matrix\" values=\"0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 0 0 0 1 \" />\n"
- "<feColorMatrix in=\"colormatrix1\" result=\"b\" type=\"matrix\" values=\"0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 0 0 1 \" />\n"
- "<feBlend in2=\"g\" mode=\"darken\" in=\"r\" result=\"minrg\" />\n"
- "<feBlend in2=\"b\" mode=\"darken\" in=\"minrg\" result=\"p\" />\n"
- "<feBlend in2=\"g\" mode=\"lighten\" in=\"r\" result=\"maxrg\" />\n"
- "<feBlend in2=\"b\" mode=\"lighten\" in=\"maxrg\" result=\"q\" />\n"
- "<feComponentTransfer in=\"q\" result=\"q2\">\n"
+ _filter = g_strdup_printf(
+ "<filter xmlns:inkscape=\"http://www.inkscape.org/namespaces/inkscape\" color-interpolation-filters=\"sRGB\" height=\"1\" width=\"1\" y=\"0\" x=\"0\" inkscape:label=\"Tritone, custom\">\n"
+ "<feColorMatrix type=\"hueRotate\" result=\"colormatrix1\" values=\"%s\" />\n"
+ "<feColorMatrix in=\"colormatrix1\" result=\"r\" type=\"matrix\" values=\"1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 0 0 0 0 1 \" />\n"
+ "<feColorMatrix in=\"colormatrix1\" result=\"g\" type=\"matrix\" values=\"0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 0 0 0 1 \" />\n"
+ "<feColorMatrix in=\"colormatrix1\" result=\"b\" type=\"matrix\" values=\"0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 0 0 1 \" />\n"
+ "<feBlend in2=\"g\" mode=\"darken\" in=\"r\" result=\"minrg\" />\n"
+ "<feBlend in2=\"b\" mode=\"darken\" in=\"minrg\" result=\"p\" />\n"
+ "<feBlend in2=\"g\" mode=\"lighten\" in=\"r\" result=\"maxrg\" />\n"
+ "<feBlend in2=\"b\" mode=\"lighten\" in=\"maxrg\" result=\"q\" />\n"
+ "<feComponentTransfer in=\"q\" result=\"q2\">\n"
"<feFuncR type=\"linear\" slope=\"0\" />\n"
- "</feComponentTransfer>\n"
- "<feBlend in2=\"q2\" mode=\"%s\" in=\"p\" result=\"pq\" />\n"
- "<feColorMatrix in=\"pq\" result=\"qminp\" type=\"matrix\" values=\"-1 1 0 0 0 -1 1 0 0 0 -1 1 0 0 0 0 0 0 0 1 \" />\n"
- "<feFlood in=\"qminp\" flood-opacity=\"%s\" flood-color=\"rgb(%s,%s,%s)\" result=\"flood\" />\n"
- "<feComposite in=\"%s\" in2=\"%s\" result=\"qminpc\" operator=\"arithmetic\" k1=\"1\" />\n"
- "<feGaussianBlur stdDeviation=\"%s\" />\n"
- "<feBlend in2=\"%s\" blend=\"normal\" result=\"blend6\" mode=\"%s\" />\n"
- "<feComposite in=\"%s\" in2=\"%s\" operator=\"arithmetic\" k1=\"%s\" k2=\"1\" k3=\"%s\" k4=\"0\" result=\"composite2\" />\n"
- "<feComposite in2=\"SourceGraphic\" in=\"composite2\" operator=\"in\" />\n"
+ "</feComponentTransfer>\n"
+ "<feBlend in2=\"q2\" mode=\"%s\" in=\"p\" result=\"pq\" />\n"
+ "<feColorMatrix in=\"pq\" result=\"qminp\" type=\"matrix\" values=\"-1 1 0 0 0 -1 1 0 0 0 -1 1 0 0 0 0 0 0 0 1 \" />\n"
+ "<feFlood in=\"qminp\" flood-opacity=\"%s\" flood-color=\"rgb(%s,%s,%s)\" result=\"flood\" />\n"
+ "<feComposite in=\"%s\" in2=\"%s\" result=\"qminpc\" operator=\"arithmetic\" k1=\"1\" />\n"
+ "<feGaussianBlur stdDeviation=\"%s\" />\n"
+ "<feBlend in2=\"%s\" blend=\"normal\" result=\"blend6\" mode=\"%s\" />\n"
+ "<feComposite in=\"%s\" in2=\"%s\" operator=\"arithmetic\" k1=\"%s\" k2=\"1\" k3=\"%s\" k4=\"0\" result=\"composite2\" />\n"
+ "<feComposite in2=\"SourceGraphic\" in=\"composite2\" operator=\"in\" />\n"
"</filter>\n", dist.str().c_str(), globalblend.str().c_str(), a.str().c_str(), r.str().c_str(), g.str().c_str(), b.str().c_str(), c1in.str().c_str(), c1in2.str().c_str(), glow.str().c_str(), b6in2.str().c_str(), glowblend.str().c_str(), c2in.str().c_str(), c2in2.str().c_str(), llight.str().c_str(), glight.str().c_str());
- return _filter;
+ return _filter;
}; /* Tritone filter */
}; /* namespace Filter */
diff --git a/src/extension/internal/filter/drop-shadow.h b/src/extension/internal/filter/drop-shadow.h
index 22890d39a67e2afb1394454958d5fc704d2ae34c..12f0c60559a4b5e57f9a726d32226521bb2faa4c 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") "</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\">127</param>\n"
- "<effect>\n"
- "<object-type>all</object-type>\n"
- "<effects-menu>\n"
- "<submenu name=\"" N_("Filters") "\">\n"
- "<submenu name=\"" N_("Experimental") "\"/>\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\">\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/experimental.h b/src/extension/internal/filter/experimental.h
index acd258805a381183bacf1e5869c43420714a7145..0375f008d0a1a013bf6e40383b55c356ac41f277 100755 (executable)
*
* Experimental filters (no assigned menu)
* Chromolitho
+ * Cross engraving
* Drawing
+ * Neon draw
* Posterize
* Posterize basic
*
*/
class Chromolitho : public Inkscape::Extension::Internal::Filter::Filter {
protected:
- virtual gchar const * get_filter_text (Inkscape::Extension::Extension * ext);
+ 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(
- "<inkscape-extension xmlns=\"" INKSCAPE_EXTENSION_URI "\">\n"
- "<name>" N_("Chromolitho, custom") "</name>\n"
- "<id>org.inkscape.effect.filter.Chromolitho</id>\n"
- "<param name=\"tab\" type=\"notebook\">\n"
- "<page name=\"optionstab\" _gui-text=\"Options\">\n"
- "<param name=\"drawing\" gui-text=\"" N_("Drawing mode") "\" type=\"boolean\" >true</param>\n"
- "<param name=\"dblend\" gui-text=\"" N_("Drawing blend:") "\" type=\"enum\">\n"
- "<_item value=\"darken\">Darken</_item>\n"
- "<_item value=\"normal\">Normal</_item>\n"
- "<_item value=\"multiply\">Multiply</_item>\n"
- "<_item value=\"screen\">Screen</_item>\n"
- "<_item value=\"lighten\">Lighten</_item>\n"
- "</param>\n"
- "<param name=\"transparent\" gui-text=\"" N_("Transparent") "\" type=\"boolean\" >false</param>\n"
- "<param name=\"dented\" gui-text=\"" N_("Dented") "\" type=\"boolean\" >false</param>\n"
- "<param name=\"inverted\" gui-text=\"" N_("Inverted") "\" type=\"boolean\" >false</param>\n"
- "<param name=\"light\" gui-text=\"" N_("Lightness:") "\" type=\"float\" min=\"0\" max=\"10\">0</param>\n"
- "<param name=\"saturation\" gui-text=\"" N_("Saturation:") "\" type=\"float\" min=\"0\" max=\"1\">1</param>\n"
- "<param name=\"noise\" gui-text=\"" N_("Noise reduction:") "\" type=\"int\" min=\"1\" max=\"1000\">10</param>\n"
- "<param name=\"smooth\" gui-text=\"" N_("Smoothness:") "\" type=\"float\" min=\"0.01\" max=\"10\">1</param>\n"
- "</page>\n"
- "<page name=\"graintab\" _gui-text=\"Grain\">\n"
- "<param name=\"grain\" gui-text=\"" N_("Grain mode") "\" type=\"boolean\" >true</param>\n"
- "<param name=\"grainxf\" gui-text=\"" N_("X frequency:") "\" type=\"float\" min=\"0\" max=\"100\">100</param>\n"
- "<param name=\"grainyf\" gui-text=\"" N_("Y frequency:") "\" type=\"float\" min=\"0\" max=\"100\">100</param>\n"
- "<param name=\"grainc\" gui-text=\"" N_("Complexity:") "\" type=\"int\" min=\"1\" max=\"5\">1</param>\n"
- "<param name=\"grainv\" gui-text=\"" N_("Variation:") "\" type=\"int\" min=\"0\" max=\"1000\">0</param>\n"
- "<param name=\"grainexp\" gui-text=\"" N_("Expansion:") "\" type=\"float\" min=\"1\" max=\"50\">1</param>\n"
- "<param name=\"grainero\" gui-text=\"" N_("Erosion:") "\" type=\"float\" min=\"0\" max=\"40\">0</param>\n"
- "<param name=\"graincol\" gui-text=\"" N_("Color") "\" type=\"boolean\" >true</param>\n"
- "<param name=\"gblend\" gui-text=\"" N_("Grain blend:") "\" type=\"enum\">\n"
- "<_item value=\"normal\">Normal</_item>\n"
- "<_item value=\"multiply\">Multiply</_item>\n"
- "<_item value=\"screen\">Screen</_item>\n"
- "<_item value=\"lighten\">Lighten</_item>\n"
- "<_item value=\"darken\">Darken</_item>\n"
- "</param>\n"
- "</page>\n"
- "</param>\n"
- "<effect>\n"
- "<object-type>all</object-type>\n"
- "<effects-menu>\n"
- "<submenu name=\"" N_("Filters") "\">\n"
- "<submenu name=\"" N_("Experimental") "\"/>\n"
- "</submenu>\n"
- "</effects-menu>\n"
- "<menu-tip>" N_("Chromo effect with customizable edge drawing and graininess") "</menu-tip>\n"
- "</effect>\n"
- "</inkscape-extension>\n", new Chromolitho());
- };
+ Chromolitho ( ) : Filter() { };
+ virtual ~Chromolitho ( ) { 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_("Chromolitho, custom") "</name>\n"
+ "<id>org.inkscape.effect.filter.Chromolitho</id>\n"
+ "<param name=\"tab\" type=\"notebook\">\n"
+ "<page name=\"optionstab\" _gui-text=\"Options\">\n"
+ "<param name=\"drawing\" gui-text=\"" N_("Drawing mode") "\" type=\"boolean\" >true</param>\n"
+ "<param name=\"dblend\" gui-text=\"" N_("Drawing blend:") "\" type=\"enum\">\n"
+ "<_item value=\"darken\">Darken</_item>\n"
+ "<_item value=\"normal\">Normal</_item>\n"
+ "<_item value=\"multiply\">Multiply</_item>\n"
+ "<_item value=\"screen\">Screen</_item>\n"
+ "<_item value=\"lighten\">Lighten</_item>\n"
+ "</param>\n"
+ "<param name=\"transparent\" gui-text=\"" N_("Transparent") "\" type=\"boolean\" >false</param>\n"
+ "<param name=\"dented\" gui-text=\"" N_("Dented") "\" type=\"boolean\" >false</param>\n"
+ "<param name=\"inverted\" gui-text=\"" N_("Inverted") "\" type=\"boolean\" >false</param>\n"
+ "<param name=\"light\" gui-text=\"" N_("Lightness:") "\" type=\"float\" min=\"0\" max=\"10\">0</param>\n"
+ "<param name=\"saturation\" gui-text=\"" N_("Saturation:") "\" type=\"float\" min=\"0\" max=\"1\">1</param>\n"
+ "<param name=\"noise\" gui-text=\"" N_("Noise reduction:") "\" type=\"int\" min=\"1\" max=\"1000\">10</param>\n"
+ "<param name=\"smooth\" gui-text=\"" N_("Smoothness:") "\" type=\"float\" min=\"0.01\" max=\"10\">1</param>\n"
+ "</page>\n"
+ "<page name=\"graintab\" _gui-text=\"Grain\">\n"
+ "<param name=\"grain\" gui-text=\"" N_("Grain mode") "\" type=\"boolean\" >true</param>\n"
+ "<param name=\"grainxf\" gui-text=\"" N_("X frequency:") "\" type=\"float\" min=\"0\" max=\"100\">100</param>\n"
+ "<param name=\"grainyf\" gui-text=\"" N_("Y frequency:") "\" type=\"float\" min=\"0\" max=\"100\">100</param>\n"
+ "<param name=\"grainc\" gui-text=\"" N_("Complexity:") "\" type=\"int\" min=\"1\" max=\"5\">1</param>\n"
+ "<param name=\"grainv\" gui-text=\"" N_("Variation:") "\" type=\"int\" min=\"0\" max=\"1000\">0</param>\n"
+ "<param name=\"grainexp\" gui-text=\"" N_("Expansion:") "\" type=\"float\" min=\"1\" max=\"50\">1</param>\n"
+ "<param name=\"grainero\" gui-text=\"" N_("Erosion:") "\" type=\"float\" min=\"0\" max=\"40\">0</param>\n"
+ "<param name=\"graincol\" gui-text=\"" N_("Color") "\" type=\"boolean\" >true</param>\n"
+ "<param name=\"gblend\" gui-text=\"" N_("Grain blend:") "\" type=\"enum\">\n"
+ "<_item value=\"normal\">Normal</_item>\n"
+ "<_item value=\"multiply\">Multiply</_item>\n"
+ "<_item value=\"screen\">Screen</_item>\n"
+ "<_item value=\"lighten\">Lighten</_item>\n"
+ "<_item value=\"darken\">Darken</_item>\n"
+ "</param>\n"
+ "</page>\n"
+ "</param>\n"
+ "<effect>\n"
+ "<object-type>all</object-type>\n"
+ "<effects-menu>\n"
+ "<submenu name=\"" N_("Filters") "\">\n"
+ "<submenu name=\"" N_("Experimental") "\"/>\n"
+ "</submenu>\n"
+ "</effects-menu>\n"
+ "<menu-tip>" N_("Chromo effect with customizable edge drawing and graininess") "</menu-tip>\n"
+ "</effect>\n"
+ "</inkscape-extension>\n", new Chromolitho());
+ };
};
gchar const *
Chromolitho::get_filter_text (Inkscape::Extension::Extension * ext)
{
- if (_filter != NULL) g_free((void *)_filter);
+ if (_filter != NULL) g_free((void *)_filter);
std::ostringstream b1in;
std::ostringstream b2in;
else
graincol << "0";
- _filter = g_strdup_printf(
- "<filter xmlns:inkscape=\"http://www.inkscape.org/namespaces/inkscape\" color-interpolation-filters=\"sRGB\" height=\"1\" width=\"1\" y=\"0\" x=\"0\" inkscape:label=\"Chromolitho, custom\">\n"
- "<feComposite stdDeviation=\"1\" in=\"SourceGraphic\" in2=\"SourceGraphic\" operator=\"arithmetic\" k1=\"%s\" k2=\"1\" result=\"composite1\" />\n"
- "<feConvolveMatrix in=\"composite1\" kernelMatrix=\"0 250 0 250 %s 250 0 250 0 \" order=\"3 3\" stdDeviation=\"1\" result=\"convolve1\" />\n"
- "<feBlend in=\"%s\" in2=\"composite1\" mode=\"%s\" blend=\"normal\" stdDeviation=\"1\" result=\"blend1\" />\n"
- "<feGaussianBlur in=\"blend1\" stdDeviation=\"%s\" result=\"blur1\" />\n"
- "<feTurbulence baseFrequency=\"%s %s\" numOctaves=\"%s\" seed=\"%s\" type=\"fractalNoise\" result=\"turbulence1\" />\n"
- "<feColorMatrix values=\"1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 %s %s \" result=\"colormatrix1\" />\n"
- "<feColorMatrix type=\"saturate\" stdDeviation=\"3\" values=\"%s\" result=\"colormatrix2\" />\n"
- "<feBlend in=\"%s\" in2=\"blur1\" stdDeviation=\"1\" blend=\"normal\" mode=\"%s\" result=\"blend2\" />\n"
- "<feColorMatrix in=\"blend2\" type=\"saturate\" values=\"%s\" result=\"colormatrix3\" />\n"
- "<feComponentTransfer in=\"colormatrix3\" stdDeviation=\"2\" result=\"component1\">\n"
+ _filter = g_strdup_printf(
+ "<filter xmlns:inkscape=\"http://www.inkscape.org/namespaces/inkscape\" color-interpolation-filters=\"sRGB\" height=\"1\" width=\"1\" y=\"0\" x=\"0\" inkscape:label=\"Chromolitho, custom\">\n"
+ "<feComposite stdDeviation=\"1\" in=\"SourceGraphic\" in2=\"SourceGraphic\" operator=\"arithmetic\" k1=\"%s\" k2=\"1\" result=\"composite1\" />\n"
+ "<feConvolveMatrix in=\"composite1\" kernelMatrix=\"0 250 0 250 %s 250 0 250 0 \" order=\"3 3\" stdDeviation=\"1\" result=\"convolve1\" />\n"
+ "<feBlend in=\"%s\" in2=\"composite1\" mode=\"%s\" blend=\"normal\" stdDeviation=\"1\" result=\"blend1\" />\n"
+ "<feGaussianBlur in=\"blend1\" stdDeviation=\"%s\" result=\"blur1\" />\n"
+ "<feTurbulence baseFrequency=\"%s %s\" numOctaves=\"%s\" seed=\"%s\" type=\"fractalNoise\" result=\"turbulence1\" />\n"
+ "<feColorMatrix values=\"1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 %s %s \" result=\"colormatrix1\" />\n"
+ "<feColorMatrix type=\"saturate\" stdDeviation=\"3\" values=\"%s\" result=\"colormatrix2\" />\n"
+ "<feBlend in=\"%s\" in2=\"blur1\" stdDeviation=\"1\" blend=\"normal\" mode=\"%s\" result=\"blend2\" />\n"
+ "<feColorMatrix in=\"blend2\" type=\"saturate\" values=\"%s\" result=\"colormatrix3\" />\n"
+ "<feComponentTransfer in=\"colormatrix3\" stdDeviation=\"2\" result=\"component1\">\n"
"<feFuncR type=\"discrete\" tableValues=\"%s\" />\n"
"<feFuncG type=\"discrete\" tableValues=\"%s\" />\n"
"<feFuncB type=\"discrete\" tableValues=\"%s\" />\n"
- "</feComponentTransfer>\n"
- "<feColorMatrix values=\"1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 -0.2125 -0.7154 -0.0721 1 0 \" result=\"colormatrix4\" />\n"
- "<feColorMatrix in=\"%s\" values=\"1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 15 0 \" result=\"colormatrix5\" />\n"
- "<feComposite in2=\"SourceGraphic\" operator=\"in\" result=\"composite2\" />\n"
+ "</feComponentTransfer>\n"
+ "<feColorMatrix values=\"1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 -0.2125 -0.7154 -0.0721 1 0 \" result=\"colormatrix4\" />\n"
+ "<feColorMatrix in=\"%s\" values=\"1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 15 0 \" result=\"colormatrix5\" />\n"
+ "<feComposite in2=\"SourceGraphic\" operator=\"in\" result=\"composite2\" />\n"
"</filter>\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;
+ return _filter;
}; /* Chromolitho filter */
+/**
+ \brief Custom predefined Cross engraving filter.
+
+ Convert image to an engraving made of vertical and horizontal lines
+
+ Filter's parameters:
+ * Clean-up (1->500, default 30) -> convolve1 (kernelMatrix, central value -1001->-1500, default -1030)
+ * Dilatation (1.->50., default 1) -> color2 (n-1th value)
+ * Erosion (0.->50., default 0) -> color2 (nth value 0->-50)
+ * Strength (0.->10., default 0.5) -> composite2 (k2)
+ * Length (0.5->20, default 4) -> blur1 (stdDeviation x), blur2 (stdDeviation y)
+ * Transparent (boolean, default false) -> composite 4 (in, true->composite3, false->blend)
+*/
+class CrossEngraving : public Inkscape::Extension::Internal::Filter::Filter {
+protected:
+ virtual gchar const * get_filter_text (Inkscape::Extension::Extension * ext);
+
+public:
+ CrossEngraving ( ) : Filter() { };
+ virtual ~CrossEngraving ( ) { 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_("Cross engraving, custom") "</name>\n"
+ "<id>org.inkscape.effect.filter.CrossEngraving</id>\n"
+ "<param name=\"clean\" gui-text=\"" N_("Clean-up:") "\" type=\"int\" min=\"1\" max=\"500\">30</param>\n"
+ "<param name=\"dilat\" gui-text=\"" N_("Dilatation:") "\" type=\"float\" min=\"1\" max=\"50\">1</param>\n"
+ "<param name=\"erosion\" gui-text=\"" N_("Erosion:") "\" type=\"float\" min=\"0\" max=\"50\">0</param>\n"
+ "<param name=\"strength\" gui-text=\"" N_("Strength:") "\" type=\"float\" min=\"0.1\" max=\"10\">0.5</param>\n"
+ "<param name=\"length\" gui-text=\"" N_("Length:") "\" type=\"float\" min=\"0.5\" max=\"20\">4</param>\n"
+ "<param name=\"trans\" gui-text=\"" N_("Transparent") "\" type=\"boolean\" >false</param>\n"
+ "<effect>\n"
+ "<object-type>all</object-type>\n"
+ "<effects-menu>\n"
+ "<submenu name=\"" N_("Filters") "\">\n"
+ "<submenu name=\"" N_("Experimental") "\"/>\n"
+ "</submenu>\n"
+ "</effects-menu>\n"
+ "<menu-tip>" N_("Convert image to an engraving made of vertical and horizontal lines") "</menu-tip>\n"
+ "</effect>\n"
+ "</inkscape-extension>\n", new CrossEngraving());
+ };
+};
+
+gchar const *
+CrossEngraving::get_filter_text (Inkscape::Extension::Extension * ext)
+{
+ if (_filter != NULL) g_free((void *)_filter);
+
+ std::ostringstream clean;
+ std::ostringstream dilat;
+ std::ostringstream erosion;
+ std::ostringstream strength;
+ std::ostringstream length;
+ std::ostringstream trans;
+
+ clean << (-1000 - ext->get_param_int("clean"));
+ dilat << ext->get_param_float("dilat");
+ erosion << (- ext->get_param_float("erosion"));
+ strength << ext->get_param_float("strength");
+ length << ext->get_param_float("length");
+ if (ext->get_param_bool("trans"))
+ trans << "composite3";
+ else
+ trans << "blend";
+
+ _filter = g_strdup_printf(
+ "<filter xmlns:inkscape=\"http://www.inkscape.org/namespaces/inkscape\" color-interpolation-filters=\"sRGB\" height=\"1\" width=\"1\" y=\"0\" x=\"0\" inkscape:label=\"Cross engraving, custom\">\n"
+ "<feConvolveMatrix in=\"SourceGraphic\" targetY=\"1\" targetX=\"1\" kernelMatrix=\"0 250 0 250 %s 250 0 250 0 \" order=\"3 3\" result=\"convolve\" />\n"
+ "<feComposite in=\"convolve\" in2=\"convolve\" k1=\"1\" k2=\"1\" operator=\"arithmetic\" result=\"composite1\" />\n"
+ "<feColorMatrix in=\"composite1\" values=\"0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0.2125 -0.7154 -0.0721 1 0 \" result=\"color1\" />\n"
+ "<feColorMatrix in=\"color1\" values=\"1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 %s %s \" result=\"color2\" />\n"
+ "<feComposite in=\"color2\" in2=\"color2\" operator=\"arithmetic\" k2=\"%s\" result=\"composite2\" />\n"
+ "<feGaussianBlur in=\"composite2\" stdDeviation=\"%s 0.01\" result=\"blur1\" />\n"
+ "<feGaussianBlur in=\"composite2\" stdDeviation=\"0.01 %s\" result=\"blur2\" />\n"
+ "<feComposite in=\"blur2\" in2=\"blur1\" k3=\"1\" k2=\"1\" operator=\"arithmetic\" result=\"composite3\" />\n"
+ "<feFlood flood-color=\"rgb(255,255,255)\" flood-opacity=\"1\" result=\"flood\" />\n"
+ "<feBlend in=\"flood\" in2=\"composite3\" blend=\"normal\" mode=\"multiply\" result=\"blend\" />\n"
+ "<feComposite in=\"%s\" in2=\"SourceGraphic\" operator=\"in\" result=\"composite4\" />\n"
+ "</filter>\n", clean.str().c_str(), dilat.str().c_str(), erosion.str().c_str(), strength.str().c_str(), length.str().c_str(), length.str().c_str(), trans.str().c_str());
+
+ return _filter;
+}; /* CrossEngraving filter */
+
/**
\brief Custom predefined Drawing filter.
Convert images to duochrome drawings.
Filter's parameters:
- * Simplification (0.01->20, default 0.6) -> blur1 (stdDeviation)
- * Lightness (1->500, default 10) -> convolve1 (kernelMatrix, central value -1001->-1500, default -1010)
- * Fading (0.->6., default 0) -> composite1 (k4)
- * Smoothness (0.01->20, default 0.6) -> blur2 (stdDeviation)
- * Dilatation (1->50, default 6) -> color2 (n-1th value)
- * Erosion (0->50, default 3) -> color2 (nth value 0->-50)
+ * Simplification strength (0.01->20, default 0.6) -> blur1 (stdDeviation)
+ * Clean-up (1->500, default 10) -> convolve1 (kernelMatrix, central value -1001->-1500, default -1010)
+ * Erase (0.->6., default 0) -> composite1 (k4)
+ * Smoothness strength (0.01->20, default 0.6) -> blur2 (stdDeviation)
+ * Dilatation (1.->50., default 6) -> color2 (n-1th value)
+ * Erosion (0.->50., default 3) -> color2 (nth value 0->-50)
* Transluscent (boolean, default false) -> composite 8 (in, true->merge1, false->composite7)
- * Offset (-100->100, default 0) -> offset (val)
- * Blur (0.01->20., default 1.) -> blur3 (stdDeviation)
- * Blur spread (1->50, default 6) -> color4 (n-1th value)
- * Blur erosion (0->50, default 3) -> color4 (nth value 0->-50)
+ * Blur strength (0.01->20., default 1.) -> blur3 (stdDeviation)
+ * Blur dilatation (1.->50., default 6) -> color4 (n-1th value)
+ * Blur erosion (0.->50., default 3) -> color4 (nth value 0->-50)
* Stroke color (guint, default 64,64,64,255) -> flood2 (flood-color), composite3 (k2)
* Image on stroke (boolean, default false) -> composite2 (in="flood2" true-> in="SourceGraphic")
+ * Offset (-100->100, default 0) -> offset (val)
+
* Fill color (guint, default 200,200,200,255) -> flood3 (flood-opacity), composite5 (k2)
* Image on fill (boolean, default false) -> composite4 (in="flood3" true-> in="SourceGraphic")
class Drawing : public Inkscape::Extension::Internal::Filter::Filter {
protected:
- virtual gchar const * get_filter_text (Inkscape::Extension::Extension * ext);
+ virtual gchar const * get_filter_text (Inkscape::Extension::Extension * ext);
public:
- Drawing ( ) : Filter() { };
- virtual ~Drawing ( ) { 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_("Drawing, custom") "</name>\n"
- "<id>org.inkscape.effect.filter.Drawing</id>\n"
- "<param name=\"tab\" type=\"notebook\">\n"
- "<page name=\"optionstab\" _gui-text=\"Options\">\n"
- "<param name=\"simply\" gui-text=\"" N_("Simplification:") "\" type=\"float\" min=\"0.01\" max=\"20\">0.6</param>\n"
- "<param name=\"light\" gui-text=\"" N_("Lightness:") "\" type=\"int\" min=\"0\" max=\"500\">10</param>\n"
- "<param name=\"fade\" gui-text=\"" N_("Fading:") "\" type=\"float\" min=\"0\" max=\"60\">0</param>\n"
- "<param name=\"smooth\" gui-text=\"" N_("Smoothness:") "\" type=\"float\" min=\"0.01\" max=\"20\">0.6</param>\n"
- "<param name=\"dilat\" gui-text=\"" N_("Dilatation:") "\" type=\"float\" min=\"1\" max=\"50\">6</param>\n"
- "<param name=\"erosion\" gui-text=\"" N_("Erosion:") "\" type=\"float\" min=\"0\" max=\"50\">3</param>\n"
- "<param name=\"transluscent\" gui-text=\"" N_("Transluscent") "\" type=\"boolean\" >false</param>\n"
- "<_param name=\"blurheader\" type=\"groupheader\">Blur</_param>\n"
- "<param name=\"blur\" gui-text=\"" N_("Level:") "\" type=\"float\" min=\"0.01\" max=\"20\">1</param>\n"
- "<param name=\"bdilat\" gui-text=\"" N_("Dilatation:") "\" type=\"float\" min=\"1\" max=\"50\">6</param>\n"
- "<param name=\"berosion\" gui-text=\"" N_("Erosion:") "\" type=\"float\" min=\"0\" max=\"50\">3</param>\n"
- "</page>\n"
- "<page name=\"co11tab\" _gui-text=\"Fill color\">\n"
- "<param name=\"fcolor\" gui-text=\"" N_("Fill color") "\" type=\"color\">-1515870721</param>\n"
- "<param name=\"iof\" gui-text=\"" N_("Image on fill") "\" type=\"boolean\" >false</param>\n"
- "</page>\n"
- "<page name=\"co12tab\" _gui-text=\"Stroke color\">\n"
- "<param name=\"scolor\" gui-text=\"" N_("Stroke color") "\" type=\"color\">589505535</param>\n"
- "<param name=\"ios\" gui-text=\"" N_("Image on stroke") "\" type=\"boolean\" >false</param>\n"
- "<param name=\"offset\" gui-text=\"" N_("Offset:") "\" type=\"int\" min=\"-100\" max=\"100\">0</param>\n"
- "</page>\n"
- "</param>\n"
- "<effect>\n"
- "<object-type>all</object-type>\n"
- "<effects-menu>\n"
- "<submenu name=\"" N_("Filters") "\">\n"
- "<submenu name=\"" N_("Experimental") "\"/>\n"
- "</submenu>\n"
- "</effects-menu>\n"
- "<menu-tip>" N_("Convert images to duochrome drawings") "</menu-tip>\n"
- "</effect>\n"
- "</inkscape-extension>\n", new Drawing());
- };
+ Drawing ( ) : Filter() { };
+ virtual ~Drawing ( ) { 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_("Drawing, custom") "</name>\n"
+ "<id>org.inkscape.effect.filter.Drawing</id>\n"
+ "<param name=\"tab\" type=\"notebook\">\n"
+ "<page name=\"optionstab\" _gui-text=\"Options\">\n"
+ "<_param name=\"simplifyheader\" type=\"groupheader\">Simplify</_param>\n"
+ "<param name=\"simply\" gui-text=\"" N_("Strength:") "\" type=\"float\" min=\"0.01\" max=\"20\">0.6</param>\n"
+ "<param name=\"clean\" gui-text=\"" N_("Clean-up:") "\" type=\"int\" min=\"1\" max=\"500\">10</param>\n"
+ "<param name=\"erase\" gui-text=\"" N_("Erase:") "\" type=\"float\" min=\"0\" max=\"60\">0</param>\n"
+ "<param name=\"transluscent\" gui-text=\"" N_("Transluscent") "\" type=\"boolean\" >false</param>\n"
+ "<_param name=\"smoothheader\" type=\"groupheader\">Smoothness</_param>\n"
+ "<param name=\"smooth\" gui-text=\"" N_("Strength:") "\" type=\"float\" min=\"0.01\" max=\"20\">0.6</param>\n"
+ "<param name=\"dilat\" gui-text=\"" N_("Dilatation:") "\" type=\"float\" min=\"1\" max=\"50\">6</param>\n"
+ "<param name=\"erosion\" gui-text=\"" N_("Erosion:") "\" type=\"float\" min=\"0\" max=\"50\">3</param>\n"
+ "<_param name=\"meltheader\" type=\"groupheader\">Melt</_param>\n"
+ "<param name=\"blur\" gui-text=\"" N_("Level:") "\" type=\"float\" min=\"0.01\" max=\"20\">1</param>\n"
+ "<param name=\"bdilat\" gui-text=\"" N_("Dilatation:") "\" type=\"float\" min=\"1\" max=\"50\">6</param>\n"
+ "<param name=\"berosion\" gui-text=\"" N_("Erosion:") "\" type=\"float\" min=\"0\" max=\"50\">3</param>\n"
+ "</page>\n"
+ "<page name=\"co11tab\" _gui-text=\"Fill color\">\n"
+ "<param name=\"fcolor\" gui-text=\"" N_("Fill color") "\" type=\"color\">-1515870721</param>\n"
+ "<param name=\"iof\" gui-text=\"" N_("Image on fill") "\" type=\"boolean\" >false</param>\n"
+ "</page>\n"
+ "<page name=\"co12tab\" _gui-text=\"Stroke color\">\n"
+ "<param name=\"scolor\" gui-text=\"" N_("Stroke color") "\" type=\"color\">589505535</param>\n"
+ "<param name=\"ios\" gui-text=\"" N_("Image on stroke") "\" type=\"boolean\" >false</param>\n"
+ "<param name=\"offset\" gui-text=\"" N_("Offset:") "\" type=\"int\" min=\"-100\" max=\"100\">0</param>\n"
+ "</page>\n"
+ "</param>\n"
+ "<effect>\n"
+ "<object-type>all</object-type>\n"
+ "<effects-menu>\n"
+ "<submenu name=\"" N_("Filters") "\">\n"
+ "<submenu name=\"" N_("Experimental") "\"/>\n"
+ "</submenu>\n"
+ "</effects-menu>\n"
+ "<menu-tip>" N_("Convert images to duochrome drawings") "</menu-tip>\n"
+ "</effect>\n"
+ "</inkscape-extension>\n", new Drawing());
+ };
};
gchar const *
Drawing::get_filter_text (Inkscape::Extension::Extension * ext)
{
- if (_filter != NULL) g_free((void *)_filter);
+ if (_filter != NULL) g_free((void *)_filter);
std::ostringstream simply;
- std::ostringstream light;
- std::ostringstream fade;
+ std::ostringstream clean;
+ std::ostringstream erase;
std::ostringstream smooth;
std::ostringstream dilat;
std::ostringstream erosion;
std::ostringstream iof;
simply << ext->get_param_float("simply");
- light << (-1000 - ext->get_param_int("light"));
- fade << (ext->get_param_float("fade") / 10);
+ clean << (-1000 - ext->get_param_int("clean"));
+ erase << (ext->get_param_float("erase") / 10);
smooth << ext->get_param_float("smooth");
dilat << ext->get_param_float("dilat");
erosion << (- ext->get_param_float("erosion"));
else
ios << "flood2";
- _filter = g_strdup_printf(
- "<filter xmlns:inkscape=\"http://www.inkscape.org/namespaces/inkscape\" color-interpolation-filters=\"sRGB\" height=\"1\" width=\"1\" y=\"0\" x=\"0\" inkscape:label=\"Drawing, custom\">\n"
+ _filter = g_strdup_printf(
+ "<filter xmlns:inkscape=\"http://www.inkscape.org/namespaces/inkscape\" color-interpolation-filters=\"sRGB\" height=\"1\" width=\"1\" y=\"0\" x=\"0\" inkscape:label=\"Drawing, custom\">\n"
"<feGaussianBlur in=\"SourceGraphic\" stdDeviation=\"%s\" result=\"blur1\" />\n"
"<feConvolveMatrix in=\"blur1\" targetX=\"1\" targetY=\"1\" order=\"3 3\" kernelMatrix=\"0 250 0 250 %s 250 0 250 0 \" result=\"convolve1\" />\n"
"<feComposite in=\"convolve1\" in2=\"convolve1\" k1=\"1\" k2=\"1\" k4=\"%s\" operator=\"arithmetic\" stdDeviation=\"1\" result=\"composite1\" />\n"
"<feComposite in=\"merge1\" in2=\"merge1\" operator=\"over\" result=\"composite6\" />\n"
"<feComposite in=\"composite6\" in2=\"composite6\" operator=\"over\" result=\"composite7\" />\n"
"<feComposite in=\"%s\" in2=\"SourceGraphic\" operator=\"in\" result=\"composite8\" />\n"
- "</filter>\n", simply.str().c_str(), light.str().c_str(), fade.str().c_str(), smooth.str().c_str(), dilat.str().c_str(), erosion.str().c_str(), blur.str().c_str(), bdilat.str().c_str(), berosion.str().c_str(), stroker.str().c_str(), strokeg.str().c_str(), strokeb.str().c_str(), ios.str().c_str(), strokea.str().c_str(), offset.str().c_str(), offset.str().c_str(), fillr.str().c_str(), fillg.str().c_str(), fillb.str().c_str(), iof.str().c_str(), filla.str().c_str(), transluscent.str().c_str());
+ "</filter>\n", simply.str().c_str(), clean.str().c_str(), erase.str().c_str(), smooth.str().c_str(), dilat.str().c_str(), erosion.str().c_str(), blur.str().c_str(), bdilat.str().c_str(), berosion.str().c_str(), stroker.str().c_str(), strokeg.str().c_str(), strokeb.str().c_str(), ios.str().c_str(), strokea.str().c_str(), offset.str().c_str(), offset.str().c_str(), fillr.str().c_str(), fillg.str().c_str(), fillb.str().c_str(), iof.str().c_str(), filla.str().c_str(), transluscent.str().c_str());
- return _filter;
+ return _filter;
}; /* Drawing filter */
+
/**
- \brief Custom predefined Posterize filter.
+ \brief Custom predefined Neon draw filter.
+
+ Posterize and draw smooth lines around color shapes
+
+ Filter's parameters:
+ * Lines type (enum, default smooth) ->
+ smooth = component1 (type="table"), component2 (type="table"), composite1 (in2="blur2")
+ hard = component1 (type="discrete"), component2 (type="discrete"), composite1 (in2="component1")
+ * Simplify (0.01->20., default 1.5) -> blur1 (stdDeviation)
+ * Line width (0.01->20., default 1.5) -> blur2 (stdDeviation)
+ * Lightness (0.->10., default 5) -> composite1 (k3)
+ * Blend (enum [normal, multiply, screen], default normal) -> blend (mode)
+ * Dark mode (boolean, default false) -> composite1 (true: in2="component2")
+*/
+class NeonDraw : public Inkscape::Extension::Internal::Filter::Filter {
+protected:
+ virtual gchar const * get_filter_text (Inkscape::Extension::Extension * ext);
+
+public:
+ NeonDraw ( ) : Filter() { };
+ virtual ~NeonDraw ( ) { 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_("Neon draw, custom") "</name>\n"
+ "<id>org.inkscape.effect.filter.NeonDraw</id>\n"
+ "<param name=\"type\" gui-text=\"" N_("Line type:") "\" type=\"enum\">\n"
+ "<_item value=\"smooth\">Smoothed</_item>\n"
+ "<_item value=\"hard\">Contrasted</_item>\n"
+ "</param>\n"
+ "<param name=\"simply\" gui-text=\"" N_("Simplify:") "\" type=\"float\" min=\"0.01\" max=\"20.0\">1.5</param>\n"
+ "<param name=\"width\" gui-text=\"" N_("Line width:") "\" type=\"float\" min=\"0.01\" max=\"20.0\">1.5</param>\n"
+ "<param name=\"lightness\" gui-text=\"" N_("Lightness:") "\" type=\"float\" min=\"0.\" max=\"10.0\">5</param>\n"
+ "<param name=\"blend\" gui-text=\"" N_("Blend mode:") "\" type=\"enum\">\n"
+ "<_item value=\"normal\">Normal</_item>\n"
+ "<_item value=\"multiply\">Multiply</_item>\n"
+ "<_item value=\"screen\">Screen</_item>\n"
+ "</param>\n"
+ "<param name=\"dark\" gui-text=\"" N_("Dark mode") "\" type=\"boolean\" >false</param>\n"
+ "<effect>\n"
+ "<object-type>all</object-type>\n"
+ "<effects-menu>\n"
+ "<submenu name=\"" N_("Filters") "\">\n"
+ "<submenu name=\"" N_("Experimental") "\"/>\n"
+ "</submenu>\n"
+ "</effects-menu>\n"
+ "<menu-tip>" N_("Posterize and draw smooth lines around color shapes") "</menu-tip>\n"
+ "</effect>\n"
+ "</inkscape-extension>\n", new NeonDraw());
+ };
+};
+
+gchar const *
+NeonDraw::get_filter_text (Inkscape::Extension::Extension * ext)
+{
+ if (_filter != NULL) g_free((void *)_filter);
+
+ std::ostringstream blend;
+ std::ostringstream simply;
+ std::ostringstream width;
+ std::ostringstream lightness;
+ std::ostringstream type1;
+ std::ostringstream type2;
+ std::ostringstream dark;
+
+ const gchar *type = ext->get_param_enum("type");
+ if ((g_ascii_strcasecmp("smooth", type) == 0)) {
+ type1 << "table";
+ type2 << "table";
+ } else {
+ type1 << "discrete";
+ type2 << "discrete";
+ }
+
+ blend << ext->get_param_enum("blend");
+ simply << ext->get_param_float("simply");
+ width << ext->get_param_float("width");
+ lightness << ext->get_param_float("lightness");
+
+ if (ext->get_param_bool("dark"))
+ dark << "component2";
+ else if ((g_ascii_strcasecmp("smooth", type) == 0))
+ dark << "blur2";
+ else
+ dark << "component1";
+
+ _filter = g_strdup_printf(
+ "<filter xmlns:inkscape=\"http://www.inkscape.org/namespaces/inkscape\" color-interpolation-filters=\"sRGB\" height=\"1\" width=\"1\" y=\"0\" x=\"0\" inkscape:label=\"Neon draw, custom\">\n"
+ "<feBlend blend=\"normal\" mode=\"%s\" result=\"blend\" />\n"
+ "<feGaussianBlur in=\"blend\" stdDeviation=\"%s\" result=\"blur1\" />\n"
+ "<feComponentTransfer result=\"component1\">\n"
+ "<feFuncR type=\"%s\" tableValues=\"0 0.3 0.6 1 1\" />\n"
+ "<feFuncG type=\"%s\" tableValues=\"0 0.3 0.6 1 1\" />\n"
+ "<feFuncB type=\"%s\" tableValues=\"0 0.3 0.6 1 1\" />\n"
+ "</feComponentTransfer>\n"
+ "<feGaussianBlur in=\"component1\" stdDeviation=\"%s\" result=\"blur2\" />\n"
+ "<feComponentTransfer in=\"blur2\" result=\"component2\">\n"
+ "<feFuncR type=\"%s\" tableValues=\"0 1 0 1 0 1 0 1\" />\n"
+ "<feFuncG type=\"%s\" tableValues=\"0 1 0 1 0 1 0 1\" />\n"
+ "<feFuncB type=\"%s\" tableValues=\"0 1 0 1 0 1 0 1\" />\n"
+ "</feComponentTransfer>\n"
+ "<feComposite in=\"component2\" in2=\"%s\" k3=\"%s\" operator=\"arithmetic\" k2=\"1\" result=\"composite1\" />\n"
+ "<feComposite in=\"composite1\" in2=\"SourceGraphic\" operator=\"in\" result=\"composite2\" />\n"
+ "</filter>\n", blend.str().c_str(), simply.str().c_str(), type1.str().c_str(), type1.str().c_str(), type1.str().c_str(), width.str().c_str(), type2.str().c_str(), type2.str().c_str(), type2.str().c_str(), dark.str().c_str(), lightness.str().c_str());
+
+ return _filter;
+}; /* NeonDraw filter */
+
+/**
+ \brief Custom predefined Poster paint filter.
Poster and painting effects.
- Filter's parameters (not finished yet):
+ Filter's parameters:
* Effect type (enum, default "Normal") ->
Normal = feComponentTransfer
Dented = Normal + intermediate values
- * Blur (0.01->10., default 5.) -> blur3 (stdDeviation)
-
+ * Transfer type (enum, default "descrete") -> component (type)
+ * Levels (1->15, default 5) -> component (tableValues)
+ * Blend mode (enum, default "Lighten") -> blend (mode)
+ * Primary blur (0.01->100., default 4.) -> blur1 (stdDeviation)
+ * Secondary blur (0.01->100., default 0.5) -> blur2 (stdDeviation)
+ * Pre-saturation (0.->1., default 1.) -> color1 (values)
+ * Post-saturation (0.->1., default 1.) -> color2 (values)
+ * Simulate antialiasing (boolean, default false) -> blur3 (true->stdDeviation=0.5, false->stdDeviation=0.01)
*/
class Posterize : public Inkscape::Extension::Internal::Filter::Filter {
protected:
- virtual gchar const * get_filter_text (Inkscape::Extension::Extension * ext);
+ virtual gchar const * get_filter_text (Inkscape::Extension::Extension * ext);
public:
- Posterize ( ) : Filter() { };
- virtual ~Posterize ( ) { 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_("Poster and painting, custom") "</name>\n"
- "<id>org.inkscape.effect.filter.Posterize</id>\n"
- "<param name=\"type\" gui-text=\"" N_("Effect type:") "\" type=\"enum\">\n"
- "<_item value=\"normal\">Normal</_item>\n"
- "<_item value=\"dented\">Dented</_item>\n"
- "</param>\n"
- "<param name=\"table\" gui-text=\"" N_("Transfer type:") "\" type=\"enum\">\n"
- "<_item value=\"discrete\">Poster</_item>\n"
- "<_item value=\"table\">Painting</_item>\n"
- "</param>\n"
- "<param name=\"levels\" gui-text=\"" N_("Levels:") "\" type=\"int\" min=\"1\" max=\"15\">5</param>\n"
- "<param name=\"blend\" gui-text=\"" N_("Blend mode:") "\" type=\"enum\">\n"
- "<_item value=\"lighten\">Lighten</_item>\n"
- "<_item value=\"normal\">Normal</_item>\n"
- "<_item value=\"darken\">Darken</_item>\n"
- "</param>\n"
- "<param name=\"blur1\" gui-text=\"" N_("Primary blur:") "\" type=\"float\" min=\"0.01\" max=\"100.0\">4.0</param>\n"
- "<param name=\"blur2\" gui-text=\"" N_("Secondary blur:") "\" type=\"float\" min=\"0.01\" max=\"100.0\">0.5</param>\n"
- "<param name=\"presaturation\" gui-text=\"" N_("Pre-saturation:") "\" type=\"float\" min=\"0.00\" max=\"1.00\">1.00</param>\n"
- "<param name=\"postsaturation\" gui-text=\"" N_("Post-saturation:") "\" type=\"float\" min=\"0.00\" max=\"1.00\">1.00</param>\n"
- "<param name=\"antialiasing\" gui-text=\"" N_("Simulate antialiasing") "\" type=\"boolean\">false</param>\n"
- "<effect>\n"
- "<object-type>all</object-type>\n"
- "<effects-menu>\n"
- "<submenu name=\"" N_("Filters") "\">\n"
- "<submenu name=\"" N_("Experimental") "\"/>\n"
- "</submenu>\n"
- "</effects-menu>\n"
- "<menu-tip>" N_("Poster and painting effects") "</menu-tip>\n"
- "</effect>\n"
- "</inkscape-extension>\n", new Posterize());
- };
+ Posterize ( ) : Filter() { };
+ virtual ~Posterize ( ) { 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_("Poster paint, custom") "</name>\n"
+ "<id>org.inkscape.effect.filter.Posterize</id>\n"
+ "<param name=\"type\" gui-text=\"" N_("Effect type:") "\" type=\"enum\">\n"
+ "<_item value=\"normal\">Normal</_item>\n"
+ "<_item value=\"dented\">Dented</_item>\n"
+ "</param>\n"
+ "<param name=\"table\" gui-text=\"" N_("Transfer type:") "\" type=\"enum\">\n"
+ "<_item value=\"discrete\">Poster</_item>\n"
+ "<_item value=\"table\">Painting</_item>\n"
+ "</param>\n"
+ "<param name=\"levels\" gui-text=\"" N_("Levels:") "\" type=\"int\" min=\"1\" max=\"15\">5</param>\n"
+ "<param name=\"blend\" gui-text=\"" N_("Blend mode:") "\" type=\"enum\">\n"
+ "<_item value=\"lighten\">Lighten</_item>\n"
+ "<_item value=\"normal\">Normal</_item>\n"
+ "<_item value=\"darken\">Darken</_item>\n"
+ "</param>\n"
+ "<param name=\"blur1\" gui-text=\"" N_("Primary blur:") "\" type=\"float\" min=\"0.01\" max=\"100.0\">4.0</param>\n"
+ "<param name=\"blur2\" gui-text=\"" N_("Secondary blur:") "\" type=\"float\" min=\"0.01\" max=\"100.0\">0.5</param>\n"
+ "<param name=\"presaturation\" gui-text=\"" N_("Pre-saturation:") "\" type=\"float\" min=\"0.00\" max=\"1.00\">1.00</param>\n"
+ "<param name=\"postsaturation\" gui-text=\"" N_("Post-saturation:") "\" type=\"float\" min=\"0.00\" max=\"1.00\">1.00</param>\n"
+ "<param name=\"antialiasing\" gui-text=\"" N_("Simulate antialiasing") "\" type=\"boolean\">false</param>\n"
+ "<effect>\n"
+ "<object-type>all</object-type>\n"
+ "<effects-menu>\n"
+ "<submenu name=\"" N_("Filters") "\">\n"
+ "<submenu name=\"" N_("Experimental") "\"/>\n"
+ "</submenu>\n"
+ "</effects-menu>\n"
+ "<menu-tip>" N_("Poster and painting effects") "</menu-tip>\n"
+ "</effect>\n"
+ "</inkscape-extension>\n", new Posterize());
+ };
};
gchar const *
Posterize::get_filter_text (Inkscape::Extension::Extension * ext)
{
- if (_filter != NULL) g_free((void *)_filter);
+ if (_filter != NULL) g_free((void *)_filter);
std::ostringstream table;
std::ostringstream blendmode;
else
antialias << "0.01";
- _filter = g_strdup_printf(
- "<filter xmlns:inkscape=\"http://www.inkscape.org/namespaces/inkscape\" color-interpolation-filters=\"sRGB\" height=\"1\" width=\"1\" y=\"0\" x=\"0\" inkscape:label=\"Poster and painting, custom\">\n"
- "<feComposite result=\"Composite1\" operator=\"arithmetic\" k2=\"1\" />\n"
- "<feGaussianBlur stdDeviation=\"%s\" result=\"Gaussian1\" />\n"
- "<feGaussianBlur stdDeviation=\"%s\" in=\"Composite1\" />\n"
- "<feBlend in2=\"Gaussian1\" mode=\"%s\" />\n"
- "<feColorMatrix type=\"saturate\" values=\"%s\" />\n"
- "<feComponentTransfer>\n"
- "<feFuncR type=\"%s\" tableValues=\"%s\" />\n"
- "<feFuncG type=\"%s\" tableValues=\"%s\" />\n"
- "<feFuncB type=\"%s\" tableValues=\"%s\" />\n"
- "</feComponentTransfer>\n"
- "<feColorMatrix type=\"saturate\" values=\"%s\" />\n"
- "<feGaussianBlur stdDeviation=\"%s\" />\n"
- "<feComposite in2=\"SourceGraphic\" operator=\"in\" />\n"
+ _filter = g_strdup_printf(
+ "<filter xmlns:inkscape=\"http://www.inkscape.org/namespaces/inkscape\" color-interpolation-filters=\"sRGB\" height=\"1\" width=\"1\" y=\"0\" x=\"0\" inkscape:label=\"Poster paint, custom\">\n"
+ "<feComposite operator=\"arithmetic\" k2=\"1\" result=\"composite1\" />\n"
+ "<feGaussianBlur stdDeviation=\"%s\" result=\"blur1\" />\n"
+ "<feGaussianBlur in=\"composite1\" stdDeviation=\"%s\" result=\"blur2\" />\n"
+ "<feBlend in2=\"blur1\" mode=\"%s\" result=\"blend\"/>\n"
+ "<feColorMatrix type=\"saturate\" values=\"%s\" result=\"color1\" />\n"
+ "<feComponentTransfer result=\"component\">\n"
+ "<feFuncR type=\"%s\" tableValues=\"%s\" />\n"
+ "<feFuncG type=\"%s\" tableValues=\"%s\" />\n"
+ "<feFuncB type=\"%s\" tableValues=\"%s\" />\n"
+ "</feComponentTransfer>\n"
+ "<feColorMatrix type=\"saturate\" values=\"%s\" result=\"color2\" />\n"
+ "<feGaussianBlur stdDeviation=\"%s\" result=\"blur3\" />\n"
+ "<feComposite in2=\"SourceGraphic\" operator=\"in\" result=\"composite3\" />\n"
"</filter>\n", blur1.str().c_str(), blur2.str().c_str(), blendmode.str().c_str(), presat.str().c_str(), table.str().c_str(), transf.str().c_str(), table.str().c_str(), transf.str().c_str(), table.str().c_str(), transf.str().c_str(), postsat.str().c_str(), antialias.str().c_str());
- return _filter;
+ return _filter;
}; /* Posterize filter */
/**
- \brief Custom predefined PosterizeBasic filter.
+ \brief Custom predefined Posterize basic filter.
Simple posterizing effect
*/
class PosterizeBasic : public Inkscape::Extension::Internal::Filter::Filter {
protected:
- virtual gchar const * get_filter_text (Inkscape::Extension::Extension * ext);
+ virtual gchar const * get_filter_text (Inkscape::Extension::Extension * ext);
public:
- PosterizeBasic ( ) : Filter() { };
- virtual ~PosterizeBasic ( ) { 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_("Posterize basic, custom") "</name>\n"
- "<id>org.inkscape.effect.filter.PosterizeBasic</id>\n"
- "<param name=\"levels\" gui-text=\"" N_("Levels:") "\" type=\"int\" min=\"1\" max=\"20\">5</param>\n"
- "<param name=\"blur\" gui-text=\"" N_("Blur:") "\" type=\"float\" min=\"0.01\" max=\"20.0\">4.0</param>\n"
- "<effect>\n"
- "<object-type>all</object-type>\n"
- "<effects-menu>\n"
- "<submenu name=\"" N_("Filters") "\">\n"
- "<submenu name=\"" N_("Experimental") "\"/>\n"
- "</submenu>\n"
- "</effects-menu>\n"
- "<menu-tip>" N_("Simple posterizing effect") "</menu-tip>\n"
- "</effect>\n"
- "</inkscape-extension>\n", new PosterizeBasic());
- };
+ PosterizeBasic ( ) : Filter() { };
+ virtual ~PosterizeBasic ( ) { 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_("Posterize basic, custom") "</name>\n"
+ "<id>org.inkscape.effect.filter.PosterizeBasic</id>\n"
+ "<param name=\"levels\" gui-text=\"" N_("Levels:") "\" type=\"int\" min=\"1\" max=\"20\">5</param>\n"
+ "<param name=\"blur\" gui-text=\"" N_("Blur:") "\" type=\"float\" min=\"0.01\" max=\"20.0\">4.0</param>\n"
+ "<effect>\n"
+ "<object-type>all</object-type>\n"
+ "<effects-menu>\n"
+ "<submenu name=\"" N_("Filters") "\">\n"
+ "<submenu name=\"" N_("Experimental") "\"/>\n"
+ "</submenu>\n"
+ "</effects-menu>\n"
+ "<menu-tip>" N_("Simple posterizing effect") "</menu-tip>\n"
+ "</effect>\n"
+ "</inkscape-extension>\n", new PosterizeBasic());
+ };
};
gchar const *
PosterizeBasic::get_filter_text (Inkscape::Extension::Extension * ext)
{
- if (_filter != NULL) g_free((void *)_filter);
+ if (_filter != NULL) g_free((void *)_filter);
std::ostringstream blur;
std::ostringstream transf;
}
transf << " 1";
- _filter = g_strdup_printf(
- "<filter xmlns:inkscape=\"http://www.inkscape.org/namespaces/inkscape\" color-interpolation-filters=\"sRGB\" height=\"1\" width=\"1\" y=\"0\" x=\"0\" inkscape:label=\"Posterize basic, custom\">\n"
- "<feGaussianBlur stdDeviation=\"%s\" result=\"blur1\" />\n"
- "<feComponentTransfer stdDeviation=\"2\" in=\"blur1\" result=\"component1\">\n"
- "<feFuncR type=\"discrete\" tableValues=\"%s\" />\n"
- "<feFuncG type=\"discrete\" tableValues=\"%s\" />\n"
- "<feFuncB type=\"discrete\" tableValues=\"%s\" />\n"
- "</feComponentTransfer>\n"
- "<feComposite in=\"component1\" in2=\"SourceGraphic\" operator=\"in\" />\n"
+ _filter = g_strdup_printf(
+ "<filter xmlns:inkscape=\"http://www.inkscape.org/namespaces/inkscape\" color-interpolation-filters=\"sRGB\" height=\"1\" width=\"1\" y=\"0\" x=\"0\" inkscape:label=\"Posterize basic, custom\">\n"
+ "<feGaussianBlur stdDeviation=\"%s\" result=\"blur1\" />\n"
+ "<feComponentTransfer stdDeviation=\"2\" in=\"blur1\" result=\"component1\">\n"
+ "<feFuncR type=\"discrete\" tableValues=\"%s\" />\n"
+ "<feFuncG type=\"discrete\" tableValues=\"%s\" />\n"
+ "<feFuncB type=\"discrete\" tableValues=\"%s\" />\n"
+ "</feComponentTransfer>\n"
+ "<feComposite in=\"component1\" in2=\"SourceGraphic\" operator=\"in\" />\n"
"</filter>\n", blur.str().c_str(), transf.str().c_str(), transf.str().c_str(), transf.str().c_str());
- return _filter;
+ return _filter;
}; /* PosterizeBasic filter */
}; /* namespace Filter */
}; /* namespace Extension */
}; /* namespace Inkscape */
-/* Change the 'COLOR' below to be your file name */
+/* Change the 'EXPERIMENTAL' below to be your file name */
#endif /* __INKSCAPE_EXTENSION_INTERNAL_FILTER_EXPERIMENTAL_H__ */
diff --git a/src/extension/internal/filter/filter-all.cpp b/src/extension/internal/filter/filter-all.cpp
index 8467254724058e8350559a1541030f05303c099e..7383b793a1e599d3d5cdccf3eb25e566ac9c1957 100755 (executable)
#include "color.h"
#include "drop-shadow.h"
#include "morphology.h"
+#include "shadows.h"
#include "snow.h"
#include "experimental.h"
// ABCs
Blur::init();
+ CleanEdges::init();
+ ColorShift::init();
DiffuseLight::init();
+ Feather::init();
+ MatteJelly::init();
+ NoiseFill::init();
+ Outline::init();
Roughen::init();
+ Silhouette::init();
SpecularLight::init();
// Color
Colorize::init();
Duochrome::init();
+ Electrize::init();
Quadritone::init();
Solarize::init();
Tritone::init();
// TDB
Chromolitho::init();
+ CrossEngraving::init();
Drawing::init();
+ NeonDraw::init();
Posterize::init();
PosterizeBasic::init();
diff --git a/src/extension/internal/filter/morphology.h b/src/extension/internal/filter/morphology.h
index 8e00b47bee34d43674fe8f9c7ae696f8c8801808..5584ce5065e77a15de2bd973ac8d355255f7b09d 100644 (file)
/* Change the 'MORPHOLOGY' above to be your file name */
/*
- * Copyright (C) 2010 Authors:
+ * Copyright (C) 2011 Authors:
* Ivan Louette (filters)
* Nicolas Dufour (UI) <nicoduf@yahoo.fr>
*
class Crosssmooth : public Inkscape::Extension::Internal::Filter::Filter {
protected:
- virtual gchar const * get_filter_text (Inkscape::Extension::Extension * ext);
+ virtual gchar const * get_filter_text (Inkscape::Extension::Extension * ext);
public:
- Crosssmooth ( ) : Filter() { };
- virtual ~Crosssmooth ( ) { 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_("Cross-smooth, custom (morphology)") "</name>\n"
- "<id>org.inkscape.effect.filter.crosssmooth</id>\n"
- "<param name=\"type\" gui-text=\"" N_("Type:") "\" type=\"enum\">\n"
- "<_item value=\"edges\">Smooth edges</_item>\n"
- "<_item value=\"all\">Smooth all</_item>\n"
- "</param>\n"
- "<param name=\"blur\" gui-text=\"" N_("Blur:") "\" type=\"float\" min=\"0.01\" max=\"10\">5</param>\n"
- "<effect>\n"
- "<object-type>all</object-type>\n"
- "<effects-menu>\n"
- "<submenu name=\"" N_("Filters") "\">\n"
- "<submenu name=\"" N_("Experimental") "\"/>\n"
- "</submenu>\n"
- "</effects-menu>\n"
- "<menu-tip>" N_("Smooth edges and angles of shapes") "</menu-tip>\n"
- "</effect>\n"
- "</inkscape-extension>\n", new Crosssmooth());
- };
+ Crosssmooth ( ) : Filter() { };
+ virtual ~Crosssmooth ( ) { 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_("Cross-smooth, custom (Morphology)") "</name>\n"
+ "<id>org.inkscape.effect.filter.crosssmooth</id>\n"
+ "<param name=\"type\" gui-text=\"" N_("Type:") "\" type=\"enum\">\n"
+ "<_item value=\"edges\">Smooth edges</_item>\n"
+ "<_item value=\"all\">Smooth all</_item>\n"
+ "</param>\n"
+ "<param name=\"blur\" gui-text=\"" N_("Blur:") "\" type=\"float\" min=\"0.01\" max=\"10\">5</param>\n"
+ "<effect>\n"
+ "<object-type>all</object-type>\n"
+ "<effects-menu>\n"
+ "<submenu name=\"" N_("Filters") "\">\n"
+ "<submenu name=\"" N_("Experimental") "\"/>\n"
+ "</submenu>\n"
+ "</effects-menu>\n"
+ "<menu-tip>" N_("Smooth edges and angles of shapes") "</menu-tip>\n"
+ "</effect>\n"
+ "</inkscape-extension>\n", new Crosssmooth());
+ };
};
gchar const *
Crosssmooth::get_filter_text (Inkscape::Extension::Extension * ext)
{
- if (_filter != NULL) g_free((void *)_filter);
+ if (_filter != NULL) g_free((void *)_filter);
std::ostringstream blur;
std::ostringstream c1in;
c1in << "SourceGraphic";
}
- _filter = g_strdup_printf(
- "<filter xmlns:inkscape=\"http://www.inkscape.org/namespaces/inkscape\" color-interpolation-filters=\"sRGB\" inkscape:label=\"Cross-smooth, custom\">\n"
- "<feGaussianBlur stdDeviation=\"%s\" result=\"blur\" />\n"
- "<feComposite in=\"%s\" in2=\"blur\" operator=\"atop\" result=\"composite1\" />\n"
- "<feComposite in2=\"composite1\" operator=\"in\" result=\"composite2\" />\n"
- "<feComposite in2=\"composite2\" operator=\"in\" result=\"composite3\" />\n"
- "<feColorMatrix values=\"1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 20 -10 \" result=\"colormatrix\" />\n"
+ _filter = g_strdup_printf(
+ "<filter xmlns:inkscape=\"http://www.inkscape.org/namespaces/inkscape\" color-interpolation-filters=\"sRGB\" inkscape:label=\"Cross-smooth, custom\">\n"
+ "<feGaussianBlur stdDeviation=\"%s\" result=\"blur\" />\n"
+ "<feComposite in=\"%s\" in2=\"blur\" operator=\"atop\" result=\"composite1\" />\n"
+ "<feComposite in2=\"composite1\" operator=\"in\" result=\"composite2\" />\n"
+ "<feComposite in2=\"composite2\" operator=\"in\" result=\"composite3\" />\n"
+ "<feColorMatrix values=\"1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 20 -10 \" result=\"colormatrix\" />\n"
"</filter>\n", blur.str().c_str(), c1in.str().c_str());
- return _filter;
+ return _filter;
}; /* Crosssmooth filter */
}; /* namespace Filter */
}; /* namespace Extension */
}; /* namespace Inkscape */
-/* Change the 'COLOR' below to be your file name */
+/* Change the 'MORPHOLOGY' below to be your file name */
#endif /* __INKSCAPE_EXTENSION_INTERNAL_FILTER_MORPHOLOGY_H__ */
diff --git a/src/extension/internal/filter/shadows.h b/src/extension/internal/filter/shadows.h
--- /dev/null
@@ -0,0 +1,111 @@
+#ifndef __INKSCAPE_EXTENSION_INTERNAL_FILTER_SHADOWS_H__
+#define __INKSCAPE_EXTENSION_INTERNAL_FILTER_SHADOWS_H__
+/* Change the 'SHADOWS' above to be your file name */
+
+/*
+ * Copyright (C) 2011 Authors:
+ * Ivan Louette (filters)
+ * Nicolas Dufour (UI) <nicoduf@yahoo.fr>
+ *
+ * Color filters
+ * Drop shadow
+ *
+ * Released under GNU GPL, read the file 'COPYING' for more information
+ */
+/* ^^^ Change the copyright to be you and your e-mail address ^^^ */
+
+#include "filter.h"
+
+#include "extension/internal/clear-n_.h"
+#include "extension/system.h"
+#include "extension/extension.h"
+
+namespace Inkscape {
+namespace Extension {
+namespace Internal {
+namespace Filter {
+
+/**
+ \brief Custom predefined Drop shadow filter.
+
+ Colorizable Drop shadow.
+
+ Filter's parameters:
+ * Blur radius (0.->200., default 3) -> blur (stdDeviation)
+ * Horizontal offset (-50.->50., default 6.0) -> offset (dx)
+ * Vertical offset (-50.->50., default 6.0) -> offset (dy)
+ * Color (guint, default 0,0,0,127) -> flood (flood-opacity, flood-color)
+*/
+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, custom (Shadows and Glows)") "</name>\n"
+ "<id>org.inkscape.effect.filter.ColorDropShadow</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\">127</param>\n"
+ "<effect>\n"
+ "<object-type>all</object-type>\n"
+ "<effects-menu>\n"
+ "<submenu name=\"" N_("Filters") "\">\n"
+ "<submenu name=\"" N_("Experimental") "\"/>\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, custom\">\n"
+ "<feFlood flood-opacity=\"%s\" flood-color=\"rgb(%s,%s,%s)\" result=\"flood\" />\n"
+ "<feComposite in=\"flood\" in2=\"SourceGraphic\" operator=\"in\" result=\"composite1\" />\n"
+ "<feGaussianBlur in=\"composite1\" stdDeviation=\"%s\" result=\"blur\" />\n"
+ "<feOffset dx=\"%s\" dy=\"%s\" result=\"offset\" />\n"
+ "<feComposite in=\"SourceGraphic\" in2=\"offset\" operator=\"over\" result=\"composite2\" />\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 */
+}; /* namespace Inkscape */
+
+/* Change the 'SHADOWS' below to be your file name */
+#endif /* __INKSCAPE_EXTENSION_INTERNAL_FILTER_SHADOWS_H__ */