]> granicus.if.org Git - imagemagick/commitdiff
https://www.imagemagick.org/discourse-server/viewtopic.php?f=3&t=34065
authorCristy <urban-warrior@imagemagick.org>
Sat, 2 Jun 2018 12:09:01 +0000 (08:09 -0400)
committerCristy <urban-warrior@imagemagick.org>
Sat, 2 Jun 2018 12:09:01 +0000 (08:09 -0400)
MagickCore/draw.c

index 80c1b0521f99f38b191ad5e313970ce218fcb9ac..ee74688ab65cdc16f61e92ab5da79c445a199f45 100644 (file)
@@ -2054,7 +2054,7 @@ MagickExport MagickBooleanType DrawGradientImage(Image *image,
               {
                 j=i;
                 i--;
-                alpha=100.0*(offset-gradient->stops[i].offset)/
+                alpha=(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);
@@ -3436,7 +3436,9 @@ MagickExport MagickBooleanType DrawImage(Image *image,const DrawInfo *draw_info,
               exception);
             stops[number_stops-1].color=stop_color;
             GetNextToken(q,&q,extent,token);
-            stops[number_stops-1].offset=StringToDouble(token,&next_token);
+            factor=strchr(token,'%') != (char *) NULL ? 0.01 : 1.0;
+            stops[number_stops-1].offset=factor*StringToDouble(token,
+              &next_token);
             if (token == next_token)
               ThrowPointExpectedException(token,exception);
             break;