From ee4956cfe78fc822d0cadcc24f3e49d199bd0fe6 Mon Sep 17 00:00:00 2001 From: Nicolas Dufour Date: Thu, 28 Jul 2011 20:09:35 +0200 Subject: Filters. New Bump custom predefined filter. Translations. inkscape.pot and French translation update. (bzr r10512) --- po/fr.po | 25 +-- po/inkscape.pot | 2 +- src/extension/internal/filter/bumps.h | 272 +++++++++++++++++++++++++++ src/extension/internal/filter/filter-all.cpp | 6 +- 4 files changed, 285 insertions(+), 20 deletions(-) create mode 100644 src/extension/internal/filter/bumps.h diff --git a/po/fr.po b/po/fr.po index fe1c0734c..7b5735857 100644 --- a/po/fr.po +++ b/po/fr.po @@ -18,7 +18,7 @@ msgstr "" "Project-Id-Version: inkscape\n" "Report-Msgid-Bugs-To: inkscape-devel@lists.sourceforge.net\n" "POT-Creation-Date: 2011-07-27 20:43+0200\n" -"PO-Revision-Date: 2011-07-27 20:50+0100\n" +"PO-Revision-Date: 2011-07-27 21:02+0100\n" "Last-Translator: Nicolas Dufour \n" "Language-Team: \n" "Language: \n" @@ -6967,9 +6967,8 @@ msgid "Brightness filter" msgstr "Filtre de luminosité" #: ../src/extension/internal/filter/color.h:147 -#, fuzzy msgid "Channel painting, custom (Color)" -msgstr "Quadritone fantaisie, paramétrable (Couleur)" +msgstr "Peinture par canal, paramétrable (Couleur)" #: ../src/extension/internal/filter/color.h:152 #: ../src/extension/internal/filter/color.h:262 @@ -6996,19 +6995,16 @@ msgid "Alpha:" msgstr "Opacité" #: ../src/extension/internal/filter/color.h:169 -#, fuzzy msgid "Replace RGB by any color" -msgstr "Remplace la teinte par deux couleurs" +msgstr "Remplace les canaux RVB par une couleur" #: ../src/extension/internal/filter/color.h:260 -#, fuzzy msgid "Channel transparency, custom (Color)" -msgstr "Quadritone fantaisie, paramétrable (Couleur)" +msgstr "Transparence par canal, paramétrable (Couleur)" #: ../src/extension/internal/filter/color.h:274 -#, fuzzy msgid "Replace RGB by transparency" -msgstr "Transparence barbouillée" +msgstr "Remplace les canaux RVB par de la transparence" #: ../src/extension/internal/filter/color.h:338 msgid "Colorize, custom (Color)" @@ -7081,9 +7077,8 @@ msgid "Blend 2:" msgstr "Fondu 2 :" #: ../src/extension/internal/filter/color.h:371 -#, fuzzy msgid "Blend image or object with a flood color" -msgstr "Mélange un image ou un objet avec une couleur de remplissage, et définit sa luminosité et son contraste" +msgstr "Mélange un image ou un objet avec une couleur de remplissage" #: ../src/extension/internal/filter/color.h:447 msgid "Duochrome, custom (Color)" @@ -7122,9 +7117,8 @@ msgid "Color 2" msgstr "Couleur 2" #: ../src/extension/internal/filter/color.h:473 -#, fuzzy msgid "Convert luminance values to a duochrome palette" -msgstr "Modifie les couleurs avec une palette à deux tons" +msgstr "Convertit les valeurs de luminance en une palette à deux tons" #: ../src/extension/internal/filter/color.h:570 msgid "Electrize, custom (Color)" @@ -24873,7 +24867,7 @@ msgstr "Paramètres" #: ../share/extensions/gcodetools_lathe.inx.h:34 #: ../share/extensions/gcodetools_path_to_gcode.inx.h:24 msgid "Pass by Pass" -msgstr "" +msgstr "Passe par passe" #: ../share/extensions/gcodetools_area.inx.h:37 #: ../share/extensions/gcodetools_lathe.inx.h:35 @@ -25200,9 +25194,8 @@ msgid "Perpendicular" msgstr "Perpendiculaire" #: ../share/extensions/gcodetools_prepare_path_for_plasma.inx.h:13 -#, fuzzy msgid "Prepare corners" -msgstr "coin de page" +msgstr "Préparer les coins" #: ../share/extensions/gcodetools_prepare_path_for_plasma.inx.h:14 msgid "Prepare path for plasma or laser cuters" diff --git a/po/inkscape.pot b/po/inkscape.pot index 37c7ad794..179c3d341 100644 --- a/po/inkscape.pot +++ b/po/inkscape.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: inkscape-devel@lists.sourceforge.net\n" -"POT-Creation-Date: 2011-07-27 20:43+0200\n" +"POT-Creation-Date: 2011-07-28 20:09+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" diff --git a/src/extension/internal/filter/bumps.h b/src/extension/internal/filter/bumps.h new file mode 100644 index 000000000..5b0be2b7e --- /dev/null +++ b/src/extension/internal/filter/bumps.h @@ -0,0 +1,272 @@ +#ifndef __INKSCAPE_EXTENSION_INTERNAL_FILTER_BUMPS_H__ +#define __INKSCAPE_EXTENSION_INTERNAL_FILTER_BUMPS_H__ +/* Change the 'BUMPS' above to be your file name */ + +/* + * Copyright (C) 2011 Authors: + * Ivan Louette (filters) + * Nicolas Dufour (UI) + * + * Bump filters + * Bump + * + * Released under GNU GPL, read the file 'COPYING' for more information + */ +/* ^^^ Change the copyright to be you and your e-mail address ^^^ */ + +#include "filter.h" + +#include "extension/internal/clear-n_.h" +#include "extension/system.h" +#include "extension/extension.h" + +namespace Inkscape { +namespace Extension { +namespace Internal { +namespace Filter { + +/** + \brief Custom predefined Bump filter. + + All purpose bump filter + + Filter's parameters: + Options + * Image simplification (0.01->10., default 0.01) -> blur1 (stdDeviation) + * Bump simplification (0.01->10., default 0.01) -> blur2 (stdDeviation) + * Crop (-1.->1., default 0) -> composite1 (k3) + * Red (-50.->50., default 0.) -> colormatrix1 (values) + * Green (-50.->50., default 0.) -> colormatrix1 (values) + * Blue (-50.->50., default 0.) -> colormatrix1 (values) + * Bump from background (boolean, default false) -> colormatrix1 (false: in="SourceGraphic", true: in="BackgroundImage") + Lighting + * Lighting type (enum, default specular) -> lighting block + * Height (0.->50., default 5.) -> lighting (surfaceScale) + * Lightness (0.->5., default 1.) -> lighting [diffuselighting (diffuseConstant)|specularlighting (specularConstant)] + * Precision (1->128, default 15) -> lighting (specularExponent) + * Color (guint, default -1 (RGB:255,255,255))-> lighting (lighting-color) + Light source + * Azimuth (0->360, default 225) -> lightsOptions (distantAzimuth) + * Elevation (0->180, default 45) -> lightsOptions (distantElevation) + * X location [point] (-5000->5000, default 526) -> lightsOptions (x) + * Y location [point] (-5000->5000, default 372) -> lightsOptions (y) + * Z location [point] (0->5000, default 150) -> lightsOptions (z) + * X location [spot] (-5000->5000, default 526) -> lightsOptions (x) + * Y location [spot] (-5000->5000, default 372) -> lightsOptions (y) + * Z location [spot] (-5000->5000, default 150) -> lightsOptions (z) + * X target (-5000->5000, default 0) -> lightsOptions (pointsAtX) + * Y target (-5000->5000, default 0) -> lightsOptions (pointsAtX) + * Z target (-5000->0, default -1000) -> lightsOptions (pointsAtX) + * Specular exponent (1->100, default 1) -> lightsOptions (specularExponent) + * Cone angle (0->100, default 50) -> lightsOptions (limitingConeAngle) + Color bump + * Blend type (enum, default normal) -> blend (mode) + * Image color (guint, default -987158017 (RGB:197,41,41)) -> flood (flood-color) + * Color bump (boolean, default false) -> composite2 (false: in="diffuselighting", true in="flood") +*/ + +class Bump : public Inkscape::Extension::Internal::Filter::Filter { +protected: + virtual gchar const * get_filter_text (Inkscape::Extension::Extension * ext); + +public: + Bump ( ) : Filter() { }; + virtual ~Bump ( ) { if (_filter != NULL) g_free((void *)_filter); return; } + + static void init (void) { + Inkscape::Extension::build_from_mem( + "\n" + "" N_("Bump, custom (Bumps)") "\n" + "org.inkscape.effect.filter.Bump\n" + "\n" + "\n" + "0.01\n" + "0.01\n" + "0\n" + "<_param name=\"sourceHeader\" type=\"description\" appearance=\"header\">Bump source\n" + "0\n" + "0\n" + "0\n" + "false\n" + "\n" + "\n" + "\n" + "<_item value=\"specular\">" N_("Specular") "\n" + "<_item value=\"diffuse\">" N_("Diffuse") "\n" + "\n" + "5\n" + "1\n" + "15\n" + "-1\n" + "\n" + "\n" + "\n" + "<_item value=\"distant\">" N_("Distant") "\n" + "<_item value=\"point\">" N_("Point") "\n" + "<_item value=\"spot\">" N_("Spot") "\n" + "\n" + "<_param name=\"distantHeader\" type=\"description\" appearance=\"header\">Distant light options\n" + "225\n" + "45\n" + "<_param name=\"pointHeader\" type=\"description\" appearance=\"header\">Point light options\n" + "526\n" + "372\n" + "150\n" + "<_param name=\"spotHeader\" type=\"description\" appearance=\"header\">Spot light options\n" + "526\n" + "372\n" + "150\n" + "0\n" + "0\n" + "-1000\n" + "1\n" + "50\n" + "\n" + "\n" + "-987158017\n" + "false\n" + "\n" + "<_item value=\"normal\">" N_("Normal") "\n" + "<_item value=\"darken\">" N_("Darken") "\n" + "<_item value=\"screen\">" N_("Screen") "\n" + "<_item value=\"multiply\">" N_("Multiply") "\n" + "<_item value=\"lighten\">" N_("Lighten") "\n" + "\n" + "\n" + "\n" + "\n" + "all\n" + "\n" + "\n" + "\n" + "\n" + "\n" + "" N_("All purposes bump filter") "\n" + "\n" + "\n", new Bump()); + }; + +}; + +gchar const * +Bump::get_filter_text (Inkscape::Extension::Extension * ext) +{ + if (_filter != NULL) g_free((void *)_filter); + + std::ostringstream simplifyImage; + std::ostringstream simplifyBump; + std::ostringstream red; + std::ostringstream green; + std::ostringstream blue; + std::ostringstream crop; + std::ostringstream bumpSource; + std::ostringstream blend; + + std::ostringstream lightStart; + std::ostringstream lightOptions; + std::ostringstream lightEnd; + + std::ostringstream lightRed; + std::ostringstream lightGreen; + std::ostringstream lightBlue; + std::ostringstream floodRed; + std::ostringstream floodGreen; + std::ostringstream floodBlue; + std::ostringstream colorize; + + + simplifyImage << ext->get_param_float("simplifyImage"); + simplifyBump << ext->get_param_float("simplifyBump"); + red << ext->get_param_float("red"); + green << ext->get_param_float("green"); + blue << ext->get_param_float("blue"); + crop << ext->get_param_float("crop"); + blend << ext->get_param_enum("blend"); + + guint32 lightingColor = ext->get_param_color("lightingColor"); + guint32 imageColor = ext->get_param_color("imageColor"); + + if (ext->get_param_bool("background")) { + bumpSource << "BackgroundImage" ; + } else { + bumpSource << "blur1" ; + } + + const gchar *lightType = ext->get_param_enum("lightType"); + if ((g_ascii_strcasecmp("specular", lightType) == 0)) { + // Specular + lightStart << "> 24) & 0xff) << "," + << ((lightingColor >> 16) & 0xff) << "," << ((lightingColor >> 8) & 0xff) << ")\" surfaceScale=\"" + << ext->get_param_float("height") << "\" specularConstant=\"" << ext->get_param_float("lightness") + << "\" specularExponent=\"" << ext->get_param_int("precision") << "\" result=\"lighting\">"; + lightEnd << ""; + } else { + // Diffuse + lightStart << "> 24) & 0xff) << "," + << ((lightingColor >> 16) & 0xff) << "," << ((lightingColor >> 8) & 0xff) << ")\" surfaceScale=\"" + << ext->get_param_float("height") << "\" diffuseConstant=\"" << ext->get_param_float("lightness") + << "\" result=\"lighting\">"; + lightEnd << ""; + } + + const gchar *lightSource = ext->get_param_enum("lightSource"); + if ((g_ascii_strcasecmp("distant", lightSource) == 0)) { + // Distant + lightOptions << "get_param_int("distantAzimuth") << "\" elevation=\"" + << ext->get_param_int("distantElevation") << "\" />"; + } else if ((g_ascii_strcasecmp("point", lightSource) == 0)) { + // Point + lightOptions << "get_param_int("pointX") << "\" y=\"" << ext->get_param_int("pointY") + << "\" x=\"" << ext->get_param_int("pointZ") << "\" />"; + } else { + // Spot + lightOptions << "get_param_int("pointX") << "\" y=\"" << ext->get_param_int("pointY") + << "\" z=\"" << ext->get_param_int("pointZ") << "\" pointsAtX=\"" << ext->get_param_int("spotAtX") + << "\" pointsAtY=\"" << ext->get_param_int("spotAtY") << "\" pointsAtZ=\"" << ext->get_param_int("spotAtZ") + << "\" specularExponent=\"" << ext->get_param_int("spotExponent") + << "\" limitingConeAngle=\"" << ext->get_param_int("spotConeAngle") + << "\" />"; + } + + floodRed << ((imageColor >> 24) & 0xff); + floodGreen << ((imageColor >> 16) & 0xff); + floodBlue << ((imageColor >> 8) & 0xff); + + if (ext->get_param_bool("colorize")) { + colorize << "flood" ; + } else { + colorize << "blur1" ; + } + + _filter = g_strdup_printf( + "\n" + "\n" + "\n" + "\n" + "\n" + "\n" + "%s\n" + "%s\n" + "%s\n" + "\n" + "\n" + "\n" + "\n" + "\n", simplifyImage.str().c_str(), bumpSource.str().c_str(), red.str().c_str(), green.str().c_str(), blue.str().c_str(), + crop.str().c_str(), simplifyBump.str().c_str(), + lightStart.str().c_str(), lightOptions.str().c_str(), lightEnd.str().c_str(), + floodRed.str().c_str(), floodGreen.str().c_str(), floodBlue.str().c_str(), + colorize.str().c_str(), blend.str().c_str()); + + return _filter; + +}; /* Cross blur filter */ + + +}; /* namespace Filter */ +}; /* namespace Internal */ +}; /* namespace Extension */ +}; /* namespace Inkscape */ + +/* Change the 'BUMPS' below to be your file name */ +#endif /* __INKSCAPE_EXTENSION_INTERNAL_FILTER_BUMPS_H__ */ diff --git a/src/extension/internal/filter/filter-all.cpp b/src/extension/internal/filter/filter-all.cpp index ed8b4e180..210d1d87a 100755 --- a/src/extension/internal/filter/filter-all.cpp +++ b/src/extension/internal/filter/filter-all.cpp @@ -10,7 +10,7 @@ /* Put your filter here */ #include "abc.h" #include "blurs.h" -//#include "bumps.h" +#include "bumps.h" #include "color.h" #include "drop-shadow.h" #include "image.h" @@ -36,7 +36,7 @@ Filter::filters_all (void ) /* Experimental custom predefined filters */ - // ABCs + // ABC Blur::init(); CleanEdges::init(); ColorShift::init(); @@ -53,7 +53,7 @@ Filter::filters_all (void ) CrossBlur::init(); // Bumps -// SpecularBump::init(); + Bump::init(); // Color Brightness::init(); -- cgit v1.2.3