1 // This may look like C code, but it is really -*- C++ -*- 2 // 3 // Copyright Bob Friesenhahn, 1999, 2000, 2001, 2002, 2003 4 // Copyright Dirk Lemstra 2014-2015 5 // 6 // Implementation of Drawable (Graphic objects) 7 // 8 9 #define MAGICKCORE_IMPLEMENTATION 1 10 #define MAGICK_PLUSPLUS_IMPLEMENTATION 1 11 #define MAGICK_DRAWABLE_IMPLEMENTATION 12 13 #include "Magick++/Include.h" 14 #include <math.h> 15 #include <string> 16 17 #include "Magick++/Drawable.h" 18 #include "Magick++/Image.h" 19 20 using namespace std; 21 22 MagickPPExport int Magick::operator == (const Magick::Coordinate& left_, 23 const Magick::Coordinate& right_) 24 { 25 return((left_.x() == right_.x()) && (left_.y() == right_.y())); 26 } 27 28 MagickPPExport int Magick::operator != (const Magick::Coordinate& left_, 29 const Magick::Coordinate& right_) 30 { 31 return(!(left_ == right_)); 32 } 33 34 MagickPPExport int Magick::operator > (const Magick::Coordinate& left_, 35 const Magick::Coordinate& right_) 36 { 37 return (!(left_ < right_) && (left_ != right_)); 38 } 39 40 MagickPPExport int Magick::operator < (const Magick::Coordinate& left_, 41 const Magick::Coordinate& right_) 42 { 43 // Based on distance from origin 44 return((sqrt(left_.x()*left_.x() + left_.y()*left_.y())) < 45 (sqrt(right_.x()*right_.x() + right_.y()*right_.y()))); 46 } 47 48 MagickPPExport int Magick::operator >= (const Magick::Coordinate& left_, 49 const Magick::Coordinate& right_) 50 { 51 return((left_ > right_) || (left_ == right_)); 52 } 53 54 MagickPPExport int Magick::operator <= (const Magick::Coordinate& left_, 55 const Magick::Coordinate& right_) 56 { 57 return((left_ < right_) || (left_ == right_)); 58 } 59 60 /* DrawableBase */ 61 Magick::DrawableBase::DrawableBase() 62 { 63 } 64 65 Magick::DrawableBase::~DrawableBase(void) 66 { 67 } 68 69 void Magick::DrawableBase::operator()(MagickCore::DrawingWand * context_) const 70 { 71 (void) context_; 72 } 73 74 Magick::DrawableBase* Magick::DrawableBase::copy() const 75 { 76 return new DrawableBase(*this); 77 } 78 79 /* Drawable */ 80 Magick::Drawable::Drawable(void) 81 : dp((Magick::DrawableBase *) NULL) 82 { 83 } 84 85 Magick::Drawable::Drawable(const Magick::DrawableBase& original_) 86 : dp(original_.copy()) 87 { 88 } 89 90 Magick::Drawable::~Drawable(void) 91 { 92 delete dp; 93 dp=(Magick::DrawableBase *) NULL; 94 } 95 96 Magick::Drawable::Drawable(const Magick::Drawable& original_) 97 : dp((original_.dp != (Magick::DrawableBase *) NULL ? original_.dp->copy() : 98 (Magick::DrawableBase *) NULL)) 99 { 100 } 101 102 Magick::Drawable& Magick::Drawable::operator= ( 103 const Magick::Drawable& original_) 104 { 105 DrawableBase 106 *temp_dp; 107 108 if (this != &original_) 109 { 110 temp_dp=(original_.dp != (Magick::DrawableBase *) NULL ? 111 original_.dp->copy() : (Magick::DrawableBase *) NULL); 112 delete dp; 113 dp=temp_dp; 114 } 115 return(*this); 116 } 117 118 void Magick::Drawable::operator()(MagickCore::DrawingWand * context_) const 119 { 120 if (dp != (Magick::DrawableBase *) NULL) 121 dp->operator()(context_); 122 } 123 124 /*virtual*/ 125 Magick::VPathBase::~VPathBase ( void ) 126 { 127 } 128 129 // Constructor 130 Magick::VPath::VPath ( void ) 131 : dp(0) 132 { 133 } 134 135 // Construct from VPathBase 136 Magick::VPath::VPath ( const Magick::VPathBase& original_ ) 137 : dp(original_.copy()) 138 { 139 } 140 141 // Destructor 142 /* virtual */ Magick::VPath::~VPath ( void ) 143 { 144 delete dp; 145 dp = 0; 146 } 147 148 // Copy constructor 149 Magick::VPath::VPath ( const Magick::VPath& original_ ) 150 : dp(original_.dp? original_.dp->copy(): 0) 151 { 152 } 153 154 // Assignment operator 155 Magick::VPath& Magick::VPath::operator= (const Magick::VPath& original_ ) 156 { 157 if (this != &original_) 158 { 159 VPathBase* temp_dp = (original_.dp ? original_.dp->copy() : 0); 160 delete dp; 161 dp = temp_dp; 162 } 163 return *this; 164 } 165 166 // Operator to invoke contained object 167 void Magick::VPath::operator()( MagickCore::DrawingWand * context_ ) const 168 { 169 if(dp) 170 dp->operator()( context_ ); 171 } 172 173 MagickPPExport int Magick::operator == ( const Magick::VPath& /*left_*/, 174 const Magick::VPath& /*right_*/ ) 175 { 176 return ( 1 ); 177 } 178 MagickPPExport int Magick::operator != ( const Magick::VPath& /*left_*/, 179 const Magick::VPath& /*right_*/ ) 180 { 181 return ( 0 ); 182 } 183 MagickPPExport int Magick::operator > ( const Magick::VPath& /*left_*/, 184 const Magick::VPath& /*right_*/ ) 185 { 186 return ( 0 ); 187 } 188 MagickPPExport int Magick::operator < ( const Magick::VPath& /*left_*/, 189 const Magick::VPath& /*right_*/ ) 190 { 191 return ( 0 ); 192 } 193 MagickPPExport int Magick::operator >= ( const Magick::VPath& left_, 194 const Magick::VPath& right_ ) 195 { 196 return ( ( left_ > right_ ) || ( left_ == right_ ) ); 197 } 198 MagickPPExport int Magick::operator <= ( const Magick::VPath& left_, 199 const Magick::VPath& right_ ) 200 { 201 return ( ( left_ < right_ ) || ( left_ == right_ ) ); 202 } 203 204 // 205 // Drawable Objects 206 // 207 208 // Affine (scaling, rotation, and translation) 209 Magick::DrawableAffine::DrawableAffine( double sx_, double sy_, 210 double rx_, double ry_, 211 double tx_, double ty_ ) 212 { 213 _affine.sx = sx_; 214 _affine.rx = rx_; 215 _affine.ry = ry_; 216 _affine.sy = sy_; 217 _affine.tx = tx_; 218 _affine.ty = ty_; 219 } 220 Magick::DrawableAffine::DrawableAffine( void ) 221 { 222 GetAffineMatrix(&_affine); 223 } 224 Magick::DrawableAffine::~DrawableAffine( void ) 225 { 226 } 227 void Magick::DrawableAffine::operator()( MagickCore::DrawingWand * context_ ) const 228 { 229 DrawAffine( context_, &_affine ); 230 } 231 Magick::DrawableBase* Magick::DrawableAffine::copy() const 232 { 233 return new DrawableAffine(*this); 234 } 235 236 Magick::DrawableAlpha::~DrawableAlpha(void) 237 { 238 } 239 240 void Magick::DrawableAlpha::operator()(MagickCore::DrawingWand * context_) const 241 { 242 DrawAlpha(context_,_x,_y,_paintMethod); 243 } 244 245 Magick::DrawableBase* Magick::DrawableAlpha::copy() const 246 { 247 return new DrawableAlpha(*this); 248 } 249 250 // Arc 251 Magick::DrawableArc::~DrawableArc( void ) 252 { 253 } 254 void Magick::DrawableArc::operator()( MagickCore::DrawingWand * context_ ) const 255 { 256 DrawArc( context_, _startX, _startY, _endX, _endY, _startDegrees, _endDegrees ); 257 } 258 Magick::DrawableBase* Magick::DrawableArc::copy() const 259 { 260 return new DrawableArc(*this); 261 } 262 263 // 264 // Bezier curve 265 // 266 // Construct from coordinates (Coordinate list must contain at least three members) 267 Magick::DrawableBezier::DrawableBezier ( const CoordinateList &coordinates_ ) 268 : _coordinates(coordinates_) 269 { 270 } 271 // Copy constructor 272 Magick::DrawableBezier::DrawableBezier( const Magick::DrawableBezier& original_ ) 273 : DrawableBase (original_), 274 _coordinates(original_._coordinates) 275 { 276 } 277 // Destructor 278 Magick::DrawableBezier::~DrawableBezier( void ) 279 { 280 } 281 void Magick::DrawableBezier::operator()( MagickCore::DrawingWand * context_ ) const 282 { 283 size_t num_coords = (size_t) _coordinates.size(); 284 PointInfo *coordinates = new PointInfo[num_coords]; 285 286 PointInfo *q = coordinates; 287 CoordinateList::const_iterator p = _coordinates.begin(); 288 289 while( p != _coordinates.end() ) 290 { 291 q->x = p->x(); 292 q->y = p->y(); 293 q++; 294 p++; 295 } 296 297 DrawBezier( context_, num_coords, coordinates ); 298 delete [] coordinates; 299 } 300 Magick::DrawableBase* Magick::DrawableBezier::copy() const 301 { 302 return new DrawableBezier(*this); 303 } 304 305 306 /* DrawableBorderColor */ 307 Magick::DrawableBorderColor::DrawableBorderColor(const Magick::Color &color_) 308 : _color(color_) 309 { 310 } 311 312 Magick::DrawableBorderColor::DrawableBorderColor 313 (const Magick::DrawableBorderColor &original_) 314 : DrawableBase(original_), 315 _color(original_._color) 316 { 317 } 318 319 Magick::DrawableBorderColor::~DrawableBorderColor(void) 320 { 321 } 322 323 void Magick::DrawableBorderColor::operator()( 324 MagickCore::DrawingWand *context_) const 325 { 326 PixelInfo 327 color; 328 329 PixelWand 330 *pixel_wand; 331 332 color=static_cast<PixelInfo>(_color); 333 pixel_wand=NewPixelWand(); 334 PixelSetPixelColor(pixel_wand,&color); 335 DrawSetBorderColor(context_,pixel_wand); 336 pixel_wand=DestroyPixelWand(pixel_wand); 337 } 338 339 void Magick::DrawableBorderColor::color(const Color &color_) 340 { 341 _color=color_; 342 } 343 344 Magick::Color Magick::DrawableBorderColor::color(void) const 345 { 346 return(_color); 347 } 348 349 Magick::DrawableBase* Magick::DrawableBorderColor::copy() const 350 { 351 return(new DrawableBorderColor(*this)); 352 } 353 354 355 /* DrawableClipRule */ 356 Magick::DrawableClipRule::DrawableClipRule(const FillRule fillRule_) 357 { 358 _fillRule=fillRule_; 359 } 360 361 Magick::DrawableClipRule::~DrawableClipRule(void) 362 { 363 } 364 365 void Magick::DrawableClipRule::operator()( 366 MagickCore::DrawingWand * context_) const 367 { 368 DrawSetClipRule(context_,_fillRule); 369 } 370 371 void Magick::DrawableClipRule::fillRule(const FillRule fillRule_) 372 { 373 _fillRule=fillRule_; 374 } 375 376 Magick::FillRule Magick::DrawableClipRule::fillRule(void) const 377 { 378 return(_fillRule); 379 } 380 381 Magick::DrawableBase* Magick::DrawableClipRule::copy() const 382 { 383 return(new DrawableClipRule(*this)); 384 } 385 386 387 /* DrawableClipUnits */ 388 Magick::DrawableClipUnits::DrawableClipUnits(const ClipPathUnits units_) 389 { 390 _units = units_; 391 } 392 393 Magick::DrawableClipUnits::~DrawableClipUnits(void) 394 { 395 } 396 397 void Magick::DrawableClipUnits::operator()( 398 MagickCore::DrawingWand * context_) const 399 { 400 DrawSetClipUnits(context_, _units); 401 } 402 403 void Magick::DrawableClipUnits::units(const ClipPathUnits units_) 404 { 405 _units = units_; 406 } 407 408 Magick::ClipPathUnits Magick::DrawableClipUnits::units(void) const 409 { 410 return(_units); 411 } 412 413 Magick::DrawableBase* Magick::DrawableClipUnits::copy() const 414 { 415 return(new DrawableClipUnits(*this)); 416 } 417 418 419 // 420 //Clip Path 421 // 422 423 // Pop (terminate) Clip path definition 424 Magick::DrawablePopClipPath::~DrawablePopClipPath ( void ) 425 { 426 } 427 void Magick::DrawablePopClipPath::operator() ( MagickCore::DrawingWand * context_ ) const 428 { 429 DrawPopClipPath( context_ ); 430 DrawPopDefs(context_); 431 } 432 Magick::DrawableBase* Magick::DrawablePopClipPath::copy() const 433 { 434 return new DrawablePopClipPath(*this); 435 } 436 437 // Push clip path definition 438 Magick::DrawablePushClipPath::DrawablePushClipPath( const std::string &id_) 439 : _id(id_.c_str()) //multithread safe const char* 440 { 441 } 442 Magick::DrawablePushClipPath::DrawablePushClipPath 443 ( const Magick::DrawablePushClipPath& original_ ) //multithread safe const char* 444 : DrawableBase (original_), 445 _id(original_._id.c_str()) 446 { 447 } 448 Magick::DrawablePushClipPath::~DrawablePushClipPath( void ) 449 { 450 } 451 void Magick::DrawablePushClipPath::operator() 452 ( MagickCore::DrawingWand * context_ ) const 453 { 454 DrawPushDefs(context_); 455 DrawPushClipPath( context_, _id.c_str()); 456 } 457 Magick::DrawableBase* Magick::DrawablePushClipPath::copy() const 458 { 459 return new DrawablePushClipPath(*this); 460 } 461 // 462 // ClipPath 463 // 464 Magick::DrawableClipPath::DrawableClipPath( const std::string &id_ ) 465 :_id(id_.c_str()) 466 { 467 } 468 469 Magick::DrawableClipPath::DrawableClipPath ( const Magick::DrawableClipPath& original_ ) 470 : DrawableBase (original_), 471 _id(original_._id.c_str()) 472 { 473 } 474 Magick::DrawableClipPath::~DrawableClipPath( void ) 475 { 476 } 477 void Magick::DrawableClipPath::operator()( MagickCore::DrawingWand * context_ ) const 478 { 479 (void) DrawSetClipPath( context_, _id.c_str()); 480 } 481 Magick::DrawableBase* Magick::DrawableClipPath::copy() const 482 { 483 return new DrawableClipPath(*this); 484 } 485 486 // Circle 487 Magick::DrawableCircle::~DrawableCircle ( void ) 488 { 489 } 490 void Magick::DrawableCircle::operator()( MagickCore::DrawingWand * context_ ) const 491 { 492 DrawCircle( context_, _originX, _originY, _perimX, _perimY ); 493 } 494 Magick::DrawableBase* Magick::DrawableCircle::copy() const 495 { 496 return new DrawableCircle(*this); 497 } 498 499 // Colorize at point using PaintMethod 500 Magick::DrawableColor::~DrawableColor( void ) 501 { 502 } 503 void Magick::DrawableColor::operator()( MagickCore::DrawingWand * context_ ) const 504 { 505 DrawColor( context_, _x, _y, _paintMethod ); 506 } 507 Magick::DrawableBase* Magick::DrawableColor::copy() const 508 { 509 return new DrawableColor(*this); 510 } 511 512 // Draw image at point 513 Magick::DrawableCompositeImage::DrawableCompositeImage 514 ( double x_, double y_, 515 double width_, double height_, 516 const std::string &filename_, 517 Magick::CompositeOperator composition_ ) 518 : _composition(composition_), 519 _x(x_), 520 _y(y_), 521 _width(width_), 522 _height(height_), 523 _image(new Image(filename_)) 524 { 525 } 526 Magick::DrawableCompositeImage::DrawableCompositeImage 527 ( double x_, double y_, 528 double width_, double height_, 529 const Magick::Image &image_, 530 Magick::CompositeOperator composition_ ) 531 : _composition(composition_), 532 _x(x_), 533 _y(y_), 534 _width(width_), 535 _height(height_), 536 _image(new Image(image_)) 537 { 538 } 539 Magick::DrawableCompositeImage::DrawableCompositeImage 540 ( double x_, double y_, 541 double width_, double height_, 542 const std::string &filename_ ) 543 :_composition(CopyCompositeOp), 544 _x(x_), 545 _y(y_), 546 _width(width_), 547 _height(height_), 548 _image(new Image(filename_)) 549 { 550 } 551 Magick::DrawableCompositeImage::DrawableCompositeImage 552 ( double x_, double y_, 553 double width_, double height_, 554 const Magick::Image &image_ ) 555 :_composition(CopyCompositeOp), 556 _x(x_), 557 _y(y_), 558 _width(width_), 559 _height(height_), 560 _image(new Image(image_)) 561 { 562 } 563 Magick::DrawableCompositeImage::DrawableCompositeImage 564 ( double x_, double y_, 565 const std::string &filename_ ) 566 : _composition(CopyCompositeOp), 567 _x(x_), 568 _y(y_), 569 _width(0), 570 _height(0), 571 _image(new Image(filename_)) 572 { 573 _width=_image->columns(); 574 _height=_image->rows(); 575 } 576 Magick::DrawableCompositeImage::DrawableCompositeImage 577 ( double x_, double y_, 578 const Magick::Image &image_ ) 579 : _composition(CopyCompositeOp), 580 _x(x_), 581 _y(y_), 582 _width(0), 583 _height(0), 584 _image(new Image(image_)) 585 { 586 _width=_image->columns(); 587 _height=_image->rows(); 588 } 589 // Copy constructor 590 Magick::DrawableCompositeImage::DrawableCompositeImage 591 ( const Magick::DrawableCompositeImage& original_ ) 592 : Magick::DrawableBase(original_), 593 _composition(original_._composition), 594 _x(original_._x), 595 _y(original_._y), 596 _width(original_._width), 597 _height(original_._height), 598 _image(new Image(*original_._image)) 599 { 600 } 601 Magick::DrawableCompositeImage::~DrawableCompositeImage( void ) 602 { 603 delete _image; 604 } 605 // Assignment operator 606 Magick::DrawableCompositeImage& Magick::DrawableCompositeImage::operator= 607 (const Magick::DrawableCompositeImage& original_ ) 608 { 609 // If not being set to ourself 610 if ( this != &original_ ) 611 { 612 _composition = original_._composition; 613 _x = original_._x; 614 _y = original_._y; 615 _width = original_._width; 616 _height = original_._height; 617 Image* temp_image = new Image(*original_._image); 618 delete _image; 619 _image = temp_image; 620 } 621 return *this; 622 } 623 void Magick::DrawableCompositeImage::filename( const std::string &filename_ ) 624 { 625 Image* temp_image = new Image(filename_); 626 delete _image; 627 _image = temp_image; 628 } 629 std::string Magick::DrawableCompositeImage::filename( void ) const 630 { 631 return _image->fileName(); 632 } 633 634 void Magick::DrawableCompositeImage::image( const Magick::Image &image_ ) 635 { 636 Image* temp_image = new Image(image_); 637 delete _image; 638 _image = temp_image; 639 } 640 Magick::Image Magick::DrawableCompositeImage::image( void ) const 641 { 642 return *_image; 643 } 644 645 // Specify image format used to output Base64 inlined image data. 646 void Magick::DrawableCompositeImage::magick( std::string magick_ ) 647 { 648 _image->magick( magick_ ); 649 } 650 std::string Magick::DrawableCompositeImage::magick( void ) 651 { 652 return _image->magick(); 653 } 654 655 void Magick::DrawableCompositeImage::operator() 656 ( MagickCore::DrawingWand * context_ ) const 657 { 658 MagickWand 659 *magick_wand; 660 661 magick_wand=NewMagickWandFromImage(_image->constImage()); 662 (void) DrawComposite( context_, _composition, _x, _y, _width, _height, 663 magick_wand ); 664 magick_wand=DestroyMagickWand(magick_wand); 665 } 666 667 Magick::DrawableBase* Magick::DrawableCompositeImage::copy() const 668 { 669 return new DrawableCompositeImage(*this); 670 } 671 672 Magick::DrawableDensity::DrawableDensity(const Point &density_) 673 : _density(density_) 674 { 675 } 676 677 Magick::DrawableDensity::DrawableDensity(const std::string &density_) 678 : _density(density_) 679 { 680 } 681 682 Magick::DrawableDensity::~DrawableDensity(void) 683 { 684 } 685 686 void Magick::DrawableDensity::operator()( 687 MagickCore::DrawingWand *context_) const 688 { 689 DrawSetDensity(context_,_density.c_str()); 690 } 691 692 Magick::DrawableBase* Magick::DrawableDensity::copy() const 693 { 694 return(new DrawableDensity(*this)); 695 } 696 697 // Ellipse 698 Magick::DrawableEllipse::~DrawableEllipse( void ) 699 { 700 } 701 void Magick::DrawableEllipse::operator() 702 ( MagickCore::DrawingWand * context_ ) const 703 { 704 DrawEllipse( context_, _originX, _originY, _radiusX, _radiusY, 705 _arcStart, _arcEnd ); 706 } 707 Magick::DrawableBase* Magick::DrawableEllipse::copy() const 708 { 709 return new DrawableEllipse(*this); 710 } 711 712 // Specify drawing fill color 713 Magick::DrawableFillColor::DrawableFillColor( const Magick::Color &color_ ) 714 : _color(color_) 715 { 716 } 717 Magick::DrawableFillColor::DrawableFillColor 718 ( const Magick::DrawableFillColor& original_ ) 719 : DrawableBase (original_), 720 _color(original_._color) 721 { 722 } 723 Magick::DrawableFillColor::~DrawableFillColor( void ) 724 { 725 } 726 void Magick::DrawableFillColor::operator() 727 ( MagickCore::DrawingWand * context_ ) const 728 { 729 PixelInfo color = static_cast<PixelInfo>(_color); 730 PixelWand *pixel_wand=NewPixelWand(); 731 PixelSetPixelColor(pixel_wand,&color); 732 DrawSetFillColor(context_,pixel_wand); 733 pixel_wand=DestroyPixelWand(pixel_wand); 734 } 735 Magick::DrawableBase* Magick::DrawableFillColor::copy() const 736 { 737 return new DrawableFillColor(*this); 738 } 739 740 /* DrawableFillPatternUrl */ 741 Magick::DrawableFillPatternUrl::DrawableFillPatternUrl(const std::string &url_) 742 : _url(url_) 743 { 744 } 745 746 Magick::DrawableFillPatternUrl::DrawableFillPatternUrl( 747 const Magick::DrawableFillPatternUrl& original_) 748 : DrawableBase(original_), 749 _url(original_._url) 750 { 751 } 752 753 Magick::DrawableFillPatternUrl::~DrawableFillPatternUrl(void) 754 { 755 } 756 757 void Magick::DrawableFillPatternUrl::operator()( 758 MagickCore::DrawingWand * context_) const 759 { 760 DrawSetFillPatternURL(context_, _url.c_str()); 761 } 762 763 void Magick::DrawableFillPatternUrl::url(const std::string &url_) 764 { 765 _url = url_; 766 } 767 768 std::string Magick::DrawableFillPatternUrl::url(void) const 769 { 770 return(_url); 771 } 772 773 Magick::DrawableBase* Magick::DrawableFillPatternUrl::copy() const 774 { 775 return(new DrawableFillPatternUrl(*this)); 776 } 777 778 // Specify drawing fill fule 779 Magick::DrawableFillRule::~DrawableFillRule ( void ) 780 { 781 } 782 void Magick::DrawableFillRule::operator() 783 ( MagickCore::DrawingWand * context_ ) const 784 { 785 DrawSetFillRule( context_, _fillRule ); 786 } 787 Magick::DrawableBase* Magick::DrawableFillRule::copy() const 788 { 789 return new DrawableFillRule(*this); 790 } 791 792 Magick::DrawableFillOpacity::~DrawableFillOpacity(void) 793 { 794 } 795 796 void Magick::DrawableFillOpacity::operator() 797 (MagickCore::DrawingWand *context_) const 798 { 799 DrawSetFillOpacity(context_,_opacity); 800 } 801 802 Magick::DrawableBase* Magick::DrawableFillOpacity::copy() const 803 { 804 return new DrawableFillOpacity(*this); 805 } 806 807 // Specify text font 808 Magick::DrawableFont::DrawableFont ( const std::string &font_ ) 809 : _font(font_), 810 _family(), 811 _style(Magick::AnyStyle), 812 _weight(400), 813 _stretch(Magick::NormalStretch) 814 { 815 } 816 Magick::DrawableFont::DrawableFont ( const std::string &family_, 817 Magick::StyleType style_, 818 const unsigned int weight_, 819 Magick::StretchType stretch_ ) 820 : _font(), 821 _family(family_), 822 _style(style_), 823 _weight(weight_), 824 _stretch(stretch_) 825 { 826 } 827 Magick::DrawableFont::DrawableFont ( const Magick::DrawableFont& original_ ) 828 : DrawableBase (original_), 829 _font(original_._font), 830 _family(original_._family), 831 _style(original_._style), 832 _weight(original_._weight), 833 _stretch(original_._stretch) 834 { 835 } 836 Magick::DrawableFont::~DrawableFont ( void ) 837 { 838 } 839 void Magick::DrawableFont::operator()( MagickCore::DrawingWand * context_ ) const 840 { 841 // font 842 if(_font.length()) 843 { 844 (void) DrawSetFont( context_, _font.c_str() ); 845 } 846 847 if(_family.length()) 848 { 849 // font-family 850 (void) DrawSetFontFamily( context_, _family.c_str() ); 851 852 // font-style 853 DrawSetFontStyle( context_, _style ); 854 855 // font-weight 856 DrawSetFontWeight( context_, _weight ); 857 858 // font-stretch 859 DrawSetFontStretch( context_, _stretch ); 860 } 861 } 862 Magick::DrawableBase* Magick::DrawableFont::copy() const 863 { 864 return new DrawableFont(*this); 865 } 866 867 // Specify text positioning gravity 868 Magick::DrawableGravity::~DrawableGravity ( void ) 869 { 870 } 871 void Magick::DrawableGravity::operator() 872 ( MagickCore::DrawingWand * context_ ) const 873 { 874 DrawSetGravity( context_, _gravity ); 875 } 876 Magick::DrawableBase* Magick::DrawableGravity::copy() const 877 { 878 return new DrawableGravity(*this); 879 } 880 881 // Line 882 Magick::DrawableLine::~DrawableLine ( void ) 883 { 884 } 885 void Magick::DrawableLine::operator()( MagickCore::DrawingWand * context_ ) const 886 { 887 DrawLine( context_, _startX, _startY, _endX, _endY ); 888 } 889 Magick::DrawableBase* Magick::DrawableLine::copy() const 890 { 891 return new DrawableLine(*this); 892 } 893 894 // Drawable Path 895 Magick::DrawablePath::DrawablePath ( const VPathList &path_ ) 896 : _path(path_) 897 { 898 } 899 Magick::DrawablePath::DrawablePath ( const Magick::DrawablePath& original_ ) 900 : DrawableBase (original_), 901 _path(original_._path) 902 { 903 } 904 Magick::DrawablePath::~DrawablePath ( void ) 905 { 906 } 907 void Magick::DrawablePath::operator()( MagickCore::DrawingWand * context_ ) const 908 { 909 DrawPathStart( context_ ); 910 911 for( VPathList::const_iterator p = _path.begin(); 912 p != _path.end(); p++ ) 913 p->operator()( context_ ); // FIXME, how to quit loop on error? 914 915 DrawPathFinish( context_ ); 916 } 917 Magick::DrawableBase* Magick::DrawablePath::copy() const 918 { 919 return new DrawablePath(*this); 920 } 921 922 // Point 923 Magick::DrawablePoint::~DrawablePoint ( void ) 924 { 925 } 926 void Magick::DrawablePoint::operator()( MagickCore::DrawingWand * context_ ) const 927 { 928 DrawPoint( context_, _x, _y ); 929 } 930 Magick::DrawableBase* Magick::DrawablePoint::copy() const 931 { 932 return new DrawablePoint(*this); 933 } 934 935 // Text pointsize 936 Magick::DrawablePointSize::~DrawablePointSize ( void ) 937 { 938 } 939 void Magick::DrawablePointSize::operator() 940 ( MagickCore::DrawingWand * context_ ) const 941 { 942 DrawSetFontSize( context_, _pointSize ); 943 } 944 Magick::DrawableBase* Magick::DrawablePointSize::copy() const 945 { 946 return new DrawablePointSize(*this); 947 } 948 949 // Polygon (Coordinate list must contain at least three members) 950 Magick::DrawablePolygon::DrawablePolygon ( const CoordinateList &coordinates_ ) 951 : _coordinates(coordinates_) 952 { 953 } 954 Magick::DrawablePolygon::DrawablePolygon 955 ( const Magick::DrawablePolygon& original_ ) 956 : DrawableBase (original_), 957 _coordinates(original_._coordinates) 958 { 959 } 960 Magick::DrawablePolygon::~DrawablePolygon ( void ) 961 { 962 } 963 void Magick::DrawablePolygon::operator() 964 ( MagickCore::DrawingWand * context_ ) const 965 { 966 size_t num_coords = (size_t) _coordinates.size(); 967 PointInfo *coordinates = new PointInfo[num_coords]; 968 969 PointInfo *q = coordinates; 970 CoordinateList::const_iterator p = _coordinates.begin(); 971 972 while( p != _coordinates.end() ) 973 { 974 q->x = p->x(); 975 q->y = p->y(); 976 q++; 977 p++; 978 } 979 980 DrawPolygon( context_, num_coords, coordinates ); 981 delete [] coordinates; 982 } 983 Magick::DrawableBase* Magick::DrawablePolygon::copy() const 984 { 985 return new DrawablePolygon(*this); 986 } 987 988 // Polyline (Coordinate list must contain at least three members) 989 Magick::DrawablePolyline::DrawablePolyline 990 ( const CoordinateList &coordinates_ ) 991 : _coordinates(coordinates_) 992 { 993 } 994 Magick::DrawablePolyline::DrawablePolyline 995 ( const Magick::DrawablePolyline& original_ ) 996 : DrawableBase (original_), 997 _coordinates(original_._coordinates) 998 { 999 } 1000 Magick::DrawablePolyline::~DrawablePolyline ( void ) 1001 { 1002 } 1003 void Magick::DrawablePolyline::operator() 1004 ( MagickCore::DrawingWand * context_ ) const 1005 { 1006 size_t num_coords = (size_t) _coordinates.size(); 1007 PointInfo *coordinates = new PointInfo[num_coords]; 1008 1009 PointInfo *q = coordinates; 1010 CoordinateList::const_iterator p = _coordinates.begin(); 1011 1012 while( p != _coordinates.end() ) 1013 { 1014 q->x = p->x(); 1015 q->y = p->y(); 1016 q++; 1017 p++; 1018 } 1019 1020 DrawPolyline( context_, num_coords, coordinates ); 1021 delete [] coordinates; 1022 } 1023 Magick::DrawableBase* Magick::DrawablePolyline::copy() const 1024 { 1025 return new DrawablePolyline(*this); 1026 } 1027 1028 // Pop Graphic Context 1029 Magick::DrawablePopGraphicContext::~DrawablePopGraphicContext ( void ) 1030 { 1031 } 1032 void Magick::DrawablePopGraphicContext::operator() 1033 ( MagickCore::DrawingWand * context_ ) const 1034 { 1035 PopDrawingWand( context_ ); 1036 } 1037 Magick::DrawableBase* Magick::DrawablePopGraphicContext::copy() const 1038 { 1039 return new DrawablePopGraphicContext(*this); 1040 } 1041 1042 // Push Graphic Context 1043 Magick::DrawablePushGraphicContext::~DrawablePushGraphicContext ( void ) 1044 { 1045 } 1046 void Magick::DrawablePushGraphicContext::operator() 1047 ( MagickCore::DrawingWand * context_ ) const 1048 { 1049 PushDrawingWand( context_ ); 1050 } 1051 Magick::DrawableBase* Magick::DrawablePushGraphicContext::copy() const 1052 { 1053 return new DrawablePushGraphicContext(*this); 1054 } 1055 1056 // Pop (terminate) Pattern definition 1057 Magick::DrawablePopPattern::~DrawablePopPattern ( void ) 1058 { 1059 } 1060 void Magick::DrawablePopPattern::operator() 1061 ( MagickCore::DrawingWand * context_ ) const 1062 { 1063 (void) DrawPopPattern( context_ ); 1064 } 1065 Magick::DrawableBase* Magick::DrawablePopPattern::copy() const 1066 { 1067 return new DrawablePopPattern(*this); 1068 } 1069 1070 // Push Pattern definition 1071 Magick::DrawablePushPattern::DrawablePushPattern 1072 ( const std::string &id_, ssize_t x_, ssize_t y_, 1073 size_t width_, size_t height_ ) 1074 : _id(id_), 1075 _x(x_), 1076 _y(y_), 1077 _width(width_), 1078 _height(height_) 1079 { 1080 } 1081 Magick::DrawablePushPattern::DrawablePushPattern 1082 ( const Magick::DrawablePushPattern& original_ ) 1083 : DrawableBase (original_), 1084 _id(original_._id), 1085 _x(original_._x), 1086 _y(original_._y), 1087 _width(original_._width), 1088 _height(original_._height) 1089 { 1090 } 1091 Magick::DrawablePushPattern::~DrawablePushPattern ( void ) 1092 { 1093 } 1094 void Magick::DrawablePushPattern::operator() 1095 ( MagickCore::DrawingWand * context_ ) const 1096 { 1097 (void) DrawPushPattern( context_, _id.c_str(), _x, _y, _width, _height ); 1098 } 1099 Magick::DrawableBase* Magick::DrawablePushPattern::copy() const 1100 { 1101 return new DrawablePushPattern(*this); 1102 } 1103 1104 // Rectangle 1105 Magick::DrawableRectangle::~DrawableRectangle ( void ) 1106 { 1107 } 1108 void Magick::DrawableRectangle::operator() 1109 ( MagickCore::DrawingWand * context_ ) const 1110 { 1111 DrawRectangle( context_, _upperLeftX, _upperLeftY, 1112 _lowerRightX, _lowerRightY ); 1113 } 1114 Magick::DrawableBase* Magick::DrawableRectangle::copy() const 1115 { 1116 return new DrawableRectangle(*this); 1117 } 1118 1119 // Apply Rotation 1120 Magick::DrawableRotation::~DrawableRotation ( void ) 1121 { 1122 } 1123 void Magick::DrawableRotation::operator() 1124 ( MagickCore::DrawingWand * context_ ) const 1125 { 1126 DrawRotate( context_, _angle ); 1127 } 1128 Magick::DrawableBase* Magick::DrawableRotation::copy() const 1129 { 1130 return new DrawableRotation(*this); 1131 } 1132 1133 // Round Rectangle 1134 Magick::DrawableRoundRectangle::~DrawableRoundRectangle ( void ) 1135 { 1136 } 1137 void Magick::DrawableRoundRectangle::operator() 1138 ( MagickCore::DrawingWand * context_ ) const 1139 { 1140 DrawRoundRectangle( context_, _centerX,_centerY, _width,_hight, 1141 _cornerWidth, _cornerHeight); 1142 } 1143 Magick::DrawableBase* Magick::DrawableRoundRectangle::copy() const 1144 { 1145 return new DrawableRoundRectangle(*this); 1146 } 1147 1148 // Apply Scaling 1149 Magick::DrawableScaling::~DrawableScaling ( void ) 1150 { 1151 } 1152 void Magick::DrawableScaling::operator() 1153 ( MagickCore::DrawingWand * context_ ) const 1154 { 1155 DrawScale( context_, _x, _y ); 1156 } 1157 Magick::DrawableBase* Magick::DrawableScaling::copy() const 1158 { 1159 return new DrawableScaling(*this); 1160 } 1161 1162 // Apply Skew in the X direction 1163 Magick::DrawableSkewX::~DrawableSkewX ( void ) 1164 { 1165 } 1166 void Magick::DrawableSkewX::operator() 1167 ( MagickCore::DrawingWand * context_ ) const 1168 { 1169 DrawSkewX( context_, _angle ); 1170 } 1171 Magick::DrawableBase* Magick::DrawableSkewX::copy() const 1172 { 1173 return new DrawableSkewX(*this); 1174 } 1175 1176 // Apply Skew in the Y direction 1177 Magick::DrawableSkewY::~DrawableSkewY ( void ) 1178 { 1179 } 1180 void Magick::DrawableSkewY::operator()( MagickCore::DrawingWand * context_ ) const 1181 { 1182 DrawSkewY( context_, _angle ); 1183 } 1184 Magick::DrawableBase* Magick::DrawableSkewY::copy() const 1185 { 1186 return new DrawableSkewY(*this); 1187 } 1188 1189 /* DrawableStrokeDashArray */ 1190 Magick::DrawableStrokeDashArray::DrawableStrokeDashArray(const double* dasharray_) 1191 : _size(0), 1192 _dasharray(0) 1193 { 1194 dasharray(dasharray_); 1195 } 1196 1197 Magick::DrawableStrokeDashArray::DrawableStrokeDashArray( 1198 const Magick::DrawableStrokeDashArray& original_) 1199 : DrawableBase (original_), 1200 _size(original_._size), 1201 _dasharray(new double[_size+1]) 1202 { 1203 // Copy elements 1204 { 1205 for (size_t i=0; i < _size; i++) 1206 _dasharray[i]=original_._dasharray[i]; 1207 _dasharray[_size]=0.0; 1208 } 1209 } 1210 1211 Magick::DrawableStrokeDashArray::~DrawableStrokeDashArray(void) 1212 { 1213 delete [] _dasharray; 1214 _size=0; 1215 _dasharray=(double *) NULL; 1216 } 1217 1218 Magick::DrawableStrokeDashArray& Magick::DrawableStrokeDashArray::operator=( 1219 const Magick::DrawableStrokeDashArray &original_) 1220 { 1221 if (this != &original_) 1222 { 1223 delete [] _dasharray; 1224 _size=original_._size; 1225 _dasharray = new double[_size+1]; 1226 // Copy elements 1227 { 1228 for (size_t i=0; i < _size; i++) 1229 _dasharray[i]=original_._dasharray[i]; 1230 _dasharray[_size]=0.0; 1231 } 1232 } 1233 return(*this); 1234 } 1235 1236 void Magick::DrawableStrokeDashArray::operator()( 1237 MagickCore::DrawingWand *context_) const 1238 { 1239 (void) DrawSetStrokeDashArray(context_,(const unsigned long) _size, 1240 _dasharray); 1241 } 1242 1243 Magick::DrawableBase *Magick::DrawableStrokeDashArray::copy() const 1244 { 1245 return(new DrawableStrokeDashArray(*this)); 1246 } 1247 1248 void Magick::DrawableStrokeDashArray::dasharray(const double* dasharray_) 1249 { 1250 size_t 1251 n; 1252 1253 delete [] _dasharray; 1254 _size=0; 1255 _dasharray=0; 1256 1257 if (dasharray_ != (const double *) NULL) 1258 { 1259 const double 1260 *p; 1261 1262 // Count elements in dash array 1263 n=0; 1264 { 1265 p = dasharray_; 1266 while(*p++ != 0.0) 1267 n++; 1268 } 1269 _size=n; 1270 1271 // Allocate elements 1272 _dasharray=new double[_size+1]; 1273 // Copy elements 1274 { 1275 for (size_t i=0; i < _size; i++) 1276 _dasharray[i]=dasharray_[i]; 1277 _dasharray[_size]=0.0; 1278 } 1279 } 1280 } 1281 1282 const double* Magick::DrawableStrokeDashArray::dasharray(void) const 1283 { 1284 return(_dasharray); 1285 } 1286 1287 /* DrawableStrokeDashOffset */ 1288 Magick::DrawableStrokeDashOffset::~DrawableStrokeDashOffset(void) 1289 { 1290 } 1291 1292 void Magick::DrawableStrokeDashOffset::operator() 1293 ( MagickCore::DrawingWand * context_) const 1294 { 1295 DrawSetStrokeDashOffset(context_,_offset); 1296 } 1297 1298 Magick::DrawableBase* Magick::DrawableStrokeDashOffset::copy() const 1299 { 1300 return(new DrawableStrokeDashOffset(*this)); 1301 } 1302 1303 void Magick::DrawableStrokeDashOffset::offset(const double offset_) 1304 { 1305 _offset=offset_; 1306 } 1307 1308 double Magick::DrawableStrokeDashOffset::offset(void) const 1309 { 1310 return(_offset); 1311 } 1312 1313 // Stroke linecap 1314 Magick::DrawableStrokeLineCap::~DrawableStrokeLineCap ( void ) 1315 { 1316 } 1317 void Magick::DrawableStrokeLineCap::operator() 1318 ( MagickCore::DrawingWand * context_ ) const 1319 { 1320 DrawSetStrokeLineCap( context_, _linecap ); 1321 } 1322 Magick::DrawableBase* Magick::DrawableStrokeLineCap::copy() const 1323 { 1324 return new DrawableStrokeLineCap(*this); 1325 } 1326 1327 // Stroke linejoin 1328 Magick::DrawableStrokeLineJoin::~DrawableStrokeLineJoin ( void ) 1329 { 1330 } 1331 void Magick::DrawableStrokeLineJoin::operator() 1332 ( MagickCore::DrawingWand * context_ ) const 1333 { 1334 DrawSetStrokeLineJoin( context_, _linejoin ); 1335 } 1336 Magick::DrawableBase* Magick::DrawableStrokeLineJoin::copy() const 1337 { 1338 return new DrawableStrokeLineJoin(*this); 1339 } 1340 1341 // Stroke miterlimit 1342 Magick::DrawableMiterLimit::~DrawableMiterLimit ( void ) 1343 { 1344 } 1345 void Magick::DrawableMiterLimit::operator() 1346 ( MagickCore::DrawingWand * context_ ) const 1347 { 1348 DrawSetStrokeMiterLimit( context_, _miterlimit ); 1349 } 1350 Magick::DrawableBase* Magick::DrawableMiterLimit::copy() const 1351 { 1352 return new DrawableMiterLimit(*this); 1353 } 1354 1355 1356 /* DrawableStrokePatternUrl */ 1357 Magick::DrawableStrokePatternUrl::DrawableStrokePatternUrl( 1358 const std::string &url_) 1359 : _url(url_) 1360 { 1361 } 1362 1363 Magick::DrawableStrokePatternUrl::DrawableStrokePatternUrl( 1364 const Magick::DrawableStrokePatternUrl& original_) 1365 : DrawableBase(original_), 1366 _url(original_._url) 1367 { 1368 } 1369 1370 Magick::DrawableStrokePatternUrl::~DrawableStrokePatternUrl(void) 1371 { 1372 } 1373 1374 void Magick::DrawableStrokePatternUrl::operator()( 1375 MagickCore::DrawingWand * context_) const 1376 { 1377 DrawSetStrokePatternURL(context_, _url.c_str()); 1378 } 1379 1380 void Magick::DrawableStrokePatternUrl::url(const std::string &url_) 1381 { 1382 _url = url_; 1383 } 1384 1385 std::string Magick::DrawableStrokePatternUrl::url(void) const 1386 { 1387 return(_url); 1388 } 1389 1390 Magick::DrawableBase* Magick::DrawableStrokePatternUrl::copy() const 1391 { 1392 return(new DrawableStrokePatternUrl(*this)); 1393 } 1394 1395 // Stroke antialias 1396 Magick::DrawableStrokeAntialias::~DrawableStrokeAntialias ( void ) 1397 { 1398 } 1399 void Magick::DrawableStrokeAntialias::operator() 1400 ( MagickCore::DrawingWand * context_ ) const 1401 { 1402 DrawSetStrokeAntialias( context_, static_cast<MagickBooleanType> 1403 (_flag ? MagickTrue : MagickFalse) ); 1404 } 1405 Magick::DrawableBase* Magick::DrawableStrokeAntialias::copy() const 1406 { 1407 return new DrawableStrokeAntialias(*this); 1408 } 1409 1410 // Stroke color 1411 Magick::DrawableStrokeColor::DrawableStrokeColor 1412 ( const Magick::Color &color_ ) 1413 : _color(color_) 1414 { 1415 } 1416 Magick::DrawableStrokeColor::DrawableStrokeColor 1417 ( const Magick::DrawableStrokeColor& original_ ) 1418 : DrawableBase (original_), 1419 _color(original_._color) 1420 { 1421 } 1422 Magick::DrawableStrokeColor::~DrawableStrokeColor ( void ) 1423 { 1424 } 1425 void Magick::DrawableStrokeColor::operator() 1426 ( MagickCore::DrawingWand * context_ ) const 1427 { 1428 PixelInfo color = static_cast<PixelInfo>(_color); 1429 PixelWand *pixel_wand=NewPixelWand(); 1430 PixelSetPixelColor(pixel_wand,&color); 1431 DrawSetStrokeColor(context_,pixel_wand); 1432 pixel_wand=DestroyPixelWand(pixel_wand); 1433 } 1434 Magick::DrawableBase* Magick::DrawableStrokeColor::copy() const 1435 { 1436 return new DrawableStrokeColor(*this); 1437 } 1438 1439 Magick::DrawableStrokeOpacity::~DrawableStrokeOpacity(void) 1440 { 1441 } 1442 1443 void Magick::DrawableStrokeOpacity::operator() 1444 (MagickCore::DrawingWand * context_) const 1445 { 1446 DrawSetStrokeOpacity(context_,_opacity); 1447 } 1448 1449 Magick::DrawableBase* Magick::DrawableStrokeOpacity::copy() const 1450 { 1451 return new DrawableStrokeOpacity(*this); 1452 } 1453 1454 // Stroke width 1455 Magick::DrawableStrokeWidth::~DrawableStrokeWidth ( void ) 1456 { 1457 } 1458 void Magick::DrawableStrokeWidth::operator() 1459 ( MagickCore::DrawingWand * context_ ) const 1460 { 1461 DrawSetStrokeWidth( context_, _width ); 1462 } 1463 Magick::DrawableBase* Magick::DrawableStrokeWidth::copy() const 1464 { 1465 return new DrawableStrokeWidth(*this); 1466 } 1467 1468 // Draw text at point 1469 Magick::DrawableText::DrawableText ( const double x_, const double y_, 1470 const std::string &text_ ) 1471 : _x(x_), 1472 _y(y_), 1473 _text(text_), 1474 _encoding() 1475 { 1476 } 1477 Magick::DrawableText::DrawableText ( const double x_, const double y_, 1478 const std::string &text_, const std::string &encoding_) 1479 : _x(x_), 1480 _y(y_), 1481 _text(text_), 1482 _encoding(encoding_) 1483 { 1484 } 1485 Magick::DrawableText::DrawableText( const Magick::DrawableText& original_ ) 1486 : DrawableBase (original_), 1487 _x(original_._x), 1488 _y(original_._y), 1489 _text(original_._text), 1490 _encoding(original_._encoding) 1491 { 1492 } 1493 Magick::DrawableText::~DrawableText ( void ) 1494 { 1495 } 1496 void Magick::DrawableText::operator() 1497 ( MagickCore::DrawingWand * context_ ) const 1498 { 1499 DrawSetTextEncoding( context_, _encoding.c_str() ); 1500 DrawAnnotation( context_, _x, _y, 1501 reinterpret_cast<const unsigned char*>(_text.c_str()) ); 1502 } 1503 Magick::DrawableBase* Magick::DrawableText::copy() const 1504 { 1505 return new DrawableText(*this); 1506 } 1507 1508 /* DrawableTextAlignment */ 1509 Magick::DrawableTextAlignment::DrawableTextAlignment( 1510 Magick::AlignType alignment_) 1511 : _alignment(alignment_) 1512 { 1513 } 1514 1515 Magick::DrawableTextAlignment::DrawableTextAlignment 1516 (const Magick::DrawableTextAlignment &original_) 1517 : DrawableBase(original_), 1518 _alignment(original_._alignment) 1519 { 1520 } 1521 1522 Magick::DrawableTextAlignment::~DrawableTextAlignment(void) 1523 { 1524 } 1525 1526 void Magick::DrawableTextAlignment::operator()( 1527 MagickCore::DrawingWand * context_) const 1528 { 1529 DrawSetTextAlignment(context_, _alignment); 1530 } 1531 1532 void Magick::DrawableTextAlignment::alignment(AlignType alignment_) 1533 { 1534 _alignment=alignment_; 1535 } 1536 1537 Magick::AlignType Magick::DrawableTextAlignment::alignment(void) const 1538 { 1539 return(_alignment); 1540 } 1541 1542 Magick::DrawableBase* Magick::DrawableTextAlignment::copy() const 1543 { 1544 return new DrawableTextAlignment(*this); 1545 } 1546 1547 // Text antialias 1548 Magick::DrawableTextAntialias::DrawableTextAntialias ( bool flag_ ) 1549 : _flag(flag_) 1550 { 1551 } 1552 Magick::DrawableTextAntialias::DrawableTextAntialias( const Magick::DrawableTextAntialias &original_ ) 1553 : DrawableBase (original_), 1554 _flag(original_._flag) 1555 { 1556 } 1557 Magick::DrawableTextAntialias::~DrawableTextAntialias ( void ) 1558 { 1559 } 1560 void Magick::DrawableTextAntialias::operator() 1561 ( MagickCore::DrawingWand * context_ ) const 1562 { 1563 DrawSetTextAntialias( context_, static_cast<MagickBooleanType> 1564 (_flag ? MagickTrue : MagickFalse) ); 1565 } 1566 Magick::DrawableBase* Magick::DrawableTextAntialias::copy() const 1567 { 1568 return new DrawableTextAntialias(*this); 1569 } 1570 1571 1572 // Decoration (text decoration) 1573 Magick::DrawableTextDecoration::DrawableTextDecoration 1574 ( Magick::DecorationType decoration_ ) 1575 : _decoration(decoration_) 1576 { 1577 } 1578 Magick::DrawableTextDecoration::DrawableTextDecoration 1579 ( const Magick::DrawableTextDecoration &original_ ) 1580 : DrawableBase (original_), 1581 _decoration(original_._decoration) 1582 { 1583 } 1584 Magick::DrawableTextDecoration::~DrawableTextDecoration( void ) 1585 { 1586 } 1587 void Magick::DrawableTextDecoration::operator() 1588 ( MagickCore::DrawingWand * context_ ) const 1589 { 1590 DrawSetTextDecoration( context_, _decoration ); 1591 } 1592 Magick::DrawableBase* Magick::DrawableTextDecoration::copy() const 1593 { 1594 return new DrawableTextDecoration(*this); 1595 } 1596 1597 // DrawableTextDirection 1598 Magick::DrawableTextDirection::DrawableTextDirection( 1599 DirectionType direction_) 1600 : _direction(direction_) 1601 { 1602 } 1603 1604 Magick::DrawableTextDirection::~DrawableTextDirection(void) 1605 { 1606 } 1607 1608 void Magick::DrawableTextDirection::operator()( 1609 MagickCore::DrawingWand *context_) const 1610 { 1611 DrawSetTextDirection(context_,_direction); 1612 } 1613 1614 void Magick::DrawableTextDirection::direction(DirectionType direction_) 1615 { 1616 _direction=direction_; 1617 } 1618 1619 Magick::DirectionType Magick::DrawableTextDirection::direction(void) const 1620 { 1621 return(_direction); 1622 } 1623 1624 Magick::DrawableBase *Magick::DrawableTextDirection::copy() const 1625 { 1626 return new DrawableTextDirection(*this); 1627 } 1628 1629 // DrawableTextInterlineSpacing 1630 Magick::DrawableTextInterlineSpacing::DrawableTextInterlineSpacing( 1631 double spacing_) 1632 : _spacing(spacing_) 1633 { 1634 } 1635 1636 Magick::DrawableTextInterlineSpacing::~DrawableTextInterlineSpacing(void) 1637 { 1638 } 1639 1640 void Magick::DrawableTextInterlineSpacing::operator()( 1641 MagickCore::DrawingWand *context_) const 1642 { 1643 DrawSetTextInterlineSpacing(context_,_spacing); 1644 } 1645 1646 void Magick::DrawableTextInterlineSpacing::spacing(double spacing_) 1647 { 1648 _spacing=spacing_; 1649 } 1650 1651 double Magick::DrawableTextInterlineSpacing::spacing(void) const 1652 { 1653 return(_spacing); 1654 } 1655 1656 Magick::DrawableBase *Magick::DrawableTextInterlineSpacing::copy() const 1657 { 1658 return new DrawableTextInterlineSpacing(*this); 1659 } 1660 1661 // DrawableTextInterwordSpacing 1662 Magick::DrawableTextInterwordSpacing::DrawableTextInterwordSpacing( 1663 double spacing_) 1664 : _spacing(spacing_) 1665 { 1666 } 1667 1668 Magick::DrawableTextInterwordSpacing::~DrawableTextInterwordSpacing(void) 1669 { 1670 } 1671 1672 void Magick::DrawableTextInterwordSpacing::operator()( 1673 MagickCore::DrawingWand *context_) const 1674 { 1675 DrawSetTextInterwordSpacing(context_,_spacing); 1676 } 1677 1678 void Magick::DrawableTextInterwordSpacing::spacing(double spacing_) 1679 { 1680 _spacing=spacing_; 1681 } 1682 1683 double Magick::DrawableTextInterwordSpacing::spacing(void) const 1684 { 1685 return(_spacing); 1686 } 1687 1688 Magick::DrawableBase *Magick::DrawableTextInterwordSpacing::copy() const 1689 { 1690 return new DrawableTextInterwordSpacing(*this); 1691 } 1692 1693 // DrawableTextKerning 1694 Magick::DrawableTextKerning::DrawableTextKerning( 1695 double kerning_) 1696 : _kerning(kerning_) 1697 { 1698 } 1699 1700 Magick::DrawableTextKerning::~DrawableTextKerning(void) 1701 { 1702 } 1703 1704 void Magick::DrawableTextKerning::operator()( 1705 MagickCore::DrawingWand *context_) const 1706 { 1707 DrawSetTextKerning(context_,_kerning); 1708 } 1709 1710 void Magick::DrawableTextKerning::kerning(double kerning_) 1711 { 1712 _kerning=kerning_; 1713 } 1714 1715 double Magick::DrawableTextKerning::kerning(void) const 1716 { 1717 return(_kerning); 1718 } 1719 1720 Magick::DrawableBase *Magick::DrawableTextKerning::copy() const 1721 { 1722 return new DrawableTextKerning(*this); 1723 } 1724 1725 // Set text undercolor 1726 Magick::DrawableTextUnderColor::DrawableTextUnderColor 1727 ( const Magick::Color &color_ ) 1728 : _color(color_) 1729 { 1730 } 1731 Magick::DrawableTextUnderColor::DrawableTextUnderColor 1732 ( const Magick::DrawableTextUnderColor& original_ ) 1733 : DrawableBase (original_), 1734 _color(original_._color) 1735 { 1736 } 1737 Magick::DrawableTextUnderColor::~DrawableTextUnderColor ( void ) 1738 { 1739 } 1740 void Magick::DrawableTextUnderColor::operator() 1741 ( MagickCore::DrawingWand * context_ ) const 1742 { 1743 PixelInfo color = static_cast<PixelInfo>(_color); 1744 PixelWand *pixel_wand=NewPixelWand(); 1745 PixelSetPixelColor(pixel_wand,&color); 1746 DrawSetTextUnderColor(context_,pixel_wand); 1747 pixel_wand=DestroyPixelWand(pixel_wand); 1748 } 1749 Magick::DrawableBase* Magick::DrawableTextUnderColor::copy() const 1750 { 1751 return new DrawableTextUnderColor(*this); 1752 } 1753 1754 // Apply Translation 1755 Magick::DrawableTranslation::~DrawableTranslation ( void ) 1756 { 1757 } 1758 void Magick::DrawableTranslation::operator() 1759 ( MagickCore::DrawingWand * context_ ) const 1760 { 1761 DrawTranslate( context_, _x, _y ); 1762 } 1763 Magick::DrawableBase* Magick::DrawableTranslation::copy() const 1764 { 1765 return new DrawableTranslation(*this); 1766 } 1767 1768 // Set the size of the viewbox 1769 Magick::DrawableViewbox::~DrawableViewbox ( void ) 1770 { 1771 } 1772 void Magick::DrawableViewbox::operator() 1773 ( MagickCore::DrawingWand * context_ ) const 1774 { 1775 DrawSetViewbox( context_, _x1, _y1, _x2, _y2 ); 1776 } 1777 Magick::DrawableBase* Magick::DrawableViewbox::copy() const 1778 { 1779 return new DrawableViewbox(*this); 1780 } 1781 1782 // 1783 // Path Classes 1784 // 1785 1786 // 1787 // PathArcArgs 1788 // 1789 MagickPPExport int Magick::operator == ( const Magick::PathArcArgs& /*left_*/, 1790 const Magick::PathArcArgs& /*right_*/ ) 1791 { 1792 return ( 1 ); 1793 } 1794 MagickPPExport int Magick::operator != ( const Magick::PathArcArgs& /*left_*/, 1795 const Magick::PathArcArgs& /*right_*/ ) 1796 { 1797 return ( 0 ); 1798 } 1799 MagickPPExport int Magick::operator > ( const Magick::PathArcArgs& /*left_*/, 1800 const Magick::PathArcArgs& /*right_*/ ) 1801 { 1802 return ( 0 ); 1803 } 1804 MagickPPExport int Magick::operator < ( const Magick::PathArcArgs& /*left_*/, 1805 const Magick::PathArcArgs& /*right_*/ ) 1806 { 1807 return ( false ); 1808 } 1809 MagickPPExport int Magick::operator >= ( const Magick::PathArcArgs& left_, 1810 const Magick::PathArcArgs& right_ ) 1811 { 1812 return ( ( left_ > right_ ) || ( left_ == right_ ) ); 1813 } 1814 MagickPPExport int Magick::operator <= ( const Magick::PathArcArgs& left_, 1815 const Magick::PathArcArgs& right_ ) 1816 { 1817 return ( ( left_ < right_ ) || ( left_ == right_ ) ); 1818 } 1819 // Default constructor 1820 Magick::PathArcArgs::PathArcArgs( void ) 1821 : _radiusX(0), 1822 _radiusY(0), 1823 _xAxisRotation(0), 1824 _largeArcFlag(false), 1825 _sweepFlag(false), 1826 _x(0), 1827 _y(0) 1828 { 1829 } 1830 // Normal constructor 1831 Magick::PathArcArgs::PathArcArgs( double radiusX_, double radiusY_, 1832 double xAxisRotation_, bool largeArcFlag_, 1833 bool sweepFlag_, double x_, double y_ ) 1834 : _radiusX(radiusX_), 1835 _radiusY(radiusY_), 1836 _xAxisRotation(xAxisRotation_), 1837 _largeArcFlag(largeArcFlag_), 1838 _sweepFlag(sweepFlag_), 1839 _x(x_), 1840 _y(y_) 1841 { 1842 } 1843 // Copy constructor 1844 Magick::PathArcArgs::PathArcArgs( const Magick::PathArcArgs &original_ ) 1845 : _radiusX(original_._radiusX), 1846 _radiusY(original_._radiusY), 1847 _xAxisRotation(original_._xAxisRotation), 1848 _largeArcFlag(original_._largeArcFlag), 1849 _sweepFlag(original_._sweepFlag), 1850 _x(original_._x), 1851 _y(original_._y) 1852 { 1853 } 1854 // Destructor 1855 Magick::PathArcArgs::~PathArcArgs ( void ) 1856 { 1857 } 1858 1859 // Path Arc 1860 Magick::PathArcAbs::PathArcAbs ( const Magick::PathArcArgs &coordinates_ ) 1861 : _coordinates(1,coordinates_) 1862 { 1863 } 1864 Magick::PathArcAbs::PathArcAbs ( const PathArcArgsList &coordinates_ ) 1865 : _coordinates(coordinates_) 1866 { 1867 } 1868 Magick::PathArcAbs::PathArcAbs ( const Magick::PathArcAbs& original_ ) 1869 : VPathBase (original_), 1870 _coordinates(original_._coordinates) 1871 { 1872 } 1873 Magick::PathArcAbs::~PathArcAbs ( void ) 1874 { 1875 } 1876 void Magick::PathArcAbs::operator()( MagickCore::DrawingWand * context_ ) const 1877 { 1878 for( PathArcArgsList::const_iterator p = _coordinates.begin(); 1879 p != _coordinates.end(); p++ ) 1880 { 1881 DrawPathEllipticArcAbsolute( context_, p->radiusX(), p->radiusY(), 1882 p->xAxisRotation(), (MagickBooleanType) p->largeArcFlag(), 1883 (MagickBooleanType) p->sweepFlag(), p->x(), p->y() ); 1884 } 1885 } 1886 Magick::VPathBase* Magick::PathArcAbs::copy() const 1887 { 1888 return new PathArcAbs(*this); 1889 } 1890 1891 Magick::PathArcRel::PathArcRel ( const Magick::PathArcArgs &coordinates_ ) 1892 : _coordinates(1,coordinates_) 1893 { 1894 } 1895 Magick::PathArcRel::PathArcRel ( const PathArcArgsList &coordinates_ ) 1896 : _coordinates(coordinates_) 1897 { 1898 } 1899 Magick::PathArcRel::PathArcRel ( const Magick::PathArcRel& original_ ) 1900 : VPathBase (original_), 1901 _coordinates(original_._coordinates) 1902 { 1903 } 1904 Magick::PathArcRel::~PathArcRel ( void ) 1905 { 1906 } 1907 void Magick::PathArcRel::operator()( MagickCore::DrawingWand * context_ ) const 1908 { 1909 for( PathArcArgsList::const_iterator p = _coordinates.begin(); 1910 p != _coordinates.end(); p++ ) 1911 { 1912 DrawPathEllipticArcRelative( context_, p->radiusX(), p->radiusY(), 1913 p->xAxisRotation(), (MagickBooleanType) p->largeArcFlag(), 1914 (MagickBooleanType) p->sweepFlag(), p->x(), p->y() ); 1915 } 1916 } 1917 Magick::VPathBase* Magick::PathArcRel::copy() const 1918 { 1919 return new PathArcRel(*this); 1920 } 1921 1922 // 1923 // Path Closepath 1924 // 1925 Magick::PathClosePath::~PathClosePath ( void ) 1926 { 1927 } 1928 void Magick::PathClosePath::operator()( MagickCore::DrawingWand * context_ ) const 1929 { 1930 DrawPathClose( context_ ); 1931 } 1932 Magick::VPathBase* Magick::PathClosePath::copy() const 1933 { 1934 return new PathClosePath(*this); 1935 } 1936 1937 // 1938 // Path Curveto (Cubic Bezier) 1939 // 1940 MagickPPExport int Magick::operator == ( const Magick::PathCurvetoArgs& /*left_*/, 1941 const Magick::PathCurvetoArgs& /*right_*/ ) 1942 { 1943 return ( 1 ); 1944 } 1945 MagickPPExport int Magick::operator != ( const Magick::PathCurvetoArgs& /*left_*/, 1946 const Magick::PathCurvetoArgs& /*right_*/ ) 1947 { 1948 return ( 0 ); 1949 } 1950 MagickPPExport int Magick::operator > ( const Magick::PathCurvetoArgs& /*left_*/, 1951 const Magick::PathCurvetoArgs& /*right_*/ ) 1952 { 1953 return ( 0 ); 1954 } 1955 MagickPPExport int Magick::operator < ( const Magick::PathCurvetoArgs& /*left_*/, 1956 const Magick::PathCurvetoArgs& /*right_*/ ) 1957 { 1958 return ( false ); 1959 } 1960 MagickPPExport int Magick::operator >= ( const Magick::PathCurvetoArgs& left_, 1961 const Magick::PathCurvetoArgs& right_ ) 1962 { 1963 return ( ( left_ > right_ ) || ( left_ == right_ ) ); 1964 } 1965 MagickPPExport int Magick::operator <= ( const Magick::PathCurvetoArgs& left_, 1966 const Magick::PathCurvetoArgs& right_ ) 1967 { 1968 return ( ( left_ < right_ ) || ( left_ == right_ ) ); 1969 } 1970 // Default constructor 1971 Magick::PathCurvetoArgs::PathCurvetoArgs( void ) 1972 : _x1(0), 1973 _y1(0), 1974 _x2(0), 1975 _y2(0), 1976 _x(0), 1977 _y(0) 1978 { 1979 } 1980 // Normal constructor 1981 Magick::PathCurvetoArgs::PathCurvetoArgs( double x1_, double y1_, 1982 double x2_, double y2_, 1983 double x_, double y_ ) 1984 : _x1(x1_), 1985 _y1(y1_), 1986 _x2(x2_), 1987 _y2(y2_), 1988 _x(x_), 1989 _y(y_) 1990 { 1991 } 1992 // Copy constructor 1993 Magick::PathCurvetoArgs::PathCurvetoArgs( const PathCurvetoArgs &original_ ) 1994 : _x1(original_._x1), 1995 _y1(original_._y1), 1996 _x2(original_._x2), 1997 _y2(original_._y2), 1998 _x(original_._x), 1999 _y(original_._y) 2000 { 2001 } 2002 // Destructor 2003 Magick::PathCurvetoArgs::~PathCurvetoArgs ( void ) 2004 { 2005 } 2006 2007 Magick::PathCurvetoAbs::PathCurvetoAbs ( const Magick::PathCurvetoArgs &args_ ) 2008 : _args(1,args_) 2009 { 2010 } 2011 Magick::PathCurvetoAbs::PathCurvetoAbs ( const PathCurveToArgsList &args_ ) 2012 : _args(args_) 2013 { 2014 } 2015 Magick::PathCurvetoAbs::PathCurvetoAbs 2016 ( const Magick::PathCurvetoAbs& original_ ) 2017 : VPathBase (original_), 2018 _args(original_._args) 2019 { 2020 } 2021 Magick::PathCurvetoAbs::~PathCurvetoAbs ( void ) 2022 { 2023 } 2024 void Magick::PathCurvetoAbs::operator() 2025 ( MagickCore::DrawingWand * context_ ) const 2026 { 2027 for( PathCurveToArgsList::const_iterator p = _args.begin(); 2028 p != _args.end(); p++ ) 2029 { 2030 DrawPathCurveToAbsolute( context_, p->x1(), p->y1(), p->x2(), p->y2(), 2031 p->x(), p->y() ); 2032 } 2033 } 2034 Magick::VPathBase* Magick::PathCurvetoAbs::copy() const 2035 { 2036 return new PathCurvetoAbs(*this); 2037 } 2038 Magick::PathCurvetoRel::PathCurvetoRel ( const Magick::PathCurvetoArgs &args_ ) 2039 : _args(1,args_) 2040 { 2041 } 2042 Magick::PathCurvetoRel::PathCurvetoRel ( const PathCurveToArgsList &args_ ) 2043 : _args(args_) 2044 { 2045 } 2046 Magick::PathCurvetoRel::PathCurvetoRel 2047 ( const Magick::PathCurvetoRel& original_ ) 2048 : VPathBase (original_), 2049 _args(original_._args) 2050 { 2051 } 2052 Magick::PathCurvetoRel::~PathCurvetoRel ( void ) 2053 { 2054 } 2055 void Magick::PathCurvetoRel::operator() 2056 ( MagickCore::DrawingWand * context_ ) const 2057 { 2058 for( PathCurveToArgsList::const_iterator p = _args.begin(); 2059 p != _args.end(); p++ ) 2060 { 2061 DrawPathCurveToRelative( context_, p->x1(), p->y1(), p->x2(), p->y2(), 2062 p->x(), p->y() ); 2063 } 2064 } 2065 Magick::VPathBase* Magick::PathCurvetoRel::copy() const 2066 { 2067 return new PathCurvetoRel(*this); 2068 } 2069 Magick::PathSmoothCurvetoAbs::PathSmoothCurvetoAbs 2070 ( const Magick::Coordinate &coordinates_ ) 2071 : _coordinates(1,coordinates_) 2072 { 2073 } 2074 Magick::PathSmoothCurvetoAbs::PathSmoothCurvetoAbs 2075 ( const CoordinateList &coordinates_ ) 2076 : _coordinates(coordinates_) 2077 { 2078 } 2079 Magick::PathSmoothCurvetoAbs::PathSmoothCurvetoAbs 2080 ( const Magick::PathSmoothCurvetoAbs& original_ ) 2081 : VPathBase (original_), 2082 _coordinates(original_._coordinates) 2083 { 2084 } 2085 Magick::PathSmoothCurvetoAbs::~PathSmoothCurvetoAbs ( void ) 2086 { 2087 } 2088 void Magick::PathSmoothCurvetoAbs::operator() 2089 ( MagickCore::DrawingWand * context_ ) const 2090 { 2091 for( CoordinateList::const_iterator p = _coordinates.begin(); 2092 p != _coordinates.end(); p++ ) 2093 { 2094 double x2 = p->x(); 2095 double y2 = p->y(); 2096 p++; 2097 if(p != _coordinates.end() ) 2098 DrawPathCurveToSmoothAbsolute( context_, x2, y2, p->x(), p->y() ); 2099 } 2100 } 2101 Magick::VPathBase* Magick::PathSmoothCurvetoAbs::copy() const 2102 { 2103 return new PathSmoothCurvetoAbs(*this); 2104 } 2105 Magick::PathSmoothCurvetoRel::PathSmoothCurvetoRel 2106 ( const Magick::Coordinate &coordinates_ ) 2107 : _coordinates(1,coordinates_) 2108 { 2109 } 2110 Magick::PathSmoothCurvetoRel::PathSmoothCurvetoRel 2111 ( const CoordinateList &coordinates_ ) 2112 : _coordinates(coordinates_) 2113 { 2114 } 2115 Magick::PathSmoothCurvetoRel::PathSmoothCurvetoRel 2116 ( const Magick::PathSmoothCurvetoRel& original_ ) 2117 : VPathBase (original_), 2118 _coordinates(original_._coordinates) 2119 { 2120 } 2121 Magick::PathSmoothCurvetoRel::~PathSmoothCurvetoRel ( void ) 2122 { 2123 } 2124 void Magick::PathSmoothCurvetoRel::operator() 2125 ( MagickCore::DrawingWand * context_ ) const 2126 { 2127 for( CoordinateList::const_iterator p = _coordinates.begin(); 2128 p != _coordinates.end(); p++ ) 2129 { 2130 double x2 = p->x(); 2131 double y2 = p->y(); 2132 p++; 2133 if(p != _coordinates.end() ) 2134 DrawPathCurveToSmoothRelative( context_, x2, y2, p->x(), p->y() ); 2135 } 2136 } 2137 Magick::VPathBase* Magick::PathSmoothCurvetoRel::copy() const 2138 { 2139 return new PathSmoothCurvetoRel(*this); 2140 } 2141 2142 // 2143 // Quadratic Curveto (Quadratic Bezier) 2144 // 2145 MagickPPExport int Magick::operator == 2146 ( const Magick::PathQuadraticCurvetoArgs& /*left_*/, 2147 const Magick::PathQuadraticCurvetoArgs& /*right_*/ ) 2148 { 2149 return ( 1 ); 2150 } 2151 MagickPPExport int Magick::operator != 2152 ( const Magick::PathQuadraticCurvetoArgs& /*left_*/, 2153 const Magick::PathQuadraticCurvetoArgs& /*right_*/ ) 2154 { 2155 return ( 0 ); 2156 } 2157 MagickPPExport int Magick::operator > 2158 ( const Magick::PathQuadraticCurvetoArgs& /*left_*/, 2159 const Magick::PathQuadraticCurvetoArgs& /*right_*/ ) 2160 { 2161 return ( 0 ); 2162 } 2163 MagickPPExport int Magick::operator < 2164 ( const Magick::PathQuadraticCurvetoArgs& /*left_*/, 2165 const Magick::PathQuadraticCurvetoArgs& /*right_*/ ) 2166 { 2167 return ( 0 ); 2168 } 2169 MagickPPExport int Magick::operator >= 2170 ( const Magick::PathQuadraticCurvetoArgs& left_, 2171 const Magick::PathQuadraticCurvetoArgs& right_ ) 2172 { 2173 return ( ( left_ > right_ ) || ( left_ == right_ ) ); 2174 } 2175 MagickPPExport int Magick::operator <= 2176 ( const Magick::PathQuadraticCurvetoArgs& left_, 2177 const Magick::PathQuadraticCurvetoArgs& right_ ) 2178 { 2179 return ( ( left_ < right_ ) || ( left_ == right_ ) ); 2180 } 2181 // Default Constructor 2182 Magick::PathQuadraticCurvetoArgs::PathQuadraticCurvetoArgs( void ) 2183 : _x1(0), 2184 _y1(0), 2185 _x(0), 2186 _y(0) 2187 { 2188 } 2189 // Normal Constructor 2190 Magick::PathQuadraticCurvetoArgs::PathQuadraticCurvetoArgs( double x1_, 2191 double y1_, 2192 double x_, 2193 double y_ ) 2194 : _x1(x1_), 2195 _y1(y1_), 2196 _x(x_), 2197 _y(y_) 2198 { 2199 } 2200 // Copy Constructor 2201 Magick::PathQuadraticCurvetoArgs::PathQuadraticCurvetoArgs( const PathQuadraticCurvetoArgs &original_ ) 2202 : _x1(original_._x1), 2203 _y1(original_._y1), 2204 _x(original_._x), 2205 _y(original_._y) 2206 { 2207 } 2208 // Destructor 2209 Magick::PathQuadraticCurvetoArgs::~PathQuadraticCurvetoArgs ( void ) 2210 { 2211 } 2212 2213 Magick::PathQuadraticCurvetoAbs::PathQuadraticCurvetoAbs 2214 ( const Magick::PathQuadraticCurvetoArgs &args_ ) 2215 : _args(1,args_) 2216 { 2217 } 2218 Magick::PathQuadraticCurvetoAbs::PathQuadraticCurvetoAbs 2219 ( const PathQuadraticCurvetoArgsList &args_ ) 2220 : _args(args_) 2221 { 2222 } 2223 Magick::PathQuadraticCurvetoAbs::PathQuadraticCurvetoAbs 2224 ( const Magick::PathQuadraticCurvetoAbs& original_ ) 2225 : VPathBase (original_), 2226 _args(original_._args) 2227 { 2228 } 2229 Magick::PathQuadraticCurvetoAbs::~PathQuadraticCurvetoAbs ( void ) 2230 { 2231 } 2232 void Magick::PathQuadraticCurvetoAbs::operator() 2233 ( MagickCore::DrawingWand * context_ ) const 2234 { 2235 for( PathQuadraticCurvetoArgsList::const_iterator p = _args.begin(); 2236 p != _args.end(); p++ ) 2237 { 2238 DrawPathCurveToQuadraticBezierAbsolute( context_, p->x1(), p->y1(), 2239 p->x(), p->y() ); 2240 } 2241 } 2242 Magick::VPathBase* Magick::PathQuadraticCurvetoAbs::copy() const 2243 { 2244 return new PathQuadraticCurvetoAbs(*this); 2245 } 2246 Magick::PathQuadraticCurvetoRel::PathQuadraticCurvetoRel 2247 ( const Magick::PathQuadraticCurvetoArgs &args_ ) 2248 : _args(1,args_) 2249 { 2250 } 2251 Magick::PathQuadraticCurvetoRel::PathQuadraticCurvetoRel 2252 ( const PathQuadraticCurvetoArgsList &args_ ) 2253 : _args(args_) 2254 { 2255 } 2256 Magick::PathQuadraticCurvetoRel::PathQuadraticCurvetoRel 2257 ( const Magick::PathQuadraticCurvetoRel& original_ ) 2258 : VPathBase (original_), 2259 _args(original_._args) 2260 { 2261 } 2262 Magick::PathQuadraticCurvetoRel::~PathQuadraticCurvetoRel ( void ) 2263 { 2264 } 2265 void Magick::PathQuadraticCurvetoRel::operator() 2266 ( MagickCore::DrawingWand * context_ ) const 2267 { 2268 for( PathQuadraticCurvetoArgsList::const_iterator p = _args.begin(); 2269 p != _args.end(); p++ ) 2270 { 2271 DrawPathCurveToQuadraticBezierRelative( context_, p->x1(), p->y1(), 2272 p->x(), p->y() ); 2273 } 2274 } 2275 Magick::VPathBase* Magick::PathQuadraticCurvetoRel::copy() const 2276 { 2277 return new PathQuadraticCurvetoRel(*this); 2278 } 2279 Magick::PathSmoothQuadraticCurvetoAbs::PathSmoothQuadraticCurvetoAbs 2280 ( const Magick::Coordinate &coordinate_ ) 2281 : _coordinates(1,coordinate_) 2282 { 2283 } 2284 Magick::PathSmoothQuadraticCurvetoAbs::PathSmoothQuadraticCurvetoAbs 2285 ( const CoordinateList &coordinates_ ) 2286 : _coordinates(coordinates_) 2287 { 2288 } 2289 Magick::PathSmoothQuadraticCurvetoAbs::PathSmoothQuadraticCurvetoAbs 2290 ( const Magick::PathSmoothQuadraticCurvetoAbs& original_ ) 2291 : VPathBase (original_), 2292 _coordinates(original_._coordinates) 2293 { 2294 } 2295 Magick::PathSmoothQuadraticCurvetoAbs::~PathSmoothQuadraticCurvetoAbs ( void ) 2296 { 2297 } 2298 void Magick::PathSmoothQuadraticCurvetoAbs::operator() 2299 ( MagickCore::DrawingWand * context_ ) const 2300 { 2301 for( CoordinateList::const_iterator p = _coordinates.begin(); 2302 p != _coordinates.end(); p++ ) 2303 { 2304 DrawPathCurveToQuadraticBezierSmoothAbsolute( context_, p->x(), p->y() ); 2305 } 2306 } 2307 Magick::VPathBase* Magick::PathSmoothQuadraticCurvetoAbs::copy() const 2308 { 2309 return new PathSmoothQuadraticCurvetoAbs(*this); 2310 } 2311 Magick::PathSmoothQuadraticCurvetoRel::PathSmoothQuadraticCurvetoRel 2312 ( const Magick::Coordinate &coordinate_ ) 2313 : _coordinates(1,coordinate_) 2314 { 2315 } 2316 Magick::PathSmoothQuadraticCurvetoRel::PathSmoothQuadraticCurvetoRel 2317 ( const CoordinateList &coordinates_ ) 2318 : _coordinates(coordinates_) 2319 { 2320 } 2321 Magick::PathSmoothQuadraticCurvetoRel::PathSmoothQuadraticCurvetoRel 2322 ( const PathSmoothQuadraticCurvetoRel& original_ ) 2323 : VPathBase (original_), 2324 _coordinates(original_._coordinates) 2325 { 2326 } 2327 Magick::PathSmoothQuadraticCurvetoRel::~PathSmoothQuadraticCurvetoRel ( void ) 2328 { 2329 } 2330 void Magick::PathSmoothQuadraticCurvetoRel::operator() 2331 ( MagickCore::DrawingWand * context_ ) const 2332 { 2333 for( CoordinateList::const_iterator p = _coordinates.begin(); 2334 p != _coordinates.end(); p++ ) 2335 { 2336 DrawPathCurveToQuadraticBezierSmoothRelative( context_, p->x(), p->y() ); 2337 } 2338 } 2339 Magick::VPathBase* Magick::PathSmoothQuadraticCurvetoRel::copy() const 2340 { 2341 return new PathSmoothQuadraticCurvetoRel(*this); 2342 } 2343 2344 // 2345 // Path Lineto 2346 // 2347 Magick::PathLinetoAbs::PathLinetoAbs ( const Magick::Coordinate& coordinate_ ) 2348 : _coordinates(1,coordinate_) 2349 { 2350 } 2351 Magick::PathLinetoAbs::PathLinetoAbs ( const CoordinateList &coordinates_ ) 2352 : _coordinates(coordinates_) 2353 { 2354 } 2355 Magick::PathLinetoAbs::PathLinetoAbs ( const Magick::PathLinetoAbs& original_ ) 2356 : VPathBase (original_), 2357 _coordinates(original_._coordinates) 2358 { 2359 } 2360 Magick::PathLinetoAbs::~PathLinetoAbs ( void ) 2361 { 2362 } 2363 void Magick::PathLinetoAbs::operator()( MagickCore::DrawingWand * context_ ) const 2364 { 2365 for( CoordinateList::const_iterator p = _coordinates.begin(); 2366 p != _coordinates.end(); p++ ) 2367 { 2368 DrawPathLineToAbsolute( context_, p->x(), p->y() ); 2369 } 2370 } 2371 Magick::VPathBase* Magick::PathLinetoAbs::copy() const 2372 { 2373 return new PathLinetoAbs(*this); 2374 } 2375 Magick::PathLinetoRel::PathLinetoRel ( const Magick::Coordinate& coordinate_ ) 2376 : _coordinates(1,coordinate_) 2377 { 2378 } 2379 Magick::PathLinetoRel::PathLinetoRel ( const CoordinateList &coordinates_ ) 2380 : _coordinates(coordinates_) 2381 { 2382 } 2383 Magick::PathLinetoRel::PathLinetoRel ( const Magick::PathLinetoRel& original_ ) 2384 : VPathBase (original_), 2385 _coordinates(original_._coordinates) 2386 { 2387 } 2388 Magick::PathLinetoRel::~PathLinetoRel ( void ) 2389 { 2390 } 2391 void Magick::PathLinetoRel::operator()( MagickCore::DrawingWand * context_ ) const 2392 { 2393 for( CoordinateList::const_iterator p = _coordinates.begin(); 2394 p != _coordinates.end(); p++ ) 2395 { 2396 DrawPathLineToRelative( context_, p->x(), p->y() ); 2397 } 2398 } 2399 Magick::VPathBase* Magick::PathLinetoRel::copy() const 2400 { 2401 return new PathLinetoRel(*this); 2402 } 2403 2404 // 2405 // Path Horizontal Lineto 2406 // 2407 2408 Magick::PathLinetoHorizontalAbs::~PathLinetoHorizontalAbs ( void ) 2409 { 2410 } 2411 void Magick::PathLinetoHorizontalAbs::operator() 2412 ( MagickCore::DrawingWand * context_ ) const 2413 { 2414 DrawPathLineToHorizontalAbsolute( context_, _x ); 2415 } 2416 Magick::VPathBase* Magick::PathLinetoHorizontalAbs::copy() const 2417 { 2418 return new PathLinetoHorizontalAbs(*this); 2419 } 2420 Magick::PathLinetoHorizontalRel::~PathLinetoHorizontalRel ( void ) 2421 { 2422 } 2423 void Magick::PathLinetoHorizontalRel::operator() 2424 ( MagickCore::DrawingWand * context_ ) const 2425 { 2426 DrawPathLineToHorizontalRelative( context_, _x ); 2427 } 2428 Magick::VPathBase* Magick::PathLinetoHorizontalRel::copy() const 2429 { 2430 return new PathLinetoHorizontalRel(*this); 2431 } 2432 2433 // 2434 // Path Vertical Lineto 2435 // 2436 Magick::PathLinetoVerticalAbs::~PathLinetoVerticalAbs ( void ) 2437 { 2438 } 2439 void Magick::PathLinetoVerticalAbs::operator() 2440 ( MagickCore::DrawingWand * context_ ) const 2441 { 2442 DrawPathLineToVerticalAbsolute( context_, _y ); 2443 } 2444 Magick::VPathBase* Magick::PathLinetoVerticalAbs::copy() const 2445 { 2446 return new PathLinetoVerticalAbs(*this); 2447 } 2448 Magick::PathLinetoVerticalRel::~PathLinetoVerticalRel ( void ) 2449 { 2450 } 2451 void Magick::PathLinetoVerticalRel::operator() 2452 ( MagickCore::DrawingWand * context_ ) const 2453 { 2454 DrawPathLineToVerticalRelative( context_, _y ); 2455 } 2456 Magick::VPathBase* Magick::PathLinetoVerticalRel::copy() const 2457 { 2458 return new PathLinetoVerticalRel(*this); 2459 } 2460 2461 // 2462 // Path Moveto 2463 // 2464 2465 Magick::PathMovetoAbs::PathMovetoAbs ( const Magick::Coordinate &coordinate_ ) 2466 : _coordinates(1,coordinate_) 2467 { 2468 } 2469 Magick::PathMovetoAbs::PathMovetoAbs ( const CoordinateList &coordinates_ ) 2470 : _coordinates(coordinates_) 2471 { 2472 } 2473 Magick::PathMovetoAbs::PathMovetoAbs ( const Magick::PathMovetoAbs& original_ ) 2474 : VPathBase (original_), 2475 _coordinates(original_._coordinates) 2476 { 2477 } 2478 Magick::PathMovetoAbs::~PathMovetoAbs ( void ) 2479 { 2480 } 2481 void Magick::PathMovetoAbs::operator()( MagickCore::DrawingWand * context_ ) const 2482 { 2483 for( CoordinateList::const_iterator p = _coordinates.begin(); 2484 p != _coordinates.end(); p++ ) 2485 { 2486 DrawPathMoveToAbsolute( context_, p->x(), p->y() ); 2487 } 2488 } 2489 Magick::VPathBase* Magick::PathMovetoAbs::copy() const 2490 { 2491 return new PathMovetoAbs(*this); 2492 } 2493 Magick::PathMovetoRel::PathMovetoRel ( const Magick::Coordinate &coordinate_ ) 2494 : _coordinates(1,coordinate_) 2495 { 2496 } 2497 Magick::PathMovetoRel::PathMovetoRel ( const CoordinateList &coordinates_ ) 2498 : _coordinates(coordinates_) 2499 { 2500 } 2501 Magick::PathMovetoRel::PathMovetoRel ( const Magick::PathMovetoRel& original_ ) 2502 : VPathBase (original_), 2503 _coordinates(original_._coordinates) 2504 { 2505 } 2506 Magick::PathMovetoRel::~PathMovetoRel ( void ) 2507 { 2508 } 2509 void Magick::PathMovetoRel::operator()( MagickCore::DrawingWand * context_ ) const 2510 { 2511 for( CoordinateList::const_iterator p = _coordinates.begin(); 2512 p != _coordinates.end(); p++ ) 2513 { 2514 DrawPathMoveToRelative( context_, p->x(), p->y() ); 2515 } 2516 } 2517 Magick::VPathBase* Magick::PathMovetoRel::copy() const 2518 { 2519 return new PathMovetoRel(*this); 2520 } 2521 2522 #if defined(EXPLICIT_TEMPLATE_INSTANTIATION) 2523 // template class std::vector<Magick::Coordinate>; 2524 // template class std::vector<const Magick::Drawable>; 2525 // template class std::vector<const Magick::PathArcArgs>; 2526 // template class std::vector<const Magick::PathCurvetoArgs>; 2527 // template class std::vector<const Magick::PathQuadraticCurvetoArgs>; 2528 // template class std::vector<const Magick::VPath>; 2529 #endif 2530