]> granicus.if.org Git - imagemagick/blobdiff - magick/draw.c
(no commit message)
[imagemagick] / magick / draw.c
index 0299fd2810eae98f0988d68673a5b3d3203d202c..c79c0e0f5fd2f4ab3a836e984671eed540122d50 100644 (file)
@@ -1657,7 +1657,7 @@ static inline MagickBooleanType IsPoint(const char *point)
   double
     value;
 
-  value=LocaleToDouble(point,&p);
+  value=InterpretLocaleValue(point,&p);
   return((value == 0.0) && (p == point) ? MagickFalse : MagickTrue);
 }
 
@@ -1822,27 +1822,27 @@ MagickExport MagickBooleanType DrawImage(Image *image,const DrawInfo *draw_info)
         if (LocaleCompare("affine",keyword) == 0)
           {
             GetMagickToken(q,&q,token);
-            affine.sx=LocaleToDouble(token,(char **) NULL);
+            affine.sx=InterpretLocaleValue(token,(char **) NULL);
             GetMagickToken(q,&q,token);
             if (*token == ',')
               GetMagickToken(q,&q,token);
-            affine.rx=LocaleToDouble(token,(char **) NULL);
+            affine.rx=InterpretLocaleValue(token,(char **) NULL);
             GetMagickToken(q,&q,token);
             if (*token == ',')
               GetMagickToken(q,&q,token);
-            affine.ry=LocaleToDouble(token,(char **) NULL);
+            affine.ry=InterpretLocaleValue(token,(char **) NULL);
             GetMagickToken(q,&q,token);
             if (*token == ',')
               GetMagickToken(q,&q,token);
-            affine.sy=LocaleToDouble(token,(char **) NULL);
+            affine.sy=InterpretLocaleValue(token,(char **) NULL);
             GetMagickToken(q,&q,token);
             if (*token == ',')
               GetMagickToken(q,&q,token);
-            affine.tx=LocaleToDouble(token,(char **) NULL);
+            affine.tx=InterpretLocaleValue(token,(char **) NULL);
             GetMagickToken(q,&q,token);
             if (*token == ',')
               GetMagickToken(q,&q,token);
-            affine.ty=LocaleToDouble(token,(char **) NULL);
+            affine.ty=InterpretLocaleValue(token,(char **) NULL);
             break;
           }
         if (LocaleCompare("arc",keyword) == 0)
@@ -2013,7 +2013,8 @@ MagickExport MagickBooleanType DrawImage(Image *image,const DrawInfo *draw_info)
             GetMagickToken(q,&q,token);
             factor=strchr(token,'%') != (char *) NULL ? 0.01 : 1.0;
             graphic_context[n]->fill.opacity=ClampToQuantum((MagickRealType)
-              QuantumRange*(1.0-factor*LocaleToDouble(token,(char **) NULL)));
+              QuantumRange*(1.0-factor*InterpretLocaleValue(token,
+              (char **) NULL)));
             break;
           }
         if (LocaleCompare("fill-rule",keyword) == 0)
@@ -2050,7 +2051,8 @@ MagickExport MagickBooleanType DrawImage(Image *image,const DrawInfo *draw_info)
         if (LocaleCompare("font-size",keyword) == 0)
           {
             GetMagickToken(q,&q,token);
-            graphic_context[n]->pointsize=LocaleToDouble(token,(char **) NULL);
+            graphic_context[n]->pointsize=InterpretLocaleValue(token,
+              (char **) NULL);
             break;
           }
         if (LocaleCompare("font-stretch",keyword) == 0)
@@ -2152,13 +2154,15 @@ MagickExport MagickBooleanType DrawImage(Image *image,const DrawInfo *draw_info)
         if (LocaleCompare("interline-spacing",keyword) == 0)
           {
             GetMagickToken(q,&q,token);
-            graphic_context[n]->interline_spacing=LocaleToDouble(token,(char **) NULL);
+            graphic_context[n]->interline_spacing=InterpretLocaleValue(token,
+              (char **) NULL);
             break;
           }
         if (LocaleCompare("interword-spacing",keyword) == 0)
           {
             GetMagickToken(q,&q,token);
-            graphic_context[n]->interword_spacing=LocaleToDouble(token,(char **) NULL);
+            graphic_context[n]->interword_spacing=InterpretLocaleValue(token,
+              (char **) NULL);
             break;
           }
         status=MagickFalse;
@@ -2170,7 +2174,8 @@ MagickExport MagickBooleanType DrawImage(Image *image,const DrawInfo *draw_info)
         if (LocaleCompare("kerning",keyword) == 0)
           {
             GetMagickToken(q,&q,token);
-            graphic_context[n]->kerning=LocaleToDouble(token,(char **) NULL);
+            graphic_context[n]->kerning=InterpretLocaleValue(token,
+              (char **) NULL);
             break;
           }
         status=MagickFalse;
@@ -2212,7 +2217,7 @@ MagickExport MagickBooleanType DrawImage(Image *image,const DrawInfo *draw_info)
             factor=strchr(token,'%') != (char *) NULL ? 0.01 : 1.0;
             graphic_context[n]->opacity=ClampToQuantum((MagickRealType)
               QuantumRange*(1.0-((1.0-QuantumScale*graphic_context[n]->opacity)*
-              factor*LocaleToDouble(token,(char **) NULL))));
+              factor*InterpretLocaleValue(token,(char **) NULL))));
             graphic_context[n]->fill.opacity=graphic_context[n]->opacity;
             graphic_context[n]->stroke.opacity=graphic_context[n]->opacity;
             break;
@@ -2315,19 +2320,19 @@ MagickExport MagickBooleanType DrawImage(Image *image,const DrawInfo *draw_info)
                 GetMagickToken(q,&q,token);
                 (void) CopyMagickString(type,token,MaxTextExtent);
                 GetMagickToken(q,&q,token);
-                segment.x1=LocaleToDouble(token,(char **) NULL);
+                segment.x1=InterpretLocaleValue(token,(char **) NULL);
                 GetMagickToken(q,&q,token);
                 if (*token == ',')
                   GetMagickToken(q,&q,token);
-                segment.y1=LocaleToDouble(token,(char **) NULL);
+                segment.y1=InterpretLocaleValue(token,(char **) NULL);
                 GetMagickToken(q,&q,token);
                 if (*token == ',')
                   GetMagickToken(q,&q,token);
-                segment.x2=LocaleToDouble(token,(char **) NULL);
+                segment.x2=InterpretLocaleValue(token,(char **) NULL);
                 GetMagickToken(q,&q,token);
                 if (*token == ',')
                   GetMagickToken(q,&q,token);
-                segment.y2=LocaleToDouble(token,(char **) NULL);
+                segment.y2=InterpretLocaleValue(token,(char **) NULL);
                 if (LocaleCompare(type,"radial") == 0)
                   {
                     GetMagickToken(q,&q,token);
@@ -2377,19 +2382,23 @@ MagickExport MagickBooleanType DrawImage(Image *image,const DrawInfo *draw_info)
                 GetMagickToken(q,&q,token);
                 (void) CopyMagickString(name,token,MaxTextExtent);
                 GetMagickToken(q,&q,token);
-                bounds.x=(ssize_t) ceil(LocaleToDouble(token,(char **) NULL)-0.5);
+                bounds.x=(ssize_t) ceil(InterpretLocaleValue(token,
+                  (char **) NULL)-0.5);
                 GetMagickToken(q,&q,token);
                 if (*token == ',')
                   GetMagickToken(q,&q,token);
-                bounds.y=(ssize_t) ceil(LocaleToDouble(token,(char **) NULL)-0.5);
+                bounds.y=(ssize_t) ceil(InterpretLocaleValue(token,
+                  (char **) NULL)-0.5);
                 GetMagickToken(q,&q,token);
                 if (*token == ',')
                   GetMagickToken(q,&q,token);
-                bounds.width=(size_t) floor(LocaleToDouble(token,(char **) NULL)+0.5);
+                bounds.width=(size_t) floor(InterpretLocaleValue(token,
+                  (char **) NULL)+0.5);
                 GetMagickToken(q,&q,token);
                 if (*token == ',')
                   GetMagickToken(q,&q,token);
-                bounds.height=(size_t) floor(LocaleToDouble(token,(char **) NULL)+0.5);
+                bounds.height=(size_t) floor(InterpretLocaleValue(token,
+                  (char **) NULL)+0.5);
                 for (p=q; *q != '\0'; )
                 {
                   GetMagickToken(q,&q,token);
@@ -2446,7 +2455,7 @@ MagickExport MagickBooleanType DrawImage(Image *image,const DrawInfo *draw_info)
         if (LocaleCompare("rotate",keyword) == 0)
           {
             GetMagickToken(q,&q,token);
-            angle=LocaleToDouble(token,(char **) NULL);
+            angle=InterpretLocaleValue(token,(char **) NULL);
             affine.sx=cos(DegreesToRadians(fmod((double) angle,360.0)));
             affine.rx=sin(DegreesToRadians(fmod((double) angle,360.0)));
             affine.ry=(-sin(DegreesToRadians(fmod((double) angle,360.0))));
@@ -2467,24 +2476,24 @@ MagickExport MagickBooleanType DrawImage(Image *image,const DrawInfo *draw_info)
         if (LocaleCompare("scale",keyword) == 0)
           {
             GetMagickToken(q,&q,token);
-            affine.sx=LocaleToDouble(token,(char **) NULL);
+            affine.sx=InterpretLocaleValue(token,(char **) NULL);
             GetMagickToken(q,&q,token);
             if (*token == ',')
               GetMagickToken(q,&q,token);
-            affine.sy=LocaleToDouble(token,(char **) NULL);
+            affine.sy=InterpretLocaleValue(token,(char **) NULL);
             break;
           }
         if (LocaleCompare("skewX",keyword) == 0)
           {
             GetMagickToken(q,&q,token);
-            angle=LocaleToDouble(token,(char **) NULL);
+            angle=InterpretLocaleValue(token,(char **) NULL);
             affine.ry=sin(DegreesToRadians(angle));
             break;
           }
         if (LocaleCompare("skewY",keyword) == 0)
           {
             GetMagickToken(q,&q,token);
-            angle=LocaleToDouble(token,(char **) NULL);
+            angle=InterpretLocaleValue(token,(char **) NULL);
             affine.rx=(-tan(DegreesToRadians(angle)/2.0));
             break;
           }
@@ -2570,7 +2579,8 @@ MagickExport MagickBooleanType DrawImage(Image *image,const DrawInfo *draw_info)
                   GetMagickToken(q,&q,token);
                   if (*token == ',')
                     GetMagickToken(q,&q,token);
-                  graphic_context[n]->dash_pattern[j]=LocaleToDouble(token,(char **) NULL);
+                  graphic_context[n]->dash_pattern[j]=InterpretLocaleValue(
+                    token,(char **) NULL);
                 }
                 if ((x & 0x01) != 0)
                   for ( ; j < (2*x); j++)
@@ -2585,7 +2595,8 @@ MagickExport MagickBooleanType DrawImage(Image *image,const DrawInfo *draw_info)
         if (LocaleCompare("stroke-dashoffset",keyword) == 0)
           {
             GetMagickToken(q,&q,token);
-            graphic_context[n]->dash_offset=LocaleToDouble(token,(char **) NULL);
+            graphic_context[n]->dash_offset=InterpretLocaleValue(token,
+              (char **) NULL);
             break;
           }
         if (LocaleCompare("stroke-linecap",keyword) == 0)
@@ -2629,13 +2640,15 @@ MagickExport MagickBooleanType DrawImage(Image *image,const DrawInfo *draw_info)
             GetMagickToken(q,&q,token);
             factor=strchr(token,'%') != (char *) NULL ? 0.01 : 1.0;
             graphic_context[n]->stroke.opacity=ClampToQuantum((MagickRealType)
-              QuantumRange*(1.0-factor*LocaleToDouble(token,(char **) NULL)));
+              QuantumRange*(1.0-factor*InterpretLocaleValue(token,
+              (char **) NULL)));
             break;
           }
         if (LocaleCompare("stroke-width",keyword) == 0)
           {
             GetMagickToken(q,&q,token);
-            graphic_context[n]->stroke_width=LocaleToDouble(token,(char **) NULL);
+            graphic_context[n]->stroke_width=InterpretLocaleValue(token,
+              (char **) NULL);
             break;
           }
         status=MagickFalse;
@@ -2696,11 +2709,11 @@ MagickExport MagickBooleanType DrawImage(Image *image,const DrawInfo *draw_info)
         if (LocaleCompare("translate",keyword) == 0)
           {
             GetMagickToken(q,&q,token);
-            affine.tx=LocaleToDouble(token,(char **) NULL);
+            affine.tx=InterpretLocaleValue(token,(char **) NULL);
             GetMagickToken(q,&q,token);
             if (*token == ',')
               GetMagickToken(q,&q,token);
-            affine.ty=LocaleToDouble(token,(char **) NULL);
+            affine.ty=InterpretLocaleValue(token,(char **) NULL);
             break;
           }
         status=MagickFalse;
@@ -2712,23 +2725,23 @@ MagickExport MagickBooleanType DrawImage(Image *image,const DrawInfo *draw_info)
         if (LocaleCompare("viewbox",keyword) == 0)
           {
             GetMagickToken(q,&q,token);
-            graphic_context[n]->viewbox.x=(ssize_t) ceil(LocaleToDouble(token,(char **) NULL)-
-              0.5);
+            graphic_context[n]->viewbox.x=(ssize_t) ceil(InterpretLocaleValue(
+              token,(char **) NULL)-0.5);
             GetMagickToken(q,&q,token);
             if (*token == ',')
               GetMagickToken(q,&q,token);
-            graphic_context[n]->viewbox.y=(ssize_t) ceil(LocaleToDouble(token,(char **) NULL)-
-              0.5);
+            graphic_context[n]->viewbox.y=(ssize_t) ceil(InterpretLocaleValue(
+              token,(char **) NULL)-0.5);
             GetMagickToken(q,&q,token);
             if (*token == ',')
               GetMagickToken(q,&q,token);
             graphic_context[n]->viewbox.width=(size_t) floor(
-              LocaleToDouble(token,(char **) NULL)+0.5);
+              InterpretLocaleValue(token,(char **) NULL)+0.5);
             GetMagickToken(q,&q,token);
             if (*token == ',')
               GetMagickToken(q,&q,token);
             graphic_context[n]->viewbox.height=(size_t) floor(
-              LocaleToDouble(token,(char **) NULL)+0.5);
+              InterpretLocaleValue(token,(char **) NULL)+0.5);
             break;
           }
         status=MagickFalse;
@@ -2776,11 +2789,11 @@ MagickExport MagickBooleanType DrawImage(Image *image,const DrawInfo *draw_info)
       if (IsPoint(q) == MagickFalse)
         break;
       GetMagickToken(q,&q,token);
-      point.x=LocaleToDouble(token,(char **) NULL);
+      point.x=InterpretLocaleValue(token,(char **) NULL);
       GetMagickToken(q,&q,token);
       if (*token == ',')
         GetMagickToken(q,&q,token);
-      point.y=LocaleToDouble(token,(char **) NULL);
+      point.y=InterpretLocaleValue(token,(char **) NULL);
       GetMagickToken(q,(const char **) NULL,token);
       if (*token == ',')
         GetMagickToken(q,&q,token);
@@ -2862,7 +2875,7 @@ MagickExport MagickBooleanType DrawImage(Image *image,const DrawInfo *draw_info)
           double
             value;
 
-          value=LocaleToDouble(s,&t);
+          value=InterpretLocaleValue(s,&t);
           (void) value;
           if (s == t)
             {
@@ -4759,14 +4772,14 @@ MagickExport void GetDrawInfo(const ImageInfo *image_info,DrawInfo *draw_info)
     (void) CloneString(&draw_info->encoding,option);
   option=GetImageOption(clone_info,"kerning");
   if (option != (const char *) NULL)
-    draw_info->kerning=LocaleToDouble(option,(char **) NULL);
+    draw_info->kerning=InterpretLocaleValue(option,(char **) NULL);
   option=GetImageOption(clone_info,"interline-spacing");
   if (option != (const char *) NULL)
-    draw_info->interline_spacing=LocaleToDouble(option,(char **) NULL);
+    draw_info->interline_spacing=InterpretLocaleValue(option,(char **) NULL);
   draw_info->direction=UndefinedDirection;
   option=GetImageOption(clone_info,"interword-spacing");
   if (option != (const char *) NULL)
-    draw_info->interword_spacing=LocaleToDouble(option,(char **) NULL);
+    draw_info->interword_spacing=InterpretLocaleValue(option,(char **) NULL);
   option=GetImageOption(clone_info,"direction");
   if (option != (const char *) NULL)
     draw_info->direction=(DirectionType) ParseCommandOption(
@@ -4779,7 +4792,7 @@ MagickExport void GetDrawInfo(const ImageInfo *image_info,DrawInfo *draw_info)
     (void) QueryColorDatabase(option,&draw_info->stroke,exception);
   option=GetImageOption(clone_info,"strokewidth");
   if (option != (const char *) NULL)
-    draw_info->stroke_width=LocaleToDouble(option,(char **) NULL);
+    draw_info->stroke_width=InterpretLocaleValue(option,(char **) NULL);
   option=GetImageOption(clone_info,"undercolor");
   if (option != (const char *) NULL)
     (void) QueryColorDatabase(option,&draw_info->undercolor,exception);
@@ -5256,15 +5269,15 @@ static size_t TracePath(PrimitiveInfo *primitive_info,const char *path)
           GetMagickToken(p,&p,token);
           if (*token == ',')
             GetMagickToken(p,&p,token);
-          arc.x=LocaleToDouble(token,(char **) NULL);
+          arc.x=InterpretLocaleValue(token,(char **) NULL);
           GetMagickToken(p,&p,token);
           if (*token == ',')
             GetMagickToken(p,&p,token);
-          arc.y=LocaleToDouble(token,(char **) NULL);
+          arc.y=InterpretLocaleValue(token,(char **) NULL);
           GetMagickToken(p,&p,token);
           if (*token == ',')
             GetMagickToken(p,&p,token);
-          angle=LocaleToDouble(token,(char **) NULL);
+          angle=InterpretLocaleValue(token,(char **) NULL);
           GetMagickToken(p,&p,token);
           if (*token == ',')
             GetMagickToken(p,&p,token);
@@ -5276,11 +5289,11 @@ static size_t TracePath(PrimitiveInfo *primitive_info,const char *path)
           GetMagickToken(p,&p,token);
           if (*token == ',')
             GetMagickToken(p,&p,token);
-          x=LocaleToDouble(token,(char **) NULL);
+          x=InterpretLocaleValue(token,(char **) NULL);
           GetMagickToken(p,&p,token);
           if (*token == ',')
             GetMagickToken(p,&p,token);
-          y=LocaleToDouble(token,(char **) NULL);
+          y=InterpretLocaleValue(token,(char **) NULL);
           end.x=(double) (attribute == (int) 'A' ? x : point.x+x);
           end.y=(double) (attribute == (int) 'A' ? y : point.y+y);
           TraceArcPath(q,point,end,arc,angle,large_arc,sweep);
@@ -5303,11 +5316,11 @@ static size_t TracePath(PrimitiveInfo *primitive_info,const char *path)
             GetMagickToken(p,&p,token);
             if (*token == ',')
               GetMagickToken(p,&p,token);
-            x=LocaleToDouble(token,(char **) NULL);
+            x=InterpretLocaleValue(token,(char **) NULL);
             GetMagickToken(p,&p,token);
             if (*token == ',')
               GetMagickToken(p,&p,token);
-            y=LocaleToDouble(token,(char **) NULL);
+            y=InterpretLocaleValue(token,(char **) NULL);
             end.x=(double) (attribute == (int) 'C' ? x : point.x+x);
             end.y=(double) (attribute == (int) 'C' ? y : point.y+y);
             points[i]=end;
@@ -5328,7 +5341,7 @@ static size_t TracePath(PrimitiveInfo *primitive_info,const char *path)
           GetMagickToken(p,&p,token);
           if (*token == ',')
             GetMagickToken(p,&p,token);
-          x=LocaleToDouble(token,(char **) NULL);
+          x=InterpretLocaleValue(token,(char **) NULL);
           point.x=(double) (attribute == (int) 'H' ? x: point.x+x);
           TracePoint(q,point);
           q+=q->coordinates;
@@ -5343,11 +5356,11 @@ static size_t TracePath(PrimitiveInfo *primitive_info,const char *path)
           GetMagickToken(p,&p,token);
           if (*token == ',')
             GetMagickToken(p,&p,token);
-          x=LocaleToDouble(token,(char **) NULL);
+          x=InterpretLocaleValue(token,(char **) NULL);
           GetMagickToken(p,&p,token);
           if (*token == ',')
             GetMagickToken(p,&p,token);
-          y=LocaleToDouble(token,(char **) NULL);
+          y=InterpretLocaleValue(token,(char **) NULL);
           point.x=(double) (attribute == (int) 'L' ? x : point.x+x);
           point.y=(double) (attribute == (int) 'L' ? y : point.y+y);
           TracePoint(q,point);
@@ -5370,11 +5383,11 @@ static size_t TracePath(PrimitiveInfo *primitive_info,const char *path)
           GetMagickToken(p,&p,token);
           if (*token == ',')
             GetMagickToken(p,&p,token);
-          x=LocaleToDouble(token,(char **) NULL);
+          x=InterpretLocaleValue(token,(char **) NULL);
           GetMagickToken(p,&p,token);
           if (*token == ',')
             GetMagickToken(p,&p,token);
-          y=LocaleToDouble(token,(char **) NULL);
+          y=InterpretLocaleValue(token,(char **) NULL);
           point.x=(double) (attribute == (int) 'M' ? x : point.x+x);
           point.y=(double) (attribute == (int) 'M' ? y : point.y+y);
           if (i == 0)
@@ -5404,11 +5417,11 @@ static size_t TracePath(PrimitiveInfo *primitive_info,const char *path)
             GetMagickToken(p,&p,token);
             if (*token == ',')
               GetMagickToken(p,&p,token);
-            x=LocaleToDouble(token,(char **) NULL);
+            x=InterpretLocaleValue(token,(char **) NULL);
             GetMagickToken(p,&p,token);
             if (*token == ',')
               GetMagickToken(p,&p,token);
-            y=LocaleToDouble(token,(char **) NULL);
+            y=InterpretLocaleValue(token,(char **) NULL);
             if (*p == ',')
               p++;
             end.x=(double) (attribute == (int) 'Q' ? x : point.x+x);
@@ -5439,11 +5452,11 @@ static size_t TracePath(PrimitiveInfo *primitive_info,const char *path)
             GetMagickToken(p,&p,token);
             if (*token == ',')
               GetMagickToken(p,&p,token);
-            x=LocaleToDouble(token,(char **) NULL);
+            x=InterpretLocaleValue(token,(char **) NULL);
             GetMagickToken(p,&p,token);
             if (*token == ',')
               GetMagickToken(p,&p,token);
-            y=LocaleToDouble(token,(char **) NULL);
+            y=InterpretLocaleValue(token,(char **) NULL);
             if (*p == ',')
               p++;
             end.x=(double) (attribute == (int) 'S' ? x : point.x+x);
@@ -5479,11 +5492,11 @@ static size_t TracePath(PrimitiveInfo *primitive_info,const char *path)
             GetMagickToken(p,&p,token);
             if (*token == ',')
               GetMagickToken(p,&p,token);
-            x=LocaleToDouble(token,(char **) NULL);
+            x=InterpretLocaleValue(token,(char **) NULL);
             GetMagickToken(p,&p,token);
             if (*token == ',')
               GetMagickToken(p,&p,token);
-            y=LocaleToDouble(token,(char **) NULL);
+            y=InterpretLocaleValue(token,(char **) NULL);
             end.x=(double) (attribute == (int) 'T' ? x : point.x+x);
             end.y=(double) (attribute == (int) 'T' ? y : point.y+y);
             points[i]=end;
@@ -5509,7 +5522,7 @@ static size_t TracePath(PrimitiveInfo *primitive_info,const char *path)
           GetMagickToken(p,&p,token);
           if (*token == ',')
             GetMagickToken(p,&p,token);
-          y=LocaleToDouble(token,(char **) NULL);
+          y=InterpretLocaleValue(token,(char **) NULL);
           point.y=(double) (attribute == (int) 'V' ? y : point.y+y);
           TracePoint(q,point);
           q+=q->coordinates;