2 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6 % DDDD RRRR AAA W W IIIII N N GGGG %
7 % D D R R A A W W I NN N G %
8 % D D RRRR AAAAA W W I N N N G GG %
9 % D D R R A A W W W I N NN G G %
10 % DDDD R R A A W W IIIII N N GGG %
14 % W W W AAAAA N N N D D %
15 % WW WW A A N NN D D %
19 % MagickWand Image Vector Drawing Methods %
26 % Copyright 1999-2018 ImageMagick Studio LLC, a non-profit organization %
27 % dedicated to making software imaging solutions freely available. %
29 % You may not use this file except in compliance with the License. You may %
30 % obtain a copy of the License at %
32 % https://www.imagemagick.org/script/license.php %
34 % Unless required by applicable law or agreed to in writing, software %
35 % distributed under the License is distributed on an "AS IS" BASIS, %
36 % WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. %
37 % See the License for the specific language governing permissions and %
38 % limitations under the License. %
40 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
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/string-private.h"
58 #define DRAW_BINARY_IMPLEMENTATION 0
60 #define CurrentContext (wand->graphic_context[wand->index])
61 #define DrawingWandId "DrawingWand"
62 #define ThrowDrawException(severity,tag,reason) (void) ThrowMagickException( \
63 wand->exception,GetMagickModule(),severity,tag,"`%s'",reason);
71 PathCloseOperation, /* Z|z (none) */
72 PathCurveToOperation, /* C|c (x1 y1 x2 y2 x y)+ */
73 PathCurveToQuadraticBezierOperation, /* Q|q (x1 y1 x y)+ */
74 PathCurveToQuadraticBezierSmoothOperation, /* T|t (x y)+ */
75 PathCurveToSmoothOperation, /* S|s (x2 y2 x y)+ */
76 PathEllipticArcOperation, /* A|a (rx ry x-axis-rotation large-arc-flag sweep-flag x y)+ */
77 PathLineToHorizontalOperation, /* H|h x+ */
78 PathLineToOperation, /* L|l (x y)+ */
79 PathLineToVerticalOperation, /* V|v y+ */
80 PathMoveToOperation /* M|m (x y)+ */
96 name[MagickPathExtent];
98 /* Support structures */
105 /* MVG output string and housekeeping */
110 mvg_alloc, /* total allocated memory */
111 mvg_length; /* total MVG length */
114 mvg_width; /* current line width */
116 /* Pattern support */
128 index; /* array index */
134 filter_off; /* true if not filtering attributes */
136 /* Pretty-printing depth */
138 indent_depth; /* number of left-hand pad characters */
140 /* Path operation support */
156 Forward declarations.
159 MVGPrintf(DrawingWand *,const char *,...) wand_attribute((format
161 MVGAutoWrapPrintf(DrawingWand *,const char *,...) wand_attribute((format
165 MVGAppendColor(DrawingWand *,const PixelInfo *);
168 "Printf" for MVG commands
170 static int MVGPrintf(DrawingWand *wand,const char *format,...)
175 if (wand->debug != MagickFalse)
176 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",format);
177 assert(wand != (DrawingWand *) NULL);
178 assert(wand->signature == MagickWandSignature);
179 extent=20UL*MagickPathExtent;
180 if (wand->mvg == (char *) NULL)
182 wand->mvg=(char *) AcquireQuantumMemory(extent,sizeof(*wand->mvg));
183 if (wand->mvg == (char *) NULL)
185 ThrowDrawException(ResourceLimitError,"MemoryAllocationFailed",
189 wand->mvg_alloc=extent;
192 if (wand->mvg_alloc < (wand->mvg_length+10*MagickPathExtent))
194 extent+=wand->mvg_alloc;
195 wand->mvg=(char *) ResizeQuantumMemory(wand->mvg,extent,
197 if (wand->mvg == (char *) NULL)
199 ThrowDrawException(ResourceLimitError,"MemoryAllocationFailed",
203 wand->mvg_alloc=extent;
215 while (wand->mvg_width < wand->indent_depth)
217 wand->mvg[wand->mvg_length]=' ';
221 wand->mvg[wand->mvg_length]='\0';
223 offset=(ssize_t) wand->mvg_alloc-wand->mvg_length-1;
226 va_start(argp,format);
227 #if defined(MAGICKCORE_HAVE_VSNPRINTF)
228 count=vsnprintf(wand->mvg+wand->mvg_length,(size_t) offset,format,argp);
230 count=vsprintf(wand->mvg+wand->mvg_length,format,argp);
234 if ((count < 0) || (count > (int) offset))
235 ThrowDrawException(DrawError,"UnableToPrint",format)
238 wand->mvg_length+=count;
239 wand->mvg_width+=count;
241 wand->mvg[wand->mvg_length]='\0';
242 if ((wand->mvg_length > 1) && (wand->mvg[wand->mvg_length-1] == '\n'))
244 assert((wand->mvg_length+1) < wand->mvg_alloc);
249 static int MVGAutoWrapPrintf(DrawingWand *wand,const char *format,...)
252 buffer[MagickPathExtent];
260 va_start(argp,format);
261 #if defined(MAGICKCORE_HAVE_VSNPRINTF)
262 count=vsnprintf(buffer,sizeof(buffer)-1,format,argp);
264 count=vsprintf(buffer,format,argp);
267 buffer[sizeof(buffer)-1]='\0';
269 ThrowDrawException(DrawError,"UnableToPrint",format)
272 if (((wand->mvg_width + count) > 78) && (buffer[count-1] != '\n'))
273 (void) MVGPrintf(wand, "\n");
274 (void) MVGPrintf(wand,"%s",buffer);
279 static void MVGAppendColor(DrawingWand *wand,const PixelInfo *packet)
281 if ((packet->red == 0) && (packet->green == 0) && (packet->blue == 0) &&
282 (packet->alpha == (Quantum) TransparentAlpha))
283 (void) MVGPrintf(wand,"none");
287 tuple[MagickPathExtent];
292 GetPixelInfo(wand->image,&pixel);
293 pixel.colorspace=sRGBColorspace;
294 pixel.alpha_trait=packet->alpha != OpaqueAlpha ? BlendPixelTrait :
296 pixel.red=(double) packet->red;
297 pixel.green=(double) packet->green;
298 pixel.blue=(double) packet->blue;
299 pixel.alpha=(double) packet->alpha;
300 GetColorTuple(&pixel,MagickTrue,tuple);
301 (void) MVGPrintf(wand,"%s",tuple);
305 static void MVGAppendPointsCommand(DrawingWand *wand,const char *command,
306 const size_t number_coordinates,const PointInfo *coordinates)
314 (void) MVGPrintf(wand,"%s",command);
315 for (i=number_coordinates, coordinate=coordinates; i != 0; i--)
317 (void) MVGAutoWrapPrintf(wand," %.20g %.20g",coordinate->x,coordinate->y);
320 (void) MVGPrintf(wand, "\n");
323 static void AdjustAffine(DrawingWand *wand,const AffineMatrix *affine)
325 assert(wand != (DrawingWand *) NULL);
326 assert(wand->signature == MagickWandSignature);
327 if (wand->debug != MagickFalse)
328 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
329 if ((affine->sx != 1.0) || (affine->rx != 0.0) || (affine->ry != 0.0) ||
330 (affine->sy != 1.0) || (affine->tx != 0.0) || (affine->ty != 0.0))
335 current=CurrentContext->affine;
336 CurrentContext->affine.sx=affine->sx*current.sx+affine->ry*current.rx;
337 CurrentContext->affine.rx=affine->rx*current.sx+affine->sy*current.rx;
338 CurrentContext->affine.ry=affine->sx*current.ry+affine->ry*current.sy;
339 CurrentContext->affine.sy=affine->rx*current.ry+affine->sy*current.sy;
340 CurrentContext->affine.tx=affine->sx*current.tx+affine->ry*current.ty+
342 CurrentContext->affine.ty=affine->rx*current.tx+affine->sy*current.ty+
348 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
352 + A c q u i r e D r a w i n g W a n d %
356 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
358 % AcquireDrawingWand() allocates an initial drawing wand which is an opaque
359 % handle required by the remaining drawing methods.
361 % The format of the AcquireDrawingWand method is:
363 % DrawingWand AcquireDrawingWand(const DrawInfo *draw_info,Image *image)
365 % A description of each parameter follows:
367 % o draw_info: Initial drawing defaults. Set to NULL to use defaults.
369 % o image: the image to draw on.
372 WandExport DrawingWand *AcquireDrawingWand(const DrawInfo *draw_info,
378 wand=NewDrawingWand();
379 if (draw_info != (const DrawInfo *) NULL)
381 CurrentContext=DestroyDrawInfo(CurrentContext);
382 CurrentContext=CloneDrawInfo((ImageInfo *) NULL,draw_info);
384 if (image != (Image *) NULL)
386 wand->image=DestroyImage(wand->image);
387 wand->destroy=MagickFalse;
394 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
398 % C l e a r D r a w i n g W a n d %
402 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
404 % ClearDrawingWand() clears resources associated with the drawing wand.
406 % The format of the ClearDrawingWand method is:
408 % void ClearDrawingWand(DrawingWand *wand)
410 % A description of each parameter follows:
412 % o wand: the drawing wand to clear.
415 WandExport void ClearDrawingWand(DrawingWand *wand)
417 assert(wand != (DrawingWand *) NULL);
418 assert(wand->signature == MagickWandSignature);
419 if (wand->debug != MagickFalse)
420 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
421 for ( ; wand->index > 0; wand->index--)
422 CurrentContext=DestroyDrawInfo(CurrentContext);
423 CurrentContext=DestroyDrawInfo(CurrentContext);
424 wand->graphic_context=(DrawInfo **) RelinquishMagickMemory(
425 wand->graphic_context);
426 if (wand->pattern_id != (char *) NULL)
427 wand->pattern_id=DestroyString(wand->pattern_id);
428 wand->mvg=DestroyString(wand->mvg);
429 if ((wand->destroy != MagickFalse) && (wand->image != (Image *) NULL))
430 wand->image=DestroyImage(wand->image);
432 wand->image=(Image *) NULL;
433 wand->mvg=(char *) NULL;
437 wand->pattern_id=(char *) NULL;
438 wand->pattern_offset=0;
439 wand->pattern_bounds.x=0;
440 wand->pattern_bounds.y=0;
441 wand->pattern_bounds.width=0;
442 wand->pattern_bounds.height=0;
444 wand->graphic_context=(DrawInfo **) AcquireMagickMemory(
445 sizeof(*wand->graphic_context));
446 if (wand->graphic_context == (DrawInfo **) NULL)
448 ThrowDrawException(ResourceLimitError,"MemoryAllocationFailed",
452 CurrentContext=CloneDrawInfo((ImageInfo *) NULL,(DrawInfo *) NULL);
453 wand->filter_off=MagickTrue;
454 wand->indent_depth=0;
455 wand->path_operation=PathDefaultOperation;
456 wand->path_mode=DefaultPathMode;
457 wand->image=AcquireImage((const ImageInfo *) NULL,wand->exception);
458 ClearMagickException(wand->exception);
459 wand->destroy=MagickTrue;
460 wand->debug=IsEventLogging();
464 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
468 % C l o n e D r a w i n g W a n d %
472 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
474 % CloneDrawingWand() makes an exact copy of the specified wand.
476 % The format of the CloneDrawingWand method is:
478 % DrawingWand *CloneDrawingWand(const DrawingWand *wand)
480 % A description of each parameter follows:
482 % o wand: the magick wand.
485 WandExport DrawingWand *CloneDrawingWand(const DrawingWand *wand)
493 assert(wand != (DrawingWand *) NULL);
494 assert(wand->signature == MagickWandSignature);
495 if (wand->debug != MagickFalse)
496 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
497 clone_wand=(DrawingWand *) AcquireMagickMemory(sizeof(*clone_wand));
498 if (clone_wand == (DrawingWand *) NULL)
499 ThrowWandFatalException(ResourceLimitFatalError,
500 "MemoryAllocationFailed",GetExceptionMessage(errno));
501 (void) memset(clone_wand,0,sizeof(*clone_wand));
502 clone_wand->id=AcquireWandId();
503 (void) FormatLocaleString(clone_wand->name,MagickPathExtent,
504 "DrawingWand-%.20g",(double) clone_wand->id);
505 clone_wand->exception=AcquireExceptionInfo();
506 InheritException(clone_wand->exception,wand->exception);
507 clone_wand->mvg=AcquireString(wand->mvg);
508 clone_wand->mvg_length=strlen(clone_wand->mvg);
509 clone_wand->mvg_alloc=wand->mvg_length+1;
510 clone_wand->mvg_width=wand->mvg_width;
511 clone_wand->pattern_id=AcquireString(wand->pattern_id);
512 clone_wand->pattern_offset=wand->pattern_offset;
513 clone_wand->pattern_bounds=wand->pattern_bounds;
514 clone_wand->index=wand->index;
515 clone_wand->graphic_context=(DrawInfo **) AcquireQuantumMemory((size_t)
516 wand->index+1UL,sizeof(*wand->graphic_context));
517 if (clone_wand->graphic_context == (DrawInfo **) NULL)
518 ThrowWandFatalException(ResourceLimitFatalError,"MemoryAllocationFailed",
519 GetExceptionMessage(errno));
520 for (i=0; i <= (ssize_t) wand->index; i++)
521 clone_wand->graphic_context[i]=CloneDrawInfo((ImageInfo *) NULL,
522 wand->graphic_context[i]);
523 clone_wand->filter_off=wand->filter_off;
524 clone_wand->indent_depth=wand->indent_depth;
525 clone_wand->path_operation=wand->path_operation;
526 clone_wand->path_mode=wand->path_mode;
527 clone_wand->image=wand->image;
528 if (wand->image != (Image *) NULL)
529 clone_wand->image=CloneImage(wand->image,0,0,MagickTrue,
530 clone_wand->exception);
531 clone_wand->destroy=MagickTrue;
532 clone_wand->debug=IsEventLogging();
533 if (clone_wand->debug != MagickFalse)
534 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",clone_wand->name);
535 clone_wand->signature=MagickWandSignature;
540 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
544 % D e s t r o y D r a w i n g W a n d %
548 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
550 % DestroyDrawingWand() frees all resources associated with the drawing wand.
551 % Once the drawing wand has been freed, it should not be used and further
552 % unless it re-allocated.
554 % The format of the DestroyDrawingWand method is:
556 % DrawingWand *DestroyDrawingWand(DrawingWand *wand)
558 % A description of each parameter follows:
560 % o wand: the drawing wand to destroy.
563 WandExport DrawingWand *DestroyDrawingWand(DrawingWand *wand)
565 assert(wand != (DrawingWand *) NULL);
566 assert(wand->signature == MagickWandSignature);
567 if (wand->debug != MagickFalse)
568 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
569 for ( ; wand->index > 0; wand->index--)
570 CurrentContext=DestroyDrawInfo(CurrentContext);
571 CurrentContext=DestroyDrawInfo(CurrentContext);
572 wand->graphic_context=(DrawInfo **) RelinquishMagickMemory(
573 wand->graphic_context);
574 if (wand->pattern_id != (char *) NULL)
575 wand->pattern_id=DestroyString(wand->pattern_id);
576 wand->mvg=DestroyString(wand->mvg);
577 if ((wand->destroy != MagickFalse) && (wand->image != (Image *) NULL))
578 wand->image=DestroyImage(wand->image);
579 wand->image=(Image *) NULL;
580 wand->exception=DestroyExceptionInfo(wand->exception);
581 wand->signature=(~MagickWandSignature);
582 RelinquishWandId(wand->id);
583 wand=(DrawingWand *) RelinquishMagickMemory(wand);
588 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
592 % D r a w A f f i n e %
596 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
598 % DrawAffine() adjusts the current affine transformation matrix with
599 % the specified affine transformation matrix. Note that the current affine
600 % transform is adjusted rather than replaced.
602 % The format of the DrawAffine method is:
604 % void DrawAffine(DrawingWand *wand,const AffineMatrix *affine)
606 % A description of each parameter follows:
608 % o wand: Drawing wand
610 % o affine: Affine matrix parameters
613 WandExport void DrawAffine(DrawingWand *wand,const AffineMatrix *affine)
615 assert(wand != (DrawingWand *) NULL);
616 assert(wand->signature == MagickWandSignature);
617 if (wand->debug != MagickFalse)
618 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
619 assert(affine != (const AffineMatrix *) NULL);
620 AdjustAffine(wand,affine);
621 (void) MVGPrintf(wand,"affine %.20g %.20g %.20g %.20g %.20g %.20g\n",
622 affine->sx,affine->rx,affine->ry,affine->sy,affine->tx,affine->ty);
626 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
630 % D r a w A l p h a %
634 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
636 % DrawAlpha() paints on the image's alpha channel in order to set effected
637 % pixels to transparent. The available paint methods are:
639 % PointMethod: Select the target pixel
640 % ReplaceMethod: Select any pixel that matches the target pixel.
641 % FloodfillMethod: Select the target pixel and matching neighbors.
642 % FillToBorderMethod: Select the target pixel and neighbors not matching
644 % ResetMethod: Select all pixels.
646 % The format of the DrawAlpha method is:
648 % void DrawAlpha(DrawingWand *wand,const double x,const double y,
649 % const PaintMethod paint_method)
651 % A description of each parameter follows:
653 % o wand: the drawing wand.
659 % o paint_method: paint method.
662 WandExport void DrawAlpha(DrawingWand *wand,const double x,const double y,
663 const PaintMethod paint_method)
665 assert(wand != (DrawingWand *) NULL);
666 assert(wand->signature == MagickWandSignature);
667 if (wand->debug != MagickFalse)
668 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
669 (void) MVGPrintf(wand,"alpha %.20g %.20g '%s'\n",x,y,CommandOptionToMnemonic(
670 MagickMethodOptions,(ssize_t) paint_method));
674 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
678 % D r a w A n n o t a t i o n %
682 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
684 % DrawAnnotation() draws text on the image.
686 % The format of the DrawAnnotation method is:
688 % void DrawAnnotation(DrawingWand *wand,const double x,
689 % const double y,const unsigned char *text)
691 % A description of each parameter follows:
693 % o wand: the drawing wand.
695 % o x: x ordinate to left of text
697 % o y: y ordinate to text baseline
699 % o text: text to draw
702 WandExport void DrawAnnotation(DrawingWand *wand,const double x,const double y,
703 const unsigned char *text)
708 assert(wand != (DrawingWand *) NULL);
709 assert(wand->signature == MagickWandSignature);
710 if (wand->debug != MagickFalse)
711 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
712 assert(text != (const unsigned char *) NULL);
713 escaped_text=EscapeString((const char *) text,'\'');
714 if (escaped_text != (char *) NULL)
716 (void) MVGPrintf(wand,"text %.20g %.20g '%s'\n",x,y,escaped_text);
717 escaped_text=DestroyString(escaped_text);
722 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
730 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
732 % DrawArc() draws an arc falling within a specified bounding rectangle on the
735 % The format of the DrawArc method is:
737 % void DrawArc(DrawingWand *wand,const double sx,const double sy,
738 % const double ex,const double ey,const double sd,const double ed)
740 % A description of each parameter follows:
742 % o wand: the drawing wand.
744 % o sx: starting x ordinate of bounding rectangle
746 % o sy: starting y ordinate of bounding rectangle
748 % o ex: ending x ordinate of bounding rectangle
750 % o ey: ending y ordinate of bounding rectangle
752 % o sd: starting degrees of rotation
754 % o ed: ending degrees of rotation
757 WandExport void DrawArc(DrawingWand *wand,const double sx,const double sy,
758 const double ex,const double ey,const double sd,const double ed)
760 assert(wand != (DrawingWand *) NULL);
761 assert(wand->signature == MagickWandSignature);
762 if (wand->debug != MagickFalse)
763 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
764 (void) MVGPrintf(wand,"arc %.20g %.20g %.20g %.20g %.20g %.20g\n",sx,sy,ex,
769 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
773 % D r a w B e z i e r %
777 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
779 % DrawBezier() draws a bezier curve through a set of points on the image.
781 % The format of the DrawBezier method is:
783 % void DrawBezier(DrawingWand *wand,
784 % const size_t number_coordinates,const PointInfo *coordinates)
786 % A description of each parameter follows:
788 % o wand: the drawing wand.
790 % o number_coordinates: number of coordinates
792 % o coordinates: coordinates
795 WandExport void DrawBezier(DrawingWand *wand,
796 const size_t number_coordinates,const PointInfo *coordinates)
798 assert(wand != (DrawingWand *) NULL);
799 assert(wand->signature == MagickWandSignature);
800 if (wand->debug != MagickFalse)
801 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
802 assert(coordinates != (const PointInfo *) NULL);
803 MVGAppendPointsCommand(wand,"bezier",number_coordinates,coordinates);
807 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
811 % D r a w C i r c l e %
815 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
817 % DrawCircle() draws a circle on the image.
819 % The format of the DrawCircle method is:
821 % void DrawCircle(DrawingWand *wand,const double ox,
822 % const double oy,const double px, const double py)
824 % A description of each parameter follows:
826 % o wand: the drawing wand.
828 % o ox: origin x ordinate
830 % o oy: origin y ordinate
832 % o px: perimeter x ordinate
834 % o py: perimeter y ordinate
837 WandExport void DrawCircle(DrawingWand *wand,const double ox,const double oy,
838 const double px,const double py)
840 assert(wand != (DrawingWand *) NULL);
841 assert(wand->signature == MagickWandSignature);
842 if (wand->debug != MagickFalse)
843 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
844 (void) MVGPrintf(wand,"circle %.20g %.20g %.20g %.20g\n",ox,oy,px,py);
848 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
852 % D r a w C l e a r E x c e p t i o n %
856 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
858 % DrawClearException() clear any exceptions associated with the wand.
860 % The format of the DrawClearException method is:
862 % MagickBooleanType DrawClearException(DrawWand *wand)
864 % A description of each parameter follows:
866 % o wand: the drawing wand.
869 WandExport MagickBooleanType DrawClearException(DrawingWand *wand)
871 assert(wand != (DrawingWand *) NULL);
872 assert(wand->signature == MagickWandSignature);
873 if (wand->debug != MagickFalse)
874 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
875 ClearMagickException(wand->exception);
880 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
884 % D r a w C l o n e E x c e p t i o n I n f o %
888 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
890 % DrawCloneExceptionInfo() clones the ExceptionInfo structure within the wand.
892 % The format of the DrawCloneExceptionInfo method is:
894 % ExceptionInfo *DrawCloneExceptionInfo(DrawWand *wand)
896 % A description of each parameter follows:
898 % o wand: the drawing wand.
901 WandExport ExceptionInfo *DrawCloneExceptionInfo(const DrawingWand *wand)
903 assert(wand != (DrawingWand *) NULL);
904 assert(wand->signature == MagickWandSignature);
905 if (wand->exception == (ExceptionInfo*) NULL)
906 return (ExceptionInfo*) NULL;
907 return CloneExceptionInfo(wand->exception);
911 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
915 % D r a w C o l o r %
919 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
921 % DrawColor() draws color on image using the current fill color, starting at
922 % specified position, and using specified paint method. The available paint
925 % PointMethod: Recolors the target pixel
926 % ReplaceMethod: Recolor any pixel that matches the target pixel.
927 % FloodfillMethod: Recolors target pixels and matching neighbors.
928 % ResetMethod: Recolor all pixels.
930 % The format of the DrawColor method is:
932 % void DrawColor(DrawingWand *wand,const double x,const double y,
933 % const PaintMethod paint_method)
935 % A description of each parameter follows:
937 % o wand: the drawing wand.
943 % o paint_method: paint method.
946 WandExport void DrawColor(DrawingWand *wand, const double x, const double y,
947 const PaintMethod paint_method)
949 assert(wand != (DrawingWand *)NULL);
950 assert(wand->signature == MagickWandSignature);
951 if (wand->debug != MagickFalse)
952 (void) LogMagickEvent(WandEvent, GetMagickModule(), "%s", wand->name);
953 (void) MVGPrintf(wand, "color %.20g %.20g '%s'\n",x,y,CommandOptionToMnemonic(
954 MagickMethodOptions,(ssize_t) paint_method));
958 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
962 % D r a w C o m p o s i t e %
966 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
968 % DrawComposite() composites an image onto the current image, using the
969 % specified composition operator, specified position, and at the specified
972 % The format of the DrawComposite method is:
974 % MagickBooleanType DrawComposite(DrawingWand *wand,
975 % const CompositeOperator compose,const double x,
976 % const double y,const double width,const double height,
977 % MagickWand *magick_wand)
979 % A description of each parameter follows:
981 % o wand: the drawing wand.
983 % o compose: composition operator
985 % o x: x ordinate of top left corner
987 % o y: y ordinate of top left corner
989 % o width: Width to resize image to prior to compositing. Specify zero to
990 % use existing width.
992 % o height: Height to resize image to prior to compositing. Specify zero
993 % to use existing height.
995 % o magick_wand: Image to composite is obtained from this wand.
998 WandExport MagickBooleanType DrawComposite(DrawingWand *wand,
999 const CompositeOperator compose,const double x,const double y,
1000 const double width,const double height,MagickWand *magick_wand)
1029 assert(wand != (DrawingWand *) NULL);
1030 assert(wand->signature == MagickWandSignature);
1031 if (wand->debug != MagickFalse)
1032 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1033 assert(magick_wand != (MagickWand *) NULL);
1034 image=GetImageFromMagickWand(magick_wand);
1035 if (image == (Image *) NULL)
1036 return(MagickFalse);
1037 clone_image=CloneImage(image,0,0,MagickTrue,wand->exception);
1038 if (clone_image == (Image *) NULL)
1039 return(MagickFalse);
1040 image_info=AcquireImageInfo();
1041 (void) CopyMagickString(image_info->magick,"MIFF",MagickPathExtent);
1043 blob=(unsigned char *) ImageToBlob(image_info,clone_image,&blob_length,
1045 image_info=DestroyImageInfo(image_info);
1046 clone_image=DestroyImageList(clone_image);
1047 if (blob == (void *) NULL)
1048 return(MagickFalse);
1050 base64=Base64Encode(blob,blob_length,&encoded_length);
1051 blob=(unsigned char *) RelinquishMagickMemory(blob);
1052 if (base64 == (char *) NULL)
1055 buffer[MagickPathExtent];
1057 (void) FormatLocaleString(buffer,MagickPathExtent,"%.20g bytes",(double)
1058 (4L*blob_length/3L+4L));
1059 ThrowDrawException(ResourceLimitWarning,"MemoryAllocationFailed",
1061 return(MagickFalse);
1063 mode=CommandOptionToMnemonic(MagickComposeOptions,(ssize_t) compose);
1064 media_type=MagickToMime(image->magick);
1065 (void) MVGPrintf(wand,"image %s %.20g %.20g %.20g %.20g 'data:%s;base64,\n",
1066 mode,x,y,width,height,media_type);
1068 for (i=(ssize_t) encoded_length; i > 0; i-=76)
1070 (void) MVGPrintf(wand,"%.76s",p);
1073 (void) MVGPrintf(wand,"\n");
1075 (void) MVGPrintf(wand,"'\n");
1076 media_type=DestroyString(media_type);
1077 base64=DestroyString(base64);
1082 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1086 % D r a w C o m m e n t %
1090 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1092 % DrawComment() adds a comment to a vector output stream.
1094 % The format of the DrawComment method is:
1096 % void DrawComment(DrawingWand *wand,const char *comment)
1098 % A description of each parameter follows:
1100 % o wand: the drawing wand.
1102 % o comment: comment text
1105 WandExport void DrawComment(DrawingWand *wand,const char *comment)
1107 (void) MVGPrintf(wand,"#%s\n",comment);
1111 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1115 % D r a w E l l i p s e %
1119 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1121 % DrawEllipse() draws an ellipse on the image.
1123 % The format of the DrawEllipse method is:
1125 % void DrawEllipse(DrawingWand *wand,const double ox,const double oy,
1126 % const double rx,const double ry,const double start,const double end)
1128 % A description of each parameter follows:
1130 % o wand: the drawing wand.
1132 % o ox: origin x ordinate
1134 % o oy: origin y ordinate
1140 % o start: starting rotation in degrees
1142 % o end: ending rotation in degrees
1145 WandExport void DrawEllipse(DrawingWand *wand,const double ox,const double oy,
1146 const double rx,const double ry,const double start,const double end)
1148 assert(wand != (DrawingWand *) NULL);
1149 assert(wand->signature == MagickWandSignature);
1150 if (wand->debug != MagickFalse)
1151 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1152 (void) MVGPrintf(wand,"ellipse %.20g %.20g %.20g %.20g %.20g %.20g\n",ox,oy,
1157 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1161 % D r a w G e t B o r d e r C o l o r %
1165 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1167 % DrawGetBorderColor() returns the border color used for drawing bordered
1170 % The format of the DrawGetBorderColor method is:
1172 % void DrawGetBorderColor(const DrawingWand *wand,
1173 % PixelWand *border_color)
1175 % A description of each parameter follows:
1177 % o wand: the drawing wand.
1179 % o border_color: Return the border color.
1182 WandExport void DrawGetBorderColor(const DrawingWand *wand,
1183 PixelWand *border_color)
1185 assert(wand != (const DrawingWand *) NULL);
1186 assert(wand->signature == MagickWandSignature);
1187 assert(border_color != (PixelWand *) NULL);
1188 if (wand->debug != MagickFalse)
1189 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1190 PixelSetPixelColor(border_color,&CurrentContext->border_color);
1194 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1198 % D r a w G e t C l i p P a t h %
1202 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1204 % DrawGetClipPath() obtains the current clipping path ID. The value returned
1205 % must be deallocated by the user when it is no longer needed.
1207 % The format of the DrawGetClipPath method is:
1209 % char *DrawGetClipPath(const DrawingWand *wand)
1211 % A description of each parameter follows:
1213 % o wand: the drawing wand.
1216 WandExport char *DrawGetClipPath(const DrawingWand *wand)
1218 assert(wand != (const DrawingWand *) NULL);
1219 assert(wand->signature == MagickWandSignature);
1220 if (wand->debug != MagickFalse)
1221 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1222 if (CurrentContext->clip_mask != (char *) NULL)
1223 return((char *) AcquireString(CurrentContext->clip_mask));
1224 return((char *) NULL);
1228 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1232 % D r a w G e t C l i p R u l e %
1236 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1238 % DrawGetClipRule() returns the current polygon fill rule to be used by the
1241 % The format of the DrawGetClipRule method is:
1243 % FillRule DrawGetClipRule(const DrawingWand *wand)
1245 % A description of each parameter follows:
1247 % o wand: the drawing wand.
1250 WandExport FillRule DrawGetClipRule(const DrawingWand *wand)
1252 assert(wand != (const DrawingWand *) NULL);
1253 assert(wand->signature == MagickWandSignature);
1254 if (wand->debug != MagickFalse)
1255 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1256 return(CurrentContext->fill_rule);
1260 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1264 % D r a w G e t C l i p U n i t s %
1268 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1270 % DrawGetClipUnits() returns the interpretation of clip path units.
1272 % The format of the DrawGetClipUnits method is:
1274 % ClipPathUnits DrawGetClipUnits(const DrawingWand *wand)
1276 % A description of each parameter follows:
1278 % o wand: the drawing wand.
1281 WandExport ClipPathUnits DrawGetClipUnits(const DrawingWand *wand)
1283 assert(wand != (const DrawingWand *) NULL);
1284 assert(wand->signature == MagickWandSignature);
1285 if (wand->debug != MagickFalse)
1286 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1287 return(CurrentContext->clip_units);
1291 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1295 % D r a w G e t D e n s i t y %
1299 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1301 % DrawGetDensity() obtains the vertical and horizontal resolution. The value
1302 % returned must be deallocated by the user when it is no longer needed.
1304 % The format of the DrawGetDensity method is:
1306 % char *DrawGetDensity(const DrawingWand *wand)
1308 % A description of each parameter follows:
1310 % o wand: the drawing wand.
1313 WandExport char *DrawGetDensity(const DrawingWand *wand)
1315 assert(wand != (const DrawingWand *) NULL);
1316 assert(wand->signature == MagickWandSignature);
1317 if (wand->debug != MagickFalse)
1318 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1319 if (CurrentContext->density != (char *) NULL)
1320 return((char *) AcquireString(CurrentContext->density));
1321 return((char *) NULL);
1325 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1329 % D r a w G e t E x c e p t i o n %
1333 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1335 % DrawGetException() returns the severity, reason, and description of any
1336 % error that occurs when using other methods in this API.
1338 % The format of the DrawGetException method is:
1340 % char *DrawGetException(const DrawWand *wand,
1341 % ExceptionType *severity)
1343 % A description of each parameter follows:
1345 % o wand: the drawing wand.
1347 % o severity: the severity of the error is returned here.
1350 WandExport char *DrawGetException(const DrawingWand *wand,
1351 ExceptionType *severity)
1356 assert(wand != (const DrawingWand *) NULL);
1357 assert(wand->signature == MagickWandSignature);
1358 if (wand->debug != MagickFalse)
1359 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1360 assert(severity != (ExceptionType *) NULL);
1361 *severity=wand->exception->severity;
1362 description=(char *) AcquireQuantumMemory(2UL*MagickPathExtent,
1363 sizeof(*description));
1364 if (description == (char *) NULL)
1365 ThrowWandFatalException(ResourceLimitFatalError,"MemoryAllocationFailed",
1368 if (wand->exception->reason != (char *) NULL)
1369 (void) CopyMagickString(description,GetLocaleExceptionMessage(
1370 wand->exception->severity,wand->exception->reason),
1372 if (wand->exception->description != (char *) NULL)
1374 (void) ConcatenateMagickString(description," (",MagickPathExtent);
1375 (void) ConcatenateMagickString(description,GetLocaleExceptionMessage(
1376 wand->exception->severity,wand->exception->description),
1378 (void) ConcatenateMagickString(description,")",MagickPathExtent);
1380 return(description);
1384 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1388 % P i x e l G e t E x c e p t i o n T y p e %
1392 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1394 % DrawGetExceptionType() the exception type associated with the wand. If
1395 % no exception has occurred, UndefinedExceptionType is returned.
1397 % The format of the DrawGetExceptionType method is:
1399 % ExceptionType DrawGetExceptionType(const DrawWand *wand)
1401 % A description of each parameter follows:
1403 % o wand: the magick wand.
1406 WandExport ExceptionType DrawGetExceptionType(const DrawingWand *wand)
1408 assert(wand != (const DrawingWand *) NULL);
1409 assert(wand->signature == MagickWandSignature);
1410 if (wand->debug != MagickFalse)
1411 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1412 return(wand->exception->severity);
1416 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1420 % D r a w G e t F i l l C o l o r %
1424 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1426 % DrawGetFillColor() returns the fill color used for drawing filled objects.
1428 % The format of the DrawGetFillColor method is:
1430 % void DrawGetFillColor(const DrawingWand *wand,
1431 % PixelWand *fill_color)
1433 % A description of each parameter follows:
1435 % o wand: the drawing wand.
1437 % o fill_color: Return the fill color.
1440 WandExport void DrawGetFillColor(const DrawingWand *wand,PixelWand *fill_color)
1442 assert(wand != (const DrawingWand *) NULL);
1443 assert(wand->signature == MagickWandSignature);
1444 assert(fill_color != (PixelWand *) NULL);
1445 if (wand->debug != MagickFalse)
1446 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1447 PixelSetPixelColor(fill_color,&CurrentContext->fill);
1451 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1455 % D r a w G e t F i l l O p a c i t y %
1459 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1461 % DrawGetFillOpacity() returns the alpha used when drawing using the fill
1462 % color or fill texture. Fully opaque is 1.0.
1464 % The format of the DrawGetFillOpacity method is:
1466 % double DrawGetFillOpacity(const DrawingWand *wand)
1468 % A description of each parameter follows:
1470 % o wand: the drawing wand.
1473 WandExport double DrawGetFillOpacity(const DrawingWand *wand)
1478 assert(wand != (const DrawingWand *) NULL);
1479 assert(wand->signature == MagickWandSignature);
1480 if (wand->debug != MagickFalse)
1481 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1482 alpha=(double) QuantumScale*CurrentContext->fill.alpha;
1487 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1491 % D r a w G e t F i l l R u l e %
1495 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1497 % DrawGetFillRule() returns the fill rule used while drawing polygons.
1499 % The format of the DrawGetFillRule method is:
1501 % FillRule DrawGetFillRule(const DrawingWand *wand)
1503 % A description of each parameter follows:
1505 % o wand: the drawing wand.
1508 WandExport FillRule DrawGetFillRule(const DrawingWand *wand)
1510 assert(wand != (const DrawingWand *) NULL);
1511 assert(wand->signature == MagickWandSignature);
1512 if (wand->debug != MagickFalse)
1513 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1514 return(CurrentContext->fill_rule);
1518 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1522 % D r a w G e t F o n t %
1526 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1528 % DrawGetFont() returns a null-terminaged string specifying the font used
1529 % when annotating with text. The value returned must be freed by the user
1530 % when no longer needed.
1532 % The format of the DrawGetFont method is:
1534 % char *DrawGetFont(const DrawingWand *wand)
1536 % A description of each parameter follows:
1538 % o wand: the drawing wand.
1541 WandExport char *DrawGetFont(const DrawingWand *wand)
1543 assert(wand != (const DrawingWand *) NULL);
1544 assert(wand->signature == MagickWandSignature);
1545 if (wand->debug != MagickFalse)
1546 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1547 if (CurrentContext->font != (char *) NULL)
1548 return(AcquireString(CurrentContext->font));
1549 return((char *) NULL);
1553 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1557 % D r a w G e t F o n t F a m i l y %
1561 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1563 % DrawGetFontFamily() returns the font family to use when annotating with text.
1564 % The value returned must be freed by the user when it is no longer needed.
1566 % The format of the DrawGetFontFamily method is:
1568 % char *DrawGetFontFamily(const DrawingWand *wand)
1570 % A description of each parameter follows:
1572 % o wand: the drawing wand.
1575 WandExport char *DrawGetFontFamily(const DrawingWand *wand)
1577 assert(wand != (const DrawingWand *) NULL);
1578 assert(wand->signature == MagickWandSignature);
1579 if (wand->debug != MagickFalse)
1580 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1581 if (CurrentContext->family != NULL)
1582 return(AcquireString(CurrentContext->family));
1583 return((char *) NULL);
1587 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1591 % D r a w G e t F o n t R e s o l u t i o n %
1595 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1597 % DrawGetFontResolution() gets the image X and Y resolution.
1599 % The format of the DrawGetFontResolution method is:
1601 % MagickBooleanType DrawGetFontResolution(const DrawingWand *wand,
1602 % double *x,double *y)
1604 % A description of each parameter follows:
1606 % o wand: the magick wand.
1608 % o x: the x-resolution.
1610 % o y: the y-resolution.
1613 WandExport MagickBooleanType DrawGetFontResolution(const DrawingWand *wand,
1614 double *x,double *y)
1616 assert(wand != (DrawingWand *) NULL);
1617 assert(wand->signature == MagickWandSignature);
1618 if (wand->debug != MagickFalse)
1619 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1622 if (CurrentContext->density != (char *) NULL)
1630 flags=ParseGeometry(CurrentContext->density,&geometry_info);
1631 *x=geometry_info.rho;
1632 *y=geometry_info.sigma;
1633 if ((flags & SigmaValue) == MagickFalse)
1640 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1644 % D r a w G e t F o n t S i z e %
1648 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1650 % DrawGetFontSize() returns the font pointsize used when annotating with text.
1652 % The format of the DrawGetFontSize method is:
1654 % double DrawGetFontSize(const DrawingWand *wand)
1656 % A description of each parameter follows:
1658 % o wand: the drawing wand.
1661 WandExport double DrawGetFontSize(const DrawingWand *wand)
1663 assert(wand != (const DrawingWand *) NULL);
1664 assert(wand->signature == MagickWandSignature);
1665 if (wand->debug != MagickFalse)
1666 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1667 return(CurrentContext->pointsize);
1671 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1675 % D r a w G e t F o n t S t r e t c h %
1679 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1681 % DrawGetFontStretch() returns the font stretch used when annotating with text.
1683 % The format of the DrawGetFontStretch method is:
1685 % StretchType DrawGetFontStretch(const DrawingWand *wand)
1687 % A description of each parameter follows:
1689 % o wand: the drawing wand.
1692 WandExport StretchType DrawGetFontStretch(const DrawingWand *wand)
1694 assert(wand != (const DrawingWand *) NULL);
1695 assert(wand->signature == MagickWandSignature);
1696 if (wand->debug != MagickFalse)
1697 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1698 return(CurrentContext->stretch);
1702 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1706 % D r a w G e t F o n t S t y l e %
1710 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1712 % DrawGetFontStyle() returns the font style used when annotating with text.
1714 % The format of the DrawGetFontStyle method is:
1716 % StyleType DrawGetFontStyle(const DrawingWand *wand)
1718 % A description of each parameter follows:
1720 % o wand: the drawing wand.
1723 WandExport StyleType DrawGetFontStyle(const DrawingWand *wand)
1725 assert(wand != (const DrawingWand *) NULL);
1726 assert(wand->signature == MagickWandSignature);
1727 if (wand->debug != MagickFalse)
1728 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1729 return(CurrentContext->style);
1733 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1737 % D r a w G e t F o n t W e i g h t %
1741 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1743 % DrawGetFontWeight() returns the font weight used when annotating with text.
1745 % The format of the DrawGetFontWeight method is:
1747 % size_t DrawGetFontWeight(const DrawingWand *wand)
1749 % A description of each parameter follows:
1751 % o wand: the drawing wand.
1754 WandExport size_t DrawGetFontWeight(const DrawingWand *wand)
1756 assert(wand != (const DrawingWand *) NULL);
1757 assert(wand->signature == MagickWandSignature);
1758 if (wand->debug != MagickFalse)
1759 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1760 return(CurrentContext->weight);
1764 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1768 % D r a w G e t G r a v i t y %
1772 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1774 % DrawGetGravity() returns the text placement gravity used when annotating
1777 % The format of the DrawGetGravity method is:
1779 % GravityType DrawGetGravity(const DrawingWand *wand)
1781 % A description of each parameter follows:
1783 % o wand: the drawing wand.
1786 WandExport GravityType DrawGetGravity(const DrawingWand *wand)
1788 assert(wand != (const DrawingWand *) NULL);
1789 assert(wand->signature == MagickWandSignature);
1790 if (wand->debug != MagickFalse)
1791 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1792 return(CurrentContext->gravity);
1796 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1800 % D r a w G e t O p a c i t y %
1804 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1806 % DrawGetOpacity() returns the alpha used when drawing with the fill
1807 % or stroke color or texture. Fully opaque is 1.0.
1809 % The format of the DrawGetOpacity method is:
1811 % double DrawGetOpacity(const DrawingWand *wand)
1813 % A description of each parameter follows:
1815 % o wand: the drawing wand.
1818 WandExport double DrawGetOpacity(const DrawingWand *wand)
1823 assert(wand != (const DrawingWand *) NULL);
1824 assert(wand->signature == MagickWandSignature);
1825 if (wand->debug != MagickFalse)
1826 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1827 alpha=(double) QuantumScale*CurrentContext->alpha;
1832 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1836 % D r a w G e t S t r o k e A n t i a l i a s %
1840 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1842 % DrawGetStrokeAntialias() returns the current stroke antialias setting.
1843 % Stroked outlines are antialiased by default. When antialiasing is disabled
1844 % stroked pixels are thresholded to determine if the stroke color or
1845 % underlying canvas color should be used.
1847 % The format of the DrawGetStrokeAntialias method is:
1849 % MagickBooleanType DrawGetStrokeAntialias(const DrawingWand *wand)
1851 % A description of each parameter follows:
1853 % o wand: the drawing wand.
1856 WandExport MagickBooleanType DrawGetStrokeAntialias(const DrawingWand *wand)
1858 assert(wand != (const DrawingWand *) NULL);
1859 assert(wand->signature == MagickWandSignature);
1860 if (wand->debug != MagickFalse)
1861 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1862 return(CurrentContext->stroke_antialias);
1866 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1870 % D r a w G e t S t r o k e C o l o r %
1874 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1876 % DrawGetStrokeColor() returns the color used for stroking object outlines.
1878 % The format of the DrawGetStrokeColor method is:
1880 % void DrawGetStrokeColor(const DrawingWand *wand,
1881 % PixelWand *stroke_color)
1883 % A description of each parameter follows:
1885 % o wand: the drawing wand.
1887 % o stroke_color: Return the stroke color.
1890 WandExport void DrawGetStrokeColor(const DrawingWand *wand,
1891 PixelWand *stroke_color)
1893 assert(wand != (const DrawingWand *) NULL);
1894 assert(wand->signature == MagickWandSignature);
1895 assert(stroke_color != (PixelWand *) NULL);
1896 if (wand->debug != MagickFalse)
1897 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1898 PixelSetPixelColor(stroke_color,&CurrentContext->stroke);
1902 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1906 % D r a w G e t S t r o k e D a s h A r r a y %
1910 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1912 % DrawGetStrokeDashArray() returns an array representing the pattern of
1913 % dashes and gaps used to stroke paths (see DrawSetStrokeDashArray). The
1914 % array must be freed once it is no longer required by the user.
1916 % The format of the DrawGetStrokeDashArray method is:
1918 % double *DrawGetStrokeDashArray(const DrawingWand *wand,
1919 % size_t *number_elements)
1921 % A description of each parameter follows:
1923 % o wand: the drawing wand.
1925 % o number_elements: address to place number of elements in dash array
1928 WandExport double *DrawGetStrokeDashArray(const DrawingWand *wand,
1929 size_t *number_elements)
1934 register const double
1946 assert(wand != (const DrawingWand *) NULL);
1947 assert(wand->signature == MagickWandSignature);
1948 if (wand->debug != MagickFalse)
1949 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1950 assert(number_elements != (size_t *) NULL);
1952 p=CurrentContext->dash_pattern;
1953 if (p != (const double *) NULL)
1954 while (fabs(*p++) >= MagickEpsilon)
1957 dasharray=(double *) NULL;
1960 dasharray=(double *) AcquireQuantumMemory((size_t) n+1UL,
1961 sizeof(*dasharray));
1962 if (dasharray != (double *) NULL)
1964 p=CurrentContext->dash_pattern;
1966 for (i=0; i < (ssize_t) n; i++)
1975 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1979 % D r a w G e t S t r o k e D a s h O f f s e t %
1983 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1985 % DrawGetStrokeDashOffset() returns the offset into the dash pattern to
1988 % The format of the DrawGetStrokeDashOffset method is:
1990 % double DrawGetStrokeDashOffset(const DrawingWand *wand)
1992 % A description of each parameter follows:
1994 % o wand: the drawing wand.
1997 WandExport double DrawGetStrokeDashOffset(const DrawingWand *wand)
1999 assert(wand != (const DrawingWand *) NULL);
2000 assert(wand->signature == MagickWandSignature);
2001 if (wand->debug != MagickFalse)
2002 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2003 return(CurrentContext->dash_offset);
2007 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2011 % D r a w G e t S t r o k e L i n e C a p %
2015 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2017 % DrawGetStrokeLineCap() returns the shape to be used at the end of
2018 % open subpaths when they are stroked. Values of LineCap are
2019 % UndefinedCap, ButtCap, RoundCap, and SquareCap.
2021 % The format of the DrawGetStrokeLineCap method is:
2023 % LineCap DrawGetStrokeLineCap(const DrawingWand *wand)
2025 % A description of each parameter follows:
2027 % o wand: the drawing wand.
2030 WandExport LineCap DrawGetStrokeLineCap(const DrawingWand *wand)
2032 assert(wand != (const DrawingWand *) NULL);
2033 assert(wand->signature == MagickWandSignature);
2034 if (wand->debug != MagickFalse)
2035 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2036 return(CurrentContext->linecap);
2040 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2044 % D r a w G e t S t r o k e L i n e J o i n %
2048 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2050 % DrawGetStrokeLineJoin() returns the shape to be used at the
2051 % corners of paths (or other vector shapes) when they are
2052 % stroked. Values of LineJoin are UndefinedJoin, MiterJoin, RoundJoin,
2055 % The format of the DrawGetStrokeLineJoin method is:
2057 % LineJoin DrawGetStrokeLineJoin(const DrawingWand *wand)
2059 % A description of each parameter follows:
2061 % o wand: the drawing wand.
2064 WandExport LineJoin DrawGetStrokeLineJoin(const DrawingWand *wand)
2066 assert(wand != (const DrawingWand *) NULL);
2067 assert(wand->signature == MagickWandSignature);
2068 if (wand->debug != MagickFalse)
2069 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2070 return(CurrentContext->linejoin);
2074 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2078 % D r a w G e t S t r o k e M i t e r L i m i t %
2082 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2084 % DrawGetStrokeMiterLimit() returns the miter limit. When two line
2085 % segments meet at a sharp angle and miter joins have been specified for
2086 % 'lineJoin', it is possible for the miter to extend far beyond the
2087 % thickness of the line stroking the path. The miterLimit' imposes a
2088 % limit on the ratio of the miter length to the 'lineWidth'.
2090 % The format of the DrawGetStrokeMiterLimit method is:
2092 % size_t DrawGetStrokeMiterLimit(const DrawingWand *wand)
2094 % A description of each parameter follows:
2096 % o wand: the drawing wand.
2099 WandExport size_t DrawGetStrokeMiterLimit(const DrawingWand *wand)
2101 assert(wand != (const DrawingWand *) NULL);
2102 assert(wand->signature == MagickWandSignature);
2103 if (wand->debug != MagickFalse)
2104 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2105 return CurrentContext->miterlimit;
2109 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2113 % D r a w G e t S t r o k e O p a c i t y %
2117 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2119 % DrawGetStrokeOpacity() returns the alpha of stroked object outlines.
2121 % The format of the DrawGetStrokeOpacity method is:
2123 % double DrawGetStrokeOpacity(const DrawingWand *wand)
2125 % A description of each parameter follows:
2127 % o wand: the drawing wand.
2130 WandExport double DrawGetStrokeOpacity(const DrawingWand *wand)
2135 assert(wand != (const DrawingWand *) NULL);
2136 assert(wand->signature == MagickWandSignature);
2137 if (wand->debug != MagickFalse)
2138 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2139 alpha=(double) QuantumScale*CurrentContext->stroke.alpha;
2144 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2148 % D r a w G e t S t r o k e W i d t h %
2152 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2154 % DrawGetStrokeWidth() returns the width of the stroke used to draw object
2157 % The format of the DrawGetStrokeWidth method is:
2159 % double DrawGetStrokeWidth(const DrawingWand *wand)
2161 % A description of each parameter follows:
2163 % o wand: the drawing wand.
2166 WandExport double DrawGetStrokeWidth(const DrawingWand *wand)
2168 assert(wand != (const DrawingWand *) NULL);
2169 assert(wand->signature == MagickWandSignature);
2170 if (wand->debug != MagickFalse)
2171 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2172 return(CurrentContext->stroke_width);
2176 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2180 % D r a w G e t T e x t A l i g n m e n t %
2184 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2186 % DrawGetTextAlignment() returns the alignment applied when annotating with
2189 % The format of the DrawGetTextAlignment method is:
2191 % AlignType DrawGetTextAlignment(const DrawingWand *wand)
2193 % A description of each parameter follows:
2195 % o wand: the drawing wand.
2198 WandExport AlignType DrawGetTextAlignment(const DrawingWand *wand)
2200 assert(wand != (const DrawingWand *) NULL);
2201 assert(wand->signature == MagickWandSignature);
2202 if (wand->debug != MagickFalse)
2203 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2204 return(CurrentContext->align);
2208 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2212 % D r a w G e t T e x t A n t i a l i a s %
2216 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2218 % DrawGetTextAntialias() returns the current text antialias setting, which
2219 % determines whether text is antialiased. Text is antialiased by default.
2221 % The format of the DrawGetTextAntialias method is:
2223 % MagickBooleanType DrawGetTextAntialias(const DrawingWand *wand)
2225 % A description of each parameter follows:
2227 % o wand: the drawing wand.
2230 WandExport MagickBooleanType DrawGetTextAntialias(const DrawingWand *wand)
2232 assert(wand != (const DrawingWand *) NULL);
2233 assert(wand->signature == MagickWandSignature);
2234 if (wand->debug != MagickFalse)
2235 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2236 return(CurrentContext->text_antialias);
2240 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2244 % D r a w G e t T e x t D e c o r a t i o n %
2248 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2250 % DrawGetTextDecoration() returns the decoration applied when annotating with
2253 % The format of the DrawGetTextDecoration method is:
2255 % DecorationType DrawGetTextDecoration(const DrawingWand *wand)
2257 % A description of each parameter follows:
2259 % o wand: the drawing wand.
2262 WandExport DecorationType DrawGetTextDecoration(const DrawingWand *wand)
2264 assert(wand != (const DrawingWand *) NULL);
2265 assert(wand->signature == MagickWandSignature);
2266 if (wand->debug != MagickFalse)
2267 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2268 return(CurrentContext->decorate);
2272 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2276 % D r a w G e t T e x t D i r e c t i o n %
2280 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2282 % DrawGetTextDirection() returns the direction that will be used when
2283 % annotating with text.
2285 % The format of the DrawGetTextDirection method is:
2287 % DirectionType DrawGetTextDirection(const DrawingWand *wand)
2289 % A description of each parameter follows:
2291 % o wand: the drawing wand.
2294 WandExport DirectionType DrawGetTextDirection(const DrawingWand *wand)
2296 assert(wand != (const DrawingWand *) NULL);
2297 assert(wand->signature == MagickWandSignature);
2298 if (wand->debug != MagickFalse)
2299 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2300 return(CurrentContext->direction);
2304 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2308 % D r a w G e t T e x t E n c o d i n g %
2312 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2314 % DrawGetTextEncoding() returns a null-terminated string which specifies the
2315 % code set used for text annotations. The string must be freed by the user
2316 % once it is no longer required.
2318 % The format of the DrawGetTextEncoding method is:
2320 % char *DrawGetTextEncoding(const DrawingWand *wand)
2322 % A description of each parameter follows:
2324 % o wand: the drawing wand.
2327 WandExport char *DrawGetTextEncoding(const DrawingWand *wand)
2329 assert(wand != (const DrawingWand *) NULL);
2330 assert(wand->signature == MagickWandSignature);
2331 if (wand->debug != MagickFalse)
2332 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2333 if (CurrentContext->encoding != (char *) NULL)
2334 return((char *) AcquireString(CurrentContext->encoding));
2335 return((char *) NULL);
2339 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2343 % D r a w G e t T e x t K e r n i n g %
2347 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2349 % DrawGetTextKerning() gets the spacing between characters in text.
2351 % The format of the DrawSetFontKerning method is:
2353 % double DrawGetTextKerning(DrawingWand *wand)
2355 % A description of each parameter follows:
2357 % o wand: the drawing wand.
2360 WandExport double DrawGetTextKerning(DrawingWand *wand)
2362 assert(wand != (DrawingWand *) NULL);
2363 assert(wand->signature == MagickWandSignature);
2365 if (wand->debug != MagickFalse)
2366 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2367 return(CurrentContext->kerning);
2371 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2375 % D r a w G e t T e x t I n t e r l i n e S p a c i n g %
2379 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2381 % DrawGetTextInterlineSpacing() gets the spacing between lines in text.
2383 % The format of the DrawGetTextInterlineSpacing method is:
2385 % double DrawGetTextInterlineSpacing(DrawingWand *wand)
2387 % A description of each parameter follows:
2389 % o wand: the drawing wand.
2392 WandExport double DrawGetTextInterlineSpacing(DrawingWand *wand)
2394 assert(wand != (DrawingWand *) NULL);
2395 assert(wand->signature == MagickWandSignature);
2396 if (wand->debug != MagickFalse)
2397 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2398 return(CurrentContext->interline_spacing);
2402 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2406 % D r a w G e t T e x t I n t e r w o r d S p a c i n g %
2410 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2412 % DrawGetTextInterwordSpacing() gets the spacing between words in text.
2414 % The format of the DrawSetFontKerning method is:
2416 % double DrawGetTextInterwordSpacing(DrawingWand *wand)
2418 % A description of each parameter follows:
2420 % o wand: the drawing wand.
2423 WandExport double DrawGetTextInterwordSpacing(DrawingWand *wand)
2425 assert(wand != (DrawingWand *) NULL);
2426 assert(wand->signature == MagickWandSignature);
2427 if (wand->debug != MagickFalse)
2428 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2429 return(CurrentContext->interword_spacing);
2433 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2437 % D r a w G e t V e c t o r G r a p h i c s %
2441 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2443 % DrawGetVectorGraphics() returns a null-terminated string which specifies the
2444 % vector graphics generated by any graphics calls made since the wand was
2445 % instantiated. The string must be freed by the user once it is no longer
2448 % The format of the DrawGetVectorGraphics method is:
2450 % char *DrawGetVectorGraphics(DrawingWand *wand)
2452 % A description of each parameter follows:
2454 % o wand: the drawing wand.
2457 WandExport char *DrawGetVectorGraphics(DrawingWand *wand)
2460 value[MagickPathExtent],
2473 assert(wand != (const DrawingWand *) NULL);
2474 assert(wand->signature == MagickWandSignature);
2475 if (wand->debug != MagickFalse)
2476 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2477 xml_info=NewXMLTreeTag("drawing-wand");
2478 if (xml_info == (XMLTreeInfo *) NULL)
2479 return((char *) NULL);
2480 (void) SetXMLTreeContent(xml_info," ");
2481 GetPixelInfo(wand->image,&pixel);
2482 child=AddChildToXMLTree(xml_info,"clip-path",0);
2483 if (child != (XMLTreeInfo *) NULL)
2484 (void) SetXMLTreeContent(child,CurrentContext->clip_mask);
2485 child=AddChildToXMLTree(xml_info,"clip-units",0);
2486 if (child != (XMLTreeInfo *) NULL)
2488 (void) CopyMagickString(value,CommandOptionToMnemonic(
2489 MagickClipPathOptions,(ssize_t) CurrentContext->clip_units),
2491 (void) SetXMLTreeContent(child,value);
2493 child=AddChildToXMLTree(xml_info,"decorate",0);
2494 if (child != (XMLTreeInfo *) NULL)
2496 (void) CopyMagickString(value,CommandOptionToMnemonic(
2497 MagickDecorateOptions,(ssize_t) CurrentContext->decorate),
2499 (void) SetXMLTreeContent(child,value);
2501 child=AddChildToXMLTree(xml_info,"encoding",0);
2502 if (child != (XMLTreeInfo *) NULL)
2503 (void) SetXMLTreeContent(child,CurrentContext->encoding);
2504 child=AddChildToXMLTree(xml_info,"fill",0);
2505 if (child != (XMLTreeInfo *) NULL)
2507 if (CurrentContext->fill.alpha != OpaqueAlpha)
2508 pixel.alpha_trait=CurrentContext->fill.alpha != OpaqueAlpha ?
2509 BlendPixelTrait : UndefinedPixelTrait;
2510 pixel=CurrentContext->fill;
2511 GetColorTuple(&pixel,MagickTrue,value);
2512 (void) SetXMLTreeContent(child,value);
2514 child=AddChildToXMLTree(xml_info,"fill-opacity",0);
2515 if (child != (XMLTreeInfo *) NULL)
2517 (void) FormatLocaleString(value,MagickPathExtent,"%.20g",
2518 (double) (QuantumScale*CurrentContext->fill.alpha));
2519 (void) SetXMLTreeContent(child,value);
2521 child=AddChildToXMLTree(xml_info,"fill-rule",0);
2522 if (child != (XMLTreeInfo *) NULL)
2524 (void) CopyMagickString(value,CommandOptionToMnemonic(
2525 MagickFillRuleOptions,(ssize_t) CurrentContext->fill_rule),
2527 (void) SetXMLTreeContent(child,value);
2529 child=AddChildToXMLTree(xml_info,"font",0);
2530 if (child != (XMLTreeInfo *) NULL)
2531 (void) SetXMLTreeContent(child,CurrentContext->font);
2532 child=AddChildToXMLTree(xml_info,"font-family",0);
2533 if (child != (XMLTreeInfo *) NULL)
2534 (void) SetXMLTreeContent(child,CurrentContext->family);
2535 child=AddChildToXMLTree(xml_info,"font-size",0);
2536 if (child != (XMLTreeInfo *) NULL)
2538 (void) FormatLocaleString(value,MagickPathExtent,"%.20g",
2539 CurrentContext->pointsize);
2540 (void) SetXMLTreeContent(child,value);
2542 child=AddChildToXMLTree(xml_info,"font-stretch",0);
2543 if (child != (XMLTreeInfo *) NULL)
2545 (void) CopyMagickString(value,CommandOptionToMnemonic(
2546 MagickStretchOptions,(ssize_t) CurrentContext->stretch),
2548 (void) SetXMLTreeContent(child,value);
2550 child=AddChildToXMLTree(xml_info,"font-style",0);
2551 if (child != (XMLTreeInfo *) NULL)
2553 (void) CopyMagickString(value,CommandOptionToMnemonic(
2554 MagickStyleOptions,(ssize_t) CurrentContext->style),MagickPathExtent);
2555 (void) SetXMLTreeContent(child,value);
2557 child=AddChildToXMLTree(xml_info,"font-weight",0);
2558 if (child != (XMLTreeInfo *) NULL)
2560 (void) FormatLocaleString(value,MagickPathExtent,"%.20g",(double)
2561 CurrentContext->weight);
2562 (void) SetXMLTreeContent(child,value);
2564 child=AddChildToXMLTree(xml_info,"gravity",0);
2565 if (child != (XMLTreeInfo *) NULL)
2567 (void) CopyMagickString(value,CommandOptionToMnemonic(
2568 MagickGravityOptions,(ssize_t) CurrentContext->gravity),
2570 (void) SetXMLTreeContent(child,value);
2572 child=AddChildToXMLTree(xml_info,"stroke",0);
2573 if (child != (XMLTreeInfo *) NULL)
2575 if (CurrentContext->stroke.alpha != OpaqueAlpha)
2576 pixel.alpha_trait=CurrentContext->stroke.alpha != OpaqueAlpha ?
2577 BlendPixelTrait : UndefinedPixelTrait;
2578 pixel=CurrentContext->stroke;
2579 GetColorTuple(&pixel,MagickTrue,value);
2580 (void) SetXMLTreeContent(child,value);
2582 child=AddChildToXMLTree(xml_info,"stroke-antialias",0);
2583 if (child != (XMLTreeInfo *) NULL)
2585 (void) FormatLocaleString(value,MagickPathExtent,"%d",
2586 CurrentContext->stroke_antialias != MagickFalse ? 1 : 0);
2587 (void) SetXMLTreeContent(child,value);
2589 child=AddChildToXMLTree(xml_info,"stroke-dasharray",0);
2590 if ((child != (XMLTreeInfo *) NULL) &&
2591 (CurrentContext->dash_pattern != (double *) NULL))
2596 dash_pattern=AcquireString((char *) NULL);
2597 for (i=0; fabs(CurrentContext->dash_pattern[i]) >= MagickEpsilon; i++)
2600 (void) ConcatenateString(&dash_pattern,",");
2601 (void) FormatLocaleString(value,MagickPathExtent,"%.20g",
2602 CurrentContext->dash_pattern[i]);
2603 (void) ConcatenateString(&dash_pattern,value);
2605 (void) SetXMLTreeContent(child,dash_pattern);
2606 dash_pattern=DestroyString(dash_pattern);
2608 child=AddChildToXMLTree(xml_info,"stroke-dashoffset",0);
2609 if (child != (XMLTreeInfo *) NULL)
2611 (void) FormatLocaleString(value,MagickPathExtent,"%.20g",
2612 CurrentContext->dash_offset);
2613 (void) SetXMLTreeContent(child,value);
2615 child=AddChildToXMLTree(xml_info,"stroke-linecap",0);
2616 if (child != (XMLTreeInfo *) NULL)
2618 (void) CopyMagickString(value,CommandOptionToMnemonic(
2619 MagickLineCapOptions,(ssize_t) CurrentContext->linecap),
2621 (void) SetXMLTreeContent(child,value);
2623 child=AddChildToXMLTree(xml_info,"stroke-linejoin",0);
2624 if (child != (XMLTreeInfo *) NULL)
2626 (void) CopyMagickString(value,CommandOptionToMnemonic(
2627 MagickLineJoinOptions,(ssize_t) CurrentContext->linejoin),
2629 (void) SetXMLTreeContent(child,value);
2631 child=AddChildToXMLTree(xml_info,"stroke-miterlimit",0);
2632 if (child != (XMLTreeInfo *) NULL)
2634 (void) FormatLocaleString(value,MagickPathExtent,"%.20g",(double)
2635 CurrentContext->miterlimit);
2636 (void) SetXMLTreeContent(child,value);
2638 child=AddChildToXMLTree(xml_info,"stroke-opacity",0);
2639 if (child != (XMLTreeInfo *) NULL)
2641 (void) FormatLocaleString(value,MagickPathExtent,"%.20g",
2642 (double) (QuantumScale*CurrentContext->stroke.alpha));
2643 (void) SetXMLTreeContent(child,value);
2645 child=AddChildToXMLTree(xml_info,"stroke-width",0);
2646 if (child != (XMLTreeInfo *) NULL)
2648 (void) FormatLocaleString(value,MagickPathExtent,"%.20g",
2649 CurrentContext->stroke_width);
2650 (void) SetXMLTreeContent(child,value);
2652 child=AddChildToXMLTree(xml_info,"text-align",0);
2653 if (child != (XMLTreeInfo *) NULL)
2655 (void) CopyMagickString(value,CommandOptionToMnemonic(MagickAlignOptions,
2656 (ssize_t) CurrentContext->align),MagickPathExtent);
2657 (void) SetXMLTreeContent(child,value);
2659 child=AddChildToXMLTree(xml_info,"text-antialias",0);
2660 if (child != (XMLTreeInfo *) NULL)
2662 (void) FormatLocaleString(value,MagickPathExtent,"%d",
2663 CurrentContext->text_antialias != MagickFalse ? 1 : 0);
2664 (void) SetXMLTreeContent(child,value);
2666 child=AddChildToXMLTree(xml_info,"text-undercolor",0);
2667 if (child != (XMLTreeInfo *) NULL)
2669 if (CurrentContext->undercolor.alpha != OpaqueAlpha)
2670 pixel.alpha_trait=CurrentContext->undercolor.alpha != OpaqueAlpha ?
2671 BlendPixelTrait : UndefinedPixelTrait;
2672 pixel=CurrentContext->undercolor;
2673 GetColorTuple(&pixel,MagickTrue,value);
2674 (void) SetXMLTreeContent(child,value);
2676 child=AddChildToXMLTree(xml_info,"vector-graphics",0);
2677 if (child != (XMLTreeInfo *) NULL)
2678 (void) SetXMLTreeContent(child,wand->mvg);
2679 xml=XMLTreeInfoToXML(xml_info);
2680 xml_info=DestroyXMLTree(xml_info);
2685 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2689 % D r a w G e t T e x t U n d e r C o l o r %
2693 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2695 % DrawGetTextUnderColor() returns the color of a background rectangle
2696 % to place under text annotations.
2698 % The format of the DrawGetTextUnderColor method is:
2700 % void DrawGetTextUnderColor(const DrawingWand *wand,
2701 % PixelWand *under_color)
2703 % A description of each parameter follows:
2705 % o wand: the drawing wand.
2707 % o under_color: Return the under color.
2710 WandExport void DrawGetTextUnderColor(const DrawingWand *wand,
2711 PixelWand *under_color)
2713 assert(wand != (const DrawingWand *) NULL);
2714 assert(wand->signature == MagickWandSignature);
2715 assert(under_color != (PixelWand *) NULL);
2716 if (wand->debug != MagickFalse)
2717 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2718 PixelSetPixelColor(under_color,&CurrentContext->undercolor);
2722 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2730 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2732 % DrawLine() draws a line on the image using the current stroke color,
2733 % stroke alpha, and stroke width.
2735 % The format of the DrawLine method is:
2737 % void DrawLine(DrawingWand *wand,const double sx,const double sy,
2738 % const double ex,const double ey)
2740 % A description of each parameter follows:
2742 % o wand: the drawing wand.
2744 % o sx: starting x ordinate
2746 % o sy: starting y ordinate
2748 % o ex: ending x ordinate
2750 % o ey: ending y ordinate
2753 WandExport void DrawLine(DrawingWand *wand,const double sx,const double sy,
2754 const double ex,const double ey)
2756 assert(wand != (DrawingWand *) NULL);
2757 assert(wand->signature == MagickWandSignature);
2758 if (wand->debug != MagickFalse)
2759 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2760 (void) MVGPrintf(wand,"line %.20g %.20g %.20g %.20g\n",sx,sy,ex,ey);
2764 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2768 % D r a w P a t h C l o s e %
2772 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2774 % DrawPathClose() adds a path element to the current path which closes the
2775 % current subpath by drawing a straight line from the current point to the
2776 % current subpath's most recent starting point (usually, the most recent
2779 % The format of the DrawPathClose method is:
2781 % void DrawPathClose(DrawingWand *wand)
2783 % A description of each parameter follows:
2785 % o wand: the drawing wand.
2788 WandExport void DrawPathClose(DrawingWand *wand)
2790 assert(wand != (DrawingWand *) NULL);
2791 assert(wand->signature == MagickWandSignature);
2792 if (wand->debug != MagickFalse)
2793 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2794 (void) MVGAutoWrapPrintf(wand,"%s",wand->path_mode == AbsolutePathMode ?
2799 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2803 % D r a w P a t h C u r v e T o A b s o l u t e %
2807 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2809 % DrawPathCurveToAbsolute() draws a cubic Bezier curve from the current
2810 % point to (x,y) using (x1,y1) as the control point at the beginning of
2811 % the curve and (x2,y2) as the control point at the end of the curve using
2812 % absolute coordinates. At the end of the command, the new current point
2813 % becomes the final (x,y) coordinate pair used in the polybezier.
2815 % The format of the DrawPathCurveToAbsolute method is:
2817 % void DrawPathCurveToAbsolute(DrawingWand *wand,const double x1,
2818 % const double y1,const double x2,const double y2,const double x,
2821 % A description of each parameter follows:
2823 % o wand: the drawing wand.
2825 % o x1: x ordinate of control point for curve beginning
2827 % o y1: y ordinate of control point for curve beginning
2829 % o x2: x ordinate of control point for curve ending
2831 % o y2: y ordinate of control point for curve ending
2833 % o x: x ordinate of the end of the curve
2835 % o y: y ordinate of the end of the curve
2839 static void DrawPathCurveTo(DrawingWand *wand,const PathMode mode,
2840 const double x1,const double y1,const double x2,const double y2,
2841 const double x,const double y)
2843 assert(wand != (DrawingWand *) NULL);
2844 assert(wand->signature == MagickWandSignature);
2845 if (wand->debug != MagickFalse)
2846 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2847 if ((wand->path_operation != PathCurveToOperation) ||
2848 (wand->path_mode != mode))
2850 wand->path_operation=PathCurveToOperation;
2851 wand->path_mode=mode;
2852 (void) MVGAutoWrapPrintf(wand, "%c%.20g %.20g %.20g %.20g %.20g %.20g",
2853 mode == AbsolutePathMode ? 'C' : 'c',x1,y1,x2,y2,x,y);
2856 (void) MVGAutoWrapPrintf(wand," %.20g %.20g %.20g %.20g %.20g %.20g",x1,y1,
2860 WandExport void DrawPathCurveToAbsolute(DrawingWand *wand,const double x1,
2861 const double y1,const double x2,const double y2,const double x,const double y)
2863 assert(wand != (DrawingWand *) NULL);
2864 assert(wand->signature == MagickWandSignature);
2865 if (wand->debug != MagickFalse)
2866 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2867 DrawPathCurveTo(wand,AbsolutePathMode,x1,y1,x2,y2,x,y);
2871 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2875 % D r a w P a t h C u r v e T o R e l a t i v e %
2879 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2881 % DrawPathCurveToRelative() draws a cubic Bezier curve from the current
2882 % point to (x,y) using (x1,y1) as the control point at the beginning of
2883 % the curve and (x2,y2) as the control point at the end of the curve using
2884 % relative coordinates. At the end of the command, the new current point
2885 % becomes the final (x,y) coordinate pair used in the polybezier.
2887 % The format of the DrawPathCurveToRelative method is:
2889 % void DrawPathCurveToRelative(DrawingWand *wand,const double x1,
2890 % const double y1,const double x2,const double y2,const double x,
2893 % A description of each parameter follows:
2895 % o wand: the drawing wand.
2897 % o x1: x ordinate of control point for curve beginning
2899 % o y1: y ordinate of control point for curve beginning
2901 % o x2: x ordinate of control point for curve ending
2903 % o y2: y ordinate of control point for curve ending
2905 % o x: x ordinate of the end of the curve
2907 % o y: y ordinate of the end of the curve
2910 WandExport void DrawPathCurveToRelative(DrawingWand *wand,const double x1,
2911 const double y1,const double x2,const double y2,const double x,const double y)
2913 assert(wand != (DrawingWand *) NULL);
2914 assert(wand->signature == MagickWandSignature);
2915 if (wand->debug != MagickFalse)
2916 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2917 DrawPathCurveTo(wand,RelativePathMode,x1,y1,x2,y2,x,y);
2921 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2925 % D r a w P a t h C u r v e T o Q u a d r a t i c B e z i e r A b s o l u t e %
2929 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2931 % DrawPathCurveToQuadraticBezierAbsolute() draws a quadratic Bezier curve
2932 % from the current point to (x,y) using (x1,y1) as the control point using
2933 % absolute coordinates. At the end of the command, the new current point
2934 % becomes the final (x,y) coordinate pair used in the polybezier.
2936 % The format of the DrawPathCurveToQuadraticBezierAbsolute method is:
2938 % void DrawPathCurveToQuadraticBezierAbsolute(DrawingWand *wand,
2939 % const double x1,const double y1,onst double x,const double y)
2941 % A description of each parameter follows:
2943 % o wand: the drawing wand.
2945 % o x1: x ordinate of the control point
2947 % o y1: y ordinate of the control point
2949 % o x: x ordinate of final point
2951 % o y: y ordinate of final point
2955 static void DrawPathCurveToQuadraticBezier(DrawingWand *wand,
2956 const PathMode mode,const double x1,double y1,const double x,const double y)
2958 assert(wand != (DrawingWand *) NULL);
2959 assert(wand->signature == MagickWandSignature);
2960 if (wand->debug != MagickFalse)
2961 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2962 if ((wand->path_operation != PathCurveToQuadraticBezierOperation) ||
2963 (wand->path_mode != mode))
2965 wand->path_operation=PathCurveToQuadraticBezierOperation;
2966 wand->path_mode=mode;
2967 (void) MVGAutoWrapPrintf(wand, "%c%.20g %.20g %.20g %.20g",
2968 mode == AbsolutePathMode ? 'Q' : 'q',x1,y1,x,y);
2971 (void) MVGAutoWrapPrintf(wand," %.20g %.20g %.20g %.20g",x1,y1,x,y);
2974 WandExport void DrawPathCurveToQuadraticBezierAbsolute(DrawingWand *wand,
2975 const double x1,const double y1,const double x,const double y)
2977 assert(wand != (DrawingWand *) NULL);
2978 assert(wand->signature == MagickWandSignature);
2979 if (wand->debug != MagickFalse)
2980 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2981 DrawPathCurveToQuadraticBezier(wand,AbsolutePathMode,x1,y1,x,y);
2985 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2989 % D r a w P a t h C u r v e T o Q u a d r a t i c B e z i e r R e l a t i v e %
2993 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2995 % DrawPathCurveToQuadraticBezierRelative() draws a quadratic Bezier curve
2996 % from the current point to (x,y) using (x1,y1) as the control point using
2997 % relative coordinates. At the end of the command, the new current point
2998 % becomes the final (x,y) coordinate pair used in the polybezier.
3000 % The format of the DrawPathCurveToQuadraticBezierRelative method is:
3002 % void DrawPathCurveToQuadraticBezierRelative(DrawingWand *wand,
3003 % const double x1,const double y1,const double x,const double y)
3005 % A description of each parameter follows:
3007 % o wand: the drawing wand.
3009 % o x1: x ordinate of the control point
3011 % o y1: y ordinate of the control point
3013 % o x: x ordinate of final point
3015 % o y: y ordinate of final point
3018 WandExport void DrawPathCurveToQuadraticBezierRelative(DrawingWand *wand,
3019 const double x1,const double y1,const double x,const double y)
3021 assert(wand != (DrawingWand *) NULL);
3022 assert(wand->signature == MagickWandSignature);
3023 if (wand->debug != MagickFalse)
3024 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3025 DrawPathCurveToQuadraticBezier(wand,RelativePathMode,x1,y1,x,y);
3029 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3033 % D r a w P a t h C u r v e T o Q u a d r a t i c B e z i e r S m o o t h %
3037 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3039 % DrawPathCurveToQuadraticBezierSmoothAbsolute() draws a quadratic
3040 % Bezier curve (using absolute coordinates) from the current point to
3041 % (x,y). The control point is assumed to be the reflection of the
3042 % control point on the previous command relative to the current
3043 % point. (If there is no previous command or if the previous command was
3044 % not a DrawPathCurveToQuadraticBezierAbsolute,
3045 % DrawPathCurveToQuadraticBezierRelative,
3046 % DrawPathCurveToQuadraticBezierSmoothAbsolute or
3047 % DrawPathCurveToQuadraticBezierSmoothRelative, assume the control point
3048 % is coincident with the current point.). At the end of the command, the
3049 % new current point becomes the final (x,y) coordinate pair used in the
3052 % The format of the DrawPathCurveToQuadraticBezierSmoothAbsolute method is:
3054 % void DrawPathCurveToQuadraticBezierSmoothAbsolute(
3055 % DrawingWand *wand,const double x,const double y)
3057 % A description of each parameter follows:
3059 % o wand: the drawing wand.
3061 % o x: x ordinate of final point
3063 % o y: y ordinate of final point
3067 static void DrawPathCurveToQuadraticBezierSmooth(DrawingWand *wand,
3068 const PathMode mode,const double x,const double y)
3070 assert(wand != (DrawingWand *) NULL);
3071 assert(wand->signature == MagickWandSignature);
3072 if (wand->debug != MagickFalse)
3073 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3074 if ((wand->path_operation != PathCurveToQuadraticBezierSmoothOperation) ||
3075 (wand->path_mode != mode))
3077 wand->path_operation=PathCurveToQuadraticBezierSmoothOperation;
3078 wand->path_mode=mode;
3079 (void) MVGAutoWrapPrintf(wand,"%c%.20g %.20g",mode == AbsolutePathMode ?
3083 (void) MVGAutoWrapPrintf(wand," %.20g %.20g",x,y);
3086 WandExport void DrawPathCurveToQuadraticBezierSmoothAbsolute(DrawingWand *wand,
3087 const double x,const double y)
3089 assert(wand != (DrawingWand *) NULL);
3090 assert(wand->signature == MagickWandSignature);
3091 if (wand->debug != MagickFalse)
3092 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3093 DrawPathCurveToQuadraticBezierSmooth(wand,AbsolutePathMode,x,y);
3097 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3101 % D r a w P a t h C u r v e T o Q u a d r a t i c B e z i e r S m o o t h %
3105 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3107 % DrawPathCurveToQuadraticBezierSmoothRelative() draws a quadratic Bezier
3108 % curve (using relative coordinates) from the current point to (x,y). The
3109 % control point is assumed to be the reflection of the control point on the
3110 % previous command relative to the current point. (If there is no previous
3111 % command or if the previous command was not a
3112 % DrawPathCurveToQuadraticBezierAbsolute,
3113 % DrawPathCurveToQuadraticBezierRelative,
3114 % DrawPathCurveToQuadraticBezierSmoothAbsolute or
3115 % DrawPathCurveToQuadraticBezierSmoothRelative, assume the control point is
3116 % coincident with the current point.). At the end of the command, the new
3117 % current point becomes the final (x,y) coordinate pair used in the polybezier.
3119 % The format of the DrawPathCurveToQuadraticBezierSmoothRelative method is:
3121 % void DrawPathCurveToQuadraticBezierSmoothRelative(DrawingWand *wand,
3122 % const double x,const double y)
3124 % A description of each parameter follows:
3126 % o wand: the drawing wand.
3128 % o x: x ordinate of final point
3130 % o y: y ordinate of final point
3133 WandExport void DrawPathCurveToQuadraticBezierSmoothRelative(DrawingWand *wand,
3134 const double x,const double y)
3136 DrawPathCurveToQuadraticBezierSmooth(wand,RelativePathMode,x,y);
3140 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3144 % D r a w P a t h C u r v e T o S m o o t h A b s o l u t e %
3148 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3150 % DrawPathCurveToSmoothAbsolute() draws a cubic Bezier curve from the
3151 % current point to (x,y) using absolute coordinates. The first control
3152 % point is assumed to be the reflection of the second control point on
3153 % the previous command relative to the current point. (If there is no
3154 % previous command or if the previous command was not an
3155 % DrawPathCurveToAbsolute, DrawPathCurveToRelative,
3156 % DrawPathCurveToSmoothAbsolute or DrawPathCurveToSmoothRelative, assume
3157 % the first control point is coincident with the current point.) (x2,y2)
3158 % is the second control point (i.e., the control point at the end of the
3159 % curve). At the end of the command, the new current point becomes the
3160 % final (x,y) coordinate pair used in the polybezier.
3162 % The format of the DrawPathCurveToSmoothAbsolute method is:
3164 % void DrawPathCurveToSmoothAbsolute(DrawingWand *wand,
3165 % const double x2,const double y2,const double x,const double y)
3167 % A description of each parameter follows:
3169 % o wand: the drawing wand.
3171 % o x2: x ordinate of second control point
3173 % o y2: y ordinate of second control point
3175 % o x: x ordinate of termination point
3177 % o y: y ordinate of termination point
3181 static void DrawPathCurveToSmooth(DrawingWand *wand,const PathMode mode,
3182 const double x2,const double y2,const double x,const double y)
3184 assert(wand != (DrawingWand *) NULL);
3185 assert(wand->signature == MagickWandSignature);
3186 if (wand->debug != MagickFalse)
3187 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3188 if ((wand->path_operation != PathCurveToSmoothOperation) ||
3189 (wand->path_mode != mode))
3191 wand->path_operation=PathCurveToSmoothOperation;
3192 wand->path_mode=mode;
3193 (void) MVGAutoWrapPrintf(wand,"%c%.20g %.20g %.20g %.20g",
3194 mode == AbsolutePathMode ? 'S' : 's',x2,y2,x,y);
3197 (void) MVGAutoWrapPrintf(wand," %.20g %.20g %.20g %.20g",x2,y2,x,y);
3200 WandExport void DrawPathCurveToSmoothAbsolute(DrawingWand *wand,const double x2,
3201 const double y2,const double x,const double y)
3203 assert(wand != (DrawingWand *) NULL);
3204 assert(wand->signature == MagickWandSignature);
3205 if (wand->debug != MagickFalse)
3206 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3207 DrawPathCurveToSmooth(wand,AbsolutePathMode,x2,y2,x,y);
3211 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3215 % D r a w P a t h C u r v e T o S m o o t h R e l a t i v e %
3219 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3221 % DrawPathCurveToSmoothRelative() draws a cubic Bezier curve from the current
3222 % point to (x,y) using relative coordinates. The first control point is
3223 % assumed to be the reflection of the second control point on the previous
3224 % command relative to the current point. (If there is no previous command or
3225 % if the previous command was not an DrawPathCurveToAbsolute,
3226 % DrawPathCurveToRelative, DrawPathCurveToSmoothAbsolute or
3227 % DrawPathCurveToSmoothRelative, assume the first control point is coincident
3228 % with the current point.) (x2,y2) is the second control point (i.e., the
3229 % control point at the end of the curve). At the end of the command, the new
3230 % current point becomes the final (x,y) coordinate pair used in the polybezier.
3232 % The format of the DrawPathCurveToSmoothRelative method is:
3234 % void DrawPathCurveToSmoothRelative(DrawingWand *wand,
3235 % const double x2,const double y2,const double x,const double y)
3237 % A description of each parameter follows:
3239 % o wand: the drawing wand.
3241 % o x2: x ordinate of second control point
3243 % o y2: y ordinate of second control point
3245 % o x: x ordinate of termination point
3247 % o y: y ordinate of termination point
3250 WandExport void DrawPathCurveToSmoothRelative(DrawingWand *wand,const double x2,
3251 const double y2,const double x,const double y)
3253 assert(wand != (DrawingWand *) NULL);
3254 assert(wand->signature == MagickWandSignature);
3255 if (wand->debug != MagickFalse)
3256 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3257 DrawPathCurveToSmooth(wand,RelativePathMode,x2,y2,x,y);
3261 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3265 % D r a w P a t h E l l i p t i c A r c A b s o l u t e %
3269 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3271 % DrawPathEllipticArcAbsolute() draws an elliptical arc from the current point
3272 % to (x, y) using absolute coordinates. The size and orientation of the
3273 % ellipse are defined by two radii (rx, ry) and an xAxisRotation, which
3274 % indicates how the ellipse as a whole is rotated relative to the current
3275 % coordinate system. The center (cx, cy) of the ellipse is calculated
3276 % automagically to satisfy the constraints imposed by the other parameters.
3277 % largeArcFlag and sweepFlag contribute to the automatic calculations and help
3278 % determine how the arc is drawn. If largeArcFlag is true then draw the larger
3279 % of the available arcs. If sweepFlag is true, then draw the arc matching a
3280 % clock-wise rotation.
3282 % The format of the DrawPathEllipticArcAbsolute method is:
3284 % void DrawPathEllipticArcAbsolute(DrawingWand *wand,
3285 % const double rx,const double ry,const double x_axis_rotation,
3286 % const MagickBooleanType large_arc_flag,
3287 % const MagickBooleanType sweep_flag,const double x,const double y)
3289 % A description of each parameter follows:
3291 % o wand: the drawing wand.
3297 % o x_axis_rotation: indicates how the ellipse as a whole is rotated
3298 % relative to the current coordinate system
3300 % o large_arc_flag: If non-zero (true) then draw the larger of the
3303 % o sweep_flag: If non-zero (true) then draw the arc matching a
3304 % clock-wise rotation
3309 static void DrawPathEllipticArc(DrawingWand *wand, const PathMode mode,
3310 const double rx,const double ry,const double x_axis_rotation,
3311 const MagickBooleanType large_arc_flag,const MagickBooleanType sweep_flag,
3312 const double x,const double y)
3314 assert(wand != (DrawingWand *) NULL);
3315 assert(wand->signature == MagickWandSignature);
3316 if (wand->debug != MagickFalse)
3317 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3318 if ((wand->path_operation != PathEllipticArcOperation) ||
3319 (wand->path_mode != mode))
3321 wand->path_operation=PathEllipticArcOperation;
3322 wand->path_mode=mode;
3323 (void) MVGAutoWrapPrintf(wand, "%c%.20g %.20g %.20g %u %u %.20g %.20g",
3324 mode == AbsolutePathMode ? 'A' : 'a',rx,ry,x_axis_rotation,
3325 large_arc_flag,sweep_flag,x,y);
3328 (void) MVGAutoWrapPrintf(wand," %.20g %.20g %.20g %u %u %.20g %.20g",rx,ry,
3329 x_axis_rotation,large_arc_flag,sweep_flag,x,y);
3332 WandExport void DrawPathEllipticArcAbsolute(DrawingWand *wand,const double rx,
3333 const double ry,const double x_axis_rotation,
3334 const MagickBooleanType large_arc_flag,const MagickBooleanType sweep_flag,
3335 const double x,const double y)
3337 assert(wand != (DrawingWand *) NULL);
3338 assert(wand->signature == MagickWandSignature);
3339 if (wand->debug != MagickFalse)
3340 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3341 DrawPathEllipticArc(wand,AbsolutePathMode,rx,ry,x_axis_rotation,
3342 large_arc_flag,sweep_flag,x,y);
3346 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3350 % D r a w P a t h E l l i p t i c A r c R e l a t i v e %
3354 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3356 % DrawPathEllipticArcRelative() draws an elliptical arc from the current point
3357 % to (x, y) using relative coordinates. The size and orientation of the
3358 % ellipse are defined by two radii (rx, ry) and an xAxisRotation, which
3359 % indicates how the ellipse as a whole is rotated relative to the current
3360 % coordinate system. The center (cx, cy) of the ellipse is calculated
3361 % automagically to satisfy the constraints imposed by the other parameters.
3362 % largeArcFlag and sweepFlag contribute to the automatic calculations and help
3363 % determine how the arc is drawn. If largeArcFlag is true then draw the larger
3364 % of the available arcs. If sweepFlag is true, then draw the arc matching a
3365 % clock-wise rotation.
3367 % The format of the DrawPathEllipticArcRelative method is:
3369 % void DrawPathEllipticArcRelative(DrawingWand *wand,
3370 % const double rx,const double ry,const double x_axis_rotation,
3371 % const MagickBooleanType large_arc_flag,
3372 % const MagickBooleanType sweep_flag,const double x,const double y)
3374 % A description of each parameter follows:
3376 % o wand: the drawing wand.
3382 % o x_axis_rotation: indicates how the ellipse as a whole is rotated
3383 % relative to the current coordinate system
3385 % o large_arc_flag: If non-zero (true) then draw the larger of the
3388 % o sweep_flag: If non-zero (true) then draw the arc matching a
3389 % clock-wise rotation
3392 WandExport void DrawPathEllipticArcRelative(DrawingWand *wand,const double rx,
3393 const double ry,const double x_axis_rotation,
3394 const MagickBooleanType large_arc_flag,const MagickBooleanType sweep_flag,
3395 const double x,const double y)
3397 DrawPathEllipticArc(wand,RelativePathMode,rx,ry,x_axis_rotation,
3398 large_arc_flag,sweep_flag,x,y);
3402 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3406 % D r a w P a t h F i n i s h %
3410 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3412 % DrawPathFinish() terminates the current path.
3414 % The format of the DrawPathFinish method is:
3416 % void DrawPathFinish(DrawingWand *wand)
3418 % A description of each parameter follows:
3420 % o wand: the drawing wand.
3423 WandExport void DrawPathFinish(DrawingWand *wand)
3425 assert(wand != (DrawingWand *) NULL);
3426 assert(wand->signature == MagickWandSignature);
3427 if (wand->debug != MagickFalse)
3428 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3429 (void) MVGPrintf(wand,"'\n");
3430 wand->path_operation=PathDefaultOperation;
3431 wand->path_mode=DefaultPathMode;
3435 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3439 % D r a w P a t h L i n e T o A b s o l u t e %
3443 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3445 % DrawPathLineToAbsolute() draws a line path from the current point to the
3446 % given coordinate using absolute coordinates. The coordinate then becomes
3447 % the new current point.
3449 % The format of the DrawPathLineToAbsolute method is:
3451 % void DrawPathLineToAbsolute(DrawingWand *wand,const double x,
3454 % A description of each parameter follows:
3456 % o wand: the drawing wand.
3458 % o x: target x ordinate
3460 % o y: target y ordinate
3463 static void DrawPathLineTo(DrawingWand *wand,const PathMode mode,
3464 const double x,const double y)
3466 assert(wand != (DrawingWand *) NULL);
3467 assert(wand->signature == MagickWandSignature);
3468 if (wand->debug != MagickFalse)
3469 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3470 if ((wand->path_operation != PathLineToOperation) ||
3471 (wand->path_mode != mode))
3473 wand->path_operation=PathLineToOperation;
3474 wand->path_mode=mode;
3475 (void) MVGAutoWrapPrintf(wand,"%c%.20g %.20g",mode == AbsolutePathMode ?
3479 (void) MVGAutoWrapPrintf(wand," %.20g %.20g",x,y);
3482 WandExport void DrawPathLineToAbsolute(DrawingWand *wand,const double x,
3485 assert(wand != (DrawingWand *) NULL);
3486 assert(wand->signature == MagickWandSignature);
3487 if (wand->debug != MagickFalse)
3488 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3489 DrawPathLineTo(wand,AbsolutePathMode,x,y);
3493 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3497 % D r a w P a t h L i n e T o R e l a t i v e %
3501 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3503 % DrawPathLineToRelative() draws a line path from the current point to the
3504 % given coordinate using relative coordinates. The coordinate then becomes
3505 % the new current point.
3507 % The format of the DrawPathLineToRelative method is:
3509 % void DrawPathLineToRelative(DrawingWand *wand,const double x,
3512 % A description of each parameter follows:
3514 % o wand: the drawing wand.
3516 % o x: target x ordinate
3518 % o y: target y ordinate
3521 WandExport void DrawPathLineToRelative(DrawingWand *wand,const double x,
3524 assert(wand != (DrawingWand *) NULL);
3525 assert(wand->signature == MagickWandSignature);
3526 if (wand->debug != MagickFalse)
3527 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3528 DrawPathLineTo(wand,RelativePathMode,x,y);
3532 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3536 % D r a w P a t h L i n e T o H o r i z o n t a l A b s o l u t e %
3540 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3542 % DrawPathLineToHorizontalAbsolute() draws a horizontal line path from the
3543 % current point to the target point using absolute coordinates. The target
3544 % point then becomes the new current point.
3546 % The format of the DrawPathLineToHorizontalAbsolute method is:
3548 % void DrawPathLineToHorizontalAbsolute(DrawingWand *wand,const double x)
3550 % A description of each parameter follows:
3552 % o wand: the drawing wand.
3554 % o x: target x ordinate
3558 static void DrawPathLineToHorizontal(DrawingWand *wand,const PathMode mode,
3561 assert(wand != (DrawingWand *) NULL);
3562 assert(wand->signature == MagickWandSignature);
3563 if (wand->debug != MagickFalse)
3564 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3565 if ((wand->path_operation != PathLineToHorizontalOperation) ||
3566 (wand->path_mode != mode))
3568 wand->path_operation=PathLineToHorizontalOperation;
3569 wand->path_mode=mode;
3570 (void) MVGAutoWrapPrintf(wand,"%c%.20g",mode == AbsolutePathMode ?
3574 (void) MVGAutoWrapPrintf(wand," %.20g",x);
3577 WandExport void DrawPathLineToHorizontalAbsolute(DrawingWand *wand,
3580 assert(wand != (DrawingWand *) NULL);
3581 assert(wand->signature == MagickWandSignature);
3582 if (wand->debug != MagickFalse)
3583 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3584 DrawPathLineToHorizontal(wand,AbsolutePathMode,x);
3588 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3592 % D r a w P a t h L i n e T o H o r i z o n t a l R e l a t i v e %
3596 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3598 % DrawPathLineToHorizontalRelative() draws a horizontal line path from the
3599 % current point to the target point using relative coordinates. The target
3600 % point then becomes the new current point.
3602 % The format of the DrawPathLineToHorizontalRelative method is:
3604 % void DrawPathLineToHorizontalRelative(DrawingWand *wand,
3607 % A description of each parameter follows:
3609 % o wand: the drawing wand.
3611 % o x: target x ordinate
3614 WandExport void DrawPathLineToHorizontalRelative(DrawingWand *wand,
3617 DrawPathLineToHorizontal(wand,RelativePathMode,x);
3621 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3625 % D r a w P a t h L i n e T o V e r t i c a l A b s o l u t e %
3629 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3631 % DrawPathLineToVerticalAbsolute() draws a vertical line path from the
3632 % current point to the target point using absolute coordinates. The target
3633 % point then becomes the new current point.
3635 % The format of the DrawPathLineToVerticalAbsolute method is:
3637 % void DrawPathLineToVerticalAbsolute(DrawingWand *wand,
3640 % A description of each parameter follows:
3642 % o wand: the drawing wand.
3644 % o y: target y ordinate
3648 static void DrawPathLineToVertical(DrawingWand *wand,const PathMode mode,
3651 assert(wand != (DrawingWand *) NULL);
3652 assert(wand->signature == MagickWandSignature);
3653 if (wand->debug != MagickFalse)
3654 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3655 if ((wand->path_operation != PathLineToVerticalOperation) ||
3656 (wand->path_mode != mode))
3658 wand->path_operation=PathLineToVerticalOperation;
3659 wand->path_mode=mode;
3660 (void) MVGAutoWrapPrintf(wand,"%c%.20g",mode == AbsolutePathMode ?
3664 (void) MVGAutoWrapPrintf(wand," %.20g",y);
3667 WandExport void DrawPathLineToVerticalAbsolute(DrawingWand *wand,const double y)
3669 assert(wand != (DrawingWand *) NULL);
3670 assert(wand->signature == MagickWandSignature);
3671 if (wand->debug != MagickFalse)
3672 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3673 DrawPathLineToVertical(wand,AbsolutePathMode,y);
3677 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3681 % D r a w P a t h L i n e T o V e r t i c a l R e l a t i v e %
3685 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3687 % DrawPathLineToVerticalRelative() draws a vertical line path from the
3688 % current point to the target point using relative coordinates. The target
3689 % point then becomes the new current point.
3691 % The format of the DrawPathLineToVerticalRelative method is:
3693 % void DrawPathLineToVerticalRelative(DrawingWand *wand,
3696 % A description of each parameter follows:
3698 % o wand: the drawing wand.
3700 % o y: target y ordinate
3703 WandExport void DrawPathLineToVerticalRelative(DrawingWand *wand,const double y)
3705 assert(wand != (DrawingWand *) NULL);
3706 assert(wand->signature == MagickWandSignature);
3707 if (wand->debug != MagickFalse)
3708 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3709 DrawPathLineToVertical(wand,RelativePathMode,y);
3712 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3716 % D r a w P a t h M o v e T o A b s o l u t e %
3720 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3722 % DrawPathMoveToAbsolute() starts a new sub-path at the given coordinate
3723 % using absolute coordinates. The current point then becomes the
3724 % specified coordinate.
3726 % The format of the DrawPathMoveToAbsolute method is:
3728 % void DrawPathMoveToAbsolute(DrawingWand *wand,const double x,
3731 % A description of each parameter follows:
3733 % o wand: the drawing wand.
3735 % o x: target x ordinate
3737 % o y: target y ordinate
3741 static void DrawPathMoveTo(DrawingWand *wand,const PathMode mode,const double x,
3744 assert(wand != (DrawingWand *) NULL);
3745 assert(wand->signature == MagickWandSignature);
3746 if (wand->debug != MagickFalse)
3747 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3748 if ((wand->path_operation != PathMoveToOperation) ||
3749 (wand->path_mode != mode))
3751 wand->path_operation=PathMoveToOperation;
3752 wand->path_mode=mode;
3753 (void) MVGAutoWrapPrintf(wand,"%c%.20g %.20g",mode == AbsolutePathMode ?
3757 (void) MVGAutoWrapPrintf(wand," %.20g %.20g",x,y);
3760 WandExport void DrawPathMoveToAbsolute(DrawingWand *wand,const double x,
3763 assert(wand != (DrawingWand *) NULL);
3764 assert(wand->signature == MagickWandSignature);
3765 if (wand->debug != MagickFalse)
3766 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3767 DrawPathMoveTo(wand,AbsolutePathMode,x,y);
3771 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3775 % D r a w P a t h M o v e T o R e l a t i v e %
3779 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3781 % DrawPathMoveToRelative() starts a new sub-path at the given coordinate using
3782 % relative coordinates. The current point then becomes the specified
3785 % The format of the DrawPathMoveToRelative method is:
3787 % void DrawPathMoveToRelative(DrawingWand *wand,const double x,
3790 % A description of each parameter follows:
3792 % o wand: the drawing wand.
3794 % o x: target x ordinate
3796 % o y: target y ordinate
3799 WandExport void DrawPathMoveToRelative(DrawingWand *wand,const double x,
3802 assert(wand != (DrawingWand *) NULL);
3803 assert(wand->signature == MagickWandSignature);
3804 if (wand->debug != MagickFalse)
3805 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3806 DrawPathMoveTo(wand,RelativePathMode,x,y);
3810 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3814 % D r a w P a t h S t a r t %
3818 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3820 % DrawPathStart() declares the start of a path drawing list which is terminated
3821 % by a matching DrawPathFinish() command. All other DrawPath commands must
3822 % be enclosed between a DrawPathStart() and a DrawPathFinish() command. This
3823 % is because path drawing commands are subordinate commands and they do not
3824 % function by themselves.
3826 % The format of the DrawPathStart method is:
3828 % void DrawPathStart(DrawingWand *wand)
3830 % A description of each parameter follows:
3832 % o wand: the drawing wand.
3835 WandExport void DrawPathStart(DrawingWand *wand)
3837 assert(wand != (DrawingWand *) NULL);
3838 assert(wand->signature == MagickWandSignature);
3839 if (wand->debug != MagickFalse)
3840 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3841 (void) MVGPrintf(wand,"path '");
3842 wand->path_operation=PathDefaultOperation;
3843 wand->path_mode=DefaultPathMode;
3847 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3851 % D r a w P o i n t %
3855 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3857 % DrawPoint() draws a point using the current fill color.
3859 % The format of the DrawPoint method is:
3861 % void DrawPoint(DrawingWand *wand,const double x,const double y)
3863 % A description of each parameter follows:
3865 % o wand: the drawing wand.
3867 % o x: target x coordinate
3869 % o y: target y coordinate
3872 WandExport void DrawPoint(DrawingWand *wand,const double x,const double y)
3874 assert(wand != (DrawingWand *) NULL);
3875 assert(wand->signature == MagickWandSignature);
3876 if (wand->debug != MagickFalse)
3877 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3878 (void) MVGPrintf(wand,"point %.20g %.20g\n",x,y);
3882 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3886 % D r a w P o l y g o n %
3890 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3892 % DrawPolygon() draws a polygon using the current stroke, stroke width, and
3893 % fill color or texture, using the specified array of coordinates.
3895 % The format of the DrawPolygon method is:
3897 % void DrawPolygon(DrawingWand *wand,
3898 % const size_t number_coordinates,const PointInfo *coordinates)
3900 % A description of each parameter follows:
3902 % o wand: the drawing wand.
3904 % o number_coordinates: number of coordinates
3906 % o coordinates: coordinate array
3909 WandExport void DrawPolygon(DrawingWand *wand,
3910 const size_t number_coordinates,const PointInfo *coordinates)
3912 assert(wand != (DrawingWand *) NULL);
3913 assert(wand->signature == MagickWandSignature);
3914 if (wand->debug != MagickFalse)
3915 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3916 MVGAppendPointsCommand(wand,"polygon",number_coordinates,coordinates);
3920 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3924 % D r a w P o l y l i n e %
3928 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3930 % DrawPolyline() draws a polyline using the current stroke, stroke width, and
3931 % fill color or texture, using the specified array of coordinates.
3933 % The format of the DrawPolyline method is:
3935 % void DrawPolyline(DrawingWand *wand,
3936 % const size_t number_coordinates,const PointInfo *coordinates)
3938 % A description of each parameter follows:
3940 % o wand: the drawing wand.
3942 % o number_coordinates: number of coordinates
3944 % o coordinates: coordinate array
3947 WandExport void DrawPolyline(DrawingWand *wand,
3948 const size_t number_coordinates,const PointInfo *coordinates)
3950 assert(wand != (DrawingWand *) NULL);
3951 assert(wand->signature == MagickWandSignature);
3952 if (wand->debug != MagickFalse)
3953 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3954 MVGAppendPointsCommand(wand,"polyline",number_coordinates,coordinates);
3958 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3962 % D r a w P o p C l i p P a t h %
3966 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3968 % DrawPopClipPath() terminates a clip path definition.
3970 % The format of the DrawPopClipPath method is:
3972 % void DrawPopClipPath(DrawingWand *wand)
3974 % A description of each parameter follows:
3976 % o wand: the drawing wand.
3979 WandExport void DrawPopClipPath(DrawingWand *wand)
3981 assert(wand != (DrawingWand *) NULL);
3982 assert(wand->signature == MagickWandSignature);
3983 if (wand->debug != MagickFalse)
3984 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3985 if (wand->indent_depth > 0)
3986 wand->indent_depth--;
3987 (void) MVGPrintf(wand,"pop clip-path\n");
3991 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3995 % D r a w P o p D e f s %
3999 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4001 % DrawPopDefs() terminates a definition list.
4003 % The format of the DrawPopDefs method is:
4005 % void DrawPopDefs(DrawingWand *wand)
4007 % A description of each parameter follows:
4009 % o wand: the drawing wand.
4012 WandExport void DrawPopDefs(DrawingWand *wand)
4014 assert(wand != (DrawingWand *) NULL);
4015 assert(wand->signature == MagickWandSignature);
4016 if (wand->debug != MagickFalse)
4017 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4018 if (wand->indent_depth > 0)
4019 wand->indent_depth--;
4020 (void) MVGPrintf(wand,"pop defs\n");
4024 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4028 % D r a w P o p P a t t e r n %
4032 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4034 % DrawPopPattern() terminates a pattern definition.
4036 % The format of the DrawPopPattern method is:
4038 % MagickBooleanType DrawPopPattern(DrawingWand *wand)
4040 % A description of each parameter follows:
4042 % o wand: the drawing wand.
4045 WandExport MagickBooleanType DrawPopPattern(DrawingWand *wand)
4048 geometry[MagickPathExtent],
4049 key[MagickPathExtent];
4051 assert(wand != (DrawingWand *) NULL);
4052 assert(wand->signature == MagickWandSignature);
4053 if (wand->debug != MagickFalse)
4054 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4055 if (wand->image == (Image *) NULL)
4056 ThrowDrawException(WandError,"ContainsNoImages",wand->name);
4057 if (wand->pattern_id == (const char *) NULL)
4059 ThrowDrawException(DrawWarning,"NotCurrentlyPushingPatternDefinition",
4061 return(MagickFalse);
4063 (void) FormatLocaleString(key,MagickPathExtent,"%s",wand->pattern_id);
4064 (void) SetImageArtifact(wand->image,key,wand->mvg+wand->pattern_offset);
4065 (void) FormatLocaleString(geometry,MagickPathExtent,"%.20gx%.20g%+.20g%+.20g",
4066 (double) wand->pattern_bounds.width,(double) wand->pattern_bounds.height,
4067 (double) wand->pattern_bounds.x,(double) wand->pattern_bounds.y);
4068 (void) SetImageArtifact(wand->image,key,geometry);
4069 wand->pattern_id=DestroyString(wand->pattern_id);
4070 wand->pattern_offset=0;
4071 wand->pattern_bounds.x=0;
4072 wand->pattern_bounds.y=0;
4073 wand->pattern_bounds.width=0;
4074 wand->pattern_bounds.height=0;
4075 wand->filter_off=MagickTrue;
4076 if (wand->indent_depth > 0)
4077 wand->indent_depth--;
4078 (void) MVGPrintf(wand,"pop pattern\n");
4083 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4087 % D r a w P u s h C l i p P a t h %
4091 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4093 % DrawPushClipPath() starts a clip path definition which is comprized of any
4094 % number of drawing commands and terminated by a DrawPopClipPath() command.
4096 % The format of the DrawPushClipPath method is:
4098 % void DrawPushClipPath(DrawingWand *wand,const char *clip_mask_id)
4100 % A description of each parameter follows:
4102 % o wand: the drawing wand.
4104 % o clip_mask_id: string identifier to associate with the clip path for
4108 WandExport void DrawPushClipPath(DrawingWand *wand,const char *clip_mask_id)
4110 assert(wand != (DrawingWand *) NULL);
4111 assert(wand->signature == MagickWandSignature);
4112 if (wand->debug != MagickFalse)
4113 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4114 assert(clip_mask_id != (const char *) NULL);
4115 (void) MVGPrintf(wand,"push clip-path \"%s\"\n",clip_mask_id);
4116 wand->indent_depth++;
4120 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4124 % D r a w P u s h D e f s %
4128 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4130 % DrawPushDefs() indicates that commands up to a terminating DrawPopDefs()
4131 % command create named elements (e.g. clip-paths, textures, etc.) which
4132 % may safely be processed earlier for the sake of efficiency.
4134 % The format of the DrawPushDefs method is:
4136 % void DrawPushDefs(DrawingWand *wand)
4138 % A description of each parameter follows:
4140 % o wand: the drawing wand.
4143 WandExport void DrawPushDefs(DrawingWand *wand)
4145 assert(wand != (DrawingWand *) NULL);
4146 assert(wand->signature == MagickWandSignature);
4147 if (wand->debug != MagickFalse)
4148 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4149 (void) MVGPrintf(wand,"push defs\n");
4150 wand->indent_depth++;
4154 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4158 % D r a w P u s h P a t t e r n %
4162 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4164 % DrawPushPattern() indicates that subsequent commands up to a
4165 % DrawPopPattern() command comprise the definition of a named pattern.
4166 % The pattern space is assigned top left corner coordinates, a width
4167 % and height, and becomes its own drawing space. Anything which can
4168 % be drawn may be used in a pattern definition.
4169 % Named patterns may be used as stroke or brush definitions.
4171 % The format of the DrawPushPattern method is:
4173 % MagickBooleanType DrawPushPattern(DrawingWand *wand,
4174 % const char *pattern_id,const double x,const double y,
4175 % const double width,const double height)
4177 % A description of each parameter follows:
4179 % o wand: the drawing wand.
4181 % o pattern_id: pattern identification for later reference
4183 % o x: x ordinate of top left corner
4185 % o y: y ordinate of top left corner
4187 % o width: width of pattern space
4189 % o height: height of pattern space
4192 WandExport MagickBooleanType DrawPushPattern(DrawingWand *wand,
4193 const char *pattern_id,const double x,const double y,const double width,
4194 const double height)
4196 assert(wand != (DrawingWand *) NULL);
4197 assert(wand->signature == MagickWandSignature);
4198 if (wand->debug != MagickFalse)
4199 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4200 assert(pattern_id != (const char *) NULL);
4201 if (wand->pattern_id != NULL)
4203 ThrowDrawException(DrawError,"AlreadyPushingPatternDefinition",
4205 return(MagickFalse);
4207 wand->filter_off=MagickTrue;
4208 (void) MVGPrintf(wand,"push pattern %s %.20g %.20g %.20g %.20g\n",pattern_id,
4210 wand->indent_depth++;
4211 wand->pattern_id=AcquireString(pattern_id);
4212 wand->pattern_bounds.x=(ssize_t) ceil(x-0.5);
4213 wand->pattern_bounds.y=(ssize_t) ceil(y-0.5);
4214 wand->pattern_bounds.width=(size_t) floor(width+0.5);
4215 wand->pattern_bounds.height=(size_t) floor(height+0.5);
4216 wand->pattern_offset=wand->mvg_length;
4221 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4225 % D r a w R e c t a n g l e %
4229 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4231 % DrawRectangle() draws a rectangle given two coordinates and using the
4232 % current stroke, stroke width, and fill settings.
4234 % The format of the DrawRectangle method is:
4236 % void DrawRectangle(DrawingWand *wand,const double x1,
4237 % const double y1,const double x2,const double y2)
4239 % A description of each parameter follows:
4241 % o x1: x ordinate of first coordinate
4243 % o y1: y ordinate of first coordinate
4245 % o x2: x ordinate of second coordinate
4247 % o y2: y ordinate of second coordinate
4250 WandExport void DrawRectangle(DrawingWand *wand,const double x1,const double y1,
4251 const double x2,const double y2)
4253 assert(wand != (DrawingWand *) NULL);
4254 assert(wand->signature == MagickWandSignature);
4255 if (wand->debug != MagickFalse)
4256 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4257 if ((fabs(x2-x1) < MagickEpsilon) && (fabs(y2-y1) < MagickEpsilon))
4258 (void) MVGPrintf(wand,"point %.20g %.20g\n",x1,y1);
4260 (void) MVGPrintf(wand,"rectangle %.20g %.20g %.20g %.20g\n",x1,y1,x2,y2);
4264 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4268 + D r a w R e n d e r %
4272 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4274 % DrawRender() renders all preceding drawing commands onto the image.
4276 % The format of the DrawRender method is:
4278 % MagickBooleanType DrawRender(DrawingWand *wand)
4280 % A description of each parameter follows:
4282 % o wand: the drawing wand.
4285 WandExport MagickBooleanType DrawRender(DrawingWand *wand)
4290 assert(wand != (const DrawingWand *) NULL);
4291 assert(wand->signature == MagickWandSignature);
4292 if (wand->debug != MagickFalse)
4293 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4294 CurrentContext->primitive=wand->mvg;
4295 if (wand->debug != MagickFalse)
4296 (void) LogMagickEvent(DrawEvent,GetMagickModule(),"MVG:\n'%s'\n",wand->mvg);
4297 if (wand->image == (Image *) NULL)
4298 ThrowDrawException(WandError,"ContainsNoImages",wand->name);
4299 status=DrawImage(wand->image,CurrentContext,wand->exception);
4300 CurrentContext->primitive=(char *) NULL;
4305 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4309 % D r a w R e s e t V e c t o r G r a p h i c s %
4313 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4315 % DrawResetVectorGraphics() resets the vector graphics associated with the
4318 % The format of the DrawResetVectorGraphics method is:
4320 % void DrawResetVectorGraphics(DrawingWand *wand)
4322 % A description of each parameter follows:
4324 % o wand: the drawing wand.
4327 WandExport void DrawResetVectorGraphics(DrawingWand *wand)
4329 assert(wand != (DrawingWand *) NULL);
4330 assert(wand->signature == MagickWandSignature);
4331 if (wand->debug != MagickFalse)
4332 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4333 if (wand->mvg != (char *) NULL)
4334 wand->mvg=DestroyString(wand->mvg);
4341 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4345 % D r a w R o t a t e %
4349 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4351 % DrawRotate() applies the specified rotation to the current coordinate space.
4353 % The format of the DrawRotate method is:
4355 % void DrawRotate(DrawingWand *wand,const double degrees)
4357 % A description of each parameter follows:
4359 % o wand: the drawing wand.
4361 % o degrees: degrees of rotation
4364 WandExport void DrawRotate(DrawingWand *wand,const double degrees)
4366 assert(wand != (DrawingWand *) NULL);
4367 assert(wand->signature == MagickWandSignature);
4368 if (wand->debug != MagickFalse)
4369 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4370 (void) MVGPrintf(wand,"rotate %.20g\n",degrees);
4374 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4378 % D r a w R o u n d R e c t a n g l e %
4382 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4384 % DrawRoundRectangle() draws a rounted rectangle given two coordinates,
4385 % x & y corner radiuses and using the current stroke, stroke width,
4386 % and fill settings.
4388 % The format of the DrawRoundRectangle method is:
4390 % void DrawRoundRectangle(DrawingWand *wand,double x1,double y1,
4391 % double x2,double y2,double rx,double ry)
4393 % A description of each parameter follows:
4395 % o wand: the drawing wand.
4397 % o x1: x ordinate of first coordinate
4399 % o y1: y ordinate of first coordinate
4401 % o x2: x ordinate of second coordinate
4403 % o y2: y ordinate of second coordinate
4405 % o rx: radius of corner in horizontal direction
4407 % o ry: radius of corner in vertical direction
4410 WandExport void DrawRoundRectangle(DrawingWand *wand,double x1,double y1,
4411 double x2,double y2,double rx,double ry)
4413 assert(wand != (DrawingWand *) NULL);
4414 assert(wand->signature == MagickWandSignature);
4415 if (wand->debug != MagickFalse)
4416 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4417 (void) MVGPrintf(wand,"roundrectangle %.20g %.20g %.20g %.20g %.20g %.20g\n",
4422 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4426 % D r a w S c a l e %
4430 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4432 % DrawScale() adjusts the scaling factor to apply in the horizontal and
4433 % vertical directions to the current coordinate space.
4435 % The format of the DrawScale method is:
4437 % void DrawScale(DrawingWand *wand,const double x,const double y)
4439 % A description of each parameter follows:
4441 % o wand: the drawing wand.
4443 % o x: horizontal scale factor
4445 % o y: vertical scale factor
4448 WandExport void DrawScale(DrawingWand *wand,const double x,const double y)
4450 assert(wand != (DrawingWand *) NULL);
4451 assert(wand->signature == MagickWandSignature);
4452 if (wand->debug != MagickFalse)
4453 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4454 (void) MVGPrintf(wand,"scale %.20g %.20g\n",x,y);
4458 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4462 % D r a w S e t B o r d e r C o l o r %
4466 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4468 % DrawSetBorderColor() sets the border color to be used for drawing bordered
4471 % The format of the DrawSetBorderColor method is:
4473 % void DrawSetBorderColor(DrawingWand *wand,const PixelWand *border_wand)
4475 % A description of each parameter follows:
4477 % o wand: the drawing wand.
4479 % o border_wand: border wand.
4482 WandExport void DrawSetBorderColor(DrawingWand *wand,
4483 const PixelWand *border_wand)
4490 assert(wand != (DrawingWand *) NULL);
4491 assert(wand->signature == MagickWandSignature);
4492 if (wand->debug != MagickFalse)
4493 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4494 assert(border_wand != (const PixelWand *) NULL);
4495 PixelGetQuantumPacket(border_wand,&border_color);
4496 new_border=border_color;
4497 current_border=(&CurrentContext->border_color);
4498 if ((wand->filter_off != MagickFalse) ||
4499 (IsPixelInfoEquivalent(current_border,&new_border) == MagickFalse))
4501 CurrentContext->border_color=new_border;
4502 (void) MVGPrintf(wand,"border-color '");
4503 MVGAppendColor(wand,&border_color);
4504 (void) MVGPrintf(wand,"'\n");
4509 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4513 % D r a w S e t C l i p P a t h %
4517 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4519 % DrawSetClipPath() associates a named clipping path with the image. Only
4520 % the areas drawn on by the clipping path will be modified as ssize_t as it
4521 % remains in effect.
4523 % The format of the DrawSetClipPath method is:
4525 % MagickBooleanType DrawSetClipPath(DrawingWand *wand,
4526 % const char *clip_mask)
4528 % A description of each parameter follows:
4530 % o wand: the drawing wand.
4532 % o clip_mask: name of clipping path to associate with image
4535 WandExport MagickBooleanType DrawSetClipPath(DrawingWand *wand,
4536 const char *clip_mask)
4538 if (wand->debug != MagickFalse)
4539 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",clip_mask);
4540 assert(wand != (DrawingWand *) NULL);
4541 assert(wand->signature == MagickWandSignature);
4542 assert(clip_mask != (const char *) NULL);
4543 if ((CurrentContext->clip_mask == (const char *) NULL) ||
4544 (wand->filter_off != MagickFalse) ||
4545 (LocaleCompare(CurrentContext->clip_mask,clip_mask) != 0))
4547 (void) CloneString(&CurrentContext->clip_mask,clip_mask);
4548 #if DRAW_BINARY_IMPLEMENTATION
4549 if (wand->image == (Image *) NULL)
4550 ThrowDrawException(WandError,"ContainsNoImages",wand->name);
4551 (void) DrawClipPath(wand->image,CurrentContext,CurrentContext->clip_mask,
4554 (void) MVGPrintf(wand,"clip-path url(#%s)\n",clip_mask);
4560 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4564 % D r a w S e t C l i p R u l e %
4568 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4570 % DrawSetClipRule() set the polygon fill rule to be used by the clipping path.
4572 % The format of the DrawSetClipRule method is:
4574 % void DrawSetClipRule(DrawingWand *wand,const FillRule fill_rule)
4576 % A description of each parameter follows:
4578 % o wand: the drawing wand.
4580 % o fill_rule: fill rule (EvenOddRule or NonZeroRule)
4583 WandExport void DrawSetClipRule(DrawingWand *wand,const FillRule fill_rule)
4585 assert(wand != (DrawingWand *) NULL);
4586 assert(wand->signature == MagickWandSignature);
4587 if (wand->debug != MagickFalse)
4588 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4589 if ((wand->filter_off != MagickFalse) ||
4590 (CurrentContext->fill_rule != fill_rule))
4592 CurrentContext->fill_rule=fill_rule;
4593 (void) MVGPrintf(wand, "clip-rule '%s'\n",CommandOptionToMnemonic(
4594 MagickFillRuleOptions,(ssize_t) fill_rule));
4599 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4603 % D r a w S e t C l i p U n i t s %
4607 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4609 % DrawSetClipUnits() sets the interpretation of clip path units.
4611 % The format of the DrawSetClipUnits method is:
4613 % void DrawSetClipUnits(DrawingWand *wand,
4614 % const ClipPathUnits clip_units)
4616 % A description of each parameter follows:
4618 % o wand: the drawing wand.
4620 % o clip_units: units to use (UserSpace, UserSpaceOnUse, or
4621 % ObjectBoundingBox)
4624 WandExport void DrawSetClipUnits(DrawingWand *wand,
4625 const ClipPathUnits clip_units)
4627 assert(wand != (DrawingWand *) NULL);
4628 assert(wand->signature == MagickWandSignature);
4629 if (wand->debug != MagickFalse)
4630 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4631 if ((wand->filter_off != MagickFalse) ||
4632 (CurrentContext->clip_units != clip_units))
4634 CurrentContext->clip_units=clip_units;
4635 if (clip_units == ObjectBoundingBox)
4640 GetAffineMatrix(&affine);
4641 affine.sx=CurrentContext->bounds.x2;
4642 affine.sy=CurrentContext->bounds.y2;
4643 affine.tx=CurrentContext->bounds.x1;
4644 affine.ty=CurrentContext->bounds.y1;
4645 AdjustAffine(wand,&affine);
4647 (void) MVGPrintf(wand, "clip-units '%s'\n",CommandOptionToMnemonic(
4648 MagickClipPathOptions,(ssize_t) clip_units));
4653 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4657 % D r a w S e t D e n s i t y %
4661 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4663 % DrawSetDensity() sets the vertical and horizontal resolution.
4665 % The format of the DrawSetDensity method is:
4667 % MagickBooleanType DrawSetDensity(DrawingWand *wand,
4668 % const char *density)
4670 % A description of each parameter follows:
4672 % o wand: the drawing wand.
4674 % o density: the vertical and horizontal resolution.
4677 WandExport MagickBooleanType DrawSetDensity(DrawingWand *wand,
4678 const char *density)
4680 if (wand->debug != MagickFalse)
4681 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",density);
4682 assert(wand != (DrawingWand *) NULL);
4683 assert(wand->signature == MagickWandSignature);
4684 assert(density != (const char *) NULL);
4685 if ((CurrentContext->density == (const char *) NULL) ||
4686 (wand->filter_off != MagickFalse) ||
4687 (LocaleCompare(CurrentContext->density,density) != 0))
4689 (void) CloneString(&CurrentContext->density,density);
4690 (void) MVGPrintf(wand,"density '%s'\n",density);
4696 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4700 % D r a w S e t F i l l C o l o r %
4704 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4706 % DrawSetFillColor() sets the fill color to be used for drawing filled objects.
4708 % The format of the DrawSetFillColor method is:
4710 % void DrawSetFillColor(DrawingWand *wand,const PixelWand *fill_wand)
4712 % A description of each parameter follows:
4714 % o wand: the drawing wand.
4716 % o fill_wand: fill wand.
4719 WandExport void DrawSetFillColor(DrawingWand *wand,const PixelWand *fill_wand)
4726 assert(wand != (DrawingWand *) NULL);
4727 assert(wand->signature == MagickWandSignature);
4728 if (wand->debug != MagickFalse)
4729 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4730 assert(fill_wand != (const PixelWand *) NULL);
4731 PixelGetQuantumPacket(fill_wand,&fill_color);
4732 new_fill=fill_color;
4733 current_fill=(&CurrentContext->fill);
4734 if ((wand->filter_off != MagickFalse) ||
4735 (IsPixelInfoEquivalent(current_fill,&new_fill) == MagickFalse))
4737 CurrentContext->fill=new_fill;
4738 (void) MVGPrintf(wand,"fill '");
4739 MVGAppendColor(wand,&fill_color);
4740 (void) MVGPrintf(wand,"'\n");
4745 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4749 % D r a w S e t F i l l O p a c i t y %
4753 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4755 % DrawSetFillOpacity() sets the alpha to use when drawing using the fill
4756 % color or fill texture. Fully opaque is 1.0.
4758 % The format of the DrawSetFillOpacity method is:
4760 % void DrawSetFillOpacity(DrawingWand *wand,const double fill_alpha)
4762 % A description of each parameter follows:
4764 % o wand: the drawing wand.
4766 % o fill_opacity: fill opacity
4769 WandExport void DrawSetFillOpacity(DrawingWand *wand,const double fill_opacity)
4774 assert(wand != (DrawingWand *) NULL);
4775 assert(wand->signature == MagickWandSignature);
4776 if (wand->debug != MagickFalse)
4777 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4778 alpha=(double) ClampToQuantum(QuantumRange*fill_opacity);
4779 if ((wand->filter_off != MagickFalse) ||
4780 (CurrentContext->fill.alpha != alpha))
4782 CurrentContext->fill.alpha=alpha;
4783 (void) MVGPrintf(wand,"fill-opacity %.20g\n",fill_opacity);
4788 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4792 % D r a w S e t F o n t R e s o l u t i o n %
4796 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4798 % DrawSetFontResolution() sets the image resolution.
4800 % The format of the DrawSetFontResolution method is:
4802 % MagickBooleanType DrawSetFontResolution(DrawingWand *wand,
4803 % const double x_resolution,const double y_resolution)
4805 % A description of each parameter follows:
4807 % o wand: the magick wand.
4809 % o x_resolution: the image x resolution.
4811 % o y_resolution: the image y resolution.
4814 WandExport MagickBooleanType DrawSetFontResolution(DrawingWand *wand,
4815 const double x_resolution,const double y_resolution)
4818 density[MagickPathExtent];
4820 assert(wand != (DrawingWand *) NULL);
4821 assert(wand->signature == MagickWandSignature);
4822 if (wand->debug != MagickFalse)
4823 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4824 (void) FormatLocaleString(density,MagickPathExtent,"%.20gx%.20g",x_resolution,
4826 (void) CloneString(&CurrentContext->density,density);
4831 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4835 % D r a w S e t O p a c i t y %
4839 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4841 % DrawSetOpacity() sets the alpha to use when drawing using the fill or
4842 % stroke color or texture. Fully opaque is 1.0.
4844 % The format of the DrawSetOpacity method is:
4846 % void DrawSetOpacity(DrawingWand *wand,const double alpha)
4848 % A description of each parameter follows:
4850 % o wand: the drawing wand.
4852 % o opacity: fill and stroke opacity. The value 1.0 is opaque.
4855 WandExport void DrawSetOpacity(DrawingWand *wand,const double opacity)
4860 assert(wand != (DrawingWand *) NULL);
4861 assert(wand->signature == MagickWandSignature);
4862 if (wand->debug != MagickFalse)
4863 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4864 quantum_alpha=ClampToQuantum(QuantumRange*opacity);
4865 if ((wand->filter_off != MagickFalse) ||
4866 (CurrentContext->alpha != quantum_alpha))
4868 CurrentContext->alpha=quantum_alpha;
4869 (void) MVGPrintf(wand,"opacity %.20g\n",opacity);
4874 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4878 % D r a w S e t F i l l P a t t e r n U R L %
4882 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4884 % DrawSetFillPatternURL() sets the URL to use as a fill pattern for filling
4885 % objects. Only local URLs ("#identifier") are supported at this time. These
4886 % local URLs are normally created by defining a named fill pattern with
4887 % DrawPushPattern/DrawPopPattern.
4889 % The format of the DrawSetFillPatternURL method is:
4891 % MagickBooleanType DrawSetFillPatternURL(DrawingWand *wand,
4892 % const char *fill_url)
4894 % A description of each parameter follows:
4896 % o wand: the drawing wand.
4898 % o fill_url: URL to use to obtain fill pattern.
4901 WandExport MagickBooleanType DrawSetFillPatternURL(DrawingWand *wand,
4902 const char *fill_url)
4905 pattern[MagickPathExtent],
4906 pattern_spec[MagickPathExtent];
4908 assert(wand != (DrawingWand *) NULL);
4909 assert(wand->signature == MagickWandSignature);
4910 if (wand->debug != MagickFalse)
4911 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",fill_url);
4912 if (wand->image == (Image *) NULL)
4913 ThrowDrawException(WandError,"ContainsNoImages",wand->name);
4914 assert(fill_url != (const char *) NULL);
4915 if (*fill_url != '#')
4917 ThrowDrawException(DrawError,"NotARelativeURL",fill_url);
4918 return(MagickFalse);
4920 (void) FormatLocaleString(pattern,MagickPathExtent,"%s",fill_url+1);
4921 if (GetImageArtifact(wand->image,pattern) == (const char *) NULL)
4923 ThrowDrawException(DrawError,"URLNotFound",fill_url)
4924 return(MagickFalse);
4926 (void) FormatLocaleString(pattern_spec,MagickPathExtent,"url(%s)",fill_url);
4927 #if DRAW_BINARY_IMPLEMENTATION
4928 DrawPatternPath(wand->image,CurrentContext,pattern_spec,
4929 &CurrentContext->fill_pattern);
4931 if (CurrentContext->fill.alpha != (Quantum) TransparentAlpha)
4932 CurrentContext->fill.alpha=(double) CurrentContext->alpha;
4933 (void) MVGPrintf(wand,"fill %s\n",pattern_spec);
4938 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4942 % D r a w S e t F i l l R u l e %
4946 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4948 % DrawSetFillRule() sets the fill rule to use while drawing polygons.
4950 % The format of the DrawSetFillRule method is:
4952 % void DrawSetFillRule(DrawingWand *wand,const FillRule fill_rule)
4954 % A description of each parameter follows:
4956 % o wand: the drawing wand.
4958 % o fill_rule: fill rule (EvenOddRule or NonZeroRule)
4961 WandExport void DrawSetFillRule(DrawingWand *wand,const FillRule fill_rule)
4963 assert(wand != (DrawingWand *) NULL);
4964 assert(wand->signature == MagickWandSignature);
4965 if (wand->debug != MagickFalse)
4966 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4967 if ((wand->filter_off != MagickFalse) ||
4968 (CurrentContext->fill_rule != fill_rule))
4970 CurrentContext->fill_rule=fill_rule;
4971 (void) MVGPrintf(wand, "fill-rule '%s'\n",CommandOptionToMnemonic(
4972 MagickFillRuleOptions,(ssize_t) fill_rule));
4977 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4981 % D r a w S e t F o n t %
4985 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4987 % DrawSetFont() sets the fully-sepecified font to use when annotating with
4990 % The format of the DrawSetFont method is:
4992 % MagickBooleanType DrawSetFont(DrawingWand *wand,const char *font_name)
4994 % A description of each parameter follows:
4996 % o wand: the drawing wand.
4998 % o font_name: font name
5001 WandExport MagickBooleanType DrawSetFont(DrawingWand *wand,
5002 const char *font_name)
5004 assert(wand != (DrawingWand *) NULL);
5005 assert(wand->signature == MagickWandSignature);
5006 if (wand->debug != MagickFalse)
5007 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5008 assert(font_name != (const char *) NULL);
5009 if ((wand->filter_off != MagickFalse) ||
5010 (CurrentContext->font == (char *) NULL) ||
5011 (LocaleCompare(CurrentContext->font,font_name) != 0))
5013 (void) CloneString(&CurrentContext->font,font_name);
5014 (void) MVGPrintf(wand,"font '%s'\n",font_name);
5020 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5024 % D r a w S e t F o n t F a m i l y %
5028 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5030 % DrawSetFontFamily() sets the font family to use when annotating with text.
5032 % The format of the DrawSetFontFamily method is:
5034 % MagickBooleanType DrawSetFontFamily(DrawingWand *wand,
5035 % const char *font_family)
5037 % A description of each parameter follows:
5039 % o wand: the drawing wand.
5041 % o font_family: font family
5044 WandExport MagickBooleanType DrawSetFontFamily(DrawingWand *wand,
5045 const char *font_family)
5047 assert(wand != (DrawingWand *) NULL);
5048 assert(wand->signature == MagickWandSignature);
5049 if (wand->debug != MagickFalse)
5050 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5051 assert(font_family != (const char *) NULL);
5052 if ((wand->filter_off != MagickFalse) ||
5053 (CurrentContext->family == (const char *) NULL) ||
5054 (LocaleCompare(CurrentContext->family,font_family) != 0))
5056 (void) CloneString(&CurrentContext->family,font_family);
5057 (void) MVGPrintf(wand,"font-family '%s'\n",font_family);
5063 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5067 % D r a w S e t F o n t S i z e %
5071 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5073 % DrawSetFontSize() sets the font pointsize to use when annotating with text.
5075 % The format of the DrawSetFontSize method is:
5077 % void DrawSetFontSize(DrawingWand *wand,const double pointsize)
5079 % A description of each parameter follows:
5081 % o wand: the drawing wand.
5083 % o pointsize: text pointsize
5086 WandExport void DrawSetFontSize(DrawingWand *wand,const double pointsize)
5088 assert(wand != (DrawingWand *) NULL);
5089 assert(wand->signature == MagickWandSignature);
5090 if (wand->debug != MagickFalse)
5091 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5092 if ((wand->filter_off != MagickFalse) ||
5093 (fabs(CurrentContext->pointsize-pointsize) >= MagickEpsilon))
5095 CurrentContext->pointsize=pointsize;
5096 (void) MVGPrintf(wand,"font-size %.20g\n",pointsize);
5101 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5105 % D r a w S e t F o n t S t r e t c h %
5109 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5111 % DrawSetFontStretch() sets the font stretch to use when annotating with text.
5112 % The AnyStretch enumeration acts as a wild-card "don't care" option.
5114 % The format of the DrawSetFontStretch method is:
5116 % void DrawSetFontStretch(DrawingWand *wand,
5117 % const StretchType font_stretch)
5119 % A description of each parameter follows:
5121 % o wand: the drawing wand.
5123 % o font_stretch: font stretch (NormalStretch, UltraCondensedStretch,
5124 % CondensedStretch, SemiCondensedStretch,
5125 % SemiExpandedStretch, ExpandedStretch,
5126 % ExtraExpandedStretch, UltraExpandedStretch, AnyStretch)
5129 WandExport void DrawSetFontStretch(DrawingWand *wand,
5130 const StretchType font_stretch)
5132 assert(wand != (DrawingWand *) NULL);
5133 assert(wand->signature == MagickWandSignature);
5134 if (wand->debug != MagickFalse)
5135 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5136 if ((wand->filter_off != MagickFalse) ||
5137 (CurrentContext->stretch != font_stretch))
5139 CurrentContext->stretch=font_stretch;
5140 (void) MVGPrintf(wand, "font-stretch '%s'\n",CommandOptionToMnemonic(
5141 MagickStretchOptions,(ssize_t) font_stretch));
5146 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5150 % D r a w S e t F o n t S t y l e %
5154 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5156 % DrawSetFontStyle() sets the font style to use when annotating with text.
5157 % The AnyStyle enumeration acts as a wild-card "don't care" option.
5159 % The format of the DrawSetFontStyle method is:
5161 % void DrawSetFontStyle(DrawingWand *wand,const StyleType style)
5163 % A description of each parameter follows:
5165 % o wand: the drawing wand.
5167 % o style: font style (NormalStyle, ItalicStyle, ObliqueStyle, AnyStyle)
5170 WandExport void DrawSetFontStyle(DrawingWand *wand,const StyleType style)
5172 assert(wand != (DrawingWand *) NULL);
5173 assert(wand->signature == MagickWandSignature);
5174 if (wand->debug != MagickFalse)
5175 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5176 if ((wand->filter_off != MagickFalse) ||
5177 (CurrentContext->style != style))
5179 CurrentContext->style=style;
5180 (void) MVGPrintf(wand, "font-style '%s'\n",CommandOptionToMnemonic(
5181 MagickStyleOptions,(ssize_t) style));
5186 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5190 % D r a w S e t F o n t W e i g h t %
5194 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5196 % DrawSetFontWeight() sets the font weight to use when annotating with text.
5198 % The format of the DrawSetFontWeight method is:
5200 % void DrawSetFontWeight(DrawingWand *wand,
5201 % const size_t font_weight)
5203 % A description of each parameter follows:
5205 % o wand: the drawing wand.
5207 % o font_weight: font weight (valid range 100-900)
5210 WandExport void DrawSetFontWeight(DrawingWand *wand,
5211 const size_t font_weight)
5213 assert(wand != (DrawingWand *) NULL);
5214 assert(wand->signature == MagickWandSignature);
5215 if (wand->debug != MagickFalse)
5216 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5217 if ((wand->filter_off != MagickFalse) ||
5218 (CurrentContext->weight != font_weight))
5220 CurrentContext->weight=font_weight;
5221 (void) MVGPrintf(wand,"font-weight %.20g\n",(double) font_weight);
5226 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5230 % D r a w S e t G r a v i t y %
5234 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5236 % DrawSetGravity() sets the text placement gravity to use when annotating
5239 % The format of the DrawSetGravity method is:
5241 % void DrawSetGravity(DrawingWand *wand,const GravityType gravity)
5243 % A description of each parameter follows:
5245 % o wand: the drawing wand.
5247 % o gravity: positioning gravity (NorthWestGravity, NorthGravity,
5248 % NorthEastGravity, WestGravity, CenterGravity,
5249 % EastGravity, SouthWestGravity, SouthGravity,
5253 WandExport void DrawSetGravity(DrawingWand *wand,const GravityType gravity)
5255 assert(wand != (DrawingWand *) NULL);
5256 assert(wand->signature == MagickWandSignature);
5257 if (wand->debug != MagickFalse)
5258 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5259 if ((wand->filter_off != MagickFalse) ||
5260 (CurrentContext->gravity != gravity) || (gravity != ForgetGravity))
5262 CurrentContext->gravity=gravity;
5263 (void) MVGPrintf(wand,"gravity '%s'\n",CommandOptionToMnemonic(
5264 MagickGravityOptions,(ssize_t) gravity));
5269 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5273 % D r a w S e t S t r o k e C o l o r %
5277 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5279 % DrawSetStrokeColor() sets the color used for stroking object outlines.
5281 % The format of the DrawSetStrokeColor method is:
5283 % void DrawSetStrokeColor(DrawingWand *wand,
5284 % const PixelWand *stroke_wand)
5286 % A description of each parameter follows:
5288 % o wand: the drawing wand.
5290 % o stroke_wand: stroke wand.
5293 WandExport void DrawSetStrokeColor(DrawingWand *wand,
5294 const PixelWand *stroke_wand)
5301 assert(wand != (DrawingWand *) NULL);
5302 assert(wand->signature == MagickWandSignature);
5303 if (wand->debug != MagickFalse)
5304 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5305 assert(stroke_wand != (const PixelWand *) NULL);
5306 PixelGetQuantumPacket(stroke_wand,&stroke_color);
5307 new_stroke=stroke_color;
5308 current_stroke=(&CurrentContext->stroke);
5309 if ((wand->filter_off != MagickFalse) ||
5310 (IsPixelInfoEquivalent(current_stroke,&new_stroke) == MagickFalse))
5312 CurrentContext->stroke=new_stroke;
5313 (void) MVGPrintf(wand,"stroke '");
5314 MVGAppendColor(wand,&stroke_color);
5315 (void) MVGPrintf(wand,"'\n");
5320 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5324 % D r a w S e t S t r o k e P a t t e r n U R L %
5328 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5330 % DrawSetStrokePatternURL() sets the pattern used for stroking object outlines.
5332 % The format of the DrawSetStrokePatternURL method is:
5334 % MagickBooleanType DrawSetStrokePatternURL(DrawingWand *wand,
5335 % const char *stroke_url)
5337 % A description of each parameter follows:
5339 % o wand: the drawing wand.
5341 % o stroke_url: URL specifying pattern ID (e.g. "#pattern_id")
5344 WandExport MagickBooleanType DrawSetStrokePatternURL(DrawingWand *wand,
5345 const char *stroke_url)
5348 pattern[MagickPathExtent],
5349 pattern_spec[MagickPathExtent];
5351 assert(wand != (DrawingWand *) NULL);
5352 assert(wand->signature == MagickWandSignature);
5353 if (wand->debug != MagickFalse)
5354 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5355 if (wand->image == (Image *) NULL)
5356 ThrowDrawException(WandError,"ContainsNoImages",wand->name);
5357 assert(stroke_url != NULL);
5358 if (stroke_url[0] != '#')
5359 ThrowDrawException(DrawError,"NotARelativeURL",stroke_url);
5360 (void) FormatLocaleString(pattern,MagickPathExtent,"%s",stroke_url+1);
5361 if (GetImageArtifact(wand->image,pattern) == (const char *) NULL)
5363 ThrowDrawException(DrawError,"URLNotFound",stroke_url)
5364 return(MagickFalse);
5366 (void) FormatLocaleString(pattern_spec,MagickPathExtent,"url(%s)",stroke_url);
5367 #if DRAW_BINARY_IMPLEMENTATION
5368 DrawPatternPath(wand->image,CurrentContext,pattern_spec,
5369 &CurrentContext->stroke_pattern);
5371 if (CurrentContext->stroke.alpha != (Quantum) TransparentAlpha)
5372 CurrentContext->stroke.alpha=(double) CurrentContext->alpha;
5373 (void) MVGPrintf(wand,"stroke %s\n",pattern_spec);
5378 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5382 % D r a w S e t S t r o k e A n t i a l i a s %
5386 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5388 % DrawSetStrokeAntialias() controls whether stroked outlines are antialiased.
5389 % Stroked outlines are antialiased by default. When antialiasing is disabled
5390 % stroked pixels are thresholded to determine if the stroke color or
5391 % underlying canvas color should be used.
5393 % The format of the DrawSetStrokeAntialias method is:
5395 % void DrawSetStrokeAntialias(DrawingWand *wand,
5396 % const MagickBooleanType stroke_antialias)
5398 % A description of each parameter follows:
5400 % o wand: the drawing wand.
5402 % o stroke_antialias: set to false (zero) to disable antialiasing
5405 WandExport void DrawSetStrokeAntialias(DrawingWand *wand,
5406 const MagickBooleanType stroke_antialias)
5408 assert(wand != (DrawingWand *) NULL);
5409 assert(wand->signature == MagickWandSignature);
5410 if (wand->debug != MagickFalse)
5411 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5412 if ((wand->filter_off != MagickFalse) ||
5413 (CurrentContext->stroke_antialias != stroke_antialias))
5415 CurrentContext->stroke_antialias=stroke_antialias;
5416 (void) MVGPrintf(wand,"stroke-antialias %i\n",stroke_antialias != 0 ?
5422 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5426 % D r a w S e t S t r o k e D a s h A r r a y %
5430 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5432 % DrawSetStrokeDashArray() specifies the pattern of dashes and gaps used to
5433 % stroke paths. The stroke dash array represents an array of numbers that
5434 % specify the lengths of alternating dashes and gaps in pixels. If an odd
5435 % number of values is provided, then the list of values is repeated to yield
5436 % an even number of values. To remove an existing dash array, pass a zero
5437 % number_elements argument and null dasharray. A typical stroke dash array
5438 % might contain the members 5 3 2.
5440 % The format of the DrawSetStrokeDashArray method is:
5442 % MagickBooleanType DrawSetStrokeDashArray(DrawingWand *wand,
5443 % const size_t number_elements,const double *dasharray)
5445 % A description of each parameter follows:
5447 % o wand: the drawing wand.
5449 % o number_elements: number of elements in dash array
5451 % o dasharray: dash array values
5454 WandExport MagickBooleanType DrawSetStrokeDashArray(DrawingWand *wand,
5455 const size_t number_elements,const double *dasharray)
5460 register const double
5473 assert(wand != (DrawingWand *) NULL);
5474 assert(wand->signature == MagickWandSignature);
5475 if (wand->debug != MagickFalse)
5476 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5477 n_new=number_elements;
5478 if (dasharray == (const double *) NULL)
5482 q=CurrentContext->dash_pattern;
5483 if (q != (const double *) NULL)
5484 while (fabs(*q++) < MagickEpsilon)
5486 if ((n_old == 0) && (n_new == 0))
5492 if ((CurrentContext->dash_pattern != (double *) NULL) &&
5493 (dasharray != (double *) NULL))
5496 q=CurrentContext->dash_pattern;
5497 for (i=0; i < (ssize_t) n_new; i++)
5499 if (fabs((*p)-(*q)) >= MagickEpsilon)
5508 if ((wand->filter_off != MagickFalse) || (update != MagickFalse))
5510 if (CurrentContext->dash_pattern != (double *) NULL)
5511 CurrentContext->dash_pattern=(double *)
5512 RelinquishMagickMemory(CurrentContext->dash_pattern);
5515 CurrentContext->dash_pattern=(double *) AcquireQuantumMemory((size_t)
5516 n_new+1UL,sizeof(*CurrentContext->dash_pattern));
5517 if (CurrentContext->dash_pattern == (double *) NULL)
5519 ThrowDrawException(ResourceLimitError,"MemoryAllocationFailed",
5521 return(MagickFalse);
5523 for (i=0; i < (ssize_t) n_new; i++)
5525 CurrentContext->dash_pattern[i]=0.0;
5526 if (dasharray != (double *) NULL)
5527 CurrentContext->dash_pattern[i]=dasharray[i];
5529 CurrentContext->dash_pattern[n_new]=0.0;
5531 (void) MVGPrintf(wand,"stroke-dasharray ");
5533 (void) MVGPrintf(wand,"none\n");
5535 if (dasharray != (double *) NULL)
5537 for (i=0; i < (ssize_t) n_new; i++)
5540 (void) MVGPrintf(wand,",");
5541 (void) MVGPrintf(wand,"%.20g",dasharray[i]);
5543 (void) MVGPrintf(wand,"\n");
5550 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5554 % D r a w S e t S t r o k e D a s h O f f s e t %
5558 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5560 % DrawSetStrokeDashOffset() specifies the offset into the dash pattern to
5563 % The format of the DrawSetStrokeDashOffset method is:
5565 % void DrawSetStrokeDashOffset(DrawingWand *wand,
5566 % const double dash_offset)
5568 % A description of each parameter follows:
5570 % o wand: the drawing wand.
5572 % o dash_offset: dash offset
5575 WandExport void DrawSetStrokeDashOffset(DrawingWand *wand,
5576 const double dash_offset)
5578 assert(wand != (DrawingWand *) NULL);
5579 assert(wand->signature == MagickWandSignature);
5580 if (wand->debug != MagickFalse)
5581 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5582 if ((wand->filter_off != MagickFalse) ||
5583 (fabs(CurrentContext->dash_offset-dash_offset) >= MagickEpsilon))
5585 CurrentContext->dash_offset=dash_offset;
5586 (void) MVGPrintf(wand,"stroke-dashoffset %.20g\n",dash_offset);
5591 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5595 % D r a w S e t S t r o k e L i n e C a p %
5599 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5601 % DrawSetStrokeLineCap() specifies the shape to be used at the end of
5602 % open subpaths when they are stroked. Values of LineCap are
5603 % UndefinedCap, ButtCap, RoundCap, and SquareCap.
5605 % The format of the DrawSetStrokeLineCap method is:
5607 % void DrawSetStrokeLineCap(DrawingWand *wand,
5608 % const LineCap linecap)
5610 % A description of each parameter follows:
5612 % o wand: the drawing wand.
5614 % o linecap: linecap style
5617 WandExport void DrawSetStrokeLineCap(DrawingWand *wand,const LineCap linecap)
5619 assert(wand != (DrawingWand *) NULL);
5620 assert(wand->signature == MagickWandSignature);
5621 if (wand->debug != MagickFalse)
5622 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5623 if ((wand->filter_off != MagickFalse) || (CurrentContext->linecap != linecap))
5625 CurrentContext->linecap=linecap;
5626 (void) MVGPrintf(wand,"stroke-linecap '%s'\n",CommandOptionToMnemonic(
5627 MagickLineCapOptions,(ssize_t) linecap));
5632 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5636 % D r a w S e t S t r o k e L i n e J o i n %
5640 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5642 % DrawSetStrokeLineJoin() specifies the shape to be used at the corners of
5643 % paths (or other vector shapes) when they are stroked. Values of LineJoin are
5644 % UndefinedJoin, MiterJoin, RoundJoin, and BevelJoin.
5646 % The format of the DrawSetStrokeLineJoin method is:
5648 % void DrawSetStrokeLineJoin(DrawingWand *wand,
5649 % const LineJoin linejoin)
5651 % A description of each parameter follows:
5653 % o wand: the drawing wand.
5655 % o linejoin: line join style
5658 WandExport void DrawSetStrokeLineJoin(DrawingWand *wand,const LineJoin linejoin)
5660 assert(wand != (DrawingWand *) NULL);
5661 assert(wand->signature == MagickWandSignature);
5662 if (wand->debug != MagickFalse)
5663 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5664 if ((wand->filter_off != MagickFalse) ||
5665 (CurrentContext->linejoin != linejoin))
5667 CurrentContext->linejoin=linejoin;
5668 (void) MVGPrintf(wand, "stroke-linejoin '%s'\n",CommandOptionToMnemonic(
5669 MagickLineJoinOptions,(ssize_t) linejoin));
5674 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5678 % D r a w S e t S t r o k e M i t e r L i m i t %
5682 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5684 % DrawSetStrokeMiterLimit() specifies the miter limit. When two line
5685 % segments meet at a sharp angle and miter joins have been specified for
5686 % 'lineJoin', it is possible for the miter to extend far beyond the
5687 % thickness of the line stroking the path. The miterLimit' imposes a
5688 % limit on the ratio of the miter length to the 'lineWidth'.
5690 % The format of the DrawSetStrokeMiterLimit method is:
5692 % void DrawSetStrokeMiterLimit(DrawingWand *wand,
5693 % const size_t miterlimit)
5695 % A description of each parameter follows:
5697 % o wand: the drawing wand.
5699 % o miterlimit: miter limit
5702 WandExport void DrawSetStrokeMiterLimit(DrawingWand *wand,
5703 const size_t miterlimit)
5705 assert(wand != (DrawingWand *) NULL);
5706 assert(wand->signature == MagickWandSignature);
5707 if (wand->debug != MagickFalse)
5708 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5709 if (CurrentContext->miterlimit != miterlimit)
5711 CurrentContext->miterlimit=miterlimit;
5712 (void) MVGPrintf(wand,"stroke-miterlimit %.20g\n",(double) miterlimit);
5717 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5721 % D r a w S e t S t r o k e O p a c i t y %
5725 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5727 % DrawSetStrokeOpacity() specifies the alpha of stroked object outlines.
5729 % The format of the DrawSetStrokeOpacity method is:
5731 % void DrawSetStrokeOpacity(DrawingWand *wand,
5732 % const double stroke_alpha)
5734 % A description of each parameter follows:
5736 % o wand: the drawing wand.
5738 % o opacity: stroke opacity. The value 1.0 is opaque.
5741 WandExport void DrawSetStrokeOpacity(DrawingWand *wand,
5742 const double opacity)
5747 assert(wand != (DrawingWand *) NULL);
5748 assert(wand->signature == MagickWandSignature);
5749 if (wand->debug != MagickFalse)
5750 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5751 alpha=(double) ClampToQuantum(QuantumRange*opacity);
5752 if ((wand->filter_off != MagickFalse) ||
5753 (CurrentContext->stroke.alpha != alpha))
5755 CurrentContext->stroke.alpha=alpha;
5756 (void) MVGPrintf(wand,"stroke-opacity %.20g\n",opacity);
5761 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5765 % D r a w S e t S t r o k e W i d t h %
5769 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5771 % DrawSetStrokeWidth() sets the width of the stroke used to draw object
5774 % The format of the DrawSetStrokeWidth method is:
5776 % void DrawSetStrokeWidth(DrawingWand *wand,
5777 % const double stroke_width)
5779 % A description of each parameter follows:
5781 % o wand: the drawing wand.
5783 % o stroke_width: stroke width
5786 WandExport void DrawSetStrokeWidth(DrawingWand *wand,const double stroke_width)
5788 assert(wand != (DrawingWand *) NULL);
5789 assert(wand->signature == MagickWandSignature);
5790 if (wand->debug != MagickFalse)
5791 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5792 if ((wand->filter_off != MagickFalse) ||
5793 (fabs(CurrentContext->stroke_width-stroke_width) >= MagickEpsilon))
5795 CurrentContext->stroke_width=stroke_width;
5796 (void) MVGPrintf(wand,"stroke-width %.20g\n",stroke_width);
5801 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5805 % D r a w S e t T e x t A l i g n m e n t %
5809 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5811 % DrawSetTextAlignment() specifies a text alignment to be applied when
5812 % annotating with text.
5814 % The format of the DrawSetTextAlignment method is:
5816 % void DrawSetTextAlignment(DrawingWand *wand,const AlignType alignment)
5818 % A description of each parameter follows:
5820 % o wand: the drawing wand.
5822 % o alignment: text alignment. One of UndefinedAlign, LeftAlign,
5823 % CenterAlign, or RightAlign.
5826 WandExport void DrawSetTextAlignment(DrawingWand *wand,
5827 const AlignType alignment)
5829 assert(wand != (DrawingWand *) NULL);
5830 assert(wand->signature == MagickWandSignature);
5831 if (wand->debug != MagickFalse)
5832 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5833 if ((wand->filter_off != MagickFalse) ||
5834 (CurrentContext->align != alignment))
5836 CurrentContext->align=alignment;
5837 (void) MVGPrintf(wand,"text-align '%s'\n",CommandOptionToMnemonic(
5838 MagickAlignOptions,(ssize_t) alignment));
5843 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5847 % D r a w S e t T e x t A n t i a l i a s %
5851 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5853 % DrawSetTextAntialias() controls whether text is antialiased. Text is
5854 % antialiased by default.
5856 % The format of the DrawSetTextAntialias method is:
5858 % void DrawSetTextAntialias(DrawingWand *wand,
5859 % const MagickBooleanType text_antialias)
5861 % A description of each parameter follows:
5863 % o wand: the drawing wand.
5865 % o text_antialias: antialias boolean. Set to false (0) to disable
5869 WandExport void DrawSetTextAntialias(DrawingWand *wand,
5870 const MagickBooleanType text_antialias)
5872 assert(wand != (DrawingWand *) NULL);
5873 assert(wand->signature == MagickWandSignature);
5874 if (wand->debug != MagickFalse)
5875 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5876 if ((wand->filter_off != MagickFalse) ||
5877 (CurrentContext->text_antialias != text_antialias))
5879 CurrentContext->text_antialias=text_antialias;
5880 (void) MVGPrintf(wand,"text-antialias %i\n",text_antialias != 0 ? 1 : 0);
5885 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5889 % D r a w S e t T e x t D e c o r a t i o n %
5893 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5895 % DrawSetTextDecoration() specifies a decoration to be applied when
5896 % annotating with text.
5898 % The format of the DrawSetTextDecoration method is:
5900 % void DrawSetTextDecoration(DrawingWand *wand,
5901 % const DecorationType decoration)
5903 % A description of each parameter follows:
5905 % o wand: the drawing wand.
5907 % o decoration: text decoration. One of NoDecoration, UnderlineDecoration,
5908 % OverlineDecoration, or LineThroughDecoration
5911 WandExport void DrawSetTextDecoration(DrawingWand *wand,
5912 const DecorationType decoration)
5914 assert(wand != (DrawingWand *) NULL);
5915 assert(wand->signature == MagickWandSignature);
5916 if (wand->debug != MagickFalse)
5917 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5918 if ((wand->filter_off != MagickFalse) ||
5919 (CurrentContext->decorate != decoration))
5921 CurrentContext->decorate=decoration;
5922 (void) MVGPrintf(wand,"decorate '%s'\n",CommandOptionToMnemonic(
5923 MagickDecorateOptions,(ssize_t) decoration));
5928 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5932 % D r a w S e t T e x t D i r e c t i o n %
5936 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5938 % DrawSetTextDirection() specifies the direction to be used when
5939 % annotating with text.
5941 % The format of the DrawSetTextDirection method is:
5943 % void DrawSetTextDirection(DrawingWand *wand,
5944 % const DirectionType direction)
5946 % A description of each parameter follows:
5948 % o wand: the drawing wand.
5950 % o direction: text direction. One of RightToLeftDirection,
5951 % LeftToRightDirection
5954 WandExport void DrawSetTextDirection(DrawingWand *wand,
5955 const DirectionType direction)
5957 assert(wand != (DrawingWand *) NULL);
5958 assert(wand->signature == MagickWandSignature);
5960 if (wand->debug != MagickFalse)
5961 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5962 if ((wand->filter_off != MagickFalse) ||
5963 (CurrentContext->direction != direction))
5965 CurrentContext->direction=direction;
5966 (void) MVGPrintf(wand,"direction '%s'\n",CommandOptionToMnemonic(
5967 MagickDirectionOptions,(ssize_t) direction));
5972 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5976 % D r a w S e t T e x t E n c o d i n g %
5980 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5982 % DrawSetTextEncoding() specifies the code set to use for text
5983 % annotations. The only character encoding which may be specified
5984 % at this time is "UTF-8" for representing Unicode as a sequence of
5985 % bytes. Specify an empty string to set text encoding to the system's
5986 % default. Successful text annotation using Unicode may require fonts
5987 % designed to support Unicode.
5989 % The format of the DrawSetTextEncoding method is:
5991 % void DrawSetTextEncoding(DrawingWand *wand,const char *encoding)
5993 % A description of each parameter follows:
5995 % o wand: the drawing wand.
5997 % o encoding: character string specifying text encoding
6000 WandExport void DrawSetTextEncoding(DrawingWand *wand,const char *encoding)
6002 assert(wand != (DrawingWand *) NULL);
6003 assert(wand->signature == MagickWandSignature);
6004 if (wand->debug != MagickFalse)
6005 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6006 assert(encoding != (char *) NULL);
6007 if ((wand->filter_off != MagickFalse) ||
6008 (CurrentContext->encoding == (char *) NULL) ||
6009 (LocaleCompare(CurrentContext->encoding,encoding) != 0))
6011 (void) CloneString(&CurrentContext->encoding,encoding);
6012 (void) MVGPrintf(wand,"encoding '%s'\n",encoding);
6017 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6021 % D r a w S e t T e x t K e r n i n g %
6025 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6027 % DrawSetTextKerning() sets the spacing between characters in text.
6029 % The format of the DrawSetTextKerning method is:
6031 % void DrawSetTextKerning(DrawingWand *wand,const double kerning)
6033 % A description of each parameter follows:
6035 % o wand: the drawing wand.
6037 % o kerning: text kerning
6040 WandExport void DrawSetTextKerning(DrawingWand *wand,const double kerning)
6042 assert(wand != (DrawingWand *) NULL);
6043 assert(wand->signature == MagickWandSignature);
6045 if (wand->debug != MagickFalse)
6046 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6047 if ((wand->filter_off != MagickFalse) &&
6048 (fabs((CurrentContext->kerning-kerning)) >= MagickEpsilon))
6050 CurrentContext->kerning=kerning;
6051 (void) MVGPrintf(wand,"kerning %lf\n",kerning);
6056 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6060 % D r a w S e t T e x t I n t e r l i n e S p a c i n g %
6064 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6066 % DrawSetTextInterlineSpacing() sets the spacing between line in text.
6068 % The format of the DrawSetInterlineSpacing method is:
6070 % void DrawSetTextInterlineSpacing(DrawingWand *wand,
6071 % const double interline_spacing)
6073 % A description of each parameter follows:
6075 % o wand: the drawing wand.
6077 % o interline_spacing: text line spacing
6080 WandExport void DrawSetTextInterlineSpacing(DrawingWand *wand,
6081 const double interline_spacing)
6083 assert(wand != (DrawingWand *) NULL);
6084 assert(wand->signature == MagickWandSignature);
6086 if (wand->debug != MagickFalse)
6087 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6088 if ((wand->filter_off != MagickFalse) ||
6089 (fabs((CurrentContext->interline_spacing-
6090 interline_spacing)) >= MagickEpsilon))
6092 CurrentContext->interline_spacing=interline_spacing;
6093 (void) MVGPrintf(wand,"interline-spacing %lf\n",interline_spacing);
6098 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6102 % D r a w S e t T e x t I n t e r w o r d S p a c i n g %
6106 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6108 % DrawSetTextInterwordSpacing() sets the spacing between words in text.
6110 % The format of the DrawSetInterwordSpacing method is:
6112 % void DrawSetTextInterwordSpacing(DrawingWand *wand,
6113 % const double interword_spacing)
6115 % A description of each parameter follows:
6117 % o wand: the drawing wand.
6119 % o interword_spacing: text word spacing
6122 WandExport void DrawSetTextInterwordSpacing(DrawingWand *wand,
6123 const double interword_spacing)
6125 assert(wand != (DrawingWand *) NULL);
6126 assert(wand->signature == MagickWandSignature);
6128 if (wand->debug != MagickFalse)
6129 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6130 if ((wand->filter_off != MagickFalse) ||
6131 (fabs((CurrentContext->interword_spacing-
6132 interword_spacing)) >= MagickEpsilon))
6134 CurrentContext->interword_spacing=interword_spacing;
6135 (void) MVGPrintf(wand,"interword-spacing %lf\n",interword_spacing);
6140 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6144 % D r a w S e t T e x t U n d e r C o l o r %
6148 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6150 % DrawSetTextUnderColor() specifies the color of a background rectangle
6151 % to place under text annotations.
6153 % The format of the DrawSetTextUnderColor method is:
6155 % void DrawSetTextUnderColor(DrawingWand *wand,
6156 % const PixelWand *under_wand)
6158 % A description of each parameter follows:
6160 % o wand: the drawing wand.
6162 % o under_wand: text under wand.
6165 WandExport void DrawSetTextUnderColor(DrawingWand *wand,
6166 const PixelWand *under_wand)
6171 assert(wand != (DrawingWand *) NULL);
6172 assert(wand->signature == MagickWandSignature);
6173 if (wand->debug != MagickFalse)
6174 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6175 assert(under_wand != (const PixelWand *) NULL);
6176 PixelGetQuantumPacket(under_wand,&under_color);
6177 if ((wand->filter_off != MagickFalse) ||
6178 (IsPixelInfoEquivalent(&CurrentContext->undercolor,&under_color) == MagickFalse))
6180 CurrentContext->undercolor=under_color;
6181 (void) MVGPrintf(wand,"text-undercolor '");
6182 MVGAppendColor(wand,&under_color);
6183 (void) MVGPrintf(wand,"'\n");
6188 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6192 % D r a w S e t V e c t o r G r a p h i c s %
6196 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6198 % DrawSetVectorGraphics() sets the vector graphics associated with the
6199 % specified wand. Use this method with DrawGetVectorGraphics() as a method
6200 % to persist the vector graphics state.
6202 % The format of the DrawSetVectorGraphics method is:
6204 % MagickBooleanType DrawSetVectorGraphics(DrawingWand *wand,
6207 % A description of each parameter follows:
6209 % o wand: the drawing wand.
6211 % o xml: the drawing wand XML.
6215 static inline MagickBooleanType IsPoint(const char *point)
6223 value=strtol(point,&p,10);
6225 return(p != point ? MagickTrue : MagickFalse);
6228 WandExport MagickBooleanType DrawSetVectorGraphics(DrawingWand *wand,
6238 assert(wand != (DrawingWand *) NULL);
6239 assert(wand->signature == MagickWandSignature);
6240 if (wand->debug != MagickFalse)
6241 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6242 CurrentContext=DestroyDrawInfo(CurrentContext);
6243 CurrentContext=CloneDrawInfo((ImageInfo *) NULL,(DrawInfo *) NULL);
6244 if (xml == (const char *) NULL)
6245 return(MagickFalse);
6246 xml_info=NewXMLTree(xml,wand->exception);
6247 if (xml_info == (XMLTreeInfo *) NULL)
6248 return(MagickFalse);
6249 child=GetXMLTreeChild(xml_info,"clip-path");
6250 if (child != (XMLTreeInfo *) NULL)
6251 (void) CloneString(&CurrentContext->clip_mask,GetXMLTreeContent(child));
6252 child=GetXMLTreeChild(xml_info,"clip-units");
6253 if (child != (XMLTreeInfo *) NULL)
6255 value=GetXMLTreeContent(child);
6256 if (value != (const char *) NULL)
6257 CurrentContext->clip_units=(ClipPathUnits) ParseCommandOption(
6258 MagickClipPathOptions,MagickFalse,value);
6260 child=GetXMLTreeChild(xml_info,"decorate");
6261 if (child != (XMLTreeInfo *) NULL)
6263 value=GetXMLTreeContent(child);
6264 if (value != (const char *) NULL)
6265 CurrentContext->decorate=(DecorationType) ParseCommandOption(
6266 MagickDecorateOptions,MagickFalse,value);
6268 child=GetXMLTreeChild(xml_info,"encoding");
6269 if (child != (XMLTreeInfo *) NULL)
6270 (void) CloneString(&CurrentContext->encoding,GetXMLTreeContent(child));
6271 child=GetXMLTreeChild(xml_info,"fill");
6272 if (child != (XMLTreeInfo *) NULL)
6274 value=GetXMLTreeContent(child);
6275 if (value != (const char *) NULL)
6276 (void) QueryColorCompliance(value,AllCompliance,&CurrentContext->fill,
6279 child=GetXMLTreeChild(xml_info,"fill-opacity");
6280 if (child != (XMLTreeInfo *) NULL)
6282 value=GetXMLTreeContent(child);
6283 if (value != (const char *) NULL)
6284 CurrentContext->fill.alpha=(double) ClampToQuantum(QuantumRange*
6285 (1.0-StringToDouble(value,(char **) NULL)));
6287 child=GetXMLTreeChild(xml_info,"fill-rule");
6288 if (child != (XMLTreeInfo *) NULL)
6290 value=GetXMLTreeContent(child);
6291 if (value != (const char *) NULL)
6292 CurrentContext->fill_rule=(FillRule) ParseCommandOption(
6293 MagickFillRuleOptions,MagickFalse,value);
6295 child=GetXMLTreeChild(xml_info,"font");
6296 if (child != (XMLTreeInfo *) NULL)
6297 (void) CloneString(&CurrentContext->font,GetXMLTreeContent(child));
6298 child=GetXMLTreeChild(xml_info,"font-family");
6299 if (child != (XMLTreeInfo *) NULL)
6300 (void) CloneString(&CurrentContext->family,GetXMLTreeContent(child));
6301 child=GetXMLTreeChild(xml_info,"font-size");
6302 if (child != (XMLTreeInfo *) NULL)
6304 value=GetXMLTreeContent(child);
6305 if (value != (const char *) NULL)
6306 CurrentContext->pointsize=StringToDouble(value,(char **) NULL);
6308 child=GetXMLTreeChild(xml_info,"font-stretch");
6309 if (child != (XMLTreeInfo *) NULL)
6311 value=GetXMLTreeContent(child);
6312 if (value != (const char *) NULL)
6313 CurrentContext->stretch=(StretchType) ParseCommandOption(
6314 MagickStretchOptions,MagickFalse,value);
6316 child=GetXMLTreeChild(xml_info,"font-style");
6317 if (child != (XMLTreeInfo *) NULL)
6319 value=GetXMLTreeContent(child);
6320 if (value != (const char *) NULL)
6321 CurrentContext->style=(StyleType) ParseCommandOption(MagickStyleOptions,
6324 child=GetXMLTreeChild(xml_info,"font-weight");
6325 if (child != (XMLTreeInfo *) NULL)
6327 value=GetXMLTreeContent(child);
6328 if (value != (const char *) NULL)
6333 weight=ParseCommandOption(MagickWeightOptions,MagickFalse,value);
6335 weight=(ssize_t) StringToUnsignedLong(value);
6336 CurrentContext->weight=(size_t) weight;
6339 child=GetXMLTreeChild(xml_info,"gravity");
6340 if (child != (XMLTreeInfo *) NULL)
6342 value=GetXMLTreeContent(child);
6343 if (value != (const char *) NULL)
6344 CurrentContext->gravity=(GravityType) ParseCommandOption(
6345 MagickGravityOptions,MagickFalse,value);
6347 child=GetXMLTreeChild(xml_info,"stroke");
6348 if (child != (XMLTreeInfo *) NULL)
6350 value=GetXMLTreeContent(child);
6351 if (value != (const char *) NULL)
6352 (void) QueryColorCompliance(value,AllCompliance,&CurrentContext->stroke,
6355 child=GetXMLTreeChild(xml_info,"stroke-antialias");
6356 if (child != (XMLTreeInfo *) NULL)
6358 value=GetXMLTreeContent(child);
6359 if (value != (const char *) NULL)
6360 CurrentContext->stroke_antialias=StringToLong(value) != 0 ? MagickTrue :
6363 child=GetXMLTreeChild(xml_info,"stroke-dasharray");
6364 if (child != (XMLTreeInfo *) NULL)
6367 token[MagickPathExtent];
6378 value=GetXMLTreeContent(child);
6379 if (value != (const char *) NULL)
6381 if (CurrentContext->dash_pattern != (double *) NULL)
6382 CurrentContext->dash_pattern=(double *) RelinquishMagickMemory(
6383 CurrentContext->dash_pattern);
6385 if (IsPoint(q) != MagickFalse)
6391 GetNextToken(p,&p,MagickPathExtent,token);
6393 GetNextToken(p,&p,MagickPathExtent,token);
6394 for (x=0; IsPoint(token) != MagickFalse; x++)
6396 GetNextToken(p,&p,MagickPathExtent,token);
6398 GetNextToken(p,&p,MagickPathExtent,token);
6400 CurrentContext->dash_pattern=(double *) AcquireQuantumMemory(
6401 (size_t) (2UL*x)+1UL,sizeof(*CurrentContext->dash_pattern));
6402 if (CurrentContext->dash_pattern == (double *) NULL)
6403 ThrowWandFatalException(ResourceLimitFatalError,
6404 "MemoryAllocationFailed",wand->name);
6405 for (j=0; j < x; j++)
6407 GetNextToken(q,&q,MagickPathExtent,token);
6409 GetNextToken(q,&q,MagickPathExtent,token);
6410 CurrentContext->dash_pattern[j]=StringToDouble(token,
6413 if ((x & 0x01) != 0)
6414 for ( ; j < (2*x); j++)
6415 CurrentContext->dash_pattern[j]=
6416 CurrentContext->dash_pattern[j-x];
6417 CurrentContext->dash_pattern[j]=0.0;
6421 child=GetXMLTreeChild(xml_info,"stroke-dashoffset");
6422 if (child != (XMLTreeInfo *) NULL)
6424 value=GetXMLTreeContent(child);
6425 if (value != (const char *) NULL)
6426 CurrentContext->dash_offset=StringToDouble(value,(char **) NULL);
6428 child=GetXMLTreeChild(xml_info,"stroke-linecap");
6429 if (child != (XMLTreeInfo *) NULL)
6431 value=GetXMLTreeContent(child);
6432 if (value != (const char *) NULL)
6433 CurrentContext->linecap=(LineCap) ParseCommandOption(
6434 MagickLineCapOptions,MagickFalse,value);
6436 child=GetXMLTreeChild(xml_info,"stroke-linejoin");
6437 if (child != (XMLTreeInfo *) NULL)
6439 value=GetXMLTreeContent(child);
6440 if (value != (const char *) NULL)
6441 CurrentContext->linejoin=(LineJoin) ParseCommandOption(
6442 MagickLineJoinOptions,MagickFalse,value);
6444 child=GetXMLTreeChild(xml_info,"stroke-miterlimit");
6445 if (child != (XMLTreeInfo *) NULL)
6447 value=GetXMLTreeContent(child);
6448 if (value != (const char *) NULL)
6449 CurrentContext->miterlimit=StringToUnsignedLong(value);
6451 child=GetXMLTreeChild(xml_info,"stroke-opacity");
6452 if (child != (XMLTreeInfo *) NULL)
6454 value=GetXMLTreeContent(child);
6455 if (value != (const char *) NULL)
6456 CurrentContext->stroke.alpha=(double) ClampToQuantum(QuantumRange*
6457 (1.0-StringToDouble(value,(char **) NULL)));
6459 child=GetXMLTreeChild(xml_info,"stroke-width");
6460 if (child != (XMLTreeInfo *) NULL)
6462 value=GetXMLTreeContent(child);
6463 if (value != (const char *) NULL)
6468 weight=ParseCommandOption(MagickWeightOptions,MagickFalse,value);
6470 weight=(ssize_t) StringToUnsignedLong(value);
6471 CurrentContext->stroke_width=(double) weight;
6474 child=GetXMLTreeChild(xml_info,"text-align");
6475 if (child != (XMLTreeInfo *) NULL)
6477 value=GetXMLTreeContent(child);
6478 if (value != (const char *) NULL)
6479 CurrentContext->align=(AlignType) ParseCommandOption(MagickAlignOptions,
6482 child=GetXMLTreeChild(xml_info,"text-antialias");
6483 if (child != (XMLTreeInfo *) NULL)
6485 value=GetXMLTreeContent(child);
6486 if (value != (const char *) NULL)
6487 CurrentContext->text_antialias=StringToLong(value) != 0 ? MagickTrue :
6490 child=GetXMLTreeChild(xml_info,"text-undercolor");
6491 if (child != (XMLTreeInfo *) NULL)
6493 value=GetXMLTreeContent(child);
6494 if (value != (const char *) NULL)
6495 (void) QueryColorCompliance(value,AllCompliance,
6496 &CurrentContext->undercolor,wand->exception);
6498 child=GetXMLTreeChild(xml_info,"vector-graphics");
6499 if (child != (XMLTreeInfo *) NULL)
6501 (void) CloneString(&wand->mvg,GetXMLTreeContent(child));
6502 wand->mvg_length=strlen(wand->mvg);
6503 wand->mvg_alloc=wand->mvg_length+1;
6505 xml_info=DestroyXMLTree(xml_info);
6510 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6514 % D r a w S k e w X %
6518 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6520 % DrawSkewX() skews the current coordinate system in the horizontal
6523 % The format of the DrawSkewX method is:
6525 % void DrawSkewX(DrawingWand *wand,const double degrees)
6527 % A description of each parameter follows:
6529 % o wand: the drawing wand.
6531 % o degrees: number of degrees to skew the coordinates
6534 WandExport void DrawSkewX(DrawingWand *wand,const double degrees)
6536 assert(wand != (DrawingWand *) NULL);
6537 assert(wand->signature == MagickWandSignature);
6538 if (wand->debug != MagickFalse)
6539 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6540 (void) MVGPrintf(wand,"skewX %.20g\n",degrees);
6544 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6548 % D r a w S k e w Y %
6552 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6554 % DrawSkewY() skews the current coordinate system in the vertical
6557 % The format of the DrawSkewY method is:
6559 % void DrawSkewY(DrawingWand *wand,const double degrees)
6561 % A description of each parameter follows:
6563 % o wand: the drawing wand.
6565 % o degrees: number of degrees to skew the coordinates
6568 WandExport void DrawSkewY(DrawingWand *wand,const double degrees)
6570 assert(wand != (DrawingWand *) NULL);
6571 assert(wand->signature == MagickWandSignature);
6572 if (wand->debug != MagickFalse)
6573 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6574 (void) MVGPrintf(wand,"skewY %.20g\n",degrees);
6578 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6582 % D r a w T r a n s l a t e %
6586 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6588 % DrawTranslate() applies a translation to the current coordinate
6589 % system which moves the coordinate system origin to the specified
6592 % The format of the DrawTranslate method is:
6594 % void DrawTranslate(DrawingWand *wand,const double x,
6597 % A description of each parameter follows:
6599 % o wand: the drawing wand.
6601 % o x: new x ordinate for coordinate system origin
6603 % o y: new y ordinate for coordinate system origin
6606 WandExport void DrawTranslate(DrawingWand *wand,const double x,const double y)
6608 assert(wand != (DrawingWand *) NULL);
6609 assert(wand->signature == MagickWandSignature);
6610 if (wand->debug != MagickFalse)
6611 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6612 (void) MVGPrintf(wand,"translate %.20g %.20g\n",x,y);
6616 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6620 % D r a w S e t V i e w b o x %
6624 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6626 % DrawSetViewbox() sets the overall canvas size to be recorded with the
6627 % drawing vector data. Usually this will be specified using the same
6628 % size as the canvas image. When the vector data is saved to SVG or MVG
6629 % formats, the viewbox is use to specify the size of the canvas image that
6630 % a viewer will render the vector data on.
6632 % The format of the DrawSetViewbox method is:
6634 % void DrawSetViewbox(DrawingWand *wand,const double x1,const double y1,
6635 % const double x2,const double y2)
6637 % A description of each parameter follows:
6639 % o wand: the drawing wand.
6641 % o x1: left x ordinate
6643 % o y1: top y ordinate
6645 % o x2: right x ordinate
6647 % o y2: bottom y ordinate
6650 WandExport void DrawSetViewbox(DrawingWand *wand,const double x1,
6651 const double y1,const double x2,const double y2)
6653 assert(wand != (DrawingWand *) NULL);
6654 assert(wand->signature == MagickWandSignature);
6655 if (wand->debug != MagickFalse)
6656 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6657 (void) MVGPrintf(wand,"viewbox %.20g %.20g %.20g %.20g\n",x1,y1,x2,y2);
6661 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6665 % I s D r a w i n g W a n d %
6669 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6671 % IsDrawingWand() returns MagickTrue if the wand is verified as a drawing wand.
6673 % The format of the IsDrawingWand method is:
6675 % MagickBooleanType IsDrawingWand(const DrawingWand *wand)
6677 % A description of each parameter follows:
6679 % o wand: the drawing wand.
6682 WandExport MagickBooleanType IsDrawingWand(const DrawingWand *wand)
6684 if (wand == (const DrawingWand *) NULL)
6685 return(MagickFalse);
6686 if (wand->signature != MagickWandSignature)
6687 return(MagickFalse);
6688 if (LocaleNCompare(wand->name,DrawingWandId,strlen(DrawingWandId)) != 0)
6689 return(MagickFalse);
6694 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6698 % N e w D r a w i n g W a n d %
6702 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6704 % NewDrawingWand() returns a drawing wand required for all other methods in
6707 % The format of the NewDrawingWand method is:
6709 % DrawingWand *NewDrawingWand(void)
6712 WandExport DrawingWand *NewDrawingWand(void)
6723 quantum=GetMagickQuantumDepth(&depth);
6724 if (depth != MAGICKCORE_QUANTUM_DEPTH)
6725 ThrowWandFatalException(WandError,"QuantumDepthMismatch",quantum);
6726 wand=(DrawingWand *) AcquireMagickMemory(sizeof(*wand));
6727 if (wand == (DrawingWand *) NULL)
6728 ThrowWandFatalException(ResourceLimitFatalError,"MemoryAllocationFailed",
6729 GetExceptionMessage(errno));
6730 (void) memset(wand,0,sizeof(*wand));
6731 wand->id=AcquireWandId();
6732 (void) FormatLocaleString(wand->name,MagickPathExtent,"%s-%.20g",
6733 DrawingWandId,(double) wand->id);
6734 if (wand->debug != MagickFalse)
6735 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6736 wand->mvg=(char *) NULL;
6740 wand->pattern_id=(char *) NULL;
6741 wand->pattern_offset=0;
6742 wand->pattern_bounds.x=0;
6743 wand->pattern_bounds.y=0;
6744 wand->pattern_bounds.width=0;
6745 wand->pattern_bounds.height=0;
6747 wand->graphic_context=(DrawInfo **) AcquireMagickMemory(sizeof(
6748 *wand->graphic_context));
6749 if (wand->graphic_context == (DrawInfo **) NULL)
6750 ThrowWandFatalException(ResourceLimitFatalError,"MemoryAllocationFailed",
6751 GetExceptionMessage(errno));
6752 wand->filter_off=MagickTrue;
6753 wand->indent_depth=0;
6754 wand->path_operation=PathDefaultOperation;
6755 wand->path_mode=DefaultPathMode;
6756 wand->exception=AcquireExceptionInfo();
6757 wand->image=AcquireImage((const ImageInfo *) NULL,wand->exception);
6758 wand->destroy=MagickTrue;
6759 wand->debug=IsEventLogging();
6760 wand->signature=MagickWandSignature;
6761 CurrentContext=CloneDrawInfo((ImageInfo *) NULL,(DrawInfo *) NULL);
6766 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6770 % P e e k D r a w i n g W a n d %
6774 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6776 % PeekDrawingWand() returns the current drawing wand.
6778 % The format of the PeekDrawingWand method is:
6780 % DrawInfo *PeekDrawingWand(const DrawingWand *wand)
6782 % A description of each parameter follows:
6784 % o wand: the drawing wand.
6787 WandExport DrawInfo *PeekDrawingWand(const DrawingWand *wand)
6792 assert(wand != (const DrawingWand *) NULL);
6793 assert(wand->signature == MagickWandSignature);
6794 if (wand->debug != MagickFalse)
6795 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6796 draw_info=CloneDrawInfo((ImageInfo *) NULL,CurrentContext);
6797 (void) CloneString(&draw_info->primitive,wand->mvg);
6802 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6806 % P o p D r a w i n g W a n d %
6810 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6812 % PopDrawingWand() destroys the current drawing wand and returns to the
6813 % previously pushed drawing wand. Multiple drawing wands may exist. It is an
6814 % error to attempt to pop more drawing wands than have been pushed, and it is
6815 % proper form to pop all drawing wands which have been pushed.
6817 % The format of the PopDrawingWand method is:
6819 % MagickBooleanType PopDrawingWand(DrawingWand *wand)
6821 % A description of each parameter follows:
6823 % o wand: the drawing wand.
6826 WandExport MagickBooleanType PopDrawingWand(DrawingWand *wand)
6828 assert(wand != (DrawingWand *) NULL);
6829 assert(wand->signature == MagickWandSignature);
6830 if (wand->debug != MagickFalse)
6831 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6832 if (wand->index == 0)
6834 ThrowDrawException(DrawError,"UnbalancedGraphicContextPushPop",wand->name)
6835 return(MagickFalse);
6838 Destroy clip path if not same in preceding wand.
6840 #if DRAW_BINARY_IMPLEMENTATION
6841 if (wand->image == (Image *) NULL)
6842 ThrowDrawException(WandError,"ContainsNoImages",wand->name);
6843 if (CurrentContext->clip_mask != (char *) NULL)
6844 if (LocaleCompare(CurrentContext->clip_mask,
6845 wand->graphic_context[wand->index-1]->clip_mask) != 0)
6846 (void) SetImageMask(wand->image,WritePixelMask,(Image *) NULL,
6849 CurrentContext=DestroyDrawInfo(CurrentContext);
6851 if (wand->indent_depth > 0)
6852 wand->indent_depth--;
6853 (void) MVGPrintf(wand,"pop graphic-context\n");
6858 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6862 % P u s h D r a w i n g W a n d %
6866 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6868 % PushDrawingWand() clones the current drawing wand to create a new drawing
6869 % wand. The original drawing wand(s) may be returned to by invoking
6870 % PopDrawingWand(). The drawing wands are stored on a drawing wand stack.
6871 % For every Pop there must have already been an equivalent Push.
6873 % The format of the PushDrawingWand method is:
6875 % MagickBooleanType PushDrawingWand(DrawingWand *wand)
6877 % A description of each parameter follows:
6879 % o wand: the drawing wand.
6882 WandExport MagickBooleanType PushDrawingWand(DrawingWand *wand)
6884 assert(wand != (DrawingWand *) NULL);
6885 assert(wand->signature == MagickWandSignature);
6886 if (wand->debug != MagickFalse)
6887 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6889 wand->graphic_context=(DrawInfo **) ResizeQuantumMemory(wand->graphic_context,
6890 (size_t) wand->index+1UL,sizeof(*wand->graphic_context));
6891 if (wand->graphic_context == (DrawInfo **) NULL)
6894 ThrowDrawException(ResourceLimitError,"MemoryAllocationFailed",
6896 return(MagickFalse);
6898 CurrentContext=CloneDrawInfo((ImageInfo *) NULL,
6899 wand->graphic_context[wand->index-1]);
6900 (void) MVGPrintf(wand,"push graphic-context\n");
6901 wand->indent_depth++;