49#include "MagickWand/studio.h"
50#include "MagickWand/MagickWand.h"
51#include "MagickWand/magick-wand-private.h"
52#include "MagickWand/wand.h"
53#include "MagickCore/image-private.h"
54#include "MagickCore/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,
97 name[MagickPathExtent];
160 MVGPrintf(DrawingWand *,
const char *,...) wand_attribute((format
162 MVGAutoWrapPrintf(DrawingWand *,const
char *,...) wand_attribute((format
166 MVGAppendColor(DrawingWand *,const PixelInfo *);
171static
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 == MagickWandSignature);
180 extent=20UL*MagickPathExtent;
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*MagickPathExtent))
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 count=vsnprintf(wand->mvg+wand->mvg_length,(
size_t) offset,format,argp);
231 if ((count < 0) || (count > (
int) offset))
232 ThrowDrawException(DrawError,
"UnableToPrint",format)
235 wand->mvg_length+=(size_t) count;
236 wand->mvg_width+=(size_t) count;
238 wand->mvg[wand->mvg_length]=
'\0';
239 if ((wand->mvg_length > 1) && (wand->mvg[wand->mvg_length-1] ==
'\n'))
241 assert((wand->mvg_length+1) < wand->mvg_alloc);
246static int MVGAutoWrapPrintf(DrawingWand *wand,
const char *format,...)
249 buffer[MagickPathExtent];
257 va_start(argp,format);
258 count=vsnprintf(buffer,
sizeof(buffer)-1,format,argp);
260 buffer[
sizeof(buffer)-1]=
'\0';
262 ThrowDrawException(DrawError,
"UnableToPrint",format)
265 if (((wand->mvg_width+(
size_t) count) > 78) && (buffer[count-1] !=
'\n'))
266 (void) MVGPrintf(wand,
"\n");
267 (void) MVGPrintf(wand,
"%s",buffer);
272static void MVGAppendColor(DrawingWand *wand,
const PixelInfo *packet)
274 if ((packet->red == 0) && (packet->green == 0) && (packet->blue == 0) &&
275 (packet->alpha == (Quantum) TransparentAlpha))
276 (void) MVGPrintf(wand,
"none");
280 tuple[MagickPathExtent];
282 GetColorTuple(packet,packet->colorspace != sRGBColorspace ? MagickFalse :
284 (void) MVGPrintf(wand,
"%s",tuple);
288static void MVGAppendPointsCommand(DrawingWand *wand,
const char *command,
289 const size_t number_coordinates,
const PointInfo *coordinates)
297 (void) MVGPrintf(wand,
"%s",command);
298 for (i=number_coordinates, coordinate=coordinates; i != 0; i--)
300 (void) MVGAutoWrapPrintf(wand,
" %.20g %.20g",coordinate->x,coordinate->y);
303 (void) MVGPrintf(wand,
"\n");
306static void AdjustAffine(DrawingWand *wand,
const AffineMatrix *affine)
308 assert(wand != (DrawingWand *) NULL);
309 assert(wand->signature == MagickWandSignature);
310 if (wand->debug != MagickFalse)
311 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
312 if ((affine->sx != 1.0) || (affine->rx != 0.0) || (affine->ry != 0.0) ||
313 (affine->sy != 1.0) || (affine->tx != 0.0) || (affine->ty != 0.0))
318 current=CurrentContext->affine;
319 CurrentContext->affine.sx=affine->sx*current.sx+affine->ry*current.rx;
320 CurrentContext->affine.rx=affine->rx*current.sx+affine->sy*current.rx;
321 CurrentContext->affine.ry=affine->sx*current.ry+affine->ry*current.sy;
322 CurrentContext->affine.sy=affine->rx*current.ry+affine->sy*current.sy;
323 CurrentContext->affine.tx=affine->sx*current.tx+affine->ry*current.ty+
325 CurrentContext->affine.ty=affine->rx*current.tx+affine->sy*current.ty+
355WandExport DrawingWand *AcquireDrawingWand(
const DrawInfo *draw_info,
361 wand=NewDrawingWand();
362 if (draw_info != (
const DrawInfo *) NULL)
364 CurrentContext=DestroyDrawInfo(CurrentContext);
365 CurrentContext=CloneDrawInfo((ImageInfo *) NULL,draw_info);
367 wand->image=DestroyImage(wand->image);
368 if (image != (Image *) NULL)
369 wand->destroy=MagickFalse;
396WandExport
void ClearDrawingWand(DrawingWand *wand)
398 assert(wand != (DrawingWand *) NULL);
399 assert(wand->signature == MagickWandSignature);
400 if (wand->debug != MagickFalse)
401 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
402 for ( ; wand->index > 0; wand->index--)
403 CurrentContext=DestroyDrawInfo(CurrentContext);
404 CurrentContext=DestroyDrawInfo(CurrentContext);
405 wand->graphic_context=(DrawInfo **) RelinquishMagickMemory(
406 wand->graphic_context);
407 if (wand->pattern_id != (
char *) NULL)
408 wand->pattern_id=DestroyString(wand->pattern_id);
409 wand->mvg=DestroyString(wand->mvg);
410 if ((wand->destroy != MagickFalse) && (wand->image != (Image *) NULL))
411 wand->image=DestroyImage(wand->image);
413 wand->image=(Image *) NULL;
414 wand->mvg=(
char *) NULL;
418 wand->pattern_id=(
char *) NULL;
419 wand->pattern_offset=0;
420 wand->pattern_bounds.x=0;
421 wand->pattern_bounds.y=0;
422 wand->pattern_bounds.width=0;
423 wand->pattern_bounds.height=0;
425 wand->graphic_context=(DrawInfo **) AcquireQuantumMemory(1,
426 sizeof(*wand->graphic_context));
427 if (wand->graphic_context == (DrawInfo **) NULL)
429 ThrowDrawException(ResourceLimitError,
"MemoryAllocationFailed",
433 CurrentContext=CloneDrawInfo((ImageInfo *) NULL,(DrawInfo *) NULL);
434 wand->filter_off=MagickTrue;
435 wand->indent_depth=0;
436 wand->path_operation=PathDefaultOperation;
437 wand->path_mode=DefaultPathMode;
438 wand->image=AcquireImage((
const ImageInfo *) NULL,wand->exception);
439 ClearMagickException(wand->exception);
440 wand->destroy=MagickTrue;
441 wand->debug=IsEventLogging();
466WandExport DrawingWand *CloneDrawingWand(
const DrawingWand *wand)
474 assert(wand != (DrawingWand *) NULL);
475 assert(wand->signature == MagickWandSignature);
476 if (wand->debug != MagickFalse)
477 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
478 clone_wand=(DrawingWand *) AcquireMagickMemory(
sizeof(*clone_wand));
479 if (clone_wand == (DrawingWand *) NULL)
480 ThrowWandFatalException(ResourceLimitFatalError,
"MemoryAllocationFailed",
482 (void) memset(clone_wand,0,
sizeof(*clone_wand));
483 clone_wand->id=AcquireWandId();
484 (void) FormatLocaleString(clone_wand->name,MagickPathExtent,
485 "DrawingWand-%.20g",(
double) clone_wand->id);
486 clone_wand->exception=AcquireExceptionInfo();
487 InheritException(clone_wand->exception,wand->exception);
488 clone_wand->mvg=AcquireString(wand->mvg);
489 clone_wand->mvg_length=strlen(clone_wand->mvg);
490 clone_wand->mvg_alloc=wand->mvg_length+1;
491 clone_wand->mvg_width=wand->mvg_width;
492 clone_wand->pattern_id=AcquireString(wand->pattern_id);
493 clone_wand->pattern_offset=wand->pattern_offset;
494 clone_wand->pattern_bounds=wand->pattern_bounds;
495 clone_wand->index=wand->index;
496 clone_wand->graphic_context=(DrawInfo **) AcquireQuantumMemory((
size_t)
497 wand->index+1UL,
sizeof(*wand->graphic_context));
498 if (clone_wand->graphic_context == (DrawInfo **) NULL)
499 ThrowWandFatalException(ResourceLimitFatalError,
"MemoryAllocationFailed",
501 for (i=0; i <= (ssize_t) wand->index; i++)
502 clone_wand->graphic_context[i]=CloneDrawInfo((ImageInfo *) NULL,
503 wand->graphic_context[i]);
504 clone_wand->filter_off=wand->filter_off;
505 clone_wand->indent_depth=wand->indent_depth;
506 clone_wand->path_operation=wand->path_operation;
507 clone_wand->path_mode=wand->path_mode;
508 clone_wand->image=wand->image;
509 if (wand->image != (Image *) NULL)
510 clone_wand->image=CloneImage(wand->image,0,0,MagickTrue,
511 clone_wand->exception);
512 clone_wand->destroy=MagickTrue;
513 clone_wand->debug=IsEventLogging();
514 if (clone_wand->debug != MagickFalse)
515 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",clone_wand->name);
516 clone_wand->signature=MagickWandSignature;
544WandExport DrawingWand *DestroyDrawingWand(DrawingWand *wand)
546 assert(wand != (DrawingWand *) NULL);
547 assert(wand->signature == MagickWandSignature);
548 if (wand->debug != MagickFalse)
549 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
550 for ( ; wand->index > 0; wand->index--)
551 CurrentContext=DestroyDrawInfo(CurrentContext);
552 CurrentContext=DestroyDrawInfo(CurrentContext);
553 wand->graphic_context=(DrawInfo **) RelinquishMagickMemory(
554 wand->graphic_context);
555 if (wand->pattern_id != (
char *) NULL)
556 wand->pattern_id=DestroyString(wand->pattern_id);
557 wand->mvg=DestroyString(wand->mvg);
558 if ((wand->destroy != MagickFalse) && (wand->image != (Image *) NULL))
559 wand->image=DestroyImage(wand->image);
560 wand->image=(Image *) NULL;
561 wand->exception=DestroyExceptionInfo(wand->exception);
562 wand->signature=(~MagickWandSignature);
563 RelinquishWandId(wand->id);
564 wand=(DrawingWand *) RelinquishMagickMemory(wand);
594WandExport
void DrawAffine(DrawingWand *wand,
const AffineMatrix *affine)
596 assert(wand != (DrawingWand *) NULL);
597 assert(wand->signature == MagickWandSignature);
598 if (wand->debug != MagickFalse)
599 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
600 assert(affine != (
const AffineMatrix *) NULL);
601 AdjustAffine(wand,affine);
602 (void) MVGPrintf(wand,
"affine %.20g %.20g %.20g %.20g %.20g %.20g\n",
603 affine->sx,affine->ry,affine->rx,affine->sy,affine->tx,affine->ty);
643WandExport
void DrawAlpha(DrawingWand *wand,
const double x,
const double y,
644 const PaintMethod paint_method)
646 assert(wand != (DrawingWand *) NULL);
647 assert(wand->signature == MagickWandSignature);
648 if (wand->debug != MagickFalse)
649 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
650 (void) MVGPrintf(wand,
"alpha %.20g %.20g '%s'\n",x,y,CommandOptionToMnemonic(
651 MagickMethodOptions,(ssize_t) paint_method));
683WandExport
void DrawAnnotation(DrawingWand *wand,
const double x,
const double y,
684 const unsigned char *text)
689 assert(wand != (DrawingWand *) NULL);
690 assert(wand->signature == MagickWandSignature);
691 if (wand->debug != MagickFalse)
692 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
693 assert(text != (
const unsigned char *) NULL);
694 escaped_text=EscapeString((
const char *) text,
'\'');
695 if (escaped_text != (
char *) NULL)
697 (void) MVGPrintf(wand,
"text %.20g %.20g '%s'\n",x,y,escaped_text);
698 escaped_text=DestroyString(escaped_text);
738WandExport
void DrawArc(DrawingWand *wand,
const double sx,
const double sy,
739 const double ex,
const double ey,
const double sd,
const double ed)
741 assert(wand != (DrawingWand *) NULL);
742 assert(wand->signature == MagickWandSignature);
743 if (wand->debug != MagickFalse)
744 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
745 (void) MVGPrintf(wand,
"arc %.20g %.20g %.20g %.20g %.20g %.20g\n",sx,sy,ex,
776WandExport
void DrawBezier(DrawingWand *wand,
777 const size_t number_coordinates,
const PointInfo *coordinates)
779 assert(wand != (DrawingWand *) NULL);
780 assert(wand->signature == MagickWandSignature);
781 if (wand->debug != MagickFalse)
782 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
783 assert(coordinates != (
const PointInfo *) NULL);
784 MVGAppendPointsCommand(wand,
"bezier",number_coordinates,coordinates);
818WandExport
void DrawCircle(DrawingWand *wand,
const double ox,
const double oy,
819 const double px,
const double py)
821 assert(wand != (DrawingWand *) NULL);
822 assert(wand->signature == MagickWandSignature);
823 if (wand->debug != MagickFalse)
824 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
825 (void) MVGPrintf(wand,
"circle %.20g %.20g %.20g %.20g\n",ox,oy,px,py);
850WandExport MagickBooleanType DrawClearException(DrawingWand *wand)
852 assert(wand != (DrawingWand *) NULL);
853 assert(wand->signature == MagickWandSignature);
854 if (wand->debug != MagickFalse)
855 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
856 ClearMagickException(wand->exception);
882WandExport ExceptionInfo *DrawCloneExceptionInfo(
const DrawingWand *wand)
884 assert(wand != (DrawingWand *) NULL);
885 assert(wand->signature == MagickWandSignature);
886 if (wand->exception == (ExceptionInfo*) NULL)
887 return (ExceptionInfo*) NULL;
888 return CloneExceptionInfo(wand->exception);
927WandExport
void DrawColor(DrawingWand *wand,
const double x,
const double y,
928 const PaintMethod paint_method)
930 assert(wand != (DrawingWand *)NULL);
931 assert(wand->signature == MagickWandSignature);
932 if (wand->debug != MagickFalse)
933 (void) LogMagickEvent(WandEvent, GetMagickModule(),
"%s", wand->name);
934 (void) MVGPrintf(wand,
"color %.20g %.20g '%s'\n",x,y,CommandOptionToMnemonic(
935 MagickMethodOptions,(ssize_t) paint_method));
979WandExport MagickBooleanType DrawComposite(DrawingWand *wand,
980 const CompositeOperator compose,
const double x,
const double y,
981 const double width,
const double height,MagickWand *magick_wand)
1010 assert(wand != (DrawingWand *) NULL);
1011 assert(wand->signature == MagickWandSignature);
1012 if (wand->debug != MagickFalse)
1013 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
1014 assert(magick_wand != (MagickWand *) NULL);
1015 image=GetImageFromMagickWand(magick_wand);
1016 if (image == (Image *) NULL)
1017 return(MagickFalse);
1018 clone_image=CloneImage(image,0,0,MagickTrue,wand->exception);
1019 if (clone_image == (Image *) NULL)
1020 return(MagickFalse);
1021 image_info=AcquireImageInfo();
1022 (void) CopyMagickString(image_info->magick,
"MIFF",MagickPathExtent);
1024 blob=(
unsigned char *) ImageToBlob(image_info,clone_image,&blob_length,
1026 image_info=DestroyImageInfo(image_info);
1027 clone_image=DestroyImageList(clone_image);
1028 if (blob == (
void *) NULL)
1029 return(MagickFalse);
1031 base64=Base64Encode(blob,blob_length,&encoded_length);
1032 blob=(
unsigned char *) RelinquishMagickMemory(blob);
1033 if (base64 == (
char *) NULL)
1036 buffer[MagickPathExtent];
1038 (void) FormatLocaleString(buffer,MagickPathExtent,
"%.20g bytes",(
double)
1039 (4L*blob_length/3L+4L));
1040 ThrowDrawException(ResourceLimitWarning,
"MemoryAllocationFailed",
1042 return(MagickFalse);
1044 mode=CommandOptionToMnemonic(MagickComposeOptions,(ssize_t) compose);
1045 media_type=MagickToMime(image->magick);
1046 (void) MVGPrintf(wand,
"image %s %.20g %.20g %.20g %.20g 'data:%s;base64,\n",
1047 mode,x,y,width,height,media_type);
1049 for (i=(ssize_t) encoded_length; i > 0; i-=76)
1051 (void) MVGPrintf(wand,
"%.76s",p);
1054 (void) MVGPrintf(wand,
"\n");
1056 (void) MVGPrintf(wand,
"'\n");
1057 media_type=DestroyString(media_type);
1058 base64=DestroyString(base64);
1086WandExport
void DrawComment(DrawingWand *wand,
const char *comment)
1088 (void) MVGPrintf(wand,
"#%s\n",comment);
1126WandExport
void DrawEllipse(DrawingWand *wand,
const double ox,
const double oy,
1127 const double rx,
const double ry,
const double start,
const double end)
1129 assert(wand != (DrawingWand *) NULL);
1130 assert(wand->signature == MagickWandSignature);
1131 if (wand->debug != MagickFalse)
1132 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
1133 (void) MVGPrintf(wand,
"ellipse %.20g %.20g %.20g %.20g %.20g %.20g\n",ox,oy,
1163WandExport
void DrawGetBorderColor(
const DrawingWand *wand,
1164 PixelWand *border_color)
1166 assert(wand != (
const DrawingWand *) NULL);
1167 assert(wand->signature == MagickWandSignature);
1168 assert(border_color != (PixelWand *) NULL);
1169 if (wand->debug != MagickFalse)
1170 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
1171 PixelSetPixelColor(border_color,&CurrentContext->border_color);
1197WandExport
char *DrawGetClipPath(
const DrawingWand *wand)
1199 assert(wand != (
const DrawingWand *) NULL);
1200 assert(wand->signature == MagickWandSignature);
1201 if (wand->debug != MagickFalse)
1202 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
1203 if (CurrentContext->clip_mask != (
char *) NULL)
1204 return((
char *) AcquireString(CurrentContext->clip_mask));
1205 return((
char *) NULL);
1231WandExport FillRule DrawGetClipRule(
const DrawingWand *wand)
1233 assert(wand != (
const DrawingWand *) NULL);
1234 assert(wand->signature == MagickWandSignature);
1235 if (wand->debug != MagickFalse)
1236 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
1237 return(CurrentContext->fill_rule);
1262WandExport ClipPathUnits DrawGetClipUnits(
const DrawingWand *wand)
1264 assert(wand != (
const DrawingWand *) NULL);
1265 assert(wand->signature == MagickWandSignature);
1266 if (wand->debug != MagickFalse)
1267 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
1268 return(CurrentContext->clip_units);
1294WandExport
char *DrawGetDensity(
const DrawingWand *wand)
1296 assert(wand != (
const DrawingWand *) NULL);
1297 assert(wand->signature == MagickWandSignature);
1298 if (wand->debug != MagickFalse)
1299 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
1300 if (CurrentContext->density != (
char *) NULL)
1301 return((
char *) AcquireString(CurrentContext->density));
1302 return((
char *) NULL);
1331WandExport
char *DrawGetException(
const DrawingWand *wand,
1332 ExceptionType *severity)
1337 assert(wand != (
const DrawingWand *) NULL);
1338 assert(wand->signature == MagickWandSignature);
1339 if (wand->debug != MagickFalse)
1340 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
1341 assert(severity != (ExceptionType *) NULL);
1342 *severity=wand->exception->severity;
1343 description=(
char *) AcquireQuantumMemory(2UL*MagickPathExtent,
1344 sizeof(*description));
1345 if (description == (
char *) NULL)
1346 ThrowWandFatalException(ResourceLimitFatalError,
"MemoryAllocationFailed",
1349 if (wand->exception->reason != (
char *) NULL)
1350 (void) CopyMagickString(description,GetLocaleExceptionMessage(
1351 wand->exception->severity,wand->exception->reason),
1353 if (wand->exception->description != (
char *) NULL)
1355 (void) ConcatenateMagickString(description,
" (",MagickPathExtent);
1356 (void) ConcatenateMagickString(description,GetLocaleExceptionMessage(
1357 wand->exception->severity,wand->exception->description),
1359 (void) ConcatenateMagickString(description,
")",MagickPathExtent);
1361 return(description);
1387WandExport ExceptionType DrawGetExceptionType(
const DrawingWand *wand)
1389 assert(wand != (
const DrawingWand *) NULL);
1390 assert(wand->signature == MagickWandSignature);
1391 if (wand->debug != MagickFalse)
1392 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
1393 return(wand->exception->severity);
1421WandExport
void DrawGetFillColor(
const DrawingWand *wand,PixelWand *fill_color)
1423 assert(wand != (
const DrawingWand *) NULL);
1424 assert(wand->signature == MagickWandSignature);
1425 assert(fill_color != (PixelWand *) NULL);
1426 if (wand->debug != MagickFalse)
1427 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
1428 PixelSetPixelColor(fill_color,&CurrentContext->fill);
1454WandExport
double DrawGetFillOpacity(
const DrawingWand *wand)
1459 assert(wand != (
const DrawingWand *) NULL);
1460 assert(wand->signature == MagickWandSignature);
1461 if (wand->debug != MagickFalse)
1462 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
1463 alpha=(double) QuantumScale*CurrentContext->fill.alpha;
1489WandExport FillRule DrawGetFillRule(
const DrawingWand *wand)
1491 assert(wand != (
const DrawingWand *) NULL);
1492 assert(wand->signature == MagickWandSignature);
1493 if (wand->debug != MagickFalse)
1494 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
1495 return(CurrentContext->fill_rule);
1522WandExport
char *DrawGetFont(
const DrawingWand *wand)
1524 assert(wand != (
const DrawingWand *) NULL);
1525 assert(wand->signature == MagickWandSignature);
1526 if (wand->debug != MagickFalse)
1527 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
1528 if (CurrentContext->font != (
char *) NULL)
1529 return(AcquireString(CurrentContext->font));
1530 return((
char *) NULL);
1556WandExport
char *DrawGetFontFamily(
const DrawingWand *wand)
1558 assert(wand != (
const DrawingWand *) NULL);
1559 assert(wand->signature == MagickWandSignature);
1560 if (wand->debug != MagickFalse)
1561 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
1562 if (CurrentContext->family != NULL)
1563 return(AcquireString(CurrentContext->family));
1564 return((
char *) NULL);
1594WandExport MagickBooleanType DrawGetFontResolution(
const DrawingWand *wand,
1595 double *x,
double *y)
1597 assert(wand != (DrawingWand *) NULL);
1598 assert(wand->signature == MagickWandSignature);
1599 if (wand->debug != MagickFalse)
1600 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
1601 *x=DefaultResolution;
1602 *y=DefaultResolution;
1603 if (CurrentContext->density != (
char *) NULL)
1611 flags=ParseGeometry(CurrentContext->density,&geometry_info);
1612 *x=geometry_info.rho;
1613 *y=geometry_info.sigma;
1614 if ((flags & SigmaValue) == MagickFalse)
1642WandExport
double DrawGetFontSize(
const DrawingWand *wand)
1644 assert(wand != (
const DrawingWand *) NULL);
1645 assert(wand->signature == MagickWandSignature);
1646 if (wand->debug != MagickFalse)
1647 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
1648 return(CurrentContext->pointsize);
1673WandExport StretchType DrawGetFontStretch(
const DrawingWand *wand)
1675 assert(wand != (
const DrawingWand *) NULL);
1676 assert(wand->signature == MagickWandSignature);
1677 if (wand->debug != MagickFalse)
1678 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
1679 return(CurrentContext->stretch);
1704WandExport StyleType DrawGetFontStyle(
const DrawingWand *wand)
1706 assert(wand != (
const DrawingWand *) NULL);
1707 assert(wand->signature == MagickWandSignature);
1708 if (wand->debug != MagickFalse)
1709 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
1710 return(CurrentContext->style);
1735WandExport
size_t DrawGetFontWeight(
const DrawingWand *wand)
1737 assert(wand != (
const DrawingWand *) NULL);
1738 assert(wand->signature == MagickWandSignature);
1739 if (wand->debug != MagickFalse)
1740 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
1741 return(CurrentContext->weight);
1767WandExport GravityType DrawGetGravity(
const DrawingWand *wand)
1769 assert(wand != (
const DrawingWand *) NULL);
1770 assert(wand->signature == MagickWandSignature);
1771 if (wand->debug != MagickFalse)
1772 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
1773 return(CurrentContext->gravity);
1799WandExport
double DrawGetOpacity(
const DrawingWand *wand)
1804 assert(wand != (
const DrawingWand *) NULL);
1805 assert(wand->signature == MagickWandSignature);
1806 if (wand->debug != MagickFalse)
1807 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
1808 alpha=QuantumScale*(double) CurrentContext->alpha;
1837WandExport MagickBooleanType DrawGetStrokeAntialias(
const DrawingWand *wand)
1839 assert(wand != (
const DrawingWand *) NULL);
1840 assert(wand->signature == MagickWandSignature);
1841 if (wand->debug != MagickFalse)
1842 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
1843 return(CurrentContext->stroke_antialias);
1871WandExport
void DrawGetStrokeColor(
const DrawingWand *wand,
1872 PixelWand *stroke_color)
1874 assert(wand != (
const DrawingWand *) NULL);
1875 assert(wand->signature == MagickWandSignature);
1876 assert(stroke_color != (PixelWand *) NULL);
1877 if (wand->debug != MagickFalse)
1878 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
1879 PixelSetPixelColor(stroke_color,&CurrentContext->stroke);
1909WandExport
double *DrawGetStrokeDashArray(
const DrawingWand *wand,
1910 size_t *number_elements)
1925 assert(wand != (
const DrawingWand *) NULL);
1926 assert(wand->signature == MagickWandSignature);
1927 if (wand->debug != MagickFalse)
1928 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
1929 assert(number_elements != (
size_t *) NULL);
1930 p=CurrentContext->dash_pattern;
1931 if (p != (
const double *) NULL)
1932 while (fabs(*p++) >= MagickEpsilon)
1935 dasharray=(
double *) NULL;
1938 dasharray=(
double *) AcquireQuantumMemory((
size_t) n+1UL,
1939 sizeof(*dasharray));
1940 if (dasharray != (
double *) NULL)
1942 p=CurrentContext->dash_pattern;
1944 for (i=0; i < (ssize_t) n; i++)
1975WandExport
double DrawGetStrokeDashOffset(
const DrawingWand *wand)
1977 assert(wand != (
const DrawingWand *) NULL);
1978 assert(wand->signature == MagickWandSignature);
1979 if (wand->debug != MagickFalse)
1980 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
1981 return(CurrentContext->dash_offset);
2008WandExport LineCap DrawGetStrokeLineCap(
const DrawingWand *wand)
2010 assert(wand != (
const DrawingWand *) NULL);
2011 assert(wand->signature == MagickWandSignature);
2012 if (wand->debug != MagickFalse)
2013 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
2014 return(CurrentContext->linecap);
2042WandExport LineJoin DrawGetStrokeLineJoin(
const DrawingWand *wand)
2044 assert(wand != (
const DrawingWand *) NULL);
2045 assert(wand->signature == MagickWandSignature);
2046 if (wand->debug != MagickFalse)
2047 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
2048 return(CurrentContext->linejoin);
2077WandExport
size_t DrawGetStrokeMiterLimit(
const DrawingWand *wand)
2079 assert(wand != (
const DrawingWand *) NULL);
2080 assert(wand->signature == MagickWandSignature);
2081 if (wand->debug != MagickFalse)
2082 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
2083 return CurrentContext->miterlimit;
2108WandExport
double DrawGetStrokeOpacity(
const DrawingWand *wand)
2113 assert(wand != (
const DrawingWand *) NULL);
2114 assert(wand->signature == MagickWandSignature);
2115 if (wand->debug != MagickFalse)
2116 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
2117 alpha=(double) QuantumScale*CurrentContext->stroke.alpha;
2144WandExport
double DrawGetStrokeWidth(
const DrawingWand *wand)
2146 assert(wand != (
const DrawingWand *) NULL);
2147 assert(wand->signature == MagickWandSignature);
2148 if (wand->debug != MagickFalse)
2149 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
2150 return(CurrentContext->stroke_width);
2176WandExport AlignType DrawGetTextAlignment(
const DrawingWand *wand)
2178 assert(wand != (
const DrawingWand *) NULL);
2179 assert(wand->signature == MagickWandSignature);
2180 if (wand->debug != MagickFalse)
2181 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
2182 return(CurrentContext->align);
2208WandExport MagickBooleanType DrawGetTextAntialias(
const DrawingWand *wand)
2210 assert(wand != (
const DrawingWand *) NULL);
2211 assert(wand->signature == MagickWandSignature);
2212 if (wand->debug != MagickFalse)
2213 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
2214 return(CurrentContext->text_antialias);
2240WandExport DecorationType DrawGetTextDecoration(
const DrawingWand *wand)
2242 assert(wand != (
const DrawingWand *) NULL);
2243 assert(wand->signature == MagickWandSignature);
2244 if (wand->debug != MagickFalse)
2245 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
2246 return(CurrentContext->decorate);
2272WandExport DirectionType DrawGetTextDirection(
const DrawingWand *wand)
2274 assert(wand != (
const DrawingWand *) NULL);
2275 assert(wand->signature == MagickWandSignature);
2276 if (wand->debug != MagickFalse)
2277 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
2278 return(CurrentContext->direction);
2305WandExport
char *DrawGetTextEncoding(
const DrawingWand *wand)
2307 assert(wand != (
const DrawingWand *) NULL);
2308 assert(wand->signature == MagickWandSignature);
2309 if (wand->debug != MagickFalse)
2310 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
2311 if (CurrentContext->encoding != (
char *) NULL)
2312 return((
char *) AcquireString(CurrentContext->encoding));
2313 return((
char *) NULL);
2338WandExport
double DrawGetTextKerning(DrawingWand *wand)
2340 assert(wand != (DrawingWand *) NULL);
2341 assert(wand->signature == MagickWandSignature);
2343 if (wand->debug != MagickFalse)
2344 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
2345 return(CurrentContext->kerning);
2370WandExport
double DrawGetTextInterlineSpacing(DrawingWand *wand)
2372 assert(wand != (DrawingWand *) NULL);
2373 assert(wand->signature == MagickWandSignature);
2374 if (wand->debug != MagickFalse)
2375 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
2376 return(CurrentContext->interline_spacing);
2401WandExport
double DrawGetTextInterwordSpacing(DrawingWand *wand)
2403 assert(wand != (DrawingWand *) NULL);
2404 assert(wand->signature == MagickWandSignature);
2405 if (wand->debug != MagickFalse)
2406 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
2407 return(CurrentContext->interword_spacing);
2459WandExport MagickBooleanType DrawGetTypeMetrics(
const DrawingWand *wand,
2460 const char *text,MagickBooleanType ignore_newlines,TypeMetric *metrics)
2468 assert(wand != (
const DrawingWand *) NULL);
2469 assert(wand->signature == MagickWandSignature);
2470 if (wand->debug != MagickFalse)
2471 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
2472 draw_info=PeekDrawingWand(wand);
2473 if (draw_info == (DrawInfo *) NULL)
2474 return(MagickFalse);
2475 (void) CloneString(&draw_info->text,text);
2476 if (ignore_newlines != MagickFalse)
2477 status=GetTypeMetrics(wand->image,draw_info,metrics,wand->exception);
2479 status=GetMultilineTypeMetrics(wand->image,draw_info,metrics,
2481 draw_info=DestroyDrawInfo(draw_info);
2510WandExport
char *DrawGetVectorGraphics(DrawingWand *wand)
2513 value[MagickPathExtent],
2526 assert(wand != (
const DrawingWand *) NULL);
2527 assert(wand->signature == MagickWandSignature);
2528 if (wand->debug != MagickFalse)
2529 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
2530 xml_info=NewXMLTreeTag(
"drawing-wand");
2531 if (xml_info == (XMLTreeInfo *) NULL)
2532 return((
char *) NULL);
2533 (void) SetXMLTreeContent(xml_info,
" ");
2534 GetPixelInfo(wand->image,&pixel);
2535 child=AddChildToXMLTree(xml_info,
"clip-path",0);
2536 if (child != (XMLTreeInfo *) NULL)
2537 (void) SetXMLTreeContent(child,CurrentContext->clip_mask);
2538 child=AddChildToXMLTree(xml_info,
"clip-units",0);
2539 if (child != (XMLTreeInfo *) NULL)
2541 (void) CopyMagickString(value,CommandOptionToMnemonic(
2542 MagickClipPathOptions,(ssize_t) CurrentContext->clip_units),
2544 (void) SetXMLTreeContent(child,value);
2546 child=AddChildToXMLTree(xml_info,
"decorate",0);
2547 if (child != (XMLTreeInfo *) NULL)
2549 (void) CopyMagickString(value,CommandOptionToMnemonic(
2550 MagickDecorateOptions,(ssize_t) CurrentContext->decorate),
2552 (void) SetXMLTreeContent(child,value);
2554 child=AddChildToXMLTree(xml_info,
"encoding",0);
2555 if (child != (XMLTreeInfo *) NULL)
2556 (void) SetXMLTreeContent(child,CurrentContext->encoding);
2557 child=AddChildToXMLTree(xml_info,
"fill",0);
2558 if (child != (XMLTreeInfo *) NULL)
2560 if (CurrentContext->fill.alpha != (
double) OpaqueAlpha)
2561 pixel.alpha_trait=CurrentContext->fill.alpha != (double) OpaqueAlpha ?
2562 BlendPixelTrait : UndefinedPixelTrait;
2563 pixel=CurrentContext->fill;
2564 GetColorTuple(&pixel,MagickTrue,value);
2565 (void) SetXMLTreeContent(child,value);
2567 child=AddChildToXMLTree(xml_info,
"fill-opacity",0);
2568 if (child != (XMLTreeInfo *) NULL)
2570 (void) FormatLocaleString(value,MagickPathExtent,
"%.20g",
2571 (
double) (QuantumScale*CurrentContext->fill.alpha));
2572 (void) SetXMLTreeContent(child,value);
2574 child=AddChildToXMLTree(xml_info,
"fill-rule",0);
2575 if (child != (XMLTreeInfo *) NULL)
2577 (void) CopyMagickString(value,CommandOptionToMnemonic(
2578 MagickFillRuleOptions,(ssize_t) CurrentContext->fill_rule),
2580 (void) SetXMLTreeContent(child,value);
2582 child=AddChildToXMLTree(xml_info,
"font",0);
2583 if (child != (XMLTreeInfo *) NULL)
2584 (void) SetXMLTreeContent(child,CurrentContext->font);
2585 child=AddChildToXMLTree(xml_info,
"font-family",0);
2586 if (child != (XMLTreeInfo *) NULL)
2587 (void) SetXMLTreeContent(child,CurrentContext->family);
2588 child=AddChildToXMLTree(xml_info,
"font-size",0);
2589 if (child != (XMLTreeInfo *) NULL)
2591 (void) FormatLocaleString(value,MagickPathExtent,
"%.20g",
2592 CurrentContext->pointsize);
2593 (void) SetXMLTreeContent(child,value);
2595 child=AddChildToXMLTree(xml_info,
"font-stretch",0);
2596 if (child != (XMLTreeInfo *) NULL)
2598 (void) CopyMagickString(value,CommandOptionToMnemonic(
2599 MagickStretchOptions,(ssize_t) CurrentContext->stretch),
2601 (void) SetXMLTreeContent(child,value);
2603 child=AddChildToXMLTree(xml_info,
"font-style",0);
2604 if (child != (XMLTreeInfo *) NULL)
2606 (void) CopyMagickString(value,CommandOptionToMnemonic(
2607 MagickStyleOptions,(ssize_t) CurrentContext->style),MagickPathExtent);
2608 (void) SetXMLTreeContent(child,value);
2610 child=AddChildToXMLTree(xml_info,
"font-weight",0);
2611 if (child != (XMLTreeInfo *) NULL)
2613 (void) FormatLocaleString(value,MagickPathExtent,
"%.20g",(
double)
2614 CurrentContext->weight);
2615 (void) SetXMLTreeContent(child,value);
2617 child=AddChildToXMLTree(xml_info,
"gravity",0);
2618 if (child != (XMLTreeInfo *) NULL)
2620 (void) CopyMagickString(value,CommandOptionToMnemonic(
2621 MagickGravityOptions,(ssize_t) CurrentContext->gravity),
2623 (void) SetXMLTreeContent(child,value);
2625 child=AddChildToXMLTree(xml_info,
"stroke",0);
2626 if (child != (XMLTreeInfo *) NULL)
2628 if (CurrentContext->stroke.alpha != (
double) OpaqueAlpha)
2629 pixel.alpha_trait=CurrentContext->stroke.alpha != (double) OpaqueAlpha ?
2630 BlendPixelTrait : UndefinedPixelTrait;
2631 pixel=CurrentContext->stroke;
2632 GetColorTuple(&pixel,MagickTrue,value);
2633 (void) SetXMLTreeContent(child,value);
2635 child=AddChildToXMLTree(xml_info,
"stroke-antialias",0);
2636 if (child != (XMLTreeInfo *) NULL)
2638 (void) FormatLocaleString(value,MagickPathExtent,
"%d",
2639 CurrentContext->stroke_antialias != MagickFalse ? 1 : 0);
2640 (void) SetXMLTreeContent(child,value);
2642 child=AddChildToXMLTree(xml_info,
"stroke-dasharray",0);
2643 if ((child != (XMLTreeInfo *) NULL) &&
2644 (CurrentContext->dash_pattern != (
double *) NULL))
2649 dash_pattern=AcquireString((
char *) NULL);
2650 for (i=0; fabs(CurrentContext->dash_pattern[i]) >= MagickEpsilon; i++)
2653 (void) ConcatenateString(&dash_pattern,
",");
2654 (void) FormatLocaleString(value,MagickPathExtent,
"%.20g",
2655 CurrentContext->dash_pattern[i]);
2656 (void) ConcatenateString(&dash_pattern,value);
2658 (void) SetXMLTreeContent(child,dash_pattern);
2659 dash_pattern=DestroyString(dash_pattern);
2661 child=AddChildToXMLTree(xml_info,
"stroke-dashoffset",0);
2662 if (child != (XMLTreeInfo *) NULL)
2664 (void) FormatLocaleString(value,MagickPathExtent,
"%.20g",
2665 CurrentContext->dash_offset);
2666 (void) SetXMLTreeContent(child,value);
2668 child=AddChildToXMLTree(xml_info,
"stroke-linecap",0);
2669 if (child != (XMLTreeInfo *) NULL)
2671 (void) CopyMagickString(value,CommandOptionToMnemonic(
2672 MagickLineCapOptions,(ssize_t) CurrentContext->linecap),
2674 (void) SetXMLTreeContent(child,value);
2676 child=AddChildToXMLTree(xml_info,
"stroke-linejoin",0);
2677 if (child != (XMLTreeInfo *) NULL)
2679 (void) CopyMagickString(value,CommandOptionToMnemonic(
2680 MagickLineJoinOptions,(ssize_t) CurrentContext->linejoin),
2682 (void) SetXMLTreeContent(child,value);
2684 child=AddChildToXMLTree(xml_info,
"stroke-miterlimit",0);
2685 if (child != (XMLTreeInfo *) NULL)
2687 (void) FormatLocaleString(value,MagickPathExtent,
"%.20g",(
double)
2688 CurrentContext->miterlimit);
2689 (void) SetXMLTreeContent(child,value);
2691 child=AddChildToXMLTree(xml_info,
"stroke-opacity",0);
2692 if (child != (XMLTreeInfo *) NULL)
2694 (void) FormatLocaleString(value,MagickPathExtent,
"%.20g",
2695 (
double) (QuantumScale*CurrentContext->stroke.alpha));
2696 (void) SetXMLTreeContent(child,value);
2698 child=AddChildToXMLTree(xml_info,
"stroke-width",0);
2699 if (child != (XMLTreeInfo *) NULL)
2701 (void) FormatLocaleString(value,MagickPathExtent,
"%.20g",
2702 CurrentContext->stroke_width);
2703 (void) SetXMLTreeContent(child,value);
2705 child=AddChildToXMLTree(xml_info,
"text-align",0);
2706 if (child != (XMLTreeInfo *) NULL)
2708 (void) CopyMagickString(value,CommandOptionToMnemonic(MagickAlignOptions,
2709 (ssize_t) CurrentContext->align),MagickPathExtent);
2710 (void) SetXMLTreeContent(child,value);
2712 child=AddChildToXMLTree(xml_info,
"text-antialias",0);
2713 if (child != (XMLTreeInfo *) NULL)
2715 (void) FormatLocaleString(value,MagickPathExtent,
"%d",
2716 CurrentContext->text_antialias != MagickFalse ? 1 : 0);
2717 (void) SetXMLTreeContent(child,value);
2719 child=AddChildToXMLTree(xml_info,
"text-undercolor",0);
2720 if (child != (XMLTreeInfo *) NULL)
2722 if (CurrentContext->undercolor.alpha != (
double) OpaqueAlpha)
2723 pixel.alpha_trait=CurrentContext->undercolor.alpha != (double) OpaqueAlpha ?
2724 BlendPixelTrait : UndefinedPixelTrait;
2725 pixel=CurrentContext->undercolor;
2726 GetColorTuple(&pixel,MagickTrue,value);
2727 (void) SetXMLTreeContent(child,value);
2729 child=AddChildToXMLTree(xml_info,
"vector-graphics",0);
2730 if (child != (XMLTreeInfo *) NULL)
2731 (void) SetXMLTreeContent(child,wand->mvg);
2732 xml=XMLTreeInfoToXML(xml_info);
2733 xml_info=DestroyXMLTree(xml_info);
2763WandExport
void DrawGetTextUnderColor(
const DrawingWand *wand,
2764 PixelWand *under_color)
2766 assert(wand != (
const DrawingWand *) NULL);
2767 assert(wand->signature == MagickWandSignature);
2768 assert(under_color != (PixelWand *) NULL);
2769 if (wand->debug != MagickFalse)
2770 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
2771 PixelSetPixelColor(under_color,&CurrentContext->undercolor);
2806WandExport
void DrawLine(DrawingWand *wand,
const double sx,
const double sy,
2807 const double ex,
const double ey)
2809 assert(wand != (DrawingWand *) NULL);
2810 assert(wand->signature == MagickWandSignature);
2811 if (wand->debug != MagickFalse)
2812 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
2813 (void) MVGPrintf(wand,
"line %.20g %.20g %.20g %.20g\n",sx,sy,ex,ey);
2841WandExport
void DrawPathClose(DrawingWand *wand)
2843 assert(wand != (DrawingWand *) NULL);
2844 assert(wand->signature == MagickWandSignature);
2845 if (wand->debug != MagickFalse)
2846 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
2847 (void) MVGAutoWrapPrintf(wand,
"%s",wand->path_mode == AbsolutePathMode ?
2892static void DrawPathCurveTo(DrawingWand *wand,
const PathMode mode,
2893 const double x1,
const double y1,
const double x2,
const double y2,
2894 const double x,
const double y)
2896 assert(wand != (DrawingWand *) NULL);
2897 assert(wand->signature == MagickWandSignature);
2898 if (wand->debug != MagickFalse)
2899 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
2900 if ((wand->path_operation != PathCurveToOperation) ||
2901 (wand->path_mode != mode))
2903 wand->path_operation=PathCurveToOperation;
2904 wand->path_mode=mode;
2905 (void) MVGAutoWrapPrintf(wand,
"%c%.20g %.20g %.20g %.20g %.20g %.20g",
2906 mode == AbsolutePathMode ?
'C' :
'c',x1,y1,x2,y2,x,y);
2909 (
void) MVGAutoWrapPrintf(wand,
" %.20g %.20g %.20g %.20g %.20g %.20g",x1,y1,
2913WandExport
void DrawPathCurveToAbsolute(DrawingWand *wand,
const double x1,
2914 const double y1,
const double x2,
const double y2,
const double x,
const double y)
2916 assert(wand != (DrawingWand *) NULL);
2917 assert(wand->signature == MagickWandSignature);
2918 if (wand->debug != MagickFalse)
2919 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
2920 DrawPathCurveTo(wand,AbsolutePathMode,x1,y1,x2,y2,x,y);
2963WandExport
void DrawPathCurveToRelative(DrawingWand *wand,
const double x1,
2964 const double y1,
const double x2,
const double y2,
const double x,
const double y)
2966 assert(wand != (DrawingWand *) NULL);
2967 assert(wand->signature == MagickWandSignature);
2968 if (wand->debug != MagickFalse)
2969 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
2970 DrawPathCurveTo(wand,RelativePathMode,x1,y1,x2,y2,x,y);
3008static void DrawPathCurveToQuadraticBezier(DrawingWand *wand,
3009 const PathMode mode,
const double x1,
double y1,
const double x,
const double y)
3011 assert(wand != (DrawingWand *) NULL);
3012 assert(wand->signature == MagickWandSignature);
3013 if (wand->debug != MagickFalse)
3014 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
3015 if ((wand->path_operation != PathCurveToQuadraticBezierOperation) ||
3016 (wand->path_mode != mode))
3018 wand->path_operation=PathCurveToQuadraticBezierOperation;
3019 wand->path_mode=mode;
3020 (void) MVGAutoWrapPrintf(wand,
"%c%.20g %.20g %.20g %.20g",
3021 mode == AbsolutePathMode ?
'Q' :
'q',x1,y1,x,y);
3024 (
void) MVGAutoWrapPrintf(wand,
" %.20g %.20g %.20g %.20g",x1,y1,x,y);
3027WandExport
void DrawPathCurveToQuadraticBezierAbsolute(DrawingWand *wand,
3028 const double x1,
const double y1,
const double x,
const double y)
3030 assert(wand != (DrawingWand *) NULL);
3031 assert(wand->signature == MagickWandSignature);
3032 if (wand->debug != MagickFalse)
3033 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
3034 DrawPathCurveToQuadraticBezier(wand,AbsolutePathMode,x1,y1,x,y);
3071WandExport
void DrawPathCurveToQuadraticBezierRelative(DrawingWand *wand,
3072 const double x1,
const double y1,
const double x,
const double y)
3074 assert(wand != (DrawingWand *) NULL);
3075 assert(wand->signature == MagickWandSignature);
3076 if (wand->debug != MagickFalse)
3077 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
3078 DrawPathCurveToQuadraticBezier(wand,RelativePathMode,x1,y1,x,y);
3120static void DrawPathCurveToQuadraticBezierSmooth(DrawingWand *wand,
3121 const PathMode mode,
const double x,
const double y)
3123 assert(wand != (DrawingWand *) NULL);
3124 assert(wand->signature == MagickWandSignature);
3125 if (wand->debug != MagickFalse)
3126 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
3127 if ((wand->path_operation != PathCurveToQuadraticBezierSmoothOperation) ||
3128 (wand->path_mode != mode))
3130 wand->path_operation=PathCurveToQuadraticBezierSmoothOperation;
3131 wand->path_mode=mode;
3132 (void) MVGAutoWrapPrintf(wand,
"%c%.20g %.20g",mode == AbsolutePathMode ?
3136 (
void) MVGAutoWrapPrintf(wand,
" %.20g %.20g",x,y);
3139WandExport
void DrawPathCurveToQuadraticBezierSmoothAbsolute(DrawingWand *wand,
3140 const double x,
const double y)
3142 assert(wand != (DrawingWand *) NULL);
3143 assert(wand->signature == MagickWandSignature);
3144 if (wand->debug != MagickFalse)
3145 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
3146 DrawPathCurveToQuadraticBezierSmooth(wand,AbsolutePathMode,x,y);
3186WandExport
void DrawPathCurveToQuadraticBezierSmoothRelative(DrawingWand *wand,
3187 const double x,
const double y)
3189 DrawPathCurveToQuadraticBezierSmooth(wand,RelativePathMode,x,y);
3234static void DrawPathCurveToSmooth(DrawingWand *wand,
const PathMode mode,
3235 const double x2,
const double y2,
const double x,
const double y)
3237 assert(wand != (DrawingWand *) NULL);
3238 assert(wand->signature == MagickWandSignature);
3239 if (wand->debug != MagickFalse)
3240 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
3241 if ((wand->path_operation != PathCurveToSmoothOperation) ||
3242 (wand->path_mode != mode))
3244 wand->path_operation=PathCurveToSmoothOperation;
3245 wand->path_mode=mode;
3246 (void) MVGAutoWrapPrintf(wand,
"%c%.20g %.20g %.20g %.20g",
3247 mode == AbsolutePathMode ?
'S' :
's',x2,y2,x,y);
3250 (
void) MVGAutoWrapPrintf(wand,
" %.20g %.20g %.20g %.20g",x2,y2,x,y);
3253WandExport
void DrawPathCurveToSmoothAbsolute(DrawingWand *wand,
const double x2,
3254 const double y2,
const double x,
const double y)
3256 assert(wand != (DrawingWand *) NULL);
3257 assert(wand->signature == MagickWandSignature);
3258 if (wand->debug != MagickFalse)
3259 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
3260 DrawPathCurveToSmooth(wand,AbsolutePathMode,x2,y2,x,y);
3303WandExport
void DrawPathCurveToSmoothRelative(DrawingWand *wand,
const double x2,
3304 const double y2,
const double x,
const double y)
3306 assert(wand != (DrawingWand *) NULL);
3307 assert(wand->signature == MagickWandSignature);
3308 if (wand->debug != MagickFalse)
3309 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
3310 DrawPathCurveToSmooth(wand,RelativePathMode,x2,y2,x,y);
3362static void DrawPathEllipticArc(DrawingWand *wand,
const PathMode mode,
3363 const double rx,
const double ry,
const double x_axis_rotation,
3364 const MagickBooleanType large_arc_flag,
const MagickBooleanType sweep_flag,
3365 const double x,
const double y)
3367 assert(wand != (DrawingWand *) NULL);
3368 assert(wand->signature == MagickWandSignature);
3369 if (wand->debug != MagickFalse)
3370 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
3371 if ((wand->path_operation != PathEllipticArcOperation) ||
3372 (wand->path_mode != mode))
3374 wand->path_operation=PathEllipticArcOperation;
3375 wand->path_mode=mode;
3376 (void) MVGAutoWrapPrintf(wand,
"%c%.20g %.20g %.20g %u %u %.20g %.20g",
3377 mode == AbsolutePathMode ?
'A' :
'a',rx,ry,x_axis_rotation,
3378 large_arc_flag,sweep_flag,x,y);
3381 (
void) MVGAutoWrapPrintf(wand,
" %.20g %.20g %.20g %u %u %.20g %.20g",rx,ry,
3382 x_axis_rotation,large_arc_flag,sweep_flag,x,y);
3385WandExport
void DrawPathEllipticArcAbsolute(DrawingWand *wand,
const double rx,
3386 const double ry,
const double x_axis_rotation,
3387 const MagickBooleanType large_arc_flag,
const MagickBooleanType sweep_flag,
3388 const double x,
const double y)
3390 assert(wand != (DrawingWand *) NULL);
3391 assert(wand->signature == MagickWandSignature);
3392 if (wand->debug != MagickFalse)
3393 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
3394 DrawPathEllipticArc(wand,AbsolutePathMode,rx,ry,x_axis_rotation,
3395 large_arc_flag,sweep_flag,x,y);
3445WandExport
void DrawPathEllipticArcRelative(DrawingWand *wand,
const double rx,
3446 const double ry,
const double x_axis_rotation,
3447 const MagickBooleanType large_arc_flag,
const MagickBooleanType sweep_flag,
3448 const double x,
const double y)
3450 DrawPathEllipticArc(wand,RelativePathMode,rx,ry,x_axis_rotation,
3451 large_arc_flag,sweep_flag,x,y);
3476WandExport
void DrawPathFinish(DrawingWand *wand)
3478 assert(wand != (DrawingWand *) NULL);
3479 assert(wand->signature == MagickWandSignature);
3480 if (wand->debug != MagickFalse)
3481 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
3482 (void) MVGPrintf(wand,
"'\n");
3483 wand->path_operation=PathDefaultOperation;
3484 wand->path_mode=DefaultPathMode;
3516static void DrawPathLineTo(DrawingWand *wand,
const PathMode mode,
3517 const double x,
const double y)
3519 assert(wand != (DrawingWand *) NULL);
3520 assert(wand->signature == MagickWandSignature);
3521 if (wand->debug != MagickFalse)
3522 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
3523 if ((wand->path_operation != PathLineToOperation) ||
3524 (wand->path_mode != mode))
3526 wand->path_operation=PathLineToOperation;
3527 wand->path_mode=mode;
3528 (void) MVGAutoWrapPrintf(wand,
"%c%.20g %.20g",mode == AbsolutePathMode ?
3532 (
void) MVGAutoWrapPrintf(wand,
" %.20g %.20g",x,y);
3535WandExport
void DrawPathLineToAbsolute(DrawingWand *wand,
const double x,
3538 assert(wand != (DrawingWand *) NULL);
3539 assert(wand->signature == MagickWandSignature);
3540 if (wand->debug != MagickFalse)
3541 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
3542 DrawPathLineTo(wand,AbsolutePathMode,x,y);
3574WandExport
void DrawPathLineToRelative(DrawingWand *wand,
const double x,
3577 assert(wand != (DrawingWand *) NULL);
3578 assert(wand->signature == MagickWandSignature);
3579 if (wand->debug != MagickFalse)
3580 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
3581 DrawPathLineTo(wand,RelativePathMode,x,y);
3611static void DrawPathLineToHorizontal(DrawingWand *wand,
const PathMode mode,
3614 assert(wand != (DrawingWand *) NULL);
3615 assert(wand->signature == MagickWandSignature);
3616 if (wand->debug != MagickFalse)
3617 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
3618 if ((wand->path_operation != PathLineToHorizontalOperation) ||
3619 (wand->path_mode != mode))
3621 wand->path_operation=PathLineToHorizontalOperation;
3622 wand->path_mode=mode;
3623 (void) MVGAutoWrapPrintf(wand,
"%c%.20g",mode == AbsolutePathMode ?
3627 (
void) MVGAutoWrapPrintf(wand,
" %.20g",x);
3630WandExport
void DrawPathLineToHorizontalAbsolute(DrawingWand *wand,
3633 assert(wand != (DrawingWand *) NULL);
3634 assert(wand->signature == MagickWandSignature);
3635 if (wand->debug != MagickFalse)
3636 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
3637 DrawPathLineToHorizontal(wand,AbsolutePathMode,x);
3667WandExport
void DrawPathLineToHorizontalRelative(DrawingWand *wand,
3670 DrawPathLineToHorizontal(wand,RelativePathMode,x);
3701static void DrawPathLineToVertical(DrawingWand *wand,
const PathMode mode,
3704 assert(wand != (DrawingWand *) NULL);
3705 assert(wand->signature == MagickWandSignature);
3706 if (wand->debug != MagickFalse)
3707 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
3708 if ((wand->path_operation != PathLineToVerticalOperation) ||
3709 (wand->path_mode != mode))
3711 wand->path_operation=PathLineToVerticalOperation;
3712 wand->path_mode=mode;
3713 (void) MVGAutoWrapPrintf(wand,
"%c%.20g",mode == AbsolutePathMode ?
3717 (
void) MVGAutoWrapPrintf(wand,
" %.20g",y);
3720WandExport
void DrawPathLineToVerticalAbsolute(DrawingWand *wand,
const double y)
3722 assert(wand != (DrawingWand *) NULL);
3723 assert(wand->signature == MagickWandSignature);
3724 if (wand->debug != MagickFalse)
3725 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
3726 DrawPathLineToVertical(wand,AbsolutePathMode,y);
3756WandExport
void DrawPathLineToVerticalRelative(DrawingWand *wand,
const double y)
3758 assert(wand != (DrawingWand *) NULL);
3759 assert(wand->signature == MagickWandSignature);
3760 if (wand->debug != MagickFalse)
3761 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
3762 DrawPathLineToVertical(wand,RelativePathMode,y);
3794static void DrawPathMoveTo(DrawingWand *wand,
const PathMode mode,
const double x,
3797 assert(wand != (DrawingWand *) NULL);
3798 assert(wand->signature == MagickWandSignature);
3799 if (wand->debug != MagickFalse)
3800 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
3801 if ((wand->path_operation != PathMoveToOperation) ||
3802 (wand->path_mode != mode))
3804 wand->path_operation=PathMoveToOperation;
3805 wand->path_mode=mode;
3806 (void) MVGAutoWrapPrintf(wand,
"%c%.20g %.20g",mode == AbsolutePathMode ?
3810 (
void) MVGAutoWrapPrintf(wand,
" %.20g %.20g",x,y);
3813WandExport
void DrawPathMoveToAbsolute(DrawingWand *wand,
const double x,
3816 assert(wand != (DrawingWand *) NULL);
3817 assert(wand->signature == MagickWandSignature);
3818 if (wand->debug != MagickFalse)
3819 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
3820 DrawPathMoveTo(wand,AbsolutePathMode,x,y);
3852WandExport
void DrawPathMoveToRelative(DrawingWand *wand,
const double x,
3855 assert(wand != (DrawingWand *) NULL);
3856 assert(wand->signature == MagickWandSignature);
3857 if (wand->debug != MagickFalse)
3858 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
3859 DrawPathMoveTo(wand,RelativePathMode,x,y);
3888WandExport
void DrawPathStart(DrawingWand *wand)
3890 assert(wand != (DrawingWand *) NULL);
3891 assert(wand->signature == MagickWandSignature);
3892 if (wand->debug != MagickFalse)
3893 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
3894 (void) MVGPrintf(wand,
"path '");
3895 wand->path_operation=PathDefaultOperation;
3896 wand->path_mode=DefaultPathMode;
3925WandExport
void DrawPoint(DrawingWand *wand,
const double x,
const double y)
3927 assert(wand != (DrawingWand *) NULL);
3928 assert(wand->signature == MagickWandSignature);
3929 if (wand->debug != MagickFalse)
3930 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
3931 (void) MVGPrintf(wand,
"point %.20g %.20g\n",x,y);
3962WandExport
void DrawPolygon(DrawingWand *wand,
3963 const size_t number_coordinates,
const PointInfo *coordinates)
3965 assert(wand != (DrawingWand *) NULL);
3966 assert(wand->signature == MagickWandSignature);
3967 if (wand->debug != MagickFalse)
3968 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
3969 MVGAppendPointsCommand(wand,
"polygon",number_coordinates,coordinates);
4000WandExport
void DrawPolyline(DrawingWand *wand,
4001 const size_t number_coordinates,
const PointInfo *coordinates)
4003 assert(wand != (DrawingWand *) NULL);
4004 assert(wand->signature == MagickWandSignature);
4005 if (wand->debug != MagickFalse)
4006 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
4007 MVGAppendPointsCommand(wand,
"polyline",number_coordinates,coordinates);
4032WandExport
void DrawPopClipPath(DrawingWand *wand)
4034 assert(wand != (DrawingWand *) NULL);
4035 assert(wand->signature == MagickWandSignature);
4036 if (wand->debug != MagickFalse)
4037 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
4038 if (wand->indent_depth > 0)
4039 wand->indent_depth--;
4040 (void) MVGPrintf(wand,
"pop clip-path\n");
4065WandExport
void DrawPopDefs(DrawingWand *wand)
4067 assert(wand != (DrawingWand *) NULL);
4068 assert(wand->signature == MagickWandSignature);
4069 if (wand->debug != MagickFalse)
4070 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
4071 if (wand->indent_depth > 0)
4072 wand->indent_depth--;
4073 (void) MVGPrintf(wand,
"pop defs\n");
4098WandExport MagickBooleanType DrawPopPattern(DrawingWand *wand)
4101 geometry[MagickPathExtent],
4102 key[MagickPathExtent];
4104 assert(wand != (DrawingWand *) NULL);
4105 assert(wand->signature == MagickWandSignature);
4106 if (wand->debug != MagickFalse)
4107 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
4108 if (wand->image == (Image *) NULL)
4109 ThrowDrawException(WandError,
"ContainsNoImages",wand->name);
4110 if (wand->pattern_id == (
const char *) NULL)
4112 ThrowDrawException(DrawWarning,
"NotCurrentlyPushingPatternDefinition",
4114 return(MagickFalse);
4116 (void) FormatLocaleString(key,MagickPathExtent,
"%s",wand->pattern_id);
4117 (void) SetImageArtifact(wand->image,key,wand->mvg+wand->pattern_offset);
4118 (void) FormatLocaleString(geometry,MagickPathExtent,
"%.20gx%.20g%+.20g%+.20g",
4119 (
double) wand->pattern_bounds.width,(
double) wand->pattern_bounds.height,
4120 (
double) wand->pattern_bounds.x,(
double) wand->pattern_bounds.y);
4121 (void) SetImageArtifact(wand->image,key,geometry);
4122 wand->pattern_id=DestroyString(wand->pattern_id);
4123 wand->pattern_offset=0;
4124 wand->pattern_bounds.x=0;
4125 wand->pattern_bounds.y=0;
4126 wand->pattern_bounds.width=0;
4127 wand->pattern_bounds.height=0;
4128 wand->filter_off=MagickTrue;
4129 if (wand->indent_depth > 0)
4130 wand->indent_depth--;
4131 (void) MVGPrintf(wand,
"pop pattern\n");
4161WandExport
void DrawPushClipPath(DrawingWand *wand,
const char *clip_mask_id)
4163 assert(wand != (DrawingWand *) NULL);
4164 assert(wand->signature == MagickWandSignature);
4165 if (wand->debug != MagickFalse)
4166 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
4167 assert(clip_mask_id != (
const char *) NULL);
4168 (void) MVGPrintf(wand,
"push clip-path \"%s\"\n",clip_mask_id);
4169 wand->indent_depth++;
4196WandExport
void DrawPushDefs(DrawingWand *wand)
4198 assert(wand != (DrawingWand *) NULL);
4199 assert(wand->signature == MagickWandSignature);
4200 if (wand->debug != MagickFalse)
4201 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
4202 (void) MVGPrintf(wand,
"push defs\n");
4203 wand->indent_depth++;
4245WandExport MagickBooleanType DrawPushPattern(DrawingWand *wand,
4246 const char *pattern_id,
const double x,
const double y,
const double width,
4247 const double height)
4249 assert(wand != (DrawingWand *) NULL);
4250 assert(wand->signature == MagickWandSignature);
4251 if (wand->debug != MagickFalse)
4252 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
4253 assert(pattern_id != (
const char *) NULL);
4254 if (wand->pattern_id != NULL)
4256 ThrowDrawException(DrawError,
"AlreadyPushingPatternDefinition",
4258 return(MagickFalse);
4260 wand->filter_off=MagickTrue;
4261 (void) MVGPrintf(wand,
"push pattern %s %.20g %.20g %.20g %.20g\n",pattern_id,
4263 wand->indent_depth++;
4264 wand->pattern_id=AcquireString(pattern_id);
4265 wand->pattern_bounds.x=CastDoubleToSsizeT(ceil(x-0.5));
4266 wand->pattern_bounds.y=CastDoubleToSsizeT(ceil(y-0.5));
4267 wand->pattern_bounds.width=(size_t) CastDoubleToSsizeT(floor(width+0.5));
4268 wand->pattern_bounds.height=(size_t) CastDoubleToSsizeT(floor(height+0.5));
4269 wand->pattern_offset=wand->mvg_length;
4303WandExport
void DrawRectangle(DrawingWand *wand,
const double x1,
const double y1,
4304 const double x2,
const double y2)
4306 assert(wand != (DrawingWand *) NULL);
4307 assert(wand->signature == MagickWandSignature);
4308 if (wand->debug != MagickFalse)
4309 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
4310 if ((fabs(x2-x1) < MagickEpsilon) && (fabs(y2-y1) < MagickEpsilon))
4311 (void) MVGPrintf(wand,
"point %.20g %.20g\n",x1,y1);
4313 (
void) MVGPrintf(wand,
"rectangle %.20g %.20g %.20g %.20g\n",x1,y1,x2,y2);
4338WandExport MagickBooleanType DrawRender(DrawingWand *wand)
4343 assert(wand != (
const DrawingWand *) NULL);
4344 assert(wand->signature == MagickWandSignature);
4345 if (wand->debug != MagickFalse)
4346 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
4347 CurrentContext->primitive=wand->mvg;
4348 if (wand->debug != MagickFalse)
4349 (void) LogMagickEvent(DrawEvent,GetMagickModule(),
"MVG:\n'%s'\n",wand->mvg);
4350 if (wand->image == (Image *) NULL)
4351 ThrowDrawException(WandError,
"ContainsNoImages",wand->name);
4352 status=DrawImage(wand->image,CurrentContext,wand->exception);
4353 CurrentContext->primitive=(
char *) NULL;
4380WandExport
void DrawResetVectorGraphics(DrawingWand *wand)
4382 assert(wand != (DrawingWand *) NULL);
4383 assert(wand->signature == MagickWandSignature);
4384 if (wand->debug != MagickFalse)
4385 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
4386 if (wand->mvg != (
char *) NULL)
4387 wand->mvg=DestroyString(wand->mvg);
4417WandExport
void DrawRotate(DrawingWand *wand,
const double degrees)
4419 assert(wand != (DrawingWand *) NULL);
4420 assert(wand->signature == MagickWandSignature);
4421 if (wand->debug != MagickFalse)
4422 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
4423 (void) MVGPrintf(wand,
"rotate %.20g\n",degrees);
4463WandExport
void DrawRoundRectangle(DrawingWand *wand,
double x1,
double y1,
4464 double x2,
double y2,
double rx,
double ry)
4466 assert(wand != (DrawingWand *) NULL);
4467 assert(wand->signature == MagickWandSignature);
4468 if (wand->debug != MagickFalse)
4469 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
4470 (void) MVGPrintf(wand,
"roundrectangle %.20g %.20g %.20g %.20g %.20g %.20g\n",
4501WandExport
void DrawScale(DrawingWand *wand,
const double x,
const double y)
4503 assert(wand != (DrawingWand *) NULL);
4504 assert(wand->signature == MagickWandSignature);
4505 if (wand->debug != MagickFalse)
4506 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
4507 (void) MVGPrintf(wand,
"scale %.20g %.20g\n",x,y);
4535WandExport
void DrawSetBorderColor(DrawingWand *wand,
4536 const PixelWand *border_wand)
4543 assert(wand != (DrawingWand *) NULL);
4544 assert(wand->signature == MagickWandSignature);
4545 if (wand->debug != MagickFalse)
4546 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
4547 assert(border_wand != (
const PixelWand *) NULL);
4548 PixelGetQuantumPacket(border_wand,&border_color);
4549 new_border=border_color;
4550 current_border=(&CurrentContext->border_color);
4551 if ((wand->filter_off != MagickFalse) ||
4552 (IsPixelInfoEquivalent(current_border,&new_border) == MagickFalse))
4554 CurrentContext->border_color=new_border;
4555 (void) MVGPrintf(wand,
"border-color '");
4556 MVGAppendColor(wand,&border_color);
4557 (void) MVGPrintf(wand,
"'\n");
4588WandExport MagickBooleanType DrawSetClipPath(DrawingWand *wand,
4589 const char *clip_mask)
4591 assert(wand != (DrawingWand *) NULL);
4592 if (wand->debug != MagickFalse)
4593 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",clip_mask);
4594 assert(wand->signature == MagickWandSignature);
4595 assert(clip_mask != (
const char *) NULL);
4596 if ((CurrentContext->clip_mask == (
const char *) NULL) ||
4597 (wand->filter_off != MagickFalse) ||
4598 (LocaleCompare(CurrentContext->clip_mask,clip_mask) != 0))
4600 (void) CloneString(&CurrentContext->clip_mask,clip_mask);
4601#if DRAW_BINARY_IMPLEMENTATION
4602 if (wand->image == (Image *) NULL)
4603 ThrowDrawException(WandError,
"ContainsNoImages",wand->name);
4604 (void) DrawClipPath(wand->image,CurrentContext,CurrentContext->clip_mask,
4607 (void) MVGPrintf(wand,
"clip-path url(#%s)\n",clip_mask);
4636WandExport
void DrawSetClipRule(DrawingWand *wand,
const FillRule fill_rule)
4638 assert(wand != (DrawingWand *) NULL);
4639 assert(wand->signature == MagickWandSignature);
4640 if (wand->debug != MagickFalse)
4641 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
4642 if ((wand->filter_off != MagickFalse) ||
4643 (CurrentContext->fill_rule != fill_rule))
4645 CurrentContext->fill_rule=fill_rule;
4646 (void) MVGPrintf(wand,
"clip-rule '%s'\n",CommandOptionToMnemonic(
4647 MagickFillRuleOptions,(ssize_t) fill_rule));
4677WandExport
void DrawSetClipUnits(DrawingWand *wand,
4678 const ClipPathUnits clip_units)
4680 assert(wand != (DrawingWand *) NULL);
4681 assert(wand->signature == MagickWandSignature);
4682 if (wand->debug != MagickFalse)
4683 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
4684 if ((wand->filter_off != MagickFalse) ||
4685 (CurrentContext->clip_units != clip_units))
4687 CurrentContext->clip_units=clip_units;
4688 if (clip_units == ObjectBoundingBox)
4693 GetAffineMatrix(&affine);
4694 affine.sx=CurrentContext->bounds.x2;
4695 affine.sy=CurrentContext->bounds.y2;
4696 affine.tx=CurrentContext->bounds.x1;
4697 affine.ty=CurrentContext->bounds.y1;
4698 AdjustAffine(wand,&affine);
4700 (void) MVGPrintf(wand,
"clip-units '%s'\n",CommandOptionToMnemonic(
4701 MagickClipPathOptions,(ssize_t) clip_units));
4730WandExport MagickBooleanType DrawSetDensity(DrawingWand *wand,
4731 const char *density)
4733 assert(wand != (DrawingWand *) NULL);
4734 if (wand->debug != MagickFalse)
4735 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",density);
4736 assert(wand->signature == MagickWandSignature);
4737 assert(density != (
const char *) NULL);
4738 if ((CurrentContext->density == (
const char *) NULL) ||
4739 (wand->filter_off != MagickFalse) ||
4740 (LocaleCompare(CurrentContext->density,density) != 0))
4742 (void) CloneString(&CurrentContext->density,density);
4743 (void) MVGPrintf(wand,
"density '%s'\n",density);
4772WandExport
void DrawSetFillColor(DrawingWand *wand,
const PixelWand *fill_wand)
4779 assert(wand != (DrawingWand *) NULL);
4780 assert(wand->signature == MagickWandSignature);
4781 if (wand->debug != MagickFalse)
4782 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
4783 assert(fill_wand != (
const PixelWand *) NULL);
4784 PixelGetQuantumPacket(fill_wand,&fill_color);
4785 new_fill=fill_color;
4786 current_fill=(&CurrentContext->fill);
4787 if ((wand->filter_off != MagickFalse) ||
4788 (IsPixelInfoEquivalent(current_fill,&new_fill) == MagickFalse))
4790 CurrentContext->fill=new_fill;
4791 (void) MVGPrintf(wand,
"fill '");
4792 MVGAppendColor(wand,&fill_color);
4793 (void) MVGPrintf(wand,
"'\n");
4822WandExport
void DrawSetFillOpacity(DrawingWand *wand,
const double fill_opacity)
4827 assert(wand != (DrawingWand *) NULL);
4828 assert(wand->signature == MagickWandSignature);
4829 if (wand->debug != MagickFalse)
4830 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
4831 alpha=(double) ClampToQuantum((
double) QuantumRange*fill_opacity);
4832 if ((wand->filter_off != MagickFalse) ||
4833 (CurrentContext->fill.alpha != alpha))
4835 CurrentContext->fill.alpha=alpha;
4836 (void) MVGPrintf(wand,
"fill-opacity %.20g\n",fill_opacity);
4867WandExport MagickBooleanType DrawSetFontResolution(DrawingWand *wand,
4868 const double x_resolution,
const double y_resolution)
4871 density[MagickPathExtent];
4873 assert(wand != (DrawingWand *) NULL);
4874 assert(wand->signature == MagickWandSignature);
4875 if (wand->debug != MagickFalse)
4876 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
4877 (void) FormatLocaleString(density,MagickPathExtent,
"%.20gx%.20g",x_resolution,
4879 (void) CloneString(&CurrentContext->density,density);
4908WandExport
void DrawSetOpacity(DrawingWand *wand,
const double opacity)
4913 assert(wand != (DrawingWand *) NULL);
4914 assert(wand->signature == MagickWandSignature);
4915 if (wand->debug != MagickFalse)
4916 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
4917 quantum_alpha=ClampToQuantum((
double) QuantumRange*opacity);
4918 if ((wand->filter_off != MagickFalse) ||
4919 (CurrentContext->alpha != quantum_alpha))
4921 CurrentContext->alpha=quantum_alpha;
4922 (void) MVGPrintf(wand,
"opacity %.20g\n",opacity);
4954WandExport MagickBooleanType DrawSetFillPatternURL(DrawingWand *wand,
4955 const char *fill_url)
4958 pattern[MagickPathExtent],
4959 pattern_spec[MagickPathExtent];
4961 assert(wand != (DrawingWand *) NULL);
4962 assert(wand->signature == MagickWandSignature);
4963 if (wand->debug != MagickFalse)
4964 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",fill_url);
4965 if (wand->image == (Image *) NULL)
4966 ThrowDrawException(WandError,
"ContainsNoImages",wand->name);
4967 assert(fill_url != (
const char *) NULL);
4968 if (*fill_url !=
'#')
4970 ThrowDrawException(DrawError,
"NotARelativeURL",fill_url);
4971 return(MagickFalse);
4973 (void) FormatLocaleString(pattern,MagickPathExtent,
"%s",fill_url+1);
4974 if (GetImageArtifact(wand->image,pattern) == (
const char *) NULL)
4976 ThrowDrawException(DrawError,
"URLNotFound",fill_url)
4977 return(MagickFalse);
4979 (void) FormatLocaleString(pattern_spec,MagickPathExtent,
"url(%s)",fill_url);
4980#if DRAW_BINARY_IMPLEMENTATION
4981 DrawPatternPath(wand->image,CurrentContext,pattern_spec,
4982 &CurrentContext->fill_pattern,wand->exception);
4984 if (CurrentContext->fill.alpha != (
double) TransparentAlpha)
4985 CurrentContext->fill.alpha=(double) CurrentContext->alpha;
4986 (void) MVGPrintf(wand,
"fill %s\n",pattern_spec);
5014WandExport
void DrawSetFillRule(DrawingWand *wand,
const FillRule fill_rule)
5016 assert(wand != (DrawingWand *) NULL);
5017 assert(wand->signature == MagickWandSignature);
5018 if (wand->debug != MagickFalse)
5019 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
5020 if ((wand->filter_off != MagickFalse) ||
5021 (CurrentContext->fill_rule != fill_rule))
5023 CurrentContext->fill_rule=fill_rule;
5024 (void) MVGPrintf(wand,
"fill-rule '%s'\n",CommandOptionToMnemonic(
5025 MagickFillRuleOptions,(ssize_t) fill_rule));
5054WandExport MagickBooleanType DrawSetFont(DrawingWand *wand,
5055 const char *font_name)
5057 assert(wand != (DrawingWand *) NULL);
5058 assert(wand->signature == MagickWandSignature);
5059 if (wand->debug != MagickFalse)
5060 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
5061 assert(font_name != (
const char *) NULL);
5062 if ((wand->filter_off != MagickFalse) ||
5063 (CurrentContext->font == (
char *) NULL) ||
5064 (LocaleCompare(CurrentContext->font,font_name) != 0))
5066 (void) CloneString(&CurrentContext->font,font_name);
5067 (void) MVGPrintf(wand,
"font '%s'\n",font_name);
5097WandExport MagickBooleanType DrawSetFontFamily(DrawingWand *wand,
5098 const char *font_family)
5100 assert(wand != (DrawingWand *) NULL);
5101 assert(wand->signature == MagickWandSignature);
5102 if (wand->debug != MagickFalse)
5103 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
5104 assert(font_family != (
const char *) NULL);
5105 if ((wand->filter_off != MagickFalse) ||
5106 (CurrentContext->family == (
const char *) NULL) ||
5107 (LocaleCompare(CurrentContext->family,font_family) != 0))
5109 (void) CloneString(&CurrentContext->family,font_family);
5110 (void) MVGPrintf(wand,
"font-family '%s'\n",font_family);
5139WandExport
void DrawSetFontSize(DrawingWand *wand,
const double pointsize)
5141 assert(wand != (DrawingWand *) NULL);
5142 assert(wand->signature == MagickWandSignature);
5143 if (wand->debug != MagickFalse)
5144 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
5145 if ((wand->filter_off != MagickFalse) ||
5146 (fabs(CurrentContext->pointsize-pointsize) >= MagickEpsilon))
5148 CurrentContext->pointsize=pointsize;
5149 (void) MVGPrintf(wand,
"font-size %.20g\n",pointsize);
5182WandExport
void DrawSetFontStretch(DrawingWand *wand,
5183 const StretchType font_stretch)
5185 assert(wand != (DrawingWand *) NULL);
5186 assert(wand->signature == MagickWandSignature);
5187 if (wand->debug != MagickFalse)
5188 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
5189 if ((wand->filter_off != MagickFalse) ||
5190 (CurrentContext->stretch != font_stretch))
5192 CurrentContext->stretch=font_stretch;
5193 (void) MVGPrintf(wand,
"font-stretch '%s'\n",CommandOptionToMnemonic(
5194 MagickStretchOptions,(ssize_t) font_stretch));
5223WandExport
void DrawSetFontStyle(DrawingWand *wand,
const StyleType style)
5225 assert(wand != (DrawingWand *) NULL);
5226 assert(wand->signature == MagickWandSignature);
5227 if (wand->debug != MagickFalse)
5228 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
5229 if ((wand->filter_off != MagickFalse) ||
5230 (CurrentContext->style != style))
5232 CurrentContext->style=style;
5233 (void) MVGPrintf(wand,
"font-style '%s'\n",CommandOptionToMnemonic(
5234 MagickStyleOptions,(ssize_t) style));
5263WandExport
void DrawSetFontWeight(DrawingWand *wand,
5264 const size_t font_weight)
5266 assert(wand != (DrawingWand *) NULL);
5267 assert(wand->signature == MagickWandSignature);
5268 if (wand->debug != MagickFalse)
5269 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
5270 if ((wand->filter_off != MagickFalse) ||
5271 (CurrentContext->weight != font_weight))
5273 CurrentContext->weight=font_weight;
5274 (void) MVGPrintf(wand,
"font-weight %.20g\n",(
double) font_weight);
5306WandExport
void DrawSetGravity(DrawingWand *wand,
const GravityType gravity)
5308 assert(wand != (DrawingWand *) NULL);
5309 assert(wand->signature == MagickWandSignature);
5310 if (wand->debug != MagickFalse)
5311 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
5312 if ((wand->filter_off != MagickFalse) ||
5313 (CurrentContext->gravity != gravity) || (gravity != ForgetGravity))
5315 CurrentContext->gravity=gravity;
5316 (void) MVGPrintf(wand,
"gravity '%s'\n",CommandOptionToMnemonic(
5317 MagickGravityOptions,(ssize_t) gravity));
5346WandExport
void DrawSetStrokeColor(DrawingWand *wand,
5347 const PixelWand *stroke_wand)
5354 assert(wand != (DrawingWand *) NULL);
5355 assert(wand->signature == MagickWandSignature);
5356 if (wand->debug != MagickFalse)
5357 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
5358 assert(stroke_wand != (
const PixelWand *) NULL);
5359 PixelGetQuantumPacket(stroke_wand,&stroke_color);
5360 new_stroke=stroke_color;
5361 current_stroke=(&CurrentContext->stroke);
5362 if ((wand->filter_off != MagickFalse) ||
5363 (IsPixelInfoEquivalent(current_stroke,&new_stroke) == MagickFalse))
5365 CurrentContext->stroke=new_stroke;
5366 (void) MVGPrintf(wand,
"stroke '");
5367 MVGAppendColor(wand,&stroke_color);
5368 (void) MVGPrintf(wand,
"'\n");
5397WandExport MagickBooleanType DrawSetStrokePatternURL(DrawingWand *wand,
5398 const char *stroke_url)
5401 pattern[MagickPathExtent],
5402 pattern_spec[MagickPathExtent];
5404 assert(wand != (DrawingWand *) NULL);
5405 assert(wand->signature == MagickWandSignature);
5406 if (wand->debug != MagickFalse)
5407 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
5408 if (wand->image == (Image *) NULL)
5409 ThrowDrawException(WandError,
"ContainsNoImages",wand->name);
5410 assert(stroke_url != NULL);
5411 if (stroke_url[0] !=
'#')
5412 ThrowDrawException(DrawError,
"NotARelativeURL",stroke_url);
5413 (void) FormatLocaleString(pattern,MagickPathExtent,
"%s",stroke_url+1);
5414 if (GetImageArtifact(wand->image,pattern) == (
const char *) NULL)
5416 ThrowDrawException(DrawError,
"URLNotFound",stroke_url)
5417 return(MagickFalse);
5419 (void) FormatLocaleString(pattern_spec,MagickPathExtent,
"url(%s)",stroke_url);
5420#if DRAW_BINARY_IMPLEMENTATION
5421 DrawPatternPath(wand->image,CurrentContext,pattern_spec,
5422 &CurrentContext->stroke_pattern,wand->exception);
5424 if (CurrentContext->stroke.alpha != (
double) TransparentAlpha)
5425 CurrentContext->stroke.alpha=(double) CurrentContext->alpha;
5426 (void) MVGPrintf(wand,
"stroke %s\n",pattern_spec);
5458WandExport
void DrawSetStrokeAntialias(DrawingWand *wand,
5459 const MagickBooleanType stroke_antialias)
5461 assert(wand != (DrawingWand *) NULL);
5462 assert(wand->signature == MagickWandSignature);
5463 if (wand->debug != MagickFalse)
5464 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
5465 if ((wand->filter_off != MagickFalse) ||
5466 (CurrentContext->stroke_antialias != stroke_antialias))
5468 CurrentContext->stroke_antialias=stroke_antialias;
5469 (void) MVGPrintf(wand,
"stroke-antialias %i\n",stroke_antialias != 0 ?
5507WandExport MagickBooleanType DrawSetStrokeDashArray(DrawingWand *wand,
5508 const size_t number_elements,
const double *dasharray)
5526 assert(wand != (DrawingWand *) NULL);
5527 assert(wand->signature == MagickWandSignature);
5528 if (wand->debug != MagickFalse)
5529 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
5530 n_new=number_elements;
5531 if (dasharray == (
const double *) NULL)
5535 q=CurrentContext->dash_pattern;
5536 if (q != (
const double *) NULL)
5537 while (fabs(*q++) < MagickEpsilon)
5539 if ((n_old == 0) && (n_new == 0))
5545 if ((CurrentContext->dash_pattern != (
double *) NULL) &&
5546 (dasharray != (
double *) NULL))
5549 q=CurrentContext->dash_pattern;
5550 for (i=0; i < (ssize_t) n_new; i++)
5552 if (fabs((*p)-(*q)) >= MagickEpsilon)
5561 if ((wand->filter_off != MagickFalse) || (update != MagickFalse))
5563 if (CurrentContext->dash_pattern != (
double *) NULL)
5564 CurrentContext->dash_pattern=(
double *)
5565 RelinquishMagickMemory(CurrentContext->dash_pattern);
5568 CurrentContext->dash_pattern=(
double *) AcquireQuantumMemory((
size_t)
5569 n_new+1UL,
sizeof(*CurrentContext->dash_pattern));
5570 if (CurrentContext->dash_pattern == (
double *) NULL)
5572 ThrowDrawException(ResourceLimitError,
"MemoryAllocationFailed",
5574 return(MagickFalse);
5576 for (i=0; i < (ssize_t) n_new; i++)
5578 CurrentContext->dash_pattern[i]=0.0;
5579 if (dasharray != (
double *) NULL)
5580 CurrentContext->dash_pattern[i]=dasharray[i];
5582 CurrentContext->dash_pattern[n_new]=0.0;
5584 (void) MVGPrintf(wand,
"stroke-dasharray ");
5586 (void) MVGPrintf(wand,
"none\n");
5588 if (dasharray != (
double *) NULL)
5590 for (i=0; i < (ssize_t) n_new; i++)
5593 (void) MVGPrintf(wand,
",");
5594 (void) MVGPrintf(wand,
"%.20g",dasharray[i]);
5596 (void) MVGPrintf(wand,
"\n");
5628WandExport
void DrawSetStrokeDashOffset(DrawingWand *wand,
5629 const double dash_offset)
5631 assert(wand != (DrawingWand *) NULL);
5632 assert(wand->signature == MagickWandSignature);
5633 if (wand->debug != MagickFalse)
5634 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
5635 if ((wand->filter_off != MagickFalse) ||
5636 (fabs(CurrentContext->dash_offset-dash_offset) >= MagickEpsilon))
5638 CurrentContext->dash_offset=dash_offset;
5639 (void) MVGPrintf(wand,
"stroke-dashoffset %.20g\n",dash_offset);
5670WandExport
void DrawSetStrokeLineCap(DrawingWand *wand,
const LineCap linecap)
5672 assert(wand != (DrawingWand *) NULL);
5673 assert(wand->signature == MagickWandSignature);
5674 if (wand->debug != MagickFalse)
5675 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
5676 if ((wand->filter_off != MagickFalse) || (CurrentContext->linecap != linecap))
5678 CurrentContext->linecap=linecap;
5679 (void) MVGPrintf(wand,
"stroke-linecap '%s'\n",CommandOptionToMnemonic(
5680 MagickLineCapOptions,(ssize_t) linecap));
5711WandExport
void DrawSetStrokeLineJoin(DrawingWand *wand,
const LineJoin linejoin)
5713 assert(wand != (DrawingWand *) NULL);
5714 assert(wand->signature == MagickWandSignature);
5715 if (wand->debug != MagickFalse)
5716 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
5717 if ((wand->filter_off != MagickFalse) ||
5718 (CurrentContext->linejoin != linejoin))
5720 CurrentContext->linejoin=linejoin;
5721 (void) MVGPrintf(wand,
"stroke-linejoin '%s'\n",CommandOptionToMnemonic(
5722 MagickLineJoinOptions,(ssize_t) linejoin));
5755WandExport
void DrawSetStrokeMiterLimit(DrawingWand *wand,
5756 const size_t miterlimit)
5758 assert(wand != (DrawingWand *) NULL);
5759 assert(wand->signature == MagickWandSignature);
5760 if (wand->debug != MagickFalse)
5761 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
5762 if (CurrentContext->miterlimit != miterlimit)
5764 CurrentContext->miterlimit=miterlimit;
5765 (void) MVGPrintf(wand,
"stroke-miterlimit %.20g\n",(
double) miterlimit);
5794WandExport
void DrawSetStrokeOpacity(DrawingWand *wand,
5795 const double opacity)
5800 assert(wand != (DrawingWand *) NULL);
5801 assert(wand->signature == MagickWandSignature);
5802 if (wand->debug != MagickFalse)
5803 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
5804 alpha=(double) ClampToQuantum((
double) QuantumRange*opacity);
5805 if ((wand->filter_off != MagickFalse) ||
5806 (CurrentContext->stroke.alpha != alpha))
5808 CurrentContext->stroke.alpha=alpha;
5809 (void) MVGPrintf(wand,
"stroke-opacity %.20g\n",opacity);
5839WandExport
void DrawSetStrokeWidth(DrawingWand *wand,
const double stroke_width)
5841 assert(wand != (DrawingWand *) NULL);
5842 assert(wand->signature == MagickWandSignature);
5843 if (wand->debug != MagickFalse)
5844 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
5845 if ((wand->filter_off != MagickFalse) ||
5846 (fabs(CurrentContext->stroke_width-stroke_width) >= MagickEpsilon))
5848 CurrentContext->stroke_width=stroke_width;
5849 (void) MVGPrintf(wand,
"stroke-width %.20g\n",stroke_width);
5879WandExport
void DrawSetTextAlignment(DrawingWand *wand,
5880 const AlignType alignment)
5882 assert(wand != (DrawingWand *) NULL);
5883 assert(wand->signature == MagickWandSignature);
5884 if (wand->debug != MagickFalse)
5885 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
5886 if ((wand->filter_off != MagickFalse) ||
5887 (CurrentContext->align != alignment))
5889 CurrentContext->align=alignment;
5890 (void) MVGPrintf(wand,
"text-align '%s'\n",CommandOptionToMnemonic(
5891 MagickAlignOptions,(ssize_t) alignment));
5922WandExport
void DrawSetTextAntialias(DrawingWand *wand,
5923 const MagickBooleanType text_antialias)
5925 assert(wand != (DrawingWand *) NULL);
5926 assert(wand->signature == MagickWandSignature);
5927 if (wand->debug != MagickFalse)
5928 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
5929 if ((wand->filter_off != MagickFalse) ||
5930 (CurrentContext->text_antialias != text_antialias))
5932 CurrentContext->text_antialias=text_antialias;
5933 (void) MVGPrintf(wand,
"text-antialias %i\n",text_antialias != 0 ? 1 : 0);
5964WandExport
void DrawSetTextDecoration(DrawingWand *wand,
5965 const DecorationType decoration)
5967 assert(wand != (DrawingWand *) NULL);
5968 assert(wand->signature == MagickWandSignature);
5969 if (wand->debug != MagickFalse)
5970 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
5971 if ((wand->filter_off != MagickFalse) ||
5972 (CurrentContext->decorate != decoration))
5974 CurrentContext->decorate=decoration;
5975 (void) MVGPrintf(wand,
"decorate '%s'\n",CommandOptionToMnemonic(
5976 MagickDecorateOptions,(ssize_t) decoration));
6007WandExport
void DrawSetTextDirection(DrawingWand *wand,
6008 const DirectionType direction)
6010 assert(wand != (DrawingWand *) NULL);
6011 assert(wand->signature == MagickWandSignature);
6013 if (wand->debug != MagickFalse)
6014 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
6015 if ((wand->filter_off != MagickFalse) ||
6016 (CurrentContext->direction != direction))
6018 CurrentContext->direction=direction;
6019 (void) MVGPrintf(wand,
"direction '%s'\n",CommandOptionToMnemonic(
6020 MagickDirectionOptions,(ssize_t) direction));
6053WandExport
void DrawSetTextEncoding(DrawingWand *wand,
const char *encoding)
6055 assert(wand != (DrawingWand *) NULL);
6056 assert(wand->signature == MagickWandSignature);
6057 if (wand->debug != MagickFalse)
6058 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
6059 assert(encoding != (
char *) NULL);
6060 if ((wand->filter_off != MagickFalse) ||
6061 (CurrentContext->encoding == (
char *) NULL) ||
6062 (LocaleCompare(CurrentContext->encoding,encoding) != 0))
6064 (void) CloneString(&CurrentContext->encoding,encoding);
6065 (void) MVGPrintf(wand,
"encoding '%s'\n",encoding);
6093WandExport
void DrawSetTextKerning(DrawingWand *wand,
const double kerning)
6095 assert(wand != (DrawingWand *) NULL);
6096 assert(wand->signature == MagickWandSignature);
6098 if (wand->debug != MagickFalse)
6099 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
6100 if ((wand->filter_off != MagickFalse) &&
6101 (fabs((CurrentContext->kerning-kerning)) >= MagickEpsilon))
6103 CurrentContext->kerning=kerning;
6104 (void) MVGPrintf(wand,
"kerning %lf\n",kerning);
6133WandExport
void DrawSetTextInterlineSpacing(DrawingWand *wand,
6134 const double interline_spacing)
6136 assert(wand != (DrawingWand *) NULL);
6137 assert(wand->signature == MagickWandSignature);
6139 if (wand->debug != MagickFalse)
6140 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
6141 if ((wand->filter_off != MagickFalse) ||
6142 (fabs((CurrentContext->interline_spacing-
6143 interline_spacing)) >= MagickEpsilon))
6145 CurrentContext->interline_spacing=interline_spacing;
6146 (void) MVGPrintf(wand,
"interline-spacing %lf\n",interline_spacing);
6175WandExport
void DrawSetTextInterwordSpacing(DrawingWand *wand,
6176 const double interword_spacing)
6178 assert(wand != (DrawingWand *) NULL);
6179 assert(wand->signature == MagickWandSignature);
6181 if (wand->debug != MagickFalse)
6182 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
6183 if ((wand->filter_off != MagickFalse) ||
6184 (fabs((CurrentContext->interword_spacing-
6185 interword_spacing)) >= MagickEpsilon))
6187 CurrentContext->interword_spacing=interword_spacing;
6188 (void) MVGPrintf(wand,
"interword-spacing %lf\n",interword_spacing);
6218WandExport
void DrawSetTextUnderColor(DrawingWand *wand,
6219 const PixelWand *under_wand)
6224 assert(wand != (DrawingWand *) NULL);
6225 assert(wand->signature == MagickWandSignature);
6226 if (wand->debug != MagickFalse)
6227 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
6228 assert(under_wand != (
const PixelWand *) NULL);
6229 PixelGetQuantumPacket(under_wand,&under_color);
6230 if ((wand->filter_off != MagickFalse) ||
6231 (IsPixelInfoEquivalent(&CurrentContext->undercolor,&under_color) == MagickFalse))
6233 CurrentContext->undercolor=under_color;
6234 (void) MVGPrintf(wand,
"text-undercolor '");
6235 MVGAppendColor(wand,&under_color);
6236 (void) MVGPrintf(wand,
"'\n");
6268static inline MagickBooleanType IsPoint(
const char *point)
6276 value=strtol(point,&p,10);
6278 return(p != point ? MagickTrue : MagickFalse);
6281WandExport MagickBooleanType DrawSetVectorGraphics(DrawingWand *wand,
6291 assert(wand != (DrawingWand *) NULL);
6292 assert(wand->signature == MagickWandSignature);
6293 if (wand->debug != MagickFalse)
6294 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
6295 CurrentContext=DestroyDrawInfo(CurrentContext);
6296 CurrentContext=CloneDrawInfo((ImageInfo *) NULL,(DrawInfo *) NULL);
6297 if (xml == (
const char *) NULL)
6298 return(MagickFalse);
6299 xml_info=NewXMLTree(xml,wand->exception);
6300 if (xml_info == (XMLTreeInfo *) NULL)
6301 return(MagickFalse);
6302 child=GetXMLTreeChild(xml_info,
"clip-path");
6303 if (child != (XMLTreeInfo *) NULL)
6304 (void) CloneString(&CurrentContext->clip_mask,GetXMLTreeContent(child));
6305 child=GetXMLTreeChild(xml_info,
"clip-units");
6306 if (child != (XMLTreeInfo *) NULL)
6308 value=GetXMLTreeContent(child);
6309 if (value != (
const char *) NULL)
6310 CurrentContext->clip_units=(ClipPathUnits) ParseCommandOption(
6311 MagickClipPathOptions,MagickFalse,value);
6313 child=GetXMLTreeChild(xml_info,
"decorate");
6314 if (child != (XMLTreeInfo *) NULL)
6316 value=GetXMLTreeContent(child);
6317 if (value != (
const char *) NULL)
6318 CurrentContext->decorate=(DecorationType) ParseCommandOption(
6319 MagickDecorateOptions,MagickFalse,value);
6321 child=GetXMLTreeChild(xml_info,
"encoding");
6322 if (child != (XMLTreeInfo *) NULL)
6323 (void) CloneString(&CurrentContext->encoding,GetXMLTreeContent(child));
6324 child=GetXMLTreeChild(xml_info,
"fill");
6325 if (child != (XMLTreeInfo *) NULL)
6327 value=GetXMLTreeContent(child);
6328 if (value != (
const char *) NULL)
6329 (void) QueryColorCompliance(value,AllCompliance,&CurrentContext->fill,
6332 child=GetXMLTreeChild(xml_info,
"fill-opacity");
6333 if (child != (XMLTreeInfo *) NULL)
6335 value=GetXMLTreeContent(child);
6336 if (value != (
const char *) NULL)
6337 CurrentContext->fill.alpha=(double) ClampToQuantum((
double)
6338 QuantumRange*(1.0-StringToDouble(value,(
char **) NULL)));
6340 child=GetXMLTreeChild(xml_info,
"fill-rule");
6341 if (child != (XMLTreeInfo *) NULL)
6343 value=GetXMLTreeContent(child);
6344 if (value != (
const char *) NULL)
6345 CurrentContext->fill_rule=(FillRule) ParseCommandOption(
6346 MagickFillRuleOptions,MagickFalse,value);
6348 child=GetXMLTreeChild(xml_info,
"font");
6349 if (child != (XMLTreeInfo *) NULL)
6350 (void) CloneString(&CurrentContext->font,GetXMLTreeContent(child));
6351 child=GetXMLTreeChild(xml_info,
"font-family");
6352 if (child != (XMLTreeInfo *) NULL)
6353 (void) CloneString(&CurrentContext->family,GetXMLTreeContent(child));
6354 child=GetXMLTreeChild(xml_info,
"font-size");
6355 if (child != (XMLTreeInfo *) NULL)
6357 value=GetXMLTreeContent(child);
6358 if (value != (
const char *) NULL)
6359 CurrentContext->pointsize=StringToDouble(value,(
char **) NULL);
6361 child=GetXMLTreeChild(xml_info,
"font-stretch");
6362 if (child != (XMLTreeInfo *) NULL)
6364 value=GetXMLTreeContent(child);
6365 if (value != (
const char *) NULL)
6366 CurrentContext->stretch=(StretchType) ParseCommandOption(
6367 MagickStretchOptions,MagickFalse,value);
6369 child=GetXMLTreeChild(xml_info,
"font-style");
6370 if (child != (XMLTreeInfo *) NULL)
6372 value=GetXMLTreeContent(child);
6373 if (value != (
const char *) NULL)
6374 CurrentContext->style=(StyleType) ParseCommandOption(MagickStyleOptions,
6377 child=GetXMLTreeChild(xml_info,
"font-weight");
6378 if (child != (XMLTreeInfo *) NULL)
6380 value=GetXMLTreeContent(child);
6381 if (value != (
const char *) NULL)
6386 weight=ParseCommandOption(MagickWeightOptions,MagickFalse,value);
6388 weight=(ssize_t) StringToUnsignedLong(value);
6389 CurrentContext->weight=(size_t) weight;
6392 child=GetXMLTreeChild(xml_info,
"gravity");
6393 if (child != (XMLTreeInfo *) NULL)
6395 value=GetXMLTreeContent(child);
6396 if (value != (
const char *) NULL)
6397 CurrentContext->gravity=(GravityType) ParseCommandOption(
6398 MagickGravityOptions,MagickFalse,value);
6400 child=GetXMLTreeChild(xml_info,
"stroke");
6401 if (child != (XMLTreeInfo *) NULL)
6403 value=GetXMLTreeContent(child);
6404 if (value != (
const char *) NULL)
6405 (void) QueryColorCompliance(value,AllCompliance,&CurrentContext->stroke,
6408 child=GetXMLTreeChild(xml_info,
"stroke-antialias");
6409 if (child != (XMLTreeInfo *) NULL)
6411 value=GetXMLTreeContent(child);
6412 if (value != (
const char *) NULL)
6413 CurrentContext->stroke_antialias=StringToLong(value) != 0 ? MagickTrue :
6416 child=GetXMLTreeChild(xml_info,
"stroke-dasharray");
6417 if (child != (XMLTreeInfo *) NULL)
6420 token[MagickPathExtent];
6431 value=GetXMLTreeContent(child);
6432 if (value != (
const char *) NULL)
6434 if (CurrentContext->dash_pattern != (
double *) NULL)
6435 CurrentContext->dash_pattern=(
double *) RelinquishMagickMemory(
6436 CurrentContext->dash_pattern);
6438 if (IsPoint(q) != MagickFalse)
6444 (void) GetNextToken(p,&p,MagickPathExtent,token);
6446 (void) GetNextToken(p,&p,MagickPathExtent,token);
6447 for (x=0; IsPoint(token) != MagickFalse; x++)
6449 (void) GetNextToken(p,&p,MagickPathExtent,token);
6451 (void) GetNextToken(p,&p,MagickPathExtent,token);
6453 CurrentContext->dash_pattern=(
double *) AcquireQuantumMemory(
6454 (
size_t) (2*x)+1UL,
sizeof(*CurrentContext->dash_pattern));
6455 if (CurrentContext->dash_pattern == (
double *) NULL)
6456 ThrowWandFatalException(ResourceLimitFatalError,
6457 "MemoryAllocationFailed",wand->name);
6458 for (j=0; j < x; j++)
6460 (void) GetNextToken(q,&q,MagickPathExtent,token);
6462 (void) GetNextToken(q,&q,MagickPathExtent,token);
6463 CurrentContext->dash_pattern[j]=StringToDouble(token,
6466 if (((x & 0x01) != 0) && (j == x))
6467 for ( ; j < (2*x); j++)
6468 CurrentContext->dash_pattern[j]=
6469 CurrentContext->dash_pattern[j-x];
6470 CurrentContext->dash_pattern[j]=0.0;
6474 child=GetXMLTreeChild(xml_info,
"stroke-dashoffset");
6475 if (child != (XMLTreeInfo *) NULL)
6477 value=GetXMLTreeContent(child);
6478 if (value != (
const char *) NULL)
6479 CurrentContext->dash_offset=StringToDouble(value,(
char **) NULL);
6481 child=GetXMLTreeChild(xml_info,
"stroke-linecap");
6482 if (child != (XMLTreeInfo *) NULL)
6484 value=GetXMLTreeContent(child);
6485 if (value != (
const char *) NULL)
6486 CurrentContext->linecap=(LineCap) ParseCommandOption(
6487 MagickLineCapOptions,MagickFalse,value);
6489 child=GetXMLTreeChild(xml_info,
"stroke-linejoin");
6490 if (child != (XMLTreeInfo *) NULL)
6492 value=GetXMLTreeContent(child);
6493 if (value != (
const char *) NULL)
6494 CurrentContext->linejoin=(LineJoin) ParseCommandOption(
6495 MagickLineJoinOptions,MagickFalse,value);
6497 child=GetXMLTreeChild(xml_info,
"stroke-miterlimit");
6498 if (child != (XMLTreeInfo *) NULL)
6500 value=GetXMLTreeContent(child);
6501 if (value != (
const char *) NULL)
6502 CurrentContext->miterlimit=StringToUnsignedLong(value);
6504 child=GetXMLTreeChild(xml_info,
"stroke-opacity");
6505 if (child != (XMLTreeInfo *) NULL)
6507 value=GetXMLTreeContent(child);
6508 if (value != (
const char *) NULL)
6509 CurrentContext->stroke.alpha=(double) ClampToQuantum((
double)
6510 QuantumRange*(1.0-StringToDouble(value,(
char **) NULL)));
6512 child=GetXMLTreeChild(xml_info,
"stroke-width");
6513 if (child != (XMLTreeInfo *) NULL)
6515 value=GetXMLTreeContent(child);
6516 if (value != (
const char *) NULL)
6521 weight=ParseCommandOption(MagickWeightOptions,MagickFalse,value);
6523 weight=(ssize_t) StringToUnsignedLong(value);
6524 CurrentContext->stroke_width=(double) weight;
6527 child=GetXMLTreeChild(xml_info,
"text-align");
6528 if (child != (XMLTreeInfo *) NULL)
6530 value=GetXMLTreeContent(child);
6531 if (value != (
const char *) NULL)
6532 CurrentContext->align=(AlignType) ParseCommandOption(MagickAlignOptions,
6535 child=GetXMLTreeChild(xml_info,
"text-antialias");
6536 if (child != (XMLTreeInfo *) NULL)
6538 value=GetXMLTreeContent(child);
6539 if (value != (
const char *) NULL)
6540 CurrentContext->text_antialias=StringToLong(value) != 0 ? MagickTrue :
6543 child=GetXMLTreeChild(xml_info,
"text-undercolor");
6544 if (child != (XMLTreeInfo *) NULL)
6546 value=GetXMLTreeContent(child);
6547 if (value != (
const char *) NULL)
6548 (void) QueryColorCompliance(value,AllCompliance,
6549 &CurrentContext->undercolor,wand->exception);
6551 child=GetXMLTreeChild(xml_info,
"vector-graphics");
6552 if (child != (XMLTreeInfo *) NULL)
6554 (void) CloneString(&wand->mvg,GetXMLTreeContent(child));
6555 wand->mvg_length=strlen(wand->mvg);
6556 wand->mvg_alloc=wand->mvg_length+1;
6558 xml_info=DestroyXMLTree(xml_info);
6587WandExport
void DrawSkewX(DrawingWand *wand,
const double degrees)
6589 assert(wand != (DrawingWand *) NULL);
6590 assert(wand->signature == MagickWandSignature);
6591 if (wand->debug != MagickFalse)
6592 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
6593 (void) MVGPrintf(wand,
"skewX %.20g\n",degrees);
6621WandExport
void DrawSkewY(DrawingWand *wand,
const double degrees)
6623 assert(wand != (DrawingWand *) NULL);
6624 assert(wand->signature == MagickWandSignature);
6625 if (wand->debug != MagickFalse)
6626 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
6627 (void) MVGPrintf(wand,
"skewY %.20g\n",degrees);
6659WandExport
void DrawTranslate(DrawingWand *wand,
const double x,
const double y)
6661 assert(wand != (DrawingWand *) NULL);
6662 assert(wand->signature == MagickWandSignature);
6663 if (wand->debug != MagickFalse)
6664 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
6665 (void) MVGPrintf(wand,
"translate %.20g %.20g\n",x,y);
6703WandExport
void DrawSetViewbox(DrawingWand *wand,
const double x1,
6704 const double y1,
const double x2,
const double y2)
6706 assert(wand != (DrawingWand *) NULL);
6707 assert(wand->signature == MagickWandSignature);
6708 if (wand->debug != MagickFalse)
6709 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
6710 (void) MVGPrintf(wand,
"viewbox %.20g %.20g %.20g %.20g\n",x1,y1,x2,y2);
6735WandExport MagickBooleanType IsDrawingWand(
const DrawingWand *wand)
6737 if (wand == (
const DrawingWand *) NULL)
6738 return(MagickFalse);
6739 if (wand->signature != MagickWandSignature)
6740 return(MagickFalse);
6741 if (LocaleNCompare(wand->name,DrawingWandId,strlen(DrawingWandId)) != 0)
6742 return(MagickFalse);
6765WandExport DrawingWand *NewDrawingWand(
void)
6770 CheckMagickCoreCompatibility();
6771 wand=(DrawingWand *) AcquireMagickMemory(
sizeof(*wand));
6772 if (wand == (DrawingWand *) NULL)
6773 ThrowWandFatalException(ResourceLimitFatalError,
"MemoryAllocationFailed",
6775 (void) memset(wand,0,
sizeof(*wand));
6776 wand->id=AcquireWandId();
6777 (void) FormatLocaleString(wand->name,MagickPathExtent,
"%s-%.20g",
6778 DrawingWandId,(
double) wand->id);
6779 if (wand->debug != MagickFalse)
6780 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
6781 wand->mvg=(
char *) NULL;
6785 wand->pattern_id=(
char *) NULL;
6786 wand->pattern_offset=0;
6787 wand->pattern_bounds.x=0;
6788 wand->pattern_bounds.y=0;
6789 wand->pattern_bounds.width=0;
6790 wand->pattern_bounds.height=0;
6792 wand->graphic_context=(DrawInfo **) AcquireMagickMemory(
sizeof(
6793 *wand->graphic_context));
6794 if (wand->graphic_context == (DrawInfo **) NULL)
6795 ThrowWandFatalException(ResourceLimitFatalError,
"MemoryAllocationFailed",
6797 wand->filter_off=MagickTrue;
6798 wand->indent_depth=0;
6799 wand->path_operation=PathDefaultOperation;
6800 wand->path_mode=DefaultPathMode;
6801 wand->exception=AcquireExceptionInfo();
6802 wand->image=AcquireImage((
const ImageInfo *) NULL,wand->exception);
6803 wand->destroy=MagickTrue;
6804 wand->debug=IsEventLogging();
6805 wand->signature=MagickWandSignature;
6806 CurrentContext=CloneDrawInfo((ImageInfo *) NULL,(DrawInfo *) NULL);
6832WandExport DrawInfo *PeekDrawingWand(
const DrawingWand *wand)
6837 assert(wand != (
const DrawingWand *) NULL);
6838 assert(wand->signature == MagickWandSignature);
6839 if (wand->debug != MagickFalse)
6840 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
6841 draw_info=CloneDrawInfo((ImageInfo *) NULL,CurrentContext);
6842 (void) CloneString(&draw_info->primitive,wand->mvg);
6871WandExport MagickBooleanType PopDrawingWand(DrawingWand *wand)
6873 assert(wand != (DrawingWand *) NULL);
6874 assert(wand->signature == MagickWandSignature);
6875 if (wand->debug != MagickFalse)
6876 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
6877 if (wand->index == 0)
6879 ThrowDrawException(DrawError,
"UnbalancedGraphicContextPushPop",wand->name)
6880 return(MagickFalse);
6885#if DRAW_BINARY_IMPLEMENTATION
6886 if (wand->image == (Image *) NULL)
6887 ThrowDrawException(WandError,
"ContainsNoImages",wand->name);
6888 if (CurrentContext->clip_mask != (
char *) NULL)
6889 if (LocaleCompare(CurrentContext->clip_mask,
6890 wand->graphic_context[wand->index-1]->clip_mask) != 0)
6891 (
void) SetImageMask(wand->image,WritePixelMask,(Image *) NULL,
6894 CurrentContext=DestroyDrawInfo(CurrentContext);
6896 if (wand->indent_depth > 0)
6897 wand->indent_depth--;
6898 (
void) MVGPrintf(wand,
"pop graphic-context\n");
6927WandExport MagickBooleanType PushDrawingWand(DrawingWand *wand)
6929 assert(wand != (DrawingWand *) NULL);
6930 assert(wand->signature == MagickWandSignature);
6931 if (wand->debug != MagickFalse)
6932 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
6934 wand->graphic_context=(DrawInfo **) ResizeQuantumMemory(wand->graphic_context,
6935 (
size_t) wand->index+1UL,
sizeof(*wand->graphic_context));
6936 if (wand->graphic_context == (DrawInfo **) NULL)
6939 ThrowDrawException(ResourceLimitError,
"MemoryAllocationFailed",
6941 return(MagickFalse);
6943 CurrentContext=CloneDrawInfo((ImageInfo *) NULL,
6944 wand->graphic_context[wand->index-1]);
6945 (void) MVGPrintf(wand,
"push graphic-context\n");
6946 wand->indent_depth++;