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 
operator ==(const Magick::Coordinate & left_,const Magick::Coordinate & right_)22 MagickPPExport int Magick::operator == ( const Magick::Coordinate& left_,
23                                         const Magick::Coordinate& right_ )
24 {
25   return ( ( left_.x() == right_.x() ) && ( left_.y() == right_.y() ) );
26 }
operator !=(const Magick::Coordinate & left_,const Magick::Coordinate & right_)27 MagickPPExport int Magick::operator != ( const Magick::Coordinate& left_,
28                                         const Magick::Coordinate& right_ )
29 {
30   return ( ! (left_ == right_) );
31 }
operator >(const Magick::Coordinate & left_,const Magick::Coordinate & right_)32 MagickPPExport int Magick::operator >  ( const Magick::Coordinate& left_,
33                                         const Magick::Coordinate& right_ )
34 {
35   return ( !( left_ < right_ ) && ( left_ != right_ ) );
36 }
operator <(const Magick::Coordinate & left_,const Magick::Coordinate & right_)37 MagickPPExport int Magick::operator <  ( const Magick::Coordinate& left_,
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 }
operator >=(const Magick::Coordinate & left_,const Magick::Coordinate & right_)44 MagickPPExport int Magick::operator >= ( const Magick::Coordinate& left_,
45                                         const Magick::Coordinate& right_ )
46 {
47   return ( ( left_ > right_ ) || ( left_ == right_ ) );
48 }
operator <=(const Magick::Coordinate & left_,const Magick::Coordinate & right_)49 MagickPPExport int Magick::operator <= ( const Magick::Coordinate& left_,
50                                         const Magick::Coordinate& right_ )
51 {
52   return ( ( left_ < right_ ) || ( left_ == right_ ) );
53 }
54 
55 /*virtual*/
~DrawableBase(void)56 Magick::DrawableBase::~DrawableBase ( void )
57 {
58 }
59 
60 // Constructor
Drawable(void)61 Magick::Drawable::Drawable ( void )
62   : dp(0)
63 {
64 }
65 
66 // Construct from DrawableBase
Drawable(const Magick::DrawableBase & original_)67 Magick::Drawable::Drawable ( const Magick::DrawableBase& original_ )
68   : dp(original_.copy())
69 {
70 }
71 
72 // Destructor
~Drawable(void)73 Magick::Drawable::~Drawable ( void )
74 {
75   delete dp;
76   dp = 0;
77 }
78 
79 // Copy constructor
Drawable(const Magick::Drawable & original_)80 Magick::Drawable::Drawable ( const Magick::Drawable& original_ )
81   : dp(original_.dp? original_.dp->copy(): 0)
82 {
83 }
84 
85 // Assignment operator
operator =(const Magick::Drawable & original_)86 Magick::Drawable& Magick::Drawable::operator= (const Magick::Drawable& original_ )
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
operator ()(MagickCore::DrawingWand * context_) const98 void Magick::Drawable::operator()( MagickCore::DrawingWand * context_ ) const
99 {
100   if(dp)
101     dp->operator()( context_ );
102 }
103 
operator ==(const Magick::Drawable &,const Magick::Drawable &)104 MagickPPExport int Magick::operator == ( const Magick::Drawable& /*left_*/,
105                                         const Magick::Drawable& /*right_*/ )
106 {
107   return ( 1 );
108 }
operator !=(const Magick::Drawable &,const Magick::Drawable &)109 MagickPPExport int Magick::operator != ( const Magick::Drawable& /*left_*/,
110                                         const Magick::Drawable& /*right_*/ )
111 {
112   return ( 0 );
113 }
operator >(const Magick::Drawable &,const Magick::Drawable &)114 MagickPPExport int Magick::operator > ( const Magick::Drawable& /*left_*/,
115                                        const Magick::Drawable& /*right_*/ )
116 {
117   return ( 0 );
118 }
operator <(const Magick::Drawable &,const Magick::Drawable &)119 MagickPPExport int Magick::operator <  ( const Magick::Drawable& /*left_*/,
120                                         const Magick::Drawable& /*right_*/ )
121 {
122   return  ( 0 );
123 }
operator >=(const Magick::Drawable & left_,const Magick::Drawable & right_)124 MagickPPExport int Magick::operator >= ( const Magick::Drawable& left_,
125                                         const Magick::Drawable& right_ )
126 {
127   return ( ( left_ > right_ ) || ( left_ == right_ ) );
128 }
operator <=(const Magick::Drawable & left_,const Magick::Drawable & right_)129 MagickPPExport int Magick::operator <= ( const Magick::Drawable& left_,
130                                         const Magick::Drawable& right_ )
131 {
132   return ( ( left_ < right_ ) || ( left_ == right_ ) );
133 }
134 
135 /*virtual*/
~VPathBase(void)136 Magick::VPathBase::~VPathBase ( void )
137 {
138 }
139 
140 // Constructor
VPath(void)141 Magick::VPath::VPath ( void )
142   : dp(0)
143 {
144 }
145 
146 // Construct from VPathBase
VPath(const Magick::VPathBase & original_)147 Magick::VPath::VPath ( const Magick::VPathBase& original_ )
148   : dp(original_.copy())
149 {
150 }
151 
152 // Destructor
~VPath(void)153 /* virtual */ Magick::VPath::~VPath ( void )
154 {
155   delete dp;
156   dp = 0;
157 }
158 
159 // Copy constructor
VPath(const Magick::VPath & original_)160 Magick::VPath::VPath ( const Magick::VPath& original_ )
161   : dp(original_.dp? original_.dp->copy(): 0)
162 {
163 }
164 
165 // Assignment operator
operator =(const Magick::VPath & original_)166 Magick::VPath& Magick::VPath::operator= (const Magick::VPath& original_ )
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
operator ()(MagickCore::DrawingWand * context_) const178 void Magick::VPath::operator()( MagickCore::DrawingWand * context_ ) const
179 {
180   if(dp)
181     dp->operator()( context_ );
182 }
183 
operator ==(const Magick::VPath &,const Magick::VPath &)184 MagickPPExport int Magick::operator == ( const Magick::VPath& /*left_*/,
185                                         const Magick::VPath& /*right_*/ )
186 {
187   return ( 1 );
188 }
operator !=(const Magick::VPath &,const Magick::VPath &)189 MagickPPExport int Magick::operator != ( const Magick::VPath& /*left_*/,
190                                         const Magick::VPath& /*right_*/ )
191 {
192   return ( 0 );
193 }
operator >(const Magick::VPath &,const Magick::VPath &)194 MagickPPExport int Magick::operator > ( const Magick::VPath& /*left_*/,
195                                        const Magick::VPath& /*right_*/ )
196 {
197   return ( 0 );
198 }
operator <(const Magick::VPath &,const Magick::VPath &)199 MagickPPExport int Magick::operator <  ( const Magick::VPath& /*left_*/,
200                                         const Magick::VPath& /*right_*/ )
201 {
202   return  ( 0 );
203 }
operator >=(const Magick::VPath & left_,const Magick::VPath & right_)204 MagickPPExport int Magick::operator >= ( const Magick::VPath& left_,
205                                         const Magick::VPath& right_ )
206 {
207   return ( ( left_ > right_ ) || ( left_ == right_ ) );
208 }
operator <=(const Magick::VPath & left_,const Magick::VPath & right_)209 MagickPPExport int Magick::operator <= ( const Magick::VPath& left_,
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)
DrawableAffine(double sx_,double sy_,double rx_,double ry_,double tx_,double ty_)220 Magick::DrawableAffine::DrawableAffine( double sx_, double sy_,
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 }
DrawableAffine(void)231 Magick::DrawableAffine::DrawableAffine( void )
232 {
233   GetAffineMatrix(&_affine);
234 }
~DrawableAffine(void)235 Magick::DrawableAffine::~DrawableAffine( void )
236 {
237 }
operator ()(MagickCore::DrawingWand * context_) const238 void Magick::DrawableAffine::operator()( MagickCore::DrawingWand * context_ ) const
239 {
240   DrawAffine( context_, &_affine );
241 }
copy() const242 Magick::DrawableBase* Magick::DrawableAffine::copy() const
243 {
244   return new DrawableAffine(*this);
245 }
246 
247 // Arc
~DrawableArc(void)248 Magick::DrawableArc::~DrawableArc( void )
249 {
250 }
operator ()(MagickCore::DrawingWand * context_) const251 void Magick::DrawableArc::operator()( MagickCore::DrawingWand * context_ ) const
252 {
253   DrawArc( context_, _startX, _startY, _endX, _endY, _startDegrees, _endDegrees );
254 }
copy() const255 Magick::DrawableBase* Magick::DrawableArc::copy() const
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)
DrawableBezier(const CoordinateList & coordinates_)264 Magick::DrawableBezier::DrawableBezier ( const CoordinateList &coordinates_ )
265   : _coordinates(coordinates_)
266 {
267 }
268 // Copy constructor
DrawableBezier(const Magick::DrawableBezier & original_)269 Magick::DrawableBezier::DrawableBezier( const Magick::DrawableBezier& original_ )
270   : DrawableBase (original_),
271     _coordinates(original_._coordinates)
272 {
273 }
274 // Destructor
~DrawableBezier(void)275 Magick::DrawableBezier::~DrawableBezier( void )
276 {
277 }
operator ()(MagickCore::DrawingWand * context_) const278 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 }
copy() const297 Magick::DrawableBase* Magick::DrawableBezier::copy() const
298 {
299   return new DrawableBezier(*this);
300 }
301 
302 //
303 //Clip Path
304 //
305 
306 // Pop (terminate) Clip path definition
~DrawablePopClipPath(void)307 Magick::DrawablePopClipPath::~DrawablePopClipPath ( void )
308 {
309 }
operator ()(MagickCore::DrawingWand * context_) const310 void Magick::DrawablePopClipPath::operator() ( MagickCore::DrawingWand * context_ ) const
311 {
312   DrawPopClipPath( context_ );
313   DrawPopDefs(context_);
314 }
copy() const315 Magick::DrawableBase* Magick::DrawablePopClipPath::copy() const
316 {
317   return new DrawablePopClipPath(*this);
318 }
319 
320 // Push clip path definition
DrawablePushClipPath(const std::string & id_)321 Magick::DrawablePushClipPath::DrawablePushClipPath( const std::string &id_)
322   : _id(id_.c_str())    //multithread safe const char*
323 {
324 }
DrawablePushClipPath(const Magick::DrawablePushClipPath & original_)325 Magick::DrawablePushClipPath::DrawablePushClipPath
326 ( const Magick::DrawablePushClipPath& original_ ) //multithread safe const char*
327   : DrawableBase (original_),
328     _id(original_._id.c_str())
329 {
330 }
~DrawablePushClipPath(void)331 Magick::DrawablePushClipPath::~DrawablePushClipPath( void )
332 {
333 }
operator ()(MagickCore::DrawingWand * context_) const334 void Magick::DrawablePushClipPath::operator()
335   ( MagickCore::DrawingWand * context_ ) const
336 {
337   DrawPushDefs(context_);
338   DrawPushClipPath( context_, _id.c_str());
339 }
copy() const340 Magick::DrawableBase* Magick::DrawablePushClipPath::copy() const
341 {
342   return new DrawablePushClipPath(*this);
343 }
344 //
345 // ClipPath
346 //
DrawableClipPath(const std::string & id_)347 Magick::DrawableClipPath::DrawableClipPath( const std::string &id_ )
348 :_id(id_.c_str())
349 {
350 }
351 
DrawableClipPath(const Magick::DrawableClipPath & original_)352 Magick::DrawableClipPath::DrawableClipPath ( const Magick::DrawableClipPath& original_ )
353   : DrawableBase (original_),
354     _id(original_._id.c_str())
355 {
356 }
~DrawableClipPath(void)357 Magick::DrawableClipPath::~DrawableClipPath( void )
358 {
359 }
operator ()(MagickCore::DrawingWand * context_) const360 void Magick::DrawableClipPath::operator()( MagickCore::DrawingWand * context_ ) const
361 {
362 	(void) DrawSetClipPath( context_, _id.c_str());
363 }
copy() const364 Magick::DrawableBase* Magick::DrawableClipPath::copy() const
365 {
366   return new DrawableClipPath(*this);
367 }
368 
369 // Circle
~DrawableCircle(void)370 Magick::DrawableCircle::~DrawableCircle ( void )
371 {
372 }
operator ()(MagickCore::DrawingWand * context_) const373 void Magick::DrawableCircle::operator()( MagickCore::DrawingWand * context_ ) const
374 {
375   DrawCircle( context_, _originX, _originY, _perimX, _perimY );
376 }
copy() const377 Magick::DrawableBase* Magick::DrawableCircle::copy() const
378 {
379   return new DrawableCircle(*this);
380 }
381 
382 // Colorize at point using PaintMethod
~DrawableColor(void)383 Magick::DrawableColor::~DrawableColor( void )
384 {
385 }
operator ()(MagickCore::DrawingWand * context_) const386 void Magick::DrawableColor::operator()( MagickCore::DrawingWand * context_ ) const
387 {
388   DrawColor( context_, _x, _y, _paintMethod );
389 }
copy() const390 Magick::DrawableBase* Magick::DrawableColor::copy() const
391 {
392   return new DrawableColor(*this);
393 }
394 
395 // Draw image at point
DrawableCompositeImage(double x_,double y_,double width_,double height_,const std::string & filename_,Magick::CompositeOperator composition_)396 Magick::DrawableCompositeImage::DrawableCompositeImage
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 }
DrawableCompositeImage(double x_,double y_,double width_,double height_,const Magick::Image & image_,Magick::CompositeOperator composition_)409 Magick::DrawableCompositeImage::DrawableCompositeImage
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 }
DrawableCompositeImage(double x_,double y_,double width_,double height_,const std::string & filename_)422 Magick::DrawableCompositeImage::DrawableCompositeImage
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 }
DrawableCompositeImage(double x_,double y_,double width_,double height_,const Magick::Image & image_)434 Magick::DrawableCompositeImage::DrawableCompositeImage
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 }
DrawableCompositeImage(double x_,double y_,const std::string & filename_)446 Magick::DrawableCompositeImage::DrawableCompositeImage
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 }
DrawableCompositeImage(double x_,double y_,const Magick::Image & image_)459 Magick::DrawableCompositeImage::DrawableCompositeImage
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
DrawableCompositeImage(const Magick::DrawableCompositeImage & original_)473 Magick::DrawableCompositeImage::DrawableCompositeImage
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 }
~DrawableCompositeImage(void)484 Magick::DrawableCompositeImage::~DrawableCompositeImage( void )
485 {
486   delete _image;
487 }
488 // Assignment operator
operator =(const Magick::DrawableCompositeImage & original_)489 Magick::DrawableCompositeImage& Magick::DrawableCompositeImage::operator=
490 (const Magick::DrawableCompositeImage& original_ )
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 }
filename(const std::string & filename_)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 }
filename(void) const512 std::string Magick::DrawableCompositeImage::filename( void ) const
513 {
514   return _image->fileName();
515 }
516 
image(const Magick::Image & image_)517 void Magick::DrawableCompositeImage::image( const Magick::Image &image_ )
518 {
519   Image* temp_image = new Image(image_);
520   delete _image;
521   _image = temp_image;
522 }
image(void) const523 Magick::Image Magick::DrawableCompositeImage::image( void ) const
524 {
525   return *_image;
526 }
527 
528 // Specify image format used to output Base64 inlined image data.
magick(std::string magick_)529 void Magick::DrawableCompositeImage::magick( std::string magick_ )
530 {
531   _image->magick( magick_ );
532 }
magick(void)533 std::string Magick::DrawableCompositeImage::magick( void )
534 {
535   return _image->magick();
536 }
537 
operator ()(MagickCore::DrawingWand * context_) const538 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 
copy() const550 Magick::DrawableBase* Magick::DrawableCompositeImage::copy() const
551 {
552   return new DrawableCompositeImage(*this);
553 }
554 
DrawableDensity(const std::string & density_)555 Magick::DrawableDensity::DrawableDensity(const std::string &density_)
556   : _density(density_)
557 {
558 }
559 
~DrawableDensity(void)560 Magick::DrawableDensity::~DrawableDensity(void)
561 {
562 }
563 
operator ()(MagickCore::DrawingWand * context_) const564 void Magick::DrawableDensity::operator()(
565   MagickCore::DrawingWand *context_) const
566 {
567   DrawSetDensity(context_,_density.c_str());
568 }
569 
copy() const570 Magick::DrawableBase* Magick::DrawableDensity::copy() const
571 {
572   return(new DrawableDensity(*this));
573 }
574 
575 // Ellipse
~DrawableEllipse(void)576 Magick::DrawableEllipse::~DrawableEllipse( void )
577 {
578 }
operator ()(MagickCore::DrawingWand * context_) const579 void Magick::DrawableEllipse::operator()
580   ( MagickCore::DrawingWand * context_ ) const
581 {
582   DrawEllipse( context_, _originX, _originY, _radiusX, _radiusY,
583                _arcStart, _arcEnd );
584 }
copy() const585 Magick::DrawableBase* Magick::DrawableEllipse::copy() const
586 {
587   return new DrawableEllipse(*this);
588 }
589 
590 // Specify drawing fill color
DrawableFillColor(const Magick::Color & color_)591 Magick::DrawableFillColor::DrawableFillColor( const Magick::Color &color_ )
592   : _color(color_)
593 {
594 }
DrawableFillColor(const Magick::DrawableFillColor & original_)595 Magick::DrawableFillColor::DrawableFillColor
596 ( const Magick::DrawableFillColor& original_ )
597   : DrawableBase (original_),
598     _color(original_._color)
599 {
600 }
~DrawableFillColor(void)601 Magick::DrawableFillColor::~DrawableFillColor( void )
602 {
603 }
operator ()(MagickCore::DrawingWand * context_) const604 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 }
copy() const613 Magick::DrawableBase* Magick::DrawableFillColor::copy() const
614 {
615   return new DrawableFillColor(*this);
616 }
617 
618 // Specify drawing fill fule
~DrawableFillRule(void)619 Magick::DrawableFillRule::~DrawableFillRule ( void )
620 {
621 }
operator ()(MagickCore::DrawingWand * context_) const622 void Magick::DrawableFillRule::operator()
623   ( MagickCore::DrawingWand * context_ ) const
624 {
625   DrawSetFillRule( context_, _fillRule );
626 }
copy() const627 Magick::DrawableBase* Magick::DrawableFillRule::copy() const
628 {
629   return new DrawableFillRule(*this);
630 }
631 
632 // Specify drawing fill opacity
~DrawableFillOpacity(void)633 Magick::DrawableFillOpacity::~DrawableFillOpacity ( void )
634 {
635 }
operator ()(MagickCore::DrawingWand * context_) const636 void Magick::DrawableFillOpacity::operator()
637   ( MagickCore::DrawingWand * context_ ) const
638 {
639   DrawSetFillOpacity( context_, _opacity );
640 }
copy() const641 Magick::DrawableBase* Magick::DrawableFillOpacity::copy() const
642 {
643   return new DrawableFillOpacity(*this);
644 }
645 
646 // Specify text font
DrawableFont(const std::string & 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 }
DrawableFont(const std::string & family_,Magick::StyleType style_,const unsigned int weight_,Magick::StretchType stretch_)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 }
DrawableFont(const Magick::DrawableFont & original_)666 Magick::DrawableFont::DrawableFont ( const Magick::DrawableFont& original_ )
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 }
~DrawableFont(void)675 Magick::DrawableFont::~DrawableFont ( void )
676 {
677 }
operator ()(MagickCore::DrawingWand * context_) const678 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 }
copy() const701 Magick::DrawableBase* Magick::DrawableFont::copy() const
702 {
703   return new DrawableFont(*this);
704 }
705 
706 // Specify text positioning gravity
~DrawableGravity(void)707 Magick::DrawableGravity::~DrawableGravity ( void )
708 {
709 }
operator ()(MagickCore::DrawingWand * context_) const710 void Magick::DrawableGravity::operator()
711   ( MagickCore::DrawingWand * context_ ) const
712 {
713   DrawSetGravity( context_, _gravity );
714 }
copy() const715 Magick::DrawableBase* Magick::DrawableGravity::copy() const
716 {
717   return new DrawableGravity(*this);
718 }
719 
720 // Line
~DrawableLine(void)721 Magick::DrawableLine::~DrawableLine ( void )
722 {
723 }
operator ()(MagickCore::DrawingWand * context_) const724 void Magick::DrawableLine::operator()( MagickCore::DrawingWand * context_ ) const
725 {
726   DrawLine( context_, _startX, _startY, _endX, _endY );
727 }
copy() const728 Magick::DrawableBase* Magick::DrawableLine::copy() const
729 {
730   return new DrawableLine(*this);
731 }
732 
733 // Change pixel matte value to transparent using PaintMethod
~DrawableMatte(void)734 Magick::DrawableMatte::~DrawableMatte ( void )
735 {
736 }
operator ()(MagickCore::DrawingWand * context_) const737 void Magick::DrawableMatte::operator()( MagickCore::DrawingWand * context_ ) const
738 {
739   DrawMatte( context_, _x, _y, _paintMethod );
740 }
copy() const741 Magick::DrawableBase* Magick::DrawableMatte::copy() const
742 {
743   return new DrawableMatte(*this);
744 }
745 
746 // Drawable Path
DrawablePath(const VPathList & path_)747 Magick::DrawablePath::DrawablePath ( const VPathList &path_ )
748   : _path(path_)
749 {
750 }
DrawablePath(const Magick::DrawablePath & original_)751 Magick::DrawablePath::DrawablePath ( const Magick::DrawablePath& original_ )
752   : DrawableBase (original_),
753     _path(original_._path)
754 {
755 }
~DrawablePath(void)756 Magick::DrawablePath::~DrawablePath ( void )
757 {
758 }
operator ()(MagickCore::DrawingWand * context_) const759 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 }
copy() const769 Magick::DrawableBase* Magick::DrawablePath::copy() const
770 {
771   return new DrawablePath(*this);
772 }
773 
774 // Point
~DrawablePoint(void)775 Magick::DrawablePoint::~DrawablePoint ( void )
776 {
777 }
operator ()(MagickCore::DrawingWand * context_) const778 void Magick::DrawablePoint::operator()( MagickCore::DrawingWand * context_ ) const
779 {
780   DrawPoint( context_, _x, _y );
781 }
copy() const782 Magick::DrawableBase* Magick::DrawablePoint::copy() const
783 {
784   return new DrawablePoint(*this);
785 }
786 
787 // Text pointsize
~DrawablePointSize(void)788 Magick::DrawablePointSize::~DrawablePointSize ( void )
789 {
790 }
operator ()(MagickCore::DrawingWand * context_) const791 void Magick::DrawablePointSize::operator()
792   ( MagickCore::DrawingWand * context_ ) const
793 {
794   DrawSetFontSize( context_, _pointSize );
795 }
copy() const796 Magick::DrawableBase* Magick::DrawablePointSize::copy() const
797 {
798   return new DrawablePointSize(*this);
799 }
800 
801 // Polygon (Coordinate list must contain at least three members)
DrawablePolygon(const CoordinateList & coordinates_)802 Magick::DrawablePolygon::DrawablePolygon ( const CoordinateList &coordinates_ )
803   : _coordinates(coordinates_)
804 {
805 }
DrawablePolygon(const Magick::DrawablePolygon & original_)806 Magick::DrawablePolygon::DrawablePolygon
807 ( const Magick::DrawablePolygon& original_ )
808   : DrawableBase (original_),
809     _coordinates(original_._coordinates)
810 {
811 }
~DrawablePolygon(void)812 Magick::DrawablePolygon::~DrawablePolygon ( void )
813 {
814 }
operator ()(MagickCore::DrawingWand * context_) const815 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 }
copy() const835 Magick::DrawableBase* Magick::DrawablePolygon::copy() const
836 {
837   return new DrawablePolygon(*this);
838 }
839 
840 // Polyline (Coordinate list must contain at least three members)
DrawablePolyline(const CoordinateList & coordinates_)841 Magick::DrawablePolyline::DrawablePolyline
842 ( const CoordinateList &coordinates_ )
843   : _coordinates(coordinates_)
844 {
845 }
DrawablePolyline(const Magick::DrawablePolyline & original_)846 Magick::DrawablePolyline::DrawablePolyline
847 ( const Magick::DrawablePolyline& original_ )
848   : DrawableBase (original_),
849     _coordinates(original_._coordinates)
850 {
851 }
~DrawablePolyline(void)852 Magick::DrawablePolyline::~DrawablePolyline ( void )
853 {
854 }
operator ()(MagickCore::DrawingWand * context_) const855 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 }
copy() const875 Magick::DrawableBase* Magick::DrawablePolyline::copy() const
876 {
877   return new DrawablePolyline(*this);
878 }
879 
880 // Pop Graphic Context
~DrawablePopGraphicContext(void)881 Magick::DrawablePopGraphicContext::~DrawablePopGraphicContext ( void )
882 {
883 }
operator ()(MagickCore::DrawingWand * context_) const884 void Magick::DrawablePopGraphicContext::operator()
885   ( MagickCore::DrawingWand * context_ ) const
886 {
887   PopDrawingWand( context_ );
888 }
copy() const889 Magick::DrawableBase* Magick::DrawablePopGraphicContext::copy() const
890 {
891   return new DrawablePopGraphicContext(*this);
892 }
893 
894 // Push Graphic Context
~DrawablePushGraphicContext(void)895 Magick::DrawablePushGraphicContext::~DrawablePushGraphicContext ( void )
896 {
897 }
operator ()(MagickCore::DrawingWand * context_) const898 void Magick::DrawablePushGraphicContext::operator()
899   ( MagickCore::DrawingWand * context_ ) const
900 {
901   PushDrawingWand( context_ );
902 }
copy() const903 Magick::DrawableBase* Magick::DrawablePushGraphicContext::copy() const
904 {
905   return new DrawablePushGraphicContext(*this);
906 }
907 
908 // Pop (terminate) Pattern definition
~DrawablePopPattern(void)909 Magick::DrawablePopPattern::~DrawablePopPattern ( void )
910 {
911 }
operator ()(MagickCore::DrawingWand * context_) const912 void Magick::DrawablePopPattern::operator()
913   ( MagickCore::DrawingWand * context_ ) const
914 {
915   (void) DrawPopPattern( context_ );
916 }
copy() const917 Magick::DrawableBase* Magick::DrawablePopPattern::copy() const
918 {
919   return new DrawablePopPattern(*this);
920 }
921 
922 // Push Pattern definition
DrawablePushPattern(const std::string & id_,ssize_t x_,ssize_t y_,size_t width_,size_t height_)923 Magick::DrawablePushPattern::DrawablePushPattern
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 }
DrawablePushPattern(const Magick::DrawablePushPattern & original_)933 Magick::DrawablePushPattern::DrawablePushPattern
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 }
~DrawablePushPattern(void)943 Magick::DrawablePushPattern::~DrawablePushPattern ( void )
944 {
945 }
operator ()(MagickCore::DrawingWand * context_) const946 void Magick::DrawablePushPattern::operator()
947   ( MagickCore::DrawingWand * context_ ) const
948 {
949   (void) DrawPushPattern( context_, _id.c_str(), _x, _y, _width, _height );
950 }
copy() const951 Magick::DrawableBase* Magick::DrawablePushPattern::copy() const
952 {
953   return new DrawablePushPattern(*this);
954 }
955 
956 // Rectangle
~DrawableRectangle(void)957 Magick::DrawableRectangle::~DrawableRectangle ( void )
958 {
959 }
operator ()(MagickCore::DrawingWand * context_) const960 void Magick::DrawableRectangle::operator()
961   ( MagickCore::DrawingWand * context_ ) const
962 {
963   DrawRectangle( context_, _upperLeftX, _upperLeftY,
964                  _lowerRightX, _lowerRightY );
965 }
copy() const966 Magick::DrawableBase* Magick::DrawableRectangle::copy() const
967 {
968   return new DrawableRectangle(*this);
969 }
970 
971 // Apply Rotation
~DrawableRotation(void)972 Magick::DrawableRotation::~DrawableRotation ( void )
973 {
974 }
operator ()(MagickCore::DrawingWand * context_) const975 void Magick::DrawableRotation::operator()
976   ( MagickCore::DrawingWand * context_ ) const
977 {
978   DrawRotate( context_, _angle );
979 }
copy() const980 Magick::DrawableBase* Magick::DrawableRotation::copy() const
981 {
982   return new DrawableRotation(*this);
983 }
984 
985 // Round Rectangle
~DrawableRoundRectangle(void)986 Magick::DrawableRoundRectangle::~DrawableRoundRectangle ( void )
987 {
988 }
operator ()(MagickCore::DrawingWand * context_) const989 void Magick::DrawableRoundRectangle::operator()
990   ( MagickCore::DrawingWand * context_ ) const
991 {
992   DrawRoundRectangle(context_,_upperLeftX,_upperLeftY,_lowerRightX,
993     _lowerRightY,_cornerWidth, _cornerHeight);
994 }
copy() const995 Magick::DrawableBase* Magick::DrawableRoundRectangle::copy() const
996 {
997   return new DrawableRoundRectangle(*this);
998 }
999 
1000 // Apply Scaling
~DrawableScaling(void)1001 Magick::DrawableScaling::~DrawableScaling ( void )
1002 {
1003 }
operator ()(MagickCore::DrawingWand * context_) const1004 void Magick::DrawableScaling::operator()
1005   ( MagickCore::DrawingWand * context_ ) const
1006 {
1007   DrawScale( context_, _x, _y );
1008 }
copy() const1009 Magick::DrawableBase* Magick::DrawableScaling::copy() const
1010 {
1011   return new DrawableScaling(*this);
1012 }
1013 
1014 // Apply Skew in the X direction
~DrawableSkewX(void)1015 Magick::DrawableSkewX::~DrawableSkewX ( void )
1016 {
1017 }
operator ()(MagickCore::DrawingWand * context_) const1018 void Magick::DrawableSkewX::operator()
1019   ( MagickCore::DrawingWand * context_ ) const
1020 {
1021   DrawSkewX( context_, _angle );
1022 }
copy() const1023 Magick::DrawableBase* Magick::DrawableSkewX::copy() const
1024 {
1025   return new DrawableSkewX(*this);
1026 }
1027 
1028 // Apply Skew in the Y direction
~DrawableSkewY(void)1029 Magick::DrawableSkewY::~DrawableSkewY ( void )
1030 {
1031 }
operator ()(MagickCore::DrawingWand * context_) const1032 void Magick::DrawableSkewY::operator()( MagickCore::DrawingWand * context_ ) const
1033 {
1034   DrawSkewY( context_, _angle );
1035 }
copy() const1036 Magick::DrawableBase* Magick::DrawableSkewY::copy() const
1037 {
1038   return new DrawableSkewY(*this);
1039 }
1040 
1041 // Stroke dasharray
DrawableDashArray(const double * dasharray_)1042 Magick::DrawableDashArray::DrawableDashArray( const double* 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*
DrawableDashArray(const size_t * dasharray_)1050 Magick::DrawableDashArray::DrawableDashArray( const size_t* dasharray_ )
1051   : _size(0),
1052     _dasharray(0)
1053 {
1054   dasharray( dasharray_ );
1055 }
DrawableDashArray(const Magick::DrawableDashArray & original_)1056 Magick::DrawableDashArray::DrawableDashArray
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 }
~DrawableDashArray(void)1069 Magick::DrawableDashArray::~DrawableDashArray( void )
1070 {
1071   delete [] _dasharray;
1072   _size = 0;
1073   _dasharray = 0;
1074 }
operator =(const Magick::DrawableDashArray & original_)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
operator ()(MagickCore::DrawingWand * context_) const1093 void Magick::DrawableDashArray::operator()
1094   ( MagickCore::DrawingWand *context_ ) const
1095 {
1096   (void) DrawSetStrokeDashArray( context_, (const unsigned long) _size, _dasharray );
1097 }
copy() const1098 Magick::DrawableBase* Magick::DrawableDashArray::copy() const
1099 {
1100   return new DrawableDashArray(*this);
1101 }
dasharray(const double * dasharray_)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.
dasharray(const size_t * dasharray_)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
~DrawableDashOffset(void)1161 Magick::DrawableDashOffset::~DrawableDashOffset ( void )
1162 {
1163 }
operator ()(MagickCore::DrawingWand * context_) const1164 void Magick::DrawableDashOffset::operator()
1165   ( MagickCore::DrawingWand * context_ ) const
1166 {
1167   DrawSetStrokeDashOffset( context_, _offset );
1168 }
copy() const1169 Magick::DrawableBase* Magick::DrawableDashOffset::copy() const
1170 {
1171   return new DrawableDashOffset(*this);
1172 }
1173 
1174 // Stroke linecap
~DrawableStrokeLineCap(void)1175 Magick::DrawableStrokeLineCap::~DrawableStrokeLineCap ( void )
1176 {
1177 }
operator ()(MagickCore::DrawingWand * context_) const1178 void Magick::DrawableStrokeLineCap::operator()
1179   ( MagickCore::DrawingWand * context_ ) const
1180 {
1181   DrawSetStrokeLineCap( context_, _linecap );
1182 }
copy() const1183 Magick::DrawableBase* Magick::DrawableStrokeLineCap::copy() const
1184 {
1185   return new DrawableStrokeLineCap(*this);
1186 }
1187 
1188 // Stroke linejoin
~DrawableStrokeLineJoin(void)1189 Magick::DrawableStrokeLineJoin::~DrawableStrokeLineJoin ( void )
1190 {
1191 }
operator ()(MagickCore::DrawingWand * context_) const1192 void Magick::DrawableStrokeLineJoin::operator()
1193   ( MagickCore::DrawingWand * context_ ) const
1194 {
1195   DrawSetStrokeLineJoin( context_, _linejoin );
1196 }
copy() const1197 Magick::DrawableBase* Magick::DrawableStrokeLineJoin::copy() const
1198 {
1199   return new DrawableStrokeLineJoin(*this);
1200 }
1201 
1202 // Stroke miterlimit
~DrawableMiterLimit(void)1203 Magick::DrawableMiterLimit::~DrawableMiterLimit ( void )
1204 {
1205 }
operator ()(MagickCore::DrawingWand * context_) const1206 void Magick::DrawableMiterLimit::operator()
1207   ( MagickCore::DrawingWand * context_ ) const
1208 {
1209   DrawSetStrokeMiterLimit( context_, _miterlimit );
1210 }
copy() const1211 Magick::DrawableBase* Magick::DrawableMiterLimit::copy() const
1212 {
1213   return new DrawableMiterLimit(*this);
1214 }
1215 
1216 // Stroke antialias
~DrawableStrokeAntialias(void)1217 Magick::DrawableStrokeAntialias::~DrawableStrokeAntialias ( void )
1218 {
1219 }
operator ()(MagickCore::DrawingWand * context_) const1220 void Magick::DrawableStrokeAntialias::operator()
1221 ( MagickCore::DrawingWand * context_ ) const
1222 {
1223   DrawSetStrokeAntialias( context_, static_cast<MagickBooleanType>
1224     (_flag ? MagickTrue : MagickFalse) );
1225 }
copy() const1226 Magick::DrawableBase* Magick::DrawableStrokeAntialias::copy() const
1227 {
1228   return new DrawableStrokeAntialias(*this);
1229 }
1230 
1231 // Stroke color
DrawableStrokeColor(const Magick::Color & color_)1232 Magick::DrawableStrokeColor::DrawableStrokeColor
1233 ( const Magick::Color &color_ )
1234   : _color(color_)
1235 {
1236 }
DrawableStrokeColor(const Magick::DrawableStrokeColor & original_)1237 Magick::DrawableStrokeColor::DrawableStrokeColor
1238 ( const Magick::DrawableStrokeColor& original_ )
1239   : DrawableBase (original_),
1240     _color(original_._color)
1241 {
1242 }
~DrawableStrokeColor(void)1243 Magick::DrawableStrokeColor::~DrawableStrokeColor ( void )
1244 {
1245 }
operator ()(MagickCore::DrawingWand * context_) const1246 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 }
copy() const1255 Magick::DrawableBase* Magick::DrawableStrokeColor::copy() const
1256 {
1257   return new DrawableStrokeColor(*this);
1258 }
1259 
1260 // Stroke opacity
~DrawableStrokeOpacity(void)1261 Magick::DrawableStrokeOpacity::~DrawableStrokeOpacity ( void )
1262 {
1263 }
operator ()(MagickCore::DrawingWand * context_) const1264 void Magick::DrawableStrokeOpacity::operator()
1265   ( MagickCore::DrawingWand * context_ ) const
1266 {
1267   DrawSetStrokeOpacity( context_, _opacity );
1268 }
copy() const1269 Magick::DrawableBase* Magick::DrawableStrokeOpacity::copy() const
1270 {
1271   return new DrawableStrokeOpacity(*this);
1272 }
1273 
1274 // Stroke width
~DrawableStrokeWidth(void)1275 Magick::DrawableStrokeWidth::~DrawableStrokeWidth ( void )
1276 {
1277 }
operator ()(MagickCore::DrawingWand * context_) const1278 void Magick::DrawableStrokeWidth::operator()
1279   ( MagickCore::DrawingWand * context_ ) const
1280 {
1281   DrawSetStrokeWidth( context_, _width );
1282 }
copy() const1283 Magick::DrawableBase* Magick::DrawableStrokeWidth::copy() const
1284 {
1285   return new DrawableStrokeWidth(*this);
1286 }
1287 
1288 // Draw text at point
DrawableText(const double x_,const double y_,const std::string & text_)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 }
DrawableText(const double x_,const double y_,const std::string & text_,const std::string & encoding_)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 }
DrawableText(const Magick::DrawableText & original_)1305 Magick::DrawableText::DrawableText( const Magick::DrawableText& original_ )
1306   : DrawableBase (original_),
1307     _x(original_._x),
1308     _y(original_._y),
1309     _text(original_._text),
1310     _encoding(original_._encoding)
1311 {
1312 }
~DrawableText(void)1313 Magick::DrawableText::~DrawableText ( void )
1314 {
1315 }
operator ()(MagickCore::DrawingWand * context_) const1316 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 }
copy() const1323 Magick::DrawableBase* Magick::DrawableText::copy() const
1324 {
1325   return new DrawableText(*this);
1326 }
1327 
1328 // Text antialias
DrawableTextAntialias(bool flag_)1329 Magick::DrawableTextAntialias::DrawableTextAntialias ( bool flag_ )
1330   : _flag(flag_)
1331 {
1332 }
DrawableTextAntialias(const Magick::DrawableTextAntialias & original_)1333 Magick::DrawableTextAntialias::DrawableTextAntialias( const Magick::DrawableTextAntialias &original_ )
1334   : DrawableBase (original_),
1335     _flag(original_._flag)
1336 {
1337 }
~DrawableTextAntialias(void)1338 Magick::DrawableTextAntialias::~DrawableTextAntialias ( void )
1339 {
1340 }
operator ()(MagickCore::DrawingWand * context_) const1341 void Magick::DrawableTextAntialias::operator()
1342   ( MagickCore::DrawingWand * context_ ) const
1343 {
1344   DrawSetTextAntialias( context_, static_cast<MagickBooleanType>
1345     (_flag ? MagickTrue : MagickFalse) );
1346 }
copy() const1347 Magick::DrawableBase* Magick::DrawableTextAntialias::copy() const
1348 {
1349   return new DrawableTextAntialias(*this);
1350 }
1351 
1352 // Decoration (text decoration)
DrawableTextDecoration(Magick::DecorationType decoration_)1353 Magick::DrawableTextDecoration::DrawableTextDecoration
1354   ( Magick::DecorationType decoration_ )
1355     : _decoration(decoration_)
1356 {
1357 }
DrawableTextDecoration(const Magick::DrawableTextDecoration & original_)1358 Magick::DrawableTextDecoration::DrawableTextDecoration
1359   ( const Magick::DrawableTextDecoration &original_ )
1360     : DrawableBase (original_),
1361       _decoration(original_._decoration)
1362 {
1363 }
~DrawableTextDecoration(void)1364 Magick::DrawableTextDecoration::~DrawableTextDecoration( void )
1365 {
1366 }
operator ()(MagickCore::DrawingWand * context_) const1367 void Magick::DrawableTextDecoration::operator()
1368   ( MagickCore::DrawingWand * context_ ) const
1369 {
1370   DrawSetTextDecoration( context_, _decoration );
1371 }
copy() const1372 Magick::DrawableBase* Magick::DrawableTextDecoration::copy() const
1373 {
1374   return new DrawableTextDecoration(*this);
1375 }
1376 
1377 // DrawableTextDirection
DrawableTextDirection(DirectionType direction_)1378 Magick::DrawableTextDirection::DrawableTextDirection(
1379   DirectionType direction_)
1380   : _direction(direction_)
1381 {
1382 }
1383 
~DrawableTextDirection(void)1384 Magick::DrawableTextDirection::~DrawableTextDirection(void)
1385 {
1386 }
1387 
operator ()(MagickCore::DrawingWand * context_) const1388 void Magick::DrawableTextDirection::operator()(
1389   MagickCore::DrawingWand *context_) const
1390 {
1391   DrawSetTextDirection(context_,_direction);
1392 }
1393 
direction(DirectionType direction_)1394 void Magick::DrawableTextDirection::direction(DirectionType direction_)
1395 {
1396   _direction=direction_;
1397 }
1398 
direction(void) const1399 Magick::DirectionType Magick::DrawableTextDirection::direction(void) const
1400 {
1401   return(_direction);
1402 }
1403 
copy() const1404 Magick::DrawableBase *Magick::DrawableTextDirection::copy() const
1405 {
1406   return new DrawableTextDirection(*this);
1407 }
1408 
1409 // DrawableTextInterlineSpacing
DrawableTextInterlineSpacing(double spacing_)1410 Magick::DrawableTextInterlineSpacing::DrawableTextInterlineSpacing(
1411   double spacing_)
1412   : _spacing(spacing_)
1413 {
1414 }
1415 
~DrawableTextInterlineSpacing(void)1416 Magick::DrawableTextInterlineSpacing::~DrawableTextInterlineSpacing(void)
1417 {
1418 }
1419 
operator ()(MagickCore::DrawingWand * context_) const1420 void Magick::DrawableTextInterlineSpacing::operator()(
1421   MagickCore::DrawingWand *context_) const
1422 {
1423   DrawSetTextInterlineSpacing(context_,_spacing);
1424 }
1425 
spacing(double spacing_)1426 void Magick::DrawableTextInterlineSpacing::spacing(double spacing_)
1427 {
1428   _spacing=spacing_;
1429 }
1430 
spacing(void) const1431 double Magick::DrawableTextInterlineSpacing::spacing(void) const
1432 {
1433   return(_spacing);
1434 }
1435 
copy() const1436 Magick::DrawableBase *Magick::DrawableTextInterlineSpacing::copy() const
1437 {
1438   return new DrawableTextInterlineSpacing(*this);
1439 }
1440 
1441 // DrawableTextInterwordSpacing
DrawableTextInterwordSpacing(double spacing_)1442 Magick::DrawableTextInterwordSpacing::DrawableTextInterwordSpacing(
1443   double spacing_)
1444   : _spacing(spacing_)
1445 {
1446 }
1447 
~DrawableTextInterwordSpacing(void)1448 Magick::DrawableTextInterwordSpacing::~DrawableTextInterwordSpacing(void)
1449 {
1450 }
1451 
operator ()(MagickCore::DrawingWand * context_) const1452 void Magick::DrawableTextInterwordSpacing::operator()(
1453   MagickCore::DrawingWand *context_) const
1454 {
1455   DrawSetTextInterwordSpacing(context_,_spacing);
1456 }
1457 
spacing(double spacing_)1458 void Magick::DrawableTextInterwordSpacing::spacing(double spacing_)
1459 {
1460   _spacing=spacing_;
1461 }
1462 
spacing(void) const1463 double Magick::DrawableTextInterwordSpacing::spacing(void) const
1464 {
1465   return(_spacing);
1466 }
1467 
copy() const1468 Magick::DrawableBase *Magick::DrawableTextInterwordSpacing::copy() const
1469 {
1470   return new DrawableTextInterwordSpacing(*this);
1471 }
1472 
1473 // DrawableTextKerning
DrawableTextKerning(double kerning_)1474 Magick::DrawableTextKerning::DrawableTextKerning(
1475   double kerning_)
1476   : _kerning(kerning_)
1477 {
1478 }
1479 
~DrawableTextKerning(void)1480 Magick::DrawableTextKerning::~DrawableTextKerning(void)
1481 {
1482 }
1483 
operator ()(MagickCore::DrawingWand * context_) const1484 void Magick::DrawableTextKerning::operator()(
1485   MagickCore::DrawingWand *context_) const
1486 {
1487   DrawSetTextKerning(context_,_kerning);
1488 }
1489 
kerning(double kerning_)1490 void Magick::DrawableTextKerning::kerning(double kerning_)
1491 {
1492   _kerning=kerning_;
1493 }
1494 
kerning(void) const1495 double Magick::DrawableTextKerning::kerning(void) const
1496 {
1497   return(_kerning);
1498 }
1499 
copy() const1500 Magick::DrawableBase *Magick::DrawableTextKerning::copy() const
1501 {
1502   return new DrawableTextKerning(*this);
1503 }
1504 
1505 // Set text undercolor
DrawableTextUnderColor(const Magick::Color & color_)1506 Magick::DrawableTextUnderColor::DrawableTextUnderColor
1507 ( const Magick::Color &color_ )
1508   : _color(color_)
1509 {
1510 }
DrawableTextUnderColor(const Magick::DrawableTextUnderColor & original_)1511 Magick::DrawableTextUnderColor::DrawableTextUnderColor
1512 ( const Magick::DrawableTextUnderColor& original_ )
1513   : DrawableBase (original_),
1514     _color(original_._color)
1515 {
1516 }
~DrawableTextUnderColor(void)1517 Magick::DrawableTextUnderColor::~DrawableTextUnderColor ( void )
1518 {
1519 }
operator ()(MagickCore::DrawingWand * context_) const1520 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 }
copy() const1529 Magick::DrawableBase* Magick::DrawableTextUnderColor::copy() const
1530 {
1531   return new DrawableTextUnderColor(*this);
1532 }
1533 
1534 // Apply Translation
~DrawableTranslation(void)1535 Magick::DrawableTranslation::~DrawableTranslation ( void )
1536 {
1537 }
operator ()(MagickCore::DrawingWand * context_) const1538 void Magick::DrawableTranslation::operator()
1539   ( MagickCore::DrawingWand * context_ ) const
1540 {
1541   DrawTranslate( context_, _x, _y );
1542 }
copy() const1543 Magick::DrawableBase* Magick::DrawableTranslation::copy() const
1544 {
1545   return new DrawableTranslation(*this);
1546 }
1547 
1548 // Set the size of the viewbox
~DrawableViewbox(void)1549 Magick::DrawableViewbox::~DrawableViewbox ( void )
1550 {
1551 }
operator ()(MagickCore::DrawingWand * context_) const1552 void Magick::DrawableViewbox::operator()
1553   ( MagickCore::DrawingWand * context_ ) const
1554 {
1555   DrawSetViewbox( context_, _x1, _y1, _x2, _y2 );
1556 }
copy() const1557 Magick::DrawableBase* Magick::DrawableViewbox::copy() const
1558 {
1559   return new DrawableViewbox(*this);
1560 }
1561 
1562 //
1563 // Path Classes
1564 //
1565 
1566 //
1567 // PathArcArgs
1568 //
operator ==(const Magick::PathArcArgs &,const Magick::PathArcArgs &)1569 MagickPPExport int Magick::operator == ( const Magick::PathArcArgs& /*left_*/,
1570                                         const Magick::PathArcArgs& /*right_*/ )
1571 {
1572   return ( 1 );
1573 }
operator !=(const Magick::PathArcArgs &,const Magick::PathArcArgs &)1574 MagickPPExport int Magick::operator != ( const Magick::PathArcArgs& /*left_*/,
1575                                         const Magick::PathArcArgs& /*right_*/ )
1576 {
1577   return ( 0 );
1578 }
operator >(const Magick::PathArcArgs &,const Magick::PathArcArgs &)1579 MagickPPExport int Magick::operator > ( const Magick::PathArcArgs& /*left_*/,
1580                                        const Magick::PathArcArgs& /*right_*/ )
1581 {
1582   return ( 0 );
1583 }
operator <(const Magick::PathArcArgs &,const Magick::PathArcArgs &)1584 MagickPPExport int Magick::operator <  ( const Magick::PathArcArgs& /*left_*/,
1585                                         const Magick::PathArcArgs& /*right_*/ )
1586 {
1587   return  ( false );
1588 }
operator >=(const Magick::PathArcArgs & left_,const Magick::PathArcArgs & right_)1589 MagickPPExport int Magick::operator >= ( const Magick::PathArcArgs& left_,
1590                                         const Magick::PathArcArgs& right_ )
1591 {
1592   return ( ( left_ > right_ ) || ( left_ == right_ ) );
1593 }
operator <=(const Magick::PathArcArgs & left_,const Magick::PathArcArgs & right_)1594 MagickPPExport int Magick::operator <= ( const Magick::PathArcArgs& left_,
1595                                         const Magick::PathArcArgs& right_ )
1596 {
1597   return ( ( left_ < right_ ) || ( left_ == right_ ) );
1598 }
1599 // Default constructor
PathArcArgs(void)1600 Magick::PathArcArgs::PathArcArgs( void )
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
PathArcArgs(double radiusX_,double radiusY_,double xAxisRotation_,bool largeArcFlag_,bool sweepFlag_,double x_,double y_)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
PathArcArgs(const Magick::PathArcArgs & original_)1624 Magick::PathArcArgs::PathArcArgs( const Magick::PathArcArgs &original_ )
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
~PathArcArgs(void)1635 Magick::PathArcArgs::~PathArcArgs ( void )
1636 {
1637 }
1638 
1639 // Path Arc
PathArcAbs(const Magick::PathArcArgs & coordinates_)1640 Magick::PathArcAbs::PathArcAbs ( const Magick::PathArcArgs &coordinates_ )
1641   : _coordinates(1,coordinates_)
1642 {
1643 }
PathArcAbs(const PathArcArgsList & coordinates_)1644 Magick::PathArcAbs::PathArcAbs ( const PathArcArgsList &coordinates_ )
1645   : _coordinates(coordinates_)
1646 {
1647 }
PathArcAbs(const Magick::PathArcAbs & original_)1648 Magick::PathArcAbs::PathArcAbs ( const Magick::PathArcAbs& original_ )
1649   : VPathBase (original_),
1650     _coordinates(original_._coordinates)
1651 {
1652 }
~PathArcAbs(void)1653 Magick::PathArcAbs::~PathArcAbs ( void )
1654 {
1655 }
operator ()(MagickCore::DrawingWand * context_) const1656 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 }
copy() const1666 Magick::VPathBase* Magick::PathArcAbs::copy() const
1667 {
1668   return new PathArcAbs(*this);
1669 }
1670 
PathArcRel(const Magick::PathArcArgs & coordinates_)1671 Magick::PathArcRel::PathArcRel ( const Magick::PathArcArgs &coordinates_ )
1672   : _coordinates(1,coordinates_)
1673 {
1674 }
PathArcRel(const PathArcArgsList & coordinates_)1675 Magick::PathArcRel::PathArcRel ( const PathArcArgsList &coordinates_ )
1676   : _coordinates(coordinates_)
1677 {
1678 }
PathArcRel(const Magick::PathArcRel & original_)1679 Magick::PathArcRel::PathArcRel ( const Magick::PathArcRel& original_ )
1680   : VPathBase (original_),
1681     _coordinates(original_._coordinates)
1682 {
1683 }
~PathArcRel(void)1684 Magick::PathArcRel::~PathArcRel ( void )
1685 {
1686 }
operator ()(MagickCore::DrawingWand * context_) const1687 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 }
copy() const1697 Magick::VPathBase* Magick::PathArcRel::copy() const
1698 {
1699   return new PathArcRel(*this);
1700 }
1701 
1702 //
1703 // Path Closepath
1704 //
~PathClosePath(void)1705 Magick::PathClosePath::~PathClosePath ( void )
1706 {
1707 }
operator ()(MagickCore::DrawingWand * context_) const1708 void Magick::PathClosePath::operator()( MagickCore::DrawingWand * context_ ) const
1709 {
1710   DrawPathClose( context_ );
1711 }
copy() const1712 Magick::VPathBase* Magick::PathClosePath::copy() const
1713 {
1714   return new PathClosePath(*this);
1715 }
1716 
1717 //
1718 // Path Curveto (Cubic Bezier)
1719 //
operator ==(const Magick::PathCurvetoArgs &,const Magick::PathCurvetoArgs &)1720 MagickPPExport int Magick::operator == ( const Magick::PathCurvetoArgs& /*left_*/,
1721                                         const Magick::PathCurvetoArgs& /*right_*/ )
1722 {
1723   return ( 1 );
1724 }
operator !=(const Magick::PathCurvetoArgs &,const Magick::PathCurvetoArgs &)1725 MagickPPExport int Magick::operator != ( const Magick::PathCurvetoArgs& /*left_*/,
1726                                         const Magick::PathCurvetoArgs& /*right_*/ )
1727 {
1728   return ( 0 );
1729 }
operator >(const Magick::PathCurvetoArgs &,const Magick::PathCurvetoArgs &)1730 MagickPPExport int Magick::operator > ( const Magick::PathCurvetoArgs& /*left_*/,
1731                                        const Magick::PathCurvetoArgs& /*right_*/ )
1732 {
1733   return ( 0 );
1734 }
operator <(const Magick::PathCurvetoArgs &,const Magick::PathCurvetoArgs &)1735 MagickPPExport int Magick::operator <  ( const Magick::PathCurvetoArgs& /*left_*/,
1736                                         const Magick::PathCurvetoArgs& /*right_*/ )
1737 {
1738   return  ( false );
1739 }
operator >=(const Magick::PathCurvetoArgs & left_,const Magick::PathCurvetoArgs & right_)1740 MagickPPExport int Magick::operator >= ( const Magick::PathCurvetoArgs& left_,
1741                                         const Magick::PathCurvetoArgs& right_ )
1742 {
1743   return ( ( left_ > right_ ) || ( left_ == right_ ) );
1744 }
operator <=(const Magick::PathCurvetoArgs & left_,const Magick::PathCurvetoArgs & right_)1745 MagickPPExport int Magick::operator <= ( const Magick::PathCurvetoArgs& left_,
1746                                         const Magick::PathCurvetoArgs& right_ )
1747 {
1748   return ( ( left_ < right_ ) || ( left_ == right_ ) );
1749 }
1750 // Default constructor
PathCurvetoArgs(void)1751 Magick::PathCurvetoArgs::PathCurvetoArgs( void )
1752   : _x1(0),
1753     _y1(0),
1754     _x2(0),
1755     _y2(0),
1756     _x(0),
1757     _y(0)
1758 {
1759 }
1760 // Normal constructor
PathCurvetoArgs(double x1_,double y1_,double x2_,double y2_,double x_,double y_)1761 Magick::PathCurvetoArgs::PathCurvetoArgs( double x1_, double y1_,
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
PathCurvetoArgs(const PathCurvetoArgs & original_)1773 Magick::PathCurvetoArgs::PathCurvetoArgs( const PathCurvetoArgs &original_ )
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
~PathCurvetoArgs(void)1783 Magick::PathCurvetoArgs::~PathCurvetoArgs ( void )
1784 {
1785 }
1786 
PathCurvetoAbs(const Magick::PathCurvetoArgs & args_)1787 Magick::PathCurvetoAbs::PathCurvetoAbs ( const Magick::PathCurvetoArgs &args_ )
1788   : _args(1,args_)
1789 {
1790 }
PathCurvetoAbs(const PathCurveToArgsList & args_)1791 Magick::PathCurvetoAbs::PathCurvetoAbs ( const PathCurveToArgsList &args_ )
1792   : _args(args_)
1793 {
1794 }
PathCurvetoAbs(const Magick::PathCurvetoAbs & original_)1795 Magick::PathCurvetoAbs::PathCurvetoAbs
1796  ( const Magick::PathCurvetoAbs& original_ )
1797    : VPathBase (original_),
1798      _args(original_._args)
1799 {
1800 }
~PathCurvetoAbs(void)1801 Magick::PathCurvetoAbs::~PathCurvetoAbs ( void )
1802 {
1803 }
operator ()(MagickCore::DrawingWand * context_) const1804 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 }
copy() const1814 Magick::VPathBase* Magick::PathCurvetoAbs::copy() const
1815 {
1816   return new PathCurvetoAbs(*this);
1817 }
PathCurvetoRel(const Magick::PathCurvetoArgs & args_)1818 Magick::PathCurvetoRel::PathCurvetoRel ( const Magick::PathCurvetoArgs &args_ )
1819   : _args(1,args_)
1820 {
1821 }
PathCurvetoRel(const PathCurveToArgsList & args_)1822 Magick::PathCurvetoRel::PathCurvetoRel ( const PathCurveToArgsList &args_ )
1823   : _args(args_)
1824 {
1825 }
PathCurvetoRel(const Magick::PathCurvetoRel & original_)1826 Magick::PathCurvetoRel::PathCurvetoRel
1827 ( const Magick::PathCurvetoRel& original_ )
1828   : VPathBase (original_),
1829     _args(original_._args)
1830 {
1831 }
~PathCurvetoRel(void)1832 Magick::PathCurvetoRel::~PathCurvetoRel ( void )
1833 {
1834 }
operator ()(MagickCore::DrawingWand * context_) const1835 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 }
copy() const1845 Magick::VPathBase* Magick::PathCurvetoRel::copy() const
1846 {
1847   return new PathCurvetoRel(*this);
1848 }
PathSmoothCurvetoAbs(const Magick::Coordinate & coordinates_)1849 Magick::PathSmoothCurvetoAbs::PathSmoothCurvetoAbs
1850 ( const Magick::Coordinate &coordinates_ )
1851   : _coordinates(1,coordinates_)
1852 {
1853 }
PathSmoothCurvetoAbs(const CoordinateList & coordinates_)1854 Magick::PathSmoothCurvetoAbs::PathSmoothCurvetoAbs
1855 ( const CoordinateList &coordinates_ )
1856   : _coordinates(coordinates_)
1857 {
1858 }
PathSmoothCurvetoAbs(const Magick::PathSmoothCurvetoAbs & original_)1859 Magick::PathSmoothCurvetoAbs::PathSmoothCurvetoAbs
1860 ( const Magick::PathSmoothCurvetoAbs& original_ )
1861   : VPathBase (original_),
1862     _coordinates(original_._coordinates)
1863 {
1864 }
~PathSmoothCurvetoAbs(void)1865 Magick::PathSmoothCurvetoAbs::~PathSmoothCurvetoAbs ( void )
1866 {
1867 }
operator ()(MagickCore::DrawingWand * context_) const1868 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         break;
1879       DrawPathCurveToSmoothAbsolute( context_, x2, y2, p->x(), p->y() );
1880     }
1881 }
copy() const1882 Magick::VPathBase* Magick::PathSmoothCurvetoAbs::copy() const
1883 {
1884   return new PathSmoothCurvetoAbs(*this);
1885 }
PathSmoothCurvetoRel(const Magick::Coordinate & coordinates_)1886 Magick::PathSmoothCurvetoRel::PathSmoothCurvetoRel
1887 ( const Magick::Coordinate &coordinates_ )
1888   : _coordinates(1,coordinates_)
1889 {
1890 }
PathSmoothCurvetoRel(const CoordinateList & coordinates_)1891 Magick::PathSmoothCurvetoRel::PathSmoothCurvetoRel
1892 ( const CoordinateList &coordinates_ )
1893   : _coordinates(coordinates_)
1894 {
1895 }
PathSmoothCurvetoRel(const Magick::PathSmoothCurvetoRel & original_)1896 Magick::PathSmoothCurvetoRel::PathSmoothCurvetoRel
1897 ( const Magick::PathSmoothCurvetoRel& original_ )
1898   : VPathBase (original_),
1899     _coordinates(original_._coordinates)
1900 {
1901 }
~PathSmoothCurvetoRel(void)1902 Magick::PathSmoothCurvetoRel::~PathSmoothCurvetoRel ( void )
1903 {
1904 }
operator ()(MagickCore::DrawingWand * context_) const1905 void Magick::PathSmoothCurvetoRel::operator()
1906   ( MagickCore::DrawingWand * context_ ) const
1907 {
1908   for( CoordinateList::const_iterator p = _coordinates.begin();
1909        p != _coordinates.end(); p++ )
1910     {
1911       double x2 = p->x();
1912       double y2 = p->y();
1913       p++;
1914       if (p == _coordinates.end() )
1915         break;
1916       DrawPathCurveToSmoothRelative( context_, x2, y2, p->x(), p->y() );
1917     }
1918 }
copy() const1919 Magick::VPathBase* Magick::PathSmoothCurvetoRel::copy() const
1920 {
1921   return new PathSmoothCurvetoRel(*this);
1922 }
1923 
1924 //
1925 // Quadratic Curveto (Quadratic Bezier)
1926 //
operator ==(const Magick::PathQuadraticCurvetoArgs &,const Magick::PathQuadraticCurvetoArgs &)1927 MagickPPExport int Magick::operator ==
1928 ( const Magick::PathQuadraticCurvetoArgs& /*left_*/,
1929   const Magick::PathQuadraticCurvetoArgs& /*right_*/ )
1930 {
1931   return ( 1 );
1932 }
operator !=(const Magick::PathQuadraticCurvetoArgs &,const Magick::PathQuadraticCurvetoArgs &)1933 MagickPPExport int Magick::operator !=
1934 ( const Magick::PathQuadraticCurvetoArgs& /*left_*/,
1935   const Magick::PathQuadraticCurvetoArgs& /*right_*/ )
1936 {
1937   return ( 0 );
1938 }
operator >(const Magick::PathQuadraticCurvetoArgs &,const Magick::PathQuadraticCurvetoArgs &)1939 MagickPPExport int Magick::operator >
1940 ( const Magick::PathQuadraticCurvetoArgs& /*left_*/,
1941   const Magick::PathQuadraticCurvetoArgs& /*right_*/ )
1942 {
1943   return ( 0 );
1944 }
operator <(const Magick::PathQuadraticCurvetoArgs &,const Magick::PathQuadraticCurvetoArgs &)1945 MagickPPExport int Magick::operator <
1946 ( const Magick::PathQuadraticCurvetoArgs& /*left_*/,
1947   const Magick::PathQuadraticCurvetoArgs& /*right_*/ )
1948 {
1949   return  ( 0 );
1950 }
operator >=(const Magick::PathQuadraticCurvetoArgs & left_,const Magick::PathQuadraticCurvetoArgs & right_)1951 MagickPPExport int Magick::operator >=
1952 ( const Magick::PathQuadraticCurvetoArgs& left_,
1953   const Magick::PathQuadraticCurvetoArgs& right_ )
1954 {
1955   return ( ( left_ > right_ ) || ( left_ == right_ ) );
1956 }
operator <=(const Magick::PathQuadraticCurvetoArgs & left_,const Magick::PathQuadraticCurvetoArgs & right_)1957 MagickPPExport int Magick::operator <=
1958 ( const Magick::PathQuadraticCurvetoArgs& left_,
1959   const Magick::PathQuadraticCurvetoArgs& right_ )
1960 {
1961   return ( ( left_ < right_ ) || ( left_ == right_ ) );
1962 }
1963 // Default Constructor
PathQuadraticCurvetoArgs(void)1964 Magick::PathQuadraticCurvetoArgs::PathQuadraticCurvetoArgs( void )
1965   : _x1(0),
1966     _y1(0),
1967     _x(0),
1968     _y(0)
1969 {
1970 }
1971 // Normal Constructor
PathQuadraticCurvetoArgs(double x1_,double y1_,double x_,double y_)1972 Magick::PathQuadraticCurvetoArgs::PathQuadraticCurvetoArgs( double x1_,
1973                                                             double y1_,
1974                                                             double x_,
1975                                                             double y_ )
1976   : _x1(x1_),
1977     _y1(y1_),
1978     _x(x_),
1979     _y(y_)
1980 {
1981 }
1982 // Copy Constructor
PathQuadraticCurvetoArgs(const PathQuadraticCurvetoArgs & original_)1983 Magick::PathQuadraticCurvetoArgs::PathQuadraticCurvetoArgs( const PathQuadraticCurvetoArgs &original_ )
1984   : _x1(original_._x1),
1985     _y1(original_._y1),
1986     _x(original_._x),
1987     _y(original_._y)
1988 {
1989 }
1990 // Destructor
~PathQuadraticCurvetoArgs(void)1991 Magick::PathQuadraticCurvetoArgs::~PathQuadraticCurvetoArgs ( void )
1992 {
1993 }
1994 
PathQuadraticCurvetoAbs(const Magick::PathQuadraticCurvetoArgs & args_)1995 Magick::PathQuadraticCurvetoAbs::PathQuadraticCurvetoAbs
1996 ( const Magick::PathQuadraticCurvetoArgs &args_ )
1997   : _args(1,args_)
1998 {
1999 }
PathQuadraticCurvetoAbs(const PathQuadraticCurvetoArgsList & args_)2000 Magick::PathQuadraticCurvetoAbs::PathQuadraticCurvetoAbs
2001 ( const PathQuadraticCurvetoArgsList &args_ )
2002   : _args(args_)
2003 {
2004 }
PathQuadraticCurvetoAbs(const Magick::PathQuadraticCurvetoAbs & original_)2005 Magick::PathQuadraticCurvetoAbs::PathQuadraticCurvetoAbs
2006 ( const Magick::PathQuadraticCurvetoAbs& original_ )
2007   : VPathBase (original_),
2008     _args(original_._args)
2009 {
2010 }
~PathQuadraticCurvetoAbs(void)2011 Magick::PathQuadraticCurvetoAbs::~PathQuadraticCurvetoAbs ( void )
2012 {
2013 }
operator ()(MagickCore::DrawingWand * context_) const2014 void Magick::PathQuadraticCurvetoAbs::operator()
2015   ( MagickCore::DrawingWand * context_ ) const
2016 {
2017   for( PathQuadraticCurvetoArgsList::const_iterator p = _args.begin();
2018        p != _args.end(); p++ )
2019     {
2020       DrawPathCurveToQuadraticBezierAbsolute( context_, p->x1(), p->y1(),
2021                                               p->x(), p->y() );
2022     }
2023 }
copy() const2024 Magick::VPathBase* Magick::PathQuadraticCurvetoAbs::copy() const
2025 {
2026   return new PathQuadraticCurvetoAbs(*this);
2027 }
PathQuadraticCurvetoRel(const Magick::PathQuadraticCurvetoArgs & args_)2028 Magick::PathQuadraticCurvetoRel::PathQuadraticCurvetoRel
2029 ( const Magick::PathQuadraticCurvetoArgs &args_ )
2030   : _args(1,args_)
2031 {
2032 }
PathQuadraticCurvetoRel(const PathQuadraticCurvetoArgsList & args_)2033 Magick::PathQuadraticCurvetoRel::PathQuadraticCurvetoRel
2034 ( const PathQuadraticCurvetoArgsList &args_ )
2035   : _args(args_)
2036 {
2037 }
PathQuadraticCurvetoRel(const Magick::PathQuadraticCurvetoRel & original_)2038 Magick::PathQuadraticCurvetoRel::PathQuadraticCurvetoRel
2039 ( const Magick::PathQuadraticCurvetoRel& original_ )
2040   : VPathBase (original_),
2041     _args(original_._args)
2042 {
2043 }
~PathQuadraticCurvetoRel(void)2044 Magick::PathQuadraticCurvetoRel::~PathQuadraticCurvetoRel ( void )
2045 {
2046 }
operator ()(MagickCore::DrawingWand * context_) const2047 void Magick::PathQuadraticCurvetoRel::operator()
2048   ( MagickCore::DrawingWand * context_ ) const
2049 {
2050   for( PathQuadraticCurvetoArgsList::const_iterator p = _args.begin();
2051        p != _args.end(); p++ )
2052     {
2053       DrawPathCurveToQuadraticBezierRelative( context_, p->x1(), p->y1(),
2054                                               p->x(), p->y() );
2055     }
2056 }
copy() const2057 Magick::VPathBase* Magick::PathQuadraticCurvetoRel::copy() const
2058 {
2059   return new PathQuadraticCurvetoRel(*this);
2060 }
PathSmoothQuadraticCurvetoAbs(const Magick::Coordinate & coordinate_)2061 Magick::PathSmoothQuadraticCurvetoAbs::PathSmoothQuadraticCurvetoAbs
2062 ( const Magick::Coordinate &coordinate_ )
2063   : _coordinates(1,coordinate_)
2064 {
2065 }
PathSmoothQuadraticCurvetoAbs(const CoordinateList & coordinates_)2066 Magick::PathSmoothQuadraticCurvetoAbs::PathSmoothQuadraticCurvetoAbs
2067 ( const CoordinateList &coordinates_ )
2068   : _coordinates(coordinates_)
2069 {
2070 }
PathSmoothQuadraticCurvetoAbs(const Magick::PathSmoothQuadraticCurvetoAbs & original_)2071 Magick::PathSmoothQuadraticCurvetoAbs::PathSmoothQuadraticCurvetoAbs
2072 ( const Magick::PathSmoothQuadraticCurvetoAbs& original_ )
2073   : VPathBase (original_),
2074     _coordinates(original_._coordinates)
2075 {
2076 }
~PathSmoothQuadraticCurvetoAbs(void)2077 Magick::PathSmoothQuadraticCurvetoAbs::~PathSmoothQuadraticCurvetoAbs ( void )
2078 {
2079 }
operator ()(MagickCore::DrawingWand * context_) const2080 void Magick::PathSmoothQuadraticCurvetoAbs::operator()
2081   ( MagickCore::DrawingWand * context_ ) const
2082 {
2083   for( CoordinateList::const_iterator p = _coordinates.begin();
2084        p != _coordinates.end(); p++ )
2085     {
2086       DrawPathCurveToQuadraticBezierSmoothAbsolute( context_, p->x(), p->y() );
2087     }
2088 }
copy() const2089 Magick::VPathBase* Magick::PathSmoothQuadraticCurvetoAbs::copy() const
2090 {
2091   return new PathSmoothQuadraticCurvetoAbs(*this);
2092 }
PathSmoothQuadraticCurvetoRel(const Magick::Coordinate & coordinate_)2093 Magick::PathSmoothQuadraticCurvetoRel::PathSmoothQuadraticCurvetoRel
2094 ( const Magick::Coordinate &coordinate_ )
2095   : _coordinates(1,coordinate_)
2096 {
2097 }
PathSmoothQuadraticCurvetoRel(const CoordinateList & coordinates_)2098 Magick::PathSmoothQuadraticCurvetoRel::PathSmoothQuadraticCurvetoRel
2099 ( const CoordinateList &coordinates_ )
2100   : _coordinates(coordinates_)
2101 {
2102 }
PathSmoothQuadraticCurvetoRel(const PathSmoothQuadraticCurvetoRel & original_)2103 Magick::PathSmoothQuadraticCurvetoRel::PathSmoothQuadraticCurvetoRel
2104 ( const PathSmoothQuadraticCurvetoRel& original_ )
2105   : VPathBase (original_),
2106     _coordinates(original_._coordinates)
2107 {
2108 }
~PathSmoothQuadraticCurvetoRel(void)2109 Magick::PathSmoothQuadraticCurvetoRel::~PathSmoothQuadraticCurvetoRel ( void )
2110 {
2111 }
operator ()(MagickCore::DrawingWand * context_) const2112 void Magick::PathSmoothQuadraticCurvetoRel::operator()
2113   ( MagickCore::DrawingWand * context_ ) const
2114 {
2115   for( CoordinateList::const_iterator p = _coordinates.begin();
2116        p != _coordinates.end(); p++ )
2117     {
2118       DrawPathCurveToQuadraticBezierSmoothRelative( context_, p->x(), p->y() );
2119     }
2120 }
copy() const2121 Magick::VPathBase* Magick::PathSmoothQuadraticCurvetoRel::copy() const
2122 {
2123   return new PathSmoothQuadraticCurvetoRel(*this);
2124 }
2125 
2126 //
2127 // Path Lineto
2128 //
PathLinetoAbs(const Magick::Coordinate & coordinate_)2129 Magick::PathLinetoAbs::PathLinetoAbs ( const Magick::Coordinate& coordinate_  )
2130   : _coordinates(1,coordinate_)
2131 {
2132 }
PathLinetoAbs(const CoordinateList & coordinates_)2133 Magick::PathLinetoAbs::PathLinetoAbs ( const CoordinateList &coordinates_ )
2134   : _coordinates(coordinates_)
2135 {
2136 }
PathLinetoAbs(const Magick::PathLinetoAbs & original_)2137 Magick::PathLinetoAbs::PathLinetoAbs ( const Magick::PathLinetoAbs& original_ )
2138   : VPathBase (original_),
2139     _coordinates(original_._coordinates)
2140 {
2141 }
~PathLinetoAbs(void)2142 Magick::PathLinetoAbs::~PathLinetoAbs ( void )
2143 {
2144 }
operator ()(MagickCore::DrawingWand * context_) const2145 void Magick::PathLinetoAbs::operator()( MagickCore::DrawingWand * context_ ) const
2146 {
2147   for( CoordinateList::const_iterator p = _coordinates.begin();
2148        p != _coordinates.end(); p++ )
2149     {
2150       DrawPathLineToAbsolute( context_, p->x(), p->y() );
2151     }
2152 }
copy() const2153 Magick::VPathBase* Magick::PathLinetoAbs::copy() const
2154 {
2155   return new PathLinetoAbs(*this);
2156 }
PathLinetoRel(const Magick::Coordinate & coordinate_)2157 Magick::PathLinetoRel::PathLinetoRel ( const Magick::Coordinate& coordinate_  )
2158   : _coordinates(1,coordinate_)
2159 {
2160 }
PathLinetoRel(const CoordinateList & coordinates_)2161 Magick::PathLinetoRel::PathLinetoRel ( const CoordinateList &coordinates_ )
2162   : _coordinates(coordinates_)
2163 {
2164 }
PathLinetoRel(const Magick::PathLinetoRel & original_)2165 Magick::PathLinetoRel::PathLinetoRel ( const Magick::PathLinetoRel& original_ )
2166   : VPathBase (original_),
2167     _coordinates(original_._coordinates)
2168 {
2169 }
~PathLinetoRel(void)2170 Magick::PathLinetoRel::~PathLinetoRel ( void )
2171 {
2172 }
operator ()(MagickCore::DrawingWand * context_) const2173 void Magick::PathLinetoRel::operator()( MagickCore::DrawingWand * context_ ) const
2174 {
2175   for( CoordinateList::const_iterator p = _coordinates.begin();
2176        p != _coordinates.end(); p++ )
2177     {
2178       DrawPathLineToRelative( context_, p->x(), p->y() );
2179     }
2180 }
copy() const2181 Magick::VPathBase* Magick::PathLinetoRel::copy() const
2182 {
2183   return new PathLinetoRel(*this);
2184 }
2185 
2186 //
2187 // Path Horizontal Lineto
2188 //
2189 
~PathLinetoHorizontalAbs(void)2190 Magick::PathLinetoHorizontalAbs::~PathLinetoHorizontalAbs ( void )
2191 {
2192 }
operator ()(MagickCore::DrawingWand * context_) const2193 void Magick::PathLinetoHorizontalAbs::operator()
2194   ( MagickCore::DrawingWand * context_ ) const
2195 {
2196   DrawPathLineToHorizontalAbsolute( context_, _x );
2197 }
copy() const2198 Magick::VPathBase* Magick::PathLinetoHorizontalAbs::copy() const
2199 {
2200   return new PathLinetoHorizontalAbs(*this);
2201 }
~PathLinetoHorizontalRel(void)2202 Magick::PathLinetoHorizontalRel::~PathLinetoHorizontalRel ( void )
2203 {
2204 }
operator ()(MagickCore::DrawingWand * context_) const2205 void Magick::PathLinetoHorizontalRel::operator()
2206   ( MagickCore::DrawingWand * context_ ) const
2207 {
2208   DrawPathLineToHorizontalRelative( context_, _x );
2209 }
copy() const2210 Magick::VPathBase* Magick::PathLinetoHorizontalRel::copy() const
2211 {
2212   return new PathLinetoHorizontalRel(*this);
2213 }
2214 
2215 //
2216 // Path Vertical Lineto
2217 //
~PathLinetoVerticalAbs(void)2218 Magick::PathLinetoVerticalAbs::~PathLinetoVerticalAbs ( void )
2219 {
2220 }
operator ()(MagickCore::DrawingWand * context_) const2221 void Magick::PathLinetoVerticalAbs::operator()
2222   ( MagickCore::DrawingWand * context_ ) const
2223 {
2224   DrawPathLineToVerticalAbsolute( context_, _y );
2225 }
copy() const2226 Magick::VPathBase* Magick::PathLinetoVerticalAbs::copy() const
2227 {
2228   return new PathLinetoVerticalAbs(*this);
2229 }
~PathLinetoVerticalRel(void)2230 Magick::PathLinetoVerticalRel::~PathLinetoVerticalRel ( void )
2231 {
2232 }
operator ()(MagickCore::DrawingWand * context_) const2233 void Magick::PathLinetoVerticalRel::operator()
2234   ( MagickCore::DrawingWand * context_ ) const
2235 {
2236   DrawPathLineToVerticalRelative( context_, _y );
2237 }
copy() const2238 Magick::VPathBase* Magick::PathLinetoVerticalRel::copy() const
2239 {
2240   return new PathLinetoVerticalRel(*this);
2241 }
2242 
2243 //
2244 // Path Moveto
2245 //
2246 
PathMovetoAbs(const Magick::Coordinate & coordinate_)2247 Magick::PathMovetoAbs::PathMovetoAbs ( const Magick::Coordinate &coordinate_ )
2248   : _coordinates(1,coordinate_)
2249 {
2250 }
PathMovetoAbs(const CoordinateList & coordinates_)2251 Magick::PathMovetoAbs::PathMovetoAbs ( const CoordinateList &coordinates_ )
2252   : _coordinates(coordinates_)
2253 {
2254 }
PathMovetoAbs(const Magick::PathMovetoAbs & original_)2255 Magick::PathMovetoAbs::PathMovetoAbs ( const Magick::PathMovetoAbs& original_ )
2256   : VPathBase (original_),
2257     _coordinates(original_._coordinates)
2258 {
2259 }
~PathMovetoAbs(void)2260 Magick::PathMovetoAbs::~PathMovetoAbs ( void )
2261 {
2262 }
operator ()(MagickCore::DrawingWand * context_) const2263 void Magick::PathMovetoAbs::operator()( MagickCore::DrawingWand * context_ ) const
2264 {
2265   for( CoordinateList::const_iterator p = _coordinates.begin();
2266        p != _coordinates.end(); p++ )
2267     {
2268       DrawPathMoveToAbsolute( context_, p->x(), p->y() );
2269     }
2270 }
copy() const2271 Magick::VPathBase* Magick::PathMovetoAbs::copy() const
2272 {
2273   return new PathMovetoAbs(*this);
2274 }
PathMovetoRel(const Magick::Coordinate & coordinate_)2275 Magick::PathMovetoRel::PathMovetoRel ( const Magick::Coordinate &coordinate_ )
2276   : _coordinates(1,coordinate_)
2277 {
2278 }
PathMovetoRel(const CoordinateList & coordinates_)2279 Magick::PathMovetoRel::PathMovetoRel ( const CoordinateList &coordinates_ )
2280   : _coordinates(coordinates_)
2281 {
2282 }
PathMovetoRel(const Magick::PathMovetoRel & original_)2283 Magick::PathMovetoRel::PathMovetoRel ( const Magick::PathMovetoRel& original_ )
2284   : VPathBase (original_),
2285     _coordinates(original_._coordinates)
2286 {
2287 }
~PathMovetoRel(void)2288 Magick::PathMovetoRel::~PathMovetoRel ( void )
2289 {
2290 }
operator ()(MagickCore::DrawingWand * context_) const2291 void Magick::PathMovetoRel::operator()( MagickCore::DrawingWand * context_ ) const
2292 {
2293   for( CoordinateList::const_iterator p = _coordinates.begin();
2294        p != _coordinates.end(); p++ )
2295     {
2296       DrawPathMoveToRelative( context_, p->x(), p->y() );
2297     }
2298 }
copy() const2299 Magick::VPathBase* Magick::PathMovetoRel::copy() const
2300 {
2301   return new PathMovetoRel(*this);
2302 }
2303 
2304 #if defined(EXPLICIT_TEMPLATE_INSTANTIATION)
2305 // template class std::list<Magick::Coordinate>;
2306 // template class std::list<const Magick::Drawable>;
2307 // template class std::list<const Magick::PathArcArgs>;
2308 // template class std::list<const Magick::PathCurvetoArgs>;
2309 // template class std::list<const Magick::PathQuadraticCurvetoArgs>;
2310 // template class std::list<const Magick::VPath>;
2311 #endif
2312