summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorNicolas Dufour <nicoduf@yahoo.fr>2011-07-20 16:06:49 +0000
committerJazzyNico <nicoduf@yahoo.fr>2011-07-20 16:06:49 +0000
commit6ff4ed36cd6ff0aff0b8fff0040794e9a0fdcc96 (patch)
tree09d5670c3485ae57c63b4e4f3e930d37f032cc20 /src
parentmemory leak fix (diff)
downloadinkscape-6ff4ed36cd6ff0aff0b8fff0040794e9a0fdcc96.tar.gz
inkscape-6ff4ed36cd6ff0aff0b8fff0040794e9a0fdcc96.zip
Filters. Custom predefined filters update.
Translations. inkscape.pot and fr.po update. (bzr r10482)
Diffstat (limited to 'src')
-rwxr-xr-xsrc/extension/internal/filter/color.h60
-rwxr-xr-xsrc/extension/internal/filter/experimental.h24
-rw-r--r--src/extension/internal/filter/image.h6
-rw-r--r--src/extension/internal/filter/shadows.h38
4 files changed, 84 insertions, 44 deletions
diff --git a/src/extension/internal/filter/color.h b/src/extension/internal/filter/color.h
index 27b1fdda9..53734bee5 100755
--- a/src/extension/internal/filter/color.h
+++ b/src/extension/internal/filter/color.h
@@ -39,9 +39,10 @@ namespace Filter {
Brightness filter.
Filter's parameters:
- * Strength (-10.->10., default 1) -> colorMatrix (RVB entries)
- * Vibration (-10.->10., default 0.) -> colorMatrix (6 other entries)
+ * Brightness (1.->10., default 2.) -> colorMatrix (RVB entries)
+ * Over-saturation (0.->10., default 0.5) -> colorMatrix (6 other entries)
* Lightness (-10.->10., default 0.) -> colorMatrix (last column)
+ * Inverted (boolean, default false) -> colorMatrix
Matrix:
St Vi Vi 0 Li
@@ -62,9 +63,10 @@ public:
"<inkscape-extension xmlns=\"" INKSCAPE_EXTENSION_URI "\">\n"
"<name>" N_("Brightness, custom (Color)") "</name>\n"
"<id>org.inkscape.effect.filter.Brightness</id>\n"
- "<param name=\"strength\" gui-text=\"" N_("Strength:") "\" type=\"float\" appearance=\"full\" precision=\"2\" min=\"-10.00\" max=\"10.00\">1</param>\n"
- "<param name=\"vibration\" gui-text=\"" N_("Vibration:") "\" type=\"float\" appearance=\"full\" precision=\"2\" min=\"-10.00\" max=\"10.00\">0</param>\n"
+ "<param name=\"brightness\" gui-text=\"" N_("Brightness:") "\" type=\"float\" appearance=\"full\" precision=\"2\" min=\"1\" max=\"10.00\">2</param>\n"
+ "<param name=\"sat\" gui-text=\"" N_("Over-saturation:") "\" type=\"float\" appearance=\"full\" precision=\"2\" min=\"0.0\" max=\"10.00\">0.5</param>\n"
"<param name=\"lightness\" gui-text=\"" N_("Lightness:") "\" type=\"float\" appearance=\"full\" precision=\"2\" min=\"-10.00\" max=\"10.00\">0</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"
@@ -83,21 +85,29 @@ Brightness::get_filter_text (Inkscape::Extension::Extension * ext)
{
if (_filter != NULL) g_free((void *)_filter);
- std::ostringstream strength;
- std::ostringstream vibration;
+ std::ostringstream brightness;
+ std::ostringstream sat;
std::ostringstream lightness;
- strength << ext->get_param_float("strength");
- vibration << ext->get_param_float("vibration");
- lightness << ext->get_param_float("lightness");
+ if (ext->get_param_bool("invert")) {
+ brightness << -ext->get_param_float("brightness");
+ sat << 1 + ext->get_param_float("sat");
+ lightness << -ext->get_param_float("lightness");
+ } else {
+ brightness << ext->get_param_float("brightness");
+ sat << -ext->get_param_float("sat");
+ lightness << ext->get_param_float("lightness");
+ }
+
+
_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=\"Brightness, custom\">\n"
"<feColorMatrix values=\"%s %s %s 0 %s %s %s %s 0 %s %s %s %s 0 %s 0 0 0 1 0 \" />\n"
- "</filter>\n", strength.str().c_str(), vibration.str().c_str(), vibration.str().c_str(),
- lightness.str().c_str(), vibration.str().c_str(), strength.str().c_str(),
- vibration.str().c_str(), lightness.str().c_str(), vibration.str().c_str(),
- vibration.str().c_str(), strength.str().c_str(), lightness.str().c_str());
+ "</filter>\n", brightness.str().c_str(), sat.str().c_str(), sat.str().c_str(),
+ lightness.str().c_str(), sat.str().c_str(), brightness.str().c_str(),
+ sat.str().c_str(), lightness.str().c_str(), sat.str().c_str(),
+ sat.str().c_str(), brightness.str().c_str(), lightness.str().c_str());
return _filter;
}; /* Brightness filter */
@@ -192,11 +202,12 @@ Colorize::get_filter_text (Inkscape::Extension::Extension * ext)
nlight << ext->get_param_float("nlight");
blend1 << ext->get_param_enum("blend1");
blend2 << ext->get_param_enum("blend2");
- if (ext->get_param_bool("duotone"))
+ if (ext->get_param_bool("duotone")) {
duotone << "0";
- else
+ } 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"
@@ -297,17 +308,17 @@ Duochrome::get_filter_text (Inkscape::Extension::Extension * ext)
b2 << ((color2 >> 8) & 0xff);
fluo << fluorescence;
- if((g_ascii_strcasecmp("full", swaptype) == 0)) {
+ if ((g_ascii_strcasecmp("full", swaptype) == 0)) {
swap1 << "in";
swap2 << "out";
a1 << (color1 & 0xff) / 255.0F;
a2 << (color2 & 0xff) / 255.0F;
- } else if((g_ascii_strcasecmp("color", swaptype) == 0)) {
+ } else if ((g_ascii_strcasecmp("color", swaptype) == 0)) {
swap1 << "in";
swap2 << "out";
a1 << (color2 & 0xff) / 255.0F;
a2 << (color1 & 0xff) / 255.0F;
- } else if((g_ascii_strcasecmp("alpha", swaptype) == 0)) {
+ } else if ((g_ascii_strcasecmp("alpha", swaptype) == 0)) {
swap1 << "out";
swap2 << "in";
a1 << (color2 & 0xff) / 255.0F;
@@ -395,8 +406,9 @@ Electrize::get_filter_text (Inkscape::Extension::Extension * ext)
// 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"))
+ if (ext->get_param_bool("invert")) {
val = 1;
+ }
values << val;
for ( int step = 1 ; step <= levels ; step++ ) {
if (val == 1) {
@@ -721,7 +733,7 @@ Solarize::get_filter_text (Inkscape::Extension::Extension * ext)
rotate << ext->get_param_int("rotate");
const gchar *type = ext->get_param_enum("type");
- if((g_ascii_strcasecmp("solarize", type) == 0)) {
+ if ((g_ascii_strcasecmp("solarize", type) == 0)) {
// Solarize
blend1 << "darken";
blend2 << "screen";
@@ -854,21 +866,21 @@ Tritone::get_filter_text (Inkscape::Extension::Extension * ext)
glight << ext->get_param_float("glight");
const gchar *type = ext->get_param_enum("type");
- if((g_ascii_strcasecmp("enhue", type) == 0)) {
+ if ((g_ascii_strcasecmp("enhue", type) == 0)) {
// Enhance hue
c1in << "qminp";
c1in2 << "flood";
c2in << "SourceGraphic";
c2in2 << "blend6";
b6in2 << "qminpc";
- } else if((g_ascii_strcasecmp("rad", type) == 0)) {
+ } else if ((g_ascii_strcasecmp("rad", type) == 0)) {
// Radiation
c1in << "qminp";
c1in2 << "flood";
c2in << "blend6";
c2in2 << "qminpc";
b6in2 << "SourceGraphic";
- } else if((g_ascii_strcasecmp("htb", type) == 0)) {
+ } else if ((g_ascii_strcasecmp("htb", type) == 0)) {
// Hue to background
c1in << "qminp";
c1in2 << "BackgroundImage";
diff --git a/src/extension/internal/filter/experimental.h b/src/extension/internal/filter/experimental.h
index 96485ad97..84b0eea3d 100755
--- a/src/extension/internal/filter/experimental.h
+++ b/src/extension/internal/filter/experimental.h
@@ -580,7 +580,7 @@ NeonDraw::get_filter_text (Inkscape::Extension::Extension * ext)
Normal = feComponentTransfer
Dented = Normal + intermediate values
* Transfer type (enum, default "descrete") -> component (type)
- * Levels (1->15, default 5) -> component (tableValues)
+ * Levels (0->15, default 5) -> component (tableValues)
* Blend mode (enum, default "Lighten") -> blend (mode)
* Primary simplify (0.01->100., default 4.) -> blur1 (stdDeviation)
* Secondary simplify (0.01->100., default 0.5) -> blur2 (stdDeviation)
@@ -609,11 +609,13 @@ public:
"<_item value=\"discrete\">Poster</_item>\n"
"<_item value=\"table\">Painting</_item>\n"
"</param>\n"
- "<param name=\"levels\" gui-text=\"" N_("Levels:") "\" type=\"int\" appearance=\"full\" min=\"1\" max=\"15\">5</param>\n"
+ "<param name=\"levels\" gui-text=\"" N_("Levels:") "\" type=\"int\" appearance=\"full\" min=\"0\" 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"
+ "<_item value=\"multiply\">Multiply</_item>\n"
+ "<_item value=\"screen\">Screen</_item>\n"
"</param>\n"
"<param name=\"blur1\" gui-text=\"" N_("Simplify (primary):") "\" type=\"float\" appearance=\"full\" precision=\"2\" min=\"0.01\" max=\"100.00\">4.0</param>\n"
"<param name=\"blur2\" gui-text=\"" N_("Simplify (secondary):") "\" type=\"float\" appearance=\"full\" precision=\"2\" min=\"0.01\" max=\"100.00\">0.5</param>\n"
@@ -659,11 +661,19 @@ Posterize::get_filter_text (Inkscape::Extension::Extension * ext)
int levels = ext->get_param_int("levels") + 1;
const gchar *effecttype = ext->get_param_enum("type");
float val = 0.0;
- for ( int step = 1 ; step <= levels ; step++ ) {
- val = (float) step / levels;
- transf << " " << val;
- if((g_ascii_strcasecmp("dented", effecttype) == 0)) {
- transf << " " << (val - ((float) 1 / (3 * levels))) << " " << (val + ((float) 1 / (2 * levels)));
+ if (levels == 1) {
+ if ((g_ascii_strcasecmp("dented", effecttype) == 0)) {
+ transf << " 1 0 1";
+ } else {
+ transf << " 1";
+ }
+ } else {
+ for ( int step = 1 ; step <= levels ; step++ ) {
+ val = (float) step / levels;
+ transf << " " << val;
+ if ((g_ascii_strcasecmp("dented", effecttype) == 0)) {
+ transf << " " << (val - ((float) 1 / (3 * levels))) << " " << (val + ((float) 1 / (2 * levels)));
+ }
}
}
transf << " 1";
diff --git a/src/extension/internal/filter/image.h b/src/extension/internal/filter/image.h
index 926c56a4d..f459466d5 100644
--- a/src/extension/internal/filter/image.h
+++ b/src/extension/internal/filter/image.h
@@ -53,7 +53,7 @@ public:
"<_item value=\"vertical\">" N_("Vertical lines") "</_item>\n"
"<_item value=\"horizontal\">" N_("Horizontal lines") "</_item>\n"
"</param>\n"
- "<param name=\"level\" gui-text=\"" N_("Level:") "\" type=\"float\" appearance=\"full\" min=\"0.01\" max=\"10.0\">1.0</param>\n"
+ "<param name=\"level\" gui-text=\"" N_("Level:") "\" type=\"float\" appearance=\"full\" min=\"0.1\" max=\"100.0\">1.0</param>\n"
"<param name=\"inverted\" gui-text=\"" N_("Invert colors") "\" type=\"boolean\" >false</param>\n"
"<effect>\n"
"<object-type>all</object-type>\n"
@@ -80,14 +80,14 @@ EdgeDetect::get_filter_text (Inkscape::Extension::Extension * ext)
const gchar *type = ext->get_param_enum("type");
- level << ext->get_param_float("level");
+ level << 1 / ext->get_param_float("level");
if ((g_ascii_strcasecmp("vertical", type) == 0)) {
matrix << "0 0 0 1 -2 1 0 0 0";
} else if ((g_ascii_strcasecmp("horizontal", type) == 0)) {
matrix << "0 1 0 0 -2 0 0 1 0";
} else {
- matrix << "1 1 1 1 -8 1 1 1 1";
+ matrix << "0 1 0 1 -4 1 0 1 0";
}
if (ext->get_param_bool("inverted")) {
diff --git a/src/extension/internal/filter/shadows.h b/src/extension/internal/filter/shadows.h
index bfc6cace6..3c964da34 100644
--- a/src/extension/internal/filter/shadows.h
+++ b/src/extension/internal/filter/shadows.h
@@ -37,7 +37,8 @@ namespace Filter {
* Blur type (enum, default outer) ->
outer = composite1 (operator="in"), composite2 (operator="over", in1="SourceGraphic", in2="offset")
inner = composite1 (operator="out"), composite2 (operator="atop", in1="offset", in2="SourceGraphic")
- cutout = composite1 (operator="in"), composite2 (operator="out", in1="offset", in2="SourceGraphic")
+ innercut = composite1 (operator="in"), composite2 (operator="out", in1="offset", in2="SourceGraphic")
+ outercut = composite1 (operator="out"), composite2 (operator="in", in1="SourceGraphic", in2="offset")
* Color (guint, default 0,0,0,127) -> flood (flood-opacity, flood-color)
* Use object's color (boolean, default false) -> composite1 (in1, in2)
*/
@@ -62,7 +63,8 @@ public:
"<param name=\"type\" gui-text=\"" N_("Blur type:") "\" type=\"enum\" >\n"
"<_item value=\"outer\">" N_("Outer") "</_item>\n"
"<_item value=\"inner\">" N_("Inner") "</_item>\n"
- "<_item value=\"cutout\">" N_("Cutout") "</_item>\n"
+ "<_item value=\"innercut\">" N_("Inner cutout") "</_item>\n"
+ "<_item value=\"outercut\">" N_("Outer cutout") "</_item>\n"
"</param>\n"
"</page>\n"
"<page name=\"coltab\" _gui-text=\"" N_("Blur color") "\">\n"
@@ -113,14 +115,26 @@ ColorizableDropShadow::get_filter_text (Inkscape::Extension::Extension * ext)
g << ((color >> 16) & 0xff);
b << ((color >> 8) & 0xff);
- if (ext->get_param_bool("objcolor")) {
- comp1in1 << "SourceGraphic";
- comp1in2 << "flood";
+ // Select object or user-defined color
+ if ((g_ascii_strcasecmp("outercut", type) == 0)) {
+ if (ext->get_param_bool("objcolor")) {
+ comp2in1 << "SourceGraphic";
+ comp2in2 << "offset";
+ } else {
+ comp2in1 << "offset";
+ comp2in2 << "SourceGraphic";
+ }
} else {
- comp1in1 << "flood";
- comp1in2 << "SourceGraphic";
+ if (ext->get_param_bool("objcolor")) {
+ comp1in1 << "SourceGraphic";
+ comp1in2 << "flood";
+ } else {
+ comp1in1 << "flood";
+ comp1in2 << "SourceGraphic";
+ }
}
+ // Shadow mode
if ((g_ascii_strcasecmp("outer", type) == 0)) {
comp1op << "in";
comp2op << "over";
@@ -131,14 +145,18 @@ ColorizableDropShadow::get_filter_text (Inkscape::Extension::Extension * ext)
comp2op << "atop";
comp2in1 << "offset";
comp2in2 << "SourceGraphic";
- } else {
+ } else if ((g_ascii_strcasecmp("innercut", type) == 0)) {
comp1op << "in";
comp2op << "out";
comp2in1 << "offset";
comp2in2 << "SourceGraphic";
+ } else { //outercut
+ comp1op << "out";
+ comp1in1 << "flood";
+ comp1in2 << "SourceGraphic";
+ comp2op << "in";
}
-
-
+
_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"