]> granicus.if.org Git - imagemagick/blobdiff - MagickCore/draw.c
(no commit message)
[imagemagick] / MagickCore / draw.c
index 81b2e73ded3ca2be67e195bf7097fecc843f52d2..448024f1103a68248836b6786a485e1f88544b3a 100644 (file)
@@ -215,9 +215,9 @@ MagickExport DrawInfo *AcquireDrawInfo(void)
 %                                                                             %
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 %
-%  CloneDrawInfo() makes a copy of the given draw info structure.  If NULL
-%  is specified, a new image info structure is created initialized to
-%  default values.
+%  CloneDrawInfo() makes a copy of the given draw_info structure.  If NULL
+%  is specified, a new draw_info structure is created initialized to
+%  default values, according to the given image_info.
 %
 %  The format of the CloneDrawInfo method is:
 %
@@ -1148,7 +1148,8 @@ MagickExport MagickBooleanType DrawAffineImage(Image *image,
   /*
     Affine transform image.
   */
-  if (SetImageStorageClass(image,DirectClass) == MagickFalse)
+  exception=(&image->exception);
+  if (SetImageStorageClass(image,DirectClass,exception) == MagickFalse)
     return(MagickFalse);
   status=MagickTrue;
   edge.x1=MagickMax(min.x,0.0);
@@ -1157,7 +1158,6 @@ MagickExport MagickBooleanType DrawAffineImage(Image *image,
   edge.y2=MagickMin(max.y,(double) image->rows-1.0);
   inverse_affine=InverseAffineMatrix(affine);
   GetPixelInfo(image,&zero);
-  exception=(&image->exception);
   image_view=AcquireCacheView(image);
   source_view=AcquireCacheView(source);
 #if defined(MAGICKCORE_OPENMP_SUPPORT)
@@ -1273,7 +1273,8 @@ static void DrawBoundingRectangles(Image *image,const DrawInfo *draw_info,
     coordinates;
 
   clone_info=CloneDrawInfo((ImageInfo *) NULL,draw_info);
-  (void) QueryColorDatabase("#0000",&clone_info->fill,&image->exception);
+  (void) QueryColorCompliance("#0000",AllCompliance,&clone_info->fill,
+    &image->exception);
   resolution.x=DefaultResolution;
   resolution.y=DefaultResolution;
   if (clone_info->density != (char *) NULL)
@@ -1325,10 +1326,10 @@ static void DrawBoundingRectangles(Image *image,const DrawInfo *draw_info,
       for (i=0; i < (ssize_t) polygon_info->number_edges; i++)
       {
         if (polygon_info->edges[i].direction != 0)
-          (void) QueryColorDatabase("red",&clone_info->stroke,
+          (void) QueryColorCompliance("red",AllCompliance,&clone_info->stroke,
             &image->exception);
         else
-          (void) QueryColorDatabase("green",&clone_info->stroke,
+          (void) QueryColorCompliance("green",AllCompliance,&clone_info->stroke,
             &image->exception);
         start.x=(double) (polygon_info->edges[i].bounds.x1-mid);
         start.y=(double) (polygon_info->edges[i].bounds.y1-mid);
@@ -1342,7 +1343,8 @@ static void DrawBoundingRectangles(Image *image,const DrawInfo *draw_info,
         (void) DrawPrimitive(image,clone_info,primitive_info);
       }
     }
-  (void) QueryColorDatabase("blue",&clone_info->stroke,&image->exception);
+  (void) QueryColorCompliance("blue",AllCompliance,&clone_info->stroke,
+    &image->exception);
   start.x=(double) (bounds.x1-mid);
   start.y=(double) (bounds.y1-mid);
   end.x=(double) (bounds.x2+mid);
@@ -1372,7 +1374,7 @@ static void DrawBoundingRectangles(Image *image,const DrawInfo *draw_info,
 %  The format of the DrawClipPath method is:
 %
 %      MagickBooleanType DrawClipPath(Image *image,const DrawInfo *draw_info,
-%        const char *name)
+%        const char *name,ExceptionInfo *exception)
 %
 %  A description of each parameter follows:
 %
@@ -1382,9 +1384,11 @@ static void DrawBoundingRectangles(Image *image,const DrawInfo *draw_info,
 %
 %    o name: the name of the clip path.
 %
+%    o exception: return any errors or warnings in this structure.
+%
 */
 MagickExport MagickBooleanType DrawClipPath(Image *image,
-  const DrawInfo *draw_info,const char *name)
+  const DrawInfo *draw_info,const char *name,ExceptionInfo *exception)
 {
   char
     clip_mask[MaxTextExtent];
@@ -1416,11 +1420,11 @@ MagickExport MagickBooleanType DrawClipPath(Image *image,
         &image->exception);
       if (clip_mask == (Image *) NULL)
         return(MagickFalse);
-      (void) SetImageClipMask(image,clip_mask);
+      (void) SetImageClipMask(image,clip_mask,exception);
       clip_mask=DestroyImage(clip_mask);
     }
-  (void) QueryColorDatabase("#00000000",&image->clip_mask->background_color,
-    &image->exception);
+  (void) QueryColorCompliance("#00000000",AllCompliance,
+    &image->clip_mask->background_color,&image->exception);
   image->clip_mask->background_color.alpha=(Quantum) TransparentAlpha;
   (void) SetImageBackgroundColor(image->clip_mask);
   if (image->debug != MagickFalse)
@@ -1428,10 +1432,11 @@ MagickExport MagickBooleanType DrawClipPath(Image *image,
       draw_info->clip_mask);
   clone_info=CloneDrawInfo((ImageInfo *) NULL,draw_info);
   (void) CloneString(&clone_info->primitive,value);
-  (void) QueryColorDatabase("#ffffff",&clone_info->fill,&image->exception);
+  (void) QueryColorCompliance("#ffffff",AllCompliance,&clone_info->fill,
+    &image->exception);
   clone_info->clip_mask=(char *) NULL;
-  status=DrawImage(image->clip_mask,clone_info);
-  status|=NegateImage(image->clip_mask,MagickFalse);
+  status=DrawImage(image->clip_mask,clone_info,exception);
+  status|=NegateImage(image->clip_mask,MagickFalse,&image->exception);
   clone_info=DestroyDrawInfo(clone_info);
   if (image->debug != MagickFalse)
     (void) LogMagickEvent(DrawEvent,GetMagickModule(),"end clip-path");
@@ -1628,7 +1633,8 @@ static MagickBooleanType DrawDashPolygon(const DrawInfo *draw_info,
 %
 %  The format of the DrawImage method is:
 %
-%      MagickBooleanType DrawImage(Image *image,const DrawInfo *draw_info)
+%      MagickBooleanType DrawImage(Image *image,const DrawInfo *draw_info,
+%        ExceptionInfo *exception)
 %
 %  A description of each parameter follows:
 %
@@ -1636,6 +1642,8 @@ static MagickBooleanType DrawDashPolygon(const DrawInfo *draw_info,
 %
 %    o draw_info: the draw info.
 %
+%    o exception: return any errors or warnings in this structure.
+%
 */
 
 static inline MagickBooleanType IsPoint(const char *point)
@@ -1657,7 +1665,8 @@ static inline void TracePoint(PrimitiveInfo *primitive_info,
   primitive_info->point=point;
 }
 
-MagickExport MagickBooleanType DrawImage(Image *image,const DrawInfo *draw_info)
+MagickExport MagickBooleanType DrawImage(Image *image,const DrawInfo *draw_info,
+  ExceptionInfo *exception)
 {
 #define RenderImageTag  "Render/Image"
 
@@ -1776,8 +1785,9 @@ MagickExport MagickBooleanType DrawImage(Image *image,const DrawInfo *draw_info)
       graphic_context[n]->viewbox.height=image->rows;
     }
   token=AcquireString(primitive);
-  (void) QueryColorDatabase("#000000",&start_color,&image->exception);
-  if (SetImageStorageClass(image,DirectClass) == MagickFalse)
+  (void) QueryColorCompliance("#000000",AllCompliance,&start_color,
+    &image->exception);
+  if (SetImageStorageClass(image,DirectClass,&image->exception) == MagickFalse)
     return(MagickFalse);
   status=MagickTrue;
   for (q=primitive; *q != '\0'; )
@@ -1853,8 +1863,8 @@ MagickExport MagickBooleanType DrawImage(Image *image,const DrawInfo *draw_info)
         if (LocaleCompare("border-color",keyword) == 0)
           {
             GetMagickToken(q,&q,token);
-            (void) QueryColorDatabase(token,&graphic_context[n]->border_color,
-              &image->exception);
+            (void) QueryColorCompliance(token,AllCompliance,
+              &graphic_context[n]->border_color,&image->exception);
             break;
           }
         status=MagickFalse;
@@ -1871,7 +1881,7 @@ MagickExport MagickBooleanType DrawImage(Image *image,const DrawInfo *draw_info)
             GetMagickToken(q,&q,token);
             (void) CloneString(&graphic_context[n]->clip_mask,token);
             (void) DrawClipPath(image,graphic_context[n],
-              graphic_context[n]->clip_mask);
+              graphic_context[n]->clip_mask,exception);
             break;
           }
         if (LocaleCompare("clip-rule",keyword) == 0)
@@ -1976,11 +1986,11 @@ MagickExport MagickBooleanType DrawImage(Image *image,const DrawInfo *draw_info)
             (void) FormatLocaleString(pattern,MaxTextExtent,"%s",token);
             if (GetImageArtifact(image,pattern) != (const char *) NULL)
               (void) DrawPatternPath(image,draw_info,token,
-                &graphic_context[n]->fill_pattern);
+                &graphic_context[n]->fill_pattern,exception);
             else
               {
-                status=QueryColorDatabase(token,&graphic_context[n]->fill,
-                  &image->exception);
+                status=QueryColorCompliance(token,AllCompliance,
+                  &graphic_context[n]->fill,&image->exception);
                 if (status == MagickFalse)
                   {
                     ImageInfo
@@ -2002,8 +2012,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.alpha=ClampToQuantum((MagickRealType)
-              QuantumRange*(1.0-factor*InterpretLocaleValue(token,
-              (char **) NULL)));
+              QuantumRange*factor*InterpretLocaleValue(token,
+              (char **) NULL));
             break;
           }
         if (LocaleCompare("fill-rule",keyword) == 0)
@@ -2259,7 +2269,7 @@ MagickExport MagickBooleanType DrawImage(Image *image,const DrawInfo *draw_info)
                 if (graphic_context[n]->clip_mask != (char *) NULL)
                   if (LocaleCompare(graphic_context[n]->clip_mask,
                       graphic_context[n-1]->clip_mask) != 0)
-                    (void) SetImageClipMask(image,(Image *) NULL);
+                    (void) SetImageClipMask(image,(Image *) NULL,exception);
                 graphic_context[n]=DestroyDrawInfo(graphic_context[n]);
                 n--;
                 break;
@@ -2492,9 +2502,10 @@ MagickExport MagickBooleanType DrawImage(Image *image,const DrawInfo *draw_info)
               stop_color;
 
             GetMagickToken(q,&q,token);
-            (void) QueryColorDatabase(token,&stop_color,&image->exception);
+            (void) QueryColorCompliance(token,AllCompliance,&stop_color,
+              &image->exception);
             (void) GradientImage(image,LinearGradient,ReflectSpread,
-              &start_color,&stop_color);
+              &start_color,&stop_color,&image->exception);
             start_color=stop_color;
             GetMagickToken(q,&q,token);
             break;
@@ -2505,11 +2516,11 @@ MagickExport MagickBooleanType DrawImage(Image *image,const DrawInfo *draw_info)
             (void) FormatLocaleString(pattern,MaxTextExtent,"%s",token);
             if (GetImageArtifact(image,pattern) != (const char *) NULL)
               (void) DrawPatternPath(image,draw_info,token,
-                &graphic_context[n]->stroke_pattern);
+                &graphic_context[n]->stroke_pattern,exception);
             else
               {
-                status=QueryColorDatabase(token,&graphic_context[n]->stroke,
-                  &image->exception);
+                status=QueryColorCompliance(token,AllCompliance,
+                  &graphic_context[n]->stroke,&image->exception);
                 if (status == MagickFalse)
                   {
                     ImageInfo
@@ -2629,8 +2640,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]->stroke.alpha=ClampToQuantum((MagickRealType)
-              QuantumRange*(1.0-factor*InterpretLocaleValue(token,
-              (char **) NULL)));
+              QuantumRange*factor*InterpretLocaleValue(token,
+              (char **) NULL));
             break;
           }
         if (LocaleCompare("stroke-width",keyword) == 0)
@@ -2691,8 +2702,8 @@ MagickExport MagickBooleanType DrawImage(Image *image,const DrawInfo *draw_info)
         if (LocaleCompare("text-undercolor",keyword) == 0)
           {
             GetMagickToken(q,&q,token);
-            (void) QueryColorDatabase(token,&graphic_context[n]->undercolor,
-              &image->exception);
+            (void) QueryColorCompliance(token,AllCompliance,
+              &graphic_context[n]->undercolor,&image->exception);
             break;
           }
         if (LocaleCompare("translate",keyword) == 0)
@@ -3106,7 +3117,7 @@ MagickExport MagickBooleanType DrawImage(Image *image,const DrawInfo *draw_info)
             (LocaleCompare(graphic_context[n]->clip_mask,
              graphic_context[n-1]->clip_mask) != 0))
           (void) DrawClipPath(image,graphic_context[n],
-            graphic_context[n]->clip_mask);
+            graphic_context[n]->clip_mask,exception);
         (void) DrawPrimitive(image,graphic_context[n],primitive_info);
       }
     if (primitive_info->text != (char *) NULL)
@@ -3464,7 +3475,7 @@ MagickExport MagickBooleanType DrawGradientImage(Image *image,
 %  The format of the DrawPatternPath method is:
 %
 %      MagickBooleanType DrawPatternPath(Image *image,const DrawInfo *draw_info,
-%        const char *name,Image **pattern)
+%        const char *name,Image **pattern,ExceptionInfo *exception)
 %
 %  A description of each parameter follows:
 %
@@ -3476,9 +3487,12 @@ MagickExport MagickBooleanType DrawGradientImage(Image *image,
 %
 %    o image: the image.
 %
+%    o exception: return any errors or warnings in this structure.
+%
 */
 MagickExport MagickBooleanType DrawPatternPath(Image *image,
-  const DrawInfo *draw_info,const char *name,Image **pattern)
+  const DrawInfo *draw_info,const char *name,Image **pattern,
+  ExceptionInfo *exception)
 {
   char
     property[MaxTextExtent];
@@ -3514,10 +3528,10 @@ MagickExport MagickBooleanType DrawPatternPath(Image *image,
     *pattern=DestroyImage(*pattern);
   image_info=AcquireImageInfo();
   image_info->size=AcquireString(geometry);
-  *pattern=AcquireImage(image_info);
+  *pattern=AcquireImage(image_info,&image->exception);
   image_info=DestroyImageInfo(image_info);
-  (void) QueryColorDatabase("#00000000",&(*pattern)->background_color,
-    &image->exception);
+  (void) QueryColorCompliance("#00000000",AllCompliance,
+    &(*pattern)->background_color,&image->exception);
   (void) SetImageBackgroundColor(*pattern);
   if (image->debug != MagickFalse)
     (void) LogMagickEvent(DrawEvent,GetMagickModule(),
@@ -3526,7 +3540,7 @@ MagickExport MagickBooleanType DrawPatternPath(Image *image,
   clone_info->fill_pattern=NewImageList();
   clone_info->stroke_pattern=NewImageList();
   (void) CloneString(&clone_info->primitive,path);
-  status=DrawImage(*pattern,clone_info);
+  status=DrawImage(*pattern,clone_info,exception);
   clone_info=DestroyDrawInfo(clone_info);
   if (image->debug != MagickFalse)
     (void) LogMagickEvent(DrawEvent,GetMagickModule(),"end pattern-path");
@@ -3902,7 +3916,7 @@ static MagickBooleanType DrawPolygonPrimitive(Image *image,
           if ((x == (ssize_t) ceil(primitive_info->point.x-0.5)) &&
               (y == (ssize_t) ceil(primitive_info->point.y-0.5)))
             {
-              (void) GetStrokeColor(draw_info,x,y,&pixel);
+              (void) GetStrokeColor(draw_info,x,y,&pixel,exception);
               SetPixelPacket(image,&pixel,q);
             }
           q+=GetPixelChannels(image);
@@ -3922,7 +3936,7 @@ static MagickBooleanType DrawPolygonPrimitive(Image *image,
     Draw polygon or line.
   */
   if (image->matte == MagickFalse)
-    (void) SetImageAlphaChannel(image,OpaqueAlphaChannel);
+    (void) SetImageAlphaChannel(image,OpaqueAlphaChannel,exception);
 #if defined(MAGICKCORE_OPENMP_SUPPORT)
   #pragma omp parallel for schedule(dynamic,4) shared(status)
 #endif
@@ -3966,11 +3980,11 @@ static MagickBooleanType DrawPolygonPrimitive(Image *image,
           fill_opacity=fill_opacity > 0.25 ? 1.0 : 0.0;
           stroke_opacity=stroke_opacity > 0.25 ? 1.0 : 0.0;
         }
-      (void) GetFillColor(draw_info,x,y,&fill_color);
+      (void) GetFillColor(draw_info,x,y,&fill_color,exception);
       fill_opacity=fill_opacity*fill_color.alpha;
       CompositePixelOver(image,&fill_color,fill_opacity,q,(MagickRealType)
         GetPixelAlpha(image,q),q);
-      (void) GetStrokeColor(draw_info,x,y,&stroke_color);
+      (void) GetStrokeColor(draw_info,x,y,&stroke_color,exception);
       stroke_opacity=stroke_opacity*stroke_color.alpha;
       CompositePixelOver(image,&stroke_color,stroke_opacity,q,(MagickRealType)
         GetPixelAlpha(image,q),q);
@@ -4166,7 +4180,7 @@ MagickExport MagickBooleanType DrawPrimitive(Image *image,
       q=GetCacheViewAuthenticPixels(image_view,x,y,1,1,exception);
       if (q == (Quantum *) NULL)
         break;
-      (void) GetFillColor(draw_info,x,y,&fill_color);
+      (void) GetFillColor(draw_info,x,y,&fill_color,exception);
       CompositePixelOver(image,&fill_color,(MagickRealType) fill_color.alpha,q,
         (MagickRealType) GetPixelAlpha(image,q),q);
       (void) SyncCacheViewAuthenticPixels(image_view,exception);
@@ -4188,7 +4202,7 @@ MagickExport MagickBooleanType DrawPrimitive(Image *image,
           q=GetCacheViewAuthenticPixels(image_view,x,y,1,1,exception);
           if (q == (Quantum *) NULL)
             break;
-          (void) GetFillColor(draw_info,x,y,&pixel);
+          (void) GetFillColor(draw_info,x,y,&pixel,exception);
           SetPixelPacket(image,&pixel,q);
           (void) SyncCacheViewAuthenticPixels(image_view,exception);
           break;
@@ -4202,7 +4216,15 @@ MagickExport MagickBooleanType DrawPrimitive(Image *image,
             pixel,
             target;
 
-          (void) GetOneCacheViewVirtualPixel(image_view,x,y,&target,exception);
+          Quantum
+            virtual_pixel[MaxPixelChannels];
+
+          (void) GetOneCacheViewVirtualPixel(image_view,x,y,virtual_pixel,
+            exception);
+          target.red=virtual_pixel[RedPixelChannel];
+          target.green=virtual_pixel[GreenPixelChannel];
+          target.blue=virtual_pixel[BluePixelChannel];
+          target.alpha=virtual_pixel[AlphaPixelChannel];
           for (y=0; y < (ssize_t) image->rows; y++)
           {
             register Quantum
@@ -4214,13 +4236,13 @@ MagickExport MagickBooleanType DrawPrimitive(Image *image,
               break;
             for (x=0; x < (ssize_t) image->columns; x++)
             {
-              GetPixelPacket(image,q,&pixel);
+              GetPixelPacketPixel(image,q,&pixel);
               if (IsFuzzyEquivalencePixelPacket(image,&pixel,&target) == MagickFalse)
                 {
                   q+=GetPixelChannels(image);
                   continue;
                 }
-              (void) GetFillColor(draw_info,x,y,&pixel);
+              (void) GetFillColor(draw_info,x,y,&pixel,exception);
               SetPixelPacket(image,&pixel,q);
               q+=GetPixelChannels(image);
             }
@@ -4243,9 +4265,9 @@ MagickExport MagickBooleanType DrawPrimitive(Image *image,
               target.green=(MagickRealType) draw_info->border_color.green;
               target.blue=(MagickRealType) draw_info->border_color.blue;
             }
-          (void) FloodfillPaintImage(image,DefaultChannels,draw_info,&target,x,
-            y,primitive_info->method == FloodfillMethod ? MagickFalse :
-            MagickTrue);
+          (void) FloodfillPaintImage(image,draw_info,&target,x,y,
+            primitive_info->method == FloodfillMethod ? MagickFalse :
+            MagickTrue,exception);
           break;
         }
         case ResetMethod:
@@ -4270,7 +4292,7 @@ MagickExport MagickBooleanType DrawPrimitive(Image *image,
               break;
             for (x=0; x < (ssize_t) image->columns; x++)
             {
-              (void) GetFillColor(draw_info,x,y,&pixel);
+              (void) GetFillColor(draw_info,x,y,&pixel,exception);
               SetPixelPacket(image,&pixel,q);
               q+=GetPixelChannels(image);
             }
@@ -4286,7 +4308,7 @@ MagickExport MagickBooleanType DrawPrimitive(Image *image,
     case MattePrimitive:
     {
       if (image->matte == MagickFalse)
-        (void) SetImageAlphaChannel(image,OpaqueAlphaChannel);
+        (void) SetImageAlphaChannel(image,OpaqueAlphaChannel,exception);
       switch (primitive_info->method)
       {
         case PointMethod:
@@ -4301,7 +4323,7 @@ MagickExport MagickBooleanType DrawPrimitive(Image *image,
           q=GetCacheViewAuthenticPixels(image_view,x,y,1,1,exception);
           if (q == (Quantum *) NULL)
             break;
-          (void) GetFillColor(draw_info,x,y,&pixel);
+          (void) GetFillColor(draw_info,x,y,&pixel,exception);
           SetPixelAlpha(image,pixel.alpha,q);
           (void) SyncCacheViewAuthenticPixels(image_view,exception);
           break;
@@ -4315,7 +4337,15 @@ MagickExport MagickBooleanType DrawPrimitive(Image *image,
             pixel,
             target;
 
-          (void) GetOneCacheViewVirtualPixel(image_view,x,y,&target,exception);
+          Quantum
+            virtual_pixel[MaxPixelChannels];
+
+          (void) GetOneCacheViewVirtualPixel(image_view,x,y,virtual_pixel,
+            exception);
+          target.red=virtual_pixel[RedPixelChannel];
+          target.green=virtual_pixel[GreenPixelChannel];
+          target.blue=virtual_pixel[BluePixelChannel];
+          target.alpha=virtual_pixel[AlphaPixelChannel];
           for (y=0; y < (ssize_t) image->rows; y++)
           {
             register Quantum
@@ -4330,13 +4360,13 @@ MagickExport MagickBooleanType DrawPrimitive(Image *image,
               break;
             for (x=0; x < (ssize_t) image->columns; x++)
             {
-              GetPixelPacket(image,q,&pixel);
+              GetPixelPacketPixel(image,q,&pixel);
               if (IsFuzzyEquivalencePixelPacket(image,&pixel,&target) == MagickFalse)
                 {
                   q+=GetPixelChannels(image);
                   continue;
                 }
-              (void) GetFillColor(draw_info,x,y,&pixel);
+              (void) GetFillColor(draw_info,x,y,&pixel,exception);
               SetPixelAlpha(image,pixel.alpha,q);
               q+=GetPixelChannels(image);
             }
@@ -4349,6 +4379,9 @@ MagickExport MagickBooleanType DrawPrimitive(Image *image,
         case FloodfillMethod:
         case FillToBorderMethod:
         {
+          ChannelType
+            channel_mask;
+
           PixelInfo
             target;
 
@@ -4359,9 +4392,11 @@ MagickExport MagickBooleanType DrawPrimitive(Image *image,
               target.green=(MagickRealType) draw_info->border_color.green;
               target.blue=(MagickRealType) draw_info->border_color.blue;
             }
-          (void) FloodfillPaintImage(image,OpacityChannel,draw_info,&target,x,y,
+          channel_mask=SetPixelChannelMask(image,AlphaChannel);
+          (void) FloodfillPaintImage(image,draw_info,&target,x,y,
             primitive_info->method == FloodfillMethod ? MagickFalse :
-            MagickTrue);
+            MagickTrue,exception);
+          (void) SetPixelChannelMask(image,channel_mask);
           break;
         }
         case ResetMethod:
@@ -4386,7 +4421,7 @@ MagickExport MagickBooleanType DrawPrimitive(Image *image,
               break;
             for (x=0; x < (ssize_t) image->columns; x++)
             {
-              (void) GetFillColor(draw_info,x,y,&pixel);
+              (void) GetFillColor(draw_info,x,y,&pixel,exception);
               SetPixelAlpha(image,pixel.alpha,q);
               q+=GetPixelChannels(image);
             }
@@ -4414,7 +4449,7 @@ MagickExport MagickBooleanType DrawPrimitive(Image *image,
       (void) FormatLocaleString(geometry,MaxTextExtent,"%+f%+f",
         primitive_info->point.x,primitive_info->point.y);
       (void) CloneString(&clone_info->geometry,geometry);
-      status=AnnotateImage(image,clone_info);
+      status=AnnotateImage(image,clone_info,exception);
       clone_info=DestroyDrawInfo(clone_info);
       break;
     }
@@ -4473,7 +4508,8 @@ MagickExport MagickBooleanType DrawPrimitive(Image *image,
           (void) TransformImage(&composite_image,(char *) NULL,geometry);
         }
       if (composite_image->matte == MagickFalse)
-        (void) SetImageAlphaChannel(composite_image,OpaqueAlphaChannel);
+        (void) SetImageAlphaChannel(composite_image,OpaqueAlphaChannel,
+          exception);
       if (draw_info->alpha != OpaqueAlpha)
         (void) SetImageOpacity(composite_image,draw_info->alpha);
       SetGeometry(image,&geometry);
@@ -4710,7 +4746,7 @@ MagickExport void GetAffineMatrix(AffineMatrix *affine_matrix)
 %                                                                             %
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 %
-%  GetDrawInfo() initializes draw_info to default values.
+%  GetDrawInfo() initializes draw_info to default values from image_info.
 %
 %  The format of the GetDrawInfo method is:
 %
@@ -4743,8 +4779,10 @@ MagickExport void GetDrawInfo(const ImageInfo *image_info,DrawInfo *draw_info)
   clone_info=CloneImageInfo(image_info);
   GetAffineMatrix(&draw_info->affine);
   exception=AcquireExceptionInfo();
-  (void) QueryColorDatabase("#000F",&draw_info->fill,exception);
-  (void) QueryColorDatabase("#FFF0",&draw_info->stroke,exception);
+  (void) QueryColorCompliance("#000F",AllCompliance,&draw_info->fill,
+    exception);
+  (void) QueryColorCompliance("#FFF0",AllCompliance,&draw_info->stroke,
+    exception);
   draw_info->stroke_antialias=clone_info->antialias;
   draw_info->stroke_width=1.0;
   draw_info->alpha=OpaqueAlpha;
@@ -4787,16 +4825,19 @@ MagickExport void GetDrawInfo(const ImageInfo *image_info,DrawInfo *draw_info)
       MagickDirectionOptions,MagickFalse,option);
   option=GetImageOption(clone_info,"fill");
   if (option != (const char *) NULL)
-    (void) QueryColorDatabase(option,&draw_info->fill,exception);
+    (void) QueryColorCompliance(option,AllCompliance,&draw_info->fill,
+      exception);
   option=GetImageOption(clone_info,"stroke");
   if (option != (const char *) NULL)
-    (void) QueryColorDatabase(option,&draw_info->stroke,exception);
+    (void) QueryColorCompliance(option,AllCompliance,&draw_info->stroke,
+      exception);
   option=GetImageOption(clone_info,"strokewidth");
   if (option != (const 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);
+    (void) QueryColorCompliance(option,AllCompliance,&draw_info->undercolor,
+      exception);
   option=GetImageOption(clone_info,"gravity");
   if (option != (const char *) NULL)
     draw_info->gravity=(GravityType) ParseCommandOption(MagickGravityOptions,