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