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,
" %.17g %.17g",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-%.17g",(
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 %.17g %.17g %.17g %.17g %.17g %.17g\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 %.17g %.17g '%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 %.17g %.17g '%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 %.17g %.17g %.17g %.17g %.17g %.17g\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 %.17g %.17g %.17g %.17g\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 %.17g %.17g '%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);
1023 media_type=MagickToMime(image_info->magick);
1025 blob=(
unsigned char *) ImageToBlob(image_info,clone_image,&blob_length,
1027 image_info=DestroyImageInfo(image_info);
1028 clone_image=DestroyImageList(clone_image);
1029 if (blob == (
void *) NULL)
1030 return(MagickFalse);
1032 base64=Base64Encode(blob,blob_length,&encoded_length);
1033 blob=(
unsigned char *) RelinquishMagickMemory(blob);
1034 if (base64 == (
char *) NULL)
1037 buffer[MagickPathExtent];
1039 (void) FormatLocaleString(buffer,MagickPathExtent,
"%.17g bytes",(
double)
1040 (4L*blob_length/3L+4L));
1041 ThrowDrawException(ResourceLimitWarning,
"MemoryAllocationFailed",
1043 return(MagickFalse);
1045 mode=CommandOptionToMnemonic(MagickComposeOptions,(ssize_t) compose);
1046 (void) MVGPrintf(wand,
"image %s %.17g %.17g %.17g %.17g '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 %.17g %.17g %.17g %.17g %.17g %.17g\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,
"%.17g",
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,
"%.17g",
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,
"%.17g",(
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,
"%.17g",
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,
"%.17g",
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,
"%.17g",(
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,
"%.17g",
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,
"%.17g",
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 %.17g %.17g %.17g %.17g\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%.17g %.17g %.17g %.17g %.17g %.17g",
2906 mode == AbsolutePathMode ?
'C' :
'c',x1,y1,x2,y2,x,y);
2909 (
void) MVGAutoWrapPrintf(wand,
" %.17g %.17g %.17g %.17g %.17g %.17g",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%.17g %.17g %.17g %.17g",
3021 mode == AbsolutePathMode ?
'Q' :
'q',x1,y1,x,y);
3024 (
void) MVGAutoWrapPrintf(wand,
" %.17g %.17g %.17g %.17g",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%.17g %.17g",mode == AbsolutePathMode ?
3136 (
void) MVGAutoWrapPrintf(wand,
" %.17g %.17g",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%.17g %.17g %.17g %.17g",
3247 mode == AbsolutePathMode ?
'S' :
's',x2,y2,x,y);
3250 (
void) MVGAutoWrapPrintf(wand,
" %.17g %.17g %.17g %.17g",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%.17g %.17g %.17g %u %u %.17g %.17g",
3377 mode == AbsolutePathMode ?
'A' :
'a',rx,ry,x_axis_rotation,
3378 large_arc_flag,sweep_flag,x,y);
3381 (
void) MVGAutoWrapPrintf(wand,
" %.17g %.17g %.17g %u %u %.17g %.17g",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%.17g %.17g",mode == AbsolutePathMode ?
3532 (
void) MVGAutoWrapPrintf(wand,
" %.17g %.17g",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%.17g",mode == AbsolutePathMode ?
3627 (
void) MVGAutoWrapPrintf(wand,
" %.17g",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%.17g",mode == AbsolutePathMode ?
3717 (
void) MVGAutoWrapPrintf(wand,
" %.17g",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%.17g %.17g",mode == AbsolutePathMode ?
3810 (
void) MVGAutoWrapPrintf(wand,
" %.17g %.17g",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 %.17g %.17g\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)
4110 ThrowDrawException(WandError,
"ContainsNoImages",wand->name);
4111 return(MagickFalse);
4113 if (wand->pattern_id == (
const char *) NULL)
4115 ThrowDrawException(DrawWarning,
"NotCurrentlyPushingPatternDefinition",
4117 return(MagickFalse);
4119 (void) FormatLocaleString(key,MagickPathExtent,
"%s",wand->pattern_id);
4120 (void) SetImageArtifact(wand->image,key,wand->mvg+wand->pattern_offset);
4121 (void) FormatLocaleString(geometry,MagickPathExtent,
"%.17gx%.17g%+.20g%+.20g",
4122 (
double) wand->pattern_bounds.width,(
double) wand->pattern_bounds.height,
4123 (
double) wand->pattern_bounds.x,(
double) wand->pattern_bounds.y);
4124 (void) SetImageArtifact(wand->image,key,geometry);
4125 wand->pattern_id=DestroyString(wand->pattern_id);
4126 wand->pattern_offset=0;
4127 wand->pattern_bounds.x=0;
4128 wand->pattern_bounds.y=0;
4129 wand->pattern_bounds.width=0;
4130 wand->pattern_bounds.height=0;
4131 wand->filter_off=MagickTrue;
4132 if (wand->indent_depth > 0)
4133 wand->indent_depth--;
4134 (void) MVGPrintf(wand,
"pop pattern\n");
4164WandExport
void DrawPushClipPath(DrawingWand *wand,
const char *clip_mask_id)
4166 assert(wand != (DrawingWand *) NULL);
4167 assert(wand->signature == MagickWandSignature);
4168 if (wand->debug != MagickFalse)
4169 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
4170 assert(clip_mask_id != (
const char *) NULL);
4171 (void) MVGPrintf(wand,
"push clip-path \"%s\"\n",clip_mask_id);
4172 wand->indent_depth++;
4199WandExport
void DrawPushDefs(DrawingWand *wand)
4201 assert(wand != (DrawingWand *) NULL);
4202 assert(wand->signature == MagickWandSignature);
4203 if (wand->debug != MagickFalse)
4204 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
4205 (void) MVGPrintf(wand,
"push defs\n");
4206 wand->indent_depth++;
4248WandExport MagickBooleanType DrawPushPattern(DrawingWand *wand,
4249 const char *pattern_id,
const double x,
const double y,
const double width,
4250 const double height)
4252 assert(wand != (DrawingWand *) NULL);
4253 assert(wand->signature == MagickWandSignature);
4254 if (wand->debug != MagickFalse)
4255 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
4256 assert(pattern_id != (
const char *) NULL);
4257 if (wand->pattern_id != NULL)
4259 ThrowDrawException(DrawError,
"AlreadyPushingPatternDefinition",
4261 return(MagickFalse);
4263 wand->filter_off=MagickTrue;
4264 (void) MVGPrintf(wand,
"push pattern %s %.17g %.17g %.17g %.17g\n",pattern_id,
4266 wand->indent_depth++;
4267 wand->pattern_id=AcquireString(pattern_id);
4268 wand->pattern_bounds.x=CastDoubleToSsizeT(ceil(x-0.5));
4269 wand->pattern_bounds.y=CastDoubleToSsizeT(ceil(y-0.5));
4270 wand->pattern_bounds.width=(size_t) CastDoubleToSsizeT(floor(width+0.5));
4271 wand->pattern_bounds.height=(size_t) CastDoubleToSsizeT(floor(height+0.5));
4272 wand->pattern_offset=wand->mvg_length;
4306WandExport
void DrawRectangle(DrawingWand *wand,
const double x1,
const double y1,
4307 const double x2,
const double y2)
4309 assert(wand != (DrawingWand *) NULL);
4310 assert(wand->signature == MagickWandSignature);
4311 if (wand->debug != MagickFalse)
4312 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
4313 if ((fabs(x2-x1) < MagickEpsilon) && (fabs(y2-y1) < MagickEpsilon))
4314 (void) MVGPrintf(wand,
"point %.17g %.17g\n",x1,y1);
4316 (
void) MVGPrintf(wand,
"rectangle %.17g %.17g %.17g %.17g\n",x1,y1,x2,y2);
4341WandExport MagickBooleanType DrawRender(DrawingWand *wand)
4346 assert(wand != (
const DrawingWand *) NULL);
4347 assert(wand->signature == MagickWandSignature);
4348 if (wand->debug != MagickFalse)
4349 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
4350 CurrentContext->primitive=wand->mvg;
4351 if (wand->debug != MagickFalse)
4352 (void) LogMagickEvent(DrawEvent,GetMagickModule(),
"MVG:\n'%s'\n",wand->mvg);
4353 if (wand->image == (Image *) NULL)
4355 ThrowDrawException(WandError,
"ContainsNoImages",wand->name);
4356 return(MagickFalse);
4358 status=DrawImage(wand->image,CurrentContext,wand->exception);
4359 CurrentContext->primitive=(
char *) NULL;
4386WandExport
void DrawResetVectorGraphics(DrawingWand *wand)
4388 assert(wand != (DrawingWand *) NULL);
4389 assert(wand->signature == MagickWandSignature);
4390 if (wand->debug != MagickFalse)
4391 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
4392 if (wand->mvg != (
char *) NULL)
4393 wand->mvg=DestroyString(wand->mvg);
4423WandExport
void DrawRotate(DrawingWand *wand,
const double degrees)
4425 assert(wand != (DrawingWand *) NULL);
4426 assert(wand->signature == MagickWandSignature);
4427 if (wand->debug != MagickFalse)
4428 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
4429 (void) MVGPrintf(wand,
"rotate %.17g\n",degrees);
4469WandExport
void DrawRoundRectangle(DrawingWand *wand,
double x1,
double y1,
4470 double x2,
double y2,
double rx,
double ry)
4472 assert(wand != (DrawingWand *) NULL);
4473 assert(wand->signature == MagickWandSignature);
4474 if (wand->debug != MagickFalse)
4475 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
4476 (void) MVGPrintf(wand,
"roundrectangle %.17g %.17g %.17g %.17g %.17g %.17g\n",
4507WandExport
void DrawScale(DrawingWand *wand,
const double x,
const double y)
4509 assert(wand != (DrawingWand *) NULL);
4510 assert(wand->signature == MagickWandSignature);
4511 if (wand->debug != MagickFalse)
4512 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
4513 (void) MVGPrintf(wand,
"scale %.17g %.17g\n",x,y);
4541WandExport
void DrawSetBorderColor(DrawingWand *wand,
4542 const PixelWand *border_wand)
4549 assert(wand != (DrawingWand *) NULL);
4550 assert(wand->signature == MagickWandSignature);
4551 if (wand->debug != MagickFalse)
4552 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
4553 assert(border_wand != (
const PixelWand *) NULL);
4554 PixelGetQuantumPacket(border_wand,&border_color);
4555 new_border=border_color;
4556 current_border=(&CurrentContext->border_color);
4557 if ((wand->filter_off != MagickFalse) ||
4558 (IsPixelInfoEquivalent(current_border,&new_border) == MagickFalse))
4560 CurrentContext->border_color=new_border;
4561 (void) MVGPrintf(wand,
"border-color '");
4562 MVGAppendColor(wand,&border_color);
4563 (void) MVGPrintf(wand,
"'\n");
4594WandExport MagickBooleanType DrawSetClipPath(DrawingWand *wand,
4595 const char *clip_mask)
4597 assert(wand != (DrawingWand *) NULL);
4598 if (wand->debug != MagickFalse)
4599 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",clip_mask);
4600 assert(wand->signature == MagickWandSignature);
4601 assert(clip_mask != (
const char *) NULL);
4602 if ((CurrentContext->clip_mask == (
const char *) NULL) ||
4603 (wand->filter_off != MagickFalse) ||
4604 (LocaleCompare(CurrentContext->clip_mask,clip_mask) != 0))
4606 (void) CloneString(&CurrentContext->clip_mask,clip_mask);
4607#if DRAW_BINARY_IMPLEMENTATION
4608 if (wand->image == (Image *) NULL)
4610 ThrowDrawException(WandError,
"ContainsNoImages",wand->name);
4611 return(MagickFalse);
4613 (void) DrawClipPath(wand->image,CurrentContext,CurrentContext->clip_mask,
4616 (void) MVGPrintf(wand,
"clip-path url(#%s)\n",clip_mask);
4645WandExport
void DrawSetClipRule(DrawingWand *wand,
const FillRule fill_rule)
4647 assert(wand != (DrawingWand *) NULL);
4648 assert(wand->signature == MagickWandSignature);
4649 if (wand->debug != MagickFalse)
4650 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
4651 if ((wand->filter_off != MagickFalse) ||
4652 (CurrentContext->fill_rule != fill_rule))
4654 CurrentContext->fill_rule=fill_rule;
4655 (void) MVGPrintf(wand,
"clip-rule '%s'\n",CommandOptionToMnemonic(
4656 MagickFillRuleOptions,(ssize_t) fill_rule));
4686WandExport
void DrawSetClipUnits(DrawingWand *wand,
4687 const ClipPathUnits clip_units)
4689 assert(wand != (DrawingWand *) NULL);
4690 assert(wand->signature == MagickWandSignature);
4691 if (wand->debug != MagickFalse)
4692 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
4693 if ((wand->filter_off != MagickFalse) ||
4694 (CurrentContext->clip_units != clip_units))
4696 CurrentContext->clip_units=clip_units;
4697 if (clip_units == ObjectBoundingBox)
4702 GetAffineMatrix(&affine);
4703 affine.sx=CurrentContext->bounds.x2;
4704 affine.sy=CurrentContext->bounds.y2;
4705 affine.tx=CurrentContext->bounds.x1;
4706 affine.ty=CurrentContext->bounds.y1;
4707 AdjustAffine(wand,&affine);
4709 (void) MVGPrintf(wand,
"clip-units '%s'\n",CommandOptionToMnemonic(
4710 MagickClipPathOptions,(ssize_t) clip_units));
4739WandExport MagickBooleanType DrawSetDensity(DrawingWand *wand,
4740 const char *density)
4742 assert(wand != (DrawingWand *) NULL);
4743 if (wand->debug != MagickFalse)
4744 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",density);
4745 assert(wand->signature == MagickWandSignature);
4746 assert(density != (
const char *) NULL);
4747 if ((CurrentContext->density == (
const char *) NULL) ||
4748 (wand->filter_off != MagickFalse) ||
4749 (LocaleCompare(CurrentContext->density,density) != 0))
4751 (void) CloneString(&CurrentContext->density,density);
4752 (void) MVGPrintf(wand,
"density '%s'\n",density);
4781WandExport
void DrawSetFillColor(DrawingWand *wand,
const PixelWand *fill_wand)
4788 assert(wand != (DrawingWand *) NULL);
4789 assert(wand->signature == MagickWandSignature);
4790 if (wand->debug != MagickFalse)
4791 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
4792 assert(fill_wand != (
const PixelWand *) NULL);
4793 PixelGetQuantumPacket(fill_wand,&fill_color);
4794 new_fill=fill_color;
4795 current_fill=(&CurrentContext->fill);
4796 if ((wand->filter_off != MagickFalse) ||
4797 (IsPixelInfoEquivalent(current_fill,&new_fill) == MagickFalse))
4799 CurrentContext->fill=new_fill;
4800 (void) MVGPrintf(wand,
"fill '");
4801 MVGAppendColor(wand,&fill_color);
4802 (void) MVGPrintf(wand,
"'\n");
4831WandExport
void DrawSetFillOpacity(DrawingWand *wand,
const double fill_opacity)
4836 assert(wand != (DrawingWand *) NULL);
4837 assert(wand->signature == MagickWandSignature);
4838 if (wand->debug != MagickFalse)
4839 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
4840 alpha=(double) ClampToQuantum((
double) QuantumRange*fill_opacity);
4841 if ((wand->filter_off != MagickFalse) ||
4842 (CurrentContext->fill.alpha != alpha))
4844 CurrentContext->fill.alpha=alpha;
4845 (void) MVGPrintf(wand,
"fill-opacity %.17g\n",fill_opacity);
4876WandExport MagickBooleanType DrawSetFontResolution(DrawingWand *wand,
4877 const double x_resolution,
const double y_resolution)
4880 density[MagickPathExtent];
4882 assert(wand != (DrawingWand *) NULL);
4883 assert(wand->signature == MagickWandSignature);
4884 if (wand->debug != MagickFalse)
4885 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
4886 (void) FormatLocaleString(density,MagickPathExtent,
"%.17gx%.17g",x_resolution,
4888 (void) CloneString(&CurrentContext->density,density);
4917WandExport
void DrawSetOpacity(DrawingWand *wand,
const double opacity)
4922 assert(wand != (DrawingWand *) NULL);
4923 assert(wand->signature == MagickWandSignature);
4924 if (wand->debug != MagickFalse)
4925 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
4926 quantum_alpha=ClampToQuantum((
double) QuantumRange*opacity);
4927 if ((wand->filter_off != MagickFalse) ||
4928 (CurrentContext->alpha != quantum_alpha))
4930 CurrentContext->alpha=quantum_alpha;
4931 (void) MVGPrintf(wand,
"opacity %.17g\n",opacity);
4963WandExport MagickBooleanType DrawSetFillPatternURL(DrawingWand *wand,
4964 const char *fill_url)
4967 pattern[MagickPathExtent],
4968 pattern_spec[MagickPathExtent];
4970 assert(wand != (DrawingWand *) NULL);
4971 assert(wand->signature == MagickWandSignature);
4972 if (wand->debug != MagickFalse)
4973 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",fill_url);
4974 if (wand->image == (Image *) NULL)
4976 ThrowDrawException(WandError,
"ContainsNoImages",wand->name);
4977 return(MagickFalse);
4979 assert(fill_url != (
const char *) NULL);
4980 if (*fill_url !=
'#')
4982 ThrowDrawException(DrawError,
"NotARelativeURL",fill_url);
4983 return(MagickFalse);
4985 (void) FormatLocaleString(pattern,MagickPathExtent,
"%s",fill_url+1);
4986 if (GetImageArtifact(wand->image,pattern) == (
const char *) NULL)
4988 ThrowDrawException(DrawError,
"URLNotFound",fill_url)
4989 return(MagickFalse);
4991 (void) FormatLocaleString(pattern_spec,MagickPathExtent,
"url(%s)",fill_url);
4992#if DRAW_BINARY_IMPLEMENTATION
4993 DrawPatternPath(wand->image,CurrentContext,pattern_spec,
4994 &CurrentContext->fill_pattern,wand->exception);
4996 if (CurrentContext->fill.alpha != (
double) TransparentAlpha)
4997 CurrentContext->fill.alpha=(double) CurrentContext->alpha;
4998 (void) MVGPrintf(wand,
"fill %s\n",pattern_spec);
5026WandExport
void DrawSetFillRule(DrawingWand *wand,
const FillRule fill_rule)
5028 assert(wand != (DrawingWand *) NULL);
5029 assert(wand->signature == MagickWandSignature);
5030 if (wand->debug != MagickFalse)
5031 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
5032 if ((wand->filter_off != MagickFalse) ||
5033 (CurrentContext->fill_rule != fill_rule))
5035 CurrentContext->fill_rule=fill_rule;
5036 (void) MVGPrintf(wand,
"fill-rule '%s'\n",CommandOptionToMnemonic(
5037 MagickFillRuleOptions,(ssize_t) fill_rule));
5066WandExport MagickBooleanType DrawSetFont(DrawingWand *wand,
5067 const char *font_name)
5069 assert(wand != (DrawingWand *) NULL);
5070 assert(wand->signature == MagickWandSignature);
5071 if (wand->debug != MagickFalse)
5072 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
5073 assert(font_name != (
const char *) NULL);
5074 if ((wand->filter_off != MagickFalse) ||
5075 (CurrentContext->font == (
char *) NULL) ||
5076 (LocaleCompare(CurrentContext->font,font_name) != 0))
5078 (void) CloneString(&CurrentContext->font,font_name);
5079 (void) MVGPrintf(wand,
"font '%s'\n",font_name);
5109WandExport MagickBooleanType DrawSetFontFamily(DrawingWand *wand,
5110 const char *font_family)
5112 assert(wand != (DrawingWand *) NULL);
5113 assert(wand->signature == MagickWandSignature);
5114 if (wand->debug != MagickFalse)
5115 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
5116 assert(font_family != (
const char *) NULL);
5117 if ((wand->filter_off != MagickFalse) ||
5118 (CurrentContext->family == (
const char *) NULL) ||
5119 (LocaleCompare(CurrentContext->family,font_family) != 0))
5121 (void) CloneString(&CurrentContext->family,font_family);
5122 (void) MVGPrintf(wand,
"font-family '%s'\n",font_family);
5151WandExport
void DrawSetFontSize(DrawingWand *wand,
const double pointsize)
5153 assert(wand != (DrawingWand *) NULL);
5154 assert(wand->signature == MagickWandSignature);
5155 if (wand->debug != MagickFalse)
5156 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
5157 if ((wand->filter_off != MagickFalse) ||
5158 (fabs(CurrentContext->pointsize-pointsize) >= MagickEpsilon))
5160 CurrentContext->pointsize=pointsize;
5161 (void) MVGPrintf(wand,
"font-size %.17g\n",pointsize);
5194WandExport
void DrawSetFontStretch(DrawingWand *wand,
5195 const StretchType font_stretch)
5197 assert(wand != (DrawingWand *) NULL);
5198 assert(wand->signature == MagickWandSignature);
5199 if (wand->debug != MagickFalse)
5200 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
5201 if ((wand->filter_off != MagickFalse) ||
5202 (CurrentContext->stretch != font_stretch))
5204 CurrentContext->stretch=font_stretch;
5205 (void) MVGPrintf(wand,
"font-stretch '%s'\n",CommandOptionToMnemonic(
5206 MagickStretchOptions,(ssize_t) font_stretch));
5235WandExport
void DrawSetFontStyle(DrawingWand *wand,
const StyleType style)
5237 assert(wand != (DrawingWand *) NULL);
5238 assert(wand->signature == MagickWandSignature);
5239 if (wand->debug != MagickFalse)
5240 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
5241 if ((wand->filter_off != MagickFalse) ||
5242 (CurrentContext->style != style))
5244 CurrentContext->style=style;
5245 (void) MVGPrintf(wand,
"font-style '%s'\n",CommandOptionToMnemonic(
5246 MagickStyleOptions,(ssize_t) style));
5275WandExport
void DrawSetFontWeight(DrawingWand *wand,
5276 const size_t font_weight)
5278 assert(wand != (DrawingWand *) NULL);
5279 assert(wand->signature == MagickWandSignature);
5280 if (wand->debug != MagickFalse)
5281 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
5282 if ((wand->filter_off != MagickFalse) ||
5283 (CurrentContext->weight != font_weight))
5285 CurrentContext->weight=font_weight;
5286 (void) MVGPrintf(wand,
"font-weight %.17g\n",(
double) font_weight);
5318WandExport
void DrawSetGravity(DrawingWand *wand,
const GravityType gravity)
5320 assert(wand != (DrawingWand *) NULL);
5321 assert(wand->signature == MagickWandSignature);
5322 if (wand->debug != MagickFalse)
5323 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
5324 if ((wand->filter_off != MagickFalse) ||
5325 (CurrentContext->gravity != gravity) || (gravity != ForgetGravity))
5327 CurrentContext->gravity=gravity;
5328 (void) MVGPrintf(wand,
"gravity '%s'\n",CommandOptionToMnemonic(
5329 MagickGravityOptions,(ssize_t) gravity));
5358WandExport
void DrawSetStrokeColor(DrawingWand *wand,
5359 const PixelWand *stroke_wand)
5366 assert(wand != (DrawingWand *) NULL);
5367 assert(wand->signature == MagickWandSignature);
5368 if (wand->debug != MagickFalse)
5369 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
5370 assert(stroke_wand != (
const PixelWand *) NULL);
5371 PixelGetQuantumPacket(stroke_wand,&stroke_color);
5372 new_stroke=stroke_color;
5373 current_stroke=(&CurrentContext->stroke);
5374 if ((wand->filter_off != MagickFalse) ||
5375 (IsPixelInfoEquivalent(current_stroke,&new_stroke) == MagickFalse))
5377 CurrentContext->stroke=new_stroke;
5378 (void) MVGPrintf(wand,
"stroke '");
5379 MVGAppendColor(wand,&stroke_color);
5380 (void) MVGPrintf(wand,
"'\n");
5409WandExport MagickBooleanType DrawSetStrokePatternURL(DrawingWand *wand,
5410 const char *stroke_url)
5413 pattern[MagickPathExtent],
5414 pattern_spec[MagickPathExtent];
5416 assert(wand != (DrawingWand *) NULL);
5417 assert(wand->signature == MagickWandSignature);
5418 if (wand->debug != MagickFalse)
5419 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
5420 if (wand->image == (Image *) NULL)
5422 ThrowDrawException(WandError,
"ContainsNoImages",wand->name);
5423 return(MagickFalse);
5425 assert(stroke_url != NULL);
5426 if (stroke_url[0] !=
'#')
5428 ThrowDrawException(DrawError,
"NotARelativeURL",stroke_url);
5429 return(MagickFalse);
5431 (void) FormatLocaleString(pattern,MagickPathExtent,
"%s",stroke_url+1);
5432 if (GetImageArtifact(wand->image,pattern) == (
const char *) NULL)
5434 ThrowDrawException(DrawError,
"URLNotFound",stroke_url)
5435 return(MagickFalse);
5437 (void) FormatLocaleString(pattern_spec,MagickPathExtent,
"url(%s)",stroke_url);
5438#if DRAW_BINARY_IMPLEMENTATION
5439 DrawPatternPath(wand->image,CurrentContext,pattern_spec,
5440 &CurrentContext->stroke_pattern,wand->exception);
5442 if (CurrentContext->stroke.alpha != (
double) TransparentAlpha)
5443 CurrentContext->stroke.alpha=(double) CurrentContext->alpha;
5444 (void) MVGPrintf(wand,
"stroke %s\n",pattern_spec);
5476WandExport
void DrawSetStrokeAntialias(DrawingWand *wand,
5477 const MagickBooleanType stroke_antialias)
5479 assert(wand != (DrawingWand *) NULL);
5480 assert(wand->signature == MagickWandSignature);
5481 if (wand->debug != MagickFalse)
5482 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
5483 if ((wand->filter_off != MagickFalse) ||
5484 (CurrentContext->stroke_antialias != stroke_antialias))
5486 CurrentContext->stroke_antialias=stroke_antialias;
5487 (void) MVGPrintf(wand,
"stroke-antialias %i\n",stroke_antialias != 0 ?
5525WandExport MagickBooleanType DrawSetStrokeDashArray(DrawingWand *wand,
5526 const size_t number_elements,
const double *dasharray)
5544 assert(wand != (DrawingWand *) NULL);
5545 assert(wand->signature == MagickWandSignature);
5546 if (wand->debug != MagickFalse)
5547 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
5548 n_new=number_elements;
5549 if (dasharray == (
const double *) NULL)
5553 q=CurrentContext->dash_pattern;
5554 if (q != (
const double *) NULL)
5555 while (fabs(*q++) >= MagickEpsilon)
5557 if ((n_old == 0) && (n_new == 0))
5563 if ((CurrentContext->dash_pattern != (
double *) NULL) &&
5564 (dasharray != (
double *) NULL))
5567 q=CurrentContext->dash_pattern;
5568 for (i=0; i < (ssize_t) n_new; i++)
5570 if (fabs((*p)-(*q)) >= MagickEpsilon)
5579 if ((wand->filter_off != MagickFalse) || (update != MagickFalse))
5581 if (CurrentContext->dash_pattern != (
double *) NULL)
5582 CurrentContext->dash_pattern=(
double *)
5583 RelinquishMagickMemory(CurrentContext->dash_pattern);
5586 CurrentContext->dash_pattern=(
double *) AcquireQuantumMemory((
size_t)
5587 n_new+1UL,
sizeof(*CurrentContext->dash_pattern));
5588 if (CurrentContext->dash_pattern == (
double *) NULL)
5590 ThrowDrawException(ResourceLimitError,
"MemoryAllocationFailed",
5592 return(MagickFalse);
5594 for (i=0; i < (ssize_t) n_new; i++)
5596 CurrentContext->dash_pattern[i]=0.0;
5597 if (dasharray != (
double *) NULL)
5598 CurrentContext->dash_pattern[i]=dasharray[i];
5600 CurrentContext->dash_pattern[n_new]=0.0;
5602 (void) MVGPrintf(wand,
"stroke-dasharray ");
5604 (void) MVGPrintf(wand,
"none\n");
5606 if (dasharray != (
double *) NULL)
5608 for (i=0; i < (ssize_t) n_new; i++)
5611 (void) MVGPrintf(wand,
",");
5612 (void) MVGPrintf(wand,
"%.17g",dasharray[i]);
5614 (void) MVGPrintf(wand,
"\n");
5646WandExport
void DrawSetStrokeDashOffset(DrawingWand *wand,
5647 const double dash_offset)
5649 assert(wand != (DrawingWand *) NULL);
5650 assert(wand->signature == MagickWandSignature);
5651 if (wand->debug != MagickFalse)
5652 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
5653 if ((wand->filter_off != MagickFalse) ||
5654 (fabs(CurrentContext->dash_offset-dash_offset) >= MagickEpsilon))
5656 CurrentContext->dash_offset=dash_offset;
5657 (void) MVGPrintf(wand,
"stroke-dashoffset %.17g\n",dash_offset);
5688WandExport
void DrawSetStrokeLineCap(DrawingWand *wand,
const LineCap linecap)
5690 assert(wand != (DrawingWand *) NULL);
5691 assert(wand->signature == MagickWandSignature);
5692 if (wand->debug != MagickFalse)
5693 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
5694 if ((wand->filter_off != MagickFalse) || (CurrentContext->linecap != linecap))
5696 CurrentContext->linecap=linecap;
5697 (void) MVGPrintf(wand,
"stroke-linecap '%s'\n",CommandOptionToMnemonic(
5698 MagickLineCapOptions,(ssize_t) linecap));
5729WandExport
void DrawSetStrokeLineJoin(DrawingWand *wand,
const LineJoin linejoin)
5731 assert(wand != (DrawingWand *) NULL);
5732 assert(wand->signature == MagickWandSignature);
5733 if (wand->debug != MagickFalse)
5734 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
5735 if ((wand->filter_off != MagickFalse) ||
5736 (CurrentContext->linejoin != linejoin))
5738 CurrentContext->linejoin=linejoin;
5739 (void) MVGPrintf(wand,
"stroke-linejoin '%s'\n",CommandOptionToMnemonic(
5740 MagickLineJoinOptions,(ssize_t) linejoin));
5773WandExport
void DrawSetStrokeMiterLimit(DrawingWand *wand,
5774 const size_t miterlimit)
5776 assert(wand != (DrawingWand *) NULL);
5777 assert(wand->signature == MagickWandSignature);
5778 if (wand->debug != MagickFalse)
5779 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
5780 if (CurrentContext->miterlimit != miterlimit)
5782 CurrentContext->miterlimit=miterlimit;
5783 (void) MVGPrintf(wand,
"stroke-miterlimit %.17g\n",(
double) miterlimit);
5812WandExport
void DrawSetStrokeOpacity(DrawingWand *wand,
5813 const double opacity)
5818 assert(wand != (DrawingWand *) NULL);
5819 assert(wand->signature == MagickWandSignature);
5820 if (wand->debug != MagickFalse)
5821 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
5822 alpha=(double) ClampToQuantum((
double) QuantumRange*opacity);
5823 if ((wand->filter_off != MagickFalse) ||
5824 (CurrentContext->stroke.alpha != alpha))
5826 CurrentContext->stroke.alpha=alpha;
5827 (void) MVGPrintf(wand,
"stroke-opacity %.17g\n",opacity);
5857WandExport
void DrawSetStrokeWidth(DrawingWand *wand,
const double stroke_width)
5859 assert(wand != (DrawingWand *) NULL);
5860 assert(wand->signature == MagickWandSignature);
5861 if (wand->debug != MagickFalse)
5862 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
5863 if ((wand->filter_off != MagickFalse) ||
5864 (fabs(CurrentContext->stroke_width-stroke_width) >= MagickEpsilon))
5866 CurrentContext->stroke_width=stroke_width;
5867 (void) MVGPrintf(wand,
"stroke-width %.17g\n",stroke_width);
5897WandExport
void DrawSetTextAlignment(DrawingWand *wand,
5898 const AlignType alignment)
5900 assert(wand != (DrawingWand *) NULL);
5901 assert(wand->signature == MagickWandSignature);
5902 if (wand->debug != MagickFalse)
5903 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
5904 if ((wand->filter_off != MagickFalse) ||
5905 (CurrentContext->align != alignment))
5907 CurrentContext->align=alignment;
5908 (void) MVGPrintf(wand,
"text-align '%s'\n",CommandOptionToMnemonic(
5909 MagickAlignOptions,(ssize_t) alignment));
5940WandExport
void DrawSetTextAntialias(DrawingWand *wand,
5941 const MagickBooleanType text_antialias)
5943 assert(wand != (DrawingWand *) NULL);
5944 assert(wand->signature == MagickWandSignature);
5945 if (wand->debug != MagickFalse)
5946 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
5947 if ((wand->filter_off != MagickFalse) ||
5948 (CurrentContext->text_antialias != text_antialias))
5950 CurrentContext->text_antialias=text_antialias;
5951 (void) MVGPrintf(wand,
"text-antialias %i\n",text_antialias != 0 ? 1 : 0);
5982WandExport
void DrawSetTextDecoration(DrawingWand *wand,
5983 const DecorationType decoration)
5985 assert(wand != (DrawingWand *) NULL);
5986 assert(wand->signature == MagickWandSignature);
5987 if (wand->debug != MagickFalse)
5988 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
5989 if ((wand->filter_off != MagickFalse) ||
5990 (CurrentContext->decorate != decoration))
5992 CurrentContext->decorate=decoration;
5993 (void) MVGPrintf(wand,
"decorate '%s'\n",CommandOptionToMnemonic(
5994 MagickDecorateOptions,(ssize_t) decoration));
6025WandExport
void DrawSetTextDirection(DrawingWand *wand,
6026 const DirectionType direction)
6028 assert(wand != (DrawingWand *) NULL);
6029 assert(wand->signature == MagickWandSignature);
6031 if (wand->debug != MagickFalse)
6032 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
6033 if ((wand->filter_off != MagickFalse) ||
6034 (CurrentContext->direction != direction))
6036 CurrentContext->direction=direction;
6037 (void) MVGPrintf(wand,
"direction '%s'\n",CommandOptionToMnemonic(
6038 MagickDirectionOptions,(ssize_t) direction));
6071WandExport
void DrawSetTextEncoding(DrawingWand *wand,
const char *encoding)
6073 assert(wand != (DrawingWand *) NULL);
6074 assert(wand->signature == MagickWandSignature);
6075 if (wand->debug != MagickFalse)
6076 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
6077 assert(encoding != (
char *) NULL);
6078 if ((wand->filter_off != MagickFalse) ||
6079 (CurrentContext->encoding == (
char *) NULL) ||
6080 (LocaleCompare(CurrentContext->encoding,encoding) != 0))
6082 (void) CloneString(&CurrentContext->encoding,encoding);
6083 (void) MVGPrintf(wand,
"encoding '%s'\n",encoding);
6111WandExport
void DrawSetTextKerning(DrawingWand *wand,
const double kerning)
6113 assert(wand != (DrawingWand *) NULL);
6114 assert(wand->signature == MagickWandSignature);
6116 if (wand->debug != MagickFalse)
6117 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
6118 if ((wand->filter_off != MagickFalse) &&
6119 (fabs((CurrentContext->kerning-kerning)) >= MagickEpsilon))
6121 CurrentContext->kerning=kerning;
6122 (void) MVGPrintf(wand,
"kerning %lf\n",kerning);
6151WandExport
void DrawSetTextInterlineSpacing(DrawingWand *wand,
6152 const double interline_spacing)
6154 assert(wand != (DrawingWand *) NULL);
6155 assert(wand->signature == MagickWandSignature);
6157 if (wand->debug != MagickFalse)
6158 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
6159 if ((wand->filter_off != MagickFalse) ||
6160 (fabs((CurrentContext->interline_spacing-
6161 interline_spacing)) >= MagickEpsilon))
6163 CurrentContext->interline_spacing=interline_spacing;
6164 (void) MVGPrintf(wand,
"interline-spacing %lf\n",interline_spacing);
6193WandExport
void DrawSetTextInterwordSpacing(DrawingWand *wand,
6194 const double interword_spacing)
6196 assert(wand != (DrawingWand *) NULL);
6197 assert(wand->signature == MagickWandSignature);
6199 if (wand->debug != MagickFalse)
6200 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
6201 if ((wand->filter_off != MagickFalse) ||
6202 (fabs((CurrentContext->interword_spacing-
6203 interword_spacing)) >= MagickEpsilon))
6205 CurrentContext->interword_spacing=interword_spacing;
6206 (void) MVGPrintf(wand,
"interword-spacing %lf\n",interword_spacing);
6236WandExport
void DrawSetTextUnderColor(DrawingWand *wand,
6237 const PixelWand *under_wand)
6242 assert(wand != (DrawingWand *) NULL);
6243 assert(wand->signature == MagickWandSignature);
6244 if (wand->debug != MagickFalse)
6245 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
6246 assert(under_wand != (
const PixelWand *) NULL);
6247 PixelGetQuantumPacket(under_wand,&under_color);
6248 if ((wand->filter_off != MagickFalse) ||
6249 (IsPixelInfoEquivalent(&CurrentContext->undercolor,&under_color) == MagickFalse))
6251 CurrentContext->undercolor=under_color;
6252 (void) MVGPrintf(wand,
"text-undercolor '");
6253 MVGAppendColor(wand,&under_color);
6254 (void) MVGPrintf(wand,
"'\n");
6286static inline MagickBooleanType IsPoint(
const char *point)
6294 value=strtol(point,&p,10);
6296 return(p != point ? MagickTrue : MagickFalse);
6299WandExport MagickBooleanType DrawSetVectorGraphics(DrawingWand *wand,
6309 assert(wand != (DrawingWand *) NULL);
6310 assert(wand->signature == MagickWandSignature);
6311 if (wand->debug != MagickFalse)
6312 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
6313 CurrentContext=DestroyDrawInfo(CurrentContext);
6314 CurrentContext=CloneDrawInfo((ImageInfo *) NULL,(DrawInfo *) NULL);
6315 if (xml == (
const char *) NULL)
6316 return(MagickFalse);
6317 xml_info=NewXMLTree(xml,wand->exception);
6318 if (xml_info == (XMLTreeInfo *) NULL)
6319 return(MagickFalse);
6320 child=GetXMLTreeChild(xml_info,
"clip-path");
6321 if (child != (XMLTreeInfo *) NULL)
6322 (void) CloneString(&CurrentContext->clip_mask,GetXMLTreeContent(child));
6323 child=GetXMLTreeChild(xml_info,
"clip-units");
6324 if (child != (XMLTreeInfo *) NULL)
6326 value=GetXMLTreeContent(child);
6327 if (value != (
const char *) NULL)
6328 CurrentContext->clip_units=(ClipPathUnits) ParseCommandOption(
6329 MagickClipPathOptions,MagickFalse,value);
6331 child=GetXMLTreeChild(xml_info,
"decorate");
6332 if (child != (XMLTreeInfo *) NULL)
6334 value=GetXMLTreeContent(child);
6335 if (value != (
const char *) NULL)
6336 CurrentContext->decorate=(DecorationType) ParseCommandOption(
6337 MagickDecorateOptions,MagickFalse,value);
6339 child=GetXMLTreeChild(xml_info,
"encoding");
6340 if (child != (XMLTreeInfo *) NULL)
6341 (void) CloneString(&CurrentContext->encoding,GetXMLTreeContent(child));
6342 child=GetXMLTreeChild(xml_info,
"fill");
6343 if (child != (XMLTreeInfo *) NULL)
6345 value=GetXMLTreeContent(child);
6346 if (value != (
const char *) NULL)
6347 (void) QueryColorCompliance(value,AllCompliance,&CurrentContext->fill,
6350 child=GetXMLTreeChild(xml_info,
"fill-opacity");
6351 if (child != (XMLTreeInfo *) NULL)
6353 value=GetXMLTreeContent(child);
6354 if (value != (
const char *) NULL)
6355 CurrentContext->fill.alpha=(double) ClampToQuantum((
double)
6356 QuantumRange*(1.0-StringToDouble(value,(
char **) NULL)));
6358 child=GetXMLTreeChild(xml_info,
"fill-rule");
6359 if (child != (XMLTreeInfo *) NULL)
6361 value=GetXMLTreeContent(child);
6362 if (value != (
const char *) NULL)
6363 CurrentContext->fill_rule=(FillRule) ParseCommandOption(
6364 MagickFillRuleOptions,MagickFalse,value);
6366 child=GetXMLTreeChild(xml_info,
"font");
6367 if (child != (XMLTreeInfo *) NULL)
6368 (void) CloneString(&CurrentContext->font,GetXMLTreeContent(child));
6369 child=GetXMLTreeChild(xml_info,
"font-family");
6370 if (child != (XMLTreeInfo *) NULL)
6371 (void) CloneString(&CurrentContext->family,GetXMLTreeContent(child));
6372 child=GetXMLTreeChild(xml_info,
"font-size");
6373 if (child != (XMLTreeInfo *) NULL)
6375 value=GetXMLTreeContent(child);
6376 if (value != (
const char *) NULL)
6377 CurrentContext->pointsize=StringToDouble(value,(
char **) NULL);
6379 child=GetXMLTreeChild(xml_info,
"font-stretch");
6380 if (child != (XMLTreeInfo *) NULL)
6382 value=GetXMLTreeContent(child);
6383 if (value != (
const char *) NULL)
6384 CurrentContext->stretch=(StretchType) ParseCommandOption(
6385 MagickStretchOptions,MagickFalse,value);
6387 child=GetXMLTreeChild(xml_info,
"font-style");
6388 if (child != (XMLTreeInfo *) NULL)
6390 value=GetXMLTreeContent(child);
6391 if (value != (
const char *) NULL)
6392 CurrentContext->style=(StyleType) ParseCommandOption(MagickStyleOptions,
6395 child=GetXMLTreeChild(xml_info,
"font-weight");
6396 if (child != (XMLTreeInfo *) NULL)
6398 value=GetXMLTreeContent(child);
6399 if (value != (
const char *) NULL)
6404 weight=ParseCommandOption(MagickWeightOptions,MagickFalse,value);
6406 weight=(ssize_t) StringToUnsignedLong(value);
6407 CurrentContext->weight=(size_t) weight;
6410 child=GetXMLTreeChild(xml_info,
"gravity");
6411 if (child != (XMLTreeInfo *) NULL)
6413 value=GetXMLTreeContent(child);
6414 if (value != (
const char *) NULL)
6415 CurrentContext->gravity=(GravityType) ParseCommandOption(
6416 MagickGravityOptions,MagickFalse,value);
6418 child=GetXMLTreeChild(xml_info,
"stroke");
6419 if (child != (XMLTreeInfo *) NULL)
6421 value=GetXMLTreeContent(child);
6422 if (value != (
const char *) NULL)
6423 (void) QueryColorCompliance(value,AllCompliance,&CurrentContext->stroke,
6426 child=GetXMLTreeChild(xml_info,
"stroke-antialias");
6427 if (child != (XMLTreeInfo *) NULL)
6429 value=GetXMLTreeContent(child);
6430 if (value != (
const char *) NULL)
6431 CurrentContext->stroke_antialias=StringToLong(value) != 0 ? MagickTrue :
6434 child=GetXMLTreeChild(xml_info,
"stroke-dasharray");
6435 if (child != (XMLTreeInfo *) NULL)
6438 token[MagickPathExtent];
6449 value=GetXMLTreeContent(child);
6450 if (value != (
const char *) NULL)
6452 if (CurrentContext->dash_pattern != (
double *) NULL)
6453 CurrentContext->dash_pattern=(
double *) RelinquishMagickMemory(
6454 CurrentContext->dash_pattern);
6456 if (IsPoint(q) != MagickFalse)
6462 (void) GetNextToken(p,&p,MagickPathExtent,token);
6464 (void) GetNextToken(p,&p,MagickPathExtent,token);
6465 for (x=0; IsPoint(token) != MagickFalse; x++)
6467 (void) GetNextToken(p,&p,MagickPathExtent,token);
6469 (void) GetNextToken(p,&p,MagickPathExtent,token);
6471 CurrentContext->dash_pattern=(
double *) AcquireQuantumMemory(
6472 (
size_t) (2*x)+1UL,
sizeof(*CurrentContext->dash_pattern));
6473 if (CurrentContext->dash_pattern == (
double *) NULL)
6474 ThrowWandFatalException(ResourceLimitFatalError,
6475 "MemoryAllocationFailed",wand->name);
6476 for (j=0; j < x; j++)
6478 (void) GetNextToken(q,&q,MagickPathExtent,token);
6480 (void) GetNextToken(q,&q,MagickPathExtent,token);
6481 CurrentContext->dash_pattern[j]=StringToDouble(token,
6484 if (((x & 0x01) != 0) && (j == x))
6485 for ( ; j < (2*x); j++)
6486 CurrentContext->dash_pattern[j]=
6487 CurrentContext->dash_pattern[j-x];
6488 CurrentContext->dash_pattern[j]=0.0;
6492 child=GetXMLTreeChild(xml_info,
"stroke-dashoffset");
6493 if (child != (XMLTreeInfo *) NULL)
6495 value=GetXMLTreeContent(child);
6496 if (value != (
const char *) NULL)
6497 CurrentContext->dash_offset=StringToDouble(value,(
char **) NULL);
6499 child=GetXMLTreeChild(xml_info,
"stroke-linecap");
6500 if (child != (XMLTreeInfo *) NULL)
6502 value=GetXMLTreeContent(child);
6503 if (value != (
const char *) NULL)
6504 CurrentContext->linecap=(LineCap) ParseCommandOption(
6505 MagickLineCapOptions,MagickFalse,value);
6507 child=GetXMLTreeChild(xml_info,
"stroke-linejoin");
6508 if (child != (XMLTreeInfo *) NULL)
6510 value=GetXMLTreeContent(child);
6511 if (value != (
const char *) NULL)
6512 CurrentContext->linejoin=(LineJoin) ParseCommandOption(
6513 MagickLineJoinOptions,MagickFalse,value);
6515 child=GetXMLTreeChild(xml_info,
"stroke-miterlimit");
6516 if (child != (XMLTreeInfo *) NULL)
6518 value=GetXMLTreeContent(child);
6519 if (value != (
const char *) NULL)
6520 CurrentContext->miterlimit=StringToUnsignedLong(value);
6522 child=GetXMLTreeChild(xml_info,
"stroke-opacity");
6523 if (child != (XMLTreeInfo *) NULL)
6525 value=GetXMLTreeContent(child);
6526 if (value != (
const char *) NULL)
6527 CurrentContext->stroke.alpha=(double) ClampToQuantum((
double)
6528 QuantumRange*(1.0-StringToDouble(value,(
char **) NULL)));
6530 child=GetXMLTreeChild(xml_info,
"stroke-width");
6531 if (child != (XMLTreeInfo *) NULL)
6533 value=GetXMLTreeContent(child);
6534 if (value != (
const char *) NULL)
6539 weight=ParseCommandOption(MagickWeightOptions,MagickFalse,value);
6541 weight=(ssize_t) StringToUnsignedLong(value);
6542 CurrentContext->stroke_width=(double) weight;
6545 child=GetXMLTreeChild(xml_info,
"text-align");
6546 if (child != (XMLTreeInfo *) NULL)
6548 value=GetXMLTreeContent(child);
6549 if (value != (
const char *) NULL)
6550 CurrentContext->align=(AlignType) ParseCommandOption(MagickAlignOptions,
6553 child=GetXMLTreeChild(xml_info,
"text-antialias");
6554 if (child != (XMLTreeInfo *) NULL)
6556 value=GetXMLTreeContent(child);
6557 if (value != (
const char *) NULL)
6558 CurrentContext->text_antialias=StringToLong(value) != 0 ? MagickTrue :
6561 child=GetXMLTreeChild(xml_info,
"text-undercolor");
6562 if (child != (XMLTreeInfo *) NULL)
6564 value=GetXMLTreeContent(child);
6565 if (value != (
const char *) NULL)
6566 (void) QueryColorCompliance(value,AllCompliance,
6567 &CurrentContext->undercolor,wand->exception);
6569 child=GetXMLTreeChild(xml_info,
"vector-graphics");
6570 if (child != (XMLTreeInfo *) NULL)
6572 (void) CloneString(&wand->mvg,GetXMLTreeContent(child));
6573 wand->mvg_length=strlen(wand->mvg);
6574 wand->mvg_alloc=wand->mvg_length+1;
6576 xml_info=DestroyXMLTree(xml_info);
6605WandExport
void DrawSkewX(DrawingWand *wand,
const double degrees)
6607 assert(wand != (DrawingWand *) NULL);
6608 assert(wand->signature == MagickWandSignature);
6609 if (wand->debug != MagickFalse)
6610 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
6611 (void) MVGPrintf(wand,
"skewX %.17g\n",degrees);
6639WandExport
void DrawSkewY(DrawingWand *wand,
const double degrees)
6641 assert(wand != (DrawingWand *) NULL);
6642 assert(wand->signature == MagickWandSignature);
6643 if (wand->debug != MagickFalse)
6644 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
6645 (void) MVGPrintf(wand,
"skewY %.17g\n",degrees);
6677WandExport
void DrawTranslate(DrawingWand *wand,
const double x,
const double y)
6679 assert(wand != (DrawingWand *) NULL);
6680 assert(wand->signature == MagickWandSignature);
6681 if (wand->debug != MagickFalse)
6682 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
6683 (void) MVGPrintf(wand,
"translate %.17g %.17g\n",x,y);
6721WandExport
void DrawSetViewbox(DrawingWand *wand,
const double x1,
6722 const double y1,
const double x2,
const double y2)
6724 assert(wand != (DrawingWand *) NULL);
6725 assert(wand->signature == MagickWandSignature);
6726 if (wand->debug != MagickFalse)
6727 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
6728 (void) MVGPrintf(wand,
"viewbox %.17g %.17g %.17g %.17g\n",x1,y1,x2,y2);
6753WandExport MagickBooleanType IsDrawingWand(
const DrawingWand *wand)
6755 if (wand == (
const DrawingWand *) NULL)
6756 return(MagickFalse);
6757 if (wand->signature != MagickWandSignature)
6758 return(MagickFalse);
6759 if (LocaleNCompare(wand->name,DrawingWandId,strlen(DrawingWandId)) != 0)
6760 return(MagickFalse);
6783WandExport DrawingWand *NewDrawingWand(
void)
6788 CheckMagickCoreCompatibility();
6789 wand=(DrawingWand *) AcquireMagickMemory(
sizeof(*wand));
6790 if (wand == (DrawingWand *) NULL)
6791 ThrowWandFatalException(ResourceLimitFatalError,
"MemoryAllocationFailed",
6793 (void) memset(wand,0,
sizeof(*wand));
6794 wand->id=AcquireWandId();
6795 (void) FormatLocaleString(wand->name,MagickPathExtent,
"%s-%.17g",
6796 DrawingWandId,(
double) wand->id);
6797 if (wand->debug != MagickFalse)
6798 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
6799 wand->mvg=(
char *) NULL;
6803 wand->pattern_id=(
char *) NULL;
6804 wand->pattern_offset=0;
6805 wand->pattern_bounds.x=0;
6806 wand->pattern_bounds.y=0;
6807 wand->pattern_bounds.width=0;
6808 wand->pattern_bounds.height=0;
6810 wand->graphic_context=(DrawInfo **) AcquireMagickMemory(
sizeof(
6811 *wand->graphic_context));
6812 if (wand->graphic_context == (DrawInfo **) NULL)
6813 ThrowWandFatalException(ResourceLimitFatalError,
"MemoryAllocationFailed",
6815 wand->filter_off=MagickTrue;
6816 wand->indent_depth=0;
6817 wand->path_operation=PathDefaultOperation;
6818 wand->path_mode=DefaultPathMode;
6819 wand->exception=AcquireExceptionInfo();
6820 wand->image=AcquireImage((
const ImageInfo *) NULL,wand->exception);
6821 wand->destroy=MagickTrue;
6822 wand->debug=IsEventLogging();
6823 wand->signature=MagickWandSignature;
6824 CurrentContext=CloneDrawInfo((ImageInfo *) NULL,(DrawInfo *) NULL);
6850WandExport DrawInfo *PeekDrawingWand(
const DrawingWand *wand)
6855 assert(wand != (
const DrawingWand *) NULL);
6856 assert(wand->signature == MagickWandSignature);
6857 if (wand->debug != MagickFalse)
6858 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
6859 draw_info=CloneDrawInfo((ImageInfo *) NULL,CurrentContext);
6860 (void) CloneString(&draw_info->primitive,wand->mvg);
6889WandExport MagickBooleanType PopDrawingWand(DrawingWand *wand)
6891 assert(wand != (DrawingWand *) NULL);
6892 assert(wand->signature == MagickWandSignature);
6893 if (wand->debug != MagickFalse)
6894 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
6895 if (wand->index == 0)
6897 ThrowDrawException(DrawError,
"UnbalancedGraphicContextPushPop",wand->name)
6898 return(MagickFalse);
6903#if DRAW_BINARY_IMPLEMENTATION
6904 if (wand->image == (Image *) NULL)
6906 ThrowDrawException(WandError,
"ContainsNoImages",wand->name);
6907 return(MagickFalse);
6909 if (CurrentContext->clip_mask != (
char *) NULL)
6910 if (LocaleCompare(CurrentContext->clip_mask,
6911 wand->graphic_context[wand->index-1]->clip_mask) != 0)
6912 (
void) SetImageMask(wand->image,WritePixelMask,(Image *) NULL,
6915 CurrentContext=DestroyDrawInfo(CurrentContext);
6917 if (wand->indent_depth > 0)
6918 wand->indent_depth--;
6919 (
void) MVGPrintf(wand,
"pop graphic-context\n");
6948WandExport MagickBooleanType PushDrawingWand(DrawingWand *wand)
6950 assert(wand != (DrawingWand *) NULL);
6951 assert(wand->signature == MagickWandSignature);
6952 if (wand->debug != MagickFalse)
6953 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
6955 wand->graphic_context=(DrawInfo **) ResizeQuantumMemory(wand->graphic_context,
6956 (
size_t) wand->index+1UL,
sizeof(*wand->graphic_context));
6957 if (wand->graphic_context == (DrawInfo **) NULL)
6960 ThrowDrawException(ResourceLimitError,
"MemoryAllocationFailed",
6962 return(MagickFalse);
6964 CurrentContext=CloneDrawInfo((ImageInfo *) NULL,
6965 wand->graphic_context[wand->index-1]);
6966 (void) MVGPrintf(wand,
"push graphic-context\n");
6967 wand->indent_depth++;