drawing-wand.c

Go to the documentation of this file.
00001 /*
00002 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
00003 %                                                                             %
00004 %                                                                             %
00005 %                                                                             %
00006 %               DDDD   RRRR    AAA   W   W  IIIII  N   N    GGGG              %
00007 %               D   D  R   R  A   A  W   W    I    NN  N   G                  %
00008 %               D   D  RRRR   AAAAA  W   W    I    N N N   G  GG              %
00009 %               D   D  R R    A   A  W W W    I    N  NN   G   G              %
00010 %               DDDD   R  R   A   A   W W   IIIII  N   N    GGG               %
00011 %                                                                             %
00012 %                         W   W   AAA   N   N  DDDD                           %
00013 %                         W   W  A   A  NN  N  D   D                          %
00014 %                         W W W  AAAAA  N N N  D   D                          %
00015 %                         WW WW  A   A  N  NN  D   D                          %
00016 %                         W   W  A   A  N   N  DDDD                           %
00017 %                                                                             %
00018 %                                                                             %
00019 %                   MagickWand Image Vector Drawing Methods                   %
00020 %                                                                             %
00021 %                              Software Design                                %
00022 %                              Bob Friesenhahn                                %
00023 %                                March 2002                                   %
00024 %                                                                             %
00025 %                                                                             %
00026 %  Copyright 1999-2009 ImageMagick Studio LLC, a non-profit organization      %
00027 %  dedicated to making software imaging solutions freely available.           %
00028 %                                                                             %
00029 %  You may not use this file except in compliance with the License.  You may  %
00030 %  obtain a copy of the License at                                            %
00031 %                                                                             %
00032 %    http://www.imagemagick.org/script/license.php                            %
00033 %                                                                             %
00034 %  Unless required by applicable law or agreed to in writing, software        %
00035 %  distributed under the License is distributed on an "AS IS" BASIS,          %
00036 %  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.   %
00037 %  See the License for the specific language governing permissions and        %
00038 %  limitations under the License.                                             %
00039 %                                                                             %
00040 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
00041 %
00042 %
00043 %
00044 */
00045 
00046 /*
00047   Include declarations.
00048 */
00049 #include "wand/studio.h"
00050 #include "wand/MagickWand.h"
00051 #include "wand/magick-wand-private.h"
00052 #include "wand/wand.h"
00053 
00054 /*
00055   Define declarations.
00056 */
00057 #define DRAW_BINARY_IMPLEMENTATION 0
00058 
00059 #define CurrentContext  (wand->graphic_context[wand->index])
00060 #define DrawingWandId  "DrawingWand"
00061 #define ThrowDrawException(severity,tag,reason) (void) ThrowMagickException( \
00062   wand->exception,GetMagickModule(),severity,tag,"`%s'",reason);
00063 
00064 /*
00065   Typedef declarations.
00066 */
00067 typedef enum
00068 {
00069   PathDefaultOperation,
00070   PathCloseOperation,                        /* Z|z (none) */
00071   PathCurveToOperation,                      /* C|c (x1 y1 x2 y2 x y)+ */
00072   PathCurveToQuadraticBezierOperation,       /* Q|q (x1 y1 x y)+ */
00073   PathCurveToQuadraticBezierSmoothOperation, /* T|t (x y)+ */
00074   PathCurveToSmoothOperation,                /* S|s (x2 y2 x y)+ */
00075   PathEllipticArcOperation,                  /* A|a (rx ry x-axis-rotation large-arc-flag sweep-flag x y)+ */
00076   PathLineToHorizontalOperation,             /* H|h x+ */
00077   PathLineToOperation,                       /* L|l (x y)+ */
00078   PathLineToVerticalOperation,               /* V|v y+ */
00079   PathMoveToOperation                        /* M|m (x y)+ */
00080 } PathOperation;
00081 
00082 typedef enum
00083 {
00084   DefaultPathMode,
00085   AbsolutePathMode,
00086   RelativePathMode
00087 } PathMode;
00088 
00089 struct _DrawingWand
00090 {
00091   unsigned long
00092     id;
00093 
00094   char
00095     name[MaxTextExtent];
00096 
00097   /* Support structures */
00098   Image
00099     *image;
00100 
00101   ExceptionInfo
00102     *exception;
00103 
00104   /* MVG output string and housekeeping */
00105   char
00106     *mvg;               /* MVG data */
00107 
00108   size_t
00109     mvg_alloc,          /* total allocated memory */
00110     mvg_length;         /* total MVG length */
00111 
00112   unsigned long
00113     mvg_width;          /* current line width */
00114 
00115   /* Pattern support */
00116   char
00117     *pattern_id;
00118 
00119   RectangleInfo
00120     pattern_bounds;
00121 
00122   size_t
00123     pattern_offset;
00124 
00125   /* Graphic wand */
00126   unsigned long
00127     index;              /* array index */
00128 
00129   DrawInfo
00130     **graphic_context;
00131 
00132   MagickBooleanType
00133     filter_off;         /* true if not filtering attributes */
00134 
00135   /* Pretty-printing depth */
00136   unsigned long
00137     indent_depth;       /* number of left-hand pad characters */
00138 
00139   /* Path operation support */
00140   PathOperation
00141     path_operation;
00142 
00143   PathMode
00144     path_mode;
00145 
00146   MagickBooleanType
00147     destroy,
00148     debug;
00149 
00150   unsigned long
00151     signature;
00152 };
00153 
00154 /* Vector table for invoking subordinate renderers */
00155 struct _DrawVTable
00156 {
00157   DrawingWand *(*DestroyDrawingWand) (DrawingWand *);
00158   void (*DrawAnnotation)(DrawingWand *,const double,const double,
00159     const unsigned char *);
00160   void (*DrawArc)(DrawingWand *,const double,const double,const double,
00161     const double,const double,const double);
00162   void (*DrawBezier)(DrawingWand *,const unsigned long,const PointInfo *);
00163   void (*DrawCircle)(DrawingWand *,const double,const double,const double,
00164     const double);
00165   void (*DrawColor)(DrawingWand *,const double,const double,const PaintMethod);
00166   void (*DrawComment)(DrawingWand *,const char *);
00167   void (*DrawEllipse)(DrawingWand *,const double,const double,const double,
00168     const double,const double,const double);
00169   MagickBooleanType (*DrawComposite)(DrawingWand *,const CompositeOperator,
00170     const double,const double,const double,const double,const Image *);
00171   void (*DrawLine)(DrawingWand *,const double,const double,const double,
00172     const double);
00173   void (*DrawMatte)(DrawingWand *,const double,const double,const PaintMethod);
00174   void (*DrawPathClose)(DrawingWand *);
00175   void (*DrawPathCurveToAbsolute)(DrawingWand *,const double,const double,
00176     const double,const double,const double,const double);
00177   void (*DrawPathCurveToRelative)(DrawingWand *,const double,const double,
00178     const double,const double,const double,const double);
00179   void (*DrawPathCurveToQuadraticBezierAbsolute)(DrawingWand *,const double,
00180     const double,const double,const double);
00181   void (*DrawPathCurveToQuadraticBezierRelative)(DrawingWand *,const double,
00182     const double,const double,const double);
00183   void (*DrawPathCurveToQuadraticBezierSmoothAbsolute)(DrawingWand *,
00184     const double,const double);
00185   void (*DrawPathCurveToQuadraticBezierSmoothRelative)(DrawingWand *,
00186     const double,const double);
00187   void (*DrawPathCurveToSmoothAbsolute)(DrawingWand *,const double,
00188     const double,const double,const double);
00189   void (*DrawPathCurveToSmoothRelative)(DrawingWand *,const double,
00190     const double,const double,const double);
00191   void (*DrawPathEllipticArcAbsolute)(DrawingWand *,const double,const double,
00192     const double,const MagickBooleanType,const MagickBooleanType,const double,
00193     const double);
00194   void (*DrawPathEllipticArcRelative)(DrawingWand *,const double,const double,
00195     const double,const MagickBooleanType,const MagickBooleanType,const double,
00196     const double);
00197   void (*DrawPathFinish)(DrawingWand *);
00198   void (*DrawPathLineToAbsolute)(DrawingWand *,const double,const double);
00199   void (*DrawPathLineToRelative)(DrawingWand *,const double,const double);
00200   void (*DrawPathLineToHorizontalAbsolute)(DrawingWand *,const double);
00201   void (*DrawPathLineToHorizontalRelative)(DrawingWand *,const double);
00202   void (*DrawPathLineToVerticalAbsolute)(DrawingWand *,const double);
00203   void (*DrawPathLineToVerticalRelative)(DrawingWand *,const double);
00204   void (*DrawPathMoveToAbsolute)(DrawingWand *,const double,const double);
00205   void (*DrawPathMoveToRelative)(DrawingWand *,const double,const double);
00206   void (*DrawPathStart)(DrawingWand *);
00207   void (*DrawPoint)(DrawingWand *,const double,const double);
00208   void (*DrawPolygon)(DrawingWand *,const unsigned long,const PointInfo *);
00209   void (*DrawPolyline)(DrawingWand *,const unsigned long,const PointInfo *);
00210   void (*DrawPopClipPath)(DrawingWand *);
00211   void (*DrawPopDefs)(DrawingWand *);
00212   MagickBooleanType (*DrawPopPattern)(DrawingWand *);
00213   void (*DrawPushClipPath)(DrawingWand *,const char *);
00214   void (*DrawPushDefs)(DrawingWand *);
00215   MagickBooleanType (*DrawPushPattern)(DrawingWand *,const char *,const double,
00216     const double,const double,const double);
00217   void (*DrawRectangle)(DrawingWand *,const double,const double,const double,
00218     const double);
00219   void (*DrawRoundRectangle)(DrawingWand *,double,double,double,double,
00220     double,double);
00221   void (*DrawAffine)(DrawingWand *,const AffineMatrix *);
00222   MagickBooleanType (*DrawSetClipPath)(DrawingWand *,const char *);
00223   void (*DrawSetBorderColor)(DrawingWand *,const PixelWand *);
00224   void (*DrawSetClipRule)(DrawingWand *,const FillRule);
00225   void (*DrawSetClipUnits)(DrawingWand *,const ClipPathUnits);
00226   void (*DrawSetFillColor)(DrawingWand *,const PixelWand *);
00227   void (*DrawSetFillRule)(DrawingWand *,const FillRule);
00228   MagickBooleanType (*DrawSetFillPatternURL)(DrawingWand *,const char *);
00229   MagickBooleanType (*DrawSetFont)(DrawingWand *,const char *);
00230   MagickBooleanType (*DrawSetFontFamily)(DrawingWand *,const char *);
00231   void (*DrawSetTextKerning)(DrawingWand *,const double);
00232   void (*DrawSetTextInterwordSpacing)(DrawingWand *,const double);
00233   double (*DrawGetTextKerning)(DrawingWand *);
00234   double (*DrawGetTextInterwordSpacing)(DrawingWand *);
00235   void (*DrawSetFontSize)(DrawingWand *,const double);
00236   void (*DrawSetFontStretch)(DrawingWand *,const StretchType);
00237   void (*DrawSetFontStyle)(DrawingWand *,const StyleType);
00238   void (*DrawSetFontWeight)(DrawingWand *,const unsigned long);
00239   void (*DrawSetGravity)(DrawingWand *,const GravityType);
00240   void (*DrawRotate)(DrawingWand *,const double);
00241   void (*DrawScale)(DrawingWand *,const double,const double);
00242   void (*DrawSkewX)(DrawingWand *,const double);
00243   void (*DrawSkewY)(DrawingWand *,const double);
00244   void (*DrawSetStrokeAntialias)(DrawingWand *,const MagickBooleanType);
00245   void (*DrawSetStrokeColor)(DrawingWand *,const PixelWand *);
00246   MagickBooleanType (*DrawSetStrokeDashArray)(DrawingWand *,const double *);
00247   void (*DrawSetStrokeDashOffset)(DrawingWand *,const double);
00248   void (*DrawSetStrokeLineCap)(DrawingWand *,const LineCap);
00249   void (*DrawSetStrokeLineJoin)(DrawingWand *,const LineJoin);
00250   void (*DrawSetStrokeMiterLimit)(DrawingWand *,const unsigned long);
00251   MagickBooleanType (*DrawSetStrokePatternURL)(DrawingWand *,const char *);
00252   void (*DrawSetStrokeWidth)(DrawingWand *,const double);
00253   void (*DrawSetTextAntialias)(DrawingWand *,const MagickBooleanType);
00254   void (*DrawSetTextDecoration)(DrawingWand *,const DecorationType);
00255   void (*DrawSetTextUnderColor)(DrawingWand *,const PixelWand *);
00256   void (*DrawTranslate)(DrawingWand *,const double,const double);
00257   void (*DrawSetViewbox)(DrawingWand *,unsigned long,unsigned long,
00258     unsigned long,unsigned long);
00259   void (*PeekDrawingWand)(DrawingWand *);
00260   MagickBooleanType (*PopDrawingWand)(DrawingWand *);
00261   MagickBooleanType (*PushDrawingWand)(DrawingWand *);
00262 };
00263 
00264 /*
00265   Forward declarations.
00266 */
00267 static int
00268   MvgPrintf(DrawingWand *,const char *,...) wand_attribute((format
00269     (printf,2,3))),
00270   MvgAutoWrapPrintf(DrawingWand *,const char *,...) wand_attribute((format
00271     (printf,2,3)));
00272 
00273 static void
00274   MvgAppendColor(DrawingWand *,const PixelPacket *);
00275 
00276 /*
00277   "Printf" for MVG commands
00278 */
00279 static int MvgPrintf(DrawingWand *wand,const char *format,...)
00280 {
00281   size_t
00282     alloc_size;
00283 
00284   if (wand->debug != MagickFalse)
00285     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",format);
00286   assert(wand != (DrawingWand *) NULL);
00287   assert(wand->signature == WandSignature);
00288   alloc_size=20UL*MaxTextExtent;
00289   if (wand->mvg == (char *) NULL)
00290     {
00291       wand->mvg=(char *) AcquireQuantumMemory(alloc_size,sizeof(*wand->mvg));
00292       if (wand->mvg == (char *) NULL)
00293         {
00294           ThrowDrawException(ResourceLimitError,"MemoryAllocationFailed",
00295             wand->name);
00296           return(-1);
00297         }
00298       wand->mvg_alloc=alloc_size;
00299       wand->mvg_length=0;
00300     }
00301   if (wand->mvg_alloc < (wand->mvg_length+10*MaxTextExtent))
00302     {
00303       size_t
00304         realloc_size;
00305 
00306       realloc_size=wand->mvg_alloc+alloc_size;
00307       wand->mvg=(char *) ResizeQuantumMemory(wand->mvg,realloc_size,
00308         sizeof(*wand->mvg));
00309       if (wand->mvg == (char *) NULL)
00310         {
00311           ThrowDrawException(ResourceLimitError,"MemoryAllocationFailed",
00312             wand->name);
00313           return -1;
00314         }
00315       wand->mvg_alloc=realloc_size;
00316     }
00317   {
00318     int
00319       formatted_length;
00320 
00321     va_list
00322       argp;
00323 
00324     while (wand->mvg_width < wand->indent_depth)
00325     {
00326       wand->mvg[wand->mvg_length]=' ';
00327       wand->mvg_length++;
00328       wand->mvg_width++;
00329     }
00330     wand->mvg[wand->mvg_length]='\0';
00331     va_start(argp, format);
00332 #if defined(MAGICKCORE_HAVE_VSNPRINTF)
00333     formatted_length=vsnprintf(wand->mvg+wand->mvg_length,
00334       wand->mvg_alloc-wand->mvg_length-1,format,argp);
00335 #else
00336     formatted_length=vsprintf(wand->mvg+wand->mvg_length,
00337       format,argp);
00338 #endif
00339     va_end(argp);
00340     if (formatted_length < 0)
00341       ThrowDrawException(DrawError,"UnableToPrint",format)
00342     else
00343       {
00344         wand->mvg_length+=formatted_length;
00345         wand->mvg_width+=formatted_length;
00346       }
00347     wand->mvg[wand->mvg_length]='\0';
00348     if ((wand->mvg_length > 1) &&
00349         (wand->mvg[wand->mvg_length-1] == '\n'))
00350       wand->mvg_width=0;
00351     assert((wand->mvg_length+1) < wand->mvg_alloc);
00352     return formatted_length;
00353   }
00354 }
00355 
00356 static int MvgAutoWrapPrintf(DrawingWand *wand,const char *format,...)
00357 {
00358   char
00359     buffer[MaxTextExtent];
00360 
00361   int
00362     formatted_length;
00363 
00364   va_list
00365     argp;
00366 
00367   va_start(argp,format);
00368 #if defined(MAGICKCORE_HAVE_VSNPRINTF)
00369   formatted_length=vsnprintf(buffer,sizeof(buffer)-1,format,argp);
00370 #else
00371   formatted_length=vsprintf(buffer,format,argp);
00372 #endif
00373   va_end(argp);
00374   *(buffer+sizeof(buffer)-1)='\0';
00375   if (formatted_length < 0)
00376     ThrowDrawException(DrawError,"UnableToPrint",format)
00377   else
00378     {
00379       if (((wand->mvg_width + formatted_length) > 78) &&
00380           (buffer[formatted_length-1] != '\n'))
00381         (void) MvgPrintf(wand, "\n");
00382       (void) MvgPrintf(wand,"%s",buffer);
00383     }
00384   return(formatted_length);
00385 }
00386 
00387 static void MvgAppendColor(DrawingWand *wand,const PixelPacket *color)
00388 {
00389   if ((color->red == 0) && (color->green == 0) && (color->blue == 0) &&
00390      (color->opacity == (Quantum) TransparentOpacity))
00391     (void) MvgPrintf(wand,"none");
00392   else
00393     {
00394       char
00395         tuple[MaxTextExtent];
00396 
00397       MagickPixelPacket
00398         pixel;
00399 
00400       GetMagickPixelPacket(wand->image,&pixel);
00401       pixel.colorspace=RGBColorspace;
00402       pixel.matte=color->opacity != OpaqueOpacity ? MagickTrue : MagickFalse;
00403       pixel.red=(MagickRealType) color->red;
00404       pixel.green=(MagickRealType) color->green;
00405       pixel.blue=(MagickRealType) color->blue;
00406       pixel.opacity=(MagickRealType) color->opacity;
00407       GetColorTuple(&pixel,MagickTrue,tuple);
00408       (void) MvgPrintf(wand,"%s",tuple);
00409     }
00410 }
00411 
00412 static void MvgAppendPointsCommand(DrawingWand *wand,const char *command,
00413   const unsigned long number_coordinates,const PointInfo *coordinates)
00414 {
00415   const PointInfo
00416     *coordinate;
00417 
00418   unsigned long
00419     i;
00420 
00421   (void) MvgPrintf(wand,"%s",command);
00422   for (i=number_coordinates, coordinate=coordinates; i != 0; i--)
00423   {
00424     (void) MvgAutoWrapPrintf(wand," %g,%g",coordinate->x,coordinate->y);
00425     coordinate++;
00426   }
00427   (void) MvgPrintf(wand, "\n");
00428 }
00429 
00430 static void AdjustAffine(DrawingWand *wand,const AffineMatrix *affine)
00431 {
00432   assert(wand != (DrawingWand *) NULL);
00433   assert(wand->signature == WandSignature);
00434   if (wand->debug != MagickFalse)
00435     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
00436   if ((affine->sx != 1.0) || (affine->rx != 0.0) || (affine->ry != 0.0) ||
00437       (affine->sy != 1.0) || (affine->tx != 0.0) || (affine->ty != 0.0))
00438     {
00439       AffineMatrix
00440         current;
00441 
00442       current=CurrentContext->affine;
00443       CurrentContext->affine.sx=current.sx*affine->sx+current.ry*affine->rx;
00444       CurrentContext->affine.rx=current.rx*affine->sx+current.sy*affine->rx;
00445       CurrentContext->affine.ry=current.sx*affine->ry+current.ry*affine->sy;
00446       CurrentContext->affine.sy=current.rx*affine->ry+current.sy*affine->sy;
00447       CurrentContext->affine.tx=current.sx*affine->tx+current.ry*affine->ty+
00448         current.tx;
00449       CurrentContext->affine.ty=current.rx*affine->tx+current.sy*affine->ty+
00450         current.ty;
00451     }
00452 }
00453 
00454 /*
00455 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
00456 %                                                                             %
00457 %                                                                             %
00458 %                                                                             %
00459 %   C l e a r D r a w i n g W a n d                                           %
00460 %                                                                             %
00461 %                                                                             %
00462 %                                                                             %
00463 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
00464 %
00465 %  ClearDrawingWand() clear resources associated with the drawing wand.
00466 %
00467 %  The format of the ClearDrawingWand method is:
00468 %
00469 %      DrawingWand *ClearDrawingWand(DrawingWand *wand)
00470 %
00471 %  A description of each parameter follows:
00472 %
00473 %    o wand: the drawing wand. to destroy
00474 %
00475 */
00476 WandExport void ClearDrawingWand(DrawingWand *wand)
00477 {
00478   assert(wand != (DrawingWand *) NULL);
00479   assert(wand->signature == WandSignature);
00480   if (wand->debug != MagickFalse)
00481     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
00482   for ( ; wand->index > 0; wand->index--)
00483     CurrentContext=DestroyDrawInfo(CurrentContext);
00484   CurrentContext=DestroyDrawInfo(CurrentContext);
00485   wand->graphic_context=(DrawInfo **) RelinquishMagickMemory(
00486     wand->graphic_context);
00487   if (wand->pattern_id != (char *) NULL)
00488     wand->pattern_id=DestroyString(wand->pattern_id);
00489   wand->mvg=DestroyString(wand->mvg);
00490   if ((wand->destroy != MagickFalse) && (wand->image != (Image *) NULL))
00491     wand->image=DestroyImage(wand->image);
00492   else
00493     wand->image=(Image *) NULL;
00494   wand->mvg=(char *) NULL;
00495   wand->mvg_alloc=0;
00496   wand->mvg_length=0;
00497   wand->mvg_width=0;
00498   wand->pattern_id=(char *) NULL;
00499   wand->pattern_offset=0;
00500   wand->pattern_bounds.x=0;
00501   wand->pattern_bounds.y=0;
00502   wand->pattern_bounds.width=0;
00503   wand->pattern_bounds.height=0;
00504   wand->index=0;
00505   wand->graphic_context=(DrawInfo **) AcquireMagickMemory(
00506     sizeof(*wand->graphic_context));
00507   if (wand->graphic_context == (DrawInfo **) NULL)
00508     {
00509       ThrowDrawException(ResourceLimitError,"MemoryAllocationFailed",
00510         wand->name);
00511       return;
00512     }
00513   CurrentContext=CloneDrawInfo((ImageInfo *) NULL,(DrawInfo *) NULL);
00514   wand->filter_off=MagickTrue;
00515   wand->indent_depth=0;
00516   wand->path_operation=PathDefaultOperation;
00517   wand->path_mode=DefaultPathMode;
00518   wand->image=AcquireImage((const ImageInfo *) NULL);
00519   ClearMagickException(wand->exception);
00520   wand->destroy=MagickTrue;
00521   wand->debug=IsEventLogging();
00522 }
00523 
00524 /*
00525 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
00526 %                                                                             %
00527 %                                                                             %
00528 %                                                                             %
00529 %   C l o n e D r a w i n g W a n d                                           %
00530 %                                                                             %
00531 %                                                                             %
00532 %                                                                             %
00533 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
00534 %
00535 %  CloneDrawingWand() makes an exact copy of the specified wand.
00536 %
00537 %  The format of the CloneDrawingWand method is:
00538 %
00539 %      DrawingWand *CloneDrawingWand(const DrawingWand *wand)
00540 %
00541 %  A description of each parameter follows:
00542 %
00543 %    o wand: the magick wand.
00544 %
00545 */
00546 WandExport DrawingWand *CloneDrawingWand(const DrawingWand *wand)
00547 {
00548   DrawingWand
00549     *clone_wand;
00550 
00551   register long
00552     i;
00553 
00554   assert(wand != (DrawingWand *) NULL);
00555   assert(wand->signature == WandSignature);
00556   if (wand->debug != MagickFalse)
00557     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
00558   clone_wand=(DrawingWand *) AcquireMagickMemory(sizeof(*clone_wand));
00559   if (clone_wand == (DrawingWand *) NULL)
00560     ThrowWandFatalException(ResourceLimitFatalError,
00561       "MemoryAllocationFailed",GetExceptionMessage(errno));
00562   (void) ResetMagickMemory(clone_wand,0,sizeof(*clone_wand));
00563   clone_wand->id=AcquireWandId();
00564   (void) FormatMagickString(clone_wand->name,MaxTextExtent,"DrawingWand-%lu",
00565     clone_wand->id);
00566   clone_wand->exception=AcquireExceptionInfo();
00567   InheritException(clone_wand->exception,wand->exception);
00568   clone_wand->mvg=AcquireString(wand->mvg);
00569   clone_wand->mvg_length=strlen(clone_wand->mvg);
00570   clone_wand->mvg_alloc=wand->mvg_length+1;
00571   clone_wand->mvg_width=wand->mvg_width;
00572   clone_wand->pattern_id=AcquireString(wand->pattern_id);
00573   clone_wand->pattern_offset=wand->pattern_offset;
00574   clone_wand->pattern_bounds=wand->pattern_bounds;
00575   clone_wand->index=wand->index;
00576   clone_wand->graphic_context=(DrawInfo **) AcquireQuantumMemory((size_t)
00577     wand->index+1UL,sizeof(*wand->graphic_context));
00578   if (clone_wand->graphic_context == (DrawInfo **) NULL)
00579     ThrowWandFatalException(ResourceLimitFatalError,"MemoryAllocationFailed",
00580       GetExceptionMessage(errno));
00581   for (i=0; i <= (long) wand->index; i++)
00582     clone_wand->graphic_context[i]=
00583       CloneDrawInfo((ImageInfo *) NULL,wand->graphic_context[i]);
00584   clone_wand->filter_off=wand->filter_off;
00585   clone_wand->indent_depth=wand->indent_depth;
00586   clone_wand->path_operation=wand->path_operation;
00587   clone_wand->path_mode=wand->path_mode;
00588   clone_wand->image=wand->image;
00589   if (wand->image != (Image *) NULL)
00590     clone_wand->image=CloneImage(wand->image,0,0,MagickTrue,
00591       clone_wand->exception);
00592   clone_wand->destroy=MagickTrue;
00593   clone_wand->debug=IsEventLogging();
00594   if (clone_wand->debug != MagickFalse)
00595     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",clone_wand->name);
00596   clone_wand->signature=WandSignature;
00597   return(clone_wand);
00598 }
00599 
00600 /*
00601 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
00602 %                                                                             %
00603 %                                                                             %
00604 %                                                                             %
00605 %   D e s t r o y D r a w i n g W a n d                                       %
00606 %                                                                             %
00607 %                                                                             %
00608 %                                                                             %
00609 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
00610 %
00611 %  DestroyDrawingWand() frees all resources associated with the drawing wand.
00612 %  Once the drawing wand has been freed, it should not be used and further
00613 %  unless it re-allocated.
00614 %
00615 %  The format of the DestroyDrawingWand method is:
00616 %
00617 %      DrawingWand *DestroyDrawingWand(DrawingWand *wand)
00618 %
00619 %  A description of each parameter follows:
00620 %
00621 %    o wand: the drawing wand. to destroy
00622 %
00623 */
00624 WandExport DrawingWand *DestroyDrawingWand(DrawingWand *wand)
00625 {
00626   assert(wand != (DrawingWand *) NULL);
00627   assert(wand->signature == WandSignature);
00628   if (wand->debug != MagickFalse)
00629     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
00630   for ( ; wand->index > 0; wand->index--)
00631     CurrentContext=DestroyDrawInfo(CurrentContext);
00632   CurrentContext=DestroyDrawInfo(CurrentContext);
00633   wand->graphic_context=(DrawInfo **) RelinquishMagickMemory(
00634     wand->graphic_context);
00635   if (wand->pattern_id != (char *) NULL)
00636     wand->pattern_id=DestroyString(wand->pattern_id);
00637   wand->mvg=DestroyString(wand->mvg);
00638   if ((wand->destroy != MagickFalse) && (wand->image != (Image *) NULL))
00639     wand->image=DestroyImage(wand->image);
00640   wand->image=(Image *) NULL;
00641   wand->exception=DestroyExceptionInfo(wand->exception);
00642   wand->signature=(~WandSignature);
00643   RelinquishWandId(wand->id);
00644   wand=(DrawingWand *) RelinquishMagickMemory(wand);
00645   return(wand);
00646 }
00647 
00648 /*
00649 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
00650 %                                                                             %
00651 %                                                                             %
00652 %                                                                             %
00653 %   D r a w A f f i n e                                                       %
00654 %                                                                             %
00655 %                                                                             %
00656 %                                                                             %
00657 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
00658 %
00659 %  DrawAffine() adjusts the current affine transformation matrix with
00660 %  the specified affine transformation matrix. Note that the current affine
00661 %  transform is adjusted rather than replaced.
00662 %
00663 %  The format of the DrawAffine method is:
00664 %
00665 %      void DrawAffine(DrawingWand *wand,const AffineMatrix *affine)
00666 %
00667 %  A description of each parameter follows:
00668 %
00669 %    o wand: Drawing wand
00670 %
00671 %    o affine: Affine matrix parameters
00672 %
00673 */
00674 WandExport void DrawAffine(DrawingWand *wand,const AffineMatrix *affine)
00675 {
00676   assert(wand != (DrawingWand *) NULL);
00677   assert(wand->signature == WandSignature);
00678   if (wand->debug != MagickFalse)
00679     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
00680   assert(affine != (const AffineMatrix *) NULL);
00681   AdjustAffine(wand,affine);
00682   (void) MvgPrintf(wand,"affine %g,%g,%g,%g,%g,%g\n",affine->sx,affine->rx,
00683     affine->ry,affine->sy,affine->tx,affine->ty);
00684 }
00685 
00686 /*
00687 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
00688 %                                                                             %
00689 %                                                                             %
00690 %                                                                             %
00691 +   D r a w A l l o c a t e W a n d                                           %
00692 %                                                                             %
00693 %                                                                             %
00694 %                                                                             %
00695 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
00696 %
00697 %  DrawAllocateWand() allocates an initial drawing wand which is an opaque
00698 %  handle required by the remaining drawing methods.
00699 %
00700 %  The format of the DrawAllocateWand method is:
00701 %
00702 %      DrawingWand DrawAllocateWand(const DrawInfo *draw_info,Image *image)
00703 %
00704 %  A description of each parameter follows:
00705 %
00706 %    o draw_info: Initial drawing defaults. Set to NULL to use defaults.
00707 %
00708 %    o image: the image to draw on.
00709 %
00710 */
00711 WandExport DrawingWand *DrawAllocateWand(const DrawInfo *draw_info,Image *image)
00712 {
00713   DrawingWand
00714     *wand;
00715 
00716   wand=NewDrawingWand();
00717   if (draw_info != (const DrawInfo *) NULL)
00718     {
00719       CurrentContext=DestroyDrawInfo(CurrentContext);
00720       CurrentContext=CloneDrawInfo((ImageInfo *) NULL,draw_info);
00721     }
00722   if (image != (Image *) NULL)
00723     {
00724       wand->image=DestroyImage(wand->image);
00725       wand->destroy=MagickFalse;
00726     }
00727   wand->image=image;
00728   return(wand);
00729 }
00730 
00731 /*
00732 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
00733 %                                                                             %
00734 %                                                                             %
00735 %                                                                             %
00736 %   D r a w A n n o t a t i o n                                               %
00737 %                                                                             %
00738 %                                                                             %
00739 %                                                                             %
00740 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
00741 %
00742 %  DrawAnnotation() draws text on the image.
00743 %
00744 %  The format of the DrawAnnotation method is:
00745 %
00746 %      void DrawAnnotation(DrawingWand *wand,const double x,
00747 %        const double y,const unsigned char *text)
00748 %
00749 %  A description of each parameter follows:
00750 %
00751 %    o wand: the drawing wand.
00752 %
00753 %    o x: x ordinate to left of text
00754 %
00755 %    o y: y ordinate to text baseline
00756 %
00757 %    o text: text to draw
00758 %
00759 */
00760 WandExport void DrawAnnotation(DrawingWand *wand,const double x,const double y,
00761   const unsigned char *text)
00762 {
00763   char
00764     *escaped_text;
00765 
00766   assert(wand != (DrawingWand *) NULL);
00767   assert(wand->signature == WandSignature);
00768   if (wand->debug != MagickFalse)
00769     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
00770   assert(text != (const unsigned char *) NULL);
00771   escaped_text=EscapeString((const char *) text,'\'');
00772   (void) MvgPrintf(wand,"text %g,%g '%s'\n",x,y,escaped_text);
00773   escaped_text=DestroyString(escaped_text);
00774 }
00775 
00776 /*
00777 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
00778 %                                                                             %
00779 %                                                                             %
00780 %                                                                             %
00781 %   D r a w A r c                                                             %
00782 %                                                                             %
00783 %                                                                             %
00784 %                                                                             %
00785 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
00786 %
00787 %  DrawArc() draws an arc falling within a specified bounding rectangle on the
00788 %  image.
00789 %
00790 %  The format of the DrawArc method is:
00791 %
00792 %      void DrawArc(DrawingWand *wand,const double sx,const double sy,
00793 %        const double ex,const double ey,const double sd,const double ed)
00794 %
00795 %  A description of each parameter follows:
00796 %
00797 %    o wand: the drawing wand.
00798 %
00799 %    o sx: starting x ordinate of bounding rectangle
00800 %
00801 %    o sy: starting y ordinate of bounding rectangle
00802 %
00803 %    o ex: ending x ordinate of bounding rectangle
00804 %
00805 %    o ey: ending y ordinate of bounding rectangle
00806 %
00807 %    o sd: starting degrees of rotation
00808 %
00809 %    o ed: ending degrees of rotation
00810 %
00811 */
00812 WandExport void DrawArc(DrawingWand *wand,const double sx,const double sy,
00813   const double ex,const double ey,const double sd,const double ed)
00814 {
00815   assert(wand != (DrawingWand *) NULL);
00816   assert(wand->signature == WandSignature);
00817   if (wand->debug != MagickFalse)
00818     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
00819   (void) MvgPrintf(wand,"arc %g,%g %g,%g %g,%g\n",sx,sy,ex,ey,sd,ed);
00820 }
00821 
00822 /*
00823 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
00824 %                                                                             %
00825 %                                                                             %
00826 %                                                                             %
00827 %   D r a w B e z i e r                                                       %
00828 %                                                                             %
00829 %                                                                             %
00830 %                                                                             %
00831 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
00832 %
00833 %  DrawBezier() draws a bezier curve through a set of points on the image.
00834 %
00835 %  The format of the DrawBezier method is:
00836 %
00837 %      void DrawBezier(DrawingWand *wand,
00838 %        const unsigned long number_coordinates,const PointInfo *coordinates)
00839 %
00840 %  A description of each parameter follows:
00841 %
00842 %    o wand: the drawing wand.
00843 %
00844 %    o number_coordinates: number of coordinates
00845 %
00846 %    o coordinates: coordinates
00847 %
00848 */
00849 WandExport void DrawBezier(DrawingWand *wand,
00850   const unsigned long number_coordinates,const PointInfo *coordinates)
00851 {
00852   assert(wand != (DrawingWand *) NULL);
00853   assert(wand->signature == WandSignature);
00854   if (wand->debug != MagickFalse)
00855     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
00856   assert(coordinates != (const PointInfo *) NULL);
00857   MvgAppendPointsCommand(wand,"bezier",number_coordinates,coordinates);
00858 }
00859 
00860 /*
00861 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
00862 %                                                                             %
00863 %                                                                             %
00864 %                                                                             %
00865 %   D r a w C i r c l e                                                       %
00866 %                                                                             %
00867 %                                                                             %
00868 %                                                                             %
00869 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
00870 %
00871 %  DrawCircle() draws a circle on the image.
00872 %
00873 %  The format of the DrawCircle method is:
00874 %
00875 %      void DrawCircle(DrawingWand *wand,const double ox,
00876 %        const double oy,const double px, const double py)
00877 %
00878 %  A description of each parameter follows:
00879 %
00880 %    o wand: the drawing wand.
00881 %
00882 %    o ox: origin x ordinate
00883 %
00884 %    o oy: origin y ordinate
00885 %
00886 %    o px: perimeter x ordinate
00887 %
00888 %    o py: perimeter y ordinate
00889 %
00890 */
00891 WandExport void DrawCircle(DrawingWand *wand,const double ox,const double oy,
00892   const double px,const double py)
00893 {
00894   assert(wand != (DrawingWand *) NULL);
00895   assert(wand->signature == WandSignature);
00896   if (wand->debug != MagickFalse)
00897     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
00898   (void) MvgPrintf(wand,"circle %g,%g %g,%g\n",ox,oy,px,py);
00899 }
00900 
00901 /*
00902 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
00903 %                                                                             %
00904 %                                                                             %
00905 %                                                                             %
00906 %   D r a w C l e a r E x c e p t i o n                                       %
00907 %                                                                             %
00908 %                                                                             %
00909 %                                                                             %
00910 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
00911 %
00912 %  DrawClearException() clear any exceptions associated with the wand.
00913 %
00914 %  The format of the DrawClearException method is:
00915 %
00916 %      MagickBooleanType DrawClearException(DrawWand *wand)
00917 %
00918 %  A description of each parameter follows:
00919 %
00920 %    o wand: the drawing wand.
00921 %
00922 */
00923 WandExport MagickBooleanType DrawClearException(DrawingWand *wand)
00924 {
00925   assert(wand != (DrawingWand *) NULL);
00926   assert(wand->signature == WandSignature);
00927   if (wand->debug != MagickFalse)
00928     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
00929   ClearMagickException(wand->exception);
00930   return(MagickTrue);
00931 }
00932 
00933 /*
00934 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
00935 %                                                                             %
00936 %                                                                             %
00937 %                                                                             %
00938 %   D r a w C o m p o s i t e                                                 %
00939 %                                                                             %
00940 %                                                                             %
00941 %                                                                             %
00942 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
00943 %
00944 %  DrawComposite() composites an image onto the current image, using the
00945 %  specified composition operator, specified position, and at the specified
00946 %  size.
00947 %
00948 %  The format of the DrawComposite method is:
00949 %
00950 %      MagickBooleanType DrawComposite(DrawingWand *wand,
00951 %        const CompositeOperator compose,const double x,
00952 %        const double y,const double width,const double height,
00953 %        MagickWand *magick_wand)
00954 %
00955 %  A description of each parameter follows:
00956 %
00957 %    o wand: the drawing wand.
00958 %
00959 %    o compose: composition operator
00960 %
00961 %    o x: x ordinate of top left corner
00962 %
00963 %    o y: y ordinate of top left corner
00964 %
00965 %    o width: Width to resize image to prior to compositing.  Specify zero to
00966 %      use existing width.
00967 %
00968 %    o height: Height to resize image to prior to compositing.  Specify zero
00969 %      to use existing height.
00970 %
00971 %    o magick_wand: Image to composite is obtained from this wand.
00972 %
00973 */
00974 WandExport MagickBooleanType DrawComposite(DrawingWand *wand,
00975   const CompositeOperator compose,const double x,const double y,
00976   const double width,const double height,MagickWand *magick_wand)
00977 
00978 {
00979   char
00980     *base64,
00981     *media_type;
00982 
00983   const char
00984     *mode;
00985 
00986   ImageInfo
00987     *image_info;
00988 
00989   Image
00990     *clone_image,
00991     *image;
00992 
00993   register char
00994     *p;
00995 
00996   register long
00997     i;
00998 
00999   size_t
01000     blob_length,
01001     encoded_length;
01002 
01003   unsigned char
01004     *blob;
01005 
01006   assert(wand != (DrawingWand *) NULL);
01007   assert(wand->signature == WandSignature);
01008   if (wand->debug != MagickFalse)
01009     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
01010   assert(magick_wand != (MagickWand *) NULL);
01011   image=GetImageFromMagickWand(magick_wand);
01012   if (image == (Image *) NULL)
01013     return(MagickFalse);
01014   clone_image=CloneImage(image,0,0,MagickTrue,wand->exception);
01015   if (clone_image == (Image *) NULL)
01016     return(MagickFalse);
01017   image_info=AcquireImageInfo();
01018   (void) CopyMagickString(image_info->magick,"MIFF",MaxTextExtent);
01019   blob_length=2048;
01020   blob=(unsigned char *) ImageToBlob(image_info,clone_image,&blob_length,
01021     wand->exception);
01022   image_info=DestroyImageInfo(image_info);
01023   clone_image=DestroyImageList(clone_image);
01024   if (blob == (void *) NULL)
01025     return(MagickFalse);
01026   encoded_length=0;
01027   base64=Base64Encode(blob,blob_length,&encoded_length);
01028   blob=(unsigned char *) RelinquishMagickMemory(blob);
01029   if (base64 == (char *) NULL)
01030     {
01031       char
01032         buffer[MaxTextExtent];
01033 
01034       (void) FormatMagickString(buffer,MaxTextExtent,"%ld bytes",
01035         (4L*blob_length/3L+4L));
01036       ThrowDrawException(ResourceLimitWarning,"MemoryAllocationFailed",
01037         wand->name);
01038       return(MagickFalse);
01039     }
01040   mode=MagickOptionToMnemonic(MagickComposeOptions,(long) compose);
01041   media_type=MagickToMime(image->magick);
01042   (void) MvgPrintf(wand,"image %s %g,%g %g,%g 'data:%s;base64,\n",mode,x,y,
01043     width,height,media_type);
01044   p=base64;
01045   for (i=(long) encoded_length; i > 0; i-=76)
01046   {
01047     (void) MvgPrintf(wand,"%.76s",p);
01048     p+=76;
01049     if (i > 76)
01050       (void) MvgPrintf(wand,"\n");
01051   }
01052   (void) MvgPrintf(wand,"'\n");
01053   media_type=DestroyString(media_type);
01054   base64=DestroyString(base64);
01055   return(MagickTrue);
01056 }
01057 
01058 /*
01059 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
01060 %                                                                             %
01061 %                                                                             %
01062 %                                                                             %
01063 %   D r a w C o l o r                                                         %
01064 %                                                                             %
01065 %                                                                             %
01066 %                                                                             %
01067 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
01068 %
01069 %  DrawColor() draws color on image using the current fill color, starting at
01070 %  specified position, and using specified paint method. The available paint
01071 %  methods are:
01072 %
01073 %    PointMethod: Recolors the target pixel
01074 %    ReplaceMethod: Recolor any pixel that matches the target pixel.
01075 %    FloodfillMethod: Recolors target pixels and matching neighbors.
01076 %    ResetMethod: Recolor all pixels.
01077 %
01078 %  The format of the DrawColor method is:
01079 %
01080 %      void DrawColor(DrawingWand *wand,const double x,const double y,
01081 %        const PaintMethod paint_method)
01082 %
01083 %  A description of each parameter follows:
01084 %
01085 %    o wand: the drawing wand.
01086 %
01087 %    o x: x ordinate.
01088 %
01089 %    o y: y ordinate.
01090 %
01091 %    o paint_method: paint method.
01092 %
01093 */
01094 WandExport void DrawColor(DrawingWand *wand,const double x,const double y,
01095   const PaintMethod paint_method)
01096 {
01097   assert(wand != (DrawingWand *) NULL);
01098   assert(wand->signature == WandSignature);
01099   if (wand->debug != MagickFalse)
01100     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
01101   (void) MvgPrintf(wand,"color %g,%g '%s'\n",x,y,MagickOptionToMnemonic(
01102     MagickMethodOptions,(long) paint_method));
01103 }
01104 
01105 /*
01106 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
01107 %                                                                             %
01108 %                                                                             %
01109 %                                                                             %
01110 %   D r a w C o m m e n t                                                     %
01111 %                                                                             %
01112 %                                                                             %
01113 %                                                                             %
01114 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
01115 %
01116 %  DrawComment() adds a comment to a vector output stream.
01117 %
01118 %  The format of the DrawComment method is:
01119 %
01120 %      void DrawComment(DrawingWand *wand,const char *comment)
01121 %
01122 %  A description of each parameter follows:
01123 %
01124 %    o wand: the drawing wand.
01125 %
01126 %    o comment: comment text
01127 %
01128 */
01129 WandExport void DrawComment(DrawingWand *wand,const char *comment)
01130 {
01131   (void) MvgPrintf(wand,"#%s\n",comment);
01132 }
01133 
01134 /*
01135 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
01136 %                                                                             %
01137 %                                                                             %
01138 %                                                                             %
01139 %   D r a w E l l i p s e                                                     %
01140 %                                                                             %
01141 %                                                                             %
01142 %                                                                             %
01143 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
01144 %
01145 %  DrawEllipse() draws an ellipse on the image.
01146 %
01147 %  The format of the DrawEllipse method is:
01148 %
01149 %       void DrawEllipse(DrawingWand *wand,const double ox,const double oy,
01150 %         const double rx,const double ry,const double start,const double end)
01151 %
01152 %  A description of each parameter follows:
01153 %
01154 %    o wand: the drawing wand.
01155 %
01156 %    o ox: origin x ordinate
01157 %
01158 %    o oy: origin y ordinate
01159 %
01160 %    o rx: radius in x
01161 %
01162 %    o ry: radius in y
01163 %
01164 %    o start: starting rotation in degrees
01165 %
01166 %    o end: ending rotation in degrees
01167 %
01168 */
01169 WandExport void DrawEllipse(DrawingWand *wand,const double ox,const double oy,
01170   const double rx,const double ry,const double start,const double end)
01171 {
01172   assert(wand != (DrawingWand *) NULL);
01173   assert(wand->signature == WandSignature);
01174   if (wand->debug != MagickFalse)
01175     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
01176   (void) MvgPrintf(wand,"ellipse %g,%g %g,%g %g,%g\n",ox,oy,rx,ry,start,end);
01177 }
01178 
01179 /*
01180 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
01181 %                                                                             %
01182 %                                                                             %
01183 %                                                                             %
01184 %   D r a w G e t B o r d e r C o l o r                                       %
01185 %                                                                             %
01186 %                                                                             %
01187 %                                                                             %
01188 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
01189 %
01190 %  DrawGetBorderColor() returns the border color used for drawing bordered
01191 %  objects.
01192 %
01193 %  The format of the DrawGetBorderColor method is:
01194 %
01195 %      void DrawGetBorderColor(const DrawingWand *wand,
01196 %        PixelWand *border_color)
01197 %
01198 %  A description of each parameter follows:
01199 %
01200 %    o wand: the drawing wand.
01201 %
01202 %    o border_color: Return the border color.
01203 %
01204 */
01205 WandExport void DrawGetBorderColor(const DrawingWand *wand,
01206   PixelWand *border_color)
01207 {
01208   assert(wand != (const DrawingWand *) NULL);
01209   assert(wand->signature == WandSignature);
01210   assert(border_color != (PixelWand *) NULL);
01211   if (wand->debug != MagickFalse)
01212     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
01213   PixelSetQuantumColor(border_color,&CurrentContext->border_color);
01214 }
01215 
01216 /*
01217 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
01218 %                                                                             %
01219 %                                                                             %
01220 %                                                                             %
01221 %   D r a w G e t C l i p P a t h                                             %
01222 %                                                                             %
01223 %                                                                             %
01224 %                                                                             %
01225 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
01226 %
01227 %  DrawGetClipPath() obtains the current clipping path ID. The value returned
01228 %  must be deallocated by the user when it is no longer needed.
01229 %
01230 %  The format of the DrawGetClipPath method is:
01231 %
01232 %      char *DrawGetClipPath(const DrawingWand *wand)
01233 %
01234 %  A description of each parameter follows:
01235 %
01236 %    o wand: the drawing wand.
01237 %
01238 */
01239 WandExport char *DrawGetClipPath(const DrawingWand *wand)
01240 {
01241   assert(wand != (const DrawingWand *) NULL);
01242   assert(wand->signature == WandSignature);
01243   if (wand->debug != MagickFalse)
01244     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
01245   if (CurrentContext->clip_mask != (char *) NULL)
01246     return((char *) AcquireString(CurrentContext->clip_mask));
01247   return((char *) NULL);
01248 }
01249 
01250 /*
01251 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
01252 %                                                                             %
01253 %                                                                             %
01254 %                                                                             %
01255 %   D r a w G e t C l i p R u l e                                             %
01256 %                                                                             %
01257 %                                                                             %
01258 %                                                                             %
01259 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
01260 %
01261 %  DrawGetClipRule() returns the current polygon fill rule to be used by the
01262 %  clipping path.
01263 %
01264 %  The format of the DrawGetClipRule method is:
01265 %
01266 %     FillRule DrawGetClipRule(const DrawingWand *wand)
01267 %
01268 %  A description of each parameter follows:
01269 %
01270 %    o wand: the drawing wand.
01271 %
01272 */
01273 WandExport FillRule DrawGetClipRule(const DrawingWand *wand)
01274 {
01275   assert(wand != (const DrawingWand *) NULL);
01276   assert(wand->signature == WandSignature);
01277   if (wand->debug != MagickFalse)
01278     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
01279   return(CurrentContext->fill_rule);
01280 }
01281 
01282 /*
01283 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
01284 %                                                                             %
01285 %                                                                             %
01286 %                                                                             %
01287 %   D r a w G e t C l i p U n i t s                                           %
01288 %                                                                             %
01289 %                                                                             %
01290 %                                                                             %
01291 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
01292 %
01293 %  DrawGetClipUnits() returns the interpretation of clip path units.
01294 %
01295 %  The format of the DrawGetClipUnits method is:
01296 %
01297 %      ClipPathUnits DrawGetClipUnits(const DrawingWand *wand)
01298 %
01299 %  A description of each parameter follows:
01300 %
01301 %    o wand: the drawing wand.
01302 %
01303 */
01304 WandExport ClipPathUnits DrawGetClipUnits(const DrawingWand *wand)
01305 {
01306   assert(wand != (const DrawingWand *) NULL);
01307   assert(wand->signature == WandSignature);
01308   if (wand->debug != MagickFalse)
01309     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
01310   return(CurrentContext->clip_units);
01311 }
01312 
01313 /*
01314 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
01315 %                                                                             %
01316 %                                                                             %
01317 %                                                                             %
01318 %   D r a w G e t E x c e p t i o n                                           %
01319 %                                                                             %
01320 %                                                                             %
01321 %                                                                             %
01322 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
01323 %
01324 %  DrawGetException() returns the severity, reason, and description of any
01325 %  error that occurs when using other methods in this API.
01326 %
01327 %  The format of the DrawGetException method is:
01328 %
01329 %      char *DrawGetException(const DrawWand *wand,
01330 %        ExceptionType *severity)
01331 %
01332 %  A description of each parameter follows:
01333 %
01334 %    o wand: the drawing wand.
01335 %
01336 %    o severity: the severity of the error is returned here.
01337 %
01338 */
01339 WandExport char *DrawGetException(const DrawingWand *wand,
01340   ExceptionType *severity)
01341 {
01342   char
01343     *description;
01344 
01345   assert(wand != (const DrawingWand *) NULL);
01346   assert(wand->signature == WandSignature);
01347   if (wand->debug != MagickFalse)
01348     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
01349   assert(severity != (ExceptionType *) NULL);
01350   *severity=wand->exception->severity;
01351   description=(char *) AcquireQuantumMemory(2UL*MaxTextExtent,
01352     sizeof(*description));
01353   if (description == (char *) NULL)
01354     ThrowWandFatalException(ResourceLimitFatalError,"MemoryAllocationFailed",
01355       wand->name);
01356   *description='\0';
01357   if (wand->exception->reason != (char *) NULL)
01358     (void) CopyMagickString(description,GetLocaleExceptionMessage(
01359       wand->exception->severity,wand->exception->reason),
01360       MaxTextExtent);
01361   if (wand->exception->description != (char *) NULL)
01362     {
01363       (void) ConcatenateMagickString(description," (",MaxTextExtent);
01364       (void) ConcatenateMagickString(description,GetLocaleExceptionMessage(
01365         wand->exception->severity,wand->exception->description),
01366         MaxTextExtent);
01367       (void) ConcatenateMagickString(description,")",MaxTextExtent);
01368     }
01369   return(description);
01370 }
01371 
01372 /*
01373 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
01374 %                                                                             %
01375 %                                                                             %
01376 %                                                                             %
01377 %   P i x e l G e t E x c e p t i o n T y p e                                 %
01378 %                                                                             %
01379 %                                                                             %
01380 %                                                                             %
01381 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
01382 %
01383 %  DrawGetExceptionType() the exception type associated with the wand.  If
01384 %  no exception has occurred, UndefinedExceptionType is returned.
01385 %
01386 %  The format of the DrawGetExceptionType method is:
01387 %
01388 %      ExceptionType DrawGetExceptionType(const DrawWand *wand)
01389 %
01390 %  A description of each parameter follows:
01391 %
01392 %    o wand: the magick wand.
01393 %
01394 */
01395 WandExport ExceptionType DrawGetExceptionType(const DrawingWand *wand)
01396 {
01397   assert(wand != (const DrawingWand *) NULL);
01398   assert(wand->signature == WandSignature);
01399   if (wand->debug != MagickFalse)
01400     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
01401   return(wand->exception->severity);
01402 }
01403 
01404 /*
01405 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
01406 %                                                                             %
01407 %                                                                             %
01408 %                                                                             %
01409 %   D r a w G e t F i l l C o l o r                                           %
01410 %                                                                             %
01411 %                                                                             %
01412 %                                                                             %
01413 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
01414 %
01415 %  DrawGetFillColor() returns the fill color used for drawing filled objects.
01416 %
01417 %  The format of the DrawGetFillColor method is:
01418 %
01419 %      void DrawGetFillColor(const DrawingWand *wand,
01420 %        PixelWand *fill_color)
01421 %
01422 %  A description of each parameter follows:
01423 %
01424 %    o wand: the drawing wand.
01425 %
01426 %    o fill_color: Return the fill color.
01427 %
01428 */
01429 WandExport void DrawGetFillColor(const DrawingWand *wand,PixelWand *fill_color)
01430 {
01431   assert(wand != (const DrawingWand *) NULL);
01432   assert(wand->signature == WandSignature);
01433   assert(fill_color != (PixelWand *) NULL);
01434   if (wand->debug != MagickFalse)
01435     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
01436   PixelSetQuantumColor(fill_color,&CurrentContext->fill);
01437 }
01438 
01439 /*
01440 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
01441 %                                                                             %
01442 %                                                                             %
01443 %                                                                             %
01444 %   D r a w G e t F i l l O p a c i t y                                       %
01445 %                                                                             %
01446 %                                                                             %
01447 %                                                                             %
01448 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
01449 %
01450 %  DrawGetFillOpacity() returns the opacity used when drawing using the fill
01451 %  color or fill texture.  Fully opaque is 1.0.
01452 %
01453 %  The format of the DrawGetFillOpacity method is:
01454 %
01455 %      double DrawGetFillOpacity(const DrawingWand *wand)
01456 %
01457 %  A description of each parameter follows:
01458 %
01459 %    o wand: the drawing wand.
01460 %
01461 */
01462 WandExport double DrawGetFillOpacity(const DrawingWand *wand)
01463 {
01464   double
01465     alpha;
01466 
01467   assert(wand != (const DrawingWand *) NULL);
01468   assert(wand->signature == WandSignature);
01469   if (wand->debug != MagickFalse)
01470     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
01471   alpha=(double) QuantumScale*(QuantumRange-CurrentContext->fill.opacity);
01472   return(alpha);
01473 }
01474 
01475 /*
01476 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
01477 %                                                                             %
01478 %                                                                             %
01479 %                                                                             %
01480 %   D r a w G e t F i l l R u l e                                             %
01481 %                                                                             %
01482 %                                                                             %
01483 %                                                                             %
01484 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
01485 %
01486 %  DrawGetFillRule() returns the fill rule used while drawing polygons.
01487 %
01488 %  The format of the DrawGetFillRule method is:
01489 %
01490 %      FillRule DrawGetFillRule(const DrawingWand *wand)
01491 %
01492 %  A description of each parameter follows:
01493 %
01494 %    o wand: the drawing wand.
01495 %
01496 */
01497 WandExport FillRule DrawGetFillRule(const DrawingWand *wand)
01498 {
01499   assert(wand != (const DrawingWand *) NULL);
01500   assert(wand->signature == WandSignature);
01501   if (wand->debug != MagickFalse)
01502     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
01503   return(CurrentContext->fill_rule);
01504 }
01505 
01506 /*
01507 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
01508 %                                                                             %
01509 %                                                                             %
01510 %                                                                             %
01511 %   D r a w G e t F o n t                                                     %
01512 %                                                                             %
01513 %                                                                             %
01514 %                                                                             %
01515 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
01516 %
01517 %  DrawGetFont() returns a null-terminaged string specifying the font used
01518 %  when annotating with text. The value returned must be freed by the user
01519 %  when no longer needed.
01520 %
01521 %  The format of the DrawGetFont method is:
01522 %
01523 %      char *DrawGetFont(const DrawingWand *wand)
01524 %
01525 %  A description of each parameter follows:
01526 %
01527 %    o wand: the drawing wand.
01528 %
01529 */
01530 WandExport char *DrawGetFont(const DrawingWand *wand)
01531 {
01532   assert(wand != (const DrawingWand *) NULL);
01533   assert(wand->signature == WandSignature);
01534   if (wand->debug != MagickFalse)
01535     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
01536   if (CurrentContext->font != (char *) NULL)
01537     return(AcquireString(CurrentContext->font));
01538   return((char *) NULL);
01539 }
01540 
01541 /*
01542 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
01543 %                                                                             %
01544 %                                                                             %
01545 %                                                                             %
01546 %   D r a w G e t F o n t F a m i l y                                         %
01547 %                                                                             %
01548 %                                                                             %
01549 %                                                                             %
01550 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
01551 %
01552 %  DrawGetFontFamily() returns the font family to use when annotating with text.
01553 %  The value returned must be freed by the user when it is no longer needed.
01554 %
01555 %  The format of the DrawGetFontFamily method is:
01556 %
01557 %      char *DrawGetFontFamily(const DrawingWand *wand)
01558 %
01559 %  A description of each parameter follows:
01560 %
01561 %    o wand: the drawing wand.
01562 %
01563 */
01564 WandExport char *DrawGetFontFamily(const DrawingWand *wand)
01565 {
01566   assert(wand != (const DrawingWand *) NULL);
01567   assert(wand->signature == WandSignature);
01568   if (wand->debug != MagickFalse)
01569     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
01570   if (CurrentContext->family != NULL)
01571     return(AcquireString(CurrentContext->family));
01572   return((char *) NULL);
01573 }
01574 
01575 /*
01576 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
01577 %                                                                             %
01578 %                                                                             %
01579 %                                                                             %
01580 %   D r a w G e t F o n t S i z e                                             %
01581 %                                                                             %
01582 %                                                                             %
01583 %                                                                             %
01584 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
01585 %
01586 %  DrawGetFontSize() returns the font pointsize used when annotating with text.
01587 %
01588 %  The format of the DrawGetFontSize method is:
01589 %
01590 %      double DrawGetFontSize(const DrawingWand *wand)
01591 %
01592 %  A description of each parameter follows:
01593 %
01594 %    o wand: the drawing wand.
01595 %
01596 */
01597 WandExport double DrawGetFontSize(const DrawingWand *wand)
01598 {
01599   assert(wand != (const DrawingWand *) NULL);
01600   assert(wand->signature == WandSignature);
01601   if (wand->debug != MagickFalse)
01602     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
01603   return(CurrentContext->pointsize);
01604 }
01605 
01606 /*
01607 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
01608 %                                                                             %
01609 %                                                                             %
01610 %                                                                             %
01611 %   D r a w G e t F o n t S t r e t c h                                       %
01612 %                                                                             %
01613 %                                                                             %
01614 %                                                                             %
01615 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
01616 %
01617 %  DrawGetFontStretch() returns the font stretch used when annotating with text.
01618 %
01619 %  The format of the DrawGetFontStretch method is:
01620 %
01621 %      StretchType DrawGetFontStretch(const DrawingWand *wand)
01622 %
01623 %  A description of each parameter follows:
01624 %
01625 %    o wand: the drawing wand.
01626 %
01627 */
01628 WandExport StretchType DrawGetFontStretch(const DrawingWand *wand)
01629 {
01630   assert(wand != (const DrawingWand *) NULL);
01631   assert(wand->signature == WandSignature);
01632   if (wand->debug != MagickFalse)
01633     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
01634   return(CurrentContext->stretch);
01635 }
01636 
01637 /*
01638 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
01639 %                                                                             %
01640 %                                                                             %
01641 %                                                                             %
01642 %   D r a w G e t F o n t S t y l e                                           %
01643 %                                                                             %
01644 %                                                                             %
01645 %                                                                             %
01646 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
01647 %
01648 %  DrawGetFontStyle() returns the font style used when annotating with text.
01649 %
01650 %  The format of the DrawGetFontStyle method is:
01651 %
01652 %      StyleType DrawGetFontStyle(const DrawingWand *wand)
01653 %
01654 %  A description of each parameter follows:
01655 %
01656 %    o wand: the drawing wand.
01657 %
01658 */
01659 WandExport StyleType DrawGetFontStyle(const DrawingWand *wand)
01660 {
01661   assert(wand != (const DrawingWand *) NULL);
01662   assert(wand->signature == WandSignature);
01663   if (wand->debug != MagickFalse)
01664     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
01665   return(CurrentContext->style);
01666 }
01667 
01668 /*
01669 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
01670 %                                                                             %
01671 %                                                                             %
01672 %                                                                             %
01673 %   D r a w G e t F o n t W e i g h t                                         %
01674 %                                                                             %
01675 %                                                                             %
01676 %                                                                             %
01677 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
01678 %
01679 %  DrawGetFontWeight() returns the font weight used when annotating with text.
01680 %
01681 %  The format of the DrawGetFontWeight method is:
01682 %
01683 %      unsigned long DrawGetFontWeight(const DrawingWand *wand)
01684 %
01685 %  A description of each parameter follows:
01686 %
01687 %    o wand: the drawing wand.
01688 %
01689 */
01690 WandExport unsigned long DrawGetFontWeight(const DrawingWand *wand)
01691 {
01692   assert(wand != (const DrawingWand *) NULL);
01693   assert(wand->signature == WandSignature);
01694   if (wand->debug != MagickFalse)
01695     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
01696   return(CurrentContext->weight);
01697 }
01698 
01699 /*
01700 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
01701 %                                                                             %
01702 %                                                                             %
01703 %                                                                             %
01704 %   D r a w G e t G r a v i t y                                               %
01705 %                                                                             %
01706 %                                                                             %
01707 %                                                                             %
01708 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
01709 %
01710 %  DrawGetGravity() returns the text placement gravity used when annotating
01711 %  with text.
01712 %
01713 %  The format of the DrawGetGravity method is:
01714 %
01715 %      GravityType DrawGetGravity(const DrawingWand *wand)
01716 %
01717 %  A description of each parameter follows:
01718 %
01719 %    o wand: the drawing wand.
01720 %
01721 */
01722 WandExport GravityType DrawGetGravity(const DrawingWand *wand)
01723 {
01724   assert(wand != (const DrawingWand *) NULL);
01725   assert(wand->signature == WandSignature);
01726   if (wand->debug != MagickFalse)
01727     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
01728   return(CurrentContext->gravity);
01729 }
01730 
01731 /*
01732 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
01733 %                                                                             %
01734 %                                                                             %
01735 %                                                                             %
01736 %   D r a w G e t O p a c i t y                                               %
01737 %                                                                             %
01738 %                                                                             %
01739 %                                                                             %
01740 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
01741 %
01742 %  DrawGetOpacity() returns the opacity used when drawing with the fill
01743 %  or stroke color or texture.  Fully opaque is 1.0.
01744 %
01745 %  The format of the DrawGetOpacity method is:
01746 %
01747 %      double DrawGetOpacity(const DrawingWand *wand)
01748 %
01749 %  A description of each parameter follows:
01750 %
01751 %    o wand: the drawing wand.
01752 %
01753 */
01754 WandExport double DrawGetOpacity(const DrawingWand *wand)
01755 {
01756   double
01757     alpha;
01758 
01759   assert(wand != (const DrawingWand *) NULL);
01760   assert(wand->signature == WandSignature);
01761   if (wand->debug != MagickFalse)
01762     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
01763   alpha=(double) QuantumScale*(QuantumRange-CurrentContext->opacity);
01764   return(alpha);
01765 }
01766 
01767 /*
01768 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
01769 %                                                                             %
01770 %                                                                             %
01771 %                                                                             %
01772 %   D r a w G e t S t r o k e A n t i a l i a s                               %
01773 %                                                                             %
01774 %                                                                             %
01775 %                                                                             %
01776 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
01777 %
01778 %  DrawGetStrokeAntialias() returns the current stroke antialias setting.
01779 %  Stroked outlines are antialiased by default.  When antialiasing is disabled
01780 %  stroked pixels are thresholded to determine if the stroke color or
01781 %  underlying canvas color should be used.
01782 %
01783 %  The format of the DrawGetStrokeAntialias method is:
01784 %
01785 %      MagickBooleanType DrawGetStrokeAntialias(const DrawingWand *wand)
01786 %
01787 %  A description of each parameter follows:
01788 %
01789 %    o wand: the drawing wand.
01790 %
01791 */
01792 WandExport MagickBooleanType DrawGetStrokeAntialias(const DrawingWand *wand)
01793 {
01794   assert(wand != (const DrawingWand *) NULL);
01795   assert(wand->signature == WandSignature);
01796   if (wand->debug != MagickFalse)
01797     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
01798   return(CurrentContext->stroke_antialias);
01799 }
01800 
01801 /*
01802 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
01803 %                                                                             %
01804 %                                                                             %
01805 %                                                                             %
01806 %   D r a w G e t S t r o k e C o l o r                                       %
01807 %                                                                             %
01808 %                                                                             %
01809 %                                                                             %
01810 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
01811 %
01812 %  DrawGetStrokeColor() returns the color used for stroking object outlines.
01813 %
01814 %  The format of the DrawGetStrokeColor method is:
01815 %
01816 %      void DrawGetStrokeColor(const DrawingWand *wand,
01817 $        PixelWand *stroke_color)
01818 %
01819 %  A description of each parameter follows:
01820 %
01821 %    o wand: the drawing wand.
01822 %
01823 %    o stroke_color: Return the stroke color.
01824 %
01825 */
01826 WandExport void DrawGetStrokeColor(const DrawingWand *wand,
01827   PixelWand *stroke_color)
01828 {
01829   assert(wand != (const DrawingWand *) NULL);
01830   assert(wand->signature == WandSignature);
01831   assert(stroke_color != (PixelWand *) NULL);
01832   if (wand->debug != MagickFalse)
01833     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
01834   PixelSetQuantumColor(stroke_color,&CurrentContext->stroke);
01835 }
01836 
01837 /*
01838 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
01839 %                                                                             %
01840 %                                                                             %
01841 %                                                                             %
01842 %   D r a w G e t S t r o k e D a s h A r r a y                               %
01843 %                                                                             %
01844 %                                                                             %
01845 %                                                                             %
01846 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
01847 %
01848 %  DrawGetStrokeDashArray() returns an array representing the pattern of
01849 %  dashes and gaps used to stroke paths (see DrawSetStrokeDashArray). The
01850 %  array must be freed once it is no longer required by the user.
01851 %
01852 %  The format of the DrawGetStrokeDashArray method is:
01853 %
01854 %      double *DrawGetStrokeDashArray(const DrawingWand *wand,
01855 %        unsigned long *number_elements)
01856 %
01857 %  A description of each parameter follows:
01858 %
01859 %    o wand: the drawing wand.
01860 %
01861 %    o number_elements: address to place number of elements in dash array
01862 %
01863 */
01864 WandExport double *DrawGetStrokeDashArray(const DrawingWand *wand,
01865   unsigned long *number_elements)
01866 {
01867   double
01868     *dash_array;
01869 
01870   register const double
01871     *p;
01872 
01873   register double
01874     *q;
01875 
01876   register long
01877     i;
01878 
01879   unsigned long
01880     n;
01881 
01882   assert(wand != (const DrawingWand *) NULL);
01883   assert(wand->signature == WandSignature);
01884   if (wand->debug != MagickFalse)
01885     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
01886   assert(number_elements != (unsigned long *) NULL);
01887   n=0;
01888   p=CurrentContext->dash_pattern;
01889   if (p != (const double *) NULL)
01890     while (*p++ != 0.0)
01891       n++;
01892   *number_elements=n;
01893   dash_array=(double *) NULL;
01894   if (n != 0)
01895     {
01896       dash_array=(double *) AcquireQuantumMemory((size_t) n,
01897         sizeof(*dash_array));
01898       p=CurrentContext->dash_pattern;
01899       q=dash_array;
01900       for (i=0; i < (long) n; i++)
01901         *q++=(*p++);
01902     }
01903   return(dash_array);
01904 }
01905 
01906 /*
01907 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
01908 %                                                                             %
01909 %                                                                             %
01910 %                                                                             %
01911 %   D r a w G e t S t r o k e D a s h O f f s e t                             %
01912 %                                                                             %
01913 %                                                                             %
01914 %                                                                             %
01915 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
01916 %
01917 %  DrawGetStrokeDashOffset() returns the offset into the dash pattern to
01918 %  start the dash.
01919 %
01920 %  The format of the DrawGetStrokeDashOffset method is:
01921 %
01922 %      double DrawGetStrokeDashOffset(const DrawingWand *wand)
01923 %
01924 %  A description of each parameter follows:
01925 %
01926 %    o wand: the drawing wand.
01927 %
01928 */
01929 WandExport double DrawGetStrokeDashOffset(const DrawingWand *wand)
01930 {
01931   assert(wand != (const DrawingWand *) NULL);
01932   assert(wand->signature == WandSignature);
01933   if (wand->debug != MagickFalse)
01934     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
01935   return(CurrentContext->dash_offset);
01936 }
01937 
01938 /*
01939 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
01940 %                                                                             %
01941 %                                                                             %
01942 %                                                                             %
01943 %   D r a w G e t S t r o k e L i n e C a p                                   %
01944 %                                                                             %
01945 %                                                                             %
01946 %                                                                             %
01947 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
01948 %
01949 %  DrawGetStrokeLineCap() returns the shape to be used at the end of
01950 %  open subpaths when they are stroked. Values of LineCap are
01951 %  UndefinedCap, ButtCap, RoundCap, and SquareCap.
01952 %
01953 %  The format of the DrawGetStrokeLineCap method is:
01954 %
01955 %      LineCap DrawGetStrokeLineCap(const DrawingWand *wand)
01956 %
01957 %  A description of each parameter follows:
01958 %
01959 %    o wand: the drawing wand.
01960 %
01961 */
01962 WandExport LineCap DrawGetStrokeLineCap(const DrawingWand *wand)
01963 {
01964   assert(wand != (const DrawingWand *) NULL);
01965   assert(wand->signature == WandSignature);
01966   if (wand->debug != MagickFalse)
01967     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
01968   return(CurrentContext->linecap);
01969 }
01970 
01971 /*
01972 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
01973 %                                                                             %
01974 %                                                                             %
01975 %                                                                             %
01976 %   D r a w G e t S t r o k e L i n e J o i n                                 %
01977 %                                                                             %
01978 %                                                                             %
01979 %                                                                             %
01980 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
01981 %
01982 %  DrawGetStrokeLineJoin() returns the shape to be used at the
01983 %  corners of paths (or other vector shapes) when they are
01984 %  stroked. Values of LineJoin are UndefinedJoin, MiterJoin, RoundJoin,
01985 %  and BevelJoin.
01986 %
01987 %  The format of the DrawGetStrokeLineJoin method is:
01988 %
01989 %      LineJoin DrawGetStrokeLineJoin(const DrawingWand *wand)
01990 %
01991 %  A description of each parameter follows:
01992 %
01993 %    o wand: the drawing wand.
01994 %
01995 */
01996 WandExport LineJoin DrawGetStrokeLineJoin(const DrawingWand *wand)
01997 {
01998   assert(wand != (const DrawingWand *) NULL);
01999   assert(wand->signature == WandSignature);
02000   if (wand->debug != MagickFalse)
02001     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
02002   return(CurrentContext->linejoin);
02003 }
02004 
02005 /*
02006 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
02007 %                                                                             %
02008 %                                                                             %
02009 %                                                                             %
02010 %   D r a w G e t S t r o k e M i t e r L i m i t                             %
02011 %                                                                             %
02012 %                                                                             %
02013 %                                                                             %
02014 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
02015 %
02016 %  DrawGetStrokeMiterLimit() returns the miter limit. When two line
02017 %  segments meet at a sharp angle and miter joins have been specified for
02018 %  'lineJoin', it is possible for the miter to extend far beyond the
02019 %  thickness of the line stroking the path. The miterLimit' imposes a
02020 %  limit on the ratio of the miter length to the 'lineWidth'.
02021 %
02022 %  The format of the DrawGetStrokeMiterLimit method is:
02023 %
02024 %      unsigned long DrawGetStrokeMiterLimit(const DrawingWand *wand)
02025 %
02026 %  A description of each parameter follows:
02027 %
02028 %    o wand: the drawing wand.
02029 %
02030 */
02031 WandExport unsigned long DrawGetStrokeMiterLimit(const DrawingWand *wand)
02032 {
02033   assert(wand != (const DrawingWand *) NULL);
02034   assert(wand->signature == WandSignature);
02035   if (wand->debug != MagickFalse)
02036     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
02037   return CurrentContext->miterlimit;
02038 }
02039 
02040 /*
02041 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
02042 %                                                                             %
02043 %                                                                             %
02044 %                                                                             %
02045 %   D r a w G e t S t r o k e O p a c i t y                                   %
02046 %                                                                             %
02047 %                                                                             %
02048 %                                                                             %
02049 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
02050 %
02051 %  DrawGetStrokeOpacity() returns the opacity of stroked object outlines.
02052 %
02053 %  The format of the DrawGetStrokeOpacity method is:
02054 %
02055 %      double DrawGetStrokeOpacity(const DrawingWand *wand)
02056 %
02057 %  A description of each parameter follows:
02058 %
02059 %    o wand: the drawing wand.
02060 %
02061 */
02062 WandExport double DrawGetStrokeOpacity(const DrawingWand *wand)
02063 {
02064   double
02065     alpha;
02066 
02067   assert(wand != (const DrawingWand *) NULL);
02068   assert(wand->signature == WandSignature);
02069   if (wand->debug != MagickFalse)
02070     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
02071   alpha=(double) QuantumScale*(QuantumRange-CurrentContext->stroke.opacity);
02072   return(alpha);
02073 }
02074 
02075 /*
02076 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
02077 %                                                                             %
02078 %                                                                             %
02079 %                                                                             %
02080 %   D r a w G e t S t r o k e W i d t h                                       %
02081 %                                                                             %
02082 %                                                                             %
02083 %                                                                             %
02084 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
02085 %
02086 %  DrawGetStrokeWidth() returns the width of the stroke used to draw object
02087 %  outlines.
02088 %
02089 %  The format of the DrawGetStrokeWidth method is:
02090 %
02091 %      double DrawGetStrokeWidth(const DrawingWand *wand)
02092 %
02093 %  A description of each parameter follows:
02094 %
02095 %    o wand: the drawing wand.
02096 %
02097 */
02098 WandExport double DrawGetStrokeWidth(const DrawingWand *wand)
02099 {
02100   assert(wand != (const DrawingWand *) NULL);
02101   assert(wand->signature == WandSignature);
02102   if (wand->debug != MagickFalse)
02103     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
02104   return(CurrentContext->stroke_width);
02105 }
02106 
02107 /*
02108 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
02109 %                                                                             %
02110 %                                                                             %
02111 %                                                                             %
02112 %   D r a w G e t T e x t A l i g n m e n t                                   %
02113 %                                                                             %
02114 %                                                                             %
02115 %                                                                             %
02116 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
02117 %
02118 %  DrawGetTextAlignment() returns the alignment applied when annotating with
02119 %  text.
02120 %
02121 %  The format of the DrawGetTextAlignment method is:
02122 %
02123 %      AlignType DrawGetTextAlignment(DrawingWand *wand)
02124 %
02125 %  A description of each parameter follows:
02126 %
02127 %    o wand: the drawing wand.
02128 %
02129 */
02130 WandExport AlignType DrawGetTextAlignment(const DrawingWand *wand)
02131 {
02132   assert(wand != (const DrawingWand *) NULL);
02133   assert(wand->signature == WandSignature);
02134   if (wand->debug != MagickFalse)
02135     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
02136   return(CurrentContext->align);
02137 }
02138 
02139 /*
02140 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
02141 %                                                                             %
02142 %                                                                             %
02143 %                                                                             %
02144 %   D r a w G e t T e x t A n t i a l i a s                                   %
02145 %                                                                             %
02146 %                                                                             %
02147 %                                                                             %
02148 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
02149 %
02150 %  DrawGetTextAntialias() returns the current text antialias setting, which
02151 %  determines whether text is antialiased.  Text is antialiased by default.
02152 %
02153 %  The format of the DrawGetTextAntialias method is:
02154 %
02155 %      MagickBooleanType DrawGetTextAntialias(const DrawingWand *wand)
02156 %
02157 %  A description of each parameter follows:
02158 %
02159 %    o wand: the drawing wand.
02160 %
02161 */
02162 WandExport MagickBooleanType DrawGetTextAntialias(const DrawingWand *wand)
02163 {
02164   assert(wand != (const DrawingWand *) NULL);
02165   assert(wand->signature == WandSignature);
02166   if (wand->debug != MagickFalse)
02167     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
02168   return(CurrentContext->text_antialias);
02169 }
02170 
02171 /*
02172 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
02173 %                                                                             %
02174 %                                                                             %
02175 %                                                                             %
02176 %   D r a w G e t T e x t D e c o r a t i o n                                 %
02177 %                                                                             %
02178 %                                                                             %
02179 %                                                                             %
02180 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
02181 %
02182 %  DrawGetTextDecoration() returns the decoration applied when annotating with
02183 %  text.
02184 %
02185 %  The format of the DrawGetTextDecoration method is:
02186 %
02187 %      DecorationType DrawGetTextDecoration(DrawingWand *wand)
02188 %
02189 %  A description of each parameter follows:
02190 %
02191 %    o wand: the drawing wand.
02192 %
02193 */
02194 WandExport DecorationType DrawGetTextDecoration(const DrawingWand *wand)
02195 {
02196   assert(wand != (const DrawingWand *) NULL);
02197   assert(wand->signature == WandSignature);
02198   if (wand->debug != MagickFalse)
02199     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
02200   return(CurrentContext->decorate);
02201 }
02202 
02203 /*
02204 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
02205 %                                                                             %
02206 %                                                                             %
02207 %                                                                             %
02208 %   D r a w G e t T e x t E n c o d i n g                                     %
02209 %                                                                             %
02210 %                                                                             %
02211 %                                                                             %
02212 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
02213 %
02214 %  DrawGetTextEncoding() returns a null-terminated string which specifies the
02215 %  code set used for text annotations. The string must be freed by the user
02216 %  once it is no longer required.
02217 %
02218 %  The format of the DrawGetTextEncoding method is:
02219 %
02220 %      char *DrawGetTextEncoding(const DrawingWand *wand)
02221 %
02222 %  A description of each parameter follows:
02223 %
02224 %    o wand: the drawing wand.
02225 %
02226 */
02227 WandExport char *DrawGetTextEncoding(const DrawingWand *wand)
02228 {
02229   assert(wand != (const DrawingWand *) NULL);
02230   assert(wand->signature == WandSignature);
02231   if (wand->debug != MagickFalse)
02232     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
02233   if (CurrentContext->encoding != (char *) NULL)
02234     return((char *) AcquireString(CurrentContext->encoding));
02235   return((char *) NULL);
02236 }
02237 
02238 /*
02239 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
02240 %                                                                             %
02241 %                                                                             %
02242 %                                                                             %
02243 %   D r a w G e t T e x t K e r n i n g                                       %
02244 %                                                                             %
02245 %                                                                             %
02246 %                                                                             %
02247 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
02248 %
02249 %  DrawGetTextKerning() gets the spacing between characters in text.
02250 %
02251 %  The format of the DrawSetFontKerning method is:
02252 %
02253 %      double DrawGetTextKerning(DrawingWand *wand)
02254 %
02255 %  A description of each parameter follows:
02256 %
02257 %    o wand: the drawing wand.
02258 %
02259 */
02260 WandExport double DrawGetTextKerning(DrawingWand *wand)
02261 {
02262   assert(wand != (DrawingWand *) NULL);
02263   assert(wand->signature == WandSignature);
02264 
02265   if (wand->debug != MagickFalse)
02266     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
02267   return(CurrentContext->kerning);
02268 }
02269 
02270 /*
02271 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
02272 %                                                                             %
02273 %                                                                             %
02274 %                                                                             %
02275 %   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                     %
02276 %                                                                             %
02277 %                                                                             %
02278 %                                                                             %
02279 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
02280 %
02281 %  DrawGetTextInterwordSpacing() gets the spacing between lines in text.
02282 %
02283 %  The format of the DrawSetFontKerning method is:
02284 %
02285 %      double DrawGetTextInterwordSpacing(DrawingWand *wand)
02286 %
02287 %  A description of each parameter follows:
02288 %
02289 %    o wand: the drawing wand.
02290 %
02291 */
02292 WandExport double DrawGetTextInterlineSpacing(DrawingWand *wand)
02293 {
02294   assert(wand != (DrawingWand *) NULL);
02295   assert(wand->signature == WandSignature);
02296   if (wand->debug != MagickFalse)
02297     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
02298   return(CurrentContext->interline_spacing);
02299 }
02300 
02301 /*
02302 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
02303 %                                                                             %
02304 %                                                                             %
02305 %                                                                             %
02306 %   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                     %
02307 %                                                                             %
02308 %                                                                             %
02309 %                                                                             %
02310 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
02311 %
02312 %  DrawGetTextInterwordSpacing() gets the spacing between words in text.
02313 %
02314 %  The format of the DrawSetFontKerning method is:
02315 %
02316 %      double DrawGetTextInterwordSpacing(DrawingWand *wand)
02317 %
02318 %  A description of each parameter follows:
02319 %
02320 %    o wand: the drawing wand.
02321 %
02322 */
02323 WandExport double DrawGetTextInterwordSpacing(DrawingWand *wand)
02324 {
02325   assert(wand != (DrawingWand *) NULL);
02326   assert(wand->signature == WandSignature);
02327   if (wand->debug != MagickFalse)
02328     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
02329   return(CurrentContext->interword_spacing);
02330 }
02331 
02332 /*
02333 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
02334 %                                                                             %
02335 %                                                                             %
02336 %                                                                             %
02337 %   D r a w G e t V e c t o r G r a p h i c s                                 %
02338 %                                                                             %
02339 %                                                                             %
02340 %                                                                             %
02341 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
02342 %
02343 %  DrawGetVectorGraphics() returns a null-terminated string which specifies the
02344 %  vector graphics generated by any graphics calls made since the wand was
02345 %  instantiated.  The string must be freed by the user once it is no longer
02346 %  required.
02347 %
02348 %  The format of the DrawGetVectorGraphics method is:
02349 %
02350 %      char *DrawGetVectorGraphics(const DrawingWand *wand)
02351 %
02352 %  A description of each parameter follows:
02353 %
02354 %    o wand: the drawing wand.
02355 %
02356 */
02357 
02358 static inline void SetMagickPixelPacket(const Image *image,
02359   const PixelPacket *color,const IndexPacket *index,MagickPixelPacket *pixel)
02360 {
02361   pixel->red=(MagickRealType) color->red;
02362   pixel->green=(MagickRealType) color->green;
02363   pixel->blue=(MagickRealType) color->blue;
02364   if (image->matte != MagickFalse)
02365     pixel->opacity=(MagickRealType) color->opacity;
02366   if (((image->colorspace == CMYKColorspace) ||
02367        (image->storage_class == PseudoClass)) &&
02368       (index != (const IndexPacket *) NULL))
02369     pixel->index=(MagickRealType) *index;
02370 }
02371 
02372 WandExport char *DrawGetVectorGraphics(DrawingWand *wand)
02373 {
02374   char
02375     value[MaxTextExtent],
02376     *xml;
02377 
02378   MagickPixelPacket
02379     pixel;
02380 
02381   register long
02382     i;
02383 
02384   XMLTreeInfo
02385     *child,
02386     *xml_info;
02387 
02388   assert(wand != (const DrawingWand *) NULL);
02389   assert(wand->signature == WandSignature);
02390   if (wand->debug != MagickFalse)
02391     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
02392   xml_info=NewXMLTreeTag("drawing-wand");
02393   if (xml_info == (XMLTreeInfo *) NULL)
02394     return(char *) NULL;
02395   GetMagickPixelPacket(wand->image,&pixel);
02396   child=AddChildToXMLTree(xml_info,"clip-path",0);
02397   if (child != (XMLTreeInfo *) NULL)
02398     (void) SetXMLTreeContent(child,CurrentContext->clip_mask);
02399   child=AddChildToXMLTree(xml_info,"clip-units",0);
02400   if (child != (XMLTreeInfo *) NULL)
02401     {
02402       (void) CopyMagickString(value,MagickOptionToMnemonic(
02403         MagickClipPathOptions,(long) CurrentContext->clip_units),MaxTextExtent);
02404       (void) SetXMLTreeContent(child,value);
02405     }
02406   child=AddChildToXMLTree(xml_info,"decorate",0);
02407   if (child != (XMLTreeInfo *) NULL)
02408     {
02409       (void) CopyMagickString(value,MagickOptionToMnemonic(
02410         MagickDecorateOptions,(long) CurrentContext->decorate),MaxTextExtent);
02411       (void) SetXMLTreeContent(child,value);
02412     }
02413   child=AddChildToXMLTree(xml_info,"encoding",0);
02414   if (child != (XMLTreeInfo *) NULL)
02415     (void) SetXMLTreeContent(child,CurrentContext->encoding);
02416   child=AddChildToXMLTree(xml_info,"fill",0);
02417   if (child != (XMLTreeInfo *) NULL)
02418     {
02419       if (CurrentContext->fill.opacity != OpaqueOpacity)
02420         pixel.matte=CurrentContext->fill.opacity != OpaqueOpacity ?
02421           MagickTrue : MagickFalse;
02422       SetMagickPixelPacket(wand->image,&CurrentContext->fill,
02423         (const IndexPacket *) NULL,&pixel);
02424       GetColorTuple(&pixel,MagickTrue,value);
02425       (void) SetXMLTreeContent(child,value);
02426     }
02427   child=AddChildToXMLTree(xml_info,"fill-opacity",0);
02428   if (child != (XMLTreeInfo *) NULL)
02429     {
02430       (void) FormatMagickString(value,MaxTextExtent,"%g",
02431         (double) QuantumScale*(QuantumRange-CurrentContext->fill.opacity));
02432       (void) SetXMLTreeContent(child,value);
02433     }
02434   child=AddChildToXMLTree(xml_info,"fill-rule",0);
02435   if (child != (XMLTreeInfo *) NULL)
02436     {
02437       (void) CopyMagickString(value,MagickOptionToMnemonic(
02438         MagickFillRuleOptions,(long) CurrentContext->fill_rule),MaxTextExtent);
02439       (void) SetXMLTreeContent(child,value);
02440     }
02441   child=AddChildToXMLTree(xml_info,"font",0);
02442   if (child != (XMLTreeInfo *) NULL)
02443     (void) SetXMLTreeContent(child,CurrentContext->font);
02444   child=AddChildToXMLTree(xml_info,"font-family",0);
02445   if (child != (XMLTreeInfo *) NULL)
02446     (void) SetXMLTreeContent(child,CurrentContext->family);
02447   child=AddChildToXMLTree(xml_info,"font-size",0);
02448   if (child != (XMLTreeInfo *) NULL)
02449     {
02450       (void) FormatMagickString(value,MaxTextExtent,"%g",
02451         CurrentContext->pointsize);
02452       (void) SetXMLTreeContent(child,value);
02453     }
02454   child=AddChildToXMLTree(xml_info,"font-stretch",0);
02455   if (child != (XMLTreeInfo *) NULL)
02456     {
02457       (void) CopyMagickString(value,MagickOptionToMnemonic(
02458         MagickStretchOptions,(long) CurrentContext->stretch),MaxTextExtent);
02459       (void) SetXMLTreeContent(child,value);
02460     }
02461   child=AddChildToXMLTree(xml_info,"font-style",0);
02462   if (child != (XMLTreeInfo *) NULL)
02463     {
02464       (void) CopyMagickString(value,MagickOptionToMnemonic(
02465         MagickStyleOptions,(long) CurrentContext->style),MaxTextExtent);
02466       (void) SetXMLTreeContent(child,value);
02467     }
02468   child=AddChildToXMLTree(xml_info,"font-weight",0);
02469   if (child != (XMLTreeInfo *) NULL)
02470     {
02471       (void) FormatMagickString(value,MaxTextExtent,"%lu",
02472         CurrentContext->weight);
02473       (void) SetXMLTreeContent(child,value);
02474     }
02475   child=AddChildToXMLTree(xml_info,"gravity",0);
02476   if (child != (XMLTreeInfo *) NULL)
02477     {
02478       (void) CopyMagickString(value,MagickOptionToMnemonic(MagickGravityOptions,
02479         (long) CurrentContext->gravity),MaxTextExtent);
02480       (void) SetXMLTreeContent(child,value);
02481     }
02482   child=AddChildToXMLTree(xml_info,"stroke",0);
02483   if (child != (XMLTreeInfo *) NULL)
02484     {
02485       if (CurrentContext->stroke.opacity != OpaqueOpacity)
02486         pixel.matte=CurrentContext->stroke.opacity != OpaqueOpacity ?
02487           MagickTrue : MagickFalse;
02488       SetMagickPixelPacket(wand->image,&CurrentContext->stroke,
02489         (const IndexPacket *) NULL,&pixel);
02490       GetColorTuple(&pixel,MagickTrue,value);
02491       (void) SetXMLTreeContent(child,value);
02492     }
02493   child=AddChildToXMLTree(xml_info,"stroke-antialias",0);
02494   if (child != (XMLTreeInfo *) NULL)
02495     {
02496       (void) FormatMagickString(value,MaxTextExtent,"%d",
02497         CurrentContext->stroke_antialias != MagickFalse ? 1 : 0);
02498       (void) SetXMLTreeContent(child,value);
02499     }
02500   child=AddChildToXMLTree(xml_info,"stroke-dasharray",0);
02501   if ((child != (XMLTreeInfo *) NULL) &&
02502       (CurrentContext->dash_pattern != (double *) NULL))
02503     {
02504       char
02505         *dash_pattern;
02506 
02507       dash_pattern=AcquireString((char *) NULL);
02508       for (i=0; CurrentContext->dash_pattern[i] != 0.0; i++)
02509       {
02510         if (i != 0)
02511           (void) ConcatenateString(&dash_pattern,",");
02512         (void) FormatMagickString(value,MaxTextExtent,"%g",
02513           CurrentContext->dash_pattern[i]);
02514         (void) ConcatenateString(&dash_pattern,value);
02515       }
02516       (void) SetXMLTreeContent(child,dash_pattern);
02517       dash_pattern=DestroyString(dash_pattern);
02518     }
02519   child=AddChildToXMLTree(xml_info,"stroke-dashoffset",0);
02520   if (child != (XMLTreeInfo *) NULL)
02521     {
02522       (void) FormatMagickString(value,MaxTextExtent,"%g",
02523         CurrentContext->dash_offset);
02524       (void) SetXMLTreeContent(child,value);
02525     }
02526   child=AddChildToXMLTree(xml_info,"stroke-linecap",0);
02527   if (child != (XMLTreeInfo *) NULL)
02528     {
02529       (void) CopyMagickString(value,MagickOptionToMnemonic(MagickLineCapOptions,
02530         (long) CurrentContext->linecap),MaxTextExtent);
02531       (void) SetXMLTreeContent(child,value);
02532     }
02533   child=AddChildToXMLTree(xml_info,"stroke-linejoin",0);
02534   if (child != (XMLTreeInfo *) NULL)
02535     {
02536       (void) CopyMagickString(value,MagickOptionToMnemonic(
02537         MagickLineJoinOptions,(long) CurrentContext->linejoin),MaxTextExtent);
02538       (void) SetXMLTreeContent(child,value);
02539     }
02540   child=AddChildToXMLTree(xml_info,"stroke-miterlimit",0);
02541   if (child != (XMLTreeInfo *) NULL)
02542     {
02543       (void) FormatMagickString(value,MaxTextExtent,"%lu",
02544         CurrentContext->miterlimit);
02545       (void) SetXMLTreeContent(child,value);
02546     }
02547   child=AddChildToXMLTree(xml_info,"stroke-opacity",0);
02548   if (child != (XMLTreeInfo *) NULL)
02549     {
02550       (void) FormatMagickString(value,MaxTextExtent,"%g",
02551         (double) QuantumScale*(QuantumRange-CurrentContext->stroke.opacity));
02552       (void) SetXMLTreeContent(child,value);
02553     }
02554   child=AddChildToXMLTree(xml_info,"stroke-width",0);
02555   if (child != (XMLTreeInfo *) NULL)
02556     {
02557       (void) FormatMagickString(value,MaxTextExtent,"%g",
02558         CurrentContext->stroke_width);
02559       (void) SetXMLTreeContent(child,value);
02560     }
02561   child=AddChildToXMLTree(xml_info,"text-align",0);
02562   if (child != (XMLTreeInfo *) NULL)
02563     {
02564       (void) CopyMagickString(value,MagickOptionToMnemonic(MagickAlignOptions,
02565         (long) CurrentContext->align),MaxTextExtent);
02566       (void) SetXMLTreeContent(child,value);
02567     }
02568   child=AddChildToXMLTree(xml_info,"text-antialias",0);
02569   if (child != (XMLTreeInfo *) NULL)
02570     {
02571       (void) FormatMagickString(value,MaxTextExtent,"%d",
02572         CurrentContext->text_antialias != MagickFalse ? 1 : 0);
02573       (void) SetXMLTreeContent(child,value);
02574     }
02575   child=AddChildToXMLTree(xml_info,"text-undercolor",0);
02576   if (child != (XMLTreeInfo *) NULL)
02577     {
02578       if (CurrentContext->undercolor.opacity != OpaqueOpacity)
02579         pixel.matte=CurrentContext->undercolor.opacity != OpaqueOpacity ?
02580           MagickTrue : MagickFalse;
02581       SetMagickPixelPacket(wand->image,&CurrentContext->undercolor,
02582         (const IndexPacket *) NULL,&pixel);
02583       GetColorTuple(&pixel,MagickTrue,value);
02584       (void) SetXMLTreeContent(child,value);
02585     }
02586   child=AddChildToXMLTree(xml_info,"vector-graphics",0);
02587   if (child != (XMLTreeInfo *) NULL)
02588     (void) SetXMLTreeContent(child,wand->mvg);
02589   xml=XMLTreeInfoToXML(xml_info);
02590   xml_info=DestroyXMLTree(xml_info);
02591   return(xml);
02592 }
02593 
02594 /*
02595 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
02596 %                                                                             %
02597 %                                                                             %
02598 %                                                                             %
02599 %   D r a w G e t T e x t U n d e r C o l o r                                 %
02600 %                                                                             %
02601 %                                                                             %
02602 %                                                                             %
02603 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
02604 %
02605 %  DrawGetTextUnderColor() returns the color of a background rectangle
02606 %  to place under text annotations.
02607 %
02608 %  The format of the DrawGetTextUnderColor method is:
02609 %
02610 %      void DrawGetTextUnderColor(const DrawingWand *wand,
02611 %        PixelWand *under_color)
02612 %
02613 %  A description of each parameter follows:
02614 %
02615 %    o wand: the drawing wand.
02616 %
02617 %    o under_color: Return the under color.
02618 %
02619 */
02620 WandExport void DrawGetTextUnderColor(const DrawingWand *wand,
02621   PixelWand *under_color)
02622 {
02623   assert(wand != (const DrawingWand *) NULL);
02624   assert(wand->signature == WandSignature);
02625   assert(under_color != (PixelWand *) NULL);
02626   if (wand->debug != MagickFalse)
02627     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
02628   PixelSetQuantumColor(under_color,&CurrentContext->undercolor);
02629 }
02630 
02631 /*
02632 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
02633 %                                                                             %
02634 %                                                                             %
02635 %                                                                             %
02636 %   D r a w L i n e                                                           %
02637 %                                                                             %
02638 %                                                                             %
02639 %                                                                             %
02640 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
02641 %
02642 %  DrawLine() draws a line on the image using the current stroke color,
02643 %  stroke opacity, and stroke width.
02644 %
02645 %  The format of the DrawLine method is:
02646 %
02647 %      void DrawLine(DrawingWand *wand,const double sx,const double sy,
02648 %        const double ex,const double ey)
02649 %
02650 %  A description of each parameter follows:
02651 %
02652 %    o wand: the drawing wand.
02653 %
02654 %    o sx: starting x ordinate
02655 %
02656 %    o sy: starting y ordinate
02657 %
02658 %    o ex: ending x ordinate
02659 %
02660 %    o ey: ending y ordinate
02661 %
02662 */
02663 WandExport void DrawLine(DrawingWand *wand,const double sx,const double sy,
02664   const double ex,const double ey)
02665 {
02666   assert(wand != (DrawingWand *) NULL);
02667   assert(wand->signature == WandSignature);
02668   if (wand->debug != MagickFalse)
02669     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
02670   (void) MvgPrintf(wand,"line %g,%g %g,%g\n",sx,sy,ex,ey);
02671 }
02672 
02673 /*
02674 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
02675 %                                                                             %
02676 %                                                                             %
02677 %                                                                             %
02678 %   D r a w M a t t e                                                         %
02679 %                                                                             %
02680 %                                                                             %
02681 %                                                                             %
02682 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
02683 %
02684 %  DrawMatte() paints on the image's opacity channel in order to set effected
02685 %  pixels to transparent.
02686 %  to influence the opacity of pixels. The available paint
02687 %  methods are:
02688 %
02689 %    PointMethod: Select the target pixel
02690 %    ReplaceMethod: Select any pixel that matches the target pixel.
02691 %    FloodfillMethod: Select the target pixel and matching neighbors.
02692 %    FillToBorderMethod: Select the target pixel and neighbors not matching
02693 %      border color.
02694 %    ResetMethod: Select all pixels.
02695 %
02696 %  The format of the DrawMatte method is:
02697 %
02698 %      void DrawMatte(DrawingWand *wand,const double x,const double y,
02699 %        const PaintMethod paint_method)
02700 %
02701 %  A description of each parameter follows:
02702 %
02703 %    o wand: the drawing wand.
02704 %
02705 %    o x: x ordinate
02706 %
02707 %    o y: y ordinate
02708 %
02709 %    o paint_method: paint method.
02710 %
02711 */
02712 WandExport void DrawMatte(DrawingWand *wand,const double x,const double y,
02713   const PaintMethod paint_method)
02714 {
02715   assert(wand != (DrawingWand *) NULL);
02716   assert(wand->signature == WandSignature);
02717   if (wand->debug != MagickFalse)
02718     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
02719   (void) MvgPrintf(wand,"matte %g,%g '%s'\n",x,y,MagickOptionToMnemonic(
02720     MagickMethodOptions,(long) paint_method));
02721 }
02722 
02723 /*
02724 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
02725 %                                                                             %
02726 %                                                                             %
02727 %                                                                             %
02728 %   D r a w P a t h C l o s e                                                 %
02729 %                                                                             %
02730 %                                                                             %
02731 %                                                                             %
02732 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
02733 %
02734 %  DrawPathClose() adds a path element to the current path which closes the
02735 %  current subpath by drawing a straight line from the current point to the
02736 %  current subpath's most recent starting point (usually, the most recent
02737 %  moveto point).
02738 %
02739 %  The format of the DrawPathClose method is:
02740 %
02741 %      void DrawPathClose(DrawingWand *wand)
02742 %
02743 %  A description of each parameter follows:
02744 %
02745 %    o wand: the drawing wand.
02746 %
02747 */
02748 WandExport void DrawPathClose(DrawingWand *wand)
02749 {
02750   assert(wand != (DrawingWand *) NULL);
02751   assert(wand->signature == WandSignature);
02752   if (wand->debug != MagickFalse)
02753     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
02754   (void) MvgAutoWrapPrintf(wand,"%s",wand->path_mode == AbsolutePathMode ?
02755     "Z" : "z");
02756 }
02757 
02758 /*
02759 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
02760 %                                                                             %
02761 %                                                                             %
02762 %                                                                             %
02763 %   D r a w P a t h C u r v e T o A b s o l u t e                             %
02764 %                                                                             %
02765 %                                                                             %
02766 %                                                                             %
02767 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
02768 %
02769 %  DrawPathCurveToAbsolute() draws a cubic Bezier curve from the current
02770 %  point to (x,y) using (x1,y1) as the control point at the beginning of
02771 %  the curve and (x2,y2) as the control point at the end of the curve using
02772 %  absolute coordinates. At the end of the command, the new current point
02773 %  becomes the final (x,y) coordinate pair used in the polybezier.
02774 %
02775 %  The format of the DrawPathCurveToAbsolute method is:
02776 %
02777 %      void DrawPathCurveToAbsolute(DrawingWand *wand,const double x1,
02778 %        const double y1,const double x2,const double y2,const double x,
02779 %        const double y)
02780 %
02781 %  A description of each parameter follows:
02782 %
02783 %    o wand: the drawing wand.
02784 %
02785 %    o x1: x ordinate of control point for curve beginning
02786 %
02787 %    o y1: y ordinate of control point for curve beginning
02788 %
02789 %    o x2: x ordinate of control point for curve ending
02790 %
02791 %    o y2: y ordinate of control point for curve ending
02792 %
02793 %    o x: x ordinate of the end of the curve
02794 %
02795 %    o y: y ordinate of the end of the curve
02796 %
02797 */
02798 
02799 static void DrawPathCurveTo(DrawingWand *wand,const PathMode mode,
02800   const double x1,const double y1,const double x2,const double y2,
02801   const double x,const double y)
02802 {
02803   assert(wand != (DrawingWand *) NULL);
02804   assert(wand->signature == WandSignature);
02805   if (wand->debug != MagickFalse)
02806     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
02807   if ((wand->path_operation != PathCurveToOperation) ||
02808       (wand->path_mode != mode))
02809     {
02810       wand->path_operation=PathCurveToOperation;
02811       wand->path_mode=mode;
02812       (void) MvgAutoWrapPrintf(wand, "%c%g,%g %g,%g %g,%g",
02813         mode == AbsolutePathMode ? 'C' : 'c',x1,y1,x2,y2,x,y);
02814     }
02815   else
02816     (void) MvgAutoWrapPrintf(wand," %g,%g %g,%g %g,%g",x1,y1,x2,y2,x,y);
02817 }
02818 
02819 WandExport void DrawPathCurveToAbsolute(DrawingWand *wand,const double x1,
02820   const double y1,const double x2,const double y2,const double x,const double y)
02821 {
02822   assert(wand != (DrawingWand *) NULL);
02823   assert(wand->signature == WandSignature);
02824   if (wand->debug != MagickFalse)
02825     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
02826   DrawPathCurveTo(wand,AbsolutePathMode,x1,y1,x2,y2,x,y);
02827 }
02828 
02829 /*
02830 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
02831 %                                                                             %
02832 %                                                                             %
02833 %                                                                             %
02834 %   D r a w P a t h C u r v e T o R e l a t i v e                             %
02835 %                                                                             %
02836 %                                                                             %
02837 %                                                                             %
02838 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
02839 %
02840 %  DrawPathCurveToRelative() draws a cubic Bezier curve from the current
02841 %  point to (x,y) using (x1,y1) as the control point at the beginning of
02842 %  the curve and (x2,y2) as the control point at the end of the curve using
02843 %  relative coordinates. At the end of the command, the new current point
02844 %  becomes the final (x,y) coordinate pair used in the polybezier.
02845 %
02846 %  The format of the DrawPathCurveToRelative method is:
02847 %
02848 %      void DrawPathCurveToRelative(DrawingWand *wand,const double x1,
02849 %        const double y1,const double x2,const double y2,const double x,
02850 %        const double y)
02851 %
02852 %  A description of each parameter follows:
02853 %
02854 %    o wand: the drawing wand.
02855 %
02856 %    o x1: x ordinate of control point for curve beginning
02857 %
02858 %    o y1: y ordinate of control point for curve beginning
02859 %
02860 %    o x2: x ordinate of control point for curve ending
02861 %
02862 %    o y2: y ordinate of control point for curve ending
02863 %
02864 %    o x: x ordinate of the end of the curve
02865 %
02866 %    o y: y ordinate of the end of the curve
02867 %
02868 */
02869 WandExport void DrawPathCurveToRelative(DrawingWand *wand,const double x1,
02870   const double y1,const double x2,const double y2,const double x,const double y)
02871 {
02872   assert(wand != (DrawingWand *) NULL);
02873   assert(wand->signature == WandSignature);
02874   if (wand->debug != MagickFalse)
02875     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
02876   DrawPathCurveTo(wand,RelativePathMode,x1,y1,x2,y2,x,y);
02877 }
02878 
02879 /*
02880 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
02881 %                                                                             %
02882 %                                                                             %
02883 %                                                                             %
02884 %   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 %
02885 %                                                                             %
02886 %                                                                             %
02887 %                                                                             %
02888 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
02889 %
02890 %  DrawPathCurveToQuadraticBezierAbsolute() draws a quadratic Bezier curve
02891 %  from the current point to (x,y) using (x1,y1) as the control point using
02892 %  absolute coordinates. At the end of the command, the new current point
02893 %  becomes the final (x,y) coordinate pair used in the polybezier.
02894 %
02895 %  The format of the DrawPathCurveToQuadraticBezierAbsolute method is:
02896 %
02897 %      void DrawPathCurveToQuadraticBezierAbsolute(DrawingWand *wand,
02898 %        const double x1,const double y1,onst double x,const double y)
02899 %
02900 %  A description of each parameter follows:
02901 %
02902 %    o wand: the drawing wand.
02903 %
02904 %    o x1: x ordinate of the control point
02905 %
02906 %    o y1: y ordinate of the control point
02907 %
02908 %    o x: x ordinate of final point
02909 %
02910 %    o y: y ordinate of final point
02911 %
02912 */
02913 
02914 static void DrawPathCurveToQuadraticBezier(DrawingWand *wand,
02915   const PathMode mode,const double x1,double y1,const double x,const double y)
02916 {
02917   assert(wand != (DrawingWand *) NULL);
02918   assert(wand->signature == WandSignature);
02919   if (wand->debug != MagickFalse)
02920     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
02921   if ((wand->path_operation != PathCurveToQuadraticBezierOperation) ||
02922       (wand->path_mode != mode))
02923     {
02924       wand->path_operation=PathCurveToQuadraticBezierOperation;
02925       wand->path_mode=mode;
02926       (void) MvgAutoWrapPrintf(wand, "%c%g,%g %g,%g",mode == AbsolutePathMode ?
02927         'Q' : 'q',x1,y1,x,y);
02928     }
02929   else
02930     (void) MvgAutoWrapPrintf(wand," %g,%g %g,%g",x1,y1,x,y);
02931 }
02932 
02933 WandExport void DrawPathCurveToQuadraticBezierAbsolute(DrawingWand *wand,
02934   const double x1,const double y1,const double x,const double y)
02935 {
02936   assert(wand != (DrawingWand *) NULL);
02937   assert(wand->signature == WandSignature);
02938   if (wand->debug != MagickFalse)
02939     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
02940   DrawPathCurveToQuadraticBezier(wand,AbsolutePathMode,x1,y1,x,y);
02941 }
02942 
02943 /*
02944 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
02945 %                                                                             %
02946 %                                                                             %
02947 %                                                                             %
02948 %   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
02949 %                                                                             %
02950 %                                                                             %
02951 %                                                                             %
02952 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
02953 %
02954 %  DrawPathCurveToQuadraticBezierRelative() draws a quadratic Bezier curve
02955 %  from the current point to (x,y) using (x1,y1) as the control point using
02956 %  relative coordinates. At the end of the command, the new current point
02957 %  becomes the final (x,y) coordinate pair used in the polybezier.
02958 %
02959 %  The format of the DrawPathCurveToQuadraticBezierRelative method is:
02960 %
02961 %      void DrawPathCurveToQuadraticBezierRelative(DrawingWand *wand,
02962 %        const double x1,const double y1,const double x,const double y)
02963 %
02964 %  A description of each parameter follows:
02965 %
02966 %    o wand: the drawing wand.
02967 %
02968 %    o x1: x ordinate of the control point
02969 %
02970 %    o y1: y ordinate of the control point
02971 %
02972 %    o x: x ordinate of final point
02973 %
02974 %    o y: y ordinate of final point
02975 %
02976 */
02977 WandExport void DrawPathCurveToQuadraticBezierRelative(DrawingWand *wand,
02978   const double x1,const double y1,const double x,const double y)
02979 {
02980   assert(wand != (DrawingWand *) NULL);
02981   assert(wand->signature == WandSignature);
02982   if (wand->debug != MagickFalse)
02983     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
02984   DrawPathCurveToQuadraticBezier(wand,RelativePathMode,x1,y1,x,y);
02985 }
02986 
02987 /*
02988 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
02989 %                                                                             %
02990 %                                                                             %
02991 %                                                                             %
02992 %   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   %
02993 %                                                                             %
02994 %                                                                             %
02995 %                                                                             %
02996 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
02997 %
02998 %  DrawPathCurveToQuadraticBezierSmoothAbsolute() draws a quadratic
02999 %  Bezier curve (using absolute coordinates) from the current point to
03000 %  (x,y). The control point is assumed to be the reflection of the
03001 %  control point on the previous command relative to the current
03002 %  point. (If there is no previous command or if the previous command was
03003 %  not a DrawPathCurveToQuadraticBezierAbsolute,
03004 %  DrawPathCurveToQuadraticBezierRelative,
03005 %  DrawPathCurveToQuadraticBezierSmoothAbsolute or
03006 %  DrawPathCurveToQuadraticBezierSmoothRelative, assume the control point
03007 %  is coincident with the current point.). At the end of the command, the
03008 %  new current point becomes the final (x,y) coordinate pair used in the
03009 %  polybezier.
03010 %
03011 %  The format of the DrawPathCurveToQuadraticBezierSmoothAbsolute method is:
03012 %
03013 %      void DrawPathCurveToQuadraticBezierSmoothAbsolute(
03014 %        DrawingWand *wand,const double x,const double y)
03015 %
03016 %  A description of each parameter follows:
03017 %
03018 %    o wand: the drawing wand.
03019 %
03020 %    o x: x ordinate of final point
03021 %
03022 %    o y: y ordinate of final point
03023 %
03024 */
03025 
03026 static void DrawPathCurveToQuadraticBezierSmooth(DrawingWand *wand,
03027   const PathMode mode,const double x,const double y)
03028 {
03029   assert(wand != (DrawingWand *) NULL);
03030   assert(wand->signature == WandSignature);
03031   if (wand->debug != MagickFalse)
03032     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
03033   if ((wand->path_operation != PathCurveToQuadraticBezierSmoothOperation) ||
03034       (wand->path_mode != mode))
03035     {
03036       wand->path_operation=PathCurveToQuadraticBezierSmoothOperation;
03037       wand->path_mode=mode;
03038       (void) MvgAutoWrapPrintf(wand,"%c%g,%g",mode == AbsolutePathMode ?
03039         'T' : 't',x,y);
03040     }
03041   else
03042     (void) MvgAutoWrapPrintf(wand," %g,%g",x,y);
03043 }
03044 
03045 WandExport void DrawPathCurveToQuadraticBezierSmoothAbsolute(DrawingWand *wand,
03046   const double x,const double y)
03047 {
03048   assert(wand != (DrawingWand *) NULL);
03049   assert(wand->signature == WandSignature);
03050   if (wand->debug != MagickFalse)
03051     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
03052   DrawPathCurveToQuadraticBezierSmooth(wand,AbsolutePathMode,x,y);
03053 }
03054 
03055 /*
03056 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
03057 %                                                                             %
03058 %                                                                             %
03059 %                                                                             %
03060 %   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   %
03061 %                                                                             %
03062 %                                                                             %
03063 %                                                                             %
03064 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
03065 %
03066 %  DrawPathCurveToQuadraticBezierSmoothAbsolute() draws a quadratic Bezier
03067 %  curve (using relative coordinates) from the current point to (x,y). The
03068 %  control point is assumed to be the reflection of the control point on the
03069 %  previous command relative to the current point. (If there is no previous
03070 %  command or if the previous command was not a
03071 %  DrawPathCurveToQuadraticBezierAbsolute,
03072 %  DrawPathCurveToQuadraticBezierRelative,
03073 %  DrawPathCurveToQuadraticBezierSmoothAbsolute or
03074 %  DrawPathCurveToQuadraticBezierSmoothRelative, assume the control point is
03075 %  coincident with the current point.). At the end of the command, the new
03076 %  current point becomes the final (x,y) coordinate pair used in the polybezier.
03077 %
03078 %  The format of the DrawPathCurveToQuadraticBezierSmoothRelative method is:
03079 %
03080 %      void DrawPathCurveToQuadraticBezierSmoothRelative(DrawingWand *wand,
03081 %        const double x,const double y)
03082 %
03083 %  A description of each parameter follows:
03084 %
03085 %    o wand: the drawing wand.
03086 %
03087 %    o x: x ordinate of final point
03088 %
03089 %    o y: y ordinate of final point
03090 %
03091 */
03092 WandExport void DrawPathCurveToQuadraticBezierSmoothRelative(DrawingWand *wand,
03093   const double x,const double y)
03094 {
03095   DrawPathCurveToQuadraticBezierSmooth(wand,RelativePathMode,x,y);
03096 }
03097 
03098 /*
03099 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
03100 %                                                                             %
03101 %                                                                             %
03102 %                                                                             %
03103 %   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                 %
03104 %                                                                             %
03105 %                                                                             %
03106 %                                                                             %
03107 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
03108 %
03109 %  DrawPathCurveToSmoothAbsolute() draws a cubic Bezier curve from the
03110 %  current point to (x,y) using absolute coordinates. The first control
03111 %  point is assumed to be the reflection of the second control point on
03112 %  the previous command relative to the current point. (If there is no
03113 %  previous command or if the previous command was not an
03114 %  DrawPathCurveToAbsolute, DrawPathCurveToRelative,
03115 %  DrawPathCurveToSmoothAbsolute or DrawPathCurveToSmoothRelative, assume
03116 %  the first control point is coincident with the current point.) (x2,y2)
03117 %  is the second control point (i.e., the control point at the end of the
03118 %  curve). At the end of the command, the new current point becomes the
03119 %  final (x,y) coordinate pair used in the polybezier.
03120 %
03121 %  The format of the DrawPathCurveToSmoothAbsolute method is:
03122 %
03123 %      void DrawPathCurveToSmoothAbsolute(DrawingWand *wand,
03124 %        const double x2const double y2,const double x,const double y)
03125 %
03126 %  A description of each parameter follows:
03127 %
03128 %    o wand: the drawing wand.
03129 %
03130 %    o x2: x ordinate of second control point
03131 %
03132 %    o y2: y ordinate of second control point
03133 %
03134 %    o x: x ordinate of termination point
03135 %
03136 %    o y: y ordinate of termination point
03137 %
03138 */
03139 
03140 static void DrawPathCurveToSmooth(DrawingWand *wand,const PathMode mode,
03141   const double x2,const double y2,const double x,const double y)
03142 {
03143   assert(wand != (DrawingWand *) NULL);
03144   assert(wand->signature == WandSignature);
03145   if (wand->debug != MagickFalse)
03146     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
03147   if ((wand->path_operation != PathCurveToSmoothOperation) ||
03148       (wand->path_mode != mode))
03149     {
03150       wand->path_operation=PathCurveToSmoothOperation;
03151       wand->path_mode=mode;
03152       (void) MvgAutoWrapPrintf(wand,"%c%g,%g %g,%g",mode == AbsolutePathMode ?
03153         'S' : 's',x2,y2,x,y);
03154     }
03155   else
03156     (void) MvgAutoWrapPrintf(wand," %g,%g %g,%g",x2,y2,x,y);
03157 }
03158 
03159 WandExport void DrawPathCurveToSmoothAbsolute(DrawingWand *wand,const double x2,
03160   const double y2,const double x,const double y)
03161 {
03162   assert(wand != (DrawingWand *) NULL);
03163   assert(wand->signature == WandSignature);
03164   if (wand->debug != MagickFalse)
03165     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
03166   DrawPathCurveToSmooth(wand,AbsolutePathMode,x2,y2,x,y);
03167 }
03168 
03169 /*
03170 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
03171 %                                                                             %
03172 %                                                                             %
03173 %                                                                             %
03174 %   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                 %
03175 %                                                                             %
03176 %                                                                             %
03177 %                                                                             %
03178 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
03179 %
03180 %  DrawPathCurveToSmoothRelative() draws a cubic Bezier curve from the current
03181 %  point to (x,y) using relative coordinates. The first control point is
03182 %  assumed to be the reflection of the second control point on the previous
03183 %  command relative to the current point. (If there is no previous command or
03184 %  if the previous command was not an DrawPathCurveToAbsolute,
03185 %  DrawPathCurveToRelative, DrawPathCurveToSmoothAbsolute or
03186 %  DrawPathCurveToSmoothRelative, assume the first control point is coincident
03187 %  with the current point.) (x2,y2) is the second control point (i.e., the
03188 %  control point at the end of the curve). At the end of the command, the new
03189 %  current point becomes the final (x,y) coordinate pair used in the polybezier.
03190 %
03191 %  The format of the DrawPathCurveToSmoothRelative method is:
03192 %
03193 %      void DrawPathCurveToSmoothRelative(DrawingWand *wand,
03194 %        const double x2,const double y2,const double x,const double y)
03195 %
03196 %  A description of each parameter follows:
03197 %
03198 %    o wand: the drawing wand.
03199 %
03200 %    o x2: x ordinate of second control point
03201 %
03202 %    o y2: y ordinate of second control point
03203 %
03204 %    o x: x ordinate of termination point
03205 %
03206 %    o y: y ordinate of termination point
03207 %
03208 */
03209 WandExport void DrawPathCurveToSmoothRelative(DrawingWand *wand,const double x2,
03210   const double y2,const double x,const double y)
03211 {
03212   assert(wand != (DrawingWand *) NULL);
03213   assert(wand->signature == WandSignature);
03214   if (wand->debug != MagickFalse)
03215     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
03216   DrawPathCurveToSmooth(wand,RelativePathMode,x2,y2,x,y);
03217 }
03218 
03219 /*
03220 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
03221 %                                                                             %
03222 %                                                                             %
03223 %                                                                             %
03224 %   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                     %
03225 %                                                                             %
03226 %                                                                             %
03227 %                                                                             %
03228 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
03229 %
03230 %  DrawPathEllipticArcAbsolute() draws an elliptical arc from the current point
03231 %  to (x, y) using absolute coordinates. The size and orientation of the
03232 %  ellipse are defined by two radii (rx, ry) and an xAxisRotation, which
03233 %  indicates how the ellipse as a whole is rotated relative to the current
03234 %  coordinate system. The center (cx, cy) of the ellipse is calculated
03235 %  automagically to satisfy the constraints imposed by the other parameters.
03236 %  largeArcFlag and sweepFlag contribute to the automatic calculations and help
03237 %  determine how the arc is drawn. If largeArcFlag is true then draw the larger
03238 %  of the available arcs. If sweepFlag is true, then draw the arc matching a
03239 %  clock-wise rotation.
03240 %
03241 %  The format of the DrawPathEllipticArcAbsolute method is:
03242 %
03243 %      void DrawPathEllipticArcAbsolute(DrawingWand *wand,
03244 %        const double rx,const double ry,const double x_axis_rotation,
03245 %        const MagickBooleanType large_arc_flag,
03246 %        const MagickBooleanType sweep_flag,const double x,const double y)
03247 %
03248 %  A description of each parameter follows:
03249 %
03250 %    o wand: the drawing wand.
03251 %
03252 %    o rx: x radius
03253 %
03254 %    o ry: y radius
03255 %
03256 %    o x_axis_rotation: indicates how the ellipse as a whole is rotated
03257 %        relative to the current coordinate system
03258 %
03259 %    o large_arc_flag: If non-zero (true) then draw the larger of the
03260 %        available arcs
03261 %
03262 %    o sweep_flag: If non-zero (true) then draw the arc matching a
03263 %        clock-wise rotation
03264 %
03265 %
03266 */
03267 
03268 static void DrawPathEllipticArc(DrawingWand *wand, const PathMode mode,
03269   const double rx,const double ry,const double x_axis_rotation,
03270   const MagickBooleanType large_arc_flag,const MagickBooleanType sweep_flag,
03271   const double x,const double y)
03272 {
03273   assert(wand != (DrawingWand *) NULL);
03274   assert(wand->signature == WandSignature);
03275   if (wand->debug != MagickFalse)
03276     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
03277   if ((wand->path_operation != PathEllipticArcOperation) ||
03278       (wand->path_mode != mode))
03279     {
03280       wand->path_operation=PathEllipticArcOperation;
03281       wand->path_mode=mode;
03282       (void) MvgAutoWrapPrintf(wand, "%c%g,%g %g %u %u %g,%g",
03283         mode == AbsolutePathMode ? 'A' : 'a',rx,ry,x_axis_rotation,
03284         large_arc_flag,sweep_flag,x,y);
03285     }
03286   else
03287     (void) MvgAutoWrapPrintf(wand," %g,%g %g %u %u %g,%g",rx,ry,x_axis_rotation,
03288       large_arc_flag,sweep_flag,x,y);
03289 }
03290 
03291 WandExport void DrawPathEllipticArcAbsolute(DrawingWand *wand,const double rx,
03292   const double ry,const double x_axis_rotation,
03293   const MagickBooleanType large_arc_flag,const MagickBooleanType sweep_flag,
03294   const double x,const double y)
03295 {
03296   assert(wand != (DrawingWand *) NULL);
03297   assert(wand->signature == WandSignature);
03298   if (wand->debug != MagickFalse)
03299     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
03300   DrawPathEllipticArc(wand,AbsolutePathMode,rx,ry,x_axis_rotation,
03301     large_arc_flag,sweep_flag,x,y);
03302 }
03303 
03304 /*
03305 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
03306 %                                                                             %
03307 %                                                                             %
03308 %                                                                             %
03309 %   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                     %
03310 %                                                                             %
03311 %                                                                             %
03312 %                                                                             %
03313 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
03314 %
03315 %  DrawPathEllipticArcRelative() draws an elliptical arc from the current point
03316 %  to (x, y) using relative coordinates. The size and orientation of the
03317 %  ellipse are defined by two radii (rx, ry) and an xAxisRotation, which
03318 %  indicates how the ellipse as a whole is rotated relative to the current
03319 %  coordinate system. The center (cx, cy) of the ellipse is calculated
03320 %  automagically to satisfy the constraints imposed by the other parameters.
03321 %  largeArcFlag and sweepFlag contribute to the automatic calculations and help
03322 %  determine how the arc is drawn. If largeArcFlag is true then draw the larger
03323 %  of the available arcs. If sweepFlag is true, then draw the arc matching a
03324 %  clock-wise rotation.
03325 %
03326 %  The format of the DrawPathEllipticArcRelative method is:
03327 %
03328 %      void DrawPathEllipticArcRelative(DrawingWand *wand,
03329 %        const double rx,const double ry,const double x_axis_rotation,
03330 %        const MagickBooleanType large_arc_flag,
03331 %        const MagickBooleanType sweep_flag,const double x,const double y)
03332 %
03333 %  A description of each parameter follows:
03334 %
03335 %    o wand: the drawing wand.
03336 %
03337 %    o rx: x radius
03338 %
03339 %    o ry: y radius
03340 %
03341 %    o x_axis_rotation: indicates how the ellipse as a whole is rotated
03342 %                       relative to the current coordinate system
03343 %
03344 %    o large_arc_flag: If non-zero (true) then draw the larger of the
03345 %                      available arcs
03346 %
03347 %    o sweep_flag: If non-zero (true) then draw the arc matching a
03348 %                  clock-wise rotation
03349 %
03350 */
03351 WandExport void DrawPathEllipticArcRelative(DrawingWand *wand,const double rx,
03352   const double ry,const double x_axis_rotation,
03353   const MagickBooleanType large_arc_flag,const MagickBooleanType sweep_flag,
03354   const double x,const double y)
03355 {
03356   DrawPathEllipticArc(wand,RelativePathMode,rx,ry,x_axis_rotation,
03357     large_arc_flag,sweep_flag,x,y);
03358 }
03359 
03360 /*
03361 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
03362 %                                                                             %
03363 %                                                                             %
03364 %                                                                             %
03365 %   D r a w P a t h F i n i s h                                               %
03366 %                                                                             %
03367 %                                                                             %
03368 %                                                                             %
03369 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
03370 %
03371 %  DrawPathFinish() terminates the current path.
03372 %
03373 %  The format of the DrawPathFinish method is:
03374 %
03375 %      void DrawPathFinish(DrawingWand *wand)
03376 %
03377 %  A description of each parameter follows:
03378 %
03379 %    o wand: the drawing wand.
03380 %
03381 */
03382 WandExport void DrawPathFinish(DrawingWand *wand)
03383 {
03384   assert(wand != (DrawingWand *) NULL);
03385   assert(wand->signature == WandSignature);
03386   if (wand->debug != MagickFalse)
03387     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
03388   (void) MvgPrintf(wand,"'\n");
03389   wand->path_operation=PathDefaultOperation;
03390   wand->path_mode=DefaultPathMode;
03391 }
03392 
03393 /*
03394 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
03395 %                                                                             %
03396 %                                                                             %
03397 %                                                                             %
03398 %   D r a w P a t h L i n e T o A b s o l u t e                               %
03399 %                                                                             %
03400 %                                                                             %
03401 %                                                                             %
03402 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
03403 %
03404 %  DrawPathLineToAbsolute() draws a line path from the current point to the
03405 %  given coordinate using absolute coordinates. The coordinate then becomes
03406 %  the new current point.
03407 %
03408 %  The format of the DrawPathLineToAbsolute method is:
03409 %
03410 %      void DrawPathLineToAbsolute(DrawingWand *wand,const double x,
03411 %        const double y)
03412 %
03413 %  A description of each parameter follows:
03414 %
03415 %    o wand: the drawing wand.
03416 %
03417 %    o x: target x ordinate
03418 %
03419 %    o y: target y ordinate
03420 %
03421 */
03422 static void DrawPathLineTo(DrawingWand *wand,const PathMode mode,
03423   const double x,const double y)
03424 {
03425   assert(wand != (DrawingWand *) NULL);
03426   assert(wand->signature == WandSignature);
03427   if (wand->debug != MagickFalse)
03428     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
03429   if ((wand->path_operation != PathLineToOperation) ||
03430       (wand->path_mode != mode))
03431     {
03432       wand->path_operation=PathLineToOperation;
03433       wand->path_mode=mode;
03434       (void) MvgAutoWrapPrintf(wand,"%c%g,%g",mode == AbsolutePathMode ?
03435         'L' : 'l',x,y);
03436     }
03437   else
03438     (void) MvgAutoWrapPrintf(wand," %g,%g",x,y);
03439 }
03440 
03441 WandExport void DrawPathLineToAbsolute(DrawingWand *wand,const double x,
03442   const double y)
03443 {
03444   assert(wand != (DrawingWand *) NULL);
03445   assert(wand->signature == WandSignature);
03446   if (wand->debug != MagickFalse)
03447     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
03448   DrawPathLineTo(wand,AbsolutePathMode,x,y);
03449 }
03450 
03451 /*
03452 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
03453 %                                                                             %
03454 %                                                                             %
03455 %                                                                             %
03456 %   D r a w P a t h L i n e T o R e l a t i v e                               %
03457 %                                                                             %
03458 %                                                                             %
03459 %                                                                             %
03460 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
03461 %
03462 %  DrawPathLineToRelative() draws a line path from the current point to the
03463 %  given coordinate using relative coordinates. The coordinate then becomes
03464 %  the new current point.
03465 %
03466 %  The format of the DrawPathLineToRelative method is:
03467 %
03468 %      void DrawPathLineToRelative(DrawingWand *wand,const double x,
03469 %        const double y)
03470 %
03471 %  A description of each parameter follows:
03472 %
03473 %    o wand: the drawing wand.
03474 %
03475 %    o x: target x ordinate
03476 %
03477 %    o y: target y ordinate
03478 %
03479 */
03480 WandExport void DrawPathLineToRelative(DrawingWand *wand,const double x,
03481   const double y)
03482 {
03483   assert(wand != (DrawingWand *) NULL);
03484   assert(wand->signature == WandSignature);
03485   if (wand->debug != MagickFalse)
03486     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
03487   DrawPathLineTo(wand,RelativePathMode,x,y);
03488 }
03489 
03490 /*
03491 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
03492 %                                                                             %
03493 %                                                                             %
03494 %                                                                             %
03495 %   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           %
03496 %                                                                             %
03497 %                                                                             %
03498 %                                                                             %
03499 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
03500 %
03501 %  DrawPathLineToHorizontalAbsolute() draws a horizontal line path from the
03502 %  current point to the target point using absolute coordinates.  The target
03503 %  point then becomes the new current point.
03504 %
03505 %  The format of the DrawPathLineToHorizontalAbsolute method is:
03506 %
03507 %      void DrawPathLineToHorizontalAbsolute(DrawingWand *wand,
03508 %        const PathMode mode,const double x)
03509 %
03510 %  A description of each parameter follows:
03511 %
03512 %    o wand: the drawing wand.
03513 %
03514 %    o x: target x ordinate
03515 %
03516 */
03517 
03518 static void DrawPathLineToHorizontal(DrawingWand *wand,const PathMode mode,
03519   const double x)
03520 {
03521   assert(wand != (DrawingWand *) NULL);
03522   assert(wand->signature == WandSignature);
03523   if (wand->debug != MagickFalse)
03524     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
03525   if ((wand->path_operation != PathLineToHorizontalOperation) ||
03526       (wand->path_mode != mode))
03527     {
03528       wand->path_operation=PathLineToHorizontalOperation;
03529       wand->path_mode=mode;
03530       (void) MvgAutoWrapPrintf(wand,"%c%g",mode == AbsolutePathMode ?
03531         'H' : 'h',x);
03532     }
03533   else
03534     (void) MvgAutoWrapPrintf(wand," %g",x);
03535 }
03536 
03537 WandExport void DrawPathLineToHorizontalAbsolute(DrawingWand *wand,
03538   const double x)
03539 {
03540   assert(wand != (DrawingWand *) NULL);
03541   assert(wand->signature == WandSignature);
03542   if (wand->debug != MagickFalse)
03543     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
03544   DrawPathLineToHorizontal(wand,AbsolutePathMode,x);
03545 }
03546 
03547 /*
03548 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
03549 %                                                                             %
03550 %                                                                             %
03551 %                                                                             %
03552 %   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           %
03553 %                                                                             %
03554 %                                                                             %
03555 %                                                                             %
03556 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
03557 %
03558 %  DrawPathLineToHorizontalRelative() draws a horizontal line path from the
03559 %  current point to the target point using relative coordinates.  The target
03560 %  point then becomes the new current point.
03561 %
03562 %  The format of the DrawPathLineToHorizontalRelative method is:
03563 %
03564 %      void DrawPathLineToHorizontalRelative(DrawingWand *wand,
03565 %        const double x)
03566 %
03567 %  A description of each parameter follows:
03568 %
03569 %    o wand: the drawing wand.
03570 %
03571 %    o x: target x ordinate
03572 %
03573 */
03574 WandExport void DrawPathLineToHorizontalRelative(DrawingWand *wand,
03575   const double x)
03576 {
03577   DrawPathLineToHorizontal(wand,RelativePathMode,x);
03578 }
03579 
03580 /*
03581 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
03582 %                                                                             %
03583 %                                                                             %
03584 %                                                                             %
03585 %   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               %
03586 %                                                                             %
03587 %                                                                             %
03588 %                                                                             %
03589 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
03590 %
03591 %  DrawPathLineToVerticalAbsolute() draws a vertical line path from the
03592 %  current point to the target point using absolute coordinates.  The target
03593 %  point then becomes the new current point.
03594 %
03595 %  The format of the DrawPathLineToVerticalAbsolute method is:
03596 %
03597 %      void DrawPathLineToVerticalAbsolute(DrawingWand *wand,
03598 %        const double y)
03599 %
03600 %  A description of each parameter follows:
03601 %
03602 %    o wand: the drawing wand.
03603 %
03604 %    o y: target y ordinate
03605 %
03606 */
03607 
03608 static void DrawPathLineToVertical(DrawingWand *wand,const PathMode mode,
03609   const double y)
03610 {
03611   assert(wand != (DrawingWand *) NULL);
03612   assert(wand->signature == WandSignature);
03613   if (wand->debug != MagickFalse)
03614     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
03615   if ((wand->path_operation != PathLineToVerticalOperation) ||
03616       (wand->path_mode != mode))
03617     {
03618       wand->path_operation=PathLineToVerticalOperation;
03619       wand->path_mode=mode;
03620       (void) MvgAutoWrapPrintf(wand,"%c%g",mode == AbsolutePathMode ?
03621         'V' : 'v',y);
03622     }
03623   else
03624     (void) MvgAutoWrapPrintf(wand," %g",y);
03625 }
03626 
03627 WandExport void DrawPathLineToVerticalAbsolute(DrawingWand *wand,const double y)
03628 {
03629   assert(wand != (DrawingWand *) NULL);
03630   assert(wand->signature == WandSignature);
03631   if (wand->debug != MagickFalse)
03632     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
03633   DrawPathLineToVertical(wand,AbsolutePathMode,y);
03634 }
03635 
03636 /*
03637 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
03638 %                                                                             %
03639 %                                                                             %
03640 %                                                                             %
03641 %   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               %
03642 %                                                                             %
03643 %                                                                             %
03644 %                                                                             %
03645 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
03646 %
03647 %  DrawPathLineToVerticalRelative() draws a vertical line path from the
03648 %  current point to the target point using relative coordinates.  The target
03649 %  point then becomes the new current point.
03650 %
03651 %  The format of the DrawPathLineToVerticalRelative method is:
03652 %
03653 %      void DrawPathLineToVerticalRelative(DrawingWand *wand,
03654 %        const double y)
03655 %
03656 %  A description of each parameter follows:
03657 %
03658 %    o wand: the drawing wand.
03659 %
03660 %    o y: target y ordinate
03661 %
03662 */
03663 WandExport void DrawPathLineToVerticalRelative(DrawingWand *wand,const double y)
03664 {
03665   assert(wand != (DrawingWand *) NULL);
03666   assert(wand->signature == WandSignature);
03667   if (wand->debug != MagickFalse)
03668     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
03669   DrawPathLineToVertical(wand,RelativePathMode,y);
03670 }
03671 /*
03672 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
03673 %                                                                             %
03674 %                                                                             %
03675 %                                                                             %
03676 %   D r a w P a t h M o v e T o A b s o l u t e                               %
03677 %                                                                             %
03678 %                                                                             %
03679 %                                                                             %
03680 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
03681 %
03682 %  DrawPathMoveToAbsolute() starts a new sub-path at the given coordinate
03683 %  using absolute coordinates. The current point then becomes the
03684 %  specified coordinate.
03685 %
03686 %  The format of the DrawPathMoveToAbsolute method is:
03687 %
03688 %      void DrawPathMoveToAbsolute(DrawingWand *wand,const double x,
03689 %        const double y)
03690 %
03691 %  A description of each parameter follows:
03692 %
03693 %    o wand: the drawing wand.
03694 %
03695 %    o x: target x ordinate
03696 %
03697 %    o y: target y ordinate
03698 %
03699 */
03700 
03701 static void DrawPathMoveTo(DrawingWand *wand,const PathMode mode,const double x,
03702   const double y)
03703 {
03704   assert(wand != (DrawingWand *) NULL);
03705   assert(wand->signature == WandSignature);
03706   if (wand->debug != MagickFalse)
03707     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
03708   if ((wand->path_operation != PathMoveToOperation) ||
03709       (wand->path_mode != mode))
03710     {
03711       wand->path_operation=PathMoveToOperation;
03712       wand->path_mode=mode;
03713       (void) MvgAutoWrapPrintf(wand,"%c%g,%g",mode == AbsolutePathMode ?
03714         'M' : 'm',x,y);
03715     }
03716   else
03717     (void) MvgAutoWrapPrintf(wand," %g,%g",x,y);
03718 }
03719 
03720 WandExport void DrawPathMoveToAbsolute(DrawingWand *wand,const double x,
03721   const double y)
03722 {
03723   assert(wand != (DrawingWand *) NULL);
03724   assert(wand->signature == WandSignature);
03725   if (wand->debug != MagickFalse)
03726     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
03727   DrawPathMoveTo(wand,AbsolutePathMode,x,y);
03728 }
03729 
03730 /*
03731 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
03732 %                                                                             %
03733 %                                                                             %
03734 %                                                                             %
03735 %   D r a w P a t h M o v e T o R e l a t i v e                               %
03736 %                                                                             %
03737 %                                                                             %
03738 %                                                                             %
03739 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
03740 %
03741 %  DrawPathMoveToRelative() starts a new sub-path at the given coordinate using
03742 %  relative coordinates. The current point then becomes the specified
03743 %  coordinate.
03744 %
03745 %  The format of the DrawPathMoveToRelative method is:
03746 %
03747 %      void DrawPathMoveToRelative(DrawingWand *wand,const double x,
03748 %        const double y)
03749 %
03750 %  A description of each parameter follows:
03751 %
03752 %    o wand: the drawing wand.
03753 %
03754 %    o x: target x ordinate
03755 %
03756 %    o y: target y ordinate
03757 %
03758 */
03759 WandExport void DrawPathMoveToRelative(DrawingWand *wand,const double x,
03760   const double y)
03761 {
03762   assert(wand != (DrawingWand *) NULL);
03763   assert(wand->signature == WandSignature);
03764   if (wand->debug != MagickFalse)
03765     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
03766   DrawPathMoveTo(wand,RelativePathMode,x,y);
03767 }
03768 
03769 /*
03770 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
03771 %                                                                             %
03772 %                                                                             %
03773 %                                                                             %
03774 %   D r a w P a t h S t a r t                                                 %
03775 %                                                                             %
03776 %                                                                             %
03777 %                                                                             %
03778 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
03779 %
03780 %  DrawPathStart() declares the start of a path drawing list which is terminated
03781 %  by a matching DrawPathFinish() command. All other DrawPath commands must
03782 %  be enclosed between a DrawPathStart() and a DrawPathFinish() command. This
03783 %  is because path drawing commands are subordinate commands and they do not
03784 %  function by themselves.
03785 %
03786 %  The format of the DrawPathStart method is:
03787 %
03788 %      void DrawPathStart(DrawingWand *wand)
03789 %
03790 %  A description of each parameter follows:
03791 %
03792 %    o wand: the drawing wand.
03793 %
03794 */
03795 WandExport void DrawPathStart(DrawingWand *wand)
03796 {
03797   assert(wand != (DrawingWand *) NULL);
03798   assert(wand->signature == WandSignature);
03799   if (wand->debug != MagickFalse)
03800     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
03801   (void) MvgPrintf(wand,"path '");
03802   wand->path_operation=PathDefaultOperation;
03803   wand->path_mode=DefaultPathMode;
03804 }
03805 
03806 /*
03807 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
03808 %                                                                             %
03809 %                                                                             %
03810 %                                                                             %
03811 %   D r a w P o i n t                                                         %
03812 %                                                                             %
03813 %                                                                             %
03814 %                                                                             %
03815 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
03816 %
03817 %  DrawPoint() draws a point using the current fill color.
03818 %
03819 %  The format of the DrawPoint method is:
03820 %
03821 %      void DrawPoint(DrawingWand *wand,const double x,const double y)
03822 %
03823 %  A description of each parameter follows:
03824 %
03825 %    o wand: the drawing wand.
03826 %
03827 %    o x: target x coordinate
03828 %
03829 %    o y: target y coordinate
03830 %
03831 */
03832 WandExport void DrawPoint(DrawingWand *wand,const double x,const double y)
03833 {
03834   assert(wand != (DrawingWand *) NULL);
03835   assert(wand->signature == WandSignature);
03836   if (wand->debug != MagickFalse)
03837     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
03838   (void) MvgPrintf(wand,"point %g,%g\n",x,y);
03839 }
03840 
03841 /*
03842 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
03843 %                                                                             %
03844 %                                                                             %
03845 %                                                                             %
03846 %   D r a w P o l y g o n                                                     %
03847 %                                                                             %
03848 %                                                                             %
03849 %                                                                             %
03850 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
03851 %
03852 %  DrawPolygon() draws a polygon using the current stroke, stroke width, and
03853 %  fill color or texture, using the specified array of coordinates.
03854 %
03855 %  The format of the DrawPolygon method is:
03856 %
03857 %      void DrawPolygon(DrawingWand *wand,
03858 %        const unsigned long number_coordinates,const PointInfo *coordinates)
03859 %
03860 %  A description of each parameter follows:
03861 %
03862 %    o wand: the drawing wand.
03863 %
03864 %    o number_coordinates: number of coordinates
03865 %
03866 %    o coordinates: coordinate array
03867 %
03868 */
03869 WandExport void DrawPolygon(DrawingWand *wand,
03870   const unsigned long number_coordinates,const PointInfo *coordinates)
03871 {
03872   assert(wand != (DrawingWand *) NULL);
03873   assert(wand->signature == WandSignature);
03874   if (wand->debug != MagickFalse)
03875     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
03876   MvgAppendPointsCommand(wand,"polygon",number_coordinates,coordinates);
03877 }
03878 
03879 /*
03880 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
03881 %                                                                             %
03882 %                                                                             %
03883 %                                                                             %
03884 %   D r a w P o l y l i n e                                                   %
03885 %                                                                             %
03886 %                                                                             %
03887 %                                                                             %
03888 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
03889 %
03890 %  DrawPolyline() draws a polyline using the current stroke, stroke width, and
03891 %  fill color or texture, using the specified array of coordinates.
03892 %
03893 %  The format of the DrawPolyline method is:
03894 %
03895 %      void DrawPolyline(DrawingWand *wand,
03896 %        const unsigned long number_coordinates,const PointInfo *coordinates)
03897 %
03898 %  A description of each parameter follows:
03899 %
03900 %    o wand: the drawing wand.
03901 %
03902 %    o number_coordinates: number of coordinates
03903 %
03904 %    o coordinates: coordinate array
03905 %
03906 */
03907 WandExport void DrawPolyline(DrawingWand *wand,
03908   const unsigned long number_coordinates,const PointInfo *coordinates)
03909 {
03910   assert(wand != (DrawingWand *) NULL);
03911   assert(wand->signature == WandSignature);
03912   if (wand->debug != MagickFalse)
03913     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
03914   MvgAppendPointsCommand(wand,"polyline",number_coordinates,coordinates);
03915 }
03916 
03917 /*
03918 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
03919 %                                                                             %
03920 %                                                                             %
03921 %                                                                             %
03922 %   D r a w P o p C l i p P a t h                                             %
03923 %                                                                             %
03924 %                                                                             %
03925 %                                                                             %
03926 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
03927 %
03928 %  DrawPopClipPath() terminates a clip path definition.
03929 %
03930 %  The format of the DrawPopClipPath method is:
03931 %
03932 %      void DrawPopClipPath(DrawingWand *wand)
03933 %
03934 %  A description of each parameter follows:
03935 %
03936 %    o wand: the drawing wand.
03937 %
03938 */
03939 WandExport void DrawPopClipPath(DrawingWand *wand)
03940 {
03941   assert(wand != (DrawingWand *) NULL);
03942   assert(wand->signature == WandSignature);
03943   if (wand->debug != MagickFalse)
03944     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
03945   if (wand->indent_depth > 0)
03946     wand->indent_depth--;
03947   (void) MvgPrintf(wand,"pop clip-path\n");
03948 }
03949 
03950 /*
03951 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
03952 %                                                                             %
03953 %                                                                             %
03954 %                                                                             %
03955 %   D r a w P o p D e f s                                                     %
03956 %                                                                             %
03957 %                                                                             %
03958 %                                                                             %
03959 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
03960 %
03961 %  DrawPopDefs() terminates a definition list.
03962 %
03963 %  The format of the DrawPopDefs method is:
03964 %
03965 %      void DrawPopDefs(DrawingWand *wand)
03966 %
03967 %  A description of each parameter follows:
03968 %
03969 %    o wand: the drawing wand.
03970 %
03971 */
03972 WandExport void DrawPopDefs(DrawingWand *wand)
03973 {
03974   assert(wand != (DrawingWand *) NULL);
03975   assert(wand->signature == WandSignature);
03976   if (wand->debug != MagickFalse)
03977     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
03978   if (wand->indent_depth > 0)
03979     wand->indent_depth--;
03980   (void) MvgPrintf(wand,"pop defs\n");
03981 }
03982 
03983 /*
03984 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
03985 %                                                                             %
03986 %                                                                             %
03987 %                                                                             %
03988 %   D r a w P o p P a t t e r n                                               %
03989 %                                                                             %
03990 %                                                                             %
03991 %                                                                             %
03992 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
03993 %
03994 %  DrawPopPattern() terminates a pattern definition.
03995 %
03996 %  The format of the DrawPopPattern method is:
03997 %
03998 %      MagickBooleanType DrawPopPattern(DrawingWand *wand)
03999 %
04000 %  A description of each parameter follows:
04001 %
04002 %    o wand: the drawing wand.
04003 %
04004 */
04005 WandExport MagickBooleanType DrawPopPattern(DrawingWand *wand)
04006 {
04007   char
04008     geometry[MaxTextExtent],
04009     key[MaxTextExtent];
04010 
04011   assert(wand != (DrawingWand *) NULL);
04012   assert(wand->signature == WandSignature);
04013   if (wand->debug != MagickFalse)
04014     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
04015   if (wand->image == (Image *) NULL)
04016     ThrowDrawException(WandError,"ContainsNoImages",wand->name);
04017   if (wand->pattern_id == (const char *) NULL)
04018     {
04019       ThrowDrawException(DrawWarning,"NotCurrentlyPushingPatternDefinition",
04020         wand->name);
04021       return(MagickFalse);
04022     }
04023   (void) FormatMagickString(key,MaxTextExtent,"%s",wand->pattern_id);
04024   (void) SetImageArtifact(wand->image,key,wand->mvg+wand->pattern_offset);
04025   (void) FormatMagickString(geometry,MaxTextExtent,"%lux%lu%+ld%+ld",
04026     wand->pattern_bounds.width,wand->pattern_bounds.height,
04027     wand->pattern_bounds.x,wand->pattern_bounds.y);
04028   (void) SetImageArtifact(wand->image,key,geometry);
04029   wand->pattern_id=DestroyString(wand->pattern_id);
04030   wand->pattern_offset=0;
04031   wand->pattern_bounds.x=0;
04032   wand->pattern_bounds.y=0;
04033   wand->pattern_bounds.width=0;
04034   wand->pattern_bounds.height=0;
04035   wand->filter_off=MagickTrue;
04036   if (wand->indent_depth > 0)
04037     wand->indent_depth--;
04038   (void) MvgPrintf(wand,"pop pattern\n");
04039   return(MagickTrue);
04040 }
04041 
04042 /*
04043 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
04044 %                                                                             %
04045 %                                                                             %
04046 %                                                                             %
04047 %   D r a w P u s h C l i p P a t h                                           %
04048 %                                                                             %
04049 %                                                                             %
04050 %                                                                             %
04051 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
04052 %
04053 %  DrawPushClipPath() starts a clip path definition which is comprized of any
04054 %  number of drawing commands and terminated by a DrawPopClipPath() command.
04055 %
04056 %  The format of the DrawPushClipPath method is:
04057 %
04058 %      void DrawPushClipPath(DrawingWand *wand,const char *clip_mask_id)
04059 %
04060 %  A description of each parameter follows:
04061 %
04062 %    o wand: the drawing wand.
04063 %
04064 %    o clip_mask_id: string identifier to associate with the clip path for
04065 %      later use.
04066 %
04067 */
04068 WandExport void DrawPushClipPath(DrawingWand *wand,const char *clip_mask_id)
04069 {
04070   assert(wand != (DrawingWand *) NULL);
04071   assert(wand->signature == WandSignature);
04072   if (wand->debug != MagickFalse)
04073     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
04074   assert(clip_mask_id != (const char *) NULL);
04075   (void) MvgPrintf(wand,"push clip-path %s\n",clip_mask_id);
04076   wand->indent_depth++;
04077 }
04078 
04079 /*
04080 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
04081 %                                                                             %
04082 %                                                                             %
04083 %                                                                             %
04084 %   D r a w P u s h D e f s                                                   %
04085 %                                                                             %
04086 %                                                                             %
04087 %                                                                             %
04088 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
04089 %
04090 %  DrawPushDefs() indicates that commands up to a terminating DrawPopDefs()
04091 %  command create named elements (e.g. clip-paths, textures, etc.) which
04092 %  may safely be processed earlier for the sake of efficiency.
04093 %
04094 %  The format of the DrawPushDefs method is:
04095 %
04096 %      void DrawPushDefs(DrawingWand *wand)
04097 %
04098 %  A description of each parameter follows:
04099 %
04100 %    o wand: the drawing wand.
04101 %
04102 */
04103 WandExport void DrawPushDefs(DrawingWand *wand)
04104 {
04105   assert(wand != (DrawingWand *) NULL);
04106   assert(wand->signature == WandSignature);
04107   if (wand->debug != MagickFalse)
04108     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
04109   (void) MvgPrintf(wand,"push defs\n");
04110   wand->indent_depth++;
04111 }
04112 
04113 /*
04114 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
04115 %                                                                             %
04116 %                                                                             %
04117 %                                                                             %
04118 %   D r a w P u s h P a t t e r n                                             %
04119 %                                                                             %
04120 %                                                                             %
04121 %                                                                             %
04122 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
04123 %
04124 %  DrawPushPattern() indicates that subsequent commands up to a
04125 %  DrawPopPattern() command comprise the definition of a named pattern.
04126 %  The pattern space is assigned top left corner coordinates, a width
04127 %  and height, and becomes its own drawing space.  Anything which can
04128 %  be drawn may be used in a pattern definition.
04129 %  Named patterns may be used as stroke or brush definitions.
04130 %
04131 %  The format of the DrawPushPattern method is:
04132 %
04133 %      MagickBooleanType DrawPushPattern(DrawingWand *wand,
04134 %        const char *pattern_id,const double x,const double y,
04135 %        const double width,const double height)
04136 %
04137 %  A description of each parameter follows:
04138 %
04139 %    o wand: the drawing wand.
04140 %
04141 %    o pattern_id: pattern identification for later reference
04142 %
04143 %    o x: x ordinate of top left corner
04144 %
04145 %    o y: y ordinate of top left corner
04146 %
04147 %    o width: width of pattern space
04148 %
04149 %    o height: height of pattern space
04150 %
04151 */
04152 WandExport MagickBooleanType DrawPushPattern(DrawingWand *wand,
04153   const char *pattern_id,const double x,const double y,const double width,
04154   const double height)
04155 {
04156   assert(wand != (DrawingWand *) NULL);
04157   assert(wand->signature == WandSignature);
04158   if (wand->debug != MagickFalse)
04159     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
04160   assert(pattern_id != (const char *) NULL);
04161   if (wand->pattern_id != NULL)
04162     {
04163       ThrowDrawException(DrawError,"AlreadyPushingPatternDefinition",
04164         wand->pattern_id);
04165       return(MagickFalse);
04166     }
04167   wand->filter_off=MagickTrue;
04168   (void) MvgPrintf(wand,"push pattern %s %g,%g %g,%g\n",pattern_id,x,y,
04169     width,height);
04170   wand->indent_depth++;
04171   wand->pattern_id=AcquireString(pattern_id);
04172   wand->pattern_bounds.x=(long) ceil(x-0.5);
04173   wand->pattern_bounds.y=(long) ceil(y-0.5);
04174   wand->pattern_bounds.width=(unsigned long) (width+0.5);
04175   wand->pattern_bounds.height=(unsigned long) (height+0.5);
04176   wand->pattern_offset=wand->mvg_length;
04177   return(MagickTrue);
04178 }
04179 
04180 /*
04181 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
04182 %                                                                             %
04183 %                                                                             %
04184 %                                                                             %
04185 %   D r a w R e c t a n g l e                                                 %
04186 %                                                                             %
04187 %                                                                             %
04188 %                                                                             %
04189 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
04190 %
04191 %  DrawRectangle() draws a rectangle given two coordinates and using the
04192 %  current stroke, stroke width, and fill settings.
04193 %
04194 %  The format of the DrawRectangle method is:
04195 %
04196 %      void DrawRectangle(DrawingWand *wand,const double x1,
04197 %        const double y1,const double x2,const double y2)
04198 %
04199 %  A description of each parameter follows:
04200 %
04201 %    o x1: x ordinate of first coordinate
04202 %
04203 %    o y1: y ordinate of first coordinate
04204 %
04205 %    o x2: x ordinate of second coordinate
04206 %
04207 %    o y2: y ordinate of second coordinate
04208 %
04209 */
04210 WandExport void DrawRectangle(DrawingWand *wand,const double x1,const double y1,
04211   const double x2,const double y2)
04212 {
04213   assert(wand != (DrawingWand *) NULL);
04214   assert(wand->signature == WandSignature);
04215   if (wand->debug != MagickFalse)
04216     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
04217   (void) MvgPrintf(wand,"rectangle %g,%g %g,%g\n",x1,y1,x2,y2);
04218 }
04219 
04220 /*
04221 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
04222 %                                                                             %
04223 %                                                                             %
04224 %                                                                             %
04225 +   D r a w R e n d e r                                                       %
04226 %                                                                             %
04227 %                                                                             %
04228 %                                                                             %
04229 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
04230 %
04231