Coverage Report

Created: 2025-10-12 07:48

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