...
authorCristy <urban-warrior@imagemagick.org>
Mon, 28 May 2018 13:43:11 +0000 (09:43 -0400)
committerCristy <urban-warrior@imagemagick.org>
Mon, 28 May 2018 13:43:11 +0000 (09:43 -0400)
MagickCore/draw.c
coders/svg.c

index 784de9b642eb62e73f7248083fb1d4f304655aa5..7d5426f5e8fd7f467100f5a1507ef9fc3600607c 100644 (file)
@@ -2052,7 +2052,7 @@ MagickExport MagickBooleanType DrawGradientImage(Image *image,
               {
                 j=i;
                 i--;
-                alpha=(offset-gradient->stops[i].offset)/
+                alpha=100.0*(offset-gradient->stops[i].offset)/
                   (gradient->stops[j].offset-gradient->stops[i].offset);
                 CompositePixelInfoBlend(&gradient->stops[i].color,1.0-alpha,
                   &gradient->stops[j].color,alpha,&composite);
@@ -3410,9 +3410,10 @@ MagickExport MagickBooleanType DrawImage(Image *image,const DrawInfo *draw_info,
             number_stops++;
             if (number_stops == 1)
               stops=(StopInfo *) AcquireQuantumMemory(2,sizeof(*stops));
-            else if (number_stops > 2)
-              stops=(StopInfo *) ResizeQuantumMemory(stops,number_stops,
-                sizeof(*stops));
+            else
+              if (number_stops > 2)
+                stops=(StopInfo *) ResizeQuantumMemory(stops,number_stops,
+                  sizeof(*stops));
             if (stops == (StopInfo *) NULL)
               {
                 (void) ThrowMagickException(exception,GetMagickModule(),
index 6bf786ce9cac8f2603065a23b14955cc968260c8..9c924cbd0a60b742847469229617761e54bb95f4 100644 (file)
@@ -1390,6 +1390,10 @@ static void SVGStartElement(void *context,const xmlChar *name,
       if (LocaleCompare((const char *) name,"text") == 0)
         {
           PushGraphicContext(id);
+          (void) FormatLocaleFile(svg_info->file,"translate %g,%g\n",
+            svg_info->bounds.x,svg_info->bounds.y);
+          svg_info->center.x=svg_info->bounds.x;
+          svg_info->center.y=svg_info->bounds.y;
           svg_info->bounds.x=0.0;
           svg_info->bounds.y=0.0;
           svg_info->bounds.width=0.0;
@@ -2592,8 +2596,7 @@ static void SVGEndElement(void *context,const xmlChar *name)
                 *text;
 
               text=EscapeString(svg_info->text,'\'');
-              (void) FormatLocaleFile(svg_info->file,"text %g,%g \"%s\"\n",
-                svg_info->bounds.x,svg_info->bounds.y,text);
+              (void) FormatLocaleFile(svg_info->file,"text 0,0 \"%s\"\n",text);
               text=DestroyString(text);
               *svg_info->text='\0';
             }
@@ -2615,7 +2618,7 @@ static void SVGEndElement(void *context,const xmlChar *name)
 
               text=EscapeString(svg_info->text,'\'');
               (void) FormatLocaleFile(svg_info->file,"text %g,%g \"%s\"\n",
-                svg_info->bounds.x,svg_info->bounds.y,text);
+                svg_info->bounds.x-svg_info->center.x,svg_info->bounds.y-svg_info->center.y,text);
               text=DestroyString(text);
               draw_info=CloneDrawInfo(svg_info->image_info,(DrawInfo *) NULL);
               draw_info->pointsize=svg_info->pointsize;