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