summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorNicolas Dufour <nicoduf@yahoo.fr>2010-05-27 19:41:41 +0000
committerJazzyNico <nicoduf@yahoo.fr>2010-05-27 19:41:41 +0000
commitf6bd903f2b41f36bb6112d099f36e31696536ba7 (patch)
treeee675c5ba0c7b4d19d203a20563ea42525ac54c0 /src
parenta web banner collection template (diff)
downloadinkscape-f6bd903f2b41f36bb6112d099f36e31696536ba7.tar.gz
inkscape-f6bd903f2b41f36bb6112d099f36e31696536ba7.zip
Extensions. Localized float values in SVG due to internal extensions, %f in printf (bug #586063)
Fixed bugs: - https://launchpad.net/bugs/586063 (bzr r9456)
Diffstat (limited to 'src')
-rw-r--r--src/extension/internal/filter/drop-shadow.h42
-rw-r--r--src/extension/internal/filter/snow.h7
-rw-r--r--src/extension/internal/grid.cpp4
3 files changed, 33 insertions, 20 deletions
diff --git a/src/extension/internal/filter/drop-shadow.h b/src/extension/internal/filter/drop-shadow.h
index 34939222c..a48175fde 100644
--- a/src/extension/internal/filter/drop-shadow.h
+++ b/src/extension/internal/filter/drop-shadow.h
@@ -57,21 +57,26 @@ DropShadow::get_filter_text (Inkscape::Extension::Extension * ext)
{
if (_filter != NULL) g_free((void *)_filter);
- float blur = ext->get_param_float("blur");
- float opacity = ext->get_param_float("opacity") / 100;
- float x = ext->get_param_float("xoffset");
- float y = ext->get_param_float("yoffset");
+ std::ostringstream blur;
+ std::ostringstream opacity;
+ std::ostringstream x;
+ std::ostringstream y;
+
+ blur << ext->get_param_float("blur");
+ opacity << ext->get_param_float("opacity") / 100;
+ x << ext->get_param_float("xoffset");
+ y << ext->get_param_float("yoffset");
_filter = g_strdup_printf(
"<filter xmlns:inkscape=\"http://www.inkscape.org/namespaces/inkscape\" inkscape:label=\"Drop shadow\" width=\"1.5\" height=\"1.5\" x=\"-.25\" y=\"-.25\">\n"
- "<feGaussianBlur in=\"SourceAlpha\" stdDeviation=\"%f\" result=\"blur\"/>\n"
- "<feColorMatrix result=\"bluralpha\" type=\"matrix\" values=\"1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 %f 0 \" />\n"
- "<feOffset in=\"bluralpha\" dx=\"%f\" dy=\"%f\" result=\"offsetBlur\"/>\n"
+ "<feGaussianBlur in=\"SourceAlpha\" stdDeviation=\"%s\" result=\"blur\"/>\n"
+ "<feColorMatrix result=\"bluralpha\" type=\"matrix\" values=\"1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 %s 0 \" />\n"
+ "<feOffset in=\"bluralpha\" dx=\"%s\" dy=\"%s\" result=\"offsetBlur\"/>\n"
"<feMerge>\n"
"<feMergeNode in=\"offsetBlur\"/>\n"
"<feMergeNode in=\"SourceGraphic\"/>\n"
"</feMerge>\n"
- "</filter>\n", blur, opacity, x, y);
+ "</filter>\n", blur.str().c_str(), opacity.str().c_str(), x.str().c_str(), y.str().c_str());
return _filter;
};
@@ -112,21 +117,26 @@ DropGlow::get_filter_text (Inkscape::Extension::Extension * ext)
{
if (_filter != NULL) g_free((void *)_filter);
- float blur = ext->get_param_float("blur");
- float opacity = ext->get_param_float("opacity") / 100;
- float x = ext->get_param_float("xoffset");
- float y = ext->get_param_float("yoffset");
+ std::ostringstream blur;
+ std::ostringstream opacity;
+ std::ostringstream x;
+ std::ostringstream y;
+
+ blur << ext->get_param_float("blur");
+ opacity << ext->get_param_float("opacity") / 100;
+ x << ext->get_param_float("xoffset");
+ y << ext->get_param_float("yoffset");
_filter = g_strdup_printf(
"<filter xmlns:inkscape=\"http://www.inkscape.org/namespaces/inkscape\" inkscape:label=\"Drop shadow\" width=\"1.5\" height=\"1.5\" x=\"-.25\" y=\"-.25\">\n"
- "<feGaussianBlur in=\"SourceAlpha\" stdDeviation=\"%f\" result=\"blur\"/>\n"
- "<feColorMatrix result=\"bluralpha\" type=\"matrix\" values=\"-1 0 0 0 1 0 -1 0 0 1 0 0 -1 0 1 0 0 0 %f 0 \" />\n"
- "<feOffset in=\"bluralpha\" dx=\"%f\" dy=\"%f\" result=\"offsetBlur\"/>\n"
+ "<feGaussianBlur in=\"SourceAlpha\" stdDeviation=\"%s\" result=\"blur\"/>\n"
+ "<feColorMatrix result=\"bluralpha\" type=\"matrix\" values=\"-1 0 0 0 1 0 -1 0 0 1 0 0 -1 0 1 0 0 0 %s 0 \" />\n"
+ "<feOffset in=\"bluralpha\" dx=\"%s\" dy=\"%s\" result=\"offsetBlur\"/>\n"
"<feMerge>\n"
"<feMergeNode in=\"offsetBlur\"/>\n"
"<feMergeNode in=\"SourceGraphic\"/>\n"
"</feMerge>\n"
- "</filter>\n", blur, opacity, x, y);
+ "</filter>\n", blur.str().c_str(), opacity.str().c_str(), x.str().c_str(), y.str().c_str());
return _filter;
};
diff --git a/src/extension/internal/filter/snow.h b/src/extension/internal/filter/snow.h
index cb5c55f57..2bb798cf1 100644
--- a/src/extension/internal/filter/snow.h
+++ b/src/extension/internal/filter/snow.h
@@ -51,12 +51,13 @@ Snow::get_filter_text (Inkscape::Extension::Extension * ext)
{
if (_filter != NULL) g_free((void *)_filter);
- float drift = ext->get_param_float("drift");
+ std::ostringstream drift;
+ drift << ext->get_param_float("drift");
_filter = g_strdup_printf(
"<filter xmlns:inkscape=\"http://www.inkscape.org/namespaces/inkscape\" inkscape:label=\"Snow\">\n"
"<feConvolveMatrix order=\"3 3\" kernelMatrix=\"1 1 1 0 0 0 -1 -1 -1\" preserveAlpha=\"false\" divisor=\"3\"/>\n"
- "<feMorphology operator=\"dilate\" radius=\"1 %f\"/>\n"
+ "<feMorphology operator=\"dilate\" radius=\"1 %s\"/>\n"
"<feGaussianBlur stdDeviation=\"1.6270889487870621\" result=\"result0\"/>\n"
"<feColorMatrix values=\"0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 10 0\" result=\"result1\"/>\n"
"<feOffset dx=\"0\" dy=\"1\" result=\"result5\"/>\n"
@@ -67,7 +68,7 @@ Snow::get_filter_text (Inkscape::Extension::Extension * ext)
"<feColorMatrix values=\"0.4 0 0 0 0.6 0 0.4 0 0 0.6 0 0 0 0 1 0 0 0 1 0\" result=\"result4\"/>\n"
"<feComposite in2=\"result5\" in=\"result4\"/>\n"
"<feComposite in2=\"SourceGraphic\"/>\n"
- "</filter>\n", drift);
+ "</filter>\n", drift.str().c_str());
return _filter;
};
diff --git a/src/extension/internal/grid.cpp b/src/extension/internal/grid.cpp
index 39bca52d8..1593ffe79 100644
--- a/src/extension/internal/grid.cpp
+++ b/src/extension/internal/grid.cpp
@@ -120,7 +120,9 @@ Grid::effect (Inkscape::Extension::Effect *module, Inkscape::UI::View::View *doc
Glib::ustring style("fill:none;fill-opacity:0.75000000;fill-rule:evenodd;stroke:#000000;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1.0000000");
style += ";stroke-width:";
gchar floatstring[64];
- sprintf(floatstring, "%f", line_width);
+ std::ostringstream stringstream;
+ stringstream << line_width;
+ sprintf(floatstring, "%s", stringstream.str().c_str());
style += floatstring;
style += "pt";
path->setAttribute("style", style.c_str());