[dia] Bug #591525 - fix opacitiy export of standard SVG renderer



commit 1f931111b4eb932e615b0b849183e41a243d6f1e
Author: Hans Breuer <hans breuer org>
Date:   Fri Aug 21 13:38:05 2009 +0200

    Bug #591525 - fix opacitiy export of standard SVG renderer
    
    Need to write fill-opacitiy and stroke-opacitiy as non localized double.

 lib/diasvgrenderer.c |   11 ++++++++---
 1 files changed, 8 insertions(+), 3 deletions(-)
---
diff --git a/lib/diasvgrenderer.c b/lib/diasvgrenderer.c
index ed2d315..9046265 100644
--- a/lib/diasvgrenderer.c
+++ b/lib/diasvgrenderer.c
@@ -222,12 +222,15 @@ get_draw_style(DiaSvgRenderer *renderer,
 {
   static GString *str = NULL;
   gchar linewidth_buf[DTOSTR_BUF_SIZE];
+  gchar alpha_buf[DTOSTR_BUF_SIZE];
 
   if (!str) str = g_string_new(NULL);
   g_string_truncate(str, 0);
 
   /* TODO(CHECK): the shape-export didn't have 'fill: none' here */
-  g_string_printf(str, "fill: none; fill-opacity: %f; stroke-width: %s", colour->alpha, dia_svg_dtostr(linewidth_buf, renderer->linewidth) );
+  g_string_printf(str, "fill: none; stroke-opacity: %s; stroke-width: %s", 
+		  g_ascii_formatd (alpha_buf, sizeof(alpha_buf), "%g", colour->alpha), 
+		  dia_svg_dtostr(linewidth_buf, renderer->linewidth) );
   if (strcmp(renderer->linecap, "butt"))
     g_string_append_printf(str, "; stroke-linecap: %s", renderer->linecap);
   if (strcmp(renderer->linejoin, "miter"))
@@ -250,12 +253,14 @@ get_fill_style(DiaSvgRenderer *renderer,
 	       Color *colour)
 {
   static GString *str = NULL;
+  gchar alpha_buf[DTOSTR_BUF_SIZE];
 
   if (!str) str = g_string_new(NULL);
 
-  g_string_printf(str, "fill: #%02x%02x%02x; fill-opacity: %f",
+  g_string_printf(str, "fill: #%02x%02x%02x; fill-opacity: %s",
 		   (int)(255*colour->red), (int)(255*colour->green),
-		   (int)(255*colour->blue), colour->alpha);
+		   (int)(255*colour->blue), 
+		   g_ascii_formatd(alpha_buf, sizeof(alpha_buf), "%g", colour->alpha));
 
   return str->str;
 }



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]