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