summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorNicolas Dufour <nicoduf@yahoo.fr>2011-08-23 17:56:40 +0000
committerJazzyNico <nicoduf@yahoo.fr>2011-08-23 17:56:40 +0000
commit073995c772424b27f3e63a38e0cc5f3bc800d1d0 (patch)
treedbf705305bed109ba2ec7f2f9418010401f41d17 /src
parentFilters. More filters clean-up. (diff)
downloadinkscape-073995c772424b27f3e63a38e0cc5f3bc800d1d0.tar.gz
inkscape-073995c772424b27f3e63a38e0cc5f3bc800d1d0.zip
Filters. Filters clean-up again.
Filters. Outline CPF improvements. Translations. Translation template and file list, French translation update. (bzr r10575)
Diffstat (limited to 'src')
-rw-r--r--src/extension/internal/filter/color.h22
-rwxr-xr-xsrc/extension/internal/filter/filter-all.cpp2
-rw-r--r--src/extension/internal/filter/morphology.h94
3 files changed, 71 insertions, 47 deletions
diff --git a/src/extension/internal/filter/color.h b/src/extension/internal/filter/color.h
index a026e686a..9cc009b3a 100644
--- a/src/extension/internal/filter/color.h
+++ b/src/extension/internal/filter/color.h
@@ -18,7 +18,7 @@
* Fade to black or white
* Greyscale
* Invert
- * Lightness
+ * Lighting
* Lightness-contrast
* Nudge
* Quadritone
@@ -1017,7 +1017,7 @@ Invert::get_filter_text (Inkscape::Extension::Extension * ext)
}; /* Invert filter */
/**
- \brief Custom predefined Lightness filter.
+ \brief Custom predefined Lighting filter.
Modify lights and shadows separately.
@@ -1026,19 +1026,19 @@ Invert::get_filter_text (Inkscape::Extension::Extension * ext)
* Shadow (0.->20., default 1.) -> component (exponent)
* Offset (-1.->1., default 0.) -> component (offset)
*/
-class Lightness : public Inkscape::Extension::Internal::Filter::Filter {
+class Lighting : public Inkscape::Extension::Internal::Filter::Filter {
protected:
virtual gchar const * get_filter_text (Inkscape::Extension::Extension * ext);
public:
- Lightness ( ) : Filter() { };
- virtual ~Lightness ( ) { if (_filter != NULL) g_free((void *)_filter); return; }
+ Lighting ( ) : Filter() { };
+ virtual ~Lighting ( ) { 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_("Lightness") "</name>\n"
- "<id>org.inkscape.effect.filter.Lightness</id>\n"
+ "<name>" N_("Lighting") "</name>\n"
+ "<id>org.inkscape.effect.filter.Lighting</id>\n"
"<param name=\"amplitude\" gui-text=\"" N_("Lights:") "\" type=\"float\" appearance=\"full\" precision=\"2\" min=\"0.00\" max=\"20.00\">1</param>\n"
"<param name=\"exponent\" gui-text=\"" N_("Shadows:") "\" type=\"float\" appearance=\"full\" precision=\"2\" min=\"0.00\" max=\"20.00\">1</param>\n"
"<param name=\"offset\" gui-text=\"" N_("Offset:") "\" type=\"float\" appearance=\"full\" precision=\"2\" min=\"-1.00\" max=\"1.00\">0</param>\n"
@@ -1051,12 +1051,12 @@ public:
"</effects-menu>\n"
"<menu-tip>" N_("Modify lights and shadows separately") "</menu-tip>\n"
"</effect>\n"
- "</inkscape-extension>\n", new Lightness());
+ "</inkscape-extension>\n", new Lighting());
};
};
gchar const *
-Lightness::get_filter_text (Inkscape::Extension::Extension * ext)
+Lighting::get_filter_text (Inkscape::Extension::Extension * ext)
{
if (_filter != NULL) g_free((void *)_filter);
@@ -1069,7 +1069,7 @@ Lightness::get_filter_text (Inkscape::Extension::Extension * ext)
offset << ext->get_param_float("offset");
_filter = g_strdup_printf(
- "<filter xmlns:inkscape=\"http://www.inkscape.org/namespaces/inkscape\" style=\"color-interpolation-filters:sRGB;\" height=\"1\" width=\"1\" y=\"0\" x=\"0\" inkscape:label=\"Lightness\">\n"
+ "<filter xmlns:inkscape=\"http://www.inkscape.org/namespaces/inkscape\" style=\"color-interpolation-filters:sRGB;\" height=\"1\" width=\"1\" y=\"0\" x=\"0\" inkscape:label=\"Lighting\">\n"
"<feComponentTransfer in=\"blur\" result=\"component\" >\n"
"<feFuncR type=\"gamma\" amplitude=\"%s\" exponent=\"%s\" offset=\"%s\" />\n"
"<feFuncG type=\"gamma\" amplitude=\"%s\" exponent=\"%s\" offset=\"%s\" />\n"
@@ -1080,7 +1080,7 @@ Lightness::get_filter_text (Inkscape::Extension::Extension * ext)
amplitude.str().c_str(), exponent.str().c_str(), offset.str().c_str() );
return _filter;
-}; /* Lightness filter */
+}; /* Lighting filter */
/**
\brief Custom predefined Lightness-Contrast filter.
diff --git a/src/extension/internal/filter/filter-all.cpp b/src/extension/internal/filter/filter-all.cpp
index 17c22c0cb..b5d47ae45 100755
--- a/src/extension/internal/filter/filter-all.cpp
+++ b/src/extension/internal/filter/filter-all.cpp
@@ -62,7 +62,7 @@ Filter::filters_all (void )
FadeToBW::init();
Greyscale::init();
Invert::init();
- Lightness::init();
+ Lighting::init();
LightnessContrast::init();
Nudge::init();
Quadritone::init();
diff --git a/src/extension/internal/filter/morphology.h b/src/extension/internal/filter/morphology.h
index 4b69f564b..c57cb3618 100644
--- a/src/extension/internal/filter/morphology.h
+++ b/src/extension/internal/filter/morphology.h
@@ -105,20 +105,21 @@ Crosssmooth::get_filter_text (Inkscape::Extension::Extension * ext)
Adds a colorizable outline
Filter's parameters:
- * Stroke type (enum, default single)
- * single -> composite4 (in="composite3"), composite2 (operator="atop")
- * double -> composite4 (in="SourceGraphic"), composite2 (operator="xor")
+ * Fill image (boolean, default false) -> true: composite2 (in="SourceGraphic"), false: composite2 (in="blur2")
+ * Hide image (boolean, default false) -> true: composite4 (in="composite3"), false: composite4 (in="SourceGraphic")
+ * Stroke type (enum, default over) -> composite2 (operator)
* Stroke position (enum, default inside)
* inside -> composite1 (operator="out", in="SourceGraphic", in2="blur1")
* outside -> composite1 (operator="out", in="blur1", in2="SourceGraphic")
* overlayed -> composite1 (operator="xor", in="blur1", in2="SourceGraphic")
- * Width 1(0.01->20., default 4) -> blur1 (stdDeviation)
- * Width 2 (0.01->20., default 0.5) -> blur2 (stdDeviation)
+ * Width 1 (0.01->20., default 4) -> blur1 (stdDeviation)
* Dilatation 1 (1.->100., default 100) -> colormatrix1 (n-1th value)
* Erosion 1 (0.->100., default 1) -> colormatrix1 (nth value 0->-100)
+ * Width 2 (0.01->20., default 0.5) -> blur2 (stdDeviation)
* Dilatation 2 (1.->100., default 50) -> colormatrix2 (n-1th value)
* Erosion 2 (0.->100., default 5) -> colormatrix2 (nth value 0->-100)
- * Color (guint, default 200,55,55,255) -> flood (flood-color, flood-opacity)
+ * Antialiasing (0.01->1., default 1) -> blur3 (stdDeviation)
+ * Color (guint, default 0,0,0,255) -> flood (flood-color, flood-opacity)
* Fill opacity (0.->1., default 1) -> composite5 (k2)
* Stroke opacity (0.->1., default 1) -> composite5 (k3)
@@ -139,9 +140,14 @@ public:
"<id>org.inkscape.effect.filter.Outline</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=\"single\">" N_("Single") "</_item>\n"
- "<_item value=\"double\">" N_("Double") "</_item>\n"
+ "<param name=\"fill\" gui-text=\"" N_("Fill image") "\" type=\"boolean\" >false</param>\n"
+ "<param name=\"outline\" gui-text=\"" N_("Hide image") "\" type=\"boolean\" >false</param>\n"
+ "<param name=\"type\" gui-text=\"" N_("Composite type:") "\" type=\"enum\">\n"
+ "<_item value=\"over\">" N_("Over") "</_item>\n"
+ "<_item value=\"in\">" N_("In") "</_item>\n"
+ "<_item value=\"out\">" N_("Out") "</_item>\n"
+ "<_item value=\"atop\">" N_("Atop") "</_item>\n"
+ "<_item value=\"xor\">" N_("XOR") "</_item>\n"
"</param>\n"
"<param name=\"position\" gui-text=\"" N_("Position:") "\" type=\"enum\">\n"
"<_item value=\"inside\">" N_("Inside") "</_item>\n"
@@ -149,14 +155,16 @@ public:
"<_item value=\"overlayed\">" N_("Overlayed") "</_item>\n"
"</param>\n"
"<param name=\"width1\" gui-text=\"" N_("Width 1:") "\" type=\"float\" appearance=\"full\" precision=\"2\" min=\"0.01\" max=\"20.00\">4</param>\n"
- "<param name=\"width2\" gui-text=\"" N_("Width 2:") "\" type=\"float\" appearance=\"full\" precision=\"2\" min=\"0.01\" max=\"20.00\">0.5</param>\n"
"<param name=\"dilat1\" gui-text=\"" N_("Dilatation 1:") "\" type=\"float\" appearance=\"full\" precision=\"2\" min=\"1\" max=\"100\">100</param>\n"
"<param name=\"erosion1\" gui-text=\"" N_("Erosion 1:") "\" type=\"float\" appearance=\"full\" precision=\"2\" min=\"0\" max=\"100\">1</param>\n"
+ "<param name=\"width2\" gui-text=\"" N_("Width 2:") "\" type=\"float\" appearance=\"full\" precision=\"2\" min=\"0.01\" max=\"20.00\">0.5</param>\n"
"<param name=\"dilat2\" gui-text=\"" N_("Dilatation 2:") "\" type=\"float\" appearance=\"full\" precision=\"2\" min=\"1\" max=\"100\">50</param>\n"
"<param name=\"erosion2\" gui-text=\"" N_("Erosion 2:") "\" type=\"float\" appearance=\"full\" precision=\"2\" min=\"0\" max=\"100\">5</param>\n"
+ "<param name=\"antialias\" gui-text=\"" N_("Antialiasing:") "\" type=\"float\" appearance=\"full\" precision=\"2\" min=\"0.01\" max=\"1\">1</param>\n"
+ "<param name=\"smooth\" gui-text=\"" N_("Smooth") "\" type=\"boolean\" >false</param>\n"
"</page>\n"
"<page name=\"co11tab\" _gui-text=\"Color\">\n"
- "<param name=\"color\" gui-text=\"" N_("Color") "\" type=\"color\">1029214207</param>\n"
+ "<param name=\"color\" gui-text=\"" N_("Color") "\" type=\"color\">255</param>\n"
"<param name=\"fopacity\" gui-text=\"" N_("Fill opacity:") "\" type=\"float\" appearance=\"full\" precision=\"2\" min=\"0\" max=\"1\">1</param>\n"
"<param name=\"sopacity\" gui-text=\"" N_("Stroke opacity:") "\" type=\"float\" appearance=\"full\" precision=\"2\" min=\"0\" max=\"1\">1</param>\n"
"</page>\n"
@@ -181,30 +189,35 @@ Outline::get_filter_text (Inkscape::Extension::Extension * ext)
if (_filter != NULL) g_free((void *)_filter);
std::ostringstream width1;
- std::ostringstream width2;
std::ostringstream dilat1;
std::ostringstream erosion1;
+ std::ostringstream width2;
std::ostringstream dilat2;
std::ostringstream erosion2;
+ std::ostringstream antialias;
std::ostringstream r;
std::ostringstream g;
std::ostringstream b;
std::ostringstream a;
std::ostringstream fopacity;
std::ostringstream sopacity;
- std::ostringstream c4in;
- std::ostringstream c4op;
+ std::ostringstream smooth;
+
std::ostringstream c1in;
std::ostringstream c1in2;
std::ostringstream c1op;
+ std::ostringstream c2in;
+ std::ostringstream c2op;
+ std::ostringstream c4in;
+
width1 << ext->get_param_float("width1");
- width2 << ext->get_param_float("width2");
dilat1 << ext->get_param_float("dilat1");
erosion1 << (- ext->get_param_float("erosion1"));
+ width2 << ext->get_param_float("width2");
dilat2 << ext->get_param_float("dilat2");
erosion2 << (- ext->get_param_float("erosion2"));
-
+ antialias << ext->get_param_float("antialias");
guint32 color = ext->get_param_color("color");
r << ((color >> 24) & 0xff);
g << ((color >> 16) & 0xff);
@@ -214,21 +227,10 @@ Outline::get_filter_text (Inkscape::Extension::Extension * ext)
fopacity << ext->get_param_float("fopacity");
sopacity << ext->get_param_float("sopacity");
- const gchar *type = ext->get_param_enum("type");
- if((g_ascii_strcasecmp("single", type) == 0)) {
- // Single
- c4in << "composite3";
- c4op << "atop";
- } else {
- // Double
- c4in << "SourceGraphic";
- c4op << "xor";
- }
-
const gchar *position = ext->get_param_enum("position");
if((g_ascii_strcasecmp("inside", position) == 0)) {
// Indide
- c1in << "SourceGraphic3";
+ c1in << "SourceGraphic";
c1in2 << "blur1";
c1op << "out";
} else if((g_ascii_strcasecmp("outside", position) == 0)) {
@@ -243,24 +245,46 @@ Outline::get_filter_text (Inkscape::Extension::Extension * ext)
c1op << "xor";
}
+ if (ext->get_param_bool("fill")) {
+ c2in << "SourceGraphic";
+ } else {
+ c2in << "blur2";
+ }
+
+ c2op << ext->get_param_enum("type");
+
+ if (ext->get_param_bool("outline")) {
+ c4in << "composite3";
+ } else {
+ c4in << "SourceGraphic";
+ }
+
+ if (ext->get_param_bool("smooth")) {
+ smooth << "1 0";
+ } else {
+ smooth << "5 -1";
+ }
+
_filter = g_strdup_printf(
"<filter xmlns:inkscape=\"http://www.inkscape.org/namespaces/inkscape\" style=\"color-interpolation-filters:sRGB;\" height=\"1.4\" width=\"1.4\" y=\"-0.2\" x=\"-0.2\" inkscape:label=\"Outline\">\n"
"<feGaussianBlur in=\"SourceAlpha\" stdDeviation=\"%s\" result=\"blur1\" />\n"
"<feComposite in=\"%s\" in2=\"%s\" 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=\"colormatrix1\" />\n"
"<feGaussianBlur stdDeviation=\"%s\" result=\"blur2\" />\n"
- "<feComposite in2=\"blur2\" operator=\"over\" result=\"composite2\" />\n"
- "<feColorMatrix in=\"composite2\" values=\"1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 %s %s \" result=\"colormatrix2\" />\n"
+ "<feComposite in=\"%s\" in2=\"blur2\" operator=\"%s\" result=\"composite2\" />\n"
+ "<feColorMatrix values=\"1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 %s %s \" result=\"colormatrix2\" />\n"
+ "<feGaussianBlur stdDeviation=\"%s\" result=\"blur3\" />\n"
+ "<feColorMatrix values=\"1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 %s \" result=\"colormatrix3\" />\n"
"<feFlood flood-opacity=\"%s\" flood-color=\"rgb(%s,%s,%s)\" result=\"flood\" />\n"
- "<feComposite in=\"flood\" in2=\"colormatrix2\" k2=\"1\" operator=\"in\" result=\"composite3\" />\n"
- "<feComposite in=\"%s\" in2=\"colormatrix2\" operator=\"%s\" result=\"composite4\" />\n"
+ "<feComposite in=\"flood\" in2=\"colormatrix3\" k2=\"1\" operator=\"in\" result=\"composite3\" />\n"
+ "<feComposite in=\"%s\" in2=\"colormatrix3\" operator=\"out\" result=\"composite4\" />\n"
"<feComposite in=\"composite4\" in2=\"composite3\" k2=\"%s\" k3=\"%s\" operator=\"arithmetic\" result=\"composite5\" />\n"
"</filter>\n", width1.str().c_str(), c1in.str().c_str(), c1in2.str().c_str(), c1op.str().c_str(),
dilat1.str().c_str(), erosion1.str().c_str(),
- width2.str().c_str(), dilat2.str().c_str(), erosion2.str().c_str(),
+ width2.str().c_str(), c2in.str().c_str(), c2op.str().c_str(),
+ dilat2.str().c_str(), erosion2.str().c_str(), antialias.str().c_str(), smooth.str().c_str(),
a.str().c_str(), r.str().c_str(), g.str().c_str(), b.str().c_str(),
- c4in.str().c_str(), c4op.str().c_str(),
- fopacity.str().c_str(), sopacity.str().c_str() );
+ c4in.str().c_str(), fopacity.str().c_str(), sopacity.str().c_str() );
return _filter;
}; /* Outline filter */