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