49 #include "wand/studio.h"
50 #include "wand/MagickWand.h"
51 #include "wand/magick-wand-private.h"
52 #include "wand/wand.h"
53 #include "magick/image-private.h"
54 #include "magick/string-private.h"
59 #define DRAW_BINARY_IMPLEMENTATION 0
61 #define CurrentContext (wand->graphic_context[wand->index])
62 #define DrawingWandId "DrawingWand"
63 #define ThrowDrawException(severity,tag,reason) (void) ThrowMagickException( \
64 wand->exception,GetMagickModule(),severity,tag,"`%s'",reason);
74 PathCurveToQuadraticBezierOperation,
75 PathCurveToQuadraticBezierSmoothOperation,
76 PathCurveToSmoothOperation,
77 PathEllipticArcOperation,
78 PathLineToHorizontalOperation,
80 PathLineToVerticalOperation,
160 MVGPrintf(
DrawingWand *,
const char *,...) wand_attribute((format
162 MVGAutoWrapPrintf(
DrawingWand *,const
char *,...) wand_attribute((format
166 MVGAppendColor(DrawingWand *,const PixelPacket *);
171 static
int MVGPrintf(DrawingWand *wand,const
char *format,...)
176 assert(wand != (DrawingWand *) NULL);
177 if (wand->debug != MagickFalse)
178 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",format);
179 assert(wand->signature == WandSignature);
180 extent=20UL*MaxTextExtent;
181 if (wand->mvg == (
char *) NULL)
183 wand->mvg=(
char *) AcquireQuantumMemory(extent,
sizeof(*wand->mvg));
184 if (wand->mvg == (
char *) NULL)
186 ThrowDrawException(ResourceLimitError,
"MemoryAllocationFailed",
190 wand->mvg_alloc=extent;
193 if (wand->mvg_alloc < (wand->mvg_length+10*MaxTextExtent))
195 extent+=wand->mvg_alloc;
196 wand->mvg=(
char *) ResizeQuantumMemory(wand->mvg,extent,
198 if (wand->mvg == (
char *) NULL)
200 ThrowDrawException(ResourceLimitError,
"MemoryAllocationFailed",
204 wand->mvg_alloc=extent;
216 while (wand->mvg_width < wand->indent_depth)
218 wand->mvg[wand->mvg_length]=
' ';
222 wand->mvg[wand->mvg_length]=
'\0';
224 offset=(ssize_t) wand->mvg_alloc-wand->mvg_length-1;
227 va_start(argp,format);
228 #if defined(MAGICKCORE_HAVE_VSNPRINTF)
229 count=vsnprintf(wand->mvg+wand->mvg_length,(
size_t) offset,format,argp);
231 count=vsprintf(wand->mvg+wand->mvg_length,format,argp);
235 if ((count < 0) || (count > (
int) offset))
236 ThrowDrawException(DrawError,
"UnableToPrint",format)
239 wand->mvg_length+=count;
240 wand->mvg_width+=count;
242 wand->mvg[wand->mvg_length]=
'\0';
243 if ((wand->mvg_length > 1) && (wand->mvg[wand->mvg_length-1] ==
'\n'))
245 assert((wand->mvg_length+1) < wand->mvg_alloc);
250 static int MVGAutoWrapPrintf(DrawingWand *wand,
const char *format,...)
253 buffer[MaxTextExtent];
261 va_start(argp,format);
262 #if defined(MAGICKCORE_HAVE_VSNPRINTF)
263 count=vsnprintf(buffer,
sizeof(buffer)-1,format,argp);
265 count=vsprintf(buffer,format,argp);
268 buffer[
sizeof(buffer)-1]=
'\0';
270 ThrowDrawException(DrawError,
"UnableToPrint",format)
273 if (((wand->mvg_width + count) > 78) && (buffer[count-1] !=
'\n'))
274 (void) MVGPrintf(wand,
"\n");
275 (void) MVGPrintf(wand,
"%s",buffer);
280 static void MVGAppendColor(DrawingWand *wand,
const PixelPacket *color)
282 if ((GetPixelRed(color) == 0) &&
283 (GetPixelGreen(color) == 0) &&
284 (GetPixelBlue(color) == 0) &&
285 (GetPixelOpacity(color) == (Quantum) TransparentOpacity))
286 (void) MVGPrintf(wand,
"none");
290 tuple[MaxTextExtent];
295 GetMagickPixelPacket(wand->image,&pixel);
296 pixel.colorspace=sRGBColorspace;
297 pixel.matte=color->opacity != OpaqueOpacity ? MagickTrue : MagickFalse;
298 pixel.red=(MagickRealType) GetPixelRed(color);
299 pixel.green=(MagickRealType) GetPixelGreen(color);
300 pixel.blue=(MagickRealType) GetPixelBlue(color);
301 pixel.opacity=(MagickRealType) GetPixelOpacity(color);
302 GetColorTuple(&pixel,MagickTrue,tuple);
303 (void) MVGPrintf(wand,
"%s",tuple);
307 static void MVGAppendPointsCommand(DrawingWand *wand,
const char *command,
308 const size_t number_coordinates,
const PointInfo *coordinates)
316 (void) MVGPrintf(wand,
"%s",command);
317 for (i=number_coordinates, coordinate=coordinates; i != 0; i--)
319 (void) MVGAutoWrapPrintf(wand,
" %.20g %.20g",coordinate->x,coordinate->y);
322 (void) MVGPrintf(wand,
"\n");
325 static void AdjustAffine(DrawingWand *wand,
const AffineMatrix *affine)
327 assert(wand != (DrawingWand *) NULL);
328 assert(wand->signature == WandSignature);
329 if (wand->debug != MagickFalse)
330 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
331 if ((affine->sx != 1.0) || (affine->rx != 0.0) || (affine->ry != 0.0) ||
332 (affine->sy != 1.0) || (affine->tx != 0.0) || (affine->ty != 0.0))
337 current=CurrentContext->affine;
338 CurrentContext->affine.sx=affine->sx*current.sx+affine->ry*current.rx;
339 CurrentContext->affine.rx=affine->rx*current.sx+affine->sy*current.rx;
340 CurrentContext->affine.ry=affine->sx*current.ry+affine->ry*current.sy;
341 CurrentContext->affine.sy=affine->rx*current.ry+affine->sy*current.sy;
342 CurrentContext->affine.tx=affine->sx*current.tx+affine->ry*current.ty+
344 CurrentContext->affine.ty=affine->rx*current.tx+affine->sy*current.ty+
374 WandExport DrawingWand *AcquireDrawingWand(
const DrawInfo *draw_info,
380 wand=NewDrawingWand();
381 if (draw_info != (
const DrawInfo *) NULL)
383 CurrentContext=DestroyDrawInfo(CurrentContext);
384 CurrentContext=CloneDrawInfo((ImageInfo *) NULL,draw_info);
386 wand->image=DestroyImage(wand->image);
387 if (image != (Image *) NULL)
388 wand->destroy=MagickFalse;
415 WandExport
void ClearDrawingWand(DrawingWand *wand)
417 assert(wand != (DrawingWand *) NULL);
418 assert(wand->signature == WandSignature);
419 if (wand->debug != MagickFalse)
420 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
421 for ( ; wand->index > 0; wand->index--)
422 CurrentContext=DestroyDrawInfo(CurrentContext);
423 CurrentContext=DestroyDrawInfo(CurrentContext);
424 wand->graphic_context=(DrawInfo **) RelinquishMagickMemory(
425 wand->graphic_context);
426 if (wand->pattern_id != (
char *) NULL)
427 wand->pattern_id=DestroyString(wand->pattern_id);
428 wand->mvg=DestroyString(wand->mvg);
429 if ((wand->destroy != MagickFalse) && (wand->image != (Image *) NULL))
430 wand->image=DestroyImage(wand->image);
432 wand->image=(Image *) NULL;
433 wand->mvg=(
char *) NULL;
437 wand->pattern_id=(
char *) NULL;
438 wand->pattern_offset=0;
439 wand->pattern_bounds.x=0;
440 wand->pattern_bounds.y=0;
441 wand->pattern_bounds.width=0;
442 wand->pattern_bounds.height=0;
444 wand->graphic_context=(DrawInfo **) AcquireQuantumMemory(1,
445 sizeof(*wand->graphic_context));
446 if (wand->graphic_context == (DrawInfo **) NULL)
448 ThrowDrawException(ResourceLimitError,
"MemoryAllocationFailed",
452 CurrentContext=CloneDrawInfo((ImageInfo *) NULL,(DrawInfo *) NULL);
453 wand->filter_off=MagickTrue;
454 wand->indent_depth=0;
455 wand->path_operation=PathDefaultOperation;
456 wand->path_mode=DefaultPathMode;
457 wand->image=AcquireImage((
const ImageInfo *) NULL);
458 ClearMagickException(wand->exception);
459 wand->destroy=MagickTrue;
460 wand->debug=IsEventLogging();
485 WandExport DrawingWand *CloneDrawingWand(
const DrawingWand *wand)
493 assert(wand != (DrawingWand *) NULL);
494 assert(wand->signature == WandSignature);
495 if (wand->debug != MagickFalse)
496 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
497 clone_wand=(DrawingWand *) AcquireMagickMemory(
sizeof(*clone_wand));
498 if (clone_wand == (DrawingWand *) NULL)
499 ThrowWandFatalException(ResourceLimitFatalError,
500 "MemoryAllocationFailed",GetExceptionMessage(errno));
501 (void) memset(clone_wand,0,
sizeof(*clone_wand));
502 clone_wand->id=AcquireWandId();
503 (void) FormatLocaleString(clone_wand->name,MaxTextExtent,
"DrawingWand-%.20g",
504 (
double) clone_wand->id);
505 clone_wand->exception=AcquireExceptionInfo();
506 InheritException(clone_wand->exception,wand->exception);
507 clone_wand->mvg=AcquireString(wand->mvg);
508 clone_wand->mvg_length=strlen(clone_wand->mvg);
509 clone_wand->mvg_alloc=wand->mvg_length+1;
510 clone_wand->mvg_width=wand->mvg_width;
511 clone_wand->pattern_id=AcquireString(wand->pattern_id);
512 clone_wand->pattern_offset=wand->pattern_offset;
513 clone_wand->pattern_bounds=wand->pattern_bounds;
514 clone_wand->index=wand->index;
515 clone_wand->graphic_context=(DrawInfo **) AcquireQuantumMemory((
size_t)
516 wand->index+1UL,
sizeof(*wand->graphic_context));
517 if (clone_wand->graphic_context == (DrawInfo **) NULL)
518 ThrowWandFatalException(ResourceLimitFatalError,
"MemoryAllocationFailed",
519 GetExceptionMessage(errno));
520 for (i=0; i <= (ssize_t) wand->index; i++)
521 clone_wand->graphic_context[i]=
522 CloneDrawInfo((ImageInfo *) NULL,wand->graphic_context[i]);
523 clone_wand->filter_off=wand->filter_off;
524 clone_wand->indent_depth=wand->indent_depth;
525 clone_wand->path_operation=wand->path_operation;
526 clone_wand->path_mode=wand->path_mode;
527 clone_wand->image=wand->image;
528 if (wand->image != (Image *) NULL)
529 clone_wand->image=CloneImage(wand->image,0,0,MagickTrue,
530 clone_wand->exception);
531 clone_wand->destroy=MagickTrue;
532 clone_wand->debug=IsEventLogging();
533 if (clone_wand->debug != MagickFalse)
534 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",clone_wand->name);
535 clone_wand->signature=WandSignature;
563 WandExport DrawingWand *DestroyDrawingWand(DrawingWand *wand)
565 assert(wand != (DrawingWand *) NULL);
566 assert(wand->signature == WandSignature);
567 if (wand->debug != MagickFalse)
568 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
569 for ( ; wand->index > 0; wand->index--)
570 CurrentContext=DestroyDrawInfo(CurrentContext);
571 CurrentContext=DestroyDrawInfo(CurrentContext);
572 wand->graphic_context=(DrawInfo **) RelinquishMagickMemory(
573 wand->graphic_context);
574 if (wand->pattern_id != (
char *) NULL)
575 wand->pattern_id=DestroyString(wand->pattern_id);
576 wand->mvg=DestroyString(wand->mvg);
577 if ((wand->destroy != MagickFalse) && (wand->image != (Image *) NULL))
578 wand->image=DestroyImage(wand->image);
579 wand->image=(Image *) NULL;
580 wand->exception=DestroyExceptionInfo(wand->exception);
581 wand->signature=(~WandSignature);
582 RelinquishWandId(wand->id);
583 wand=(DrawingWand *) RelinquishMagickMemory(wand);
613 WandExport
void DrawAffine(DrawingWand *wand,
const AffineMatrix *affine)
615 assert(wand != (DrawingWand *) NULL);
616 assert(wand->signature == WandSignature);
617 if (wand->debug != MagickFalse)
618 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
619 assert(affine != (
const AffineMatrix *) NULL);
620 AdjustAffine(wand,affine);
621 (void) MVGPrintf(wand,
"affine %.20g %.20g %.20g %.20g %.20g %.20g\n",
622 affine->sx,affine->rx,affine->ry,affine->sy,affine->tx,affine->ty);
654 WandExport
void DrawAnnotation(DrawingWand *wand,
const double x,
const double y,
655 const unsigned char *text)
660 assert(wand != (DrawingWand *) NULL);
661 assert(wand->signature == WandSignature);
662 if (wand->debug != MagickFalse)
663 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
664 assert(text != (
const unsigned char *) NULL);
665 escaped_text=EscapeString((
const char *) text,
'\'');
666 if (escaped_text != (
char *) NULL)
668 (void) MVGPrintf(wand,
"text %.20g %.20g '%s'\n",x,y,escaped_text);
669 escaped_text=DestroyString(escaped_text);
709 WandExport
void DrawArc(DrawingWand *wand,
const double sx,
const double sy,
710 const double ex,
const double ey,
const double sd,
const double ed)
712 assert(wand != (DrawingWand *) NULL);
713 assert(wand->signature == WandSignature);
714 if (wand->debug != MagickFalse)
715 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
716 (void) MVGPrintf(wand,
"arc %.20g %.20g %.20g %.20g %.20g %.20g\n",sx,sy,ex,
747 WandExport
void DrawBezier(DrawingWand *wand,
748 const size_t number_coordinates,
const PointInfo *coordinates)
750 assert(wand != (DrawingWand *) NULL);
751 assert(wand->signature == WandSignature);
752 if (wand->debug != MagickFalse)
753 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
754 assert(coordinates != (
const PointInfo *) NULL);
755 MVGAppendPointsCommand(wand,
"bezier",number_coordinates,coordinates);
789 WandExport
void DrawCircle(DrawingWand *wand,
const double ox,
const double oy,
790 const double px,
const double py)
792 assert(wand != (DrawingWand *) NULL);
793 assert(wand->signature == WandSignature);
794 if (wand->debug != MagickFalse)
795 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
796 (void) MVGPrintf(wand,
"circle %.20g %.20g %.20g %.20g\n",ox,oy,px,py);
821 WandExport MagickBooleanType DrawClearException(DrawingWand *wand)
823 assert(wand != (DrawingWand *) NULL);
824 assert(wand->signature == WandSignature);
825 if (wand->debug != MagickFalse)
826 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
827 ClearMagickException(wand->exception);
872 WandExport MagickBooleanType DrawComposite(DrawingWand *wand,
873 const CompositeOperator compose,
const double x,
const double y,
874 const double width,
const double height,
MagickWand *magick_wand)
904 assert(wand != (DrawingWand *) NULL);
905 assert(wand->signature == WandSignature);
906 if (wand->debug != MagickFalse)
907 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
909 image=GetImageFromMagickWand(magick_wand);
910 if (image == (Image *) NULL)
912 clone_image=CloneImage(image,0,0,MagickTrue,wand->exception);
913 if (clone_image == (Image *) NULL)
915 image_info=AcquireImageInfo();
916 (void) CopyMagickString(image_info->magick,
"MIFF",MaxTextExtent);
918 blob=(
unsigned char *) ImageToBlob(image_info,clone_image,&blob_length,
920 image_info=DestroyImageInfo(image_info);
921 clone_image=DestroyImageList(clone_image);
922 if (blob == (
void *) NULL)
925 base64=Base64Encode(blob,blob_length,&encoded_length);
926 blob=(
unsigned char *) RelinquishMagickMemory(blob);
927 if (base64 == (
char *) NULL)
930 buffer[MaxTextExtent];
932 (void) FormatLocaleString(buffer,MaxTextExtent,
"%.20g bytes",(
double)
933 (4L*blob_length/3L+4L));
934 ThrowDrawException(ResourceLimitWarning,
"MemoryAllocationFailed",
938 mode=CommandOptionToMnemonic(MagickComposeOptions,(ssize_t) compose);
939 media_type=MagickToMime(image->magick);
940 (void) MVGPrintf(wand,
"image %s %.20g %.20g %.20g %.20g 'data:%s;base64,\n",
941 mode,x,y,width,height,media_type);
943 for (i=(ssize_t) encoded_length; i > 0; i-=76)
945 (void) MVGPrintf(wand,
"%.76s",p);
948 (void) MVGPrintf(wand,
"\n");
950 (void) MVGPrintf(wand,
"'\n");
951 media_type=DestroyString(media_type);
952 base64=DestroyString(base64);
992 WandExport
void DrawColor(DrawingWand *wand,
const double x,
const double y,
993 const PaintMethod paint_method)
995 assert(wand != (DrawingWand *) NULL);
996 assert(wand->signature == WandSignature);
997 if (wand->debug != MagickFalse)
998 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
999 (void) MVGPrintf(wand,
"color %.20g %.20g '%s'\n",x,y,CommandOptionToMnemonic(
1000 MagickMethodOptions,(ssize_t) paint_method));
1027 WandExport
void DrawComment(DrawingWand *wand,
const char *comment)
1029 (void) MVGPrintf(wand,
"#%s\n",comment);
1067 WandExport
void DrawEllipse(DrawingWand *wand,
const double ox,
const double oy,
1068 const double rx,
const double ry,
const double start,
const double end)
1070 assert(wand != (DrawingWand *) NULL);
1071 assert(wand->signature == WandSignature);
1072 if (wand->debug != MagickFalse)
1073 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
1074 (void) MVGPrintf(wand,
"ellipse %.20g %.20g %.20g %.20g %.20g %.20g\n",ox,oy,
1104 WandExport
void DrawGetBorderColor(
const DrawingWand *wand,
1107 assert(wand != (
const DrawingWand *) NULL);
1108 assert(wand->signature == WandSignature);
1109 assert(border_color != (
PixelWand *) NULL);
1110 if (wand->debug != MagickFalse)
1111 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
1112 PixelSetQuantumColor(border_color,&CurrentContext->border_color);
1138 WandExport
char *DrawGetClipPath(
const DrawingWand *wand)
1140 assert(wand != (
const DrawingWand *) NULL);
1141 assert(wand->signature == WandSignature);
1142 if (wand->debug != MagickFalse)
1143 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
1144 if (CurrentContext->clip_mask != (
char *) NULL)
1145 return((
char *) AcquireString(CurrentContext->clip_mask));
1146 return((
char *) NULL);
1172 WandExport FillRule DrawGetClipRule(
const DrawingWand *wand)
1174 assert(wand != (
const DrawingWand *) NULL);
1175 assert(wand->signature == WandSignature);
1176 if (wand->debug != MagickFalse)
1177 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
1178 return(CurrentContext->fill_rule);
1203 WandExport ClipPathUnits DrawGetClipUnits(
const DrawingWand *wand)
1205 assert(wand != (
const DrawingWand *) NULL);
1206 assert(wand->signature == WandSignature);
1207 if (wand->debug != MagickFalse)
1208 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
1209 return(CurrentContext->clip_units);
1235 WandExport
char *DrawGetDensity(
const DrawingWand *wand)
1237 assert(wand != (
const DrawingWand *) NULL);
1238 assert(wand->signature == MagickCoreSignature);
1239 if (wand->debug != MagickFalse)
1240 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
1241 if (CurrentContext->density != (
char *) NULL)
1242 return((
char *) AcquireString(CurrentContext->density));
1243 return((
char *) NULL);
1272 WandExport
char *DrawGetException(
const DrawingWand *wand,
1273 ExceptionType *severity)
1278 assert(wand != (
const DrawingWand *) NULL);
1279 assert(wand->signature == WandSignature);
1280 if (wand->debug != MagickFalse)
1281 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
1282 assert(severity != (ExceptionType *) NULL);
1283 *severity=wand->exception->severity;
1284 description=(
char *) AcquireQuantumMemory(2UL*MaxTextExtent,
1285 sizeof(*description));
1286 if (description == (
char *) NULL)
1287 ThrowWandFatalException(ResourceLimitFatalError,
"MemoryAllocationFailed",
1290 if (wand->exception->reason != (
char *) NULL)
1291 (
void) CopyMagickString(description,GetLocaleExceptionMessage(
1292 wand->exception->severity,wand->exception->reason),
1294 if (wand->exception->description != (
char *) NULL)
1296 (void) ConcatenateMagickString(description,
" (",MaxTextExtent);
1297 (void) ConcatenateMagickString(description,GetLocaleExceptionMessage(
1298 wand->exception->severity,wand->exception->description),
1300 (void) ConcatenateMagickString(description,
")",MaxTextExtent);
1302 return(description);
1328 WandExport ExceptionType DrawGetExceptionType(
const DrawingWand *wand)
1330 assert(wand != (
const DrawingWand *) NULL);
1331 assert(wand->signature == WandSignature);
1332 if (wand->debug != MagickFalse)
1333 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
1334 return(wand->exception->severity);
1362 WandExport
void DrawGetFillColor(
const DrawingWand *wand,
PixelWand *fill_color)
1364 assert(wand != (
const DrawingWand *) NULL);
1365 assert(wand->signature == WandSignature);
1366 assert(fill_color != (
PixelWand *) NULL);
1367 if (wand->debug != MagickFalse)
1368 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
1369 PixelSetQuantumColor(fill_color,&CurrentContext->fill);
1395 WandExport
double DrawGetFillOpacity(
const DrawingWand *wand)
1400 assert(wand != (
const DrawingWand *) NULL);
1401 assert(wand->signature == WandSignature);
1402 if (wand->debug != MagickFalse)
1403 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
1404 alpha=QuantumScale*((double) QuantumRange-(
double)
1405 CurrentContext->fill.opacity);
1431 WandExport FillRule DrawGetFillRule(const DrawingWand *wand)
1433 assert(wand != (
const DrawingWand *) NULL);
1434 assert(wand->signature == WandSignature);
1435 if (wand->debug != MagickFalse)
1436 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
1437 return(CurrentContext->fill_rule);
1464 WandExport
char *DrawGetFont(
const DrawingWand *wand)
1466 assert(wand != (
const DrawingWand *) NULL);
1467 assert(wand->signature == WandSignature);
1468 if (wand->debug != MagickFalse)
1469 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
1470 if (CurrentContext->font != (
char *) NULL)
1471 return(AcquireString(CurrentContext->font));
1472 return((
char *) NULL);
1498 WandExport
char *DrawGetFontFamily(
const DrawingWand *wand)
1500 assert(wand != (
const DrawingWand *) NULL);
1501 assert(wand->signature == WandSignature);
1502 if (wand->debug != MagickFalse)
1503 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
1504 if (CurrentContext->family != NULL)
1505 return(AcquireString(CurrentContext->family));
1506 return((
char *) NULL);
1536 WandExport MagickBooleanType DrawGetFontResolution(
const DrawingWand *wand,
1537 double *x,
double *y)
1539 assert(wand != (DrawingWand *) NULL);
1540 assert(wand->signature == WandSignature);
1541 if (wand->debug != MagickFalse)
1542 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
1543 *x=DefaultResolution;
1544 *y=DefaultResolution;
1545 if (CurrentContext->density != (
char *) NULL)
1553 flags=ParseGeometry(CurrentContext->density,&geometry_info);
1554 *x=geometry_info.rho;
1555 *y=geometry_info.sigma;
1556 if ((flags & SigmaValue) == MagickFalse)
1584 WandExport
double DrawGetFontSize(
const DrawingWand *wand)
1586 assert(wand != (
const DrawingWand *) NULL);
1587 assert(wand->signature == WandSignature);
1588 if (wand->debug != MagickFalse)
1589 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
1590 return(CurrentContext->pointsize);
1615 WandExport StretchType DrawGetFontStretch(
const DrawingWand *wand)
1617 assert(wand != (
const DrawingWand *) NULL);
1618 assert(wand->signature == WandSignature);
1619 if (wand->debug != MagickFalse)
1620 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
1621 return(CurrentContext->stretch);
1646 WandExport StyleType DrawGetFontStyle(
const DrawingWand *wand)
1648 assert(wand != (
const DrawingWand *) NULL);
1649 assert(wand->signature == WandSignature);
1650 if (wand->debug != MagickFalse)
1651 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
1652 return(CurrentContext->style);
1677 WandExport
size_t DrawGetFontWeight(
const DrawingWand *wand)
1679 assert(wand != (
const DrawingWand *) NULL);
1680 assert(wand->signature == WandSignature);
1681 if (wand->debug != MagickFalse)
1682 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
1683 return(CurrentContext->weight);
1709 WandExport GravityType DrawGetGravity(
const DrawingWand *wand)
1711 assert(wand != (
const DrawingWand *) NULL);
1712 assert(wand->signature == WandSignature);
1713 if (wand->debug != MagickFalse)
1714 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
1715 return(CurrentContext->gravity);
1741 WandExport
double DrawGetOpacity(
const DrawingWand *wand)
1746 assert(wand != (
const DrawingWand *) NULL);
1747 assert(wand->signature == WandSignature);
1748 if (wand->debug != MagickFalse)
1749 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
1750 alpha=QuantumScale*((double) QuantumRange-(
double) CurrentContext->opacity);
1779 WandExport MagickBooleanType DrawGetStrokeAntialias(const DrawingWand *wand)
1781 assert(wand != (
const DrawingWand *) NULL);
1782 assert(wand->signature == WandSignature);
1783 if (wand->debug != MagickFalse)
1784 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
1785 return(CurrentContext->stroke_antialias);
1813 WandExport
void DrawGetStrokeColor(
const DrawingWand *wand,
1816 assert(wand != (
const DrawingWand *) NULL);
1817 assert(wand->signature == WandSignature);
1818 assert(stroke_color != (
PixelWand *) NULL);
1819 if (wand->debug != MagickFalse)
1820 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
1821 PixelSetQuantumColor(stroke_color,&CurrentContext->stroke);
1851 WandExport
double *DrawGetStrokeDashArray(
const DrawingWand *wand,
1852 size_t *number_elements)
1869 assert(wand != (
const DrawingWand *) NULL);
1870 assert(wand->signature == WandSignature);
1871 if (wand->debug != MagickFalse)
1872 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
1873 assert(number_elements != (
size_t *) NULL);
1875 p=CurrentContext->dash_pattern;
1876 if (p != (
const double *) NULL)
1877 while (fabs(*p++) >= MagickEpsilon)
1880 dasharray=(
double *) NULL;
1883 dasharray=(
double *) AcquireQuantumMemory((
size_t) n+1UL,
1884 sizeof(*dasharray));
1885 if (dasharray != (
double *) NULL)
1887 p=CurrentContext->dash_pattern;
1889 for (i=0; i < (ssize_t) n; i++)
1920 WandExport
double DrawGetStrokeDashOffset(
const DrawingWand *wand)
1922 assert(wand != (
const DrawingWand *) NULL);
1923 assert(wand->signature == WandSignature);
1924 if (wand->debug != MagickFalse)
1925 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
1926 return(CurrentContext->dash_offset);
1953 WandExport LineCap DrawGetStrokeLineCap(
const DrawingWand *wand)
1955 assert(wand != (
const DrawingWand *) NULL);
1956 assert(wand->signature == WandSignature);
1957 if (wand->debug != MagickFalse)
1958 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
1959 return(CurrentContext->linecap);
1987 WandExport LineJoin DrawGetStrokeLineJoin(
const DrawingWand *wand)
1989 assert(wand != (
const DrawingWand *) NULL);
1990 assert(wand->signature == WandSignature);
1991 if (wand->debug != MagickFalse)
1992 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
1993 return(CurrentContext->linejoin);
2022 WandExport
size_t DrawGetStrokeMiterLimit(
const DrawingWand *wand)
2024 assert(wand != (
const DrawingWand *) NULL);
2025 assert(wand->signature == WandSignature);
2026 if (wand->debug != MagickFalse)
2027 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
2028 return CurrentContext->miterlimit;
2053 WandExport
double DrawGetStrokeOpacity(
const DrawingWand *wand)
2058 assert(wand != (
const DrawingWand *) NULL);
2059 assert(wand->signature == WandSignature);
2060 if (wand->debug != MagickFalse)
2061 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
2062 alpha=QuantumScale*((double) QuantumRange-(
double)
2063 CurrentContext->stroke.opacity);
2090 WandExport
double DrawGetStrokeWidth(const DrawingWand *wand)
2092 assert(wand != (
const DrawingWand *) NULL);
2093 assert(wand->signature == WandSignature);
2094 if (wand->debug != MagickFalse)
2095 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
2096 return(CurrentContext->stroke_width);
2122 WandExport AlignType DrawGetTextAlignment(
const DrawingWand *wand)
2124 assert(wand != (
const DrawingWand *) NULL);
2125 assert(wand->signature == WandSignature);
2126 if (wand->debug != MagickFalse)
2127 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
2128 return(CurrentContext->align);
2154 WandExport MagickBooleanType DrawGetTextAntialias(
const DrawingWand *wand)
2156 assert(wand != (
const DrawingWand *) NULL);
2157 assert(wand->signature == WandSignature);
2158 if (wand->debug != MagickFalse)
2159 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
2160 return(CurrentContext->text_antialias);
2186 WandExport DecorationType DrawGetTextDecoration(
const DrawingWand *wand)
2188 assert(wand != (
const DrawingWand *) NULL);
2189 assert(wand->signature == WandSignature);
2190 if (wand->debug != MagickFalse)
2191 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
2192 return(CurrentContext->decorate);
2218 WandExport DirectionType DrawGetTextDirection(
const DrawingWand *wand)
2220 assert(wand != (
const DrawingWand *) NULL);
2221 assert(wand->signature == WandSignature);
2222 if (wand->debug != MagickFalse)
2223 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
2224 return(CurrentContext->direction);
2251 WandExport
char *DrawGetTextEncoding(
const DrawingWand *wand)
2253 assert(wand != (
const DrawingWand *) NULL);
2254 assert(wand->signature == WandSignature);
2255 if (wand->debug != MagickFalse)
2256 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
2257 if (CurrentContext->encoding != (
char *) NULL)
2258 return((
char *) AcquireString(CurrentContext->encoding));
2259 return((
char *) NULL);
2284 WandExport
double DrawGetTextKerning(DrawingWand *wand)
2286 assert(wand != (DrawingWand *) NULL);
2287 assert(wand->signature == WandSignature);
2289 if (wand->debug != MagickFalse)
2290 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
2291 return(CurrentContext->kerning);
2316 WandExport
double DrawGetTextInterlineSpacing(DrawingWand *wand)
2318 assert(wand != (DrawingWand *) NULL);
2319 assert(wand->signature == WandSignature);
2320 if (wand->debug != MagickFalse)
2321 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
2322 return(CurrentContext->interline_spacing);
2347 WandExport
double DrawGetTextInterwordSpacing(DrawingWand *wand)
2349 assert(wand != (DrawingWand *) NULL);
2350 assert(wand->signature == WandSignature);
2351 if (wand->debug != MagickFalse)
2352 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
2353 return(CurrentContext->interword_spacing);
2382 static inline void SetMagickPixelPacket(
const Image *image,
2383 const PixelPacket *color,
const IndexPacket *index,MagickPixelPacket *pixel)
2385 pixel->red=(MagickRealType) GetPixelRed(color);
2386 pixel->green=(MagickRealType) GetPixelGreen(color);
2387 pixel->blue=(MagickRealType) GetPixelBlue(color);
2388 if (image->matte != MagickFalse)
2389 pixel->opacity=(MagickRealType) GetPixelOpacity(color);
2390 if (((image->colorspace == CMYKColorspace) ||
2391 (image->storage_class == PseudoClass)) &&
2392 (index != (
const IndexPacket *) NULL))
2393 pixel->index=(MagickRealType) GetPixelIndex(index);
2396 WandExport
char *DrawGetVectorGraphics(DrawingWand *wand)
2399 value[MaxTextExtent],
2412 assert(wand != (
const DrawingWand *) NULL);
2413 assert(wand->signature == WandSignature);
2414 if (wand->debug != MagickFalse)
2415 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
2416 xml_info=NewXMLTreeTag(
"drawing-wand");
2417 if (xml_info == (XMLTreeInfo *) NULL)
2418 return((
char *) NULL);
2419 (void) SetXMLTreeContent(xml_info,
" ");
2420 GetMagickPixelPacket(wand->image,&pixel);
2421 child=AddChildToXMLTree(xml_info,
"clip-path",0);
2422 if (child != (XMLTreeInfo *) NULL)
2423 (void) SetXMLTreeContent(child,CurrentContext->clip_mask);
2424 child=AddChildToXMLTree(xml_info,
"clip-units",0);
2425 if (child != (XMLTreeInfo *) NULL)
2427 (void) CopyMagickString(value,CommandOptionToMnemonic(
2428 MagickClipPathOptions,(ssize_t) CurrentContext->clip_units),
2430 (void) SetXMLTreeContent(child,value);
2432 child=AddChildToXMLTree(xml_info,
"decorate",0);
2433 if (child != (XMLTreeInfo *) NULL)
2435 (void) CopyMagickString(value,CommandOptionToMnemonic(
2436 MagickDecorateOptions,(ssize_t) CurrentContext->decorate),
2438 (void) SetXMLTreeContent(child,value);
2440 child=AddChildToXMLTree(xml_info,
"encoding",0);
2441 if (child != (XMLTreeInfo *) NULL)
2442 (void) SetXMLTreeContent(child,CurrentContext->encoding);
2443 child=AddChildToXMLTree(xml_info,
"fill",0);
2444 if (child != (XMLTreeInfo *) NULL)
2446 if (CurrentContext->fill.opacity != OpaqueOpacity)
2447 pixel.matte=CurrentContext->fill.opacity != OpaqueOpacity ?
2448 MagickTrue : MagickFalse;
2449 SetMagickPixelPacket(wand->image,&CurrentContext->fill,
2450 (
const IndexPacket *) NULL,&pixel);
2451 GetColorTuple(&pixel,MagickTrue,value);
2452 (void) SetXMLTreeContent(child,value);
2454 child=AddChildToXMLTree(xml_info,
"fill-opacity",0);
2455 if (child != (XMLTreeInfo *) NULL)
2457 (void) FormatLocaleString(value,MaxTextExtent,
"%.20g",
2458 QuantumScale*((
double) QuantumRange-(
double)
2459 CurrentContext->fill.opacity));
2460 (void) SetXMLTreeContent(child,value);
2462 child=AddChildToXMLTree(xml_info,
"fill-rule",0);
2463 if (child != (XMLTreeInfo *) NULL)
2465 (void) CopyMagickString(value,CommandOptionToMnemonic(
2466 MagickFillRuleOptions,(ssize_t) CurrentContext->fill_rule),
2468 (void) SetXMLTreeContent(child,value);
2470 child=AddChildToXMLTree(xml_info,
"font",0);
2471 if (child != (XMLTreeInfo *) NULL)
2472 (void) SetXMLTreeContent(child,CurrentContext->font);
2473 child=AddChildToXMLTree(xml_info,
"font-family",0);
2474 if (child != (XMLTreeInfo *) NULL)
2475 (void) SetXMLTreeContent(child,CurrentContext->family);
2476 child=AddChildToXMLTree(xml_info,
"font-size",0);
2477 if (child != (XMLTreeInfo *) NULL)
2479 (void) FormatLocaleString(value,MaxTextExtent,
"%.20g",
2480 CurrentContext->pointsize);
2481 (void) SetXMLTreeContent(child,value);
2483 child=AddChildToXMLTree(xml_info,
"font-stretch",0);
2484 if (child != (XMLTreeInfo *) NULL)
2486 (void) CopyMagickString(value,CommandOptionToMnemonic(
2487 MagickStretchOptions,(ssize_t) CurrentContext->stretch),MaxTextExtent);
2488 (void) SetXMLTreeContent(child,value);
2490 child=AddChildToXMLTree(xml_info,
"font-style",0);
2491 if (child != (XMLTreeInfo *) NULL)
2493 (void) CopyMagickString(value,CommandOptionToMnemonic(
2494 MagickStyleOptions,(ssize_t) CurrentContext->style),MaxTextExtent);
2495 (void) SetXMLTreeContent(child,value);
2497 child=AddChildToXMLTree(xml_info,
"font-weight",0);
2498 if (child != (XMLTreeInfo *) NULL)
2500 (void) FormatLocaleString(value,MaxTextExtent,
"%.20g",(
double)
2501 CurrentContext->weight);
2502 (void) SetXMLTreeContent(child,value);
2504 child=AddChildToXMLTree(xml_info,
"gravity",0);
2505 if (child != (XMLTreeInfo *) NULL)
2507 (void) CopyMagickString(value,CommandOptionToMnemonic(
2508 MagickGravityOptions,(ssize_t) CurrentContext->gravity),MaxTextExtent);
2509 (void) SetXMLTreeContent(child,value);
2511 child=AddChildToXMLTree(xml_info,
"stroke",0);
2512 if (child != (XMLTreeInfo *) NULL)
2514 if (CurrentContext->stroke.opacity != OpaqueOpacity)
2515 pixel.matte=CurrentContext->stroke.opacity != OpaqueOpacity ?
2516 MagickTrue : MagickFalse;
2517 SetMagickPixelPacket(wand->image,&CurrentContext->stroke,
2518 (
const IndexPacket *) NULL,&pixel);
2519 GetColorTuple(&pixel,MagickTrue,value);
2520 (void) SetXMLTreeContent(child,value);
2522 child=AddChildToXMLTree(xml_info,
"stroke-antialias",0);
2523 if (child != (XMLTreeInfo *) NULL)
2525 (void) FormatLocaleString(value,MaxTextExtent,
"%d",
2526 CurrentContext->stroke_antialias != MagickFalse ? 1 : 0);
2527 (void) SetXMLTreeContent(child,value);
2529 child=AddChildToXMLTree(xml_info,
"stroke-dasharray",0);
2530 if ((child != (XMLTreeInfo *) NULL) &&
2531 (CurrentContext->dash_pattern != (
double *) NULL))
2536 dash_pattern=AcquireString((
char *) NULL);
2537 for (i=0; fabs(CurrentContext->dash_pattern[i]) >= MagickEpsilon; i++)
2540 (void) ConcatenateString(&dash_pattern,
",");
2541 (void) FormatLocaleString(value,MaxTextExtent,
"%.20g",
2542 CurrentContext->dash_pattern[i]);
2543 (void) ConcatenateString(&dash_pattern,value);
2545 (void) SetXMLTreeContent(child,dash_pattern);
2546 dash_pattern=DestroyString(dash_pattern);
2548 child=AddChildToXMLTree(xml_info,
"stroke-dashoffset",0);
2549 if (child != (XMLTreeInfo *) NULL)
2551 (void) FormatLocaleString(value,MaxTextExtent,
"%.20g",
2552 CurrentContext->dash_offset);
2553 (void) SetXMLTreeContent(child,value);
2555 child=AddChildToXMLTree(xml_info,
"stroke-linecap",0);
2556 if (child != (XMLTreeInfo *) NULL)
2558 (void) CopyMagickString(value,CommandOptionToMnemonic(
2559 MagickLineCapOptions,(ssize_t) CurrentContext->linecap),MaxTextExtent);
2560 (void) SetXMLTreeContent(child,value);
2562 child=AddChildToXMLTree(xml_info,
"stroke-linejoin",0);
2563 if (child != (XMLTreeInfo *) NULL)
2565 (void) CopyMagickString(value,CommandOptionToMnemonic(
2566 MagickLineJoinOptions,(ssize_t) CurrentContext->linejoin),
2568 (void) SetXMLTreeContent(child,value);
2570 child=AddChildToXMLTree(xml_info,
"stroke-miterlimit",0);
2571 if (child != (XMLTreeInfo *) NULL)
2573 (void) FormatLocaleString(value,MaxTextExtent,
"%.20g",(
double)
2574 CurrentContext->miterlimit);
2575 (void) SetXMLTreeContent(child,value);
2577 child=AddChildToXMLTree(xml_info,
"stroke-opacity",0);
2578 if (child != (XMLTreeInfo *) NULL)
2580 (void) FormatLocaleString(value,MaxTextExtent,
"%.20g",QuantumScale*
2581 ((
double) QuantumRange-(
double) CurrentContext->stroke.opacity));
2582 (void) SetXMLTreeContent(child,value);
2584 child=AddChildToXMLTree(xml_info,
"stroke-width",0);
2585 if (child != (XMLTreeInfo *) NULL)
2587 (void) FormatLocaleString(value,MaxTextExtent,
"%.20g",
2588 CurrentContext->stroke_width);
2589 (void) SetXMLTreeContent(child,value);
2591 child=AddChildToXMLTree(xml_info,
"text-align",0);
2592 if (child != (XMLTreeInfo *) NULL)
2594 (void) CopyMagickString(value,CommandOptionToMnemonic(MagickAlignOptions,
2595 (ssize_t) CurrentContext->align),MaxTextExtent);
2596 (void) SetXMLTreeContent(child,value);
2598 child=AddChildToXMLTree(xml_info,
"text-antialias",0);
2599 if (child != (XMLTreeInfo *) NULL)
2601 (void) FormatLocaleString(value,MaxTextExtent,
"%d",
2602 CurrentContext->text_antialias != MagickFalse ? 1 : 0);
2603 (void) SetXMLTreeContent(child,value);
2605 child=AddChildToXMLTree(xml_info,
"text-undercolor",0);
2606 if (child != (XMLTreeInfo *) NULL)
2608 if (CurrentContext->undercolor.opacity != OpaqueOpacity)
2609 pixel.matte=CurrentContext->undercolor.opacity != OpaqueOpacity ?
2610 MagickTrue : MagickFalse;
2611 SetMagickPixelPacket(wand->image,&CurrentContext->undercolor,
2612 (
const IndexPacket *) NULL,&pixel);
2613 GetColorTuple(&pixel,MagickTrue,value);
2614 (void) SetXMLTreeContent(child,value);
2616 child=AddChildToXMLTree(xml_info,
"vector-graphics",0);
2617 if (child != (XMLTreeInfo *) NULL)
2618 (void) SetXMLTreeContent(child,wand->mvg);
2619 xml=XMLTreeInfoToXML(xml_info);
2620 xml_info=DestroyXMLTree(xml_info);
2650 WandExport
void DrawGetTextUnderColor(
const DrawingWand *wand,
2653 assert(wand != (
const DrawingWand *) NULL);
2654 assert(wand->signature == WandSignature);
2655 assert(under_color != (
PixelWand *) NULL);
2656 if (wand->debug != MagickFalse)
2657 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
2658 PixelSetQuantumColor(under_color,&CurrentContext->undercolor);
2693 WandExport
void DrawLine(DrawingWand *wand,
const double sx,
const double sy,
2694 const double ex,
const double ey)
2696 assert(wand != (DrawingWand *) NULL);
2697 assert(wand->signature == WandSignature);
2698 if (wand->debug != MagickFalse)
2699 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
2700 (void) MVGPrintf(wand,
"line %.20g %.20g %.20g %.20g\n",sx,sy,ex,ey);
2742 WandExport
void DrawMatte(DrawingWand *wand,
const double x,
const double y,
2743 const PaintMethod paint_method)
2745 assert(wand != (DrawingWand *) NULL);
2746 assert(wand->signature == WandSignature);
2747 if (wand->debug != MagickFalse)
2748 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
2749 (void) MVGPrintf(wand,
"matte %.20g %.20g '%s'\n",x,y,CommandOptionToMnemonic(
2750 MagickMethodOptions,(ssize_t) paint_method));
2778 WandExport
void DrawPathClose(DrawingWand *wand)
2780 assert(wand != (DrawingWand *) NULL);
2781 assert(wand->signature == WandSignature);
2782 if (wand->debug != MagickFalse)
2783 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
2784 (void) MVGAutoWrapPrintf(wand,
"%s",wand->path_mode == AbsolutePathMode ?
2829 static void DrawPathCurveTo(DrawingWand *wand,
const PathMode mode,
2830 const double x1,
const double y1,
const double x2,
const double y2,
2831 const double x,
const double y)
2833 assert(wand != (DrawingWand *) NULL);
2834 assert(wand->signature == WandSignature);
2835 if (wand->debug != MagickFalse)
2836 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
2837 if ((wand->path_operation != PathCurveToOperation) ||
2838 (wand->path_mode != mode))
2840 wand->path_operation=PathCurveToOperation;
2841 wand->path_mode=mode;
2842 (void) MVGAutoWrapPrintf(wand,
"%c%.20g %.20g %.20g %.20g %.20g %.20g",
2843 mode == AbsolutePathMode ?
'C' :
'c',x1,y1,x2,y2,x,y);
2846 (
void) MVGAutoWrapPrintf(wand,
" %.20g %.20g %.20g %.20g %.20g %.20g",x1,y1,
2850 WandExport
void DrawPathCurveToAbsolute(DrawingWand *wand,
const double x1,
2851 const double y1,
const double x2,
const double y2,
const double x,
const double y)
2853 assert(wand != (DrawingWand *) NULL);
2854 assert(wand->signature == WandSignature);
2855 if (wand->debug != MagickFalse)
2856 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
2857 DrawPathCurveTo(wand,AbsolutePathMode,x1,y1,x2,y2,x,y);
2900 WandExport
void DrawPathCurveToRelative(DrawingWand *wand,
const double x1,
2901 const double y1,
const double x2,
const double y2,
const double x,
const double y)
2903 assert(wand != (DrawingWand *) NULL);
2904 assert(wand->signature == WandSignature);
2905 if (wand->debug != MagickFalse)
2906 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
2907 DrawPathCurveTo(wand,RelativePathMode,x1,y1,x2,y2,x,y);
2945 static void DrawPathCurveToQuadraticBezier(DrawingWand *wand,
2946 const PathMode mode,
const double x1,
double y1,
const double x,
const double y)
2948 assert(wand != (DrawingWand *) NULL);
2949 assert(wand->signature == WandSignature);
2950 if (wand->debug != MagickFalse)
2951 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
2952 if ((wand->path_operation != PathCurveToQuadraticBezierOperation) ||
2953 (wand->path_mode != mode))
2955 wand->path_operation=PathCurveToQuadraticBezierOperation;
2956 wand->path_mode=mode;
2957 (void) MVGAutoWrapPrintf(wand,
"%c%.20g %.20g %.20g %.20g",
2958 mode == AbsolutePathMode ?
'Q' :
'q',x1,y1,x,y);
2961 (
void) MVGAutoWrapPrintf(wand,
" %.20g %.20g %.20g %.20g",x1,y1,x,y);
2964 WandExport
void DrawPathCurveToQuadraticBezierAbsolute(DrawingWand *wand,
2965 const double x1,
const double y1,
const double x,
const double y)
2967 assert(wand != (DrawingWand *) NULL);
2968 assert(wand->signature == WandSignature);
2969 if (wand->debug != MagickFalse)
2970 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
2971 DrawPathCurveToQuadraticBezier(wand,AbsolutePathMode,x1,y1,x,y);
3008 WandExport
void DrawPathCurveToQuadraticBezierRelative(DrawingWand *wand,
3009 const double x1,
const double y1,
const double x,
const double y)
3011 assert(wand != (DrawingWand *) NULL);
3012 assert(wand->signature == WandSignature);
3013 if (wand->debug != MagickFalse)
3014 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
3015 DrawPathCurveToQuadraticBezier(wand,RelativePathMode,x1,y1,x,y);
3057 static void DrawPathCurveToQuadraticBezierSmooth(DrawingWand *wand,
3058 const PathMode mode,
const double x,
const double y)
3060 assert(wand != (DrawingWand *) NULL);
3061 assert(wand->signature == WandSignature);
3062 if (wand->debug != MagickFalse)
3063 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
3064 if ((wand->path_operation != PathCurveToQuadraticBezierSmoothOperation) ||
3065 (wand->path_mode != mode))
3067 wand->path_operation=PathCurveToQuadraticBezierSmoothOperation;
3068 wand->path_mode=mode;
3069 (void) MVGAutoWrapPrintf(wand,
"%c%.20g %.20g",mode == AbsolutePathMode ?
3073 (
void) MVGAutoWrapPrintf(wand,
" %.20g %.20g",x,y);
3076 WandExport
void DrawPathCurveToQuadraticBezierSmoothAbsolute(DrawingWand *wand,
3077 const double x,
const double y)
3079 assert(wand != (DrawingWand *) NULL);
3080 assert(wand->signature == WandSignature);
3081 if (wand->debug != MagickFalse)
3082 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
3083 DrawPathCurveToQuadraticBezierSmooth(wand,AbsolutePathMode,x,y);
3123 WandExport
void DrawPathCurveToQuadraticBezierSmoothRelative(DrawingWand *wand,
3124 const double x,
const double y)
3126 DrawPathCurveToQuadraticBezierSmooth(wand,RelativePathMode,x,y);
3171 static void DrawPathCurveToSmooth(DrawingWand *wand,
const PathMode mode,
3172 const double x2,
const double y2,
const double x,
const double y)
3174 assert(wand != (DrawingWand *) NULL);
3175 assert(wand->signature == WandSignature);
3176 if (wand->debug != MagickFalse)
3177 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
3178 if ((wand->path_operation != PathCurveToSmoothOperation) ||
3179 (wand->path_mode != mode))
3181 wand->path_operation=PathCurveToSmoothOperation;
3182 wand->path_mode=mode;
3183 (void) MVGAutoWrapPrintf(wand,
"%c%.20g %.20g %.20g %.20g",
3184 mode == AbsolutePathMode ?
'S' :
's',x2,y2,x,y);
3187 (
void) MVGAutoWrapPrintf(wand,
" %.20g %.20g %.20g %.20g",x2,y2,x,y);
3190 WandExport
void DrawPathCurveToSmoothAbsolute(DrawingWand *wand,
const double x2,
3191 const double y2,
const double x,
const double y)
3193 assert(wand != (DrawingWand *) NULL);
3194 assert(wand->signature == WandSignature);
3195 if (wand->debug != MagickFalse)
3196 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
3197 DrawPathCurveToSmooth(wand,AbsolutePathMode,x2,y2,x,y);
3240 WandExport
void DrawPathCurveToSmoothRelative(DrawingWand *wand,
const double x2,
3241 const double y2,
const double x,
const double y)
3243 assert(wand != (DrawingWand *) NULL);
3244 assert(wand->signature == WandSignature);
3245 if (wand->debug != MagickFalse)
3246 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
3247 DrawPathCurveToSmooth(wand,RelativePathMode,x2,y2,x,y);
3299 static void DrawPathEllipticArc(DrawingWand *wand,
const PathMode mode,
3300 const double rx,
const double ry,
const double x_axis_rotation,
3301 const MagickBooleanType large_arc_flag,
const MagickBooleanType sweep_flag,
3302 const double x,
const double y)
3304 assert(wand != (DrawingWand *) NULL);
3305 assert(wand->signature == WandSignature);
3306 if (wand->debug != MagickFalse)
3307 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
3308 if ((wand->path_operation != PathEllipticArcOperation) ||
3309 (wand->path_mode != mode))
3311 wand->path_operation=PathEllipticArcOperation;
3312 wand->path_mode=mode;
3313 (void) MVGAutoWrapPrintf(wand,
"%c%.20g %.20g %.20g %u %u %.20g %.20g",
3314 mode == AbsolutePathMode ?
'A' :
'a',rx,ry,x_axis_rotation,
3315 large_arc_flag,sweep_flag,x,y);
3318 (
void) MVGAutoWrapPrintf(wand,
" %.20g %.20g %.20g %u %u %.20g %.20g",rx,ry,
3319 x_axis_rotation,large_arc_flag,sweep_flag,x,y);
3322 WandExport
void DrawPathEllipticArcAbsolute(DrawingWand *wand,
const double rx,
3323 const double ry,
const double x_axis_rotation,
3324 const MagickBooleanType large_arc_flag,
const MagickBooleanType sweep_flag,
3325 const double x,
const double y)
3327 assert(wand != (DrawingWand *) NULL);
3328 assert(wand->signature == WandSignature);
3329 if (wand->debug != MagickFalse)
3330 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
3331 DrawPathEllipticArc(wand,AbsolutePathMode,rx,ry,x_axis_rotation,
3332 large_arc_flag,sweep_flag,x,y);
3382 WandExport
void DrawPathEllipticArcRelative(DrawingWand *wand,
const double rx,
3383 const double ry,
const double x_axis_rotation,
3384 const MagickBooleanType large_arc_flag,
const MagickBooleanType sweep_flag,
3385 const double x,
const double y)
3387 DrawPathEllipticArc(wand,RelativePathMode,rx,ry,x_axis_rotation,
3388 large_arc_flag,sweep_flag,x,y);
3413 WandExport
void DrawPathFinish(DrawingWand *wand)
3415 assert(wand != (DrawingWand *) NULL);
3416 assert(wand->signature == WandSignature);
3417 if (wand->debug != MagickFalse)
3418 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
3419 (void) MVGPrintf(wand,
"'\n");
3420 wand->path_operation=PathDefaultOperation;
3421 wand->path_mode=DefaultPathMode;
3453 static void DrawPathLineTo(DrawingWand *wand,
const PathMode mode,
3454 const double x,
const double y)
3456 assert(wand != (DrawingWand *) NULL);
3457 assert(wand->signature == WandSignature);
3458 if (wand->debug != MagickFalse)
3459 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
3460 if ((wand->path_operation != PathLineToOperation) ||
3461 (wand->path_mode != mode))
3463 wand->path_operation=PathLineToOperation;
3464 wand->path_mode=mode;
3465 (void) MVGAutoWrapPrintf(wand,
"%c%.20g %.20g",mode == AbsolutePathMode ?
3469 (
void) MVGAutoWrapPrintf(wand,
" %.20g %.20g",x,y);
3472 WandExport
void DrawPathLineToAbsolute(DrawingWand *wand,
const double x,
3475 assert(wand != (DrawingWand *) NULL);
3476 assert(wand->signature == WandSignature);
3477 if (wand->debug != MagickFalse)
3478 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
3479 DrawPathLineTo(wand,AbsolutePathMode,x,y);
3511 WandExport
void DrawPathLineToRelative(DrawingWand *wand,
const double x,
3514 assert(wand != (DrawingWand *) NULL);
3515 assert(wand->signature == WandSignature);
3516 if (wand->debug != MagickFalse)
3517 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
3518 DrawPathLineTo(wand,RelativePathMode,x,y);
3549 static void DrawPathLineToHorizontal(DrawingWand *wand,
const PathMode mode,
3552 assert(wand != (DrawingWand *) NULL);
3553 assert(wand->signature == WandSignature);
3554 if (wand->debug != MagickFalse)
3555 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
3556 if ((wand->path_operation != PathLineToHorizontalOperation) ||
3557 (wand->path_mode != mode))
3559 wand->path_operation=PathLineToHorizontalOperation;
3560 wand->path_mode=mode;
3561 (void) MVGAutoWrapPrintf(wand,
"%c%.20g",mode == AbsolutePathMode ?
3565 (
void) MVGAutoWrapPrintf(wand,
" %.20g",x);
3568 WandExport
void DrawPathLineToHorizontalAbsolute(DrawingWand *wand,
3571 assert(wand != (DrawingWand *) NULL);
3572 assert(wand->signature == WandSignature);
3573 if (wand->debug != MagickFalse)
3574 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
3575 DrawPathLineToHorizontal(wand,AbsolutePathMode,x);
3605 WandExport
void DrawPathLineToHorizontalRelative(DrawingWand *wand,
3608 DrawPathLineToHorizontal(wand,RelativePathMode,x);
3639 static void DrawPathLineToVertical(DrawingWand *wand,
const PathMode mode,
3642 assert(wand != (DrawingWand *) NULL);
3643 assert(wand->signature == WandSignature);
3644 if (wand->debug != MagickFalse)
3645 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
3646 if ((wand->path_operation != PathLineToVerticalOperation) ||
3647 (wand->path_mode != mode))
3649 wand->path_operation=PathLineToVerticalOperation;
3650 wand->path_mode=mode;
3651 (void) MVGAutoWrapPrintf(wand,
"%c%.20g",mode == AbsolutePathMode ?
3655 (
void) MVGAutoWrapPrintf(wand,
" %.20g",y);
3658 WandExport
void DrawPathLineToVerticalAbsolute(DrawingWand *wand,
const double y)
3660 assert(wand != (DrawingWand *) NULL);
3661 assert(wand->signature == WandSignature);
3662 if (wand->debug != MagickFalse)
3663 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
3664 DrawPathLineToVertical(wand,AbsolutePathMode,y);
3694 WandExport
void DrawPathLineToVerticalRelative(DrawingWand *wand,
const double y)
3696 assert(wand != (DrawingWand *) NULL);
3697 assert(wand->signature == WandSignature);
3698 if (wand->debug != MagickFalse)
3699 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
3700 DrawPathLineToVertical(wand,RelativePathMode,y);
3732 static void DrawPathMoveTo(DrawingWand *wand,
const PathMode mode,
const double x,
3735 assert(wand != (DrawingWand *) NULL);
3736 assert(wand->signature == WandSignature);
3737 if (wand->debug != MagickFalse)
3738 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
3739 if ((wand->path_operation != PathMoveToOperation) ||
3740 (wand->path_mode != mode))
3742 wand->path_operation=PathMoveToOperation;
3743 wand->path_mode=mode;
3744 (void) MVGAutoWrapPrintf(wand,
"%c%.20g %.20g",mode == AbsolutePathMode ?
3748 (
void) MVGAutoWrapPrintf(wand,
" %.20g %.20g",x,y);
3751 WandExport
void DrawPathMoveToAbsolute(DrawingWand *wand,
const double x,
3754 assert(wand != (DrawingWand *) NULL);
3755 assert(wand->signature == WandSignature);
3756 if (wand->debug != MagickFalse)
3757 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
3758 DrawPathMoveTo(wand,AbsolutePathMode,x,y);
3790 WandExport
void DrawPathMoveToRelative(DrawingWand *wand,
const double x,
3793 assert(wand != (DrawingWand *) NULL);
3794 assert(wand->signature == WandSignature);
3795 if (wand->debug != MagickFalse)
3796 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
3797 DrawPathMoveTo(wand,RelativePathMode,x,y);
3826 WandExport
void DrawPathStart(DrawingWand *wand)
3828 assert(wand != (DrawingWand *) NULL);
3829 assert(wand->signature == WandSignature);
3830 if (wand->debug != MagickFalse)
3831 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
3832 (void) MVGPrintf(wand,
"path '");
3833 wand->path_operation=PathDefaultOperation;
3834 wand->path_mode=DefaultPathMode;
3863 WandExport
void DrawPoint(DrawingWand *wand,
const double x,
const double y)
3865 assert(wand != (DrawingWand *) NULL);
3866 assert(wand->signature == WandSignature);
3867 if (wand->debug != MagickFalse)
3868 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
3869 (void) MVGPrintf(wand,
"point %.20g %.20g\n",x,y);
3900 WandExport
void DrawPolygon(DrawingWand *wand,
3901 const size_t number_coordinates,
const PointInfo *coordinates)
3903 assert(wand != (DrawingWand *) NULL);
3904 assert(wand->signature == WandSignature);
3905 if (wand->debug != MagickFalse)
3906 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
3907 MVGAppendPointsCommand(wand,
"polygon",number_coordinates,coordinates);
3938 WandExport
void DrawPolyline(DrawingWand *wand,
3939 const size_t number_coordinates,
const PointInfo *coordinates)
3941 assert(wand != (DrawingWand *) NULL);
3942 assert(wand->signature == WandSignature);
3943 if (wand->debug != MagickFalse)
3944 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
3945 MVGAppendPointsCommand(wand,
"polyline",number_coordinates,coordinates);
3970 WandExport
void DrawPopClipPath(DrawingWand *wand)
3972 assert(wand != (DrawingWand *) NULL);
3973 assert(wand->signature == WandSignature);
3974 if (wand->debug != MagickFalse)
3975 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
3976 if (wand->indent_depth > 0)
3977 wand->indent_depth--;
3978 (void) MVGPrintf(wand,
"pop clip-path\n");
4003 WandExport
void DrawPopDefs(DrawingWand *wand)
4005 assert(wand != (DrawingWand *) NULL);
4006 assert(wand->signature == WandSignature);
4007 if (wand->debug != MagickFalse)
4008 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
4009 if (wand->indent_depth > 0)
4010 wand->indent_depth--;
4011 (void) MVGPrintf(wand,
"pop defs\n");
4036 WandExport MagickBooleanType DrawPopPattern(DrawingWand *wand)
4039 geometry[MaxTextExtent],
4042 assert(wand != (DrawingWand *) NULL);
4043 assert(wand->signature == WandSignature);
4044 if (wand->debug != MagickFalse)
4045 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
4046 if (wand->image == (Image *) NULL)
4047 ThrowDrawException(WandError,
"ContainsNoImages",wand->name);
4048 if (wand->pattern_id == (
const char *) NULL)
4050 ThrowDrawException(DrawWarning,
"NotCurrentlyPushingPatternDefinition",
4052 return(MagickFalse);
4054 (void) FormatLocaleString(key,MaxTextExtent,
"%s",wand->pattern_id);
4055 (void) SetImageArtifact(wand->image,key,wand->mvg+wand->pattern_offset);
4056 (void) FormatLocaleString(geometry,MaxTextExtent,
"%.20gx%.20g%+.20g%+.20g",
4057 (
double) wand->pattern_bounds.width,(double) wand->pattern_bounds.height,
4058 (
double) wand->pattern_bounds.x,(double) wand->pattern_bounds.y);
4059 (void) SetImageArtifact(wand->image,key,geometry);
4060 wand->pattern_id=DestroyString(wand->pattern_id);
4061 wand->pattern_offset=0;
4062 wand->pattern_bounds.x=0;
4063 wand->pattern_bounds.y=0;
4064 wand->pattern_bounds.width=0;
4065 wand->pattern_bounds.height=0;
4066 wand->filter_off=MagickTrue;
4067 if (wand->indent_depth > 0)
4068 wand->indent_depth--;
4069 (void) MVGPrintf(wand,
"pop pattern\n");
4099 WandExport
void DrawPushClipPath(DrawingWand *wand,
const char *clip_mask_id)
4101 assert(wand != (DrawingWand *) NULL);
4102 assert(wand->signature == WandSignature);
4103 if (wand->debug != MagickFalse)
4104 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
4105 assert(clip_mask_id != (
const char *) NULL);
4106 (void) MVGPrintf(wand,
"push clip-path \"%s\"\n",clip_mask_id);
4107 wand->indent_depth++;
4134 WandExport
void DrawPushDefs(DrawingWand *wand)
4136 assert(wand != (DrawingWand *) NULL);
4137 assert(wand->signature == WandSignature);
4138 if (wand->debug != MagickFalse)
4139 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
4140 (void) MVGPrintf(wand,
"push defs\n");
4141 wand->indent_depth++;
4183 WandExport MagickBooleanType DrawPushPattern(DrawingWand *wand,
4184 const char *pattern_id,
const double x,
const double y,
const double width,
4185 const double height)
4187 assert(wand != (DrawingWand *) NULL);
4188 assert(wand->signature == WandSignature);
4189 if (wand->debug != MagickFalse)
4190 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
4191 assert(pattern_id != (
const char *) NULL);
4192 if (wand->pattern_id != NULL)
4194 ThrowDrawException(DrawError,
"AlreadyPushingPatternDefinition",
4196 return(MagickFalse);
4198 wand->filter_off=MagickTrue;
4199 (void) MVGPrintf(wand,
"push pattern %s %.20g %.20g %.20g %.20g\n",pattern_id,
4201 wand->indent_depth++;
4202 wand->pattern_id=AcquireString(pattern_id);
4203 wand->pattern_bounds.x=CastDoubleToLong(ceil(x-0.5));
4204 wand->pattern_bounds.y=CastDoubleToLong(ceil(y-0.5));
4205 wand->pattern_bounds.width=(size_t) CastDoubleToLong(floor(width+0.5));
4206 wand->pattern_bounds.height=(size_t) CastDoubleToLong(floor(height+0.5));
4207 wand->pattern_offset=wand->mvg_length;
4241 WandExport
void DrawRectangle(DrawingWand *wand,
const double x1,
const double y1,
4242 const double x2,
const double y2)
4244 assert(wand != (DrawingWand *) NULL);
4245 assert(wand->signature == WandSignature);
4246 if (wand->debug != MagickFalse)
4247 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
4248 if ((fabs(x2-x1) < MagickEpsilon) && (fabs(y2-y1) < MagickEpsilon))
4249 (void) MVGPrintf(wand,
"point %.20g %.20g\n",x1,y1);
4251 (
void) MVGPrintf(wand,
"rectangle %.20g %.20g %.20g %.20g\n",x1,y1,x2,y2);
4276 WandExport MagickBooleanType DrawRender(DrawingWand *wand)
4281 assert(wand != (
const DrawingWand *) NULL);
4282 assert(wand->signature == WandSignature);
4283 if (wand->debug != MagickFalse)
4284 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
4285 CurrentContext->primitive=wand->mvg;
4286 if (wand->debug != MagickFalse)
4287 (void) LogMagickEvent(DrawEvent,GetMagickModule(),
"MVG:\n'%s'\n",wand->mvg);
4288 if (wand->image == (Image *) NULL)
4289 ThrowDrawException(WandError,
"ContainsNoImages",wand->name);
4290 status=DrawImage(wand->image,CurrentContext);
4291 InheritException(wand->exception,&wand->image->exception);
4292 CurrentContext->primitive=(
char *) NULL;
4319 WandExport
void DrawResetVectorGraphics(DrawingWand *wand)
4321 assert(wand != (DrawingWand *) NULL);
4322 assert(wand->signature == WandSignature);
4323 if (wand->debug != MagickFalse)
4324 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
4325 if (wand->mvg != (
char *) NULL)
4326 wand->mvg=DestroyString(wand->mvg);
4356 WandExport
void DrawRotate(DrawingWand *wand,
const double degrees)
4358 assert(wand != (DrawingWand *) NULL);
4359 assert(wand->signature == WandSignature);
4360 if (wand->debug != MagickFalse)
4361 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
4362 (void) MVGPrintf(wand,
"rotate %.20g\n",degrees);
4402 WandExport
void DrawRoundRectangle(DrawingWand *wand,
double x1,
double y1,
4403 double x2,
double y2,
double rx,
double ry)
4405 assert(wand != (DrawingWand *) NULL);
4406 assert(wand->signature == WandSignature);
4407 if (wand->debug != MagickFalse)
4408 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
4409 (void) MVGPrintf(wand,
"roundrectangle %.20g %.20g %.20g %.20g %.20g %.20g\n",
4440 WandExport
void DrawScale(DrawingWand *wand,
const double x,
const double y)
4442 assert(wand != (DrawingWand *) NULL);
4443 assert(wand->signature == WandSignature);
4444 if (wand->debug != MagickFalse)
4445 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
4446 (void) MVGPrintf(wand,
"scale %.20g %.20g\n",x,y);
4475 static inline MagickBooleanType IsColorEqual(
const PixelPacket *p,
4476 const PixelPacket *q)
4478 if (GetPixelRed(p) != GetPixelRed(q))
4479 return(MagickFalse);
4480 if (GetPixelGreen(p) != GetPixelGreen(q))
4481 return(MagickFalse);
4482 if (GetPixelBlue(p) != GetPixelBlue(q))
4483 return(MagickFalse);
4484 if (GetPixelOpacity(p) != GetPixelOpacity(q))
4485 return(MagickFalse);
4489 WandExport
void DrawSetBorderColor(DrawingWand *wand,
4497 assert(wand != (DrawingWand *) NULL);
4498 assert(wand->signature == WandSignature);
4499 if (wand->debug != MagickFalse)
4500 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
4501 assert(border_wand != (
const PixelWand *) NULL);
4502 PixelGetQuantumColor(border_wand,&border_color);
4503 new_border=border_color;
4504 current_border=(&CurrentContext->border_color);
4505 if ((wand->filter_off != MagickFalse) ||
4506 (IsColorEqual(current_border,&new_border) == MagickFalse))
4508 CurrentContext->border_color=new_border;
4509 (void) MVGPrintf(wand,
"border-color '");
4510 MVGAppendColor(wand,&border_color);
4511 (void) MVGPrintf(wand,
"'\n");
4542 WandExport MagickBooleanType DrawSetClipPath(DrawingWand *wand,
4543 const char *clip_mask)
4545 assert(wand != (DrawingWand *) NULL);
4546 if (wand->debug != MagickFalse)
4547 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",clip_mask);
4548 assert(wand->signature == WandSignature);
4549 assert(clip_mask != (
const char *) NULL);
4550 if ((CurrentContext->clip_mask == (
const char *) NULL) ||
4551 (wand->filter_off != MagickFalse) ||
4552 (LocaleCompare(CurrentContext->clip_mask,clip_mask) != 0))
4554 (void) CloneString(&CurrentContext->clip_mask,clip_mask);
4555 #if DRAW_BINARY_IMPLEMENTATION
4556 if (wand->image == (Image *) NULL)
4557 ThrowDrawException(WandError,
"ContainsNoImages",wand->name);
4558 (void) DrawClipPath(wand->image,CurrentContext,CurrentContext->clip_mask);
4560 (void) MVGPrintf(wand,
"clip-path url(#%s)\n",clip_mask);
4589 WandExport
void DrawSetClipRule(DrawingWand *wand,
const FillRule fill_rule)
4591 assert(wand != (DrawingWand *) NULL);
4592 assert(wand->signature == WandSignature);
4593 if (wand->debug != MagickFalse)
4594 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
4595 if ((wand->filter_off != MagickFalse) ||
4596 (CurrentContext->fill_rule != fill_rule))
4598 CurrentContext->fill_rule=fill_rule;
4599 (void) MVGPrintf(wand,
"clip-rule '%s'\n",CommandOptionToMnemonic(
4600 MagickFillRuleOptions,(ssize_t) fill_rule));
4630 WandExport
void DrawSetClipUnits(DrawingWand *wand,
4631 const ClipPathUnits clip_units)
4633 assert(wand != (DrawingWand *) NULL);
4634 assert(wand->signature == WandSignature);
4635 if (wand->debug != MagickFalse)
4636 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
4637 if ((wand->filter_off != MagickFalse) ||
4638 (CurrentContext->clip_units != clip_units))
4640 CurrentContext->clip_units=clip_units;
4641 if (clip_units == ObjectBoundingBox)
4646 GetAffineMatrix(&affine);
4647 affine.sx=CurrentContext->bounds.x2;
4648 affine.sy=CurrentContext->bounds.y2;
4649 affine.tx=CurrentContext->bounds.x1;
4650 affine.ty=CurrentContext->bounds.y1;
4651 AdjustAffine(wand,&affine);
4653 (void) MVGPrintf(wand,
"clip-units '%s'\n",CommandOptionToMnemonic(
4654 MagickClipPathOptions,(ssize_t) clip_units));
4683 WandExport MagickBooleanType DrawSetDensity(DrawingWand *wand,
4684 const char *density)
4686 assert(wand != (DrawingWand *) NULL);
4687 if (wand->debug != MagickFalse)
4688 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",density);
4689 assert(wand->signature == MagickCoreSignature);
4690 assert(density != (
const char *) NULL);
4691 if ((CurrentContext->density == (
const char *) NULL) ||
4692 (wand->filter_off != MagickFalse) ||
4693 (LocaleCompare(CurrentContext->density,density) != 0))
4695 (void) CloneString(&CurrentContext->density,density);
4696 (void) MVGPrintf(wand,
"density '%s'\n",density);
4725 WandExport
void DrawSetFillColor(DrawingWand *wand,
const PixelWand *fill_wand)
4732 assert(wand != (DrawingWand *) NULL);
4733 assert(wand->signature == WandSignature);
4734 if (wand->debug != MagickFalse)
4735 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
4736 assert(fill_wand != (
const PixelWand *) NULL);
4737 PixelGetQuantumColor(fill_wand,&fill_color);
4738 new_fill=fill_color;
4739 current_fill=(&CurrentContext->fill);
4740 if ((wand->filter_off != MagickFalse) ||
4741 (IsColorEqual(current_fill,&new_fill) == MagickFalse))
4743 CurrentContext->fill=new_fill;
4744 (void) MVGPrintf(wand,
"fill '");
4745 MVGAppendColor(wand,&fill_color);
4746 (void) MVGPrintf(wand,
"'\n");
4775 WandExport
void DrawSetFillOpacity(DrawingWand *wand,
const double fill_opacity)
4780 assert(wand != (DrawingWand *) NULL);
4781 assert(wand->signature == WandSignature);
4782 if (wand->debug != MagickFalse)
4783 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
4784 opacity=ClampToQuantum((
double) QuantumRange*(1.0-fill_opacity));
4785 if ((wand->filter_off != MagickFalse) ||
4786 (CurrentContext->fill.opacity != opacity))
4788 CurrentContext->fill.opacity=opacity;
4789 (void) MVGPrintf(wand,
"fill-opacity %.20g\n",fill_opacity);
4820 WandExport MagickBooleanType DrawSetFontResolution(DrawingWand *wand,
4821 const double x_resolution,
const double y_resolution)
4824 density[MaxTextExtent];
4826 assert(wand != (DrawingWand *) NULL);
4827 assert(wand->signature == WandSignature);
4828 if (wand->debug != MagickFalse)
4829 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
4830 (void) FormatLocaleString(density,MaxTextExtent,
"%.20gx%.20g",x_resolution,
4832 (void) CloneString(&CurrentContext->density,density);
4861 WandExport
void DrawSetOpacity(DrawingWand *wand,
const double opacity)
4866 assert(wand != (DrawingWand *) NULL);
4867 assert(wand->signature == WandSignature);
4868 if (wand->debug != MagickFalse)
4869 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
4870 quantum_opacity=ClampToQuantum((
double) QuantumRange*(1.0-opacity));
4871 if ((wand->filter_off != MagickFalse) ||
4872 (CurrentContext->opacity != quantum_opacity))
4874 CurrentContext->opacity=quantum_opacity;
4875 (void) MVGPrintf(wand,
"opacity %.20g\n",opacity);
4907 WandExport MagickBooleanType DrawSetFillPatternURL(DrawingWand *wand,
4908 const char *fill_url)
4911 pattern[MaxTextExtent],
4912 pattern_spec[MaxTextExtent];
4914 assert(wand != (DrawingWand *) NULL);
4915 assert(wand->signature == WandSignature);
4916 if (wand->debug != MagickFalse)
4917 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",fill_url);
4918 if (wand->image == (Image *) NULL)
4919 ThrowDrawException(WandError,
"ContainsNoImages",wand->name);
4920 assert(fill_url != (
const char *) NULL);
4921 if (*fill_url !=
'#')
4923 ThrowDrawException(DrawError,
"NotARelativeURL",fill_url);
4924 return(MagickFalse);
4926 (void) FormatLocaleString(pattern,MaxTextExtent,
"%s",fill_url+1);
4927 if (GetImageArtifact(wand->image,pattern) == (
const char *) NULL)
4929 ThrowDrawException(DrawError,
"URLNotFound",fill_url)
4930 return(MagickFalse);
4932 (
void) FormatLocaleString(pattern_spec,MaxTextExtent,"url(%s)",fill_url);
4933 #if DRAW_BINARY_IMPLEMENTATION
4934 DrawPatternPath(wand->image,CurrentContext,pattern_spec,
4935 &CurrentContext->fill_pattern);
4937 if (CurrentContext->fill.opacity != (Quantum) TransparentOpacity)
4938 CurrentContext->fill.opacity=CurrentContext->opacity;
4939 (void) MVGPrintf(wand,
"fill %s\n",pattern_spec);
4967 WandExport
void DrawSetFillRule(DrawingWand *wand,
const FillRule fill_rule)
4969 assert(wand != (DrawingWand *) NULL);
4970 assert(wand->signature == WandSignature);
4971 if (wand->debug != MagickFalse)
4972 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
4973 if ((wand->filter_off != MagickFalse) ||
4974 (CurrentContext->fill_rule != fill_rule))
4976 CurrentContext->fill_rule=fill_rule;
4977 (void) MVGPrintf(wand,
"fill-rule '%s'\n",CommandOptionToMnemonic(
4978 MagickFillRuleOptions,(ssize_t) fill_rule));
5007 WandExport MagickBooleanType DrawSetFont(DrawingWand *wand,
5008 const char *font_name)
5010 assert(wand != (DrawingWand *) NULL);
5011 assert(wand->signature == WandSignature);
5012 if (wand->debug != MagickFalse)
5013 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
5014 assert(font_name != (
const char *) NULL);
5015 if ((wand->filter_off != MagickFalse) ||
5016 (CurrentContext->font == (
char *) NULL) ||
5017 (LocaleCompare(CurrentContext->font,font_name) != 0))
5019 (void) CloneString(&CurrentContext->font,font_name);
5020 (void) MVGPrintf(wand,
"font '%s'\n",font_name);
5050 WandExport MagickBooleanType DrawSetFontFamily(DrawingWand *wand,
5051 const char *font_family)
5053 assert(wand != (DrawingWand *) NULL);
5054 assert(wand->signature == WandSignature);
5055 if (wand->debug != MagickFalse)
5056 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
5057 assert(font_family != (
const char *) NULL);
5058 if ((wand->filter_off != MagickFalse) ||
5059 (CurrentContext->family == (
const char *) NULL) ||
5060 (LocaleCompare(CurrentContext->family,font_family) != 0))
5062 (void) CloneString(&CurrentContext->family,font_family);
5063 (void) MVGPrintf(wand,
"font-family '%s'\n",font_family);
5092 WandExport
void DrawSetFontSize(DrawingWand *wand,
const double pointsize)
5094 assert(wand != (DrawingWand *) NULL);
5095 assert(wand->signature == WandSignature);
5096 if (wand->debug != MagickFalse)
5097 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
5098 if ((wand->filter_off != MagickFalse) ||
5099 (fabs(CurrentContext->pointsize-pointsize) >= MagickEpsilon))
5101 CurrentContext->pointsize=pointsize;
5102 (void) MVGPrintf(wand,
"font-size %.20g\n",pointsize);
5135 WandExport
void DrawSetFontStretch(DrawingWand *wand,
5136 const StretchType font_stretch)
5138 assert(wand != (DrawingWand *) NULL);
5139 assert(wand->signature == WandSignature);
5140 if (wand->debug != MagickFalse)
5141 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
5142 if ((wand->filter_off != MagickFalse) ||
5143 (CurrentContext->stretch != font_stretch))
5145 CurrentContext->stretch=font_stretch;
5146 (void) MVGPrintf(wand,
"font-stretch '%s'\n",CommandOptionToMnemonic(
5147 MagickStretchOptions,(ssize_t) font_stretch));
5176 WandExport
void DrawSetFontStyle(DrawingWand *wand,
const StyleType style)
5178 assert(wand != (DrawingWand *) NULL);
5179 assert(wand->signature == WandSignature);
5180 if (wand->debug != MagickFalse)
5181 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
5182 if ((wand->filter_off != MagickFalse) ||
5183 (CurrentContext->style != style))
5185 CurrentContext->style=style;
5186 (void) MVGPrintf(wand,
"font-style '%s'\n",CommandOptionToMnemonic(
5187 MagickStyleOptions,(ssize_t) style));
5216 WandExport
void DrawSetFontWeight(DrawingWand *wand,
5217 const size_t font_weight)
5219 assert(wand != (DrawingWand *) NULL);
5220 assert(wand->signature == WandSignature);
5221 if (wand->debug != MagickFalse)
5222 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
5223 if ((wand->filter_off != MagickFalse) ||
5224 (CurrentContext->weight != font_weight))
5226 CurrentContext->weight=font_weight;
5227 (void) MVGPrintf(wand,
"font-weight %.20g\n",(
double) font_weight);
5259 WandExport
void DrawSetGravity(DrawingWand *wand,
const GravityType gravity)
5261 assert(wand != (DrawingWand *) NULL);
5262 assert(wand->signature == WandSignature);
5263 if (wand->debug != MagickFalse)
5264 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
5265 if ((wand->filter_off != MagickFalse) ||
5266 (CurrentContext->gravity != gravity) || (gravity != ForgetGravity))
5268 CurrentContext->gravity=gravity;
5269 (void) MVGPrintf(wand,
"gravity '%s'\n",CommandOptionToMnemonic(
5270 MagickGravityOptions,(ssize_t) gravity));
5299 WandExport
void DrawSetStrokeColor(DrawingWand *wand,
5307 assert(wand != (DrawingWand *) NULL);
5308 assert(wand->signature == WandSignature);
5309 if (wand->debug != MagickFalse)
5310 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
5311 assert(stroke_wand != (
const PixelWand *) NULL);
5312 PixelGetQuantumColor(stroke_wand,&stroke_color);
5313 new_stroke=stroke_color;
5314 current_stroke=(&CurrentContext->stroke);
5315 if ((wand->filter_off != MagickFalse) ||
5316 (IsColorEqual(current_stroke,&new_stroke) == MagickFalse))
5318 CurrentContext->stroke=new_stroke;
5319 (void) MVGPrintf(wand,
"stroke '");
5320 MVGAppendColor(wand,&stroke_color);
5321 (void) MVGPrintf(wand,
"'\n");
5350 WandExport MagickBooleanType DrawSetStrokePatternURL(DrawingWand *wand,
5351 const char *stroke_url)
5354 pattern[MaxTextExtent],
5355 pattern_spec[MaxTextExtent];
5357 assert(wand != (DrawingWand *) NULL);
5358 assert(wand->signature == WandSignature);
5359 if (wand->debug != MagickFalse)
5360 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
5361 if (wand->image == (Image *) NULL)
5362 ThrowDrawException(WandError,
"ContainsNoImages",wand->name);
5363 assert(stroke_url != NULL);
5364 if (stroke_url[0] !=
'#')
5365 ThrowDrawException(DrawError,
"NotARelativeURL",stroke_url);
5366 (void) FormatLocaleString(pattern,MaxTextExtent,
"%s",stroke_url+1);
5367 if (GetImageArtifact(wand->image,pattern) == (
const char *) NULL)
5369 ThrowDrawException(DrawError,
"URLNotFound",stroke_url)
5370 return(MagickFalse);
5372 (
void) FormatLocaleString(pattern_spec,MaxTextExtent,"url(%s)",stroke_url);
5373 #if DRAW_BINARY_IMPLEMENTATION
5374 DrawPatternPath(wand->image,CurrentContext,pattern_spec,
5375 &CurrentContext->stroke_pattern);
5377 if (CurrentContext->stroke.opacity != (Quantum) TransparentOpacity)
5378 CurrentContext->stroke.opacity=CurrentContext->opacity;
5379 (void) MVGPrintf(wand,
"stroke %s\n",pattern_spec);
5411 WandExport
void DrawSetStrokeAntialias(DrawingWand *wand,
5412 const MagickBooleanType stroke_antialias)
5414 assert(wand != (DrawingWand *) NULL);
5415 assert(wand->signature == WandSignature);
5416 if (wand->debug != MagickFalse)
5417 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
5418 if ((wand->filter_off != MagickFalse) ||
5419 (CurrentContext->stroke_antialias != stroke_antialias))
5421 CurrentContext->stroke_antialias=stroke_antialias;
5422 (void) MVGPrintf(wand,
"stroke-antialias %i\n",stroke_antialias != 0 ?
5460 WandExport MagickBooleanType DrawSetStrokeDashArray(DrawingWand *wand,
5461 const size_t number_elements,
const double *dasharray)
5479 assert(wand != (DrawingWand *) NULL);
5480 assert(wand->signature == WandSignature);
5481 if (wand->debug != MagickFalse)
5482 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
5483 n_new=number_elements;
5484 if (dasharray == (
const double *) NULL)
5488 q=CurrentContext->dash_pattern;
5489 if (q != (
const double *) NULL)
5490 while (fabs(*q++) < MagickEpsilon)
5492 if ((n_old == 0) && (n_new == 0))
5498 if ((CurrentContext->dash_pattern != (
double *) NULL) &&
5499 (dasharray != (
double *) NULL))
5502 q=CurrentContext->dash_pattern;
5503 for (i=0; i < (ssize_t) n_new; i++)
5505 if (fabs((*p)-(*q)) >= MagickEpsilon)
5514 if ((wand->filter_off != MagickFalse) || (update != MagickFalse))
5516 if (CurrentContext->dash_pattern != (
double *) NULL)
5517 CurrentContext->dash_pattern=(
double *)
5518 RelinquishMagickMemory(CurrentContext->dash_pattern);
5521 CurrentContext->dash_pattern=(
double *) AcquireQuantumMemory((
size_t)
5522 n_new+1UL,
sizeof(*CurrentContext->dash_pattern));
5523 if (CurrentContext->dash_pattern == (
double *) NULL)
5525 ThrowDrawException(ResourceLimitError,
"MemoryAllocationFailed",
5527 return(MagickFalse);
5529 for (i=0; i < (ssize_t) n_new; i++)
5531 CurrentContext->dash_pattern[i]=0.0;
5532 if (dasharray != (
double *) NULL)
5533 CurrentContext->dash_pattern[i]=dasharray[i];
5535 CurrentContext->dash_pattern[n_new]=0.0;
5537 (void) MVGPrintf(wand,
"stroke-dasharray ");
5539 (void) MVGPrintf(wand,
"none\n");
5541 if (dasharray != (
double *) NULL)
5543 for (i=0; i < (ssize_t) n_new; i++)
5546 (void) MVGPrintf(wand,
",");
5547 (void) MVGPrintf(wand,
"%.20g",dasharray[i]);
5549 (void) MVGPrintf(wand,
"\n");
5581 WandExport
void DrawSetStrokeDashOffset(DrawingWand *wand,
5582 const double dash_offset)
5584 assert(wand != (DrawingWand *) NULL);
5585 assert(wand->signature == WandSignature);
5586 if (wand->debug != MagickFalse)
5587 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
5588 if ((wand->filter_off != MagickFalse) ||
5589 (fabs(CurrentContext->dash_offset-dash_offset) >= MagickEpsilon))
5591 CurrentContext->dash_offset=dash_offset;
5592 (void) MVGPrintf(wand,
"stroke-dashoffset %.20g\n",dash_offset);
5623 WandExport
void DrawSetStrokeLineCap(DrawingWand *wand,
const LineCap linecap)
5625 assert(wand != (DrawingWand *) NULL);
5626 assert(wand->signature == WandSignature);
5627 if (wand->debug != MagickFalse)
5628 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
5629 if ((wand->filter_off != MagickFalse) || (CurrentContext->linecap != linecap))
5631 CurrentContext->linecap=linecap;
5632 (void) MVGPrintf(wand,
"stroke-linecap '%s'\n",CommandOptionToMnemonic(
5633 MagickLineCapOptions,(ssize_t) linecap));
5664 WandExport
void DrawSetStrokeLineJoin(DrawingWand *wand,
const LineJoin linejoin)
5666 assert(wand != (DrawingWand *) NULL);
5667 assert(wand->signature == WandSignature);
5668 if (wand->debug != MagickFalse)
5669 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
5670 if ((wand->filter_off != MagickFalse) ||
5671 (CurrentContext->linejoin != linejoin))
5673 CurrentContext->linejoin=linejoin;
5674 (void) MVGPrintf(wand,
"stroke-linejoin '%s'\n",CommandOptionToMnemonic(
5675 MagickLineJoinOptions,(ssize_t) linejoin));
5708 WandExport
void DrawSetStrokeMiterLimit(DrawingWand *wand,
5709 const size_t miterlimit)
5711 assert(wand != (DrawingWand *) NULL);
5712 assert(wand->signature == WandSignature);
5713 if (wand->debug != MagickFalse)
5714 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
5715 if (CurrentContext->miterlimit != miterlimit)
5717 CurrentContext->miterlimit=miterlimit;
5718 (void) MVGPrintf(wand,
"stroke-miterlimit %.20g\n",(
double) miterlimit);
5747 WandExport
void DrawSetStrokeOpacity(DrawingWand *wand,
5748 const double stroke_opacity)
5753 assert(wand != (DrawingWand *) NULL);
5754 assert(wand->signature == WandSignature);
5755 if (wand->debug != MagickFalse)
5756 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
5757 opacity=ClampToQuantum((
double) QuantumRange*(1.0-stroke_opacity));
5758 if ((wand->filter_off != MagickFalse) ||
5759 (CurrentContext->stroke.opacity != opacity))
5761 CurrentContext->stroke.opacity=opacity;
5762 (void) MVGPrintf(wand,
"stroke-opacity %.20g\n",stroke_opacity);
5792 WandExport
void DrawSetStrokeWidth(DrawingWand *wand,
const double stroke_width)
5794 assert(wand != (DrawingWand *) NULL);
5795 assert(wand->signature == WandSignature);
5796 if (wand->debug != MagickFalse)
5797 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
5798 if ((wand->filter_off != MagickFalse) ||
5799 (fabs(CurrentContext->stroke_width-stroke_width) >= MagickEpsilon))
5801 CurrentContext->stroke_width=stroke_width;
5802 (void) MVGPrintf(wand,
"stroke-width %.20g\n",stroke_width);
5832 WandExport
void DrawSetTextAlignment(DrawingWand *wand,
5833 const AlignType alignment)
5835 assert(wand != (DrawingWand *) NULL);
5836 assert(wand->signature == WandSignature);
5837 if (wand->debug != MagickFalse)
5838 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
5839 if ((wand->filter_off != MagickFalse) ||
5840 (CurrentContext->align != alignment))
5842 CurrentContext->align=alignment;
5843 (void) MVGPrintf(wand,
"text-align '%s'\n",CommandOptionToMnemonic(
5844 MagickAlignOptions,(ssize_t) alignment));
5875 WandExport
void DrawSetTextAntialias(DrawingWand *wand,
5876 const MagickBooleanType text_antialias)
5878 assert(wand != (DrawingWand *) NULL);
5879 assert(wand->signature == WandSignature);
5880 if (wand->debug != MagickFalse)
5881 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
5882 if ((wand->filter_off != MagickFalse) ||
5883 (CurrentContext->text_antialias != text_antialias))
5885 CurrentContext->text_antialias=text_antialias;
5886 (void) MVGPrintf(wand,
"text-antialias %i\n",text_antialias != 0 ? 1 : 0);
5917 WandExport
void DrawSetTextDecoration(DrawingWand *wand,
5918 const DecorationType decoration)
5920 assert(wand != (DrawingWand *) NULL);
5921 assert(wand->signature == WandSignature);
5922 if (wand->debug != MagickFalse)
5923 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
5924 if ((wand->filter_off != MagickFalse) ||
5925 (CurrentContext->decorate != decoration))
5927 CurrentContext->decorate=decoration;
5928 (void) MVGPrintf(wand,
"decorate '%s'\n",CommandOptionToMnemonic(
5929 MagickDecorateOptions,(ssize_t) decoration));
5960 WandExport
void DrawSetTextDirection(DrawingWand *wand,
5961 const DirectionType direction)
5963 assert(wand != (DrawingWand *) NULL);
5964 assert(wand->signature == WandSignature);
5966 if (wand->debug != MagickFalse)
5967 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
5968 if ((wand->filter_off != MagickFalse) ||
5969 (CurrentContext->direction != direction))
5971 CurrentContext->direction=direction;
5972 (void) MVGPrintf(wand,
"direction '%s'\n",CommandOptionToMnemonic(
5973 MagickDirectionOptions,(ssize_t) direction));
6006 WandExport
void DrawSetTextEncoding(DrawingWand *wand,
const char *encoding)
6008 assert(wand != (DrawingWand *) NULL);
6009 assert(wand->signature == WandSignature);
6010 if (wand->debug != MagickFalse)
6011 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
6012 assert(encoding != (
char *) NULL);
6013 if ((wand->filter_off != MagickFalse) ||
6014 (CurrentContext->encoding == (
char *) NULL) ||
6015 (LocaleCompare(CurrentContext->encoding,encoding) != 0))
6017 (void) CloneString(&CurrentContext->encoding,encoding);
6018 (void) MVGPrintf(wand,
"encoding '%s'\n",encoding);
6046 WandExport
void DrawSetTextKerning(DrawingWand *wand,
const double kerning)
6048 assert(wand != (DrawingWand *) NULL);
6049 assert(wand->signature == WandSignature);
6051 if (wand->debug != MagickFalse)
6052 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
6053 if ((wand->filter_off != MagickFalse) &&
6054 (fabs((CurrentContext->kerning-kerning)) >= MagickEpsilon))
6056 CurrentContext->kerning=kerning;
6057 (void) MVGPrintf(wand,
"kerning %lf\n",kerning);
6086 WandExport
void DrawSetTextInterlineSpacing(DrawingWand *wand,
6087 const double interline_spacing)
6089 assert(wand != (DrawingWand *) NULL);
6090 assert(wand->signature == WandSignature);
6092 if (wand->debug != MagickFalse)
6093 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
6094 if ((wand->filter_off != MagickFalse) &&
6095 (fabs((CurrentContext->interline_spacing-
6096 interline_spacing)) >= MagickEpsilon))
6098 CurrentContext->interline_spacing=interline_spacing;
6099 (void) MVGPrintf(wand,
"interline-spacing %lf\n",interline_spacing);
6128 WandExport
void DrawSetTextInterwordSpacing(DrawingWand *wand,
6129 const double interword_spacing)
6131 assert(wand != (DrawingWand *) NULL);
6132 assert(wand->signature == WandSignature);
6134 if (wand->debug != MagickFalse)
6135 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
6136 if ((wand->filter_off != MagickFalse) &&
6137 (fabs((CurrentContext->interword_spacing-
6138 interword_spacing)) >= MagickEpsilon))
6140 CurrentContext->interword_spacing=interword_spacing;
6141 (void) MVGPrintf(wand,
"interword-spacing %lf\n",interword_spacing);
6171 WandExport
void DrawSetTextUnderColor(DrawingWand *wand,
6177 assert(wand != (DrawingWand *) NULL);
6178 assert(wand->signature == WandSignature);
6179 if (wand->debug != MagickFalse)
6180 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
6181 assert(under_wand != (
const PixelWand *) NULL);
6182 PixelGetQuantumColor(under_wand,&under_color);
6183 if ((wand->filter_off != MagickFalse) ||
6184 (IsColorEqual(&CurrentContext->undercolor,&under_color) == MagickFalse))
6186 CurrentContext->undercolor=under_color;
6187 (void) MVGPrintf(wand,
"text-undercolor '");
6188 MVGAppendColor(wand,&under_color);
6189 (void) MVGPrintf(wand,
"'\n");
6221 static inline MagickBooleanType IsPoint(
const char *point)
6229 value=strtol(point,&p,10);
6231 return(p != point ? MagickTrue : MagickFalse);
6234 WandExport MagickBooleanType DrawSetVectorGraphics(DrawingWand *wand,
6244 assert(wand != (DrawingWand *) NULL);
6245 assert(wand->signature == WandSignature);
6246 if (wand->debug != MagickFalse)
6247 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
6248 CurrentContext=DestroyDrawInfo(CurrentContext);
6249 CurrentContext=CloneDrawInfo((ImageInfo *) NULL,(DrawInfo *) NULL);
6250 if (xml == (
const char *) NULL)
6251 return(MagickFalse);
6252 xml_info=NewXMLTree(xml,wand->exception);
6253 if (xml_info == (XMLTreeInfo *) NULL)
6254 return(MagickFalse);
6255 child=GetXMLTreeChild(xml_info,
"clip-path");
6256 if (child != (XMLTreeInfo *) NULL)
6257 (void) CloneString(&CurrentContext->clip_mask,GetXMLTreeContent(child));
6258 child=GetXMLTreeChild(xml_info,
"clip-units");
6259 if (child != (XMLTreeInfo *) NULL)
6261 value=GetXMLTreeContent(child);
6262 if (value != (
const char *) NULL)
6263 CurrentContext->clip_units=(ClipPathUnits) ParseCommandOption(
6264 MagickClipPathOptions,MagickFalse,value);
6266 child=GetXMLTreeChild(xml_info,
"decorate");
6267 if (child != (XMLTreeInfo *) NULL)
6269 value=GetXMLTreeContent(child);
6270 if (value != (
const char *) NULL)
6271 CurrentContext->decorate=(DecorationType) ParseCommandOption(
6272 MagickDecorateOptions,MagickFalse,value);
6274 child=GetXMLTreeChild(xml_info,
"encoding");
6275 if (child != (XMLTreeInfo *) NULL)
6276 (void) CloneString(&CurrentContext->encoding,GetXMLTreeContent(child));
6277 child=GetXMLTreeChild(xml_info,
"fill");
6278 if (child != (XMLTreeInfo *) NULL)
6280 value=GetXMLTreeContent(child);
6281 if (value != (
const char *) NULL)
6282 (void) QueryColorDatabase(value,&CurrentContext->fill,wand->exception);
6284 child=GetXMLTreeChild(xml_info,
"fill-opacity");
6285 if (child != (XMLTreeInfo *) NULL)
6287 value=GetXMLTreeContent(child);
6288 if (value != (
const char *) NULL)
6289 CurrentContext->fill.opacity=ClampToQuantum((MagickRealType)
6290 QuantumRange*(1.0-StringToDouble(value,(
char **) NULL)));
6292 child=GetXMLTreeChild(xml_info,
"fill-rule");
6293 if (child != (XMLTreeInfo *) NULL)
6295 value=GetXMLTreeContent(child);
6296 if (value != (
const char *) NULL)
6297 CurrentContext->fill_rule=(FillRule) ParseCommandOption(
6298 MagickFillRuleOptions,MagickFalse,value);
6300 child=GetXMLTreeChild(xml_info,
"font");
6301 if (child != (XMLTreeInfo *) NULL)
6302 (void) CloneString(&CurrentContext->font,GetXMLTreeContent(child));
6303 child=GetXMLTreeChild(xml_info,
"font-family");
6304 if (child != (XMLTreeInfo *) NULL)
6305 (void) CloneString(&CurrentContext->family,GetXMLTreeContent(child));
6306 child=GetXMLTreeChild(xml_info,
"font-size");
6307 if (child != (XMLTreeInfo *) NULL)
6309 value=GetXMLTreeContent(child);
6310 if (value != (
const char *) NULL)
6311 CurrentContext->pointsize=StringToDouble(value,(
char **) NULL);
6313 child=GetXMLTreeChild(xml_info,
"font-stretch");
6314 if (child != (XMLTreeInfo *) NULL)
6316 value=GetXMLTreeContent(child);
6317 if (value != (
const char *) NULL)
6318 CurrentContext->stretch=(StretchType) ParseCommandOption(
6319 MagickStretchOptions,MagickFalse,value);
6321 child=GetXMLTreeChild(xml_info,
"font-style");
6322 if (child != (XMLTreeInfo *) NULL)
6324 value=GetXMLTreeContent(child);
6325 if (value != (
const char *) NULL)
6326 CurrentContext->style=(StyleType) ParseCommandOption(MagickStyleOptions,
6329 child=GetXMLTreeChild(xml_info,
"font-weight");
6330 if (child != (XMLTreeInfo *) NULL)
6332 value=GetXMLTreeContent(child);
6333 if (value != (
const char *) NULL)
6334 CurrentContext->weight=StringToUnsignedLong(value);
6336 child=GetXMLTreeChild(xml_info,
"gravity");
6337 if (child != (XMLTreeInfo *) NULL)
6339 value=GetXMLTreeContent(child);
6340 if (value != (
const char *) NULL)
6341 CurrentContext->gravity=(GravityType) ParseCommandOption(
6342 MagickGravityOptions,MagickFalse,value);
6344 child=GetXMLTreeChild(xml_info,
"stroke");
6345 if (child != (XMLTreeInfo *) NULL)
6347 value=GetXMLTreeContent(child);
6348 if (value != (
const char *) NULL)
6349 (void) QueryColorDatabase(value,&CurrentContext->stroke,
6352 child=GetXMLTreeChild(xml_info,
"stroke-antialias");
6353 if (child != (XMLTreeInfo *) NULL)
6355 value=GetXMLTreeContent(child);
6356 if (value != (
const char *) NULL)
6357 CurrentContext->stroke_antialias=StringToLong(value) != 0 ? MagickTrue :
6360 child=GetXMLTreeChild(xml_info,
"stroke-dasharray");
6361 if (child != (XMLTreeInfo *) NULL)
6364 token[MaxTextExtent];
6375 value=GetXMLTreeContent(child);
6376 if (value != (
const char *) NULL)
6378 if (CurrentContext->dash_pattern != (
double *) NULL)
6379 CurrentContext->dash_pattern=(
double *) RelinquishMagickMemory(
6380 CurrentContext->dash_pattern);
6382 if (IsPoint(q) != MagickFalse)
6388 (void) GetNextToken(p,&p,MaxTextExtent,token);
6390 (void) GetNextToken(p,&p,MaxTextExtent,token);
6391 for (x=0; IsPoint(token) != MagickFalse; x++)
6393 (void) GetNextToken(p,&p,MaxTextExtent,token);
6395 (void) GetNextToken(p,&p,MaxTextExtent,token);
6397 CurrentContext->dash_pattern=(
double *) AcquireQuantumMemory(
6398 (
size_t) (2UL*x)+1UL,
sizeof(*CurrentContext->dash_pattern));
6399 if (CurrentContext->dash_pattern == (
double *) NULL)
6400 ThrowWandFatalException(ResourceLimitFatalError,
6401 "MemoryAllocationFailed",wand->name);
6402 for (j=0; j < x; j++)
6404 (void) GetNextToken(q,&q,MaxTextExtent,token);
6406 (void) GetNextToken(q,&q,MaxTextExtent,token);
6407 CurrentContext->dash_pattern[j]=StringToDouble(token,
6410 if ((x & 0x01) != 0)
6411 for ( ; j < (2*x); j++)
6412 CurrentContext->dash_pattern[j]=
6413 CurrentContext->dash_pattern[j-x];
6414 CurrentContext->dash_pattern[j]=0.0;
6418 child=GetXMLTreeChild(xml_info,
"stroke-dashoffset");
6419 if (child != (XMLTreeInfo *) NULL)
6421 value=GetXMLTreeContent(child);
6422 if (value != (
const char *) NULL)
6423 CurrentContext->dash_offset=StringToDouble(value,(
char **) NULL);
6425 child=GetXMLTreeChild(xml_info,
"stroke-linecap");
6426 if (child != (XMLTreeInfo *) NULL)
6428 value=GetXMLTreeContent(child);
6429 if (value != (
const char *) NULL)
6430 CurrentContext->linecap=(LineCap) ParseCommandOption(
6431 MagickLineCapOptions,MagickFalse,value);
6433 child=GetXMLTreeChild(xml_info,
"stroke-linejoin");
6434 if (child != (XMLTreeInfo *) NULL)
6436 value=GetXMLTreeContent(child);
6437 if (value != (
const char *) NULL)
6438 CurrentContext->linejoin=(LineJoin) ParseCommandOption(
6439 MagickLineJoinOptions,MagickFalse,value);
6441 child=GetXMLTreeChild(xml_info,
"stroke-miterlimit");
6442 if (child != (XMLTreeInfo *) NULL)
6444 value=GetXMLTreeContent(child);
6445 if (value != (
const char *) NULL)
6446 CurrentContext->miterlimit=StringToUnsignedLong(value);
6448 child=GetXMLTreeChild(xml_info,
"stroke-opacity");
6449 if (child != (XMLTreeInfo *) NULL)
6451 value=GetXMLTreeContent(child);
6452 if (value != (
const char *) NULL)
6453 CurrentContext->stroke.opacity=ClampToQuantum((MagickRealType)
6454 QuantumRange*(1.0-StringToDouble(value,(
char **) NULL)));
6456 child=GetXMLTreeChild(xml_info,
"stroke-width");
6457 if (child != (XMLTreeInfo *) NULL)
6459 value=GetXMLTreeContent(child);
6460 if (value != (
const char *) NULL)
6465 weight=ParseCommandOption(MagickWeightOptions,MagickFalse,value);
6467 weight=(ssize_t) StringToUnsignedLong(value);
6468 CurrentContext->stroke_width=(double) weight;
6471 child=GetXMLTreeChild(xml_info,
"text-align");
6472 if (child != (XMLTreeInfo *) NULL)
6474 value=GetXMLTreeContent(child);
6475 if (value != (
const char *) NULL)
6476 CurrentContext->align=(AlignType) ParseCommandOption(MagickAlignOptions,
6479 child=GetXMLTreeChild(xml_info,
"text-antialias");
6480 if (child != (XMLTreeInfo *) NULL)
6482 value=GetXMLTreeContent(child);
6483 if (value != (
const char *) NULL)
6484 CurrentContext->text_antialias=StringToLong(value) != 0 ? MagickTrue :
6487 child=GetXMLTreeChild(xml_info,
"text-undercolor");
6488 if (child != (XMLTreeInfo *) NULL)
6490 value=GetXMLTreeContent(child);
6491 if (value != (
const char *) NULL)
6492 (void) QueryColorDatabase(value,&CurrentContext->undercolor,
6495 child=GetXMLTreeChild(xml_info,
"vector-graphics");
6496 if (child != (XMLTreeInfo *) NULL)
6498 (void) CloneString(&wand->mvg,GetXMLTreeContent(child));
6499 wand->mvg_length=strlen(wand->mvg);
6500 wand->mvg_alloc=wand->mvg_length+1;
6502 xml_info=DestroyXMLTree(xml_info);
6531 WandExport
void DrawSkewX(DrawingWand *wand,
const double degrees)
6533 assert(wand != (DrawingWand *) NULL);
6534 assert(wand->signature == WandSignature);
6535 if (wand->debug != MagickFalse)
6536 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
6537 (void) MVGPrintf(wand,
"skewX %.20g\n",degrees);
6565 WandExport
void DrawSkewY(DrawingWand *wand,
const double degrees)
6567 assert(wand != (DrawingWand *) NULL);
6568 assert(wand->signature == WandSignature);
6569 if (wand->debug != MagickFalse)
6570 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
6571 (void) MVGPrintf(wand,
"skewY %.20g\n",degrees);
6603 WandExport
void DrawTranslate(DrawingWand *wand,
const double x,
const double y)
6605 assert(wand != (DrawingWand *) NULL);
6606 assert(wand->signature == WandSignature);
6607 if (wand->debug != MagickFalse)
6608 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
6609 (void) MVGPrintf(wand,
"translate %.20g %.20g\n",x,y);
6647 WandExport
void DrawSetViewbox(DrawingWand *wand,ssize_t x1,ssize_t y1,
6648 ssize_t x2,ssize_t y2)
6650 assert(wand != (DrawingWand *) NULL);
6651 assert(wand->signature == WandSignature);
6652 if (wand->debug != MagickFalse)
6653 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
6654 (void) MVGPrintf(wand,
"viewbox %.20g %.20g %.20g %.20g\n",(
double) x1,
6655 (double) y1,(
double) x2,(
double) y2);
6680 WandExport MagickBooleanType IsDrawingWand(const DrawingWand *wand)
6682 if (wand == (
const DrawingWand *) NULL)
6683 return(MagickFalse);
6684 if (wand->signature != WandSignature)
6685 return(MagickFalse);
6686 if (LocaleNCompare(wand->name,DrawingWandId,strlen(DrawingWandId)) != 0)
6687 return(MagickFalse);
6710 WandExport DrawingWand *NewDrawingWand(
void)
6721 quantum=GetMagickQuantumDepth(&depth);
6722 if (depth != MAGICKCORE_QUANTUM_DEPTH)
6723 ThrowWandFatalException(WandError,
"QuantumDepthMismatch",quantum);
6724 wand=(DrawingWand *) AcquireMagickMemory(
sizeof(*wand));
6725 if (wand == (DrawingWand *) NULL)
6726 ThrowWandFatalException(ResourceLimitFatalError,
"MemoryAllocationFailed",
6727 GetExceptionMessage(errno));
6728 (void) memset(wand,0,
sizeof(*wand));
6729 wand->id=AcquireWandId();
6730 (void) FormatLocaleString(wand->name,MaxTextExtent,
"%s-%.20g",DrawingWandId,
6732 if (wand->debug != MagickFalse)
6733 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
6734 wand->mvg=(
char *) NULL;
6738 wand->pattern_id=(
char *) NULL;
6739 wand->pattern_offset=0;
6740 wand->pattern_bounds.x=0;
6741 wand->pattern_bounds.y=0;
6742 wand->pattern_bounds.width=0;
6743 wand->pattern_bounds.height=0;
6745 wand->graphic_context=(DrawInfo **) AcquireMagickMemory(
sizeof(
6746 *wand->graphic_context));
6747 if (wand->graphic_context == (DrawInfo **) NULL)
6748 ThrowWandFatalException(ResourceLimitFatalError,
"MemoryAllocationFailed",
6749 GetExceptionMessage(errno));
6750 wand->filter_off=MagickTrue;
6751 wand->indent_depth=0;
6752 wand->path_operation=PathDefaultOperation;
6753 wand->path_mode=DefaultPathMode;
6754 wand->image=AcquireImage((
const ImageInfo *) NULL);
6755 wand->exception=AcquireExceptionInfo();
6756 wand->destroy=MagickTrue;
6757 wand->debug=IsEventLogging();
6758 wand->signature=WandSignature;
6759 CurrentContext=CloneDrawInfo((ImageInfo *) NULL,(DrawInfo *) NULL);
6785 WandExport DrawInfo *PeekDrawingWand(
const DrawingWand *wand)
6790 assert(wand != (
const DrawingWand *) NULL);
6791 assert(wand->signature == WandSignature);
6792 if (wand->debug != MagickFalse)
6793 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
6794 draw_info=CloneDrawInfo((ImageInfo *) NULL,CurrentContext);
6795 (void) CloneString(&draw_info->primitive,wand->mvg);
6824 WandExport MagickBooleanType PopDrawingWand(DrawingWand *wand)
6826 assert(wand != (DrawingWand *) NULL);
6827 assert(wand->signature == WandSignature);
6828 if (wand->debug != MagickFalse)
6829 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
6830 if (wand->index == 0)
6832 ThrowDrawException(DrawError,
"UnbalancedGraphicContextPushPop",wand->name)
6833 return(MagickFalse);
6838 #if DRAW_BINARY_IMPLEMENTATION
6839 if (wand->image == (Image *) NULL)
6840 ThrowDrawException(WandError,
"ContainsNoImages",wand->name);
6841 if (CurrentContext->clip_mask != (
char *) NULL)
6842 if (LocaleCompare(CurrentContext->clip_mask,
6843 wand->graphic_context[wand->index-1]->clip_mask) != 0)
6844 (void) SetImageClippingMask(wand->image,(Image *) NULL);
6846 CurrentContext=DestroyDrawInfo(CurrentContext);
6848 if (wand->indent_depth > 0)
6849 wand->indent_depth--;
6850 (void) MVGPrintf(wand,
"pop graphic-context\n");
6879 WandExport MagickBooleanType PushDrawingWand(DrawingWand *wand)
6881 assert(wand != (DrawingWand *) NULL);
6882 assert(wand->signature == WandSignature);
6883 if (wand->debug != MagickFalse)
6884 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
6886 wand->graphic_context=(DrawInfo **) ResizeQuantumMemory(wand->graphic_context,
6887 (
size_t) wand->index+1UL,
sizeof(*wand->graphic_context));
6888 if (wand->graphic_context == (DrawInfo **) NULL)
6891 ThrowDrawException(ResourceLimitError,
"MemoryAllocationFailed",
6893 return(MagickFalse);
6895 CurrentContext=CloneDrawInfo((ImageInfo *) NULL,
6896 wand->graphic_context[wand->index-1]);
6897 (void) MVGPrintf(wand,
"push graphic-context\n");
6898 wand->indent_depth++;