summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorNicolas Dufour <nicoduf@yahoo.fr>2012-09-28 11:14:02 +0000
committerJazzyNico <nicoduf@yahoo.fr>2012-09-28 11:14:02 +0000
commit56d3279ce493f79922fbc7200f670237fcf45ff2 (patch)
tree30f5eb5418c73b4c201d0d4ed84b5127e75f1ed9 /src
parentTranslations. Latvian translation update by Jānis Eisaks. (diff)
downloadinkscape-56d3279ce493f79922fbc7200f670237fcf45ff2.tar.gz
inkscape-56d3279ce493f79922fbc7200f670237fcf45ff2.zip
Filters. Some filters fixes, renaming and simplifications.
(bzr r11713)
Diffstat (limited to 'src')
-rw-r--r--src/extension/internal/filter/color.h63
-rw-r--r--src/extension/internal/filter/paint.h52
2 files changed, 53 insertions, 62 deletions
diff --git a/src/extension/internal/filter/color.h b/src/extension/internal/filter/color.h
index b6b194c8b..22b77a8cc 100644
--- a/src/extension/internal/filter/color.h
+++ b/src/extension/internal/filter/color.h
@@ -615,9 +615,8 @@ Duochrome::get_filter_text (Inkscape::Extension::Extension * ext)
Filter's parameters:
* Channel (enum, all colors, default Red) -> colormatrix (values)
- * Background blend (enum, all blend modes, default Multiply) -> blend (mode)
+ * Background blend (enum, Normal, Multiply, Screen, default Normal) -> blend (mode)
* Channel to alpha (boolean, default false) -> colormatrix (values)
- * Invert (boolean, default false) -> colormatrix (values)
*/
class ExtractChannel : public Inkscape::Extension::Internal::Filter::Filter {
@@ -637,16 +636,16 @@ public:
"<_item value=\"r\">" N_("Red") "</_item>\n"
"<_item value=\"g\">" N_("Green") "</_item>\n"
"<_item value=\"b\">" N_("Blue") "</_item>\n"
+ "<_item value=\"c\">" N_("Cyan") "</_item>\n"
+ "<_item value=\"m\">" N_("Majenta") "</_item>\n"
+ "<_item value=\"y\">" N_("Yellow") "</_item>\n"
"</param>\n"
"<param name=\"blend\" gui-text=\"" N_("Background blend mode:") "\" type=\"enum\">\n"
"<_item value=\"multiply\">" N_("Multiply") "</_item>\n"
"<_item value=\"normal\">" N_("Normal") "</_item>\n"
"<_item value=\"screen\">" N_("Screen") "</_item>\n"
- "<_item value=\"darken\">" N_("Darken") "</_item>\n"
- "<_item value=\"lighten\">" N_("Lighten") "</_item>\n"
"</param>\n"
"<param name=\"alpha\" gui-text=\"" N_("Channel to alpha") "\" type=\"boolean\">false</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"
@@ -667,45 +666,45 @@ ExtractChannel::get_filter_text (Inkscape::Extension::Extension * ext)
std::ostringstream blend;
std::ostringstream colors;
- std::ostringstream alpha;
- std::ostringstream invert;
blend << ext->get_param_enum("blend");
const gchar *channel = ext->get_param_enum("source");
if (ext->get_param_bool("alpha")) {
- colors << "0 0 0 0 0 0 0 0 0 0 0 0 0 0 0";
- } else if ((g_ascii_strcasecmp("r", channel) == 0)) {
- colors << "0 0 0 0 1 0 0 0 0 0 0 0 0 0 0";
- } else if ((g_ascii_strcasecmp("g", channel) == 0)) {
- colors << "0 0 0 0 0 0 0 0 0 1 0 0 0 0 0";
- } else {
- colors << "0 0 0 0 0 0 0 0 0 0 0 0 0 0 1";
- }
-
- if (ext->get_param_bool("invert")) {
if ((g_ascii_strcasecmp("r", channel) == 0)) {
- alpha << "-1 0 0 1";
+ colors << "0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0";
} else if ((g_ascii_strcasecmp("g", channel) == 0)) {
- alpha << "0 -1 0 1";
+ colors << "0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0";
+ } else if ((g_ascii_strcasecmp("b", channel) == 0)) {
+ colors << "0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0";
+ } else if ((g_ascii_strcasecmp("c", channel) == 0)) {
+ colors << "0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -1 0 0 1 0";
+ } else if ((g_ascii_strcasecmp("m", channel) == 0)) {
+ colors << "0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -1 0 1 0";
} else {
- alpha << "0 0 -1 1";
+ colors << "0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -1 1 0";
}
} else {
if ((g_ascii_strcasecmp("r", channel) == 0)) {
- alpha << "1 0 0 0";
+ colors << "0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0";
} else if ((g_ascii_strcasecmp("g", channel) == 0)) {
- alpha << "0 1 0 0";
+ colors << "0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 1 0 0 0";
+ } else if ((g_ascii_strcasecmp("b", channel) == 0)) {
+ colors << "0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 1 0 0";
+ } else if ((g_ascii_strcasecmp("c", channel) == 0)) {
+ colors << "0 0 0 0 0 0 0 0 0 1 0 0 0 0 1 -1 0 0 1 0";
+ } else if ((g_ascii_strcasecmp("m", channel) == 0)) {
+ colors << "0 0 0 0 1 0 0 0 0 0 0 0 0 0 1 0 -1 0 1 0";
} else {
- alpha << "0 0 1 0";
+ colors << "0 0 0 0 1 0 0 0 0 1 0 0 0 0 0 0 0 -1 1 0";
}
}
_filter = g_strdup_printf(
"<filter xmlns:inkscape=\"http://www.inkscape.org/namespaces/inkscape\" style=\"color-interpolation-filters:sRGB;\" inkscape:label=\"Extract Channel\">\n"
- "<feColorMatrix in=\"SourceGraphic\" values=\"%s %s %s 0 \" result=\"colormatrix\" />\n"
+ "<feColorMatrix in=\"SourceGraphic\" values=\"%s 0 \" result=\"colormatrix\" />\n"
"<feBlend in2=\"BackgroundImage\" mode=\"%s\" result=\"blend\" />\n"
- "</filter>\n", colors.str().c_str(), alpha.str().c_str(), invert.str().c_str(), blend.str().c_str() );
+ "</filter>\n", colors.str().c_str(), blend.str().c_str() );
return _filter;
}; /* ExtractChannel filter */
@@ -1157,9 +1156,9 @@ LightnessContrast::get_filter_text (Inkscape::Extension::Extension * ext)
}; /* Lightness-Contrast filter */
/**
- \brief Custom predefined Nudge filter.
+ \brief Custom predefined Nudge RGB filter.
- Nudge separately RGB channels and blend them to different types of backgrounds
+ Nudge RGB channels separately and blend them to different types of backgrounds
Filter's parameters:
Offsets
@@ -1193,8 +1192,8 @@ public:
static void init (void) {
Inkscape::Extension::build_from_mem(
"<inkscape-extension xmlns=\"" INKSCAPE_EXTENSION_URI "\">\n"
- "<name>" N_("Nudge") "</name>\n"
- "<id>org.inkscape.effect.filter.Nudge</id>\n"
+ "<name>" N_("Nudge RGB") "</name>\n"
+ "<id>org.inkscape.effect.filter.NudgeRGB</id>\n"
"<param name=\"tab\" type=\"notebook\">\n"
"<page name=\"offsettab\" _gui-text=\"Offset\">\n"
"<_param name=\"redOffset\" type=\"description\" appearance=\"header\">" N_("Red offset") "</_param>\n"
@@ -1232,7 +1231,7 @@ public:
"<submenu name=\"" N_("Color") "\"/>\n"
"</submenu>\n"
"</effects-menu>\n"
- "<menu-tip>" N_("Nudge separately RGB channels and blend them to different types of backgrounds") "</menu-tip>\n"
+ "<menu-tip>" N_("Nudge RGB channels separately and blend them to different types of backgrounds") "</menu-tip>\n"
"</effect>\n"
"</inkscape-extension>\n", new Nudge());
};
@@ -1277,7 +1276,7 @@ Nudge::get_filter_text (Inkscape::Extension::Extension * ext)
a << (color & 0xff) / 255.0F;
_filter = g_strdup_printf(
- "<filter xmlns:inkscape=\"http://www.inkscape.org/namespaces/inkscape\" style=\"color-interpolation-filters:sRGB;\" inkscape:label=\"Nudge\">\n"
+ "<filter xmlns:inkscape=\"http://www.inkscape.org/namespaces/inkscape\" style=\"color-interpolation-filters:sRGB;\" inkscape:label=\"Nudge RGB\">\n"
"<feFlood flood-opacity=\"%s\" flood-color=\"rgb(%s,%s,%s)\" result=\"flood\" />\n"
"<feColorMatrix in=\"SourceGraphic\" values=\"0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 \" result=\"colormatrix1\" />\n"
"<feOffset dy=\"%s\" dx=\"%s\" result=\"offset1\" />\n"
@@ -1297,7 +1296,7 @@ Nudge::get_filter_text (Inkscape::Extension::Extension * ext)
return _filter;
-}; /* Nudge filter */
+}; /* Nudge RGB filter */
/**
\brief Custom predefined Quadritone filter.
diff --git a/src/extension/internal/filter/paint.h b/src/extension/internal/filter/paint.h
index debdd7d79..dcc51c815 100644
--- a/src/extension/internal/filter/paint.h
+++ b/src/extension/internal/filter/paint.h
@@ -3,7 +3,7 @@
/* Change the 'PAINT' above to be your file name */
/*
- * Copyright (C) 2011 Authors:
+ * Copyright (C) 2012 Authors:
* Ivan Louette (filters)
* Nicolas Dufour (UI) <nicoduf@yahoo.fr>
*
@@ -563,13 +563,13 @@ Electrize::get_filter_text (Inkscape::Extension::Extension * ext)
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 0.5) -> composite1 (k3)
+ smooth = component2 (type="table"), composite1 (in2="blur2")
+ hard = component2 (type="discrete"), composite1 (in2="component1")
+ * Simplify (0.01->20., default 3) -> blur1 (stdDeviation)
+ * Line width (0.01->20., default 3) -> blur2 (stdDeviation)
+ * Lightness (0.->10., default 1) -> composite1 (k2)
* Blend (enum [normal, multiply, screen], default normal) -> blend (mode)
- * Dark mode (boolean, default false) -> composite1 (true: in2="component2")
+ * Dark mode (boolean, default false) -> composite2 (true: in2="component2")
*/
class NeonDraw : public Inkscape::Extension::Internal::Filter::Filter {
protected:
@@ -588,15 +588,14 @@ public:
"<_item value=\"table\">" N_("Smoothed") "</_item>\n"
"<_item value=\"discrete\">" N_("Contrasted") "</_item>\n"
"</param>\n"
- "<param name=\"simply\" gui-text=\"" N_("Simplify:") "\" type=\"float\" appearance=\"full\" precision=\"2\" min=\"0.01\" max=\"20.00\">1.5</param>\n"
- "<param name=\"width\" gui-text=\"" N_("Line width:") "\" type=\"float\" appearance=\"full\" precision=\"2\" min=\"0.01\" max=\"20.00\">1.5</param>\n"
- "<param name=\"lightness\" gui-text=\"" N_("Lightness:") "\" type=\"float\" appearance=\"full\" precision=\"2\" min=\"0.00\" max=\"10.00\">0.5</param>\n"
+ "<param name=\"simply\" gui-text=\"" N_("Simplify:") "\" type=\"float\" appearance=\"full\" precision=\"2\" min=\"0.01\" max=\"20.00\">3</param>\n"
+ "<param name=\"width\" gui-text=\"" N_("Line width:") "\" type=\"float\" appearance=\"full\" precision=\"2\" min=\"0.01\" max=\"20.00\">3</param>\n"
+ "<param name=\"lightness\" gui-text=\"" N_("Lightness:") "\" type=\"float\" appearance=\"full\" precision=\"2\" min=\"0.00\" max=\"10.00\">1</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"
@@ -620,7 +619,6 @@ NeonDraw::get_filter_text (Inkscape::Extension::Extension * ext)
std::ostringstream width;
std::ostringstream lightness;
std::ostringstream type;
- std::ostringstream dark;
type << ext->get_param_enum("type");
blend << ext->get_param_enum("blend");
@@ -628,33 +626,27 @@ NeonDraw::get_filter_text (Inkscape::Extension::Extension * ext)
width << ext->get_param_float("width");
lightness << ext->get_param_float("lightness");
- const gchar *typestr = ext->get_param_enum("type");
- if (ext->get_param_bool("dark")) {
- dark << "component2";
- } else if ((g_ascii_strcasecmp("table", typestr) == 0)) {
- dark << "blur2";
- } else {
- dark << "component1";
- }
-
_filter = g_strdup_printf(
"<filter xmlns:inkscape=\"http://www.inkscape.org/namespaces/inkscape\" style=\"color-interpolation-filters:sRGB;\" inkscape:label=\"Neon Draw\">\n"
"<feBlend mode=\"%s\" result=\"blend\" />\n"
"<feGaussianBlur in=\"blend\" stdDeviation=\"%s\" result=\"blur1\" />\n"
+ "<feColorMatrix values=\"1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 50 0\" result=\"color1\" />\n"
"<feComponentTransfer result=\"component1\">\n"
- "<feFuncR type=\"discrete\" tableValues=\"0 0.3 0.6 1 1\" />\n"
- "<feFuncG type=\"discrete\" tableValues=\"0 0.3 0.6 1 1\" />\n"
- "<feFuncB type=\"discrete\" tableValues=\"0 0.3 0.6 1 1\" />\n"
+ "<feFuncR type=\"discrete\" tableValues=\"0 0.3 0.3 0.3 0.3 0.6 0.6 0.6 0.6 1 1\" />\n"
+ "<feFuncG type=\"discrete\" tableValues=\"0 0.3 0.3 0.3 0.3 0.6 0.6 0.6 0.6 1 1\" />\n"
+ "<feFuncB type=\"discrete\" tableValues=\"0 0.3 0.3 0.3 0.3 0.6 0.6 0.6 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"
+ "<feColorMatrix values=\"1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 50 0\" result=\"color2\" />\n"
+ "<feComponentTransfer in=\"color2\" result=\"component2\">\n"
+ "<feFuncR type=\"%s\" tableValues=\"0 1 1 1 0 0 0 1 1 1 0 0 0 1 1 1 0 0 0 1\" />\n"
+ "<feFuncG type=\"%s\" tableValues=\"0 1 1 1 0 0 0 1 1 1 0 0 0 1 1 1 0 0 0 1\" />\n"
+ "<feFuncB type=\"%s\" tableValues=\"0 1 1 1 0 0 0 1 1 1 0 0 0 1 1 1 0 0 0 1\" />\n"
"</feComponentTransfer>\n"
- "<feComposite in=\"component2\" in2=\"%s\" k3=\"%s\" operator=\"arithmetic\" k2=\"1\" result=\"composite1\" />\n"
+ "<feComposite in=\"component2\" in2=\"blur2\" k3=\"%s\" operator=\"arithmetic\" k2=\"1\" result=\"composite1\" />\n"
+ "<feColorMatrix values=\"-1 0 0 0 1 0 -1 0 0 0 1 0 -1 0 1 -0.21 -0.72 -0.07 2 0\" result=\"color3\" />\n"
"<feComposite in=\"composite1\" in2=\"SourceGraphic\" operator=\"in\" result=\"composite2\" />\n"
- "</filter>\n", blend.str().c_str(), simply.str().c_str(), width.str().c_str(), type.str().c_str(), type.str().c_str(), type.str().c_str(), dark.str().c_str(), lightness.str().c_str());
+ "</filter>\n", blend.str().c_str(), simply.str().c_str(), width.str().c_str(), type.str().c_str(), type.str().c_str(), type.str().c_str(), lightness.str().c_str());
return _filter;
}; /* NeonDraw filter */