Magick++  6.9.3
Options.cpp
Go to the documentation of this file.
1 // This may look like C code, but it is really -*- C++ -*-
2 //
3 // Copyright Bob Friesenhahn, 1999, 2000, 2001, 2002, 2003
4 // Copyright Dirk Lemstra 2014-2015
5 //
6 // Implementation of Options
7 //
8 // A wrapper around DrawInfo, ImageInfo, and QuantizeInfo
9 //
10 
11 #define MAGICKCORE_IMPLEMENTATION 1
12 #define MAGICK_PLUSPLUS_IMPLEMENTATION 1
13 
14 #include "Magick++/Include.h"
15 #include <string>
16 #include <string.h>
17 #include <stdlib.h>
18 #include <math.h>
19 
20 #include "Magick++/Options.h"
21 #include "Magick++/Functions.h"
22 #include "Magick++/Exception.h"
23 
24 #define MagickPI 3.14159265358979323846264338327950288419716939937510
25 #define DegreesToRadians(x) (MagickPI*(x)/180.0)
26 
28  : _imageInfo(static_cast<ImageInfo*>(AcquireMagickMemory(
29  sizeof(ImageInfo)))),
30  _quantizeInfo(static_cast<QuantizeInfo*>(AcquireMagickMemory(
31  sizeof(QuantizeInfo)))),
32  _drawInfo(static_cast<DrawInfo*>(AcquireMagickMemory(sizeof(DrawInfo)))),
33  _quiet(false)
34 {
35  // Initialize image info with defaults
36  GetImageInfo(_imageInfo);
37 
38  // Initialize quantization info
39  GetQuantizeInfo(_quantizeInfo);
40 
41  // Initialize drawing info
42  GetDrawInfo(_imageInfo,_drawInfo);
43 }
44 
46  : _imageInfo(CloneImageInfo(options_._imageInfo)),
47  _quantizeInfo(CloneQuantizeInfo(options_._quantizeInfo)),
48  _drawInfo(CloneDrawInfo(_imageInfo,options_._drawInfo)),
49  _quiet(false)
50 {
51 }
52 
54 {
55  // Destroy image info
56  _imageInfo=DestroyImageInfo(_imageInfo);
57 
58  // Destroy quantization info
59  _quantizeInfo=DestroyQuantizeInfo(_quantizeInfo);
60 
61  // Destroy drawing info
62  _drawInfo=DestroyDrawInfo(_drawInfo);
63 }
64 
66 {
67  _drawInfo->text_antialias=static_cast<MagickBooleanType>(
68  flag_ ? MagickTrue : MagickFalse);
69 }
70 
72 {
73  return(static_cast<bool>(_drawInfo->text_antialias));
74 }
75 
76 void Magick::Options::adjoin(bool flag_)
77 {
78  _imageInfo->adjoin=static_cast<MagickBooleanType>(
79  flag_ ? MagickTrue : MagickFalse);
80 }
81 
82 bool Magick::Options::adjoin(void) const
83 {
84  return(static_cast<bool>(_imageInfo->adjoin));
85 }
86 
88 {
89  _imageInfo->background_color=color_;
90 }
91 
93 {
94  return(Magick::Color(_imageInfo->background_color));
95 }
96 
97 void Magick::Options::backgroundTexture(const std::string &backgroundTexture_)
98 {
99  if (backgroundTexture_.length() == 0)
100  _imageInfo->texture=(char *) RelinquishMagickMemory(_imageInfo->texture);
101  else
102  Magick::CloneString(&_imageInfo->texture,backgroundTexture_);
103 }
104 
105 std::string Magick::Options::backgroundTexture(void) const
106 {
107  if (_imageInfo->texture)
108  return(std::string(_imageInfo->texture));
109  else
110  return(std::string());
111 }
112 
114 {
115  _imageInfo->border_color=color_;
116  _drawInfo->border_color=color_;
117 }
118 
120 {
121  return(Magick::Color(_imageInfo->border_color));
122 }
123 
125 {
126  _drawInfo->undercolor=boxColor_;
127 }
128 
130 {
131  return(Magick::Color(_drawInfo->undercolor));
132 }
133 
134 void Magick::Options::colorspaceType(Magick::ColorspaceType colorspace_)
135 {
136  _imageInfo->colorspace=colorspace_;
137 }
138 
139 Magick::ColorspaceType Magick::Options::colorspaceType(void) const
140 {
141  return(static_cast<Magick::ColorspaceType>(_imageInfo->colorspace));
142 }
143 
144 void Magick::Options::compressType(CompressionType compressType_)
145 {
146  _imageInfo->compression=compressType_;
147 }
148 
149 Magick::CompressionType Magick::Options::compressType(void) const
150 {
151  return(static_cast<Magick::CompressionType>(_imageInfo->compression));
152 }
153 
154 void Magick::Options::colorFuzz(double fuzz_)
155 {
156  _imageInfo->fuzz=fuzz_;
157 }
158 
159 double Magick::Options::colorFuzz(void) const
160 {
161  return(_imageInfo->fuzz);
162 }
163 
164 void Magick::Options::debug(bool flag_)
165 {
166  if (flag_)
167  SetLogEventMask("All");
168  else
169  SetLogEventMask("None");
170 }
171 
172 bool Magick::Options::debug(void) const
173 {
174  if (IsEventLogging())
175  return(true);
176 
177  return(false);
178 }
179 
181 {
182  if (!density_.isValid())
183  _imageInfo->density=(char *) RelinquishMagickMemory(_imageInfo->density);
184  else
185  Magick::CloneString(&_imageInfo->density,density_);
186 }
187 
189 {
190  if (_imageInfo->density)
191  return(Geometry(_imageInfo->density));
192 
193  return(Geometry());
194 }
195 
196 void Magick::Options::depth(size_t depth_)
197 {
198  _imageInfo->depth=depth_;
199 }
200 
201 size_t Magick::Options::depth(void) const
202 {
203  return(_imageInfo->depth);
204 }
205 
206 void Magick::Options::endian(Magick::EndianType endian_)
207 {
208  _imageInfo->endian=endian_;
209 }
210 
211 Magick::EndianType Magick::Options::endian(void) const
212 {
213  return(_imageInfo->endian);
214 }
215 
216 void Magick::Options::file(FILE *file_)
217 {
218  SetImageInfoFile(_imageInfo,file_);
219 }
220 
221 FILE *Magick::Options::file(void) const
222 {
223  return(GetImageInfoFile(_imageInfo));
224 }
225 
226 void Magick::Options::fileName(const std::string &fileName_)
227 {
228  fileName_.copy(_imageInfo->filename,MaxTextExtent-1);
229  if (fileName_.length() > MaxTextExtent-1)
230  _imageInfo->filename[MaxTextExtent-1]=0;
231  else
232  _imageInfo->filename[fileName_.length()]=0;
233 }
234 
235 std::string Magick::Options::fileName(void) const
236 {
237  return(std::string(_imageInfo->filename));
238 }
239 
241 {
242  _drawInfo->fill=fillColor_;
243  if (fillColor_ == Magick::Color())
244  fillPattern((const MagickCore::Image*) NULL);
245  setOption("fill",fillColor_);
246 }
247 
249 {
250  return(_drawInfo->fill);
251 }
252 
254 {
255  if (_drawInfo->fill_pattern)
256  {
257  DestroyImageList(_drawInfo->fill_pattern);
258  _drawInfo->fill_pattern=0;
259  }
260  if (fillPattern_)
261  {
263  _drawInfo->fill_pattern=CloneImage(const_cast<MagickCore::Image*>(
264  fillPattern_),0,0,static_cast<MagickBooleanType>(MagickTrue),
265  exceptionInfo);
266  ThrowPPException(_quiet);
267  }
268 }
269 
271 {
272  return(_drawInfo->fill_pattern);
273 }
274 
275 void Magick::Options::fillRule(const Magick::FillRule &fillRule_)
276 {
277  _drawInfo->fill_rule=fillRule_;
278 }
279 
280 Magick::FillRule Magick::Options::fillRule(void) const
281 {
282  return(_drawInfo->fill_rule);
283 }
284 
285 void Magick::Options::font(const std::string &font_)
286 {
287  if (font_.length() == 0)
288  {
289  _imageInfo->font=(char *) RelinquishMagickMemory(_imageInfo->font);
290  _drawInfo->font=(char *) RelinquishMagickMemory(_drawInfo->font);
291  }
292  else
293  {
294  Magick::CloneString(&_imageInfo->font,font_);
295  Magick::CloneString(&_drawInfo->font,font_);
296  }
297 }
298 
299 std::string Magick::Options::font(void) const
300 {
301  if (_imageInfo->font)
302  return(std::string(_imageInfo->font));
303 
304  return(std::string());
305 }
306 
307 void Magick::Options::fontFamily(const std::string &family_)
308 {
309  if (family_.length() == 0)
310  {
311  _drawInfo->family=(char *) RelinquishMagickMemory(_drawInfo->font);
312  DestroyString(RemoveImageOption(imageInfo(),"family"));
313  }
314  else
315  {
316  Magick::CloneString(&_drawInfo->family,family_);
317  (void) SetImageOption(imageInfo(),"family",family_.c_str());
318  }
319 }
320 
321 std::string Magick::Options::fontFamily(void) const
322 {
323  if (_drawInfo->family)
324  return(std::string(_drawInfo->family));
325 
326  return(std::string());
327 }
328 
329 void Magick::Options::fontPointsize(double pointSize_)
330 {
331  _imageInfo->pointsize=pointSize_;
332  _drawInfo->pointsize=pointSize_;
333 }
334 
336 {
337  return(_imageInfo->pointsize);
338 }
339 
340 void Magick::Options::fontStyle(const StyleType style_)
341 {
342  _drawInfo->style=style_;
343  (void) SetImageOption(_imageInfo,"style",CommandOptionToMnemonic(
344  MagickStyleOptions,(ssize_t) style_));
345 }
346 
347 Magick::StyleType Magick::Options::fontStyle(void) const
348 {
349  return(_drawInfo->style);
350 }
351 
352 void Magick::Options::fontWeight(const size_t weight_)
353 {
354  _drawInfo->weight=weight_;
355  setOption("weight",(double) weight_);
356 }
357 
358 size_t Magick::Options::fontWeight(void) const
359 {
360  return(_drawInfo->weight);
361 }
362 
363 
364 std::string Magick::Options::format(void) const
365 {
366  const MagickInfo
367  *magick_info=0;
368 
370  if (*_imageInfo->magick != '\0')
371  magick_info=GetMagickInfo(_imageInfo->magick,exceptionInfo);
372  ThrowPPException(_quiet);
373 
374  if ((magick_info != 0) && (*magick_info->description != '\0'))
375  return(std::string(magick_info->description));
376 
377  return(std::string());
378 }
379 
380 void Magick::Options::interlaceType(Magick::InterlaceType interlace_)
381 {
382  _imageInfo->interlace=interlace_;
383 }
384 
385 Magick::InterlaceType Magick::Options::interlaceType(void) const
386 {
387  return(static_cast<Magick::InterlaceType>(_imageInfo->interlace));
388 }
389 
390 void Magick::Options::magick(const std::string &magick_)
391 {
392  if (magick_.empty())
393  {
394  _imageInfo->magick[0] = '\0';
395  return;
396  }
397 
398  FormatLocaleString(_imageInfo->filename,MaxTextExtent,"%.1024s:",
399  magick_.c_str());
401  SetImageInfo(_imageInfo,1,exceptionInfo);
402  ThrowPPException(_quiet);
403  if ( _imageInfo->magick[0] == '\0' )
404  throwExceptionExplicit(OptionWarning,"Unrecognized image format",
405  magick_.c_str());
406 }
407 
408 std::string Magick::Options::magick(void) const
409 {
410  if ( _imageInfo->magick[0] != '\0' )
411  return(std::string(_imageInfo->magick));
412 
413  return(std::string());
414 }
415 
417 {
418  _imageInfo->matte_color=matteColor_;
419 }
420 
422 {
423  return(Magick::Color(_imageInfo->matte_color));
424 }
425 
426 void Magick::Options::monochrome(bool monochromeFlag_)
427 {
428  _imageInfo->monochrome=(MagickBooleanType) monochromeFlag_;
429 }
430 
432 {
433  return(static_cast<bool>(_imageInfo->monochrome));
434 }
435 
437 {
438  if (!pageSize_.isValid())
439  _imageInfo->page=(char *) RelinquishMagickMemory(_imageInfo->page);
440  else
441  Magick::CloneString(&_imageInfo->page,pageSize_);
442 }
443 
445 {
446  if (_imageInfo->page)
447  return(Geometry(_imageInfo->page));
448 
449  return(Geometry());
450 }
451 
452 void Magick::Options::quality(size_t quality_)
453 {
454  _imageInfo->quality=quality_;
455 }
456 
457 size_t Magick::Options::quality(void) const
458 {
459  return(_imageInfo->quality);
460 }
461 
463 {
464  _quantizeInfo->number_colors=colors_;
465 }
466 
468 {
469  return(_quantizeInfo->number_colors);
470 }
471 
472 void Magick::Options::quantizeColorSpace(Magick::ColorspaceType colorSpace_)
473 {
474  _quantizeInfo->colorspace=colorSpace_;
475 }
476 
477 Magick::ColorspaceType Magick::Options::quantizeColorSpace(void) const
478 {
479  return(static_cast<Magick::ColorspaceType>(_quantizeInfo->colorspace));
480 }
481 
482 void Magick::Options::quantizeDither(bool ditherFlag_)
483 {
484  _imageInfo->dither=(MagickBooleanType) ditherFlag_;
485  _quantizeInfo->dither=(MagickBooleanType) ditherFlag_;
486 }
487 
489 {
490  return(static_cast<bool>(_imageInfo->dither));
491 }
492 
493 void Magick::Options::quantizeDitherMethod(DitherMethod ditherMethod_)
494 {
495  _quantizeInfo->dither_method=ditherMethod_;
496 }
497 
498 MagickCore::DitherMethod Magick::Options::quantizeDitherMethod(void) const
499 {
500  return(_quantizeInfo->dither_method);
501 }
502 
503 void Magick::Options::quantizeTreeDepth(size_t treeDepth_)
504 {
505  _quantizeInfo->tree_depth=treeDepth_;
506 }
507 
509 {
510  return(_quantizeInfo->tree_depth);
511 }
512 
513 void Magick::Options::quiet(const bool quiet_)
514 {
515  _quiet=quiet_;
516 }
517 
518 bool Magick::Options::quiet(void) const
519 {
520  return(_quiet);
521 }
522 
523 void Magick::Options::resolutionUnits(Magick::ResolutionType resolutionUnits_)
524 {
525  _imageInfo->units=resolutionUnits_;
526 }
527 
528 Magick::ResolutionType Magick::Options::resolutionUnits(void) const
529 {
530  return(_imageInfo->units);
531 }
532 
533 void Magick::Options::samplingFactor(const std::string &samplingFactor_)
534 {
535  if (samplingFactor_.length() == 0)
536  _imageInfo->sampling_factor=(char *) RelinquishMagickMemory(
537  _imageInfo->sampling_factor);
538  else
539  Magick::CloneString(&_imageInfo->sampling_factor, samplingFactor_);
540 }
541 
542 std::string Magick::Options::samplingFactor(void) const
543 {
544  if (_imageInfo->sampling_factor)
545  return(std::string(_imageInfo->sampling_factor));
546 
547  return(std::string());
548 }
549 
550 void Magick::Options::size(const Geometry &geometry_)
551 {
552  _imageInfo->size=(char *) RelinquishMagickMemory(_imageInfo->size);
553 
554  if ( geometry_.isValid() )
555  Magick::CloneString(&_imageInfo->size,geometry_);
556 }
557 
559 {
560  if (_imageInfo->size)
561  return(Geometry(_imageInfo->size));
562 
563  return(Geometry());
564 }
565 
567 {
568  flag_ ? _drawInfo->stroke_antialias=MagickTrue :
569  _drawInfo->stroke_antialias=MagickFalse;
570 }
571 
573 {
574  return(_drawInfo->stroke_antialias != 0 ? true : false);
575 }
576 
578 {
579  _drawInfo->stroke=strokeColor_;
580  if (strokeColor_ == Magick::Color())
581  strokePattern((const MagickCore::Image*) NULL);
582  setOption("stroke",strokeColor_);
583 }
584 
586 {
587  return(_drawInfo->stroke);
588 }
589 
590 void Magick::Options::strokeDashArray(const double *strokeDashArray_)
591 {
592  _drawInfo->dash_pattern=(double *) RelinquishMagickMemory(
593  _drawInfo->dash_pattern);
594 
595  if(strokeDashArray_)
596  {
597  size_t
598  x;
599 
600  // Count elements in dash array
601  for (x=0; strokeDashArray_[x]; x++) ;
602  // Allocate elements
603  _drawInfo->dash_pattern=static_cast<double*>(AcquireMagickMemory((x+1)*
604  sizeof(double)));
605  // Copy elements
606  memcpy(_drawInfo->dash_pattern,strokeDashArray_,(x+1)*sizeof(double));
607  _drawInfo->dash_pattern[x]=0.0;
608  }
609 }
610 
611 const double *Magick::Options::strokeDashArray(void) const
612 {
613  return(_drawInfo->dash_pattern);
614 }
615 
616 void Magick::Options::strokeDashOffset(double strokeDashOffset_)
617 {
618  _drawInfo->dash_offset=strokeDashOffset_;
619 }
620 
622 {
623  return(_drawInfo->dash_offset);
624 }
625 
626 void Magick::Options::strokeLineCap(Magick::LineCap lineCap_)
627 {
628  _drawInfo->linecap=lineCap_;
629 }
630 
631 Magick::LineCap Magick::Options::strokeLineCap(void) const
632 {
633  return(_drawInfo->linecap);
634 }
635 
636 void Magick::Options::strokeLineJoin(Magick::LineJoin lineJoin_)
637 {
638  _drawInfo->linejoin=lineJoin_;
639 }
640 
641 Magick::LineJoin Magick::Options::strokeLineJoin(void) const
642 {
643  return(_drawInfo->linejoin);
644 }
645 
646 void Magick::Options::strokeMiterLimit(size_t miterLimit_)
647 {
648  _drawInfo->miterlimit=miterLimit_;
649 }
650 
652 {
653  return(_drawInfo->miterlimit);
654 }
655 
657 {
658  if (_drawInfo->stroke_pattern)
659  _drawInfo->stroke_pattern=DestroyImageList(_drawInfo->stroke_pattern);
660 
661  if (strokePattern_)
662  {
664  _drawInfo->stroke_pattern=CloneImage(const_cast<MagickCore::Image*>(
665  strokePattern_),0,0,MagickTrue,exceptionInfo);
666  ThrowPPException(_quiet);
667  }
668 }
669 
671 {
672  return(_drawInfo->stroke_pattern);
673 }
674 
675 void Magick::Options::strokeWidth(double strokeWidth_)
676 {
677  _drawInfo->stroke_width=strokeWidth_;
678 }
679 
681 {
682  return(_drawInfo->stroke_width);
683 }
684 
685 void Magick::Options::subImage(size_t subImage_)
686 {
687  _imageInfo->scene=subImage_;
688 }
689 
690 size_t Magick::Options::subImage(void) const
691 {
692  return(_imageInfo->scene);
693 }
694 
695 void Magick::Options::subRange(size_t subRange_)
696 {
697  _imageInfo->number_scenes=subRange_;
698 }
699 
700 size_t Magick::Options::subRange(void) const
701 {
702  return(_imageInfo->number_scenes);
703 }
704 
705 void Magick::Options::textDirection(DirectionType direction_)
706 {
707  _drawInfo->direction=direction_;
708  (void) SetImageOption(_imageInfo,"direction",CommandOptionToMnemonic(
709  MagickDirectionOptions,(ssize_t) direction_));
710 }
711 
712 Magick::DirectionType Magick::Options::textDirection() const
713 {
714  return(_drawInfo->direction);
715 }
716 
717 void Magick::Options::textEncoding(const std::string &encoding_)
718 {
719  CloneString(&_drawInfo->encoding,encoding_.c_str());
720  (void) SetImageOption(imageInfo(),"encoding",encoding_.c_str());
721 }
722 
723 std::string Magick::Options::textEncoding(void) const
724 {
725  if (_drawInfo->encoding && *_drawInfo->encoding)
726  return(std::string(_drawInfo->encoding));
727 
728  return(std::string());
729 }
730 
731 void Magick::Options::textGravity(GravityType gravity_)
732 {
733  _drawInfo->gravity=gravity_;
734  (void) SetImageOption(_imageInfo,"gravity",CommandOptionToMnemonic(
735  MagickGravityOptions,(ssize_t) gravity_));
736 }
737 
738 Magick::GravityType Magick::Options::textGravity() const
739 {
740  return(_drawInfo->gravity);
741 }
742 
744 {
745  _drawInfo->interline_spacing=spacing_;
746  setOption("interline-spacing",spacing_);
747 }
748 
750 {
751  return(_drawInfo->interline_spacing);
752 }
753 
755 {
756  _drawInfo->interword_spacing=spacing_;
757  setOption("interword-spacing",spacing_);
758 }
759 
761 {
762  return(_drawInfo->interword_spacing);
763 }
764 
765 void Magick::Options::textKerning(double kerning_)
766 {
767  _drawInfo->kerning=kerning_;
768  setOption("kerning",kerning_);
769 }
770 
772 {
773  return(_drawInfo->kerning);
774 }
775 
777 {
778  _drawInfo->undercolor=undercolor_;
779  setOption("undercolor",undercolor_);
780 }
781 
783 {
784  return(_drawInfo->undercolor);
785 }
786 
787 
788 void Magick::Options::tileName(const std::string &tileName_)
789 {
790  if (tileName_.length() == 0)
791  _imageInfo->tile=(char *) RelinquishMagickMemory(_imageInfo->tile);
792  else
793  Magick::CloneString(&_imageInfo->tile,tileName_);
794 }
795 
796 std::string Magick::Options::tileName(void) const
797 {
798  if (_imageInfo->tile)
799  return(std::string(_imageInfo->tile));
800  return(std::string());
801 }
802 
803 void Magick::Options::transformOrigin(double tx_,double ty_)
804 {
805  AffineMatrix
806  affine,
807  current=_drawInfo->affine;
808 
809  affine.sx=1.0;
810  affine.rx=0.0;
811  affine.ry=0.0;
812  affine.sy=1.0;
813  affine.tx=0.0;
814  affine.ty=0.0;
815 
816  affine.tx=tx_;
817  affine.ty=ty_;
818 
819  _drawInfo->affine.sx=current.sx*affine.sx+current.ry*affine.rx;
820  _drawInfo->affine.rx=current.rx*affine.sx+current.sy*affine.rx;
821  _drawInfo->affine.ry=current.sx*affine.ry+current.ry*affine.sy;
822  _drawInfo->affine.sy=current.rx*affine.ry+current.sy*affine.sy;
823  _drawInfo->affine.tx=current.sx*affine.tx+current.ry*affine.ty+current.tx;
824  _drawInfo->affine.ty=current.rx*affine.tx+current.sy*affine.ty+current.ty;
825 }
826 
828 {
829  _drawInfo->affine.sx=1.0;
830  _drawInfo->affine.rx=0.0;
831  _drawInfo->affine.ry=0.0;
832  _drawInfo->affine.sy=1.0;
833  _drawInfo->affine.tx=0.0;
834  _drawInfo->affine.ty=0.0;
835 }
836 
838 {
839  AffineMatrix
840  affine,
841  current=_drawInfo->affine;
842 
843  affine.sx=1.0;
844  affine.rx=0.0;
845  affine.ry=0.0;
846  affine.sy=1.0;
847  affine.tx=0.0;
848  affine.ty=0.0;
849 
850  affine.sx=cos(DegreesToRadians(fmod(angle_,360.0)));
851  affine.rx=(-sin(DegreesToRadians(fmod(angle_,360.0))));
852  affine.ry=sin(DegreesToRadians(fmod(angle_,360.0)));
853  affine.sy=cos(DegreesToRadians(fmod(angle_,360.0)));
854 
855  _drawInfo->affine.sx=current.sx*affine.sx+current.ry*affine.rx;
856  _drawInfo->affine.rx=current.rx*affine.sx+current.sy*affine.rx;
857  _drawInfo->affine.ry=current.sx*affine.ry+current.ry*affine.sy;
858  _drawInfo->affine.sy=current.rx*affine.ry+current.sy*affine.sy;
859  _drawInfo->affine.tx=current.sx*affine.tx+current.ry*affine.ty+current.tx;
860  _drawInfo->affine.ty=current.rx*affine.tx+current.sy*affine.ty+current.ty;
861 }
862 
863 void Magick::Options::transformScale(double sx_,double sy_)
864 {
865  AffineMatrix
866  affine,
867  current=_drawInfo->affine;
868 
869  affine.sx=1.0;
870  affine.rx=0.0;
871  affine.ry=0.0;
872  affine.sy=1.0;
873  affine.tx=0.0;
874  affine.ty=0.0;
875 
876  affine.sx=sx_;
877  affine.sy=sy_;
878 
879  _drawInfo->affine.sx=current.sx*affine.sx+current.ry*affine.rx;
880  _drawInfo->affine.rx=current.rx*affine.sx+current.sy*affine.rx;
881  _drawInfo->affine.ry=current.sx*affine.ry+current.ry*affine.sy;
882  _drawInfo->affine.sy=current.rx*affine.ry+current.sy*affine.sy;
883  _drawInfo->affine.tx=current.sx*affine.tx+current.ry*affine.ty+current.tx;
884  _drawInfo->affine.ty=current.rx*affine.tx+current.sy*affine.ty+current.ty;
885 }
886 
888 {
889  AffineMatrix
890  affine,
891  current=_drawInfo->affine;
892 
893  affine.sx=1.0;
894  affine.rx=0.0;
895  affine.ry=0.0;
896  affine.sy=1.0;
897  affine.tx=0.0;
898  affine.ty=0.0;
899 
900  affine.sx=1.0;
901  affine.ry=tan(DegreesToRadians(fmod(skewx_,360.0)));
902  affine.sy=1.0;
903 
904  _drawInfo->affine.sx=current.sx*affine.sx+current.ry*affine.rx;
905  _drawInfo->affine.rx=current.rx*affine.sx+current.sy*affine.rx;
906  _drawInfo->affine.ry=current.sx*affine.ry+current.ry*affine.sy;
907  _drawInfo->affine.sy=current.rx*affine.ry+current.sy*affine.sy;
908  _drawInfo->affine.tx=current.sx*affine.tx+current.ry*affine.ty+current.tx;
909  _drawInfo->affine.ty=current.rx*affine.tx+current.sy*affine.ty+current.ty;
910 }
911 
913 {
914  AffineMatrix
915  affine,
916  current=_drawInfo->affine;
917 
918  affine.sx=1.0;
919  affine.rx=0.0;
920  affine.ry=0.0;
921  affine.sy=1.0;
922  affine.tx=0.0;
923  affine.ty=0.0;
924 
925  affine.sx=1.0;
926  affine.rx=tan(DegreesToRadians(fmod(skewy_,360.0)));
927  affine.sy=1.0;
928 
929  _drawInfo->affine.sx=current.sx*affine.sx+current.ry*affine.rx;
930  _drawInfo->affine.rx=current.rx*affine.sx+current.sy*affine.rx;
931  _drawInfo->affine.ry=current.sx*affine.ry+current.ry*affine.sy;
932  _drawInfo->affine.sy=current.rx*affine.ry+current.sy*affine.sy;
933  _drawInfo->affine.tx=current.sx*affine.tx+current.ry*affine.ty+current.tx;
934  _drawInfo->affine.ty=current.rx*affine.tx+current.sy*affine.ty+current.ty;
935 }
936 
937 void Magick::Options::type(const Magick::ImageType type_)
938 {
939  _imageInfo->type=type_;
940 }
941 
942 Magick::ImageType Magick::Options::type(void) const
943 {
944  return(_imageInfo->type);
945 }
946 
947 void Magick::Options::verbose(bool verboseFlag_)
948 {
949  _imageInfo->verbose=(MagickBooleanType) verboseFlag_;
950 }
951 
952 bool Magick::Options::verbose(void) const
953 {
954  return(static_cast<bool>(_imageInfo->verbose));
955 }
956 
958  VirtualPixelMethod virtual_pixel_method_)
959 {
960  _imageInfo->virtual_pixel_method=virtual_pixel_method_;
961 }
962 
963 Magick::VirtualPixelMethod Magick::Options::virtualPixelMethod(void) const
964 {
965  return(static_cast<Magick::VirtualPixelMethod>(
966  _imageInfo->virtual_pixel_method));
967 }
968 
969 void Magick::Options::view(const std::string &view_)
970 {
971  if (view_.length() == 0)
972  _imageInfo->view=(char *) RelinquishMagickMemory(_imageInfo->view);
973  else
974  Magick::CloneString(&_imageInfo->view,view_);
975 }
976 
977 std::string Magick::Options::view(void) const
978 {
979  if (_imageInfo->view)
980  return(std::string(_imageInfo->view));
981 
982  return(std::string());
983 }
984 
985 void Magick::Options::x11Display(const std::string &display_)
986 {
987  if (display_.length() == 0)
988  _imageInfo->server_name=(char *) RelinquishMagickMemory(
989  _imageInfo->server_name);
990  else
991  Magick::CloneString(&_imageInfo->server_name,display_);
992 }
993 
994 std::string Magick::Options::x11Display(void) const
995 {
996  if (_imageInfo->server_name)
997  return(std::string(_imageInfo->server_name));
998 
999  return(std::string());
1000 }
1001 
1002 MagickCore::DrawInfo *Magick::Options::drawInfo(void)
1003 {
1004  return(_drawInfo);
1005 }
1006 
1007 MagickCore::ImageInfo *Magick::Options::imageInfo(void)
1008 {
1009  return(_imageInfo);
1010 }
1011 
1012 MagickCore::QuantizeInfo *Magick::Options::quantizeInfo( void )
1013 {
1014  return(_quantizeInfo);
1015 }
1016 
1017 Magick::Options::Options(const MagickCore::ImageInfo *imageInfo_,
1018  const MagickCore::QuantizeInfo *quantizeInfo_,
1019  const MagickCore::DrawInfo *drawInfo_)
1020 : _imageInfo((MagickCore::ImageInfo* ) NULL),
1021  _quantizeInfo((MagickCore::QuantizeInfo* ) NULL),
1022  _drawInfo((MagickCore::DrawInfo* ) NULL),
1023  _quiet(false)
1024 {
1025  _imageInfo=CloneImageInfo(imageInfo_);
1026  _quantizeInfo=CloneQuantizeInfo(quantizeInfo_);
1027  _drawInfo=CloneDrawInfo(imageInfo_,drawInfo_);
1028 }
1029 
1030 void Magick::Options::setOption(const char *name,const Color &value_)
1031 {
1032  std::string
1033  option;
1034 
1035  option=value_;
1036  (void) SetImageOption(imageInfo(),name,option.c_str());
1037 }
1038 
1039 void Magick::Options::setOption(const char *name,const double value_)
1040 {
1041  char
1042  option[MaxTextExtent];
1043 
1044  (void) FormatLocaleString(option,MaxTextExtent,"%.20g",value_);
1045  (void) SetImageOption(_imageInfo,name,option);
1046 }
std::string view(void) const
Definition: Options.cpp:977
LineJoin strokeLineJoin(void) const
Definition: Options.cpp:641
Geometry size(void) const
Definition: Options.cpp:558
EndianType endian(void) const
Definition: Options.cpp:211
#define DegreesToRadians(x)
Definition: Options.cpp:25
MagickCore::QuantizeInfo * quantizeInfo(void)
Definition: Options.cpp:1012
GravityType textGravity() const
Definition: Options.cpp:738
Color fillColor(void) const
Definition: Options.cpp:248
CompressionType compressType(void) const
Definition: Options.cpp:149
std::string fileName(void) const
Definition: Options.cpp:235
std::string samplingFactor(void) const
Definition: Options.cpp:542
std::string format(void) const
Definition: Options.cpp:364
const double * strokeDashArray(void) const
Definition: Options.cpp:611
ResolutionType resolutionUnits(void) const
Definition: Options.cpp:528
size_t fontWeight(void) const
Definition: Options.cpp:358
bool verbose(void) const
Definition: Options.cpp:952
MagickCore::ImageInfo * imageInfo(void)
Definition: Options.cpp:1007
bool antiAlias(void) const
Definition: Options.cpp:71
double strokeDashOffset(void) const
Definition: Options.cpp:621
std::string textEncoding(void) const
Definition: Options.cpp:723
void transformSkewX(double skewx_)
Definition: Options.cpp:887
void transformReset(void)
Definition: Options.cpp:827
const MagickCore::Image * fillPattern(void) const
Definition: Options.cpp:270
Color strokeColor(void) const
Definition: Options.cpp:585
bool adjoin(void) const
Definition: Options.cpp:82
Geometry page(void) const
Definition: Options.cpp:444
ColorspaceType quantizeColorSpace(void) const
Definition: Options.cpp:477
double fontPointsize(void) const
Definition: Options.cpp:335
ColorspaceType colorspaceType(void) const
Definition: Options.cpp:139
size_t subImage(void) const
Definition: Options.cpp:690
size_t quality(void) const
Definition: Options.cpp:457
bool strokeAntiAlias(void) const
Definition: Options.cpp:572
void transformScale(double sx_, double sy_)
Definition: Options.cpp:863
std::string magick(void) const
Definition: Options.cpp:408
size_t subRange(void) const
Definition: Options.cpp:700
double strokeWidth(void) const
Definition: Options.cpp:680
bool monochrome(void) const
Definition: Options.cpp:431
VirtualPixelMethod virtualPixelMethod(void) const
Definition: Options.cpp:963
InterlaceType interlaceType(void) const
Definition: Options.cpp:385
size_t depth(void) const
Definition: Options.cpp:201
FILE * file(void) const
Definition: Options.cpp:221
class MagickPPExport Geometry
Definition: Geometry.h:19
Geometry density(void) const
Definition: Options.cpp:188
void transformRotation(double angle_)
Definition: Options.cpp:837
std::string x11Display(void) const
Definition: Options.cpp:994
Color matteColor(void) const
Definition: Options.cpp:421
double colorFuzz(void) const
Definition: Options.cpp:159
std::string tileName(void) const
Definition: Options.cpp:796
size_t quantizeColors(void) const
Definition: Options.cpp:467
MagickPPExport void throwExceptionExplicit(const MagickCore::ExceptionType severity_, const char *reason_, const char *description_=(char *) NULL)
bool quantizeDither(void) const
Definition: Options.cpp:488
std::string font(void) const
Definition: Options.cpp:299
void transformSkewY(double skewy_)
Definition: Options.cpp:912
Color boxColor(void) const
Definition: Options.cpp:129
Color borderColor(void) const
Definition: Options.cpp:119
ImageType type(void) const
Definition: Options.cpp:942
#define ThrowPPException(quiet)
Definition: Include.h:1510
double textInterlineSpacing(void) const
Definition: Options.cpp:749
bool quiet(void) const
Definition: Options.cpp:518
FillRule fillRule(void) const
Definition: Options.cpp:280
Color backgroundColor(void) const
Definition: Options.cpp:92
DirectionType textDirection() const
Definition: Options.cpp:712
size_t strokeMiterLimit(void) const
Definition: Options.cpp:651
Color textUnderColor(void) const
Definition: Options.cpp:782
MagickCore::DrawInfo * drawInfo(void)
Definition: Options.cpp:1002
std::string fontFamily(void) const
Definition: Options.cpp:321
LineCap strokeLineCap(void) const
Definition: Options.cpp:631
MagickPPExport void CloneString(char **destination_, const std::string &source_)
Definition: Functions.cpp:22
class MagickPPExport Image
Definition: Drawable.h:647
DitherMethod quantizeDitherMethod(void) const
Definition: Options.cpp:498
const MagickCore::Image * strokePattern(void) const
Definition: Options.cpp:670
std::string backgroundTexture(void) const
Definition: Options.cpp:105
#define GetPPException
Definition: Include.h:1506
void transformOrigin(double tx_, double ty_)
Definition: Options.cpp:803
void isValid(bool isValid_)
Definition: Geometry.h:253
double textKerning(void) const
Definition: Options.cpp:771
StyleType fontStyle(void) const
Definition: Options.cpp:347
double textInterwordSpacing(void) const
Definition: Options.cpp:760
bool debug(void) const
Definition: Options.cpp:172
size_t quantizeTreeDepth(void) const
Definition: Options.cpp:508