Magick++  7.0.7
Convert, Edit, Or Compose Bitmap Images
Drawable.cpp
Go to the documentation of this file.
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 
23  const Magick::Coordinate& right_)
24 {
25  return((left_.x() == right_.x()) && (left_.y() == right_.y()));
26 }
27 
29  const Magick::Coordinate& right_)
30 {
31  return(!(left_ == right_));
32 }
33 
35  const Magick::Coordinate& right_)
36 {
37  return (!(left_ < right_) && (left_ != right_));
38 }
39 
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 
49  const Magick::Coordinate& right_)
50 {
51  return((left_ > right_) || (left_ == right_));
52 }
53 
55  const Magick::Coordinate& right_)
56 {
57  return((left_ < right_) || (left_ == right_));
58 }
59 
60 /* DrawableBase */
62 {
63 }
64 
66 {
67 }
68 
69 void Magick::DrawableBase::operator()(MagickCore::DrawingWand * context_) const
70 {
71  (void) context_;
72 }
73 
75 {
76  return new DrawableBase(*this);
77 }
78 
79 /* Drawable */
81  : dp((Magick::DrawableBase *) NULL)
82 {
83 }
84 
86  : dp(original_.copy())
87 {
88 }
89 
91 {
92  delete dp;
93  dp=(Magick::DrawableBase *) NULL;
94 }
95 
97  : dp((original_.dp != (Magick::DrawableBase *) NULL ? original_.dp->copy() :
98  (Magick::DrawableBase *) NULL))
99 {
100 }
101 
103  const Magick::Drawable& original_)
104 {
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*/
126 {
127 }
128 
129 // Constructor
131  : dp(0)
132 {
133 }
134 
135 // Construct from VPathBase
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
150  : dp(original_.dp? original_.dp->copy(): 0)
151 {
152 }
153 
154 // Assignment operator
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)
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 }
190 {
191  GetAffineMatrix(&_affine);
192 }
194 {
195 }
196 void Magick::DrawableAffine::operator()( MagickCore::DrawingWand * context_ ) const
197 {
198  DrawAffine( context_, &_affine );
199 }
201 {
202  return new DrawableAffine(*this);
203 }
204 
206 {
207 }
208 
209 void Magick::DrawableAlpha::operator()(MagickCore::DrawingWand * context_) const
210 {
211  DrawAlpha(context_,_x,_y,_paintMethod);
212 }
213 
215 {
216  return new DrawableAlpha(*this);
217 }
218 
219 // Arc
221 {
222 }
223 void Magick::DrawableArc::operator()( MagickCore::DrawingWand * context_ ) const
224 {
225  DrawArc( context_, _startX, _startY, _endX, _endY, _startDegrees, _endDegrees );
226 }
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)
237  : _coordinates(coordinates_)
238 {
239 }
240 // Copy constructor
242  : DrawableBase (original_),
243  _coordinates(original_._coordinates)
244 {
245 }
246 // Destructor
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 }
270 {
271  return new DrawableBezier(*this);
272 }
273 
274 
275 /* DrawableBorderColor */
277  : _color(color_)
278 {
279 }
280 
282  (const Magick::DrawableBorderColor &original_)
283  : DrawableBase(original_),
284  _color(original_._color)
285 {
286 }
287 
289 {
290 }
291 
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 
309 {
310  _color=color_;
311 }
312 
314 {
315  return(_color);
316 }
317 
319 {
320  return(new DrawableBorderColor(*this));
321 }
322 
323 
324 /* DrawableClipRule */
326 {
327  _fillRule=fillRule_;
328 }
329 
331 {
332 }
333 
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 
351 {
352  return(new DrawableClipRule(*this));
353 }
354 
355 
356 /* DrawableClipUnits */
358 {
359  _units = units_;
360 }
361 
363 {
364 }
365 
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 
383 {
384  return(new DrawableClipUnits(*this));
385 }
386 
387 
388 //
389 //Clip Path
390 //
391 
392 // Pop (terminate) Clip path definition
394 {
395 }
396 void Magick::DrawablePopClipPath::operator() ( MagickCore::DrawingWand * context_ ) const
397 {
398  DrawPopClipPath( context_ );
399  DrawPopDefs(context_);
400 }
402 {
403  return new DrawablePopClipPath(*this);
404 }
405 
406 // Push clip path definition
408  : _id(id_.c_str()) //multithread safe const char*
409 {
410 }
412 ( const Magick::DrawablePushClipPath& original_ ) //multithread safe const char*
413  : DrawableBase (original_),
414  _id(original_._id.c_str())
415 {
416 }
418 {
419 }
420 void Magick::DrawablePushClipPath::operator()
421  ( MagickCore::DrawingWand * context_ ) const
422 {
423  DrawPushDefs(context_);
424  DrawPushClipPath( context_, _id.c_str());
425 }
427 {
428  return new DrawablePushClipPath(*this);
429 }
430 //
431 // ClipPath
432 //
434 :_id(id_.c_str())
435 {
436 }
437 
439  : DrawableBase (original_),
440  _id(original_._id.c_str())
441 {
442 }
444 {
445 }
446 void Magick::DrawableClipPath::operator()( MagickCore::DrawingWand * context_ ) const
447 {
448  (void) DrawSetClipPath( context_, _id.c_str());
449 }
451 {
452  return new DrawableClipPath(*this);
453 }
454 
455 // Circle
457 {
458 }
459 void Magick::DrawableCircle::operator()( MagickCore::DrawingWand * context_ ) const
460 {
461  DrawCircle( context_, _originX, _originY, _perimX, _perimY );
462 }
464 {
465  return new DrawableCircle(*this);
466 }
467 
468 // Colorize at point using PaintMethod
470 {
471 }
472 void Magick::DrawableColor::operator()( MagickCore::DrawingWand * context_ ) const
473 {
474  DrawColor( context_, _x, _y, _paintMethod );
475 }
477 {
478  return new DrawableColor(*this);
479 }
480 
481 // Draw image at point
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 }
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 }
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 }
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 }
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 }
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
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 }
571 {
572  delete _image;
573 }
574 // Assignment operator
575 Magick::DrawableCompositeImage& Magick::DrawableCompositeImage::operator=
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 }
599 {
600  return _image->fileName();
601 }
602 
604 {
605  Image* temp_image = new Image(image_);
606  delete _image;
607  _image = temp_image;
608 }
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 }
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 
637 {
638  return new DrawableCompositeImage(*this);
639 }
640 
642  : _density(density_)
643 {
644 }
645 
646 Magick::DrawableDensity::DrawableDensity(const std::string &density_)
647  : _density(density_)
648 {
649 }
650 
652 {
653 }
654 
656  MagickCore::DrawingWand *context_) const
657 {
658  DrawSetDensity(context_,_density.c_str());
659 }
660 
662 {
663  return(new DrawableDensity(*this));
664 }
665 
666 // Ellipse
668 {
669 }
670 void Magick::DrawableEllipse::operator()
671  ( MagickCore::DrawingWand * context_ ) const
672 {
673  DrawEllipse( context_, _originX, _originY, _radiusX, _radiusY,
674  _arcStart, _arcEnd );
675 }
677 {
678  return new DrawableEllipse(*this);
679 }
680 
681 // Specify drawing fill color
683  : _color(color_)
684 {
685 }
687 ( const Magick::DrawableFillColor& original_ )
688  : DrawableBase (original_),
689  _color(original_._color)
690 {
691 }
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 }
705 {
706  return new DrawableFillColor(*this);
707 }
708 
709 /* DrawableFillPatternUrl */
711  : _url(url_)
712 {
713 }
714 
716  const Magick::DrawableFillPatternUrl& original_)
717  : DrawableBase(original_),
718  _url(original_._url)
719 {
720 }
721 
723 {
724 }
725 
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 
743 {
744  return(new DrawableFillPatternUrl(*this));
745 }
746 
747 // Specify drawing fill fule
749 {
750 }
751 void Magick::DrawableFillRule::operator()
752  ( MagickCore::DrawingWand * context_ ) const
753 {
754  DrawSetFillRule( context_, _fillRule );
755 }
757 {
758  return new DrawableFillRule(*this);
759 }
760 
762 {
763 }
764 
765 void Magick::DrawableFillOpacity::operator()
766  (MagickCore::DrawingWand *context_) const
767 {
768  DrawSetFillOpacity(context_,_opacity);
769 }
770 
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 }
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 }
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 }
832 {
833  return new DrawableFont(*this);
834 }
835 
836 // Specify text positioning gravity
838 {
839 }
840 void Magick::DrawableGravity::operator()
841  ( MagickCore::DrawingWand * context_ ) const
842 {
843  DrawSetGravity( context_, _gravity );
844 }
846 {
847  return new DrawableGravity(*this);
848 }
849 
850 // Line
852 {
853 }
854 void Magick::DrawableLine::operator()( MagickCore::DrawingWand * context_ ) const
855 {
856  DrawLine( context_, _startX, _startY, _endX, _endY );
857 }
859 {
860  return new DrawableLine(*this);
861 }
862 
863 // Drawable Path
865  : _path(path_)
866 {
867 }
869  : DrawableBase (original_),
870  _path(original_._path)
871 {
872 }
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 }
887 {
888  return new DrawablePath(*this);
889 }
890 
891 // Point
893 {
894 }
895 void Magick::DrawablePoint::operator()( MagickCore::DrawingWand * context_ ) const
896 {
897  DrawPoint( context_, _x, _y );
898 }
900 {
901  return new DrawablePoint(*this);
902 }
903 
904 // Text pointsize
906 {
907 }
908 void Magick::DrawablePointSize::operator()
909  ( MagickCore::DrawingWand * context_ ) const
910 {
911  DrawSetFontSize( context_, _pointSize );
912 }
914 {
915  return new DrawablePointSize(*this);
916 }
917 
918 // Polygon (Coordinate list must contain at least three members)
920  : _coordinates(coordinates_)
921 {
922 }
924 ( const Magick::DrawablePolygon& original_ )
925  : DrawableBase (original_),
926  _coordinates(original_._coordinates)
927 {
928 }
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 }
953 {
954  return new DrawablePolygon(*this);
955 }
956 
957 // Polyline (Coordinate list must contain at least three members)
959 ( const CoordinateList &coordinates_ )
960  : _coordinates(coordinates_)
961 {
962 }
964 ( const Magick::DrawablePolyline& original_ )
965  : DrawableBase (original_),
966  _coordinates(original_._coordinates)
967 {
968 }
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 }
993 {
994  return new DrawablePolyline(*this);
995 }
996 
997 // Pop Graphic Context
999 {
1000 }
1001 void Magick::DrawablePopGraphicContext::operator()
1002  ( MagickCore::DrawingWand * context_ ) const
1003 {
1004  PopDrawingWand( context_ );
1005 }
1007 {
1008  return new DrawablePopGraphicContext(*this);
1009 }
1010 
1011 // Push Graphic Context
1013 {
1014 }
1015 void Magick::DrawablePushGraphicContext::operator()
1016  ( MagickCore::DrawingWand * context_ ) const
1017 {
1018  PushDrawingWand( context_ );
1019 }
1021 {
1022  return new DrawablePushGraphicContext(*this);
1023 }
1024 
1025 // Pop (terminate) Pattern definition
1027 {
1028 }
1029 void Magick::DrawablePopPattern::operator()
1030  ( MagickCore::DrawingWand * context_ ) const
1031 {
1032  (void) DrawPopPattern( context_ );
1033 }
1035 {
1036  return new DrawablePopPattern(*this);
1037 }
1038 
1039 // Push Pattern definition
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 }
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 }
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 }
1069 {
1070  return new DrawablePushPattern(*this);
1071 }
1072 
1073 // Rectangle
1075 {
1076 }
1077 void Magick::DrawableRectangle::operator()
1078  ( MagickCore::DrawingWand * context_ ) const
1079 {
1080  DrawRectangle( context_, _upperLeftX, _upperLeftY,
1081  _lowerRightX, _lowerRightY );
1082 }
1084 {
1085  return new DrawableRectangle(*this);
1086 }
1087 
1088 // Apply Rotation
1090 {
1091 }
1092 void Magick::DrawableRotation::operator()
1093  ( MagickCore::DrawingWand * context_ ) const
1094 {
1095  DrawRotate( context_, _angle );
1096 }
1098 {
1099  return new DrawableRotation(*this);
1100 }
1101 
1102 // Round Rectangle
1104 {
1105 }
1106 void Magick::DrawableRoundRectangle::operator()
1107  ( MagickCore::DrawingWand * context_ ) const
1108 {
1109  DrawRoundRectangle(context_,_upperLeftX,_upperLeftY,_lowerRightX,
1110  _lowerRightY,_cornerWidth, _cornerHeight);
1111 }
1113 {
1114  return new DrawableRoundRectangle(*this);
1115 }
1116 
1117 // Apply Scaling
1119 {
1120 }
1121 void Magick::DrawableScaling::operator()
1122  ( MagickCore::DrawingWand * context_ ) const
1123 {
1124  DrawScale( context_, _x, _y );
1125 }
1127 {
1128  return new DrawableScaling(*this);
1129 }
1130 
1131 // Apply Skew in the X direction
1133 {
1134 }
1135 void Magick::DrawableSkewX::operator()
1136  ( MagickCore::DrawingWand * context_ ) const
1137 {
1138  DrawSkewX( context_, _angle );
1139 }
1141 {
1142  return new DrawableSkewX(*this);
1143 }
1144 
1145 // Apply Skew in the Y direction
1147 {
1148 }
1149 void Magick::DrawableSkewY::operator()( MagickCore::DrawingWand * context_ ) const
1150 {
1151  DrawSkewY( context_, _angle );
1152 }
1154 {
1155  return new DrawableSkewY(*this);
1156 }
1157 
1158 /* DrawableStrokeDashArray */
1160  : _size(0),
1161  _dasharray(0)
1162 {
1163  dasharray(dasharray_);
1164 }
1165 
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 
1181 {
1182  delete [] _dasharray;
1183  _size=0;
1184  _dasharray=(double *) NULL;
1185 }
1186 
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 
1206  MagickCore::DrawingWand *context_) const
1207 {
1208  (void) DrawSetStrokeDashArray(context_,(const unsigned long) _size,
1209  _dasharray);
1210 }
1211 
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 
1252 {
1253  return(_dasharray);
1254 }
1255 
1256 /* DrawableStrokeDashOffset */
1258 {
1259 }
1260 
1261 void Magick::DrawableStrokeDashOffset::operator()
1262  ( MagickCore::DrawingWand * context_) const
1263 {
1264  DrawSetStrokeDashOffset(context_,_offset);
1265 }
1266 
1268 {
1269  return(new DrawableStrokeDashOffset(*this));
1270 }
1271 
1273 {
1274  _offset=offset_;
1275 }
1276 
1278 {
1279  return(_offset);
1280 }
1281 
1282 // Stroke linecap
1284 {
1285 }
1286 void Magick::DrawableStrokeLineCap::operator()
1287  ( MagickCore::DrawingWand * context_ ) const
1288 {
1289  DrawSetStrokeLineCap( context_, _linecap );
1290 }
1292 {
1293  return new DrawableStrokeLineCap(*this);
1294 }
1295 
1296 // Stroke linejoin
1298 {
1299 }
1300 void Magick::DrawableStrokeLineJoin::operator()
1301  ( MagickCore::DrawingWand * context_ ) const
1302 {
1303  DrawSetStrokeLineJoin( context_, _linejoin );
1304 }
1306 {
1307  return new DrawableStrokeLineJoin(*this);
1308 }
1309 
1310 // Stroke miterlimit
1312 {
1313 }
1314 void Magick::DrawableMiterLimit::operator()
1315  ( MagickCore::DrawingWand * context_ ) const
1316 {
1317  DrawSetStrokeMiterLimit( context_, _miterlimit );
1318 }
1320 {
1321  return new DrawableMiterLimit(*this);
1322 }
1323 
1324 
1325 /* DrawableStrokePatternUrl */
1327  const std::string &url_)
1328  : _url(url_)
1329 {
1330 }
1331 
1333  const Magick::DrawableStrokePatternUrl& original_)
1334  : DrawableBase(original_),
1335  _url(original_._url)
1336 {
1337 }
1338 
1340 {
1341 }
1342 
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 
1355 {
1356  return(_url);
1357 }
1358 
1360 {
1361  return(new DrawableStrokePatternUrl(*this));
1362 }
1363 
1364 // Stroke antialias
1366 {
1367 }
1368 void Magick::DrawableStrokeAntialias::operator()
1369 ( MagickCore::DrawingWand * context_ ) const
1370 {
1371  DrawSetStrokeAntialias( context_, static_cast<MagickBooleanType>
1372  (_flag ? MagickTrue : MagickFalse) );
1373 }
1375 {
1376  return new DrawableStrokeAntialias(*this);
1377 }
1378 
1379 // Stroke color
1381 ( const Magick::Color &color_ )
1382  : _color(color_)
1383 {
1384 }
1386 ( const Magick::DrawableStrokeColor& original_ )
1387  : DrawableBase (original_),
1388  _color(original_._color)
1389 {
1390 }
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 }
1404 {
1405  return new DrawableStrokeColor(*this);
1406 }
1407 
1409 {
1410 }
1411 
1412 void Magick::DrawableStrokeOpacity::operator()
1413  (MagickCore::DrawingWand * context_) const
1414 {
1415  DrawSetStrokeOpacity(context_,_opacity);
1416 }
1417 
1419 {
1420  return new DrawableStrokeOpacity(*this);
1421 }
1422 
1423 // Stroke width
1425 {
1426 }
1427 void Magick::DrawableStrokeWidth::operator()
1428  ( MagickCore::DrawingWand * context_ ) const
1429 {
1430  DrawSetStrokeWidth( context_, _width );
1431 }
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 }
1455  : DrawableBase (original_),
1456  _x(original_._x),
1457  _y(original_._y),
1458  _text(original_._text),
1459  _encoding(original_._encoding)
1460 {
1461 }
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 }
1473 {
1474  return new DrawableText(*this);
1475 }
1476 
1477 /* DrawableTextAlignment */
1479  Magick::AlignType alignment_)
1480  : _alignment(alignment_)
1481 {
1482 }
1483 
1486  : DrawableBase(original_),
1487  _alignment(original_._alignment)
1488 {
1489 }
1490 
1492 {
1493 }
1494 
1496  MagickCore::DrawingWand * context_) const
1497 {
1498  DrawSetTextAlignment(context_, _alignment);
1499 }
1500 
1502 {
1503  _alignment=alignment_;
1504 }
1505 
1506 Magick::AlignType Magick::DrawableTextAlignment::alignment(void) const
1507 {
1508  return(_alignment);
1509 }
1510 
1512 {
1513  return new DrawableTextAlignment(*this);
1514 }
1515 
1516 // Text antialias
1518  : _flag(flag_)
1519 {
1520 }
1522  : DrawableBase (original_),
1523  _flag(original_._flag)
1524 {
1525 }
1527 {
1528 }
1529 void Magick::DrawableTextAntialias::operator()
1530  ( MagickCore::DrawingWand * context_ ) const
1531 {
1532  DrawSetTextAntialias( context_, static_cast<MagickBooleanType>
1533  (_flag ? MagickTrue : MagickFalse) );
1534 }
1536 {
1537  return new DrawableTextAntialias(*this);
1538 }
1539 
1540 
1541 // Decoration (text decoration)
1543  ( Magick::DecorationType decoration_ )
1544  : _decoration(decoration_)
1545 {
1546 }
1548  ( const Magick::DrawableTextDecoration &original_ )
1549  : DrawableBase (original_),
1550  _decoration(original_._decoration)
1551 {
1552 }
1554 {
1555 }
1556 void Magick::DrawableTextDecoration::operator()
1557  ( MagickCore::DrawingWand * context_ ) const
1558 {
1559  DrawSetTextDecoration( context_, _decoration );
1560 }
1562 {
1563  return new DrawableTextDecoration(*this);
1564 }
1565 
1566 // DrawableTextDirection
1568  DirectionType direction_)
1569  : _direction(direction_)
1570 {
1571 }
1572 
1574 {
1575 }
1576 
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 
1594 {
1595  return new DrawableTextDirection(*this);
1596 }
1597 
1598 // DrawableTextInterlineSpacing
1600  double spacing_)
1601  : _spacing(spacing_)
1602 {
1603 }
1604 
1606 {
1607 }
1608 
1610  MagickCore::DrawingWand *context_) const
1611 {
1612  DrawSetTextInterlineSpacing(context_,_spacing);
1613 }
1614 
1616 {
1617  _spacing=spacing_;
1618 }
1619 
1621 {
1622  return(_spacing);
1623 }
1624 
1626 {
1627  return new DrawableTextInterlineSpacing(*this);
1628 }
1629 
1630 // DrawableTextInterwordSpacing
1632  double spacing_)
1633  : _spacing(spacing_)
1634 {
1635 }
1636 
1638 {
1639 }
1640 
1642  MagickCore::DrawingWand *context_) const
1643 {
1644  DrawSetTextInterwordSpacing(context_,_spacing);
1645 }
1646 
1648 {
1649  _spacing=spacing_;
1650 }
1651 
1653 {
1654  return(_spacing);
1655 }
1656 
1658 {
1659  return new DrawableTextInterwordSpacing(*this);
1660 }
1661 
1662 // DrawableTextKerning
1664  double kerning_)
1665  : _kerning(kerning_)
1666 {
1667 }
1668 
1670 {
1671 }
1672 
1674  MagickCore::DrawingWand *context_) const
1675 {
1676  DrawSetTextKerning(context_,_kerning);
1677 }
1678 
1680 {
1681  _kerning=kerning_;
1682 }
1683 
1685 {
1686  return(_kerning);
1687 }
1688 
1690 {
1691  return new DrawableTextKerning(*this);
1692 }
1693 
1694 // Set text undercolor
1696 ( const Magick::Color &color_ )
1697  : _color(color_)
1698 {
1699 }
1702  : DrawableBase (original_),
1703  _color(original_._color)
1704 {
1705 }
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 }
1719 {
1720  return new DrawableTextUnderColor(*this);
1721 }
1722 
1723 // Apply Translation
1725 {
1726 }
1727 void Magick::DrawableTranslation::operator()
1728  ( MagickCore::DrawingWand * context_ ) const
1729 {
1730  DrawTranslate( context_, _x, _y );
1731 }
1733 {
1734  return new DrawableTranslation(*this);
1735 }
1736 
1737 // Set the size of the viewbox
1739 {
1740 }
1741 void Magick::DrawableViewbox::operator()
1742  ( MagickCore::DrawingWand * context_ ) const
1743 {
1744  DrawSetViewbox( context_, _x1, _y1, _x2, _y2 );
1745 }
1747 {
1748  return new DrawableViewbox(*this);
1749 }
1750 
1751 //
1752 // Path Classes
1753 //
1754 
1755 //
1756 // PathArcArgs
1757 //
1759  const Magick::PathArcArgs& /*right_*/ )
1760 {
1761  return ( 1 );
1762 }
1764  const Magick::PathArcArgs& /*right_*/ )
1765 {
1766  return ( 0 );
1767 }
1769  const Magick::PathArcArgs& /*right_*/ )
1770 {
1771  return ( 0 );
1772 }
1774  const Magick::PathArcArgs& /*right_*/ )
1775 {
1776  return ( false );
1777 }
1779  const Magick::PathArcArgs& right_ )
1780 {
1781  return ( ( left_ > right_ ) || ( left_ == right_ ) );
1782 }
1784  const Magick::PathArcArgs& right_ )
1785 {
1786  return ( ( left_ < right_ ) || ( left_ == right_ ) );
1787 }
1788 // Default constructor
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
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
1825 {
1826 }
1827 
1828 // Path Arc
1830  : _coordinates(1,coordinates_)
1831 {
1832 }
1834  : _coordinates(coordinates_)
1835 {
1836 }
1838  : VPathBase (original_),
1839  _coordinates(original_._coordinates)
1840 {
1841 }
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 }
1856 {
1857  return new PathArcAbs(*this);
1858 }
1859 
1861  : _coordinates(1,coordinates_)
1862 {
1863 }
1865  : _coordinates(coordinates_)
1866 {
1867 }
1869  : VPathBase (original_),
1870  _coordinates(original_._coordinates)
1871 {
1872 }
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 }
1887 {
1888  return new PathArcRel(*this);
1889 }
1890 
1891 //
1892 // Path Closepath
1893 //
1895 {
1896 }
1897 void Magick::PathClosePath::operator()( MagickCore::DrawingWand * context_ ) const
1898 {
1899  DrawPathClose( context_ );
1900 }
1902 {
1903  return new PathClosePath(*this);
1904 }
1905 
1906 //
1907 // Path Curveto (Cubic Bezier)
1908 //
1910  const Magick::PathCurvetoArgs& /*right_*/ )
1911 {
1912  return ( 1 );
1913 }
1915  const Magick::PathCurvetoArgs& /*right_*/ )
1916 {
1917  return ( 0 );
1918 }
1920  const Magick::PathCurvetoArgs& /*right_*/ )
1921 {
1922  return ( 0 );
1923 }
1925  const Magick::PathCurvetoArgs& /*right_*/ )
1926 {
1927  return ( false );
1928 }
1930  const Magick::PathCurvetoArgs& right_ )
1931 {
1932  return ( ( left_ > right_ ) || ( left_ == right_ ) );
1933 }
1935  const Magick::PathCurvetoArgs& right_ )
1936 {
1937  return ( ( left_ < right_ ) || ( left_ == right_ ) );
1938 }
1939 // Default constructor
1941  : _x1(0),
1942  _y1(0),
1943  _x2(0),
1944  _y2(0),
1945  _x(0),
1946  _y(0)
1947 {
1948 }
1949 // Normal constructor
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
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
1973 {
1974 }
1975 
1977  : _args(1,args_)
1978 {
1979 }
1981  : _args(args_)
1982 {
1983 }
1985  ( const Magick::PathCurvetoAbs& original_ )
1986  : VPathBase (original_),
1987  _args(original_._args)
1988 {
1989 }
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 }
2004 {
2005  return new PathCurvetoAbs(*this);
2006 }
2008  : _args(1,args_)
2009 {
2010 }
2012  : _args(args_)
2013 {
2014 }
2016 ( const Magick::PathCurvetoRel& original_ )
2017  : VPathBase (original_),
2018  _args(original_._args)
2019 {
2020 }
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 }
2035 {
2036  return new PathCurvetoRel(*this);
2037 }
2039 ( const Magick::Coordinate &coordinates_ )
2040  : _coordinates(1,coordinates_)
2041 {
2042 }
2044 ( const CoordinateList &coordinates_ )
2045  : _coordinates(coordinates_)
2046 {
2047 }
2049 ( const Magick::PathSmoothCurvetoAbs& original_ )
2050  : VPathBase (original_),
2051  _coordinates(original_._coordinates)
2052 {
2053 }
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 }
2072 {
2073  return new PathSmoothCurvetoAbs(*this);
2074 }
2076 ( const Magick::Coordinate &coordinates_ )
2077  : _coordinates(1,coordinates_)
2078 {
2079 }
2081 ( const CoordinateList &coordinates_ )
2082  : _coordinates(coordinates_)
2083 {
2084 }
2086 ( const Magick::PathSmoothCurvetoRel& original_ )
2087  : VPathBase (original_),
2088  _coordinates(original_._coordinates)
2089 {
2090 }
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 }
2109 {
2110  return new PathSmoothCurvetoRel(*this);
2111 }
2112 
2113 //
2114 // Quadratic Curveto (Quadratic Bezier)
2115 //
2116 MagickPPExport int Magick::operator ==
2118  const Magick::PathQuadraticCurvetoArgs& /*right_*/ )
2119 {
2120  return ( 1 );
2121 }
2122 MagickPPExport int Magick::operator !=
2124  const Magick::PathQuadraticCurvetoArgs& /*right_*/ )
2125 {
2126  return ( 0 );
2127 }
2128 MagickPPExport int Magick::operator >
2130  const Magick::PathQuadraticCurvetoArgs& /*right_*/ )
2131 {
2132  return ( 0 );
2133 }
2134 MagickPPExport int Magick::operator <
2136  const Magick::PathQuadraticCurvetoArgs& /*right_*/ )
2137 {
2138  return ( 0 );
2139 }
2140 MagickPPExport int Magick::operator >=
2142  const Magick::PathQuadraticCurvetoArgs& right_ )
2143 {
2144  return ( ( left_ > right_ ) || ( left_ == right_ ) );
2145 }
2146 MagickPPExport int Magick::operator <=
2148  const Magick::PathQuadraticCurvetoArgs& right_ )
2149 {
2150  return ( ( left_ < right_ ) || ( left_ == right_ ) );
2151 }
2152 // Default Constructor
2154  : _x1(0),
2155  _y1(0),
2156  _x(0),
2157  _y(0)
2158 {
2159 }
2160 // Normal Constructor
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
2173  : _x1(original_._x1),
2174  _y1(original_._y1),
2175  _x(original_._x),
2176  _y(original_._y)
2177 {
2178 }
2179 // Destructor
2181 {
2182 }
2183 
2186  : _args(1,args_)
2187 {
2188 }
2191  : _args(args_)
2192 {
2193 }
2196  : VPathBase (original_),
2197  _args(original_._args)
2198 {
2199 }
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 }
2214 {
2215  return new PathQuadraticCurvetoAbs(*this);
2216 }
2219  : _args(1,args_)
2220 {
2221 }
2224  : _args(args_)
2225 {
2226 }
2229  : VPathBase (original_),
2230  _args(original_._args)
2231 {
2232 }
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 }
2247 {
2248  return new PathQuadraticCurvetoRel(*this);
2249 }
2251 ( const Magick::Coordinate &coordinate_ )
2252  : _coordinates(1,coordinate_)
2253 {
2254 }
2256 ( const CoordinateList &coordinates_ )
2257  : _coordinates(coordinates_)
2258 {
2259 }
2262  : VPathBase (original_),
2263  _coordinates(original_._coordinates)
2264 {
2265 }
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 }
2279 {
2280  return new PathSmoothQuadraticCurvetoAbs(*this);
2281 }
2283 ( const Magick::Coordinate &coordinate_ )
2284  : _coordinates(1,coordinate_)
2285 {
2286 }
2288 ( const CoordinateList &coordinates_ )
2289  : _coordinates(coordinates_)
2290 {
2291 }
2293 ( const PathSmoothQuadraticCurvetoRel& original_ )
2294  : VPathBase (original_),
2295  _coordinates(original_._coordinates)
2296 {
2297 }
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 }
2311 {
2312  return new PathSmoothQuadraticCurvetoRel(*this);
2313 }
2314 
2315 //
2316 // Path Lineto
2317 //
2319  : _coordinates(1,coordinate_)
2320 {
2321 }
2323  : _coordinates(coordinates_)
2324 {
2325 }
2327  : VPathBase (original_),
2328  _coordinates(original_._coordinates)
2329 {
2330 }
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 }
2343 {
2344  return new PathLinetoAbs(*this);
2345 }
2347  : _coordinates(1,coordinate_)
2348 {
2349 }
2351  : _coordinates(coordinates_)
2352 {
2353 }
2355  : VPathBase (original_),
2356  _coordinates(original_._coordinates)
2357 {
2358 }
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 }
2371 {
2372  return new PathLinetoRel(*this);
2373 }
2374 
2375 //
2376 // Path Horizontal Lineto
2377 //
2378 
2380 {
2381 }
2382 void Magick::PathLinetoHorizontalAbs::operator()
2383  ( MagickCore::DrawingWand * context_ ) const
2384 {
2385  DrawPathLineToHorizontalAbsolute( context_, _x );
2386 }
2388 {
2389  return new PathLinetoHorizontalAbs(*this);
2390 }
2392 {
2393 }
2394 void Magick::PathLinetoHorizontalRel::operator()
2395  ( MagickCore::DrawingWand * context_ ) const
2396 {
2397  DrawPathLineToHorizontalRelative( context_, _x );
2398 }
2400 {
2401  return new PathLinetoHorizontalRel(*this);
2402 }
2403 
2404 //
2405 // Path Vertical Lineto
2406 //
2408 {
2409 }
2410 void Magick::PathLinetoVerticalAbs::operator()
2411  ( MagickCore::DrawingWand * context_ ) const
2412 {
2413  DrawPathLineToVerticalAbsolute( context_, _y );
2414 }
2416 {
2417  return new PathLinetoVerticalAbs(*this);
2418 }
2420 {
2421 }
2422 void Magick::PathLinetoVerticalRel::operator()
2423  ( MagickCore::DrawingWand * context_ ) const
2424 {
2425  DrawPathLineToVerticalRelative( context_, _y );
2426 }
2428 {
2429  return new PathLinetoVerticalRel(*this);
2430 }
2431 
2432 //
2433 // Path Moveto
2434 //
2435 
2437  : _coordinates(1,coordinate_)
2438 {
2439 }
2441  : _coordinates(coordinates_)
2442 {
2443 }
2445  : VPathBase (original_),
2446  _coordinates(original_._coordinates)
2447 {
2448 }
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 }
2461 {
2462  return new PathMovetoAbs(*this);
2463 }
2465  : _coordinates(1,coordinate_)
2466 {
2467 }
2469  : _coordinates(coordinates_)
2470 {
2471 }
2473  : VPathBase (original_),
2474  _coordinates(original_._coordinates)
2475 {
2476 }
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 }
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
void operator()(MagickCore::DrawingWand *context_) const
Definition: Drawable.cpp:472
void operator()(MagickCore::DrawingWand *context_) const
Definition: Drawable.cpp:854
DrawableStrokePatternUrl(const std::string &url_)
Definition: Drawable.cpp:1326
DrawableClipRule(const FillRule fillRule_)
Definition: Drawable.cpp:325
PathSmoothCurvetoAbs(const Magick::Coordinate &coordinates_)
Definition: Drawable.cpp:2039
VPathBase * copy() const
Definition: Drawable.cpp:2387
MagickPPExport int operator!=(const Magick::Color &left_, const Magick::Color &right_)
Definition: Color.cpp:36
DrawableFont(const std::string &font_)
Definition: Drawable.cpp:777
DrawableBase * copy() const
Definition: Drawable.cpp:1126
DrawableBase * copy() const
Definition: Drawable.cpp:756
DrawableBase * copy() const
Definition: Drawable.cpp:1112
VPathBase * copy() const
Definition: Drawable.cpp:2034
const double * dasharray(void) const
Definition: Drawable.cpp:1251
void y(double y_)
Definition: Drawable.h:63
DrawableBase * copy() const
Definition: Drawable.cpp:636
std::string url(void) const
Definition: Drawable.cpp:1354
DrawablePolygon(const CoordinateList &coordinates_)
Definition: Drawable.cpp:919
std::vector< Magick::PathCurvetoArgs > PathCurveToArgsList
Definition: Drawable.h:2628
VPathBase * copy() const
Definition: Drawable.cpp:2003
DrawableBase * copy() const
Definition: Drawable.cpp:350
void operator()(MagickCore::DrawingWand *context_) const
Definition: Drawable.cpp:446
DrawableClipUnits(const ClipPathUnits units_)
Definition: Drawable.cpp:357
DrawableStrokeDashArray & operator=(const Magick::DrawableStrokeDashArray &original_)
Definition: Drawable.cpp:1187
DrawableBase * copy() const
Definition: Drawable.cpp:858
DrawableBase * copy() const
Definition: Drawable.cpp:1535
void operator()(MagickCore::DrawingWand *context_) const
Definition: Drawable.cpp:1609
DrawableBase * copy() const
Definition: Drawable.cpp:200
DrawableBase * copy() const
Definition: Drawable.cpp:227
VPathBase * copy() const
Definition: Drawable.cpp:1886
DrawableBorderColor(const Color &color_)
Definition: Drawable.cpp:276
virtual ~DrawableBase(void)
Definition: Drawable.cpp:65
DrawableBase * copy() const
Definition: Drawable.cpp:1593
void operator()(MagickCore::DrawingWand *context_) const
Definition: Drawable.cpp:2452
VPathBase * copy() const
Definition: Drawable.cpp:2488
DrawableBase * copy() const
Definition: Drawable.cpp:676
virtual DrawableBase * copy() const
Definition: Drawable.cpp:74
std::vector< Magick::PathQuadraticCurvetoArgs > PathQuadraticCurvetoArgsList
Definition: Drawable.h:2809
DrawableBase * copy() const
Definition: Drawable.cpp:704
void operator()(MagickCore::DrawingWand *context_) const
Definition: Drawable.cpp:459
DrawableClipPath(const std::string &id_)
Definition: Drawable.cpp:433
DrawableBase * copy() const
Definition: Drawable.cpp:1153
DrawableBase * copy() const
Definition: Drawable.cpp:1561
std::string magick(void)
Definition: Drawable.cpp:619
void operator()(MagickCore::DrawingWand *context_) const
Definition: Drawable.cpp:196
DrawableBase * copy() const
Definition: Drawable.cpp:1140
DrawableBase * copy() const
Definition: Drawable.cpp:1718
DrawableBase * copy() const
Definition: Drawable.cpp:913
DrawableBase * copy() const
Definition: Drawable.cpp:1267
STL namespace.
DrawableBase * copy() const
Definition: Drawable.cpp:992
VPathBase * copy() const
Definition: Drawable.cpp:1855
void operator()(MagickCore::DrawingWand *context_) const
Definition: Drawable.cpp:1149
void operator()(MagickCore::DrawingWand *) const
Definition: Drawable.cpp:118
PathLinetoRel(const Magick::Coordinate &coordinate_)
Definition: Drawable.cpp:2346
VPathBase * copy() const
Definition: Drawable.cpp:2246
virtual ~VPath(void)
Definition: Drawable.cpp:142
VPathBase * copy() const
Definition: Drawable.cpp:2071
MagickPPExport int operator<(const Magick::Color &left_, const Magick::Color &right_)
Definition: Color.cpp:48
DrawableTextInterwordSpacing(double spacing_)
Definition: Drawable.cpp:1631
void operator()(MagickCore::DrawingWand *context_) const
Definition: Drawable.cpp:1876
DrawableBase * copy() const
Definition: Drawable.cpp:382
DrawableBase * copy() const
Definition: Drawable.cpp:1305
PathQuadraticCurvetoRel(const Magick::PathQuadraticCurvetoArgs &args_)
Definition: Drawable.cpp:2218
DrawableBase * copy() const
Definition: Drawable.cpp:1212
DrawableStrokeDashArray(const double *dasharray_)
Definition: Drawable.cpp:1159
DrawableBase * copy() const
Definition: Drawable.cpp:1097
void operator()(MagickCore::DrawingWand *context_) const
Definition: Drawable.cpp:1673
VPathBase * copy() const
Definition: Drawable.cpp:2342
DrawableFillColor(const Color &color_)
Definition: Drawable.cpp:682
void operator()(MagickCore::DrawingWand *context_) const
Definition: Drawable.cpp:655
DrawableTextDecoration(DecorationType decoration_)
Definition: Drawable.cpp:1543
DrawableBase * copy() const
Definition: Drawable.cpp:463
VPathBase * copy() const
Definition: Drawable.cpp:2213
DrawableBase * copy() const
Definition: Drawable.cpp:1418
void operator()(MagickCore::DrawingWand *context_) const
Definition: Drawable.cpp:1845
DrawableBase * copy() const
Definition: Drawable.cpp:831
ClipPathUnits units(void) const
Definition: Drawable.cpp:377
MagickPPExport int operator<=(const Magick::Color &left_, const Magick::Color &right_)
Definition: Color.cpp:70
PathSmoothQuadraticCurvetoRel(const Magick::Coordinate &coordinate_)
Definition: Drawable.cpp:2283
DrawableCompositeImage(double x_, double y_, const std::string &filename_)
Definition: Drawable.cpp:533
MagickPPExport int operator>=(const Magick::Color &left_, const Magick::Color &right_)
Definition: Color.cpp:64
DrawableBase * copy() const
Definition: Drawable.cpp:1068
DrawableBase * copy() const
Definition: Drawable.cpp:401
virtual VPathBase * copy() const =0
DrawableTextKerning(double kerning_)
Definition: Drawable.cpp:1663
DrawableBase * copy() const
Definition: Drawable.cpp:1403
DrawableTextUnderColor(const Color &color_)
Definition: Drawable.cpp:1696
DrawablePushClipPath(const std::string &id_)
Definition: Drawable.cpp:407
double kerning(void) const
Definition: Drawable.cpp:1684
#define MagickPPExport
Definition: Include.h:268
DrawableBase * copy() const
Definition: Drawable.cpp:771
PathSmoothCurvetoRel(const Coordinate &coordinates_)
Definition: Drawable.cpp:2076
void operator()(MagickCore::DrawingWand *context_) const
Definition: Drawable.cpp:1343
PathCurvetoAbs(const PathCurvetoArgs &args_)
Definition: Drawable.cpp:1976
void operator()(MagickCore::DrawingWand *context_) const
Definition: Drawable.cpp:334
void operator()(MagickCore::DrawingWand *context_) const
Definition: Drawable.cpp:1205
DrawableBezier(const CoordinateList &coordinates_)
Definition: Drawable.cpp:236
PathQuadraticCurvetoAbs(const Magick::PathQuadraticCurvetoArgs &args_)
Definition: Drawable.cpp:2185
void operator()(MagickCore::DrawingWand *context_) const
Definition: Drawable.cpp:2362
DrawableTextDirection(DirectionType direction_)
Definition: Drawable.cpp:1567
std::vector< Magick::VPath > VPathList
Definition: Drawable.h:207
DrawableBase * copy() const
Definition: Drawable.cpp:845
PathSmoothQuadraticCurvetoAbs(const Magick::Coordinate &coordinate_)
Definition: Drawable.cpp:2251
DrawableBase * copy() const
Definition: Drawable.cpp:214
DrawableBase * copy() const
Definition: Drawable.cpp:742
void operator()(MagickCore::DrawingWand *context_) const
Definition: Drawable.cpp:250
void operator()(MagickCore::DrawingWand *context_) const
Definition: Drawable.cpp:1897
Color color(void) const
Definition: Drawable.cpp:313
DrawableBase * copy() const
Definition: Drawable.cpp:1006
VPathBase * copy() const
Definition: Drawable.cpp:1901
void operator()(MagickCore::DrawingWand *context_) const
Definition: Drawable.cpp:1641
DrawablePath(const VPathList &path_)
Definition: Drawable.cpp:864
virtual void operator()(MagickCore::DrawingWand *) const
Definition: Drawable.cpp:69
VPath & operator=(const VPath &original_)
Definition: Drawable.cpp:155
DrawableBase * copy() const
Definition: Drawable.cpp:1472
PathCurvetoRel(const PathCurvetoArgs &args_)
Definition: Drawable.cpp:2007
DrawableBase * copy() const
Definition: Drawable.cpp:1746
VPathBase * copy() const
Definition: Drawable.cpp:2415
Magick::Image image(void) const
Definition: Drawable.cpp:609
void operator()(MagickCore::DrawingWand *context_) const
Definition: Drawable.cpp:167
AlignType alignment(void) const
Definition: Drawable.cpp:1506
DrawableBase * copy() const
Definition: Drawable.cpp:450
DrawableBase * copy() const
Definition: Drawable.cpp:318
DirectionType direction(void) const
Definition: Drawable.cpp:1588
DrawablePushPattern(const std::string &id_, ::ssize_t x_, ::ssize_t y_, size_t width_, size_t height_)
DrawableBase * copy() const
Definition: Drawable.cpp:952
DrawableBase * copy() const
Definition: Drawable.cpp:899
DrawableBase * copy() const
Definition: Drawable.cpp:1020
std::vector< Magick::PathArcArgs > PathArcArgsList
Definition: Drawable.h:2454
void operator()(MagickCore::DrawingWand *context_) const
Definition: Drawable.cpp:2480
VPathBase * copy() const
Definition: Drawable.cpp:2108
void operator()(MagickCore::DrawingWand *context_) const
Definition: Drawable.cpp:1495
VPathBase * copy() const
Definition: Drawable.cpp:2427
void operator()(MagickCore::DrawingWand *context_) const
Definition: Drawable.cpp:209
void operator()(MagickCore::DrawingWand *context_) const
Definition: Drawable.cpp:2334
PathLinetoAbs(const Magick::Coordinate &coordinate_)
Definition: Drawable.cpp:2318
DrawableText(const double x_, const double y_, const std::string &text_)
Definition: Drawable.cpp:1438
void operator()(MagickCore::DrawingWand *context_) const
Definition: Drawable.cpp:808
Drawable & operator=(const Drawable &original_)
Definition: Drawable.cpp:102
DrawableTextAlignment(AlignType alignment_)
Definition: Drawable.cpp:1478
void operator()(MagickCore::DrawingWand *context_) const
Definition: Drawable.cpp:1577
PathMovetoAbs(const Magick::Coordinate &coordinate_)
Definition: Drawable.cpp:2436
DrawableFillPatternUrl(const std::string &url_)
Definition: Drawable.cpp:710
void operator()(MagickCore::DrawingWand *context_) const
Definition: Drawable.cpp:292
PathMovetoRel(const Magick::Coordinate &coordinate_)
Definition: Drawable.cpp:2464
PathArcRel(const PathArcArgs &coordinates_)
Definition: Drawable.cpp:1860
VPathBase * copy() const
Definition: Drawable.cpp:2399
void x(double x_)
Definition: Drawable.h:60
DrawableBase * copy() const
Definition: Drawable.cpp:476
MagickPPExport int operator>(const Magick::Color &left_, const Magick::Color &right_)
Definition: Color.cpp:42
DrawableStrokeColor(const Color &color_)
Definition: Drawable.cpp:1381
VPathBase * copy() const
Definition: Drawable.cpp:2370
void operator()(MagickCore::DrawingWand *context_) const
Definition: Drawable.cpp:223
void operator()(MagickCore::DrawingWand *context_) const
Definition: Drawable.cpp:726
MagickPPExport int operator==(const Magick::Color &left_, const Magick::Color &right_)
Definition: Color.cpp:20
VPathBase * copy() const
Definition: Drawable.cpp:2460
DrawableBase * copy() const
Definition: Drawable.cpp:1511
class MagickPPExport Image
Definition: Drawable.h:720
DrawableBase * copy() const
Definition: Drawable.cpp:1359
virtual ~VPathBase(void)
Definition: Drawable.cpp:125
Definition: Blob.h:15
DrawableBase * copy() const
Definition: Drawable.cpp:1374
void operator()(MagickCore::DrawingWand *context_) const
Definition: Drawable.cpp:895
DrawableBase * copy() const
Definition: Drawable.cpp:1732
std::string url(void) const
Definition: Drawable.cpp:737
DrawableBase * copy() const
Definition: Drawable.cpp:1034
std::vector< Magick::Coordinate > CoordinateList
Definition: Drawable.h:71
DrawableBase * copy() const
Definition: Drawable.cpp:1319
DrawablePolyline(const CoordinateList &coordinates_)
Definition: Drawable.cpp:959
DrawableBase * copy() const
Definition: Drawable.cpp:661
DrawableBase * copy() const
Definition: Drawable.cpp:886
DrawableBase * copy() const
Definition: Drawable.cpp:426
DrawableTextInterlineSpacing(double spacing_)
Definition: Drawable.cpp:1599
DrawableBase * copy() const
Definition: Drawable.cpp:1432
void operator()(MagickCore::DrawingWand *context_) const
Definition: Drawable.cpp:396
PathArcAbs(const PathArcArgs &coordinates_)
Definition: Drawable.cpp:1829
DrawableBase * copy() const
Definition: Drawable.cpp:269
void operator()(MagickCore::DrawingWand *context_) const
Definition: Drawable.cpp:366
DrawableDensity(const Point &density_)
Definition: Drawable.cpp:641
void operator()(MagickCore::DrawingWand *context_) const
Definition: Drawable.cpp:876
FillRule fillRule(void) const
Definition: Drawable.cpp:345
DrawableBase * copy() const
Definition: Drawable.cpp:1083
DrawableBase * copy() const
Definition: Drawable.cpp:1689
DrawableBase * copy() const
Definition: Drawable.cpp:1291
Color color(void) const
Definition: Drawable.h:953
std::string filename(void) const
Definition: Drawable.cpp:598