]> granicus.if.org Git - imagemagick/blobdiff - MagickCore/draw.c
(no commit message)
[imagemagick] / MagickCore / draw.c
index 7cf06c6d6721c955ac54279490e75a66d3852ba1..6b754ba8eb93aada85a4f2eafdb8dd014193a8b1 100644 (file)
@@ -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)
@@ -1431,7 +1431,7 @@ MagickExport MagickBooleanType DrawClipPath(Image *image,
   (void) QueryColorDatabase("#ffffff",&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|=NegateImage(image->clip_mask,MagickFalse,&image->exception);
   clone_info=DestroyDrawInfo(clone_info);
   if (image->debug != MagickFalse)
     (void) LogMagickEvent(DrawEvent,GetMagickModule(),"end clip-path");
@@ -1777,7 +1777,7 @@ MagickExport MagickBooleanType DrawImage(Image *image,const DrawInfo *draw_info)
     }
   token=AcquireString(primitive);
   (void) QueryColorDatabase("#000000",&start_color,&image->exception);
-  if (SetImageStorageClass(image,DirectClass) == MagickFalse)
+  if (SetImageStorageClass(image,DirectClass,&image->exception) == MagickFalse)
     return(MagickFalse);
   status=MagickTrue;
   for (q=primitive; *q != '\0'; )
@@ -2002,8 +2002,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)
@@ -2494,7 +2494,7 @@ MagickExport MagickBooleanType DrawImage(Image *image,const DrawInfo *draw_info)
             GetMagickToken(q,&q,token);
             (void) QueryColorDatabase(token,&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;
@@ -2629,8 +2629,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)
@@ -3922,7 +3922,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
@@ -4221,7 +4221,7 @@ MagickExport MagickBooleanType DrawPrimitive(Image *image,
                   continue;
                 }
               (void) GetFillColor(draw_info,x,y,&pixel);
-              SetPixelAlpha(image,pixel.alpha,q);
+              SetPixelPacket(image,&pixel,q);
               q+=GetPixelChannels(image);
             }
             sync=SyncCacheViewAuthenticPixels(image_view,exception);
@@ -4243,9 +4243,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:
@@ -4286,7 +4286,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:
@@ -4349,6 +4349,9 @@ MagickExport MagickBooleanType DrawPrimitive(Image *image,
         case FloodfillMethod:
         case FillToBorderMethod:
         {
+          ChannelType
+            channel_mask;
+
           PixelInfo
             target;
 
@@ -4359,9 +4362,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:
@@ -4473,7 +4478,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);