summaryrefslogtreecommitdiffstats
path: root/src/extension
diff options
context:
space:
mode:
authorNicolas Dufour <nicoduf@yahoo.fr>2013-01-24 17:28:00 +0000
committerJazzyNico <nicoduf@yahoo.fr>2013-01-24 17:28:00 +0000
commit7ffc0c1ad646bb1199ad1dd81342573d0c2a9879 (patch)
tree60230362d55680a5f61a645a902ea1fe1bd4a4de /src/extension
parentTranslations. Greek translation update by Dimitris Spingos. (diff)
downloadinkscape-7ffc0c1ad646bb1199ad1dd81342573d0c2a9879.tar.gz
inkscape-7ffc0c1ad646bb1199ad1dd81342573d0c2a9879.zip
Filters. New Nudge CMY custom predefined filter and modified Nudge RVB.
Translations. Translation template and French translation update. (bzr r12061)
Diffstat (limited to 'src/extension')
-rw-r--r--src/extension/internal/filter/color.h195
-rwxr-xr-xsrc/extension/internal/filter/filter-all.cpp3
2 files changed, 141 insertions, 57 deletions
diff --git a/src/extension/internal/filter/color.h b/src/extension/internal/filter/color.h
index 5c1cb673e..09079453f 100644
--- a/src/extension/internal/filter/color.h
+++ b/src/extension/internal/filter/color.h
@@ -3,7 +3,7 @@
/* Change the 'COLOR' above to be your file name */
/*
- * Copyright (C) 2011 Authors:
+ * Copyright (C) 2013 Authors:
* Ivan Louette (filters)
* Nicolas Dufour (UI) <nicoduf@yahoo.fr>
*
@@ -20,7 +20,8 @@
* Invert
* Lighting
* Lightness-contrast
- * Nudge
+ * Nudge RGB
+ * Nudge CMY
* Quadritone
* Solarize
* Tritone
@@ -1163,31 +1164,25 @@ LightnessContrast::get_filter_text (Inkscape::Extension::Extension * ext)
Filter's parameters:
Offsets
* Red
- * x (-100.->100., default -7) -> offset1 (dx)
- * y (-100.->100., default 5) -> offset1 (dy)
+ * x (-100.->100., default -6) -> offset1 (dx)
+ * y (-100.->100., default -6) -> offset1 (dy)
* Green
- * x (-100.->100., default 0) -> offset2 (dx)
- * y (-100.->100., default 10) -> offset2 (dy)
+ * x (-100.->100., default 6) -> offset2 (dx)
+ * y (-100.->100., default 7) -> offset2 (dy)
* Blue
- * x (-100.->100., default 3) -> offset3 (dx)
- * y (-100.->100., default -9) -> offset3 (dy)
+ * x (-100.->100., default 1) -> offset3 (dx)
+ * y (-100.->100., default -16) -> offset3 (dy)
Color
- * Background color (guint, default -1)-> flood (flood-color, flood-opacity)
- * Blend type (enum [normal,multiply and screen], default screen) -> blend1,2,3 (mode)
- * Blend source (enum, default color) ->
- * color: blend1 (in="flood")
- * image: blend1 (in="SourceGraphic")
- * background: blend1 (in="BackgroundImage")
- * Composite (enum [in,over], default over) -> composite (operator)
+ * Background color (guint, default 255)-> flood (flood-color, flood-opacity)
*/
-class Nudge : public Inkscape::Extension::Internal::Filter::Filter {
+class NudgeRGB : public Inkscape::Extension::Internal::Filter::Filter {
protected:
virtual gchar const * get_filter_text (Inkscape::Extension::Extension * ext);
public:
- Nudge ( ) : Filter() { };
- virtual ~Nudge ( ) { if (_filter != NULL) g_free((void *)_filter); return; }
+ NudgeRGB ( ) : Filter() { };
+ virtual ~NudgeRGB ( ) { if (_filter != NULL) g_free((void *)_filter); return; }
static void init (void) {
Inkscape::Extension::build_from_mem(
@@ -1197,31 +1192,17 @@ public:
"<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"
- "<param name=\"rx\" gui-text=\"" N_("X:") "\" type=\"float\" indent=\"1\" appearance=\"full\" precision=\"2\" min=\"-100.\" max=\"100.\">-7</param>\n"
- "<param name=\"ry\" gui-text=\"" N_("Y:") "\" type=\"float\" indent=\"1\" appearance=\"full\" precision=\"2\" min=\"-100.\" max=\"100.\">5</param>\n"
+ "<param name=\"rx\" gui-text=\"" N_("X:") "\" type=\"float\" indent=\"1\" appearance=\"full\" precision=\"2\" min=\"-100.\" max=\"100.\">-6</param>\n"
+ "<param name=\"ry\" gui-text=\"" N_("Y:") "\" type=\"float\" indent=\"1\" appearance=\"full\" precision=\"2\" min=\"-100.\" max=\"100.\">-6</param>\n"
"<_param name=\"greenOffset\" type=\"description\" appearance=\"header\">" N_("Green offset") "</_param>\n"
- "<param name=\"gx\" gui-text=\"" N_("X:") "\" type=\"float\" indent=\"1\" appearance=\"full\" precision=\"2\" min=\"-100.\" max=\"100.\">0</param>\n"
- "<param name=\"gy\" gui-text=\"" N_("Y:") "\" type=\"float\" indent=\"1\" appearance=\"full\" precision=\"2\" min=\"-100.\" max=\"100.\">10</param>\n"
+ "<param name=\"gx\" gui-text=\"" N_("X:") "\" type=\"float\" indent=\"1\" appearance=\"full\" precision=\"2\" min=\"-100.\" max=\"100.\">6</param>\n"
+ "<param name=\"gy\" gui-text=\"" N_("Y:") "\" type=\"float\" indent=\"1\" appearance=\"full\" precision=\"2\" min=\"-100.\" max=\"100.\">7</param>\n"
"<_param name=\"redOffset\" type=\"description\" appearance=\"header\">" N_("Blue offset") "</_param>\n"
- "<param name=\"bx\" gui-text=\"" N_("X:") "\" type=\"float\" indent=\"1\" appearance=\"full\" precision=\"2\" min=\"-100.\" max=\"100.\">3</param>\n"
- "<param name=\"by\" gui-text=\"" N_("Y:") "\" type=\"float\" indent=\"1\" appearance=\"full\" precision=\"2\" min=\"-100.\" max=\"100.\">-9</param>\n"
+ "<param name=\"bx\" gui-text=\"" N_("X:") "\" type=\"float\" indent=\"1\" appearance=\"full\" precision=\"2\" min=\"-100.\" max=\"100.\">1</param>\n"
+ "<param name=\"by\" gui-text=\"" N_("Y:") "\" type=\"float\" indent=\"1\" appearance=\"full\" precision=\"2\" min=\"-100.\" max=\"100.\">-16</param>\n"
"</page>\n"
"<page name=\"coltab\" _gui-text=\"Color\">\n"
"<param name=\"color\" gui-text=\"" N_("Background color") "\" type=\"color\">255</param>\n"
- "<param name=\"blend\" gui-text=\"" N_("Blend type:") "\" type=\"enum\">\n"
- "<_item value=\"screen\">" N_("Screen") "</_item>\n"
- "<_item value=\"multiply\">" N_("Multiply") "</_item>\n"
- "<_item value=\"normal\">" N_("Normal") "</_item>\n"
- "</param>\n"
- "<param name=\"source\" gui-text=\"" N_("Blend source:") "\" type=\"enum\">\n"
- "<_item value=\"flood\">" N_("Color") "</_item>\n"
- "<_item value=\"SourceGraphic\">" N_("Image") "</_item>\n"
- "<_item value=\"BackgroundImage\">" N_("Background") "</_item>\n"
- "</param>\n"
- "<param name=\"composite\" gui-text=\"" N_("Composite:") "\" type=\"enum\">\n"
- "<_item value=\"over\">" N_("Over") "</_item>\n"
- "<_item value=\"in\">" N_("In") "</_item>\n"
- "</param>\n"
"</page>\n"
"</param>\n"
"<effect>\n"
@@ -1233,12 +1214,12 @@ public:
"</effects-menu>\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());
+ "</inkscape-extension>\n", new NudgeRGB());
};
};
gchar const *
-Nudge::get_filter_text (Inkscape::Extension::Extension * ext)
+NudgeRGB::get_filter_text (Inkscape::Extension::Extension * ext)
{
if (_filter != NULL) g_free((void *)_filter);
@@ -1249,10 +1230,6 @@ Nudge::get_filter_text (Inkscape::Extension::Extension * ext)
std::ostringstream bx;
std::ostringstream by;
- std::ostringstream blend;
- std::ostringstream source;
- std::ostringstream composite;
-
std::ostringstream a;
std::ostringstream r;
std::ostringstream g;
@@ -1265,10 +1242,6 @@ Nudge::get_filter_text (Inkscape::Extension::Extension * ext)
bx << ext->get_param_float("bx");
by << ext->get_param_float("by");
- blend << ext->get_param_enum("blend");
- source << ext->get_param_enum("source");
- composite << ext->get_param_enum("composite");
-
guint32 color = ext->get_param_color("color");
r << ((color >> 24) & 0xff);
g << ((color >> 16) & 0xff);
@@ -1280,25 +1253,135 @@ Nudge::get_filter_text (Inkscape::Extension::Extension * ext)
"<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"
- "<feBlend in2=\"%s\" mode=\"%s\" result=\"blend1\" />\n"
+ "<feBlend in2=\"flood\" mode=\"screen\" result=\"blend1\" />\n"
"<feColorMatrix in=\"SourceGraphic\" values=\"0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 1 0 0 0 \" result=\"colormatrix2\" />\n"
"<feOffset dy=\"%s\" dx=\"%s\" result=\"offset2\" />\n"
- "<feBlend in2=\"blend1\" mode=\"%s\" result=\"blend2\" />\n"
+ "<feBlend in2=\"blend1\" mode=\"screen\" result=\"blend2\" />\n"
"<feOffset dy=\"%s\" dx=\"%s\" result=\"offset3\" />\n"
"<feColorMatrix in=\"SourceGraphic\" values=\"0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 1 0 0 \" result=\"colormatrix3\" />\n"
- "<feBlend in2=\"offset3\" mode=\"%s\" result=\"blend3\" />\n"
- "<feComposite in2=\"SourceGraphic\" operator=\"%s\" />\n"
+ "<feBlend in2=\"offset3\" mode=\"screen\" result=\"blend3\" />\n"
"</filter>\n", a.str().c_str(), r.str().c_str(), g.str().c_str(), b.str().c_str(),
- rx.str().c_str(), ry.str().c_str(), source.str().c_str(), blend.str().c_str(),
- gx.str().c_str(), gy.str().c_str(), blend.str().c_str(),
- bx.str().c_str(), by.str().c_str(), blend.str().c_str(),
- composite.str().c_str() );
+ rx.str().c_str(), ry.str().c_str(),
+ gx.str().c_str(), gy.str().c_str(),
+ bx.str().c_str(), by.str().c_str() );
return _filter;
}; /* Nudge RGB filter */
/**
+ \brief Custom predefined Nudge CMY filter.
+
+ Nudge CMY channels separately and blend them to different types of backgrounds
+
+ Filter's parameters:
+ Offsets
+ * Cyan
+ * x (-100.->100., default -6) -> offset1 (dx)
+ * y (-100.->100., default -6) -> offset1 (dy)
+ * Magenta
+ * x (-100.->100., default 6) -> offset2 (dx)
+ * y (-100.->100., default 7) -> offset2 (dy)
+ * Yellow
+ * x (-100.->100., default 1) -> offset3 (dx)
+ * y (-100.->100., default -16) -> offset3 (dy)
+ Color
+ * Background color (guint, default -1)-> flood (flood-color, flood-opacity)
+*/
+class NudgeCMY : public Inkscape::Extension::Internal::Filter::Filter {
+protected:
+ virtual gchar const * get_filter_text (Inkscape::Extension::Extension * ext);
+
+public:
+ NudgeCMY ( ) : Filter() { };
+ virtual ~NudgeCMY ( ) { 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_("Nudge CMY") "</name>\n"
+ "<id>org.inkscape.effect.filter.NudgeCMY</id>\n"
+ "<param name=\"tab\" type=\"notebook\">\n"
+ "<page name=\"offsettab\" _gui-text=\"Offset\">\n"
+ "<_param name=\"cyanOffset\" type=\"description\" appearance=\"header\">" N_("Cyan offset") "</_param>\n"
+ "<param name=\"cx\" gui-text=\"" N_("X:") "\" type=\"float\" indent=\"1\" appearance=\"full\" precision=\"2\" min=\"-100.\" max=\"100.\">-6</param>\n"
+ "<param name=\"cy\" gui-text=\"" N_("Y:") "\" type=\"float\" indent=\"1\" appearance=\"full\" precision=\"2\" min=\"-100.\" max=\"100.\">-6</param>\n"
+ "<_param name=\"magentaOffset\" type=\"description\" appearance=\"header\">" N_("Magenta offset") "</_param>\n"
+ "<param name=\"mx\" gui-text=\"" N_("X:") "\" type=\"float\" indent=\"1\" appearance=\"full\" precision=\"2\" min=\"-100.\" max=\"100.\">6</param>\n"
+ "<param name=\"my\" gui-text=\"" N_("Y:") "\" type=\"float\" indent=\"1\" appearance=\"full\" precision=\"2\" min=\"-100.\" max=\"100.\">7</param>\n"
+ "<_param name=\"yellowOffset\" type=\"description\" appearance=\"header\">" N_("Yellow offset") "</_param>\n"
+ "<param name=\"yx\" gui-text=\"" N_("X:") "\" type=\"float\" indent=\"1\" appearance=\"full\" precision=\"2\" min=\"-100.\" max=\"100.\">1</param>\n"
+ "<param name=\"yy\" gui-text=\"" N_("Y:") "\" type=\"float\" indent=\"1\" appearance=\"full\" precision=\"2\" min=\"-100.\" max=\"100.\">-16</param>\n"
+ "</page>\n"
+ "<page name=\"coltab\" _gui-text=\"Color\">\n"
+ "<param name=\"color\" gui-text=\"" N_("Background color") "\" type=\"color\">-1</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_("Color") "\"/>\n"
+ "</submenu>\n"
+ "</effects-menu>\n"
+ "<menu-tip>" N_("Nudge CMY channels separately and blend them to different types of backgrounds") "</menu-tip>\n"
+ "</effect>\n"
+ "</inkscape-extension>\n", new NudgeCMY());
+ };
+};
+
+gchar const *
+NudgeCMY::get_filter_text (Inkscape::Extension::Extension * ext)
+{
+ if (_filter != NULL) g_free((void *)_filter);
+
+ std::ostringstream cx;
+ std::ostringstream cy;
+ std::ostringstream mx;
+ std::ostringstream my;
+ std::ostringstream yx;
+ std::ostringstream yy;
+
+ std::ostringstream a;
+ std::ostringstream r;
+ std::ostringstream g;
+ std::ostringstream b;
+
+ cx << ext->get_param_float("cx");
+ cy << ext->get_param_float("cy");
+ mx << ext->get_param_float("mx");
+ my << ext->get_param_float("my");
+ yx << ext->get_param_float("yx");
+ yy << ext->get_param_float("yy");
+
+ 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\" style=\"color-interpolation-filters:sRGB;\" inkscape:label=\"Nudge CMY\">\n"
+ "<feFlood flood-opacity=\"%s\" flood-color=\"rgb(%s,%s,%s)\" result=\"flood\" />\n"
+ "<feColorMatrix in=\"SourceGraphic\" values=\"0 0 0 0 0 0 0 0 0 1 0 0 0 0 1 -1 0 0 1 0 \" result=\"colormatrix1\" />\n"
+ "<feOffset dy=\"%s\" dx=\"%s\" result=\"offset1\" />\n"
+ "<feBlend in2=\"flood\" mode=\"multiply\" result=\"blend1\" />\n"
+ "<feColorMatrix in=\"SourceGraphic\" values=\"0 0 0 0 1 0 0 0 0 0 0 0 0 0 1 0 -1 0 1 0 \" result=\"colormatrix2\" />\n"
+ "<feOffset dy=\"%s\" dx=\"%s\" result=\"offset2\" />\n"
+ "<feBlend in2=\"blend1\" mode=\"multiply\" result=\"blend2\" />\n"
+ "<feOffset dy=\"%s\" dx=\"%s\" result=\"offset3\" />\n"
+ "<feColorMatrix in=\"SourceGraphic\" values=\"0 0 0 0 1 0 0 0 0 1 0 0 0 0 0 0 0 -1 1 0 \" result=\"colormatrix3\" />\n"
+ "<feBlend in2=\"offset3\" mode=\"multiply\" result=\"blend3\" />\n"
+ "</filter>\n", a.str().c_str(), r.str().c_str(), g.str().c_str(), b.str().c_str(),
+ cx.str().c_str(), cy.str().c_str(),
+ mx.str().c_str(), my.str().c_str(),
+ yx.str().c_str(), yy.str().c_str() );
+
+ return _filter;
+
+}; /* Nudge CMY filter */
+
+/**
\brief Custom predefined Quadritone filter.
Replace hue by two colors.
diff --git a/src/extension/internal/filter/filter-all.cpp b/src/extension/internal/filter/filter-all.cpp
index b5d47ae45..0273d1669 100755
--- a/src/extension/internal/filter/filter-all.cpp
+++ b/src/extension/internal/filter/filter-all.cpp
@@ -64,7 +64,8 @@ Filter::filters_all (void )
Invert::init();
Lighting::init();
LightnessContrast::init();
- Nudge::init();
+ NudgeRGB::init();
+ NudgeCMY::init();
Quadritone::init();
Solarize::init();
Tritone::init();