Forward declarations.
*/
static Image
- *DrawImageClippingMask(Image *,const DrawInfo *,const char *,ExceptionInfo *);
+ *DrawClippingMask(Image *,const DrawInfo *,const char *,ExceptionInfo *);
static MagickBooleanType
DrawStrokePolygon(Image *,const DrawInfo *,const PrimitiveInfo *,
MagickBooleanType
status;
-
- clipping_mask=DrawImageClippingMask(image,draw_info,clip_path,exception);
+
+ clipping_mask=DrawClippingMask(image,draw_info,clip_path,exception);
if (clipping_mask == (Image *) NULL)
return(MagickFalse);
status=SetImageMask(image,WritePixelMask,clipping_mask,exception);
% %
% %
% %
+% D r a w C l i p p i n g M a s k %
+% %
+% %
+% %
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%
+% DrawClippingMask() draws the clip path and returns it as an image clipping
+% mask.
+%
+% The format of the DrawClippingMask method is:
+%
+% Image *DrawClippingMask(Image *image,const DrawInfo *draw_info,
+% const char *clip_path,ExceptionInfo *exception)
+%
+% A description of each parameter follows:
+%
+% o image: the image.
+%
+% o draw_info: the draw info.
+%
+% o clip_path: the clip path.
+%
+% o exception: return any errors or warnings in this structure.
+%
+*/
+static Image *DrawClippingMask(Image *image,const DrawInfo *draw_info,
+ const char *clip_path,ExceptionInfo *exception)
+{
+ Image
+ *clip_mask;
+
+ DrawInfo
+ *clone_info;
+
+ MagickStatusType
+ status;
+
+ /*
+ Draw a clip path.
+ */
+ assert(image != (Image *) NULL);
+ assert(image->signature == MagickCoreSignature);
+ if (image->debug != MagickFalse)
+ (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",image->filename);
+ assert(draw_info != (const DrawInfo *) NULL);
+ clip_mask=CloneImage(image,image->columns,image->rows,MagickTrue,exception);
+ if (clip_mask == (Image *) NULL)
+ return((Image *) NULL);
+ (void) SetImageMask(clip_mask,ReadPixelMask,(Image *) NULL,exception);
+ (void) SetImageMask(clip_mask,WritePixelMask,(Image *) NULL,exception);
+ (void) QueryColorCompliance("#0000",AllCompliance,
+ &clip_mask->background_color,exception);
+ clip_mask->background_color.alpha=(MagickRealType) TransparentAlpha;
+ clip_mask->background_color.alpha_trait=BlendPixelTrait;
+ (void) SetImageBackgroundColor(clip_mask,exception);
+ if (image->debug != MagickFalse)
+ (void) LogMagickEvent(DrawEvent,GetMagickModule(),"\nbegin clip-path %s",
+ draw_info->clip_mask);
+ clone_info=CloneDrawInfo((ImageInfo *) NULL,draw_info);
+ (void) CloneString(&clone_info->primitive,clip_path);
+ (void) QueryColorCompliance("#ffffff",AllCompliance,&clone_info->fill,
+ exception);
+ if (clone_info->clip_mask != (char *) NULL)
+ clone_info->clip_mask=DestroyString(clone_info->clip_mask);
+ (void) QueryColorCompliance("#00000000",AllCompliance,&clone_info->stroke,
+ exception);
+ clone_info->stroke_width=0.0;
+ clone_info->alpha=OpaqueAlpha;
+ clone_info->clip_path=MagickTrue;
+ status=DrawImage(clip_mask,clone_info,exception);
+ clone_info=DestroyDrawInfo(clone_info);
+ if (status == MagickFalse)
+ clip_mask=DestroyImage(clip_mask);
+ if (image->debug != MagickFalse)
+ (void) LogMagickEvent(DrawEvent,GetMagickModule(),"end clip-path");
+ return(clip_mask);
+}
+\f
+/*
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+% %
+% %
+% %
+ D r a w D a s h P o l y g o n %
% %
% %
clip_path=GetNodeByURL(primitive,token);
if (clip_path != (char *) NULL)
{
- graphic_context[n]->clipping_mask=DrawImageClippingMask(image,
+ graphic_context[n]->clipping_mask=DrawClippingMask(image,
graphic_context[n],clip_path,exception);
clip_path=DestroyString(clip_path);
}
% %
% %
% %
-% D r a w I m a g e C l i p p i n g M a s k %
-% %
-% %
-% %
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-%
-% DrawImageClippingMask() draws the clip path and returns it as an image
-% clipping mask.
-%
-% The format of the DrawImageClippingMask method is:
-%
-% Image *DrawImageClippingMask(Image *image,const DrawInfo *draw_info,
-% const char *clip_path,ExceptionInfo *exception)
-%
-% A description of each parameter follows:
-%
-% o image: the image.
-%
-% o draw_info: the draw info.
-%
-% o clip_path: the clip path.
-%
-% o exception: return any errors or warnings in this structure.
-%
-*/
-static Image *DrawImageClippingMask(Image *image,const DrawInfo *draw_info,
- const char *clip_path,ExceptionInfo *exception)
-{
- Image
- *clip_mask;
-
- DrawInfo
- *clone_info;
-
- MagickStatusType
- status;
-
- /*
- Draw a clip path.
- */
- assert(image != (Image *) NULL);
- assert(image->signature == MagickCoreSignature);
- if (image->debug != MagickFalse)
- (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",image->filename);
- assert(draw_info != (const DrawInfo *) NULL);
- clip_mask=CloneImage(image,image->columns,image->rows,MagickTrue,exception);
- if (clip_mask == (Image *) NULL)
- return((Image *) NULL);
- (void) SetImageMask(clip_mask,ReadPixelMask,(Image *) NULL,exception);
- (void) SetImageMask(clip_mask,WritePixelMask,(Image *) NULL,exception);
- (void) QueryColorCompliance("#0000",AllCompliance,
- &clip_mask->background_color,exception);
- clip_mask->background_color.alpha=(MagickRealType) TransparentAlpha;
- clip_mask->background_color.alpha_trait=BlendPixelTrait;
- (void) SetImageBackgroundColor(clip_mask,exception);
- if (image->debug != MagickFalse)
- (void) LogMagickEvent(DrawEvent,GetMagickModule(),"\nbegin clip-path %s",
- draw_info->clip_mask);
- clone_info=CloneDrawInfo((ImageInfo *) NULL,draw_info);
- (void) CloneString(&clone_info->primitive,clip_path);
- (void) QueryColorCompliance("#ffffff",AllCompliance,&clone_info->fill,
- exception);
- if (clone_info->clip_mask != (char *) NULL)
- clone_info->clip_mask=DestroyString(clone_info->clip_mask);
- (void) QueryColorCompliance("#00000000",AllCompliance,&clone_info->stroke,
- exception);
- clone_info->stroke_width=0.0;
- clone_info->alpha=OpaqueAlpha;
- clone_info->clip_path=MagickTrue;
- status=DrawImage(clip_mask,clone_info,exception);
- clone_info=DestroyDrawInfo(clone_info);
- if (status == MagickFalse)
- clip_mask=DestroyImage(clip_mask);
- if (image->debug != MagickFalse)
- (void) LogMagickEvent(DrawEvent,GetMagickModule(),"end clip-path");
- return(clip_mask);
-}
-\f
-/*
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-% %
-% %
-% %
% D r a w P a t t e r n P a t h %
% %
% %
}
}
image_view=DestroyCacheView(image_view);
+ status&=SetImageMask(image,WritePixelMask,(Image *) NULL,exception);
if (image->debug != MagickFalse)
(void) LogMagickEvent(DrawEvent,GetMagickModule()," end draw-primitive");
return(status != 0 ? MagickTrue : MagickFalse);