* Ivan Louette (filters)
* Nicolas Dufour (UI) <nicoduf@yahoo.fr>
*
+ * Color filters
+ * Colorize
+ * Duochrome
+ * Quadritone
+ * Solarize
+ * Tritone
+ *
* Released under GNU GPL, read the file 'COPYING' for more information
*/
/* ^^^ Change the copyright to be you and your e-mail address ^^^ */
namespace Internal {
namespace Filter {
-/* Custom predefined Colorize filter
+/**
+ \brief Custom predefined Colorize filter.
+
+ Blend image or object with a flood color.
-Filter's parameters:
- * Harsh light (0.-10., default 0) -> composite1 (k1)
- * Normal light (0.-10., default 1) -> composite2 (k2)
+ Filter's parameters:
+ * Harsh light (0.->10., default 0) -> composite1 (k1)
+ * Normal light (0.->10., default 1) -> composite2 (k2)
* Duotone (boolean, default false) -> colormatrix1 (values="0")
* Filtered greys (boolean, default false) -> colormatrix2 (values="0")
* Blend mode 1 (enum, default Multiply) -> blend1 (mode)
static void init (void) {
Inkscape::Extension::build_from_mem(
"<inkscape-extension xmlns=\"" INKSCAPE_EXTENSION_URI "\">\n"
- "<name>" N_("Colorize, custom -EXP-") "</name>\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=\"fg\" gui-text=\"" N_("Filtered greys") "\" 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"
std::ostringstream hlight;
std::ostringstream nlight;
std::ostringstream duotone;
- std::ostringstream fg;
std::ostringstream blend1;
std::ostringstream blend2;
duotone << "0";
else
duotone << "1";
- if (ext->get_param_bool("fg"))
- fg << "0";
- else
- fg << "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 -EXP-\">\n"
+ "<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=\"%s\" type=\"saturate\" result=\"colormatrix2\" />\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(), fg.str().c_str());
+ "</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;
}; /* Colorize filter */
-/* Custom predefined Duochrome filter
+/**
+ \brief Custom predefined Duochrome filter.
+
+ Convert luminance values to a duochrome palette.
-Filter's parameters:
- * Fluorescence level (0.-2., default 0) -> composite4 (k2)
+ Filter's parameters:
+ * Fluorescence level (0.->2., default 0) -> composite4 (k2)
* Swap (enum, default "No swap") -> composite1, composite2 (operator)
* Color 1 (guint, default 1364325887) -> flood1 (flood-opacity, flood-color)
* Color 2 (guint, default -65281) -> flood2 (flood-opacity, flood-color)
static void init (void) {
Inkscape::Extension::build_from_mem(
"<inkscape-extension xmlns=\"" INKSCAPE_EXTENSION_URI "\">\n"
- "<name>" N_("Duochrome, custom -EXP-") "</name>\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=\"color\">Color only</_item>\n"
"<_item value=\"alpha\">Alpha only</_item>\n"
"</param>\n"
- "<_param name=\"header1\" type=\"groupheader\">Color 1</_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"
- "<_param name=\"header2\" type=\"groupheader\">Color 2</_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"
}
_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 -EXP-\">\n"
+ "<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"
}; /* Duochrome filter */
-/* Custom predefined Quadritone filter
+/**
+ \brief Custom predefined Quadritone filter.
+
+ Replace hue by two colors.
-Filter's parameters:
- * Hue distribution (0-360, default 280) -> colormatrix1 (values)
- * Colors (0-360, default 100) -> colormatrix3 (values)
+ Filter's parameters:
+ * Hue distribution (0->360, default 280) -> colormatrix1 (values)
+ * Colors (0->360, default 100) -> colormatrix3 (values)
* Blend mode 1 (enum, default Normal) -> blend1 (mode)
- * Over-saturation (0.-1., default 0) -> composite1 (k2)
+ * Over-saturation (0.->1., default 0) -> composite1 (k2)
* Blend mode 2 (enum, default Normal) -> blend2 (mode)
*/
static void init (void) {
Inkscape::Extension::build_from_mem(
"<inkscape-extension xmlns=\"" INKSCAPE_EXTENSION_URI "\">\n"
- "<name>" N_("Quadritone fantasy, custom -EXP-") "</name>\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"
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 -EXP-\">\n"
+ "<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"
}; /* Quadritone filter */
-/* Custom predefined Solarize filter
+/**
+ \brief Custom predefined Solarize filter.
+
+ Classic photographic solarization effect.
-Filter's parameters:
+ Filter's parameters:
* Type (enum, default "Solarize") ->
Solarize = blend1 (mode="darken"), blend2 (mode="screen")
Moonarize = blend1 (mode="lighten"), blend2 (mode="multiply") [No other access to the blend modes]
- * Hue rotation (0-360, default 0) -> colormatrix1 (values)
+ * Hue rotation (0->360, default 0) -> colormatrix1 (values)
*/
+
class Solarize : public Inkscape::Extension::Internal::Filter::Filter {
protected:
virtual gchar const * get_filter_text (Inkscape::Extension::Extension * ext);
static void init (void) {
Inkscape::Extension::build_from_mem(
"<inkscape-extension xmlns=\"" INKSCAPE_EXTENSION_URI "\">\n"
- "<name>" N_("Solarize, custom -EXP-") "</name>\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"
}
_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 -EXP-\">\n"
+ "<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"
}; /* Solarize filter */
-/* Custom predefined Tritone filter
+/**
+ \brief Custom predefined Tritone filter.
+
+ Create a custom tritone palette with additional glow, blend modes and hue moving.
-Filter's parameters:
+ Filter's parameters:
* Option (enum, default Normal) ->
Normal = composite1 (in="qminp", in2="flood"), composite2 (in="p", in2="blend6"), blend6 (in2="qminpc")
Enhance hue = Normal + composite2 (in="SourceGraphic")
Radiation = Normal + blend6 (in2="SourceGraphic") composite2 (in="blend6", in2="qminpc")
Hue to background = Normal + composite1 (in2="BackgroundImage") [a template with an activated background is needed, or colors become black]
- * Hue distribution (0-360, default 0) -> colormatrix1 (values)
+ * Hue distribution (0->360, default 0) -> colormatrix1 (values)
* Colors (guint, default -73203457) -> flood (flood-opacity, flood-color)
* Global blend (enum, default Lighten) -> blend5 (mode) [Multiply, Screen, Darken, Lighten only!]
- * Glow (0.01-10., default 0.01) -> feGaussianBlur (stdDeviation)
+ * Glow (0.01->10., default 0.01) -> feGaussianBlur (stdDeviation)
* Glow & blend (enum, default Normal) -> blend6 (mode) [Normal, Multiply and Darken only!]
- * Local light (0.-10., default 0) -> composite2 (k1)
- * Global light (0.-10., default 1) -> composite2 (k3) [k2 must be fixed to 1].
+ * Local light (0.->10., default 0) -> composite2 (k1)
+ * Global light (0.->10., default 1) -> composite2 (k3) [k2 must be fixed to 1].
*/
class Tritone : public Inkscape::Extension::Internal::Filter::Filter {
static void init (void) {
Inkscape::Extension::build_from_mem(
"<inkscape-extension xmlns=\"" INKSCAPE_EXTENSION_URI "\">\n"
- "<name>" N_("Tritone, custom -EXP-") "</name>\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=\"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"
"<param name=\"globalblend\" gui-text=\"" N_("Global blend:") "\" type=\"enum\">\n"
"<_item value=\"lighten\">Lighten</_item>\n"
"<_item value=\"screen\">Screen</_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"
}
_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 -EXP-\">\n"
+ "<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"