Magick++  6.9.3
Image.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 2013-2015
5 //
6 // Implementation of Image
7 //
8 
9 #define MAGICKCORE_IMPLEMENTATION 1
10 #define MAGICK_PLUSPLUS_IMPLEMENTATION 1
11 
12 #include "Magick++/Include.h"
13 #include <cstdlib>
14 #include <string>
15 #include <string.h>
16 #include <errno.h>
17 #include <math.h>
18 
19 using namespace std;
20 
21 #include "Magick++/Image.h"
22 #include "Magick++/Functions.h"
23 #include "Magick++/Pixels.h"
24 #include "Magick++/Options.h"
25 #include "Magick++/ImageRef.h"
27 
28 #define AbsoluteValue(x) ((x) < 0 ? -(x) : (x))
29 #define MagickPI 3.14159265358979323846264338327950288419716939937510
30 #define DegreesToRadians(x) (MagickPI*(x)/180.0)
31 #define ThrowImageException ThrowPPException(quiet())
32 
36 
38  const Magick::Image &right_)
39 {
40  // If image pixels and signature are the same, then the image is identical
41  return((left_.rows() == right_.rows()) &&
42  (left_.columns() == right_.columns()) &&
43  (left_.signature() == right_.signature()));
44 }
45 
47  const Magick::Image &right_)
48 {
49  return(!(left_ == right_));
50 }
51 
53  const Magick::Image &right_)
54 {
55  return(!(left_ < right_) && (left_ != right_));
56 }
57 
59  const Magick::Image &right_)
60 {
61  // If image pixels are less, then image is smaller
62  return((left_.rows() * left_.columns()) < (right_.rows() *
63  right_.columns()));
64 }
65 
67  const Magick::Image &right_)
68 {
69  return((left_ > right_) || (left_ == right_));
70 }
71 
73  const Magick::Image &right_)
74 {
75  return((left_ < right_) || (left_ == right_));
76 }
77 
79  : _imgRef(new ImageRef)
80 {
81 }
82 
84  : _imgRef(new ImageRef)
85 {
86  try
87  {
88  // Initialize, Allocate and Read images
89  quiet(true);
90  read(blob_);
91  quiet(false);
92  }
93  catch(const Error&)
94  {
95  // Release resources
96  delete _imgRef;
97  throw;
98  }
99 }
100 
101 Magick::Image::Image(const Blob &blob_,const Geometry &size_)
102  : _imgRef(new ImageRef)
103 {
104  try
105  {
106  // Read from Blob
107  quiet(true);
108  read(blob_,size_);
109  quiet(false);
110  }
111  catch(const Error&)
112  {
113  // Release resources
114  delete _imgRef;
115  throw;
116  }
117 }
118 
119 Magick::Image::Image(const Blob &blob_,const Geometry &size_,
120  const size_t depth_)
121  : _imgRef(new ImageRef)
122 {
123  try
124  {
125  // Read from Blob
126  quiet(true);
127  read(blob_,size_,depth_);
128  quiet(false);
129  }
130  catch(const Error&)
131  {
132  // Release resources
133  delete _imgRef;
134  throw;
135  }
136 }
137 
138 Magick::Image::Image(const Blob &blob_,const Geometry &size_,
139  const size_t depth_,const std::string &magick_)
140  : _imgRef(new ImageRef)
141 {
142  try
143  {
144  // Read from Blob
145  quiet(true);
146  read(blob_,size_,depth_,magick_);
147  quiet(false);
148  }
149  catch(const Error&)
150  {
151  // Release resources
152  delete _imgRef;
153  throw;
154  }
155 }
156 
157 Magick::Image::Image(const Blob &blob_,const Geometry &size_,
158  const std::string &magick_)
159  : _imgRef(new ImageRef)
160 {
161  try
162  {
163  // Read from Blob
164  quiet(true);
165  read(blob_,size_,magick_);
166  quiet(false);
167  }
168  catch(const Error&)
169  {
170  // Release resources
171  delete _imgRef;
172  throw;
173  }
174 }
175 
176 Magick::Image::Image(const Geometry &size_,const Color &color_)
177  : _imgRef(new ImageRef)
178 {
179  // xc: prefix specifies an X11 color string
180  std::string imageSpec("xc:");
181  imageSpec+=color_;
182 
183  try
184  {
185  quiet(true);
186  // Set image size
187  size(size_);
188 
189  // Initialize, Allocate and Read images
190  read(imageSpec);
191  quiet(false);
192  }
193  catch(const Error&)
194  {
195  // Release resources
196  delete _imgRef;
197  throw;
198  }
199 }
200 
202  : _imgRef(image_._imgRef)
203 {
204  Lock lock(&_imgRef->_mutexLock);
205 
206  // Increase reference count
207  ++_imgRef->_refCount;
208 }
209 
210 Magick::Image::Image(const Image &image_,const Geometry &geometry_)
211  : _imgRef(new ImageRef)
212 {
213  const RectangleInfo
214  geometry=geometry_;
215 
216  OffsetInfo
217  offset;
218 
220  *image;
221 
223  image=CloneImage(image_.constImage(),geometry_.width(),geometry_.height(),
224  MagickTrue,exceptionInfo);
225  replaceImage(image);
226  _imgRef->options(new Options(*image_.constOptions()));
227  offset.x=0;
228  offset.y=0;
229  (void) CopyImagePixels(image,image_.constImage(),&geometry,&offset,
230  exceptionInfo);
232 }
233 
234 Magick::Image::Image(const size_t width_,const size_t height_,
235  const std::string &map_,const StorageType type_,const void *pixels_)
236  : _imgRef(new ImageRef)
237 {
238  try
239  {
240  quiet(true);
241  read(width_,height_,map_,type_,pixels_);
242  quiet(false);
243  }
244  catch(const Error&)
245  {
246  // Release resources
247  delete _imgRef;
248  throw;
249  }
250 }
251 
252 Magick::Image::Image(const std::string &imageSpec_)
253  : _imgRef(new ImageRef)
254 {
255  try
256  {
257  // Initialize, Allocate and Read images
258  quiet(true);
259  read(imageSpec_);
260  quiet(false);
261  }
262  catch(const Error&)
263  {
264  // Release resources
265  delete _imgRef;
266  throw;
267  }
268 }
269 
271 {
272  bool
273  doDelete=false;
274 
275  {
276  Lock lock(&_imgRef->_mutexLock);
277  if (--_imgRef->_refCount == 0)
278  doDelete=true;
279  }
280 
281  if (doDelete)
282  delete _imgRef;
283 
284  _imgRef=0;
285 }
286 
288 {
289  if (this != &image_)
290  {
291  bool
292  doDelete=false;
293 
294  {
295  Lock lock(&image_._imgRef->_mutexLock);
296  ++image_._imgRef->_refCount;
297  }
298 
299  {
300  Lock lock(&_imgRef->_mutexLock);
301  if (--_imgRef->_refCount == 0)
302  doDelete=true;
303  }
304 
305  if (doDelete)
306  {
307  // Delete old image reference with associated image and options.
308  delete _imgRef;
309  _imgRef=0;
310  }
311 
312  // Use new image reference
313  _imgRef=image_._imgRef;
314  }
315 
316  return(*this);
317 }
318 
319 void Magick::Image::adjoin(const bool flag_)
320 {
321  modifyImage();
322  options()->adjoin(flag_);
323 }
324 
325 bool Magick::Image::adjoin(void) const
326 {
327  return(constOptions()->adjoin());
328 }
329 
330 void Magick::Image::antiAlias(const bool flag_)
331 {
332  modifyImage();
333  options()->antiAlias(flag_);
334 }
335 
336 bool Magick::Image::antiAlias(void) const
337 {
338  return(constOptions()->antiAlias());
339 }
340 
341 void Magick::Image::animationDelay(const size_t delay_)
342 {
343  modifyImage();
344  image()->delay=delay_;
345 }
346 
348 {
349  return(constImage()->delay);
350 }
351 
352 void Magick::Image::animationIterations(const size_t iterations_)
353 {
354  modifyImage();
355  image()->iterations=iterations_;
356 }
357 
359 {
360  return(constImage()->iterations);
361 }
362 
363 void Magick::Image::attenuate(const double attenuate_)
364 {
365  char
366  value[MaxTextExtent];
367 
368  modifyImage();
369  FormatLocaleString(value,MaxTextExtent,"%.20g",attenuate_);
370  (void) SetImageArtifact(image(),"attenuate",value);
371 }
372 
373 void Magick::Image::backgroundColor(const Color &backgroundColor_)
374 {
375  modifyImage();
376 
377  if (backgroundColor_.isValid())
378  image()->background_color=backgroundColor_;
379  else
380  image()->background_color=Color();
381 
382  options()->backgroundColor(backgroundColor_);
383 }
384 
386 {
387  return(constOptions()->backgroundColor());
388 }
389 
390 void Magick::Image::backgroundTexture(const std::string &backgroundTexture_)
391 {
392  modifyImage();
393  options()->backgroundTexture(backgroundTexture_);
394 }
395 
396 std::string Magick::Image::backgroundTexture(void) const
397 {
398  return(constOptions()->backgroundTexture());
399 }
400 
401 size_t Magick::Image::baseColumns(void) const
402 {
403  return(constImage()->magick_columns);
404 }
405 
406 std::string Magick::Image::baseFilename(void) const
407 {
408  return(std::string(constImage()->magick_filename));
409 }
410 
411 size_t Magick::Image::baseRows(void) const
412 {
413  return(constImage()->magick_rows);
414 }
415 
417 {
418  image()->black_point_compensation=(MagickBooleanType) flag_;
419 }
420 
422 {
423  return(static_cast<bool>(constImage()->black_point_compensation));
424 }
425 
426 void Magick::Image::borderColor(const Color &borderColor_)
427 {
428  modifyImage();
429 
430  if (borderColor_.isValid())
431  image()->border_color=borderColor_;
432  else
433  image()->border_color=Color();
434 
435  options()->borderColor(borderColor_);
436 }
437 
439 {
440  return(constOptions()->borderColor());
441 }
442 
444 {
445  RectangleInfo
446  bbox;
447 
449  bbox=GetImageBoundingBox(constImage(),exceptionInfo);
451  return(Geometry(bbox));
452 }
453 
454 void Magick::Image::boxColor(const Color &boxColor_)
455 {
456  modifyImage();
457  options()->boxColor(boxColor_);
458 }
459 
461 {
462  return(constOptions()->boxColor());
463 }
464 
465 void Magick::Image::cacheThreshold(const size_t threshold_)
466 {
467  ResourceLimits::memory((MagickSizeType) threshold_);
468 }
469 
470 void Magick::Image::classType(const ClassType class_)
471 {
472  if (classType() == PseudoClass && class_ == DirectClass)
473  {
474  // Use SyncImage to synchronize the DirectClass pixels with the
475  // color map and then set to DirectClass type.
476  modifyImage();
477  SyncImage(image());
478  image()->colormap=(PixelPacket *)RelinquishMagickMemory(
479  image()->colormap);
480  image()->storage_class=static_cast<MagickCore::ClassType>(DirectClass);
481  }
482  else if (classType() == DirectClass && class_ == PseudoClass)
483  {
484  // Quantize to create PseudoClass color map
485  modifyImage();
486  quantizeColors(MaxColormapSize);
487  quantize();
488  image()->storage_class=static_cast<MagickCore::ClassType>(PseudoClass);
489  }
490 }
491 
493 {
494  modifyImage();
495 
496  if (clipMask_.isValid())
497  SetImageClipMask(image(),clipMask_.constImage());
498  else
499  SetImageClipMask(image(),0);
500 }
501 
503 {
505  *image;
506 
508  image=GetImageClipMask(constImage(),exceptionInfo);
510 
511  if (image == (MagickCore::Image *) NULL)
512  return(Magick::Image());
513  else
514  return(Magick::Image(image));
515 }
516 
517 void Magick::Image::colorFuzz(const double fuzz_)
518 {
519  modifyImage();
520  image()->fuzz=fuzz_;
521  options()->colorFuzz(fuzz_);
522 }
523 
524 double Magick::Image::colorFuzz(void) const
525 {
526  return(constOptions()->colorFuzz());
527 }
528 
529 void Magick::Image::colorMapSize(const size_t entries_)
530 {
531  if (entries_ > MaxColormapSize)
532  throwExceptionExplicit(OptionError,
533  "Colormap entries must not exceed MaxColormapSize");
534 
535  modifyImage();
536  (void) AcquireImageColormap(image(),entries_);
537 }
538 
539 size_t Magick::Image::colorMapSize(void) const
540 {
541  if (!constImage()->colormap)
542  throwExceptionExplicit(OptionError,"Image does not contain a colormap");
543 
544  return(constImage()->colors);
545 }
546 
547 void Magick::Image::colorSpace(const ColorspaceType colorSpace_)
548 {
549  if (image()->colorspace == colorSpace_)
550  return;
551 
552  modifyImage();
553  TransformImageColorspace(image(),colorSpace_);
554  throwImageException();
555 }
556 
557 Magick::ColorspaceType Magick::Image::colorSpace(void) const
558 {
559  return(constImage()->colorspace);
560 }
561 
562 void Magick::Image::colorspaceType(const ColorspaceType colorSpace_)
563 {
564  modifyImage();
565  SetImageColorspace(image(),colorSpace_);
566  throwImageException();
567  options()->colorspaceType(colorSpace_);
568 }
569 
570 Magick::ColorspaceType Magick::Image::colorspaceType(void) const
571 {
572  return(constOptions()->colorspaceType());
573 }
574 
575 void Magick::Image::comment(const std::string &comment_)
576 {
577  modifyImage();
578  SetImageProperty(image(),"Comment",NULL);
579  if (comment_.length() > 0)
580  SetImageProperty(image(),"Comment",comment_.c_str());
581  throwImageException();
582 }
583 
584 std::string Magick::Image::comment(void) const
585 {
586  const char
587  *value;
588 
589  value=GetImageProperty(constImage(),"Comment");
590 
591  if (value)
592  return(std::string(value));
593 
594  return(std::string()); // Intentionally no exception
595 }
596 
597 void Magick::Image::compose(const CompositeOperator compose_)
598 {
599  image()->compose=compose_;
600 }
601 
602 Magick::CompositeOperator Magick::Image::compose(void) const
603 {
604  return(constImage()->compose);
605 }
606 
607 void Magick::Image::compressType(const CompressionType compressType_)
608 {
609  modifyImage();
610  image()->compression=compressType_;
611  options()->compressType(compressType_);
612 }
613 
614 Magick::CompressionType Magick::Image::compressType(void) const
615 {
616  return(constImage()->compression);
617 }
618 
619 void Magick::Image::debug(const bool flag_)
620 {
621  modifyImage();
622  options()->debug(flag_);
623 }
624 
625 bool Magick::Image::debug(void) const
626 {
627  return(constOptions()->debug());
628 }
629 
630 void Magick::Image::density(const Geometry &density_)
631 {
632  modifyImage();
633  options()->density(density_);
634  if (density_.isValid())
635  {
636  image()->x_resolution=density_.width();
637  if (density_.height() != 0)
638  image()->y_resolution=density_.height();
639  else
640  image()->y_resolution=density_.width();
641  }
642  else
643  {
644  // Reset to default
645  image()->x_resolution=0;
646  image()->y_resolution=0;
647  }
648 }
649 
651 {
652  if (isValid())
653  {
654  ssize_t
655  x_resolution=72,
656  y_resolution=72;
657 
658  if (constImage()->x_resolution > 0.0)
659  x_resolution=static_cast<ssize_t>(constImage()->x_resolution + 0.5);
660 
661  if (constImage()->y_resolution > 0.0)
662  y_resolution=static_cast<ssize_t>(constImage()->y_resolution + 0.5);
663 
664  return(Geometry(x_resolution,y_resolution));
665  }
666 
667  return(constOptions()->density());
668 }
669 
670 void Magick::Image::depth(const size_t depth_)
671 {
672  size_t
673  depth=depth_;
674 
675  if (depth > MAGICKCORE_QUANTUM_DEPTH)
676  depth=MAGICKCORE_QUANTUM_DEPTH;
677 
678  modifyImage();
679  image()->depth=depth;
680  options()->depth(depth);
681 }
682 
683 size_t Magick::Image::depth(void) const
684 {
685  return(constImage()->depth);
686 }
687 
688 std::string Magick::Image::directory(void) const
689 {
690  if (constImage()->directory)
691  return(std::string(constImage()->directory));
692 
693  throwExceptionExplicit(CorruptImageWarning,
694  "Image does not contain a directory");
695 
696  return(std::string());
697 }
698 
699 void Magick::Image::endian(const Magick::EndianType endian_)
700 {
701  modifyImage();
702  options()->endian(endian_);
703  image()->endian=endian_;
704 }
705 
706 Magick::EndianType Magick::Image::endian(void) const
707 {
708  return(constImage()->endian);
709 }
710 
711 void Magick::Image::exifProfile(const Magick::Blob &exifProfile_)
712 {
713  if (exifProfile_.data() != 0)
714  {
715  StringInfo
716  *exif_profile;
717 
718  modifyImage();
719  exif_profile=AcquireStringInfo(exifProfile_.length());
720  SetStringInfoDatum(exif_profile,(unsigned char *) exifProfile_.data());
721  (void) SetImageProfile(image(),"exif",exif_profile);
722  exif_profile=DestroyStringInfo(exif_profile);
723  }
724 }
725 
727 {
728  const StringInfo
729  *exif_profile;
730 
731  exif_profile=GetImageProfile(constImage(),"exif");
732  if (exif_profile == (StringInfo *) NULL)
733  return(Blob());
734 
735  return(Blob(GetStringInfoDatum(exif_profile),GetStringInfoLength(
736  exif_profile)));
737 }
738 
739 void Magick::Image::fileName(const std::string &fileName_)
740 {
741  modifyImage();
742 
743  fileName_.copy(image()->filename,sizeof(image()->filename)-1);
744  image()->filename[fileName_.length()]=0; // Null terminate
745 
746  options()->fileName(fileName_);
747 }
748 
749 std::string Magick::Image::fileName(void) const
750 {
751  return(constOptions()->fileName());
752 }
753 
754 off_t Magick::Image::fileSize(void) const
755 {
756  return((off_t) GetBlobSize(constImage()));
757 }
758 
760 {
761  modifyImage();
762  options()->fillColor(fillColor_);
763 }
764 
766 {
767  return(constOptions()->fillColor());
768 }
769 
770 void Magick::Image::fillRule(const Magick::FillRule &fillRule_)
771 {
772  modifyImage();
773  options()->fillRule(fillRule_);
774 }
775 
776 Magick::FillRule Magick::Image::fillRule(void) const
777 {
778  return(constOptions()->fillRule());
779 }
780 
781 void Magick::Image::fillPattern(const Image &fillPattern_)
782 {
783  modifyImage();
784  if(fillPattern_.isValid())
785  options()->fillPattern(fillPattern_.constImage());
786  else
787  options()->fillPattern(static_cast<MagickCore::Image*>(NULL));
788 }
789 
791 {
792  // FIXME: This is inordinately innefficient
793  const MagickCore::Image
794  *tmpTexture;
795 
796  Image
797  texture;
798 
799  tmpTexture=constOptions()->fillPattern();
800 
801  if(tmpTexture)
802  {
804  *image;
805 
807  image=CloneImage(tmpTexture,0,0,MagickTrue,exceptionInfo);
808  texture.replaceImage(image);
810  }
811 
812  return(texture);
813 }
814 
815 void Magick::Image::filterType(const Magick::FilterTypes filterType_)
816 {
817  modifyImage();
818  image()->filter=filterType_;
819 }
820 
821 Magick::FilterTypes Magick::Image::filterType(void) const
822 {
823  return(constImage()->filter);
824 }
825 
826 void Magick::Image::font(const std::string &font_)
827 {
828  modifyImage();
829  options()->font(font_);
830 }
831 
832 std::string Magick::Image::font(void) const
833 {
834  return(constOptions()->font());
835 }
836 
837 void Magick::Image::fontFamily(const std::string &family_)
838 {
839  modifyImage();
840  options()->fontFamily(family_);
841 }
842 
843 std::string Magick::Image::fontFamily(void) const
844 {
845  return(constOptions()->fontFamily());
846 }
847 
848 
849 void Magick::Image::fontPointsize(const double pointSize_)
850 {
851  modifyImage();
852  options()->fontPointsize(pointSize_);
853 }
854 
856 {
857  return(constOptions()->fontPointsize());
858 }
859 
860 std::string Magick::Image::format(void) const
861 {
862  const MagickInfo
863  *magick_info;
864 
866  magick_info=GetMagickInfo(constImage()->magick,exceptionInfo);
868 
869  if ((magick_info != 0) && (*magick_info->description != '\0'))
870  return(std::string(magick_info->description));
871 
872  throwExceptionExplicit(CorruptImageWarning,"Unrecognized image magick type");
873  return(std::string());
874 }
875 
876 void Magick::Image::fontStyle(const StyleType pointSize_)
877 {
878  modifyImage();
879  options()->fontStyle(pointSize_);
880 }
881 
882 Magick::StyleType Magick::Image::fontStyle(void) const
883 {
884  return(constOptions()->fontStyle());
885 }
886 
887 void Magick::Image::fontWeight(const size_t weight_)
888 {
889  modifyImage();
890  options()->fontWeight(weight_);
891 }
892 
893 size_t Magick::Image::fontWeight(void) const
894 {
895  return(constOptions()->fontWeight());
896 }
897 
898 
899 std::string Magick::Image::formatExpression(const std::string expression)
900 {
901  char
902  *text;
903 
904  std::string
905  text_string;
906 
907  modifyImage();
908  text=InterpretImageProperties(constImageInfo(),image(),expression.c_str());
909  if (text != (char *) NULL)
910  {
911  text_string=std::string(text);
912  text=DestroyString(text);
913  }
914  throwImageException();
915  return(text_string);
916 }
917 
918 double Magick::Image::gamma(void) const
919 {
920  return(constImage()->gamma);
921 }
922 
924 {
925  if (constImage()->geometry)
926  return(Geometry(constImage()->geometry));
927 
928  throwExceptionExplicit(OptionWarning,"Image does not contain a geometry");
929 
930  return(Geometry());
931 }
932 
933 void Magick::Image::gifDisposeMethod(const size_t disposeMethod_)
934 {
935  modifyImage();
936  image()->dispose=(DisposeType) disposeMethod_;
937 }
938 
940 {
941  // FIXME: It would be better to return an enumeration
942  return ((size_t) constImage()->dispose);
943 }
944 
946 {
947  std::string
948  value;
949 
950  value=color_;
951  artifact("highlight-color",value);
952 }
953 
955 {
956  profile("icc",colorProfile_);
957 }
958 
960 {
961  const StringInfo
962  *color_profile;
963 
964  color_profile=GetImageProfile(constImage(),"icc");
965  if (color_profile == (StringInfo *) NULL)
966  return Blob();
967 
968  return(Blob(GetStringInfoDatum(color_profile),GetStringInfoLength(
969  color_profile)));
970 }
971 
972 void Magick::Image::interlaceType(const InterlaceType interlace_)
973 {
974  modifyImage();
975  image()->interlace=interlace_;
976  options()->interlaceType(interlace_);
977 }
978 
979 Magick::InterlaceType Magick::Image::interlaceType(void) const
980 {
981  return constImage()->interlace;
982 }
983 
984 void Magick::Image::interpolate(const InterpolatePixelMethod interpolate_)
985 {
986  modifyImage();
987  image()->interpolate=interpolate_;
988 }
989 
990 Magick::InterpolatePixelMethod Magick::Image::interpolate(void) const
991 {
992  return constImage()->interpolate;
993 }
994 
995 void Magick::Image::iptcProfile(const Magick::Blob &iptcProfile_)
996 {
997  modifyImage();
998  if (iptcProfile_.data() != 0)
999  {
1000  StringInfo
1001  *iptc_profile;
1002 
1003  iptc_profile=AcquireStringInfo(iptcProfile_.length());
1004  SetStringInfoDatum(iptc_profile,(unsigned char *) iptcProfile_.data());
1005  (void) SetImageProfile(image(),"iptc",iptc_profile);
1006  iptc_profile=DestroyStringInfo(iptc_profile );
1007  }
1008 }
1009 
1011 {
1012  const StringInfo
1013  *iptc_profile;
1014 
1015  iptc_profile=GetImageProfile(constImage(),"iptc");
1016  if (iptc_profile == (StringInfo *) NULL)
1017  return(Blob());
1018  return(Blob(GetStringInfoDatum(iptc_profile),GetStringInfoLength(
1019  iptc_profile)));
1020 }
1021 
1022 bool Magick::Image::isOpaque(void) const
1023 {
1024  MagickBooleanType
1025  result;
1026 
1028  result=IsOpaqueImage(constImage(),exceptionInfo);
1030  return(result != MagickFalse ? true : false);
1031 }
1032 
1033 void Magick::Image::isValid(const bool isValid_)
1034 {
1035  if (!isValid_)
1036  {
1037  delete _imgRef;
1038  _imgRef = new ImageRef;
1039  }
1040  else if (!isValid())
1041  {
1042  // Construct with single-pixel black image to make
1043  // image valid. This is an obvious hack.
1044  size(Geometry(1,1));
1045  read("xc:black");
1046  }
1047 }
1048 
1049 bool Magick::Image::isValid(void) const
1050 {
1051  return(rows() && columns());
1052 }
1053 
1054 void Magick::Image::label(const std::string &label_)
1055 {
1056  modifyImage();
1057  (void) SetImageProperty(image(),"Label",NULL);
1058  if (label_.length() > 0)
1059  (void) SetImageProperty(image(),"Label",label_.c_str());
1060  throwImageException();
1061 }
1062 
1063 std::string Magick::Image::label(void) const
1064 {
1065  const char
1066  *value;
1067 
1068  value=GetImageProperty(constImage(),"Label");
1069 
1070  if (value)
1071  return(std::string(value));
1072 
1073  return(std::string());
1074 }
1075 
1077 {
1078  std::string
1079  value;
1080 
1081  value=color_;
1082  artifact("lowlight-color",value);
1083 }
1084 
1085 void Magick::Image::magick(const std::string &magick_)
1086 {
1087  size_t
1088  length;
1089 
1090  modifyImage();
1091 
1092  length=sizeof(image()->magick)-1;
1093  if (magick_.length() < length)
1094  length=magick_.length();
1095 
1096  if (!magick_.empty())
1097  magick_.copy(image()->magick,length);
1098  image()->magick[length]=0;
1099 
1100  options()->magick(magick_);
1101 }
1102 
1103 std::string Magick::Image::magick(void) const
1104 {
1105  if (*(constImage()->magick) != '\0')
1106  return(std::string(constImage()->magick));
1107 
1108  return(constOptions()->magick());
1109 }
1110 
1112 {
1113  modifyImage();
1114 
1115  if (mask_.isValid())
1116  SetImageMask(image(),mask_.constImage());
1117  else
1118  SetImageMask(image(),0);
1119 }
1120 
1122 {
1124  *image;
1125 
1127  image=GetImageMask(constImage(),exceptionInfo);
1129 
1130  if (image == (MagickCore::Image *) NULL)
1131  return(Magick::Image());
1132  else
1133  return(Magick::Image(image));
1134 }
1135 
1136 void Magick::Image::matte(const bool matteFlag_)
1137 {
1138  modifyImage();
1139 
1140  // If matte channel is requested, but image doesn't already have a
1141  // matte channel, then create an opaque matte channel. Likewise, if
1142  // the image already has a matte channel but a matte channel is not
1143  // desired, then set the matte channel to opaque.
1144  if ((matteFlag_ && !constImage()->matte) || (constImage()->matte &&
1145  !matteFlag_))
1146  SetImageOpacity(image(),OpaqueOpacity);
1147 
1148  image()->matte=(MagickBooleanType) matteFlag_;
1149 }
1150 
1151 bool Magick::Image::matte(void) const
1152 {
1153  if (constImage()->matte)
1154  return true;
1155  else
1156  return false;
1157 }
1158 
1159 void Magick::Image::matteColor(const Color &matteColor_)
1160 {
1161  modifyImage();
1162 
1163  if (matteColor_.isValid())
1164  {
1165  image()->matte_color=matteColor_;
1166  options()->matteColor(matteColor_);
1167  }
1168  else
1169  {
1170  // Set to default matte color
1171  Color
1172  tmpColor("#BDBDBD");
1173 
1174  image()->matte_color=tmpColor;
1175  options()->matteColor(tmpColor);
1176  }
1177 }
1178 
1180 {
1181  return(Color(constImage()->matte_color.red,constImage()->matte_color.green,
1182  constImage()->matte_color.blue));
1183 }
1184 
1186 {
1187  return(constImage()->error.mean_error_per_pixel);
1188 }
1189 
1190 void Magick::Image::modulusDepth(const size_t depth_)
1191 {
1192  modifyImage();
1193  SetImageDepth(image(),depth_);
1194  options()->depth(depth_);
1195 }
1196 
1198 {
1199  size_t
1200  depth;
1201 
1203  depth=GetImageDepth(constImage(),exceptionInfo);
1205  return(depth);
1206 }
1207 
1208 void Magick::Image::monochrome(const bool monochromeFlag_)
1209 {
1210  modifyImage();
1211  options()->monochrome(monochromeFlag_);
1212 }
1213 
1215 {
1216  return(constOptions()->monochrome());
1217 }
1218 
1220 {
1221  if (constImage()->montage)
1222  return(Magick::Geometry(constImage()->montage));
1223 
1224  throwExceptionExplicit(CorruptImageWarning,
1225  "Image does not contain a montage");
1226 
1227  return(Magick::Geometry());
1228 }
1229 
1231 {
1232  return(constImage()->error.normalized_maximum_error);
1233 }
1234 
1236 {
1237  return (constImage()->error.normalized_mean_error);
1238 }
1239 
1240 void Magick::Image::orientation(const Magick::OrientationType orientation_)
1241 {
1242  modifyImage();
1243  image()->orientation=orientation_;
1244 }
1245 
1246 Magick::OrientationType Magick::Image::orientation(void) const
1247 {
1248  return(constImage()->orientation);
1249 }
1250 
1252 {
1253  modifyImage();
1254  options()->page(pageSize_);
1255  image()->page=pageSize_;
1256 }
1257 
1259 {
1260  return(Geometry(constImage()->page.width,constImage()->page.height,
1261  AbsoluteValue(constImage()->page.x),AbsoluteValue(constImage()->page.y),
1262  constImage()->page.x < 0 ? true : false,
1263  constImage()->page.y < 0 ? true : false));
1264 }
1265 
1266 void Magick::Image::penColor(const Color &penColor_)
1267 {
1268  modifyImage();
1269  options()->fillColor(penColor_);
1270  options()->strokeColor(penColor_);
1271 }
1272 
1274 {
1275  return(constOptions()->fillColor());
1276 }
1277 
1278 void Magick::Image::penTexture(const Image &penTexture_)
1279 {
1280  modifyImage();
1281  if(penTexture_.isValid())
1282  options()->fillPattern(penTexture_.constImage());
1283  else
1284  options()->fillPattern(static_cast<MagickCore::Image*>(NULL));
1285 }
1286 
1288 {
1289  // FIXME: This is inordinately innefficient
1290  const MagickCore::Image
1291  *tmpTexture;
1292 
1293  Image
1294  texture;
1295 
1296  tmpTexture=constOptions()->fillPattern();
1297 
1298  if (tmpTexture)
1299  {
1301  *image;
1302 
1304  image=CloneImage(tmpTexture,0,0,MagickTrue,exceptionInfo);
1305  texture.replaceImage(image);
1307  }
1308  return(texture);
1309 }
1310 
1311 void Magick::Image::quality(const size_t quality_)
1312 {
1313  modifyImage();
1314  image()->quality=quality_;
1315  options()->quality(quality_);
1316 }
1317 
1318 size_t Magick::Image::quality(void) const
1319 {
1320  return(constImage()->quality);
1321 }
1322 
1323 void Magick::Image::quantizeColors(const size_t colors_)
1324 {
1325  modifyImage();
1326  options()->quantizeColors(colors_);
1327 }
1328 
1330 {
1331  return(constOptions()->quantizeColors());
1332 }
1333 
1335  const Magick::ColorspaceType colorSpace_)
1336 {
1337  modifyImage();
1338  options()->quantizeColorSpace(colorSpace_);
1339 }
1340 
1341 Magick::ColorspaceType Magick::Image::quantizeColorSpace(void) const
1342 {
1343  return(constOptions()->quantizeColorSpace());
1344 }
1345 
1346 void Magick::Image::quantizeDither(const bool ditherFlag_)
1347 {
1348  modifyImage();
1349  options()->quantizeDither(ditherFlag_);
1350 }
1351 
1353 {
1354  return(constOptions()->quantizeDither());
1355 }
1356 
1357 void Magick::Image::quantizeDitherMethod(const DitherMethod ditherMethod_)
1358 {
1359  modifyImage();
1360  options()->quantizeDitherMethod(ditherMethod_);
1361 }
1362 
1363 MagickCore::DitherMethod Magick::Image::quantizeDitherMethod(void) const
1364 {
1365  return(constOptions()->quantizeDitherMethod());
1366 }
1367 
1368 void Magick::Image::quantizeTreeDepth(const size_t treeDepth_)
1369 {
1370  modifyImage();
1371  options()->quantizeTreeDepth(treeDepth_);
1372 }
1373 
1375 {
1376  return(constOptions()->quantizeTreeDepth());
1377 }
1378 
1379 void Magick::Image::quiet(const bool quiet_)
1380 {
1381  modifyImage();
1382  options()->quiet(quiet_);
1383 }
1384 
1385 bool Magick::Image::quiet(void) const
1386 {
1387  return(constOptions()->quiet());
1388 }
1389 
1391  const Magick::RenderingIntent renderingIntent_)
1392 {
1393  modifyImage();
1394  image()->rendering_intent=renderingIntent_;
1395 }
1396 
1397 Magick::RenderingIntent Magick::Image::renderingIntent(void) const
1398 {
1399  return(static_cast<Magick::RenderingIntent>(
1400  constImage()->rendering_intent));
1401 }
1402 
1404  const Magick::ResolutionType resolutionUnits_)
1405 {
1406  modifyImage();
1407  image()->units=resolutionUnits_;
1408  options()->resolutionUnits(resolutionUnits_);
1409 }
1410 
1411 Magick::ResolutionType Magick::Image::resolutionUnits(void) const
1412 {
1413  return(static_cast<Magick::ResolutionType>(constImage()->units));
1414 }
1415 
1416 void Magick::Image::scene(const size_t scene_)
1417 {
1418  modifyImage();
1419  image()->scene=scene_;
1420 }
1421 
1422 size_t Magick::Image::scene(void) const
1423 {
1424  return(constImage()->scene);
1425 }
1426 
1427 void Magick::Image::size(const Geometry &geometry_)
1428 {
1429  modifyImage();
1430  options()->size(geometry_);
1431  image()->rows=geometry_.height();
1432  image()->columns=geometry_.width();
1433 }
1434 
1436 {
1437  return(Magick::Geometry(constImage()->columns,constImage()->rows));
1438 }
1439 
1440 void Magick::Image::strokeAntiAlias(const bool flag_)
1441 {
1442  modifyImage();
1443  options()->strokeAntiAlias(flag_);
1444 }
1445 
1447 {
1448  return(constOptions()->strokeAntiAlias());
1449 }
1450 
1452 {
1453  std::string
1454  value;
1455 
1456  modifyImage();
1457  options()->strokeColor(strokeColor_);
1458  value=strokeColor_;
1459  artifact("stroke",value);
1460 }
1461 
1463 {
1464  return(constOptions()->strokeColor());
1465 }
1466 
1467 void Magick::Image::strokeDashArray(const double *strokeDashArray_)
1468 {
1469  modifyImage();
1470  options()->strokeDashArray(strokeDashArray_);
1471 }
1472 
1473 const double *Magick::Image::strokeDashArray(void) const
1474 {
1475  return(constOptions()->strokeDashArray());
1476 }
1477 
1478 void Magick::Image::strokeDashOffset(const double strokeDashOffset_)
1479 {
1480  modifyImage();
1481  options()->strokeDashOffset(strokeDashOffset_);
1482 }
1483 
1485 {
1486  return(constOptions()->strokeDashOffset());
1487 }
1488 
1489 void Magick::Image::strokeLineCap(const Magick::LineCap lineCap_)
1490 {
1491  modifyImage();
1492  options()->strokeLineCap(lineCap_);
1493 }
1494 
1495 Magick::LineCap Magick::Image::strokeLineCap(void) const
1496 {
1497  return(constOptions()->strokeLineCap());
1498 }
1499 
1500 void Magick::Image::strokeLineJoin(const Magick::LineJoin lineJoin_)
1501 {
1502  modifyImage();
1503  options()->strokeLineJoin(lineJoin_);
1504 }
1505 
1506 Magick::LineJoin Magick::Image::strokeLineJoin(void) const
1507 {
1508  return(constOptions()->strokeLineJoin());
1509 }
1510 
1511 void Magick::Image::strokeMiterLimit(const size_t strokeMiterLimit_)
1512 {
1513  modifyImage();
1514  options()->strokeMiterLimit(strokeMiterLimit_);
1515 }
1516 
1518 {
1519  return constOptions()->strokeMiterLimit();
1520 }
1521 
1522 void Magick::Image::strokePattern(const Image &strokePattern_)
1523 {
1524  modifyImage();
1525  if(strokePattern_.isValid())
1526  options()->strokePattern(strokePattern_.constImage());
1527  else
1528  options()->strokePattern(static_cast<MagickCore::Image*>(NULL));
1529 }
1530 
1532 {
1533  const MagickCore::Image
1534  *tmpTexture;
1535 
1536  Image
1537  texture;
1538 
1539  tmpTexture=constOptions()->strokePattern();
1540 
1541  if (tmpTexture)
1542  {
1544  *image;
1545 
1547  image=CloneImage(tmpTexture,0,0,MagickTrue,exceptionInfo);
1548  texture.replaceImage(image);
1550  }
1551  return(texture);
1552 }
1553 
1554 void Magick::Image::strokeWidth(const double strokeWidth_)
1555 {
1556  char
1557  value[MaxTextExtent];
1558 
1559  modifyImage();
1560  options()->strokeWidth(strokeWidth_);
1561  FormatLocaleString(value,MaxTextExtent,"%.20g",strokeWidth_);
1562  (void) SetImageArtifact(image(),"strokewidth",value);
1563 }
1564 
1565 double Magick::Image::strokeWidth(void) const
1566 {
1567  return(constOptions()->strokeWidth());
1568 }
1569 
1570 void Magick::Image::subImage(const size_t subImage_)
1571 {
1572  modifyImage();
1573  options()->subImage(subImage_);
1574 }
1575 
1576 size_t Magick::Image::subImage(void) const
1577 {
1578  return(constOptions()->subImage());
1579 }
1580 
1581 void Magick::Image::subRange(const size_t subRange_)
1582 {
1583  modifyImage();
1584  options()->subRange(subRange_);
1585 }
1586 
1587 size_t Magick::Image::subRange(void) const
1588 {
1589  return(constOptions()->subRange());
1590 }
1591 
1592 void Magick::Image::textDirection(DirectionType direction_)
1593 {
1594  modifyImage();
1595  options()->textDirection(direction_);
1596 }
1597 
1598 Magick::DirectionType Magick::Image::textDirection(void) const
1599 {
1600  return(constOptions()->textDirection());
1601 }
1602 
1603 void Magick::Image::textEncoding(const std::string &encoding_)
1604 {
1605  modifyImage();
1606  options()->textEncoding(encoding_);
1607 }
1608 
1609 std::string Magick::Image::textEncoding(void) const
1610 {
1611  return(constOptions()->textEncoding());
1612 }
1613 
1614 void Magick::Image::textGravity(GravityType gravity_)
1615 {
1616  modifyImage();
1617  options()->textGravity(gravity_);
1618 }
1619 
1620 Magick::GravityType Magick::Image::textGravity(void) const
1621 {
1622  return(constOptions()->textGravity());
1623 }
1624 
1626 {
1627  modifyImage();
1628  options()->textInterlineSpacing(spacing_);
1629 }
1630 
1632 {
1633  return(constOptions()->textInterlineSpacing());
1634 }
1635 
1637 {
1638  modifyImage();
1639  options()->textInterwordSpacing(spacing_);
1640 }
1641 
1643 {
1644  return(constOptions()->textInterwordSpacing());
1645 }
1646 
1647 void Magick::Image::textKerning(double kerning_)
1648 {
1649  modifyImage();
1650  options()->textKerning(kerning_);
1651 }
1652 
1653 double Magick::Image::textKerning(void) const
1654 {
1655  return(constOptions()->textKerning());
1656 }
1657 
1658 void Magick::Image::textUnderColor(const Color &underColor_)
1659 {
1660  modifyImage();
1661  options()->textUnderColor(underColor_);
1662 }
1663 
1665 {
1666  return(constOptions()->textUnderColor());
1667 }
1668 
1669 void Magick::Image::tileName(const std::string &tileName_)
1670 {
1671  modifyImage();
1672  options()->tileName(tileName_);
1673 }
1674 
1675 std::string Magick::Image::tileName(void) const
1676 {
1677  return(constOptions()->tileName());
1678 }
1679 
1680 size_t Magick::Image::totalColors(void) const
1681 {
1682  size_t
1683  colors;
1684 
1686  colors=GetNumberColors(constImage(),0,exceptionInfo);
1688  return(colors);
1689 }
1690 
1691 void Magick::Image::transformRotation(const double angle_)
1692 {
1693  modifyImage();
1694  options()->transformRotation(angle_);
1695 }
1696 
1697 void Magick::Image::transformSkewX(const double skewx_)
1698 {
1699  modifyImage();
1700  options()->transformSkewX(skewx_);
1701 }
1702 
1703 void Magick::Image::transformSkewY(const double skewy_)
1704 {
1705  modifyImage();
1706  options()->transformSkewY(skewy_);
1707 }
1708 
1709 void Magick::Image::type(const Magick::ImageType type_)
1710 {
1711  modifyImage();
1712  options()->type(type_);
1713  SetImageType(image(),type_);
1714 }
1715 
1716 Magick::ImageType Magick::Image::type(void) const
1717 {
1718  if (constOptions()->type() != UndefinedType)
1719  return(constOptions()->type());
1720  else if (constImage()->type != UndefinedType)
1721  return(constImage()->type);
1722  else
1723  return(determineType());
1724 }
1725 
1726 void Magick::Image::verbose(const bool verboseFlag_)
1727 {
1728  modifyImage();
1729  options()->verbose(verboseFlag_);
1730 }
1731 
1732 bool Magick::Image::verbose(void) const
1733 {
1734  return(constOptions()->verbose());
1735 }
1736 
1737 void Magick::Image::view(const std::string &view_)
1738 {
1739  modifyImage();
1740  options()->view(view_);
1741 }
1742 
1743 std::string Magick::Image::view(void) const
1744 {
1745  return(constOptions()->view());
1746 }
1747 
1749  const VirtualPixelMethod virtual_pixel_method_)
1750 {
1751  modifyImage();
1752  SetImageVirtualPixelMethod(image(),virtual_pixel_method_);
1753  options()->virtualPixelMethod(virtual_pixel_method_);
1754 }
1755 
1756 Magick::VirtualPixelMethod Magick::Image::virtualPixelMethod(void) const
1757 {
1758  return(GetImageVirtualPixelMethod(constImage()));
1759 }
1760 
1761 void Magick::Image::x11Display(const std::string &display_)
1762 {
1763  modifyImage();
1764  options()->x11Display(display_);
1765 }
1766 
1767 std::string Magick::Image::x11Display(void) const
1768 {
1769  return(constOptions()->x11Display());
1770 }
1771 
1772 double Magick::Image::xResolution(void) const
1773 {
1774  return(constImage()->x_resolution);
1775 }
1776 
1777 double Magick::Image::yResolution(void) const
1778 {
1779  return(constImage()->y_resolution);
1780 }
1781 
1782 void Magick::Image::adaptiveBlur(const double radius_,const double sigma_)
1783 {
1785  *newImage;
1786 
1788  newImage=AdaptiveBlurImage(constImage(),radius_,sigma_,exceptionInfo);
1789  replaceImage(newImage);
1791 }
1792 
1794 {
1796  *newImage;
1797 
1798  size_t
1799  width=columns(),
1800  height=rows();
1801 
1802  ssize_t
1803  x=0,
1804  y=0;
1805 
1806  ParseMetaGeometry(static_cast<std::string>(geometry_).c_str(),&x,&y,&width,
1807  &height);
1808 
1810  newImage=AdaptiveResizeImage(constImage(),width,height,exceptionInfo);
1811  replaceImage(newImage);
1813 }
1814 
1815 void Magick::Image::adaptiveSharpen(const double radius_,const double sigma_)
1816 {
1818  *newImage;
1819 
1821  newImage=AdaptiveSharpenImage(constImage(),radius_,sigma_,exceptionInfo);
1822  replaceImage(newImage);
1824 }
1825 
1826 void Magick::Image::adaptiveSharpenChannel(const ChannelType channel_,
1827  const double radius_,const double sigma_)
1828 {
1830  *newImage;
1831 
1833  newImage=AdaptiveSharpenImageChannel(constImage(),channel_,radius_,sigma_,
1834  exceptionInfo);
1835  replaceImage(newImage);
1837 }
1838 
1839 void Magick::Image::adaptiveThreshold(const size_t width_,const size_t height_,
1840  const ssize_t offset_)
1841 {
1843  *newImage;
1844 
1846  newImage=AdaptiveThresholdImage(constImage(),width_,height_,offset_,
1847  exceptionInfo);
1848  replaceImage(newImage);
1850 }
1851 
1852 void Magick::Image::addNoise(const NoiseType noiseType_)
1853 {
1855  *newImage;
1856 
1858  newImage=AddNoiseImage(constImage(),noiseType_,exceptionInfo);
1859  replaceImage(newImage);
1861 }
1862 
1863 void Magick::Image::addNoiseChannel(const ChannelType channel_,
1864  const NoiseType noiseType_)
1865 {
1867  *newImage;
1868 
1870  newImage=AddNoiseImageChannel(constImage(),channel_,noiseType_,
1871  exceptionInfo);
1872  replaceImage(newImage);
1874 }
1875 
1877 {
1878  AffineMatrix
1879  _affine;
1880 
1882  *newImage;
1883 
1884  _affine.sx = affine_.sx();
1885  _affine.sy = affine_.sy();
1886  _affine.rx = affine_.rx();
1887  _affine.ry = affine_.ry();
1888  _affine.tx = affine_.tx();
1889  _affine.ty = affine_.ty();
1890 
1892  newImage=AffineTransformImage(constImage(),&_affine,exceptionInfo);
1893  replaceImage(newImage);
1895 }
1896 
1897 void Magick::Image::alphaChannel(AlphaChannelType alphaType_)
1898 {
1899  modifyImage();
1900  SetImageAlphaChannel(image(), alphaType_);
1901  throwImageException();
1902 }
1903 
1904 void Magick::Image::annotate(const std::string &text_,
1905  const Geometry &location_)
1906 {
1907  annotate(text_,location_,NorthWestGravity,0.0);
1908 }
1909 
1910 void Magick::Image::annotate(const std::string &text_,
1911  const Geometry &boundingArea_,const GravityType gravity_)
1912 {
1913  annotate(text_,boundingArea_,gravity_,0.0);
1914 }
1915 
1916 void Magick::Image::annotate(const std::string &text_,
1917  const Geometry &boundingArea_,const GravityType gravity_,
1918  const double degrees_)
1919 {
1920  AffineMatrix
1921  oaffine;
1922 
1923  char
1924  boundingArea[MaxTextExtent];
1925 
1926  DrawInfo
1927  *drawInfo;
1928 
1929  modifyImage();
1930 
1931  drawInfo=options()->drawInfo();
1932  drawInfo->text=DestroyString(drawInfo->text);
1933  drawInfo->text=const_cast<char *>(text_.c_str());
1934  drawInfo->geometry=DestroyString(drawInfo->geometry);
1935 
1936  if (boundingArea_.isValid())
1937  {
1938  if (boundingArea_.width() == 0 || boundingArea_.height() == 0)
1939  {
1940  FormatLocaleString(boundingArea,MaxTextExtent,"%+.20g%+.20g",
1941  (double) boundingArea_.xOff(),(double) boundingArea_.yOff());
1942  }
1943  else
1944  {
1945  (void) CopyMagickString(boundingArea,
1946  std::string(boundingArea_).c_str(), MaxTextExtent);
1947  }
1948  drawInfo->geometry=boundingArea;
1949  }
1950 
1951  drawInfo->gravity=gravity_;
1952 
1953  oaffine=drawInfo->affine;
1954  if (degrees_ != 0.0)
1955  {
1956  AffineMatrix
1957  affine,
1958  current;
1959 
1960  affine.sx=1.0;
1961  affine.rx=0.0;
1962  affine.ry=0.0;
1963  affine.sy=1.0;
1964  affine.tx=0.0;
1965  affine.ty=0.0;
1966 
1967  current=drawInfo->affine;
1968  affine.sx=cos(DegreesToRadians(fmod(degrees_,360.0)));
1969  affine.rx=sin(DegreesToRadians(fmod(degrees_,360.0)));
1970  affine.ry=(-sin(DegreesToRadians(fmod(degrees_,360.0))));
1971  affine.sy=cos(DegreesToRadians(fmod(degrees_,360.0)));
1972 
1973  drawInfo->affine.sx=current.sx*affine.sx+current.ry*affine.rx;
1974  drawInfo->affine.rx=current.rx*affine.sx+current.sy*affine.rx;
1975  drawInfo->affine.ry=current.sx*affine.ry+current.ry*affine.sy;
1976  drawInfo->affine.sy=current.rx*affine.ry+current.sy*affine.sy;
1977  drawInfo->affine.tx=current.sx*affine.tx+current.ry*affine.ty
1978  +current.tx;
1979  }
1980 
1981  AnnotateImage(image(),drawInfo);
1982 
1983  // Restore original values
1984  drawInfo->affine=oaffine;
1985  drawInfo->text=(char *) NULL;
1986  drawInfo->geometry=(char *) NULL;
1987 
1988  throwImageException();
1989 }
1990 
1991 void Magick::Image::annotate(const std::string &text_,
1992  const GravityType gravity_)
1993 {
1994  DrawInfo
1995  *drawInfo;
1996 
1997  modifyImage();
1998 
1999  drawInfo=options()->drawInfo();
2000  drawInfo->text=DestroyString(drawInfo->text);
2001  drawInfo->text=const_cast<char *>(text_.c_str());
2002  drawInfo->gravity=gravity_;
2003 
2004  AnnotateImage(image(),drawInfo);
2005 
2006  drawInfo->gravity=NorthWestGravity;
2007  drawInfo->text=(char *) NULL;
2008 
2009  throwImageException();
2010 }
2011 
2012 void Magick::Image::artifact(const std::string &name_,
2013  const std::string &value_)
2014 {
2015  modifyImage();
2016  (void) SetImageArtifact(image(),name_.c_str(),value_.c_str());
2017 }
2018 
2019 std::string Magick::Image::artifact(const std::string &name_) const
2020 {
2021  const char
2022  *value;
2023 
2024  value=GetImageArtifact(constImage(),name_.c_str());
2025  if (value)
2026  return(std::string(value));
2027  return(std::string());
2028 }
2029 
2030 void Magick::Image::attribute(const std::string name_,const std::string value_)
2031 {
2032  modifyImage();
2033  SetImageProperty(image(),name_.c_str(),value_.c_str());
2034 }
2035 
2036 std::string Magick::Image::attribute(const std::string name_) const
2037 {
2038  const char
2039  *value;
2040 
2041  value=GetImageProperty(constImage(),name_.c_str());
2042 
2043  if (value)
2044  return(std::string(value));
2045 
2046  return(std::string()); // Intentionally no exception
2047 }
2048 
2050 {
2051  modifyImage();
2052  (void) AutoGammaImage(image());
2053  throwImageException();
2054 }
2055 
2056 void Magick::Image::autoGammaChannel(const ChannelType channel_)
2057 {
2058  modifyImage();
2059  (void) AutoGammaImageChannel(image(),channel_);
2060  throwImageException();
2061 }
2062 
2064 {
2065  modifyImage();
2066  (void) AutoLevelImage(image());
2067  throwImageException();
2068 }
2069 
2070 void Magick::Image::autoLevelChannel(const ChannelType channel_)
2071 {
2072  modifyImage();
2073  (void) AutoLevelImageChannel(image(),channel_);
2074  throwImageException();
2075 }
2076 
2078 {
2080  *newImage;
2081 
2082  if (image()->orientation == UndefinedOrientation ||
2083  image()->orientation == TopLeftOrientation)
2084  return;
2085 
2087  newImage=AutoOrientImage(constImage(),image()->orientation,exceptionInfo);
2088  replaceImage(newImage);
2090 }
2091 
2092 void Magick::Image::blackThreshold(const std::string &threshold_)
2093 {
2094  modifyImage();
2095  BlackThresholdImage(image(),threshold_.c_str());
2096  throwImageException();
2097 }
2098 
2099 void Magick::Image::blackThresholdChannel(const ChannelType channel_,
2100  const std::string &threshold_)
2101 {
2102  modifyImage();
2104  BlackThresholdImageChannel(image(),channel_,threshold_.c_str(),
2105  exceptionInfo);
2107 }
2108 
2109 void Magick::Image::blueShift(const double factor_)
2110 {
2112  *newImage;
2113 
2115  newImage=BlueShiftImage(constImage(),factor_,exceptionInfo);
2116  replaceImage(newImage);
2118 }
2119 
2120 // Blur image
2121 void Magick::Image::blur(const double radius_, const double sigma_)
2122 {
2124  *newImage;
2125 
2127  newImage=BlurImage(constImage(),radius_,sigma_,exceptionInfo);
2128  replaceImage(newImage);
2130 }
2131 
2132 void Magick::Image::blurChannel(const ChannelType channel_,
2133  const double radius_,const double sigma_)
2134 {
2136  *newImage;
2137 
2139  newImage=BlurImageChannel(constImage(),channel_,radius_,sigma_,
2140  exceptionInfo);
2141  replaceImage(newImage);
2143 }
2144 
2145 void Magick::Image::border(const Geometry &geometry_)
2146 {
2148  *newImage;
2149 
2150  RectangleInfo
2151  borderInfo=geometry_;
2152 
2154  newImage=BorderImage(constImage(),&borderInfo,exceptionInfo);
2155  replaceImage(newImage);
2157 }
2158 
2159 void Magick::Image::brightnessContrast(const double brightness_,
2160  const double contrast_)
2161 {
2162  modifyImage();
2163  BrightnessContrastImage(image(),brightness_,contrast_);
2164  throwImageException();
2165 }
2166 
2167 void Magick::Image::brightnessContrastChannel(const ChannelType channel_,
2168  const double brightness_,const double contrast_)
2169 {
2170  modifyImage();
2171  BrightnessContrastImageChannel(image(),channel_,brightness_,contrast_);
2172  throwImageException();
2173 }
2174 
2175 void Magick::Image::cannyEdge(const double radius_,const double sigma_,
2176  const double lowerPercent_,const double upperPercent_)
2177 {
2179  *newImage;
2180 
2181  modifyImage();
2183  newImage=CannyEdgeImage(constImage(),radius_,sigma_,lowerPercent_,
2184  upperPercent_,exceptionInfo);
2185  replaceImage(newImage);
2187 }
2188 
2189 void Magick::Image::cdl(const std::string &cdl_)
2190 {
2191  modifyImage();
2192  (void) ColorDecisionListImage(image(),cdl_.c_str());
2193  throwImageException();
2194 }
2195 
2196 void Magick::Image::channel(const ChannelType channel_)
2197 {
2198  modifyImage();
2199  SeparateImageChannel(image(),channel_);
2200  throwImageException();
2201 }
2202 
2203 void Magick::Image::channelDepth(const ChannelType channel_,
2204  const size_t depth_)
2205 {
2206  modifyImage();
2207  SetImageChannelDepth(image(),channel_,depth_);
2208  throwImageException();
2209 }
2210 
2211 size_t Magick::Image::channelDepth(const ChannelType channel_)
2212 {
2213  size_t
2214  channel_depth;
2215 
2217  channel_depth=GetImageChannelDepth(constImage(), channel_,exceptionInfo);
2219  return channel_depth;
2220 }
2221 
2222 void Magick::Image::charcoal(const double radius_,const double sigma_)
2223 {
2225  *newImage;
2226 
2228  newImage=CharcoalImage(constImage(),radius_,sigma_,exceptionInfo);
2229  replaceImage(newImage);
2231 }
2232 
2233 void Magick::Image::chop(const Geometry &geometry_)
2234 {
2236  *newImage;
2237 
2238  RectangleInfo
2239  chopInfo=geometry_;
2240 
2242  newImage=ChopImage(constImage(),&chopInfo,exceptionInfo);
2243  replaceImage(newImage);
2245 }
2246 
2247 void Magick::Image::chromaBluePrimary(const double x_,const double y_)
2248 {
2249  modifyImage();
2250  image()->chromaticity.blue_primary.x=x_;
2251  image()->chromaticity.blue_primary.y=y_;
2252 }
2253 
2254 void Magick::Image::chromaBluePrimary(double *x_,double *y_) const
2255 {
2256  *x_=constImage()->chromaticity.blue_primary.x;
2257  *y_=constImage()->chromaticity.blue_primary.y;
2258 }
2259 
2260 void Magick::Image::chromaGreenPrimary(const double x_,const double y_)
2261 {
2262  modifyImage();
2263  image()->chromaticity.green_primary.x=x_;
2264  image()->chromaticity.green_primary.y=y_;
2265 }
2266 
2267 void Magick::Image::chromaGreenPrimary(double *x_,double *y_) const
2268 {
2269  *x_=constImage()->chromaticity.green_primary.x;
2270  *y_=constImage()->chromaticity.green_primary.y;
2271 }
2272 
2273 void Magick::Image::chromaRedPrimary(const double x_,const double y_)
2274 {
2275  modifyImage();
2276  image()->chromaticity.red_primary.x=x_;
2277  image()->chromaticity.red_primary.y=y_;
2278 }
2279 
2280 void Magick::Image::chromaRedPrimary(double *x_,double *y_) const
2281 {
2282  *x_=constImage()->chromaticity.red_primary.x;
2283  *y_=constImage()->chromaticity.red_primary.y;
2284 }
2285 
2286 void Magick::Image::chromaWhitePoint(const double x_,const double y_)
2287 {
2288  modifyImage();
2289  image()->chromaticity.white_point.x=x_;
2290  image()->chromaticity.white_point.y=y_;
2291 }
2292 
2293 void Magick::Image::chromaWhitePoint(double *x_,double *y_) const
2294 {
2295  *x_=constImage()->chromaticity.white_point.x;
2296  *y_=constImage()->chromaticity.white_point.y;
2297 }
2298 
2300 {
2301  modifyImage();
2302  ClampImage(image());
2303  throwImageException();
2304 }
2305 
2306 void Magick::Image::clampChannel(const ChannelType channel_)
2307 {
2308  modifyImage();
2309  ClampImageChannel(image(),channel_);
2310  throwImageException();
2311 }
2312 
2314 {
2315  modifyImage();
2316  ClipImage(image());
2317  throwImageException();
2318 }
2319 
2320 void Magick::Image::clipPath(const std::string pathname_,const bool inside_)
2321 {
2322  modifyImage();
2323  ClipImagePath(image(),pathname_.c_str(),(MagickBooleanType) inside_);
2324  throwImageException();
2325 }
2326 
2327 void Magick::Image::clut(const Image &clutImage_)
2328 {
2329  modifyImage();
2330  ClutImage(image(),clutImage_.constImage());
2331  throwImageException();
2332 }
2333 
2334 void Magick::Image::clutChannel(const ChannelType channel_,
2335  const Image &clutImage_)
2336 {
2337  modifyImage();
2338  ClutImageChannel(image(),channel_,clutImage_.constImage());
2339  throwImageException();
2340 }
2341 
2342 void Magick::Image::colorize(const unsigned int opacityRed_,
2343  const unsigned int opacityGreen_,const unsigned int opacityBlue_,
2344  const Color &penColor_)
2345 {
2346  char
2347  opacity[MaxTextExtent];
2348 
2350  *newImage;
2351 
2352  if (!penColor_.isValid())
2353  throwExceptionExplicit( OptionError, "Pen color argument is invalid" );
2354 
2355  FormatLocaleString(opacity,MaxTextExtent,"%u/%u/%u",opacityRed_,
2356  opacityGreen_,opacityBlue_);
2357 
2359  newImage=ColorizeImage(image(),opacity,penColor_,exceptionInfo);
2360  replaceImage(newImage);
2362 }
2363 
2364 void Magick::Image::colorize(const unsigned int opacity_,
2365  const Color &penColor_)
2366 {
2367  colorize(opacity_,opacity_,opacity_,penColor_);
2368 }
2369 
2370 void Magick::Image::colorMap(const size_t index_,const Color &color_)
2371 {
2372  if (index_ > (MaxColormapSize-1) )
2373  throwExceptionExplicit(OptionError,
2374  "Colormap index must be less than MaxColormapSize");
2375 
2376  if (!color_.isValid())
2377  throwExceptionExplicit(OptionError,"Color argument is invalid");
2378 
2379  modifyImage();
2380 
2381  // Ensure that colormap size is large enough
2382  if (colorMapSize() < (index_+1))
2383  colorMapSize(index_+1);
2384 
2385  // Set color at index in colormap
2386  (image()->colormap)[index_]=color_;
2387 }
2388 
2389 Magick::Color Magick::Image::colorMap(const size_t index_) const
2390 {
2391  if (!constImage()->colormap)
2392  {
2393  throwExceptionExplicit(OptionError,"Image does not contain a colormap");
2394  return(Color());
2395  }
2396 
2397  if (index_ > constImage()->colors-1)
2398  throwExceptionExplicit(OptionError,"Index out of range");
2399 
2400  return(Color((constImage()->colormap)[index_]));
2401 }
2402 
2403 void Magick::Image::colorMatrix(const size_t order_,
2404  const double *color_matrix_)
2405 {
2406  KernelInfo
2407  *kernel_info;
2408 
2410  *newImage;
2411 
2413 
2414  kernel_info=AcquireKernelInfo("1");
2415  if (kernel_info != (KernelInfo *) NULL)
2416  {
2417  kernel_info->width=order_;
2418  kernel_info->height=order_;
2419  kernel_info->values=(double *) color_matrix_;
2420  newImage=ColorMatrixImage(constImage(),kernel_info,exceptionInfo);
2421  kernel_info->values=(double *) NULL;
2422  kernel_info=DestroyKernelInfo(kernel_info);
2423  replaceImage(newImage);
2425  }
2426 }
2427 
2428 bool Magick::Image::compare(const Image &reference_)
2429 {
2430  bool
2431  status;
2432 
2433  Image
2434  ref=reference_;
2435 
2436  modifyImage();
2437  ref.modifyImage();
2438  status=static_cast<bool>(IsImagesEqual(image(),ref.constImage()));
2439  throwImageException();
2440  return(status);
2441 }
2442 
2443 double Magick::Image::compare(const Image &reference_,const MetricType metric_)
2444 {
2445  double
2446  distortion=0.0;
2447 
2449  GetImageDistortion(image(),reference_.constImage(),metric_,&distortion,
2450  exceptionInfo);
2452  return(distortion);
2453 }
2454 
2455 double Magick::Image::compareChannel(const ChannelType channel_,
2456  const Image &reference_,const MetricType metric_)
2457 {
2458  double
2459  distortion=0.0;
2460 
2462  GetImageChannelDistortion(image(),reference_.constImage(),channel_,metric_,
2463  &distortion,exceptionInfo);
2465  return(distortion);
2466 }
2467 
2469  const MetricType metric_,double *distortion)
2470 {
2472  *newImage;
2473 
2475  newImage=CompareImages(image(),reference_.constImage(),metric_,distortion,
2476  exceptionInfo);
2478  if (newImage == (MagickCore::Image *) NULL)
2479  return(Magick::Image());
2480  else
2481  return(Magick::Image(newImage));
2482 }
2483 
2485  const Image &reference_,const MetricType metric_,double *distortion)
2486 {
2488  *newImage;
2489 
2491  newImage=CompareImageChannels(image(),reference_.constImage(),channel_,
2492  metric_,distortion,exceptionInfo);
2494  if (newImage == (MagickCore::Image *) NULL)
2495  return(Magick::Image());
2496  else
2497  return(Magick::Image(newImage));
2498 }
2499 
2500 void Magick::Image::composite(const Image &compositeImage_,
2501  const Geometry &offset_,const CompositeOperator compose_)
2502 {
2503  size_t
2504  height=rows(),
2505  width=columns();
2506 
2507  ssize_t
2508  x=offset_.xOff(),
2509  y=offset_.yOff();
2510 
2511  modifyImage();
2512  ParseMetaGeometry(static_cast<std::string>(offset_).c_str(),&x,&y,&width,
2513  &height);
2514 
2515  CompositeImage(image(),compose_,compositeImage_.constImage(),x,y);
2516  throwImageException();
2517 }
2518 
2519 void Magick::Image::composite(const Image &compositeImage_,
2520  const GravityType gravity_,const CompositeOperator compose_)
2521 {
2522  RectangleInfo
2523  geometry;
2524 
2525  modifyImage();
2526 
2527  SetGeometry(compositeImage_.constImage(),&geometry);
2528  GravityAdjustGeometry(columns(),rows(),gravity_,&geometry);
2529 
2530  CompositeImage(image(),compose_,compositeImage_.constImage(),geometry.x,
2531  geometry.y);
2532  throwImageException();
2533 }
2534 
2535 void Magick::Image::composite(const Image &compositeImage_,
2536  const ssize_t xOffset_,const ssize_t yOffset_,
2537  const CompositeOperator compose_)
2538 {
2539  // Image supplied as compositeImage is composited with current image and
2540  // results in updating current image.
2541  modifyImage();
2542 
2543  CompositeImage(image(),compose_,compositeImage_.constImage(),xOffset_,
2544  yOffset_);
2545  throwImageException();
2546 }
2547 
2548 void Magick::Image::connectedComponents(const size_t connectivity_)
2549 {
2551  *newImage;
2552 
2554  newImage=ConnectedComponentsImage(constImage(),connectivity_,exceptionInfo);
2555  replaceImage(newImage);
2557 }
2558 
2559 void Magick::Image::contrast(const size_t sharpen_)
2560 {
2561  modifyImage();
2562  ContrastImage(image(),(MagickBooleanType) sharpen_);
2563  throwImageException();
2564 }
2565 
2566 void Magick::Image::contrastStretch(const double black_point_,
2567  const double white_point_)
2568 {
2569  modifyImage();
2570  ContrastStretchImageChannel(image(),DefaultChannels,black_point_,
2571  white_point_);
2572  throwImageException();
2573 }
2574 
2575 void Magick::Image::contrastStretchChannel(const ChannelType channel_,
2576  const double black_point_,const double white_point_)
2577 {
2578  modifyImage();
2579  ContrastStretchImageChannel(image(),channel_,black_point_,white_point_);
2580  throwImageException();
2581 }
2582 
2583 void Magick::Image::convolve(const size_t order_,const double *kernel_)
2584 {
2586  *newImage;
2587 
2589  newImage=ConvolveImage(constImage(),order_,kernel_,exceptionInfo);
2590  replaceImage(newImage);
2592 }
2593 
2594 void Magick::Image::copyPixels(const Image &source_,const Geometry &geometry_,
2595  const Offset &offset_)
2596 {
2597  const OffsetInfo
2598  offset=offset_;
2599 
2600  const RectangleInfo
2601  geometry=geometry_;
2602 
2604  (void) CopyImagePixels(image(),source_.constImage(),&geometry,&offset,
2605  exceptionInfo);
2607 }
2608 
2609 
2610 void Magick::Image::crop(const Geometry &geometry_)
2611 {
2613  *newImage;
2614 
2615  RectangleInfo
2616  cropInfo=geometry_;
2617 
2619  newImage=CropImage(constImage(),&cropInfo,exceptionInfo);
2620  replaceImage(newImage);
2622 }
2623 
2624 void Magick::Image::cycleColormap(const ssize_t amount_)
2625 {
2626  modifyImage();
2627  CycleColormapImage(image(),amount_);
2628  throwImageException();
2629 }
2630 
2631 void Magick::Image::decipher(const std::string &passphrase_)
2632 {
2633  modifyImage();
2635  DecipherImage(image(),passphrase_.c_str(),exceptionInfo);
2637 }
2638 
2639 void Magick::Image::defineSet(const std::string &magick_,
2640  const std::string &key_,bool flag_)
2641 {
2642  std::string
2643  definition;
2644 
2645  modifyImage();
2646  definition=magick_ + ":" + key_;
2647  if (flag_)
2648  (void) SetImageOption(imageInfo(),definition.c_str(),"");
2649  else
2650  DeleteImageOption(imageInfo(),definition.c_str());
2651 }
2652 
2653 bool Magick::Image::defineSet(const std::string &magick_,
2654  const std::string &key_) const
2655 {
2656  const char
2657  *option;
2658 
2659  std::string
2660  key;
2661 
2662  key=magick_ + ":" + key_;
2663  option=GetImageOption(constImageInfo(),key.c_str());
2664  if (option)
2665  return(true);
2666  return(false);
2667 }
2668 
2669 void Magick::Image::defineValue(const std::string &magick_,
2670  const std::string &key_,const std::string &value_)
2671 {
2672  std::string
2673  format;
2674 
2675  modifyImage();
2676  format=magick_ + ":" + key_;
2677  (void) SetImageOption(imageInfo(),format.c_str(),value_.c_str());
2678 }
2679 
2680 std::string Magick::Image::defineValue(const std::string &magick_,
2681  const std::string &key_) const
2682 {
2683  const char
2684  *option;
2685 
2686  std::string
2687  definition;
2688 
2689  definition=magick_ + ":" + key_;
2690  option=GetImageOption(constImageInfo(),definition.c_str());
2691  if (option)
2692  return(std::string(option));
2693  return(std::string());
2694 }
2695 
2696 void Magick::Image::deskew(const double threshold_)
2697 {
2699  *newImage;
2700 
2702  newImage=DeskewImage(constImage(),threshold_,exceptionInfo);
2703  replaceImage(newImage);
2705 }
2706 
2708 {
2710  *newImage;
2711 
2713  newImage=DespeckleImage(constImage(),exceptionInfo);
2714  replaceImage(newImage);
2716 }
2717 
2718 Magick::ImageType Magick::Image::determineType(void) const
2719 {
2720  ImageType
2721  image_type;
2722 
2724  image_type=GetImageType(constImage(),exceptionInfo);
2726  return(image_type);
2727 }
2728 
2730 {
2731  DisplayImages(imageInfo(),image());
2732 }
2733 
2734 void Magick::Image::distort(const DistortImageMethod method_,
2735  const size_t number_arguments_,const double *arguments_,const bool bestfit_)
2736 {
2738  *newImage;
2739 
2741  newImage=DistortImage(constImage(),method_,number_arguments_,arguments_,
2742  bestfit_ == true ? MagickTrue : MagickFalse,exceptionInfo);
2743  replaceImage(newImage);
2745 }
2746 
2748 {
2749  DrawingWand
2750  *wand;
2751 
2752  modifyImage();
2753 
2754  wand=AcquireDrawingWand(options()->drawInfo(),image());
2755 
2756  if(wand)
2757  {
2758  drawable_.operator()(wand);
2759 
2760  if (constImage()->exception.severity == UndefinedException)
2761  DrawRender(wand);
2762 
2763  wand=DestroyDrawingWand(wand);
2764  }
2765 
2766  throwImageException();
2767 }
2768 
2769 void Magick::Image::draw(const std::list<Magick::Drawable> &drawable_)
2770 {
2771  DrawingWand
2772  *wand;
2773 
2774  modifyImage();
2775 
2776  wand=AcquireDrawingWand(options()->drawInfo(),image());
2777 
2778  if(wand)
2779  {
2780  for (std::list<Magick::Drawable>::const_iterator p = drawable_.begin();
2781  p != drawable_.end(); p++)
2782  {
2783  p->operator()(wand);
2784  if (constImage()->exception.severity != UndefinedException)
2785  break;
2786  }
2787 
2788  if (constImage()->exception.severity == UndefinedException)
2789  DrawRender(wand);
2790 
2791  wand=DestroyDrawingWand(wand);
2792  }
2793 
2794  throwImageException();
2795 }
2796 
2797 void Magick::Image::edge(const double radius_)
2798 {
2800  *newImage;
2801 
2803  newImage=EdgeImage(constImage(),radius_,exceptionInfo);
2804  replaceImage(newImage);
2806 }
2807 
2808 void Magick::Image::emboss(const double radius_,const double sigma_)
2809 {
2811  *newImage;
2812 
2814  newImage=EmbossImage(constImage(),radius_,sigma_,exceptionInfo);
2815  replaceImage(newImage);
2817 }
2818 
2819 void Magick::Image::encipher(const std::string &passphrase_)
2820 {
2821  modifyImage();
2823  EncipherImage(image(),passphrase_.c_str(),exceptionInfo);
2825 }
2826 
2828 {
2830  *newImage;
2831 
2833  newImage=EnhanceImage(constImage(),exceptionInfo);
2834  replaceImage(newImage);
2836 }
2837 
2839 {
2840  modifyImage();
2841  EqualizeImage(image());
2842  throwImageException();
2843 }
2844 
2846 {
2847  modifyImage();
2848  (void) SetImageBackgroundColor(image());
2849  throwImageException();
2850 }
2851 
2852 void Magick::Image::extent(const Geometry &geometry_)
2853 {
2855  *newImage;
2856 
2857  RectangleInfo
2858  extentInfo;
2859 
2860  modifyImage();
2861 
2863  extentInfo=geometry_;
2864  extentInfo.x=geometry_.xOff();
2865  extentInfo.y=geometry_.yOff();
2866  newImage=ExtentImage(constImage(),&extentInfo,exceptionInfo);
2867  replaceImage(newImage);
2869 }
2870 
2871 void Magick::Image::extent(const Geometry &geometry_,
2872  const Color &backgroundColor_)
2873 {
2874  backgroundColor(backgroundColor_);
2875  extent(geometry_);
2876 }
2877 
2878 void Magick::Image::extent(const Geometry &geometry_,
2879  const Color &backgroundColor_,const GravityType gravity_)
2880 {
2881  image()->gravity=gravity_;
2882  backgroundColor(backgroundColor_);
2883  extent(geometry_,gravity_);
2884 }
2885 
2886 void Magick::Image::extent(const Geometry &geometry_,
2887  const GravityType gravity_)
2888 {
2889  RectangleInfo
2890  geometry;
2891 
2892  SetGeometry(image(),&geometry);
2893  geometry.width=geometry_.width();
2894  geometry.height=geometry_.height();
2895  GravityAdjustGeometry(image()->columns,image()->rows,gravity_,&geometry);
2896  extent(geometry);
2897 }
2898 
2900 {
2902  *newImage;
2903 
2905  newImage=FlipImage(constImage(),exceptionInfo);
2906  replaceImage(newImage);
2908 }
2909 
2911  const Magick::Color &fillColor_)
2912 {
2913  floodFillColor(point_.xOff(),point_.yOff(),fillColor_,false);
2914 }
2915 
2917  const Magick::Color &fillColor_,const bool invert_)
2918 {
2919  floodFillColor(point_.xOff(),point_.yOff(),fillColor_,invert_);
2920 }
2921 
2922 void Magick::Image::floodFillColor(const ssize_t x_,const ssize_t y_,
2923  const Magick::Color &fillColor_)
2924 {
2925  floodFillColor(x_,y_,fillColor_,false);
2926 }
2927 
2928 void Magick::Image::floodFillColor(const ssize_t x_,const ssize_t y_,
2929  const Magick::Color &fillColor_,const bool invert_)
2930 {
2931  PixelPacket
2932  pixel;
2933 
2934  modifyImage();
2935 
2936  pixel=pixelColor(x_,y_);
2937  floodFill(x_,y_,(Magick::Image *)NULL,fillColor_,&pixel,invert_);
2938 }
2939 
2941  const Magick::Color &fillColor_,const Magick::Color &borderColor_)
2942 {
2943  floodFillColor(point_.xOff(),point_.yOff(),fillColor_,borderColor_,false);
2944 }
2945 
2947  const Magick::Color &fillColor_,const Magick::Color &borderColor_,
2948  const bool invert_)
2949 {
2950  floodFillColor(point_.xOff(),point_.yOff(),fillColor_,borderColor_,invert_);
2951 }
2952 
2953 void Magick::Image::floodFillColor(const ssize_t x_,const ssize_t y_,
2954  const Magick::Color &fillColor_,const Magick::Color &borderColor_)
2955 {
2956  floodFillColor(x_,y_,fillColor_,borderColor_,false);
2957 }
2958 
2959 void Magick::Image::floodFillColor(const ssize_t x_,const ssize_t y_,
2960  const Magick::Color &fillColor_,const Magick::Color &borderColor_,
2961  const bool invert_)
2962 {
2963  PixelPacket
2964  pixel;
2965 
2966  modifyImage();
2967 
2968  pixel=static_cast<PixelPacket>(borderColor_);
2969  floodFill(x_,y_,(Magick::Image *)NULL,fillColor_,&pixel,invert_);
2970 }
2971 
2972 void Magick::Image::floodFillOpacity(const ssize_t x_,const ssize_t y_,
2973  const unsigned int opacity_,const bool invert_)
2974 {
2975  MagickPixelPacket
2976  target;
2977 
2978  PixelPacket
2979  pixel;
2980 
2981  modifyImage();
2982 
2983  GetMagickPixelPacket(constImage(),&target);
2984  pixel=static_cast<PixelPacket>(pixelColor(x_,y_));
2985  target.red=pixel.red;
2986  target.green=pixel.green;
2987  target.blue=pixel.blue;
2988  target.opacity=opacity_;
2989  (void) FloodfillPaintImage(image(),OpacityChannel,options()->drawInfo(),
2990  &target,x_,y_,(MagickBooleanType)invert_);
2991  throwImageException();
2992 }
2993 
2994 void Magick::Image::floodFillOpacity(const ssize_t x_,const ssize_t y_,
2995  const unsigned int opacity_,const PaintMethod method_)
2996 {
2997  floodFillOpacity(x_,y_,opacity_,method_ == FloodfillMethod ? false : true);
2998 }
2999 
3000 void Magick::Image::floodFillOpacity(const ::ssize_t x_,const ::ssize_t y_,
3001  const unsigned int opacity_,const Color &target_,const bool invert_)
3002 {
3003  MagickPixelPacket
3004  target;
3005 
3006  PixelPacket
3007  pixel;
3008 
3009  modifyImage();
3010 
3011  GetMagickPixelPacket(constImage(),&target);
3012  pixel=static_cast<PixelPacket>(target_);
3013  target.red=pixel.red;
3014  target.green=pixel.green;
3015  target.blue=pixel.blue;
3016  target.opacity=opacity_;
3017  (void) FloodfillPaintImage(image(),OpacityChannel,options()->drawInfo(),
3018  &target,x_,y_,(MagickBooleanType)invert_);
3019  throwImageException();
3020 }
3021 
3023  const Magick::Image &texture_)
3024 {
3025  floodFillTexture(point_.xOff(),point_.yOff(),texture_,false);
3026 }
3027 
3029  const Magick::Image &texture_,const bool invert_)
3030 {
3031  floodFillTexture(point_.xOff(),point_.yOff(),texture_,invert_);
3032 }
3033 
3034 void Magick::Image::floodFillTexture(const ssize_t x_,const ssize_t y_,
3035  const Magick::Image &texture_)
3036 {
3037  floodFillTexture(x_,y_,texture_,false);
3038 }
3039 
3040 void Magick::Image::floodFillTexture(const ssize_t x_,const ssize_t y_,
3041  const Magick::Image &texture_,const bool invert_)
3042 {
3043  PixelPacket
3044  pixel;
3045 
3046  modifyImage();
3047 
3048  pixel=static_cast<PixelPacket>(pixelColor(x_,y_));
3049  floodFill(x_,y_,&texture_,Magick::Color(),&pixel,invert_);
3050 }
3051 
3053  const Magick::Image &texture_,const Magick::Color &borderColor_)
3054 {
3055  floodFillTexture(point_.xOff(),point_.yOff(),texture_,borderColor_,false);
3056 }
3057 
3059  const Magick::Image &texture_,const Magick::Color &borderColor_,
3060  const bool invert_)
3061 {
3062  floodFillTexture(point_.xOff(),point_.yOff(),texture_,borderColor_,invert_);
3063 }
3064 
3065 void Magick::Image::floodFillTexture(const ssize_t x_,const ssize_t y_,
3066  const Magick::Image &texture_,const Magick::Color &borderColor_)
3067 {
3068  floodFillTexture(x_,y_,texture_,borderColor_,false);
3069 }
3070 
3071 void Magick::Image::floodFillTexture(const ssize_t x_,const ssize_t y_,
3072  const Magick::Image &texture_,const Magick::Color &borderColor_,
3073  const bool invert_)
3074 {
3075  PixelPacket
3076  pixel;
3077 
3078  modifyImage();
3079 
3080  pixel=static_cast<PixelPacket>(borderColor_);
3081  floodFill(x_,y_,&texture_,Magick::Color(),&pixel,invert_);
3082 }
3083 
3085 {
3087  *newImage;
3088 
3090  newImage=FlopImage(constImage(),exceptionInfo);
3091  replaceImage(newImage);
3093 }
3094 
3095 void Magick::Image::fontTypeMetrics(const std::string &text_,
3096  TypeMetric *metrics)
3097 {
3098  DrawInfo
3099  *drawInfo;
3100 
3101  drawInfo=options()->drawInfo();
3102  drawInfo->text=const_cast<char *>(text_.c_str());
3103  if (GetTypeMetrics(image(),drawInfo,&(metrics->_typeMetric)) == MagickFalse)
3104  throwImageException();
3105  drawInfo->text=0;
3106 }
3107 
3108 void Magick::Image::fontTypeMetricsMultiline(const std::string &text_,
3109  TypeMetric *metrics)
3110 {
3111  DrawInfo
3112  *drawInfo;
3113 
3114  drawInfo=options()->drawInfo();
3115  drawInfo->text=const_cast<char *>(text_.c_str());
3116  GetMultilineTypeMetrics(image(),drawInfo,&(metrics->_typeMetric));
3117  drawInfo->text=0;
3118 }
3119 
3120 void Magick::Image::frame(const Geometry &geometry_)
3121 {
3122  FrameInfo
3123  info;
3124 
3126  *newImage;
3127 
3128  info.x=static_cast<ssize_t>(geometry_.width());
3129  info.y=static_cast<ssize_t>(geometry_.height());
3130  info.width=columns() + ( static_cast<size_t>(info.x) << 1 );
3131  info.height=rows() + ( static_cast<size_t>(info.y) << 1 );
3132  info.outer_bevel=geometry_.xOff();
3133  info.inner_bevel=geometry_.yOff();
3134 
3136  newImage=FrameImage(constImage(),&info,exceptionInfo);
3137  replaceImage(newImage);
3139 }
3140 
3141 void Magick::Image::frame(const size_t width_,const size_t height_,
3142  const ssize_t innerBevel_,const ssize_t outerBevel_)
3143 {
3144  FrameInfo
3145  info;
3146 
3148  *newImage;
3149 
3150  info.x=static_cast<ssize_t>(width_);
3151  info.y=static_cast<ssize_t>(height_);
3152  info.width=columns() + ( static_cast<size_t>(info.x) << 1 );
3153  info.height=rows() + ( static_cast<size_t>(info.y) << 1 );
3154  info.outer_bevel=static_cast<ssize_t>(outerBevel_);
3155  info.inner_bevel=static_cast<ssize_t>(innerBevel_);
3156 
3158  newImage=FrameImage(constImage(),&info,exceptionInfo);
3159  replaceImage(newImage);
3161 }
3162 
3163 void Magick::Image::fx(const std::string expression)
3164 {
3166  *newImage;
3167 
3169  newImage=FxImageChannel(constImage(),DefaultChannels,expression.c_str(),
3170  exceptionInfo);
3171  replaceImage(newImage);
3173 }
3174 
3175 void Magick::Image::fx(const std::string expression,
3176  const Magick::ChannelType channel)
3177 {
3179  *newImage;
3180 
3182  newImage=FxImageChannel(constImage(),channel,expression.c_str(),
3183  exceptionInfo);
3184  replaceImage(newImage);
3186 }
3187 
3188 void Magick::Image::gamma(const double gamma_)
3189 {
3190  char
3191  gamma[MaxTextExtent + 1];
3192 
3193  FormatLocaleString(gamma,MaxTextExtent,"%3.6f",gamma_);
3194 
3195  modifyImage();
3196  GammaImage(image(),gamma);
3197 }
3198 
3199 void Magick::Image::gamma(const double gammaRed_,const double gammaGreen_,
3200  const double gammaBlue_)
3201 {
3202  char
3203  gamma[MaxTextExtent + 1];
3204 
3205  FormatLocaleString(gamma,MaxTextExtent,"%3.6f/%3.6f/%3.6f/",gammaRed_,
3206  gammaGreen_,gammaBlue_);
3207 
3208  modifyImage();
3209  GammaImage(image(),gamma);
3210  throwImageException();
3211 }
3212 
3213 void Magick::Image::gaussianBlur(const double width_,const double sigma_)
3214 {
3216  *newImage;
3217 
3219  newImage=GaussianBlurImage(constImage(),width_,sigma_,exceptionInfo);
3220  replaceImage(newImage);
3222 }
3223 
3224 void Magick::Image::gaussianBlurChannel(const ChannelType channel_,
3225  const double width_,const double sigma_)
3226 {
3228  *newImage;
3229 
3231  newImage=GaussianBlurImageChannel(constImage(),channel_,width_,sigma_,
3232  exceptionInfo);
3233  replaceImage(newImage);
3235 }
3236 
3237 const Magick::IndexPacket* Magick::Image::getConstIndexes(void) const
3238 {
3239  const Magick::IndexPacket
3240  *result;
3241 
3242  result=GetVirtualIndexQueue(constImage());
3243  if (!result)
3244  throwImageException();
3245 
3246  return(result);
3247 }
3248 
3249 const Magick::PixelPacket* Magick::Image::getConstPixels(const ssize_t x_,
3250  const ssize_t y_,const size_t columns_,const size_t rows_) const
3251 {
3252  const PixelPacket
3253  *result;
3254 
3256  result=GetVirtualPixels(constImage(),x_,y_,columns_,rows_,exceptionInfo);
3258  return(result);
3259 }
3260 
3261 Magick::IndexPacket *Magick::Image::getIndexes(void)
3262 {
3263  Magick::IndexPacket
3264  *result;
3265 
3266  result=GetAuthenticIndexQueue(image());
3267 
3268  if(!result)
3269  throwImageException();
3270 
3271  return(result);
3272 }
3273 
3274 Magick::PixelPacket *Magick::Image::getPixels(const ssize_t x_,
3275  const ssize_t y_,const size_t columns_,const size_t rows_)
3276 {
3277  PixelPacket
3278  *result;
3279 
3280  modifyImage();
3282  result=GetAuthenticPixels(image(),x_,y_,columns_,rows_,exceptionInfo);
3284  return(result);
3285 }
3286 
3287 void Magick::Image::grayscale(const PixelIntensityMethod method_)
3288 {
3289  modifyImage();
3290  (void) GrayscaleImage(image(),method_);
3291  throwImageException();
3292 }
3293 
3294 void Magick::Image::haldClut(const Image &clutImage_)
3295 {
3296  modifyImage();
3297  (void) HaldClutImage(image(),clutImage_.constImage());
3298  throwImageException();
3299 }
3300 
3301 void Magick::Image::houghLine(const size_t width_,const size_t height_,
3302  const size_t threshold_)
3303 {
3305  *newImage;
3306 
3308  newImage=HoughLineImage(constImage(),width_,height_,threshold_,
3309  exceptionInfo);
3310  replaceImage(newImage);
3312 }
3313 
3314 void Magick::Image::implode(const double factor_)
3315 {
3317  *newImage;
3318 
3320  newImage=ImplodeImage(constImage(),factor_,exceptionInfo);
3321  replaceImage(newImage);
3323 }
3324 
3326 {
3327  inverseFourierTransform(phase_,true);
3328 }
3329 
3331  const bool magnitude_)
3332 {
3334  *newImage;
3335 
3337  newImage=InverseFourierTransformImage(constImage(),phase_.constImage(),
3338  magnitude_ == true ? MagickTrue : MagickFalse,exceptionInfo);
3339  replaceImage(newImage);
3341 }
3342 
3343 void Magick::Image::kuwahara(const double radius_,const double sigma_)
3344 {
3346  *newImage;
3347 
3349  newImage=KuwaharaImage(constImage(),radius_,sigma_,exceptionInfo);
3350  replaceImage(newImage);
3352 }
3353 
3354 void Magick::Image::kuwaharaChannel(const ChannelType channel_,
3355  const double radius_,const double sigma_)
3356 {
3358  *newImage;
3359 
3361  newImage=KuwaharaImageChannel(constImage(),channel_,radius_,sigma_,
3362  exceptionInfo);
3363  replaceImage(newImage);
3365 }
3366 
3367 void Magick::Image::level(const double black_point,const double white_point,
3368  const double gamma)
3369 {
3370  char
3371  levels[MaxTextExtent];
3372 
3373  modifyImage();
3374  FormatLocaleString(levels,MaxTextExtent,"%g,%g,%g",black_point,white_point,
3375  gamma);
3376  (void) LevelImage(image(),levels);
3377  throwImageException();
3378 }
3379 
3380 void Magick::Image::levelChannel(const Magick::ChannelType channel,
3381  const double black_point,const double white_point,const double gamma)
3382 {
3383  modifyImage();
3384  (void) LevelImageChannel(image(),channel,black_point,white_point,gamma);
3385  throwImageException();
3386 }
3387 
3388 void Magick::Image::levelColors(const Color &blackColor_,
3389  const Color &whiteColor_,const bool invert_)
3390 {
3391  MagickPixelPacket
3392  black,
3393  white;
3394 
3395  PixelPacket
3396  pixel;
3397 
3398  modifyImage();
3399 
3400  GetMagickPixelPacket(image(),&black);
3401  pixel=static_cast<PixelPacket>(blackColor_);
3402  black.red=pixel.red;
3403  black.green=pixel.green;
3404  black.blue=pixel.blue;
3405  black.opacity=pixel.opacity;
3406 
3407  GetMagickPixelPacket(image(),&white);
3408  pixel=static_cast<PixelPacket>(whiteColor_);
3409  white.red=pixel.red;
3410  white.green=pixel.green;
3411  white.blue=pixel.blue;
3412  white.opacity=pixel.opacity;
3413 
3414  (void) LevelColorsImage(image(),&black,&white,
3415  invert_ == true ? MagickTrue : MagickFalse);
3416  throwImageException();
3417 }
3418 
3419 void Magick::Image::levelColorsChannel(const ChannelType channel_,
3420  const Color &blackColor_,const Color &whiteColor_,const bool invert_)
3421 {
3422  MagickPixelPacket
3423  black,
3424  white;
3425 
3426  PixelPacket
3427  pixel;
3428 
3429  modifyImage();
3430 
3431  GetMagickPixelPacket(image(),&black);
3432  pixel=static_cast<PixelPacket>(blackColor_);
3433  black.red=pixel.red;
3434  black.green=pixel.green;
3435  black.blue=pixel.blue;
3436  black.opacity=pixel.opacity;
3437 
3438  GetMagickPixelPacket(image(),&white);
3439  pixel=static_cast<PixelPacket>(whiteColor_);
3440  white.red=pixel.red;
3441  white.green=pixel.green;
3442  white.blue=pixel.blue;
3443  white.opacity=pixel.opacity;
3444 
3445  (void) LevelColorsImageChannel(image(),channel_,&black,&white,
3446  invert_ == true ? MagickTrue : MagickFalse);
3447  throwImageException();
3448 }
3449 
3450 void Magick::Image::levelize(const double blackPoint_,const double whitePoint_,
3451  const double gamma_)
3452 {
3453  modifyImage();
3454  (void) LevelizeImage(image(),blackPoint_,whitePoint_,gamma_);
3455  throwImageException();
3456 }
3457 
3458 void Magick::Image::levelizeChannel(const ChannelType channel_,
3459  const double blackPoint_,const double whitePoint_,const double gamma_)
3460 {
3461  modifyImage();
3462  (void) LevelizeImageChannel(image(),channel_,blackPoint_,whitePoint_,gamma_);
3463  throwImageException();
3464 }
3465 
3466 void Magick::Image::linearStretch(const double blackPoint_,
3467  const double whitePoint_)
3468 {
3469  modifyImage();
3470  LinearStretchImage(image(),blackPoint_,whitePoint_);
3471  throwImageException();
3472 }
3473 
3475 {
3477  *newImage;
3478 
3479  size_t
3480  height=rows(),
3481  width=columns();
3482 
3483  ssize_t
3484  x=0,
3485  y=0;
3486 
3487  ParseMetaGeometry(static_cast<std::string>(geometry_).c_str(),&x,&y,&width,
3488  &height);
3489 
3491  newImage=LiquidRescaleImage(constImage(),width,height,x,y,exceptionInfo);
3492  replaceImage(newImage);
3494 }
3495 
3496 void Magick::Image::localContrast(const double radius_,const double strength_)
3497 {
3499  *newImage;
3500 
3502  newImage=LocalContrastImage(constImage(),radius_,strength_,exceptionInfo);
3503  replaceImage(newImage);
3505 }
3506 
3508 {
3510  *newImage;
3511 
3513  newImage=MagnifyImage(constImage(),exceptionInfo);
3514  replaceImage(newImage);
3516 }
3517 
3518 void Magick::Image::map(const Image &mapImage_,const bool dither_)
3519 {
3520  modifyImage();
3521  options()->quantizeDither(dither_);
3522  RemapImage(options()->quantizeInfo(),image(),mapImage_.constImage());
3523  throwImageException();
3524 }
3525 
3527  const unsigned int opacity_,const ssize_t x_,const ssize_t y_,
3528  const Magick::PaintMethod method_)
3529 {
3530  floodFillOpacity(x_,y_,opacity_,target_,
3531  method_ == FloodfillMethod ? false : true);
3532 }
3533 
3534 void Magick::Image::medianFilter(const double radius_)
3535 {
3537  *newImage;
3538 
3540  newImage=StatisticImage(constImage(),MedianStatistic,(size_t) radius_,
3541  (size_t) radius_,exceptionInfo);
3542  replaceImage(newImage);
3544 }
3545 
3546 void Magick::Image::mergeLayers(const ImageLayerMethod layerMethod_)
3547 {
3549  *newImage;
3550 
3552  newImage=MergeImageLayers(image(),layerMethod_,exceptionInfo);
3553  replaceImage(newImage);
3555 }
3556 
3558 {
3560  *newImage;
3561 
3563  newImage=MinifyImage(constImage(),exceptionInfo);
3564  replaceImage(newImage);
3566 }
3567 
3568 void Magick::Image::modulate(const double brightness_,const double saturation_,
3569  const double hue_)
3570 {
3571  char
3572  modulate[MaxTextExtent + 1];
3573 
3574  FormatLocaleString(modulate,MaxTextExtent,"%3.6f,%3.6f,%3.6f",brightness_,
3575  saturation_,hue_);
3576 
3577  modifyImage();
3578  ModulateImage(image(),modulate);
3579  throwImageException();
3580 }
3581 
3583 {
3584  return(ImageMoments(*this));
3585 }
3586 
3587 void Magick::Image::morphology(const MorphologyMethod method_,
3588  const std::string kernel_,const ssize_t iterations_)
3589 {
3590  KernelInfo
3591  *kernel;
3592 
3594  *newImage;
3595 
3596  kernel=AcquireKernelInfo(kernel_.c_str());
3597  if (kernel == (KernelInfo *)NULL)
3598  throwExceptionExplicit(OptionError,"Unable to parse kernel.");
3599 
3601  newImage=MorphologyImage(constImage(),method_,iterations_,kernel,
3602  exceptionInfo);
3603  replaceImage(newImage);
3604  kernel=DestroyKernelInfo(kernel);
3606 }
3607 
3608 void Magick::Image::morphology(const MorphologyMethod method_,
3609  const KernelInfoType kernel_,const std::string arguments_,
3610  const ssize_t iterations_)
3611 {
3612  const char
3613  *option;
3614 
3615  std::string
3616  kernel;
3617 
3618  option=CommandOptionToMnemonic(MagickKernelOptions,kernel_);
3619  if (option == (const char *)NULL)
3620  {
3621  throwExceptionExplicit(OptionError,"Unable to determine kernel type.");
3622  return;
3623  }
3624 
3625  kernel=std::string(option);
3626  if (!arguments_.empty())
3627  kernel+=":"+arguments_;
3628 
3629  morphology(method_,kernel,iterations_);
3630 }
3631 
3632 void Magick::Image::morphologyChannel(const ChannelType channel_,
3633  const MorphologyMethod method_,const std::string kernel_,
3634  const ssize_t iterations_)
3635 {
3636  KernelInfo
3637  *kernel;
3638 
3640  *newImage;
3641 
3642  kernel=AcquireKernelInfo(kernel_.c_str());
3643  if (kernel == (KernelInfo *)NULL)
3644  {
3645  throwExceptionExplicit(OptionError,"Unable to parse kernel.");
3646  return;
3647  }
3648 
3650  newImage=MorphologyImageChannel(constImage(),channel_,method_,iterations_,
3651  kernel,exceptionInfo);
3652  replaceImage(newImage);
3653  kernel=DestroyKernelInfo(kernel);
3655 }
3656 
3657 void Magick::Image::morphologyChannel(const ChannelType channel_,
3658  const MorphologyMethod method_,const KernelInfoType kernel_,
3659  const std::string arguments_,const ssize_t iterations_)
3660 {
3661  const char
3662  *option;
3663 
3664  std::string
3665  kernel;
3666 
3667  option=CommandOptionToMnemonic(MagickKernelOptions,kernel_);
3668  if (option == (const char *)NULL)
3669  throwExceptionExplicit(OptionError,"Unable to determine kernel type.");
3670 
3671  kernel=std::string(option);
3672  if (!arguments_.empty())
3673  kernel+=":"+arguments_;
3674 
3675  morphologyChannel(channel_,method_,kernel,iterations_);
3676 }
3677 
3678 void Magick::Image::motionBlur(const double radius_,const double sigma_,
3679  const double angle_)
3680 {
3682  *newImage;
3683 
3685  newImage=MotionBlurImage(constImage(),radius_,sigma_,angle_,exceptionInfo);
3686  replaceImage(newImage);
3688 }
3689 
3690 void Magick::Image::negate(const bool grayscale_)
3691 {
3692  modifyImage();
3693  NegateImage(image(),(MagickBooleanType) grayscale_);
3694  throwImageException();
3695 }
3696 
3697 void Magick::Image::negateChannel(const ChannelType channel_,
3698  const bool grayscale_)
3699 {
3700  modifyImage();
3701  NegateImageChannel(image(),channel_,(MagickBooleanType) grayscale_);
3702  throwImageException();
3703 }
3704 
3706 {
3707  modifyImage();
3708  NormalizeImage(image());
3709  throwImageException();
3710 }
3711 
3712 void Magick::Image::oilPaint(const double radius_)
3713 {
3715  *newImage;
3716 
3718  newImage=OilPaintImage(constImage(),radius_,exceptionInfo);
3719  replaceImage(newImage);
3721 }
3722 
3723 void Magick::Image::opacity(const unsigned int opacity_)
3724 {
3725  modifyImage();
3726  SetImageOpacity(image(),opacity_);
3727 }
3728 void Magick::Image::opaque(const Color &opaqueColor_,const Color &penColor_,
3729  const bool invert_)
3730 {
3731  MagickPixelPacket
3732  opaque,
3733  pen;
3734 
3735  std::string
3736  opaqueColor,
3737  penColor;
3738 
3739  if (!opaqueColor_.isValid())
3740  throwExceptionExplicit(OptionError,"Opaque color argument is invalid");
3741 
3742  if (!penColor_.isValid())
3743  throwExceptionExplicit(OptionError,"Pen color argument is invalid");
3744 
3745  opaqueColor=opaqueColor_;
3746  penColor=penColor_;
3747 
3748  (void) QueryMagickColor(opaqueColor.c_str(),&opaque,&image()->exception);
3749  (void) QueryMagickColor(penColor.c_str(),&pen,&image()->exception);
3750  modifyImage();
3751  OpaquePaintImage(image(),&opaque,&pen,invert_ ? MagickTrue : MagickFalse);
3752  throwImageException();
3753 }
3754 
3755 void Magick::Image::orderedDither(std::string thresholdMap_)
3756 {
3757  modifyImage();
3759  (void) OrderedPosterizeImage(image(),thresholdMap_.c_str(),exceptionInfo);
3761 }
3762 
3763 void Magick::Image::orderedDitherChannel(const ChannelType channel_,
3764  std::string thresholdMap_)
3765 {
3766  modifyImage();
3768  (void) OrderedPosterizeImageChannel(image(),channel_,thresholdMap_.c_str(),
3769  exceptionInfo);
3771 }
3772 
3773 void Magick::Image::perceptible(const double epsilon_)
3774 {
3775  modifyImage();
3776  PerceptibleImage(image(),epsilon_);
3777  throwImageException();
3778 }
3779 
3780 void Magick::Image::perceptibleChannel(const ChannelType channel_,
3781  const double epsilon_)
3782 {
3783  modifyImage();
3784  PerceptibleImageChannel(image(),channel_,epsilon_);
3785  throwImageException();
3786 }
3787 
3788 void Magick::Image::ping(const Blob& blob_)
3789 {
3791  *newImage;
3792 
3794  newImage=PingBlob(imageInfo(),blob_.data(),blob_.length(),exceptionInfo);
3795  read(newImage,exceptionInfo);
3796 }
3797 
3798 void Magick::Image::ping(const std::string &imageSpec_)
3799 {
3801  *newImage;
3802 
3804  options()->fileName(imageSpec_);
3805  newImage=PingImage(imageInfo(),exceptionInfo);
3806  read(newImage,exceptionInfo);
3807 }
3808 
3809 void Magick::Image::pixelColor(const ssize_t x_,const ssize_t y_,
3810  const Color &color_)
3811 {
3812  // Test arguments to ensure they are within the image.
3813  if (y_ > (ssize_t) rows() || x_ > (ssize_t) columns())
3814  throwExceptionExplicit(OptionError,"Access outside of image boundary");
3815 
3816  modifyImage();
3817 
3818  // Set image to DirectClass
3819  classType(DirectClass);
3820 
3821  // Get pixel view
3822  Pixels pixels(*this);
3823  // Set pixel value
3824  *(pixels.get(x_,y_,1,1))=color_;
3825  // Tell ImageMagick that pixels have been updated
3826  pixels.sync();
3827 }
3828 
3829 Magick::Color Magick::Image::pixelColor(const ssize_t x_,
3830  const ssize_t y_) const
3831 {
3832  ClassType
3833  storage_class;
3834 
3835  storage_class=classType();
3836  if (storage_class == DirectClass)
3837  {
3838  const PixelPacket
3839  *pixel;
3840 
3841  pixel=getConstPixels(x_,y_,1,1);
3842  if (pixel)
3843  return(Color(*pixel));
3844  }
3845  else if (storage_class == PseudoClass)
3846  {
3847  const IndexPacket
3848  *indexes;
3849 
3850  indexes=getConstIndexes();
3851  if(indexes)
3852  return(colorMap((size_t) *indexes));
3853  }
3854 
3855  return(Color()); // invalid
3856 }
3857 
3858 void Magick::Image::polaroid(const std::string &caption_,const double angle_)
3859 {
3861  *newImage;
3862 
3864  (void) SetImageProperty(image(),"Caption",caption_.c_str());
3865  newImage=PolaroidImage(constImage(),options()->drawInfo(),angle_,
3866  exceptionInfo);
3867  replaceImage(newImage);
3869 }
3870 
3871 void Magick::Image::posterize(const size_t levels_,const bool dither_)
3872 {
3873  modifyImage();
3874  PosterizeImage(image(),levels_,(MagickBooleanType) dither_);
3875  throwImageException();
3876 }
3877 
3878 void Magick::Image::posterizeChannel(const ChannelType channel_,
3879  const size_t levels_,const bool dither_)
3880 {
3881  modifyImage();
3882  PosterizeImageChannel(image(),channel_,levels_,
3883  (MagickBooleanType) dither_);
3884  throwImageException();
3885 }
3886 
3887 void Magick::Image::process(std::string name_,const ssize_t argc,
3888  const char **argv)
3889 {
3890  size_t
3891  status;
3892 
3893  modifyImage();
3894 
3895  status=InvokeDynamicImageFilter(name_.c_str(),&image(),argc, argv,
3896  &image()->exception);
3897 
3898  if (status == false)
3899  throwImageException();
3900 }
3901 
3902 void Magick::Image::profile(const std::string name_,
3903  const Magick::Blob &profile_)
3904 {
3905  ssize_t
3906  result;
3907 
3908  modifyImage();
3909  result=ProfileImage(image(),name_.c_str(),(unsigned char *)profile_.data(),
3910  profile_.length(),MagickTrue);
3911 
3912  if (!result)
3913  throwImageException();
3914 }
3915 
3916 Magick::Blob Magick::Image::profile(const std::string name_) const
3917 {
3918  const StringInfo
3919  *profile;
3920 
3921  profile=GetImageProfile(constImage(),name_.c_str());
3922 
3923  if (profile == (StringInfo *) NULL)
3924  return(Blob());
3925  return(Blob((void*) GetStringInfoDatum(profile),GetStringInfoLength(
3926  profile)));
3927 }
3928 
3929 void Magick::Image::quantize(const bool measureError_)
3930 {
3931  modifyImage();
3932 
3933  if (measureError_)
3934  options()->quantizeInfo()->measure_error=MagickTrue;
3935  else
3936  options()->quantizeInfo()->measure_error=MagickFalse;
3937 
3938  QuantizeImage(options()->quantizeInfo(),image());
3939 
3940  throwImageException();
3941 }
3942 
3943 void Magick::Image::quantumOperator(const ChannelType channel_,
3944  const MagickEvaluateOperator operator_,double rvalue_)
3945 {
3947  EvaluateImageChannel(image(),channel_,operator_,rvalue_,exceptionInfo);
3949 }
3950 
3951 void Magick::Image::quantumOperator(const ChannelType channel_,
3952  const MagickFunction function_,const size_t number_parameters_,
3953  const double *parameters_)
3954 {
3956  FunctionImageChannel(image(),channel_,function_,number_parameters_,
3957  parameters_,exceptionInfo);
3959 }
3960 
3961 void Magick::Image::quantumOperator(const ssize_t x_,const ssize_t y_,
3962  const size_t columns_,const size_t rows_,const ChannelType channel_,
3963  const MagickEvaluateOperator operator_,const double rvalue_)
3964 {
3966  *cropImage;
3967 
3968  RectangleInfo
3969  geometry;
3970 
3972  geometry.width=columns_;
3973  geometry.height=rows_;
3974  geometry.x=x_;
3975  geometry.y=y_;
3976  cropImage=CropImage(image(),&geometry,exceptionInfo);
3977  EvaluateImageChannel(cropImage,channel_,operator_,rvalue_,exceptionInfo);
3978  (void) CompositeImage(image(),image()->matte != MagickFalse ?
3979  OverCompositeOp : CopyCompositeOp,cropImage,geometry.x, geometry.y);
3980  cropImage=DestroyImageList(cropImage);
3982 }
3983 
3984 void Magick::Image::raise(const Geometry &geometry_,const bool raisedFlag_)
3985 {
3986  RectangleInfo
3987  raiseInfo;
3988 
3989  raiseInfo=geometry_;
3990  modifyImage();
3991  RaiseImage(image(),&raiseInfo,raisedFlag_ == true ?
3992  MagickTrue : MagickFalse);
3993  throwImageException();
3994 }
3995 
3996 void Magick::Image::randomThreshold( const Geometry &thresholds_ )
3997 {
3999  modifyImage();
4000  (void) RandomThresholdImage(image(),static_cast<std::string>(
4001  thresholds_).c_str(),exceptionInfo);
4003 }
4004 
4006  const ChannelType channel_)
4007 {
4009  modifyImage();
4010  (void) RandomThresholdImageChannel(image(),channel_,static_cast<std::string>(
4011  thresholds_).c_str(),exceptionInfo);
4013 }
4014 
4015 void Magick::Image::read(const Blob &blob_)
4016 {
4018  *newImage;
4019 
4021  newImage=BlobToImage(imageInfo(),static_cast<const void *>(blob_.data()),
4022  blob_.length(),exceptionInfo);
4023  read(newImage,exceptionInfo);
4024 }
4025 
4026 void Magick::Image::read(const Blob &blob_,const Geometry &size_)
4027 {
4028  size(size_);
4029  read(blob_);
4030 }
4031 
4032 void Magick::Image::read(const Blob &blob_,const Geometry &size_,
4033  const size_t depth_)
4034 {
4035  size(size_);
4036  depth(depth_);
4037  read(blob_);
4038 }
4039 
4040 void Magick::Image::read(const Blob &blob_,const Geometry &size_,
4041  const size_t depth_,const std::string &magick_)
4042 {
4043  size(size_);
4044  depth(depth_);
4045  magick(magick_);
4046  fileName(magick_ + ':');
4047  read(blob_);
4048 }
4049 
4050 void Magick::Image::read(const Blob &blob_,const Geometry &size_,
4051  const std::string &magick_)
4052 {
4053  size(size_);
4054  magick(magick_);
4055  fileName(magick_ + ':');
4056  read(blob_);
4057 }
4058 
4059 void Magick::Image::read(const Geometry &size_,const std::string &imageSpec_)
4060 {
4061  size(size_);
4062  read(imageSpec_);
4063 }
4064 
4065 void Magick::Image::read(const size_t width_,const size_t height_,
4066  const std::string &map_,const StorageType type_,const void *pixels_)
4067 {
4069  *newImage;
4070 
4072  newImage=ConstituteImage(width_,height_,map_.c_str(),type_,pixels_,
4073  exceptionInfo);
4074  replaceImage(newImage);
4076  if (newImage)
4077  throwException(&newImage->exception,quiet());
4078 }
4079 
4080 void Magick::Image::read(const std::string &imageSpec_)
4081 {
4083  *newImage;
4084 
4085  options()->fileName(imageSpec_);
4086 
4088  newImage=ReadImage(imageInfo(),exceptionInfo);
4089  read(newImage,exceptionInfo);
4090 }
4091 
4092 void Magick::Image::readPixels(const Magick::QuantumType quantum_,
4093  const unsigned char *source_)
4094 {
4095  QuantumInfo
4096  *quantum_info;
4097 
4099  quantum_info=AcquireQuantumInfo(imageInfo(),image());
4100  ImportQuantumPixels(image(),(MagickCore::CacheView *) NULL,quantum_info,
4101  quantum_,source_,exceptionInfo);
4102  quantum_info=DestroyQuantumInfo(quantum_info);
4104 }
4105 
4106 void Magick::Image::reduceNoise(const double order_)
4107 {
4109  *newImage;
4110 
4112  newImage=StatisticImage(constImage(),NonpeakStatistic,(size_t) order_,
4113  (size_t) order_,exceptionInfo);
4114  replaceImage(newImage);
4116 }
4117 
4119 {
4120  modifyImage();
4121  options()->page(Geometry());
4122  image()->page.width = 0;
4123  image()->page.height = 0;
4124  image()->page.x = 0;
4125  image()->page.y = 0;
4126 }
4127 
4128 void Magick::Image::resample(const Geometry &geometry_)
4129 {
4131  *newImage;
4132 
4133  size_t
4134  width=columns(),
4135  height=rows();
4136 
4137  ssize_t
4138  x=0,
4139  y=0;
4140 
4141  ParseMetaGeometry(static_cast<std::string>(geometry_).c_str(),&x, &y,&width,
4142  &height);
4143 
4145  newImage=ResampleImage(constImage(),width,height,image()->filter,1.0,
4146  exceptionInfo);
4147  replaceImage(newImage);
4149 }
4150 
4151 void Magick::Image::resize(const Geometry &geometry_)
4152 {
4154  *newImage;
4155 
4156  size_t
4157  width=columns(),
4158  height=rows();
4159 
4160  ssize_t
4161  x=0,
4162  y=0;
4163 
4164  ParseMetaGeometry(static_cast<std::string>(geometry_).c_str(),&x, &y,&width,
4165  &height);
4166 
4168  newImage=ResizeImage(constImage(),width,height,image()->filter,1.0,
4169  exceptionInfo);
4170  replaceImage(newImage);
4172 }
4173 
4174 void Magick::Image::roll(const Geometry &roll_)
4175 {
4177  *newImage;
4178 
4179  ssize_t
4180  xOff=roll_.xOff(),
4181  yOff=roll_.yOff();
4182 
4183  if (roll_.xNegative())
4184  xOff=0-xOff;
4185  if (roll_.yNegative())
4186  yOff=0-yOff;
4187 
4189  newImage=RollImage(constImage(),xOff,yOff,exceptionInfo);
4190  replaceImage(newImage);
4192 }
4193 
4194 void Magick::Image::roll(const size_t columns_,const size_t rows_)
4195 {
4197  *newImage;
4198 
4200  newImage=RollImage(constImage(),static_cast<ssize_t>(columns_),
4201  static_cast<ssize_t>(rows_),exceptionInfo);
4202  replaceImage(newImage);
4204 }
4205 
4206 void Magick::Image::rotate(const double degrees_)
4207 {
4209  *newImage;
4210 
4212  newImage=RotateImage(constImage(),degrees_,exceptionInfo);
4213  replaceImage(newImage);
4215 }
4216 
4217 void Magick::Image::rotationalBlur(const double angle_)
4218 {
4220  *newImage;
4221 
4223  newImage=RotationalBlurImage(constImage(),angle_,exceptionInfo);
4224  replaceImage(newImage);
4226 }
4227 
4228 void Magick::Image::rotationalBlurChannel(const ChannelType channel_,
4229  const double angle_)
4230 {
4232  *newImage;
4233 
4235  newImage=RotationalBlurImageChannel(constImage(),channel_,angle_,
4236  exceptionInfo);
4237  replaceImage(newImage);
4239 }
4240 
4241 void Magick::Image::sample(const Geometry &geometry_)
4242 {
4244  *newImage;
4245 
4246  size_t
4247  height=rows(),
4248  width=columns();
4249 
4250  ssize_t
4251  x=0,
4252  y=0;
4253 
4254  ParseMetaGeometry(static_cast<std::string>(geometry_).c_str(),&x,&y,&width,
4255  &height);
4256 
4258  newImage=SampleImage(constImage(),width,height,exceptionInfo);
4259  replaceImage(newImage);
4261 }
4262 
4263 void Magick::Image::scale(const Geometry &geometry_)
4264 {
4266  *newImage;
4267 
4268  size_t
4269  height=rows(),
4270  width=columns();
4271 
4272  ssize_t
4273  x=0,
4274  y=0;
4275 
4276  ParseMetaGeometry(static_cast<std::string>(geometry_).c_str(),&x,&y,&width,
4277  &height);
4278 
4280  newImage=ScaleImage(constImage(),width,height,exceptionInfo);
4281  replaceImage(newImage);
4283 }
4284 
4285 void Magick::Image::segment(const double clusterThreshold_,
4286  const double smoothingThreshold_)
4287 {
4288  modifyImage();
4289  SegmentImage(image(),options()->quantizeColorSpace(),
4290  (MagickBooleanType) options()->verbose(),clusterThreshold_,
4291  smoothingThreshold_);
4292  throwImageException();
4293  SyncImage(image());
4294  throwImageException();
4295 }
4296 
4297 void Magick::Image::selectiveBlur(const double radius_,const double sigma_,
4298  const double threshold_)
4299 {
4301  *newImage;
4302 
4304  newImage=SelectiveBlurImage(constImage(),radius_,sigma_,threshold_,
4305  exceptionInfo);
4306  replaceImage(newImage);
4308 }
4309 
4310 void Magick::Image::selectiveBlurChannel(const ChannelType channel_,
4311  const double radius_,const double sigma_,const double threshold_)
4312 {
4314  *newImage;
4315 
4317  newImage=SelectiveBlurImageChannel(constImage(),channel_,radius_,sigma_,
4318  threshold_,exceptionInfo);
4319  replaceImage(newImage);
4321 }
4322 
4323 Magick::Image Magick::Image::separate(const ChannelType channel_) const
4324 {
4326  *image;
4327 
4329  image=SeparateImage(constImage(),channel_,exceptionInfo);
4331  if (image == (MagickCore::Image *) NULL)
4332  return(Magick::Image());
4333  else
4334  return(Magick::Image(image));
4335 }
4336 
4337 void Magick::Image::sepiaTone(const double threshold_)
4338 {
4340  *newImage;
4341 
4343  newImage=SepiaToneImage(constImage(),threshold_,exceptionInfo);
4344  replaceImage(newImage);
4346 }
4347 
4348 Magick::PixelPacket *Magick::Image::setPixels(const ssize_t x_,
4349  const ssize_t y_,const size_t columns_,const size_t rows_)
4350 {
4351  PixelPacket
4352  *result;
4353 
4354  modifyImage();
4356  result=QueueAuthenticPixels(image(),x_, y_,columns_,rows_,exceptionInfo);
4358  return(result);
4359 }
4360 
4361 void Magick::Image::shade(const double azimuth_,const double elevation_,
4362  const bool colorShading_)
4363 {
4365  *newImage;
4366 
4368  newImage=ShadeImage(constImage(),colorShading_ == true ?
4369  MagickTrue : MagickFalse,azimuth_,elevation_,exceptionInfo);
4370  replaceImage(newImage);
4372 }
4373 
4374 void Magick::Image::shadow(const double percent_opacity_,const double sigma_,
4375  const ssize_t x_,const ssize_t y_)
4376 {
4378  *newImage;
4379 
4381  newImage=ShadowImage(constImage(),percent_opacity_,sigma_,x_,y_,exceptionInfo);
4382  replaceImage(newImage);
4384 }
4385 
4386 void Magick::Image::sharpen(const double radius_,const double sigma_)
4387 {
4389  *newImage;
4390 
4392  newImage=SharpenImage(constImage(),radius_,sigma_,exceptionInfo);
4393  replaceImage(newImage);
4395 }
4396 
4397 void Magick::Image::sharpenChannel(const ChannelType channel_,
4398  const double radius_,const double sigma_)
4399 {
4401  *newImage;
4402 
4404  newImage=SharpenImageChannel(constImage(),channel_,radius_,sigma_,
4405  exceptionInfo);
4406  replaceImage(newImage);
4408 }
4409 
4410 void Magick::Image::shave(const Geometry &geometry_)
4411 {
4413  *newImage;
4414 
4415  RectangleInfo
4416  shaveInfo=geometry_;
4417 
4419  newImage=ShaveImage(constImage(),&shaveInfo,exceptionInfo);
4420  replaceImage(newImage);
4422 }
4423 
4424 void Magick::Image::shear(const double xShearAngle_,const double yShearAngle_)
4425 {
4427  *newImage;
4428 
4430  newImage=ShearImage(constImage(),xShearAngle_,yShearAngle_,exceptionInfo);
4431  replaceImage(newImage);
4433 }
4434 
4435 void Magick::Image::sigmoidalContrast(const size_t sharpen_,
4436  const double contrast,const double midpoint)
4437 {
4438  modifyImage();
4439  (void) SigmoidalContrastImageChannel(image(),DefaultChannels,
4440  (MagickBooleanType) sharpen_,contrast,midpoint);
4441  throwImageException();
4442 }
4443 
4444 std::string Magick::Image::signature(const bool force_) const
4445 {
4446  const char
4447  *property;
4448 
4449  Lock lock(&_imgRef->_mutexLock);
4450 
4451  // Re-calculate image signature if necessary
4452  if (force_ || !GetImageProperty(constImage(), "Signature") ||
4453  constImage()->taint)
4454  SignatureImage(const_cast<MagickCore::Image *>(constImage()));
4455 
4456  property=GetImageProperty(constImage(),"Signature");
4457 
4458  return(std::string(property));
4459 }
4460 
4461 void Magick::Image::sketch(const double radius_,const double sigma_,
4462  const double angle_)
4463 {
4465  *newImage;
4466 
4468  newImage=SketchImage(constImage(),radius_,sigma_,angle_,exceptionInfo);
4469  replaceImage(newImage);
4471 }
4472 
4473 void Magick::Image::solarize(const double factor_)
4474 {
4475  modifyImage();
4476  SolarizeImage(image(),factor_);
4477  throwImageException();
4478 }
4479 
4480 void Magick::Image::sparseColor(const ChannelType channel,
4481  const SparseColorMethod method,const size_t number_arguments,
4482  const double *arguments)
4483 {
4485  *newImage;
4486 
4488  newImage=SparseColorImage(constImage(),channel,method,number_arguments,
4489  arguments,exceptionInfo);
4490  replaceImage(newImage);
4492 }
4493 
4494 void Magick::Image::splice(const Geometry &geometry_)
4495 {
4497  *newImage;
4498 
4499  RectangleInfo
4500  spliceInfo=geometry_;
4501 
4503  newImage=SpliceImage(constImage(),&spliceInfo,exceptionInfo);
4504  replaceImage(newImage);
4506 }
4507 
4508 void Magick::Image::splice(const Geometry &geometry_,
4509  const Color &backgroundColor_)
4510 {
4511  backgroundColor(backgroundColor_);
4512  splice(geometry_);
4513 }
4514 
4515 void Magick::Image::splice(const Geometry &geometry_,
4516  const Color &backgroundColor_,const GravityType gravity_)
4517 {
4518  backgroundColor(backgroundColor_);
4519  image()->gravity=gravity_;
4520  splice(geometry_);
4521 }
4522 
4523 void Magick::Image::spread(const size_t amount_)
4524 {
4526  *newImage;
4527 
4529  newImage=SpreadImage(constImage(),amount_,exceptionInfo);
4530  replaceImage(newImage);
4532 }
4533 
4535 {
4536  double
4537  maximum,
4538  minimum;
4539 
4541  (void) GetImageChannelRange(constImage(),RedChannel,&minimum,&maximum,
4542  exceptionInfo);
4543  statistics->red.minimum=minimum;
4544  statistics->red.maximum=maximum;
4545  (void) GetImageChannelMean(constImage(),RedChannel,&statistics->red.mean,
4546  &statistics->red.standard_deviation,exceptionInfo);
4547  (void) GetImageChannelKurtosis(constImage(),RedChannel,
4548  &statistics->red.kurtosis,&statistics->red.skewness,exceptionInfo);
4549  (void) GetImageChannelRange(constImage(),GreenChannel,&minimum,&maximum,
4550  exceptionInfo);
4551  statistics->green.minimum=minimum;
4552  statistics->green.maximum=maximum;
4553  (void) GetImageChannelMean(constImage(),GreenChannel,&statistics->green.mean,
4554  &statistics->green.standard_deviation,exceptionInfo);
4555  (void) GetImageChannelKurtosis(constImage(),GreenChannel,
4556  &statistics->green.kurtosis,&statistics->green.skewness,exceptionInfo);
4557  (void) GetImageChannelRange(constImage(),BlueChannel,&minimum,&maximum,
4558  exceptionInfo);
4559  statistics->blue.minimum=minimum;
4560  statistics->blue.maximum=maximum;
4561  (void) GetImageChannelMean(constImage(),BlueChannel,&statistics->blue.mean,
4562  &statistics->blue.standard_deviation,exceptionInfo);
4563  (void) GetImageChannelKurtosis(constImage(),BlueChannel,
4564  &statistics->blue.kurtosis,&statistics->blue.skewness,exceptionInfo);
4565  (void) GetImageChannelRange(constImage(),OpacityChannel,&minimum,&maximum,
4566  exceptionInfo);
4567  statistics->opacity.minimum=minimum;
4568  statistics->opacity.maximum=maximum;
4569  (void) GetImageChannelMean(constImage(),OpacityChannel,
4570  &statistics->opacity.mean,&statistics->opacity.standard_deviation,
4571  exceptionInfo);
4572  (void) GetImageChannelKurtosis(constImage(),OpacityChannel,
4573  &statistics->opacity.kurtosis,&statistics->opacity.skewness,
4574  exceptionInfo);
4576 }
4577 
4578 void Magick::Image::stegano(const Image &watermark_)
4579 {
4581  *newImage;
4582 
4584  newImage=SteganoImage(constImage(),watermark_.constImage(),exceptionInfo);
4585  replaceImage(newImage);
4587 }
4588 
4589 void Magick::Image::stereo(const Image &rightImage_)
4590 {
4592  *newImage;
4593 
4595  newImage=StereoImage(constImage(),rightImage_.constImage(),exceptionInfo);
4596  replaceImage(newImage);
4598 }
4599 
4601 {
4602  modifyImage();
4603  StripImage(image());
4604  throwImageException();
4605 }
4606 
4608  const MetricType metric_,Geometry *offset_,double *similarityMetric_,
4609  const double similarityThreshold)
4610 {
4611  char
4612  artifact[MaxTextExtent];
4613 
4615  *newImage;
4616 
4617  RectangleInfo
4618  offset;
4619 
4620  modifyImage();
4621  (void) FormatLocaleString(artifact,MaxTextExtent,"%g",similarityThreshold);
4622  (void) SetImageArtifact(image(),"compare:similarity-threshold",artifact);
4623 
4625  newImage=SimilarityMetricImage(image(),reference_.constImage(),metric_,
4626  &offset,similarityMetric_,exceptionInfo);
4628  if (offset_ != (Geometry *) NULL)
4629  *offset_=offset;
4630  if (newImage == (MagickCore::Image *) NULL)
4631  return(Magick::Image());
4632  else
4633  return(Magick::Image(newImage));
4634 }
4635 
4636 void Magick::Image::swirl(const double degrees_)
4637 {
4639  *newImage;
4640 
4642  newImage=SwirlImage(constImage(),degrees_,exceptionInfo);
4643  replaceImage(newImage);
4645 }
4646 
4648 {
4650  (void) SyncAuthenticPixels(image(),exceptionInfo);
4652 }
4653 
4654 void Magick::Image::texture(const Image &texture_)
4655 {
4656  modifyImage();
4657  TextureImage(image(),texture_.constImage());
4658  throwImageException();
4659 }
4660 
4661 void Magick::Image::threshold(const double threshold_)
4662 {
4663  modifyImage();
4664  BilevelImage(image(),threshold_);
4665  throwImageException();
4666 }
4667 
4668 void Magick::Image::thumbnail(const Geometry &geometry_)
4669 {
4671  *newImage;
4672 
4673  size_t
4674  height=rows(),
4675  width=columns();
4676 
4677  ssize_t
4678  x=0,
4679  y=0;
4680 
4681  ParseMetaGeometry(static_cast<std::string>(geometry_).c_str(),&x,&y,&width,
4682  &height);
4683 
4685  newImage=ThumbnailImage(constImage(),width,height,exceptionInfo);
4686  replaceImage(newImage);
4688 }
4689 
4690 void Magick::Image::tint(const std::string opacity_)
4691 {
4693  *newImage;
4694 
4696  newImage=TintImage(constImage(),opacity_.c_str(),constOptions()->fillColor(),
4697  exceptionInfo);
4698  replaceImage(newImage);
4700 }
4701 
4702 void Magick::Image::transform(const Geometry &imageGeometry_)
4703 {
4704  modifyImage();
4705  TransformImage(&(image()),0,std::string(imageGeometry_).c_str());
4706  throwImageException();
4707 }
4708 
4709 void Magick::Image::transform(const Geometry &imageGeometry_,
4710  const Geometry &cropGeometry_)
4711 {
4712  modifyImage();
4713  TransformImage(&(image()),std::string(cropGeometry_).c_str(),
4714  std::string(imageGeometry_).c_str());
4715  throwImageException();
4716 }
4717 
4718 void Magick::Image::transformOrigin(const double x_,const double y_)
4719 {
4720  modifyImage();
4721  options()->transformOrigin(x_,y_);
4722 }
4723 
4725 {
4726  modifyImage();
4727  options()->transformReset();
4728 }
4729 
4730 void Magick::Image::transformScale(const double sx_,const double sy_)
4731 {
4732  modifyImage();
4733  options()->transformScale(sx_,sy_);
4734 }
4735 
4737 {
4738  MagickPixelPacket
4739  target;
4740 
4741  std::string
4742  color;
4743 
4744  if (!color_.isValid())
4745  throwExceptionExplicit(OptionError,"Color argument is invalid");
4746 
4747  color=color_;
4748 
4749  (void) QueryMagickColor(std::string(color_).c_str(),&target,
4750  &image()->exception);
4751  modifyImage();
4752  TransparentPaintImage(image(),&target,TransparentOpacity,MagickFalse);
4753  throwImageException();
4754 }
4755 
4757  const Color &colorHigh_)
4758 {
4759  MagickPixelPacket
4760  targetHigh,
4761  targetLow;
4762 
4763  std::string
4764  colorHigh,
4765  colorLow;
4766 
4767  if (!colorLow_.isValid() || !colorHigh_.isValid())
4768  throwExceptionExplicit(OptionError,"Color argument is invalid");
4769 
4770  colorLow=colorLow_;
4771  colorHigh=colorHigh_;
4772 
4773  (void) QueryMagickColor(colorLow.c_str(),&targetLow,&image()->exception);
4774  (void) QueryMagickColor(colorHigh.c_str(),&targetHigh,&image()->exception);
4775  modifyImage();
4776  TransparentPaintImageChroma(image(),&targetLow,&targetHigh,
4777  TransparentOpacity,MagickFalse);
4778  throwImageException();
4779 }
4780 
4782 {
4784  *newImage;
4785 
4787  newImage=TransposeImage(constImage(),exceptionInfo);
4788  replaceImage(newImage);
4790 }
4791 
4793 {
4795  *newImage;
4796 
4798  newImage=TransverseImage(constImage(),exceptionInfo);
4799  replaceImage(newImage);
4801 }
4802 
4804 {
4806  *newImage;
4807 
4809  newImage=TrimImage(constImage(),exceptionInfo);
4810  replaceImage(newImage);
4812 }
4813 
4815 {
4817  *image;
4818 
4820  image=UniqueImageColors(constImage(),exceptionInfo);
4822  if (image == (MagickCore::Image *) NULL)
4823  return(Magick::Image());
4824  else
4825  return(Magick::Image(image));
4826 }
4827 
4828 void Magick::Image::unsharpmask(const double radius_,const double sigma_,
4829  const double amount_,const double threshold_)
4830 {
4832  *newImage;
4833 
4835  newImage=UnsharpMaskImage(constImage(),radius_,sigma_,amount_,threshold_,
4836  exceptionInfo);
4837  replaceImage(newImage);
4839 }
4840 
4841 void Magick::Image::unsharpmaskChannel(const ChannelType channel_,
4842  const double radius_,const double sigma_,const double amount_,
4843  const double threshold_)
4844 {
4846  *newImage;
4847 
4849  newImage=UnsharpMaskImageChannel(constImage(),channel_,radius_,sigma_,
4850  amount_,threshold_,exceptionInfo);
4851  replaceImage(newImage);
4853 }
4854 
4855 void Magick::Image::vignette(const double radius_,const double sigma_,
4856  const ssize_t x_,const ssize_t y_)
4857 {
4859  *newImage;
4860 
4862  newImage=VignetteImage(constImage(),radius_,sigma_,x_,y_,exceptionInfo);
4863  replaceImage(newImage);
4865 }
4866 
4867 void Magick::Image::wave(const double amplitude_,const double wavelength_)
4868 {
4870  *newImage;
4871 
4873  newImage=WaveImage(constImage(),amplitude_,wavelength_,exceptionInfo);
4874  replaceImage(newImage);
4876 }
4877 
4878 void Magick::Image::waveletDenoise(const double threshold_,
4879  const double softness_)
4880 {
4882  *newImage;
4883 
4885  newImage=WaveletDenoiseImage(constImage(),threshold_,softness_,
4886  exceptionInfo);
4887  replaceImage(newImage);
4889 }
4890 
4891 void Magick::Image::whiteThreshold(const std::string &threshold_)
4892 {
4893  modifyImage();
4894  WhiteThresholdImage(image(),threshold_.c_str());
4895  throwImageException();
4896 }
4897 
4898 void Magick::Image::whiteThresholdChannel(const ChannelType channel_,
4899  const std::string &threshold_)
4900 {
4901  modifyImage();
4903  WhiteThresholdImageChannel(image(),channel_,threshold_.c_str(),
4904  exceptionInfo);
4906 }
4907 
4909 {
4910  size_t
4911  length=0;
4912 
4913  void
4914  *data;
4915 
4916  modifyImage();
4918  data=ImagesToBlob(constImageInfo(),image(),&length,exceptionInfo);
4919  if (length > 0)
4920  blob_->updateNoCopy(data,length,Blob::MallocAllocator);
4922  throwImageException();
4923 }
4924 
4925 void Magick::Image::write(Blob *blob_,const std::string &magick_)
4926 {
4927  size_t
4928  length=0;
4929 
4930  void
4931  *data;
4932 
4933  modifyImage();
4934  magick(magick_);
4936  data=ImagesToBlob(constImageInfo(),image(),&length,exceptionInfo);
4937  if (length > 0)
4938  blob_->updateNoCopy(data,length,Blob::MallocAllocator);
4940  throwImageException();
4941 }
4942 
4943 void Magick::Image::write(Blob *blob_,const std::string &magick_,
4944  const size_t depth_)
4945 {
4946  size_t
4947  length=0;
4948 
4949  void
4950  *data;
4951 
4952  modifyImage();
4953  magick(magick_);
4954  depth(depth_);
4956  data=ImagesToBlob(constImageInfo(),image(),&length,exceptionInfo);
4957  if (length > 0)
4958  blob_->updateNoCopy(data,length,Blob::MallocAllocator);
4960  throwImageException();
4961 }
4962 
4963 void Magick::Image::write(const ssize_t x_,const ssize_t y_,
4964  const size_t columns_,const size_t rows_,const std::string &map_,
4965  const StorageType type_,void *pixels_)
4966 {
4968  ExportImagePixels(constImage(),x_,y_,columns_,rows_,map_.c_str(),type_,
4969  pixels_,exceptionInfo);
4971 }
4972 
4973 void Magick::Image::write(const std::string &imageSpec_)
4974 {
4975  modifyImage();
4976  fileName(imageSpec_);
4977  WriteImage(constImageInfo(),image());
4978  throwImageException();
4979 }
4980 
4981 void Magick::Image::writePixels(const Magick::QuantumType quantum_,
4982  unsigned char *destination_)
4983 {
4984  QuantumInfo
4985  *quantum_info;
4986 
4987  quantum_info=AcquireQuantumInfo(imageInfo(),image());
4989  ExportQuantumPixels(constImage(),(MagickCore::CacheView *) NULL,quantum_info,
4990  quantum_,destination_,exceptionInfo);
4991  quantum_info=DestroyQuantumInfo(quantum_info);
4993 }
4994 
4995 void Magick::Image::zoom(const Geometry &geometry_)
4996 {
4998  *newImage;
4999 
5000  size_t
5001  height=rows(),
5002  width=columns();
5003 
5004  ssize_t
5005  x=0,
5006  y=0;
5007 
5008  ParseMetaGeometry(static_cast<std::string>(geometry_).c_str(),&x,&y,&width,
5009  &height);
5010 
5012  newImage=ResizeImage(constImage(),width,height,image()->filter,image()->blur,
5013  exceptionInfo);
5014  replaceImage(newImage);
5016 }
5017 
5019  : _imgRef(new ImageRef(image_))
5020 {
5021 }
5022 
5024 {
5025  return(_imgRef->image());
5026 }
5027 
5029 {
5030  return(_imgRef->image());
5031 }
5032 
5033 MagickCore::ImageInfo *Magick::Image::imageInfo(void)
5034 {
5035  return(_imgRef->options()->imageInfo());
5036 }
5037 
5038 const MagickCore::ImageInfo *Magick::Image::constImageInfo(void) const
5039 {
5040  return(_imgRef->options()->imageInfo());
5041 }
5042 
5044 {
5045  return(_imgRef->options());
5046 }
5047 
5049 {
5050  return(_imgRef->options());
5051 }
5052 
5053 MagickCore::QuantizeInfo *Magick::Image::quantizeInfo(void)
5054 {
5055  return(_imgRef->options()->quantizeInfo());
5056 }
5057 
5058 const MagickCore::QuantizeInfo *Magick::Image::constQuantizeInfo(void) const
5059 {
5060  return(_imgRef->options()->quantizeInfo());
5061 }
5062 
5064 {
5065  {
5066  Lock lock(&_imgRef->_mutexLock);
5067  if (_imgRef->_refCount == 1)
5068  return;
5069  }
5070 
5072  replaceImage(CloneImage(constImage(),0,0,MagickTrue,exceptionInfo));
5074  return;
5075 }
5076 
5078 {
5080  *image;
5081 
5082  if (replacement_)
5083  image=replacement_;
5084  else
5085  image=AcquireImage(constImageInfo());
5086 
5087  {
5088  Lock lock(&_imgRef->_mutexLock);
5089 
5090  if (_imgRef->_refCount == 1)
5091  {
5092  // We own the image, just replace it, and de-register
5093  _imgRef->image(image);
5094  }
5095  else
5096  {
5097  // We don't own the image, dereference and replace with copy
5098  --_imgRef->_refCount;
5099  _imgRef=new ImageRef(image,constOptions());
5100  }
5101  }
5102 
5103  return(_imgRef->_image);
5104 }
5105 
5107 {
5108  // Throw C++ exception while resetting Image exception to default state
5109  throwException(&const_cast<MagickCore::Image*>(constImage())->exception,
5110  quiet());
5111 }
5112 
5114  MagickCore::ExceptionInfo *exceptionInfo)
5115 {
5116  // Ensure that multiple image frames were not read.
5117  if (image != (MagickCore::Image *) NULL &&
5118  image->next != (MagickCore::Image *) NULL)
5119  {
5121  *next;
5122 
5123  // Destroy any extra image frames
5124  next=image->next;
5125  image->next=(MagickCore::Image *) NULL;
5126  next->previous=(MagickCore::Image *) NULL;
5127  DestroyImageList(next);
5128  }
5129  replaceImage(image);
5130  if (exceptionInfo->severity == MagickCore::UndefinedException &&
5131  image == (MagickCore::Image *) NULL)
5132  {
5133  (void) MagickCore::DestroyExceptionInfo(exceptionInfo);
5134  throwExceptionExplicit(ImageWarning,"No image was loaded.");
5135  }
5137  if (image != (MagickCore::Image *) NULL)
5138  throwException(&image->exception,quiet());
5139 }
5140 
5141 void Magick::Image::floodFill(const ssize_t x_,const ssize_t y_,
5142  const Magick::Image *fillPattern_,const Magick::Color &fill_,
5143  const MagickCore::PixelPacket *target_,const bool invert_)
5144 {
5146  fillColor;
5147 
5149  *fillPattern;
5150 
5151  MagickPixelPacket
5152  target;
5153 
5154  // Set drawing fill pattern or fill color
5155  fillColor=options()->fillColor();
5156  fillPattern=(MagickCore::Image *)NULL;
5157  if (options()->fillPattern() != (MagickCore::Image *)NULL)
5158  {
5160  fillPattern=CloneImage(options()->fillPattern(),0,0,MagickTrue,
5161  exceptionInfo);
5163  }
5164 
5165  if (fillPattern_ == (Magick::Image *)NULL)
5166  {
5167  options()->fillPattern((MagickCore::Image *)NULL);
5168  options()->fillColor(fill_);
5169  }
5170  else
5171  options()->fillPattern(fillPattern_->constImage());
5172 
5173  GetMagickPixelPacket(image(),&target);
5174  target.red=target_->red;
5175  target.green=target_->green;
5176  target.blue=target_->blue;
5177 
5178  (void) FloodfillPaintImage(image(),DefaultChannels,options()->drawInfo(),
5179  &target,static_cast<ssize_t>(x_),static_cast<ssize_t>(y_),
5180  (MagickBooleanType) invert_);
5181 
5182  options()->fillColor(fillColor);
5183  options()->fillPattern(fillPattern);
5184  throwImageException();
5185 }
double strokeWidth(void) const
Definition: Image.cpp:1565
void distort(const DistortImageMethod method_, const size_t number_arguments_, const double *arguments_, const bool bestfit_=false)
Definition: Image.cpp:2734
void localContrast(const double radius_, const double strength_)
Definition: Image.cpp:3496
ImageChannelStatistics blue
Definition: Image.h:82
void swirl(const double degrees_)
Definition: Image.cpp:4636
class MagickPPExport Color
Definition: Color.h:15
void alphaChannel(AlphaChannelType alphaType_)
Definition: Image.cpp:1897
MagickPPExport const char * borderGeometryDefault
Definition: Image.cpp:33
bool quantizeDither(void) const
Definition: Image.cpp:1352
size_t animationIterations(void) const
Definition: Image.cpp:358
void morphology(const MorphologyMethod method_, const std::string kernel_, const ssize_t iterations_=1)
Definition: Image.cpp:3587
size_t colorMapSize(void) const
Definition: Image.cpp:539
void decipher(const std::string &passphrase_)
Definition: Image.cpp:2631
ImageChannelStatistics green
Definition: Image.h:81
void clip(void)
Definition: Image.cpp:2313
MagickPPExport int operator!=(const Magick::Color &left_, const Magick::Color &right_)
Definition: Color.cpp:29
bool strokeAntiAlias(void) const
Definition: Image.cpp:1446
void sigmoidalContrast(const size_t sharpen_, const double contrast, const double midpoint=QuantumRange/2.0)
Definition: Image.cpp:4435
Color textUnderColor(void) const
Definition: Image.cpp:1664
size_t quality(void) const
Definition: Image.cpp:1318
void splice(const Geometry &geometry_)
Definition: Image.cpp:4494
void width(size_t width_)
Definition: Geometry.h:283
void resize(const Geometry &geometry_)
Definition: Image.cpp:4151
void brightnessContrastChannel(const ChannelType channel_, const double brightness_=0.0, const double contrast_=0.0)
Definition: Image.cpp:2167
double colorFuzz(void) const
Definition: Image.cpp:524
void ty(const double ty_)
Definition: Drawable.h:338
std::string magick(void) const
Definition: Image.cpp:1103
const MagickCore::QuantizeInfo * constQuantizeInfo(void) const
Definition: Image.cpp:5058
virtual ~Image()
Definition: Image.cpp:270
void modulate(const double brightness_, const double saturation_, const double hue_)
Definition: Image.cpp:3568
bool compare(const Image &reference_)
Definition: Image.cpp:2428
void isValid(bool valid_)
Definition: Color.cpp:245
void transform(const Geometry &imageGeometry_)
Definition: Image.cpp:4702
Geometry page(void) const
Definition: Image.cpp:1258
void annotate(const std::string &text_, const Geometry &location_)
Definition: Image.cpp:1904
void transformSkewX(const double skewx_)
Definition: Image.cpp:1697
void levelChannel(const ChannelType channel, const double black_point, const double white_point, const double mid_point=1.0)
Definition: Image.cpp:3380
void matteFloodfill(const Color &target_, const unsigned int opacity_, const ::ssize_t x_, const ::ssize_t y_, const PaintMethod method_)
Definition: Image.cpp:3526
void addNoise(const NoiseType noiseType_)
Definition: Image.cpp:1852
Blob iccColorProfile(void) const
Definition: Image.cpp:959
void floodFillColor(const Geometry &point_, const Color &fillColor_)
Definition: Image.cpp:2910
InterpolatePixelMethod interpolate(void) const
Definition: Image.cpp:990
void floodFillOpacity(const ::ssize_t x_, const ::ssize_t y_, const unsigned int opacity_, const bool invert_=false)
IndexPacket * getIndexes(void)
Definition: Image.cpp:3261
Color borderColor(void) const
Definition: Image.cpp:438
void sparseColor(const ChannelType channel, const SparseColorMethod method, const size_t number_arguments, const double *arguments)
Definition: Image.cpp:4480
size_t totalColors(void) const
Definition: Image.cpp:1680
#define ThrowImageException
Definition: Image.cpp:31
void process(std::string name_, const ::ssize_t argc_, const char **argv_)
Definition: Image.cpp:3887
void writePixels(const QuantumType quantum_, unsigned char *destination_)
Definition: Image.cpp:4981
void charcoal(const double radius_=0.0, const double sigma_=1.0)
Definition: Image.cpp:2222
void blur(const double radius_=0.0, const double sigma_=1.0)
Definition: Image.cpp:2121
size_t baseRows(void) const
Definition: Image.cpp:411
size_t depth(void) const
Definition: Image.cpp:683
bool quiet(void) const
Definition: Image.cpp:1385
RenderingIntent renderingIntent(void) const
Definition: Image.cpp:1397
void profile(const std::string name_, const Blob &colorProfile_)
Definition: Image.cpp:3902
ImageMoments moments(void) const
Definition: Image.cpp:3582
std::string view(void) const
Definition: Image.cpp:1743
void medianFilter(const double radius_=0.0)
Definition: Image.cpp:3534
DitherMethod quantizeDitherMethod(void) const
Definition: Image.cpp:1363
void enhance(void)
Definition: Image.cpp:2827
void height(size_t height_)
Definition: Geometry.h:243
void chop(const Geometry &geometry_)
Definition: Image.cpp:2233
MagickPPExport const char * raiseGeometryDefault
Definition: Image.cpp:35
void composite(const Image &compositeImage_, const Geometry &offset_, const CompositeOperator compose_=InCompositeOp)
Definition: Image.cpp:2500
void liquidRescale(const Geometry &geometry_)
Definition: Image.cpp:3474
Image clipMask(void) const
Definition: Image.cpp:502
ClassType classType(void) const
Definition: Image.h:1616
void unsharpmask(const double radius_, const double sigma_, const double amount_, const double threshold_)
Definition: Image.cpp:4828
#define DegreesToRadians(x)
Definition: Image.cpp:30
void readPixels(const QuantumType quantum_, const unsigned char *source_)
Definition: Image.cpp:4092
void clut(const Image &clutImage_)
Definition: Image.cpp:2327
void negate(const bool grayscale_=false)
Definition: Image.cpp:3690
static MagickSizeType memory(void)
void connectedComponents(const size_t connectivity_)
Definition: Image.cpp:2548
std::string baseFilename(void) const
Definition: Image.cpp:406
void raise(const Geometry &geometry_=raiseGeometryDefault, const bool raisedFlag_=false)
Definition: Image.cpp:3984
void fx(const std::string expression)
Definition: Image.cpp:3163
void whiteThreshold(const std::string &threshold_)
Definition: Image.cpp:4891
double gamma(void) const
Definition: Image.cpp:918
std::string textEncoding(void) const
Definition: Image.cpp:1609
void crop(const Geometry &geometry_)
Definition: Image.cpp:2610
void adaptiveResize(const Geometry &geometry_)
Definition: Image.cpp:1793
Image uniqueColors(void) const
Definition: Image.cpp:4814
std::string comment(void) const
Definition: Image.cpp:584
bool blackPointCompensation(void) const
Definition: Image.cpp:421
static void cacheThreshold(const size_t threshold_)
Definition: Image.cpp:465
void tx(const double tx_)
Definition: Drawable.h:329
DirectionType textDirection() const
Definition: Image.cpp:1598
void clipPath(const std::string pathname_, const bool inside_)
Definition: Image.cpp:2320
size_t subImage(void) const
Definition: Image.cpp:1576
void defineValue(const std::string &magick_, const std::string &key_, const std::string &value_)
Definition: Image.cpp:2669
ImageType determineType(void) const
Definition: Image.cpp:2718
void vignette(const double radius_=0.0, const double sigma_=1.0, const ssize_t x_=0, const ssize_t y_=0)
Definition: Image.cpp:4855
void shade(const double azimuth_=30, const double elevation_=30, const bool colorShading_=false)
Definition: Image.cpp:4361
STL namespace.
void polaroid(const std::string &caption_, const double angle_)
Definition: Image.cpp:3858
void waveletDenoise(const double threshold_, const double softness_)
Definition: Image.cpp:4878
Image & operator=(const Image &image_)
Definition: Image.cpp:287
void write(Blob *blob_)
Definition: Image.cpp:4908
void yNegative(bool yNegative_)
Definition: Geometry.h:324
void statistics(ImageStatistics *statistics) const
Definition: Image.cpp:4534
void kuwaharaChannel(const ChannelType channel_, const double radius_=0.0, const double sigma_=1.0)
Definition: Image.cpp:3354
void equalize(void)
Definition: Image.cpp:2838
void zoom(const Geometry &geometry_)
Definition: Image.cpp:4995
CompositeOperator compose(void) const
Definition: Image.cpp:602
StyleType fontStyle(void) const
Definition: Image.cpp:882
void randomThresholdChannel(const Geometry &thresholds_, const ChannelType channel_)
Definition: Image.cpp:4005
FilterTypes filterType(void) const
Definition: Image.cpp:821
void blurChannel(const ChannelType channel_, const double radius_=0.0, const double sigma_=1.0)
Definition: Image.cpp:2132
void morphologyChannel(const ChannelType channel_, const MorphologyMethod method_, const std::string kernel_, const ssize_t iterations_=1)
Definition: Image.cpp:3632
void highlightColor(const Color color_)
Definition: Image.cpp:945
MagickPPExport int operator<(const Magick::Color &left_, const Magick::Color &right_)
Definition: Color.cpp:41
void yOff(::ssize_t yOff_)
Definition: Geometry.h:334
size_t fontWeight(void) const
Definition: Image.cpp:893
double fontPointsize(void) const
Definition: Image.cpp:855
size_t quantizeColors(void) const
Definition: Image.cpp:1329
bool isValid(void) const
Definition: Image.cpp:1049
void rotationalBlurChannel(const ChannelType channel_, const double angle_)
Definition: Image.cpp:4228
InterlaceType interlaceType(void) const
Definition: Image.cpp:979
void adaptiveSharpen(const double radius_=0.0, const double sigma_=1.0)
Definition: Image.cpp:1815
void level(const double black_point, const double white_point, const double mid_point=1.0)
Definition: Image.cpp:3367
MagickCore::Image * replaceImage(MagickCore::Image *replacement_)
Definition: Image.cpp:5077
void transformScale(const double sx_, const double sy_)
Definition: Image.cpp:4730
size_t modulusDepth(void) const
Definition: Image.cpp:1197
void encipher(const std::string &passphrase_)
Definition: Image.cpp:2819
Color strokeColor(void) const
Definition: Image.cpp:1462
void contrastStretch(const double black_point_, const double white_point_)
Definition: Image.cpp:2566
double compareChannel(const ChannelType channel_, const Image &reference_, const MetricType metric_)
Definition: Image.cpp:2455
void linearStretch(const double blackPoint_, const double whitePoint_)
Definition: Image.cpp:3466
void shadow(const double percent_opacity_=80.0, const double sigma_=0.5, const ssize_t x_=5, const ssize_t y_=5)
Definition: Image.cpp:4374
Geometry density(void) const
Definition: Image.cpp:650
void extent(const Geometry &geometry_)
Definition: Image.cpp:2852
void colorMatrix(const size_t order_, const double *color_matrix_)
Definition: Image.cpp:2403
void pixelColor(const ::ssize_t x_, const ::ssize_t y_, const Color &color_)
double textInterlineSpacing(void) const
Definition: Image.cpp:1631
void fontTypeMetricsMultiline(const std::string &text_, TypeMetric *metrics)
Definition: Image.cpp:3108
void motionBlur(const double radius_, const double sigma_, const double angle_)
Definition: Image.cpp:3678
void perceptibleChannel(const ChannelType channel_, const double epsilon_)
Definition: Image.cpp:3780
std::string format(void) const
Definition: Image.cpp:860
void emboss(const double radius_=0.0, const double sigma_=1.0)
Definition: Image.cpp:2808
void magnify(void)
Definition: Image.cpp:3507
void levelColors(const Color &blackColor_, const Color &whiteColor_, const bool invert_=true)
Definition: Image.cpp:3388
void segment(const double clusterThreshold_=1.0, const double smoothingThreshold_=1.5)
Definition: Image.cpp:4285
ColorspaceType quantizeColorSpace(void) const
Definition: Image.cpp:1341
void grayscale(const PixelIntensityMethod method_)
Definition: Image.cpp:3287
void reduceNoise(void)
Definition: Image.h:1635
void clampChannel(const ChannelType channel_)
Definition: Image.cpp:2306
void channelDepth(const ChannelType channel_, const size_t depth_)
Definition: Image.cpp:2203
void quantumOperator(const ChannelType channel_, const MagickEvaluateOperator operator_, double rvalue_)
Definition: Image.cpp:3943
void orderedDither(std::string thresholdMap_)
Definition: Image.cpp:3755
bool adjoin(void) const
Definition: Image.cpp:325
void stegano(const Image &watermark_)
Definition: Image.cpp:4578
void sharpen(const double radius_=0.0, const double sigma_=1.0)
Definition: Image.cpp:4386
std::string label(void) const
Definition: Image.cpp:1063
void chromaWhitePoint(const double x_, const double y_)
Definition: Image.cpp:2286
std::string signature(const bool force_=false) const
Definition: Image.cpp:4444
EndianType endian(void) const
Definition: Image.cpp:706
MagickPPExport void throwException(MagickCore::ExceptionInfo *exception_, const bool quiet_=false)
MagickCore::Image *& image(void)
Definition: Image.cpp:5023
void trim(void)
Definition: Image.cpp:4803
double yResolution(void) const
Definition: Image.cpp:1777
MagickPPExport int operator<=(const Magick::Color &left_, const Magick::Color &right_)
Definition: Color.cpp:63
void solarize(const double factor_=50.0)
Definition: Image.cpp:4473
Geometry size(void) const
Definition: Image.cpp:1435
size_t columns(void) const
Definition: Image.h:1621
Color penColor(void) const
Definition: Image.cpp:1273
std::string directory(void) const
Definition: Image.cpp:688
ImageChannelStatistics red
Definition: Image.h:80
MagickPPExport int operator>=(const Magick::Color &left_, const Magick::Color &right_)
Definition: Color.cpp:57
void stereo(const Image &rightImage_)
Definition: Image.cpp:4589
void defineSet(const std::string &magick_, const std::string &key_, bool flag_)
Definition: Image.cpp:2639
void quantize(const bool measureError_=false)
Definition: Image.cpp:3929
void read(const Blob &blob_)
Definition: Image.cpp:4015
OrientationType orientation(void) const
Definition: Image.cpp:1246
const IndexPacket * getConstIndexes(void) const
Definition: Image.cpp:3237
void autoGammaChannel(const ChannelType channel_)
Definition: Image.cpp:2056
void frame(const Geometry &geometry_=frameGeometryDefault)
Definition: Image.cpp:3120
ColorspaceType colorspaceType(void) const
Definition: Image.cpp:570
void orderedDitherChannel(const ChannelType channel_, std::string thresholdMap_)
Definition: Image.cpp:3763
void throwImageException(void) const
Definition: Image.cpp:5106
GravityType textGravity() const
Definition: Image.cpp:1620
Image(void)
Definition: Image.cpp:78
void opaque(const Color &opaqueColor_, const Color &penColor_, const bool invert_=MagickFalse)
Definition: Image.cpp:3728
void flip(void)
Definition: Image.cpp:2899
void shave(const Geometry &geometry_)
Definition: Image.cpp:4410
#define AbsoluteValue(x)
Definition: Image.cpp:28
CompressionType compressType(void) const
Definition: Image.cpp:614
#define MagickPPExport
Definition: Include.h:255
void tint(const std::string opacity_)
Definition: Image.cpp:4690
void perceptible(const double epsilon_)
Definition: Image.cpp:3773
double textKerning(void) const
Definition: Image.cpp:1653
void blackThreshold(const std::string &threshold_)
Definition: Image.cpp:2092
void erase(void)
Definition: Image.cpp:2845
class MagickPPExport Geometry
Definition: Geometry.h:19
void sharpenChannel(const ChannelType channel_, const double radius_=0.0, const double sigma_=1.0)
Definition: Image.cpp:4397
Image fillPattern(void) const
Definition: Image.cpp:790
void fillPattern(const Image &fillPattern_)
Definition: Image.cpp:781
void spread(const size_t amount_=3)
Definition: Image.cpp:4523
void blackThresholdChannel(const ChannelType channel_, const std::string &threshold_)
Definition: Image.cpp:2099
void edge(const double radius_=0.0)
Definition: Image.cpp:2797
double normalizedMeanError(void) const
Definition: Image.cpp:1235
void kuwahara(const double radius_=0.0, const double sigma_=1.0)
Definition: Image.cpp:3343
double strokeDashOffset(void) const
Definition: Image.cpp:1484
void texture(const Image &texture_)
Definition: Image.cpp:4654
void xOff(::ssize_t xOff_)
Definition: Geometry.h:314
double meanErrorPerPixel(void) const
Definition: Image.cpp:1185
size_t baseColumns(void) const
Definition: Image.cpp:401
void mergeLayers(const ImageLayerMethod layerType_)
Definition: Image.cpp:3546
void sepiaTone(const double threshold_)
Definition: Image.cpp:4337
std::string fileName(void) const
Definition: Image.cpp:749
std::string font(void) const
Definition: Image.cpp:832
void transparentChroma(const Color &colorLow_, const Color &colorHigh_)
Definition: Image.cpp:4756
void sy(const double sy_)
Definition: Drawable.h:302
void whiteThresholdChannel(const ChannelType channel_, const std::string &threshold_)
Definition: Image.cpp:4898
void minify(void)
Definition: Image.cpp:3557
void syncPixels(void)
Definition: Image.cpp:4647
void scale(const Geometry &geometry_)
Definition: Image.cpp:4263
MagickCore::ImageInfo * imageInfo(void)
Definition: Image.cpp:5033
Image subImageSearch(const Image &reference_, const MetricType metric_, Geometry *offset_, double *similarityMetric_, const double similarityThreshold=(-1.0))
Definition: Image.cpp:4607
double normalizedMaxError(void) const
Definition: Image.cpp:1230
const MagickCore::Image * constImage(void) const
Definition: Image.cpp:5028
void unsharpmaskChannel(const ChannelType channel_, const double radius_, const double sigma_, const double amount_, const double threshold_)
Definition: Image.cpp:4841
Color matteColor(void) const
Definition: Image.cpp:1179
void transformRotation(const double angle_)
Definition: Image.cpp:1691
void artifact(const std::string &name_, const std::string &value_)
Definition: Image.cpp:2012
void transverse(void)
Definition: Image.cpp:4792
double xResolution(void) const
Definition: Image.cpp:1772
void sx(const double sx_)
Definition: Drawable.h:293
void cannyEdge(const double radius_=0.0, const double sigma_=1.0, const double lowerPercent_=0.1, const double upperPercent_=0.3)
Definition: Image.cpp:2175
MagickPPExport const char * frameGeometryDefault
Definition: Image.cpp:34
PixelPacket * setPixels(const ::ssize_t x_, const ::ssize_t y_, const size_t columns_, const size_t rows_)
Definition: Image.cpp:4348
void attribute(const std::string name_, const std::string value_)
Definition: Image.cpp:2030
ResolutionType resolutionUnits(void) const
Definition: Image.cpp:1411
void draw(const Drawable &drawable_)
Definition: Image.cpp:2747
MagickPPExport void throwExceptionExplicit(const MagickCore::ExceptionType severity_, const char *reason_, const char *description_=(char *) NULL)
Image penTexture(void) const
Definition: Image.cpp:1287
void contrast(const size_t sharpen_)
Definition: Image.cpp:2559
void rotationalBlur(const double angle_)
Definition: Image.cpp:4217
void chromaRedPrimary(const double x_, const double y_)
Definition: Image.cpp:2273
void opacity(const unsigned int opacity_)
Definition: Image.cpp:3723
void resample(const Geometry &geometry_)
Definition: Image.cpp:4128
void posterizeChannel(const ChannelType channel_, const size_t levels_, const bool dither_=false)
Definition: Image.cpp:3878
void updateNoCopy(void *data_, const size_t length_, Allocator allocator_=NewAllocator)
Definition: Blob.cpp:148
void implode(const double factor_)
Definition: Image.cpp:3314
Color fillColor(void) const
Definition: Image.cpp:765
size_t subRange(void) const
Definition: Image.cpp:1587
void gaussianBlur(const double width_, const double sigma_)
Definition: Image.cpp:3213
double textInterwordSpacing(void) const
Definition: Image.cpp:1642
Blob exifProfile(void) const
Definition: Image.cpp:726
void ping(const Blob &blob_)
Definition: Image.cpp:3788
void contrastStretchChannel(const ChannelType channel_, const double black_point_, const double white_point_)
Definition: Image.cpp:2575
LineCap strokeLineCap(void) const
Definition: Image.cpp:1495
void clamp(void)
Definition: Image.cpp:2299
void levelize(const double blackPoint_, const double whitePoint_, const double gamma_=1.0)
Definition: Image.cpp:3450
void adaptiveSharpenChannel(const ChannelType channel_, const double radius_=0.0, const double sigma_=1.0)
Definition: Image.cpp:1826
Image strokePattern(void) const
Definition: Image.cpp:1531
void wave(const double amplitude_=25.0, const double wavelength_=150.0)
Definition: Image.cpp:4867
void threshold(const double threshold_)
Definition: Image.cpp:4661
void convolve(const size_t order_, const double *kernel_)
Definition: Image.cpp:2583
void roll(const Geometry &roll_)
Definition: Image.cpp:4174
void rx(const double rx_)
Definition: Drawable.h:311
Geometry boundingBox(void) const
Definition: Image.cpp:443
const Options * constOptions(void) const
Definition: Image.cpp:5048
VirtualPixelMethod virtualPixelMethod(void) const
Definition: Image.cpp:1756
void strip(void)
Definition: Image.cpp:4600
void thumbnail(const Geometry &geometry_)
Definition: Image.cpp:4668
Geometry montageGeometry(void) const
Definition: Image.cpp:1219
void adaptiveBlur(const double radius_=0.0, const double sigma_=1.0)
Definition: Image.cpp:1782
void display(void)
Definition: Image.cpp:2729
void posterize(const size_t levels_, const bool dither_=false)
Definition: Image.cpp:3871
std::string x11Display(void) const
Definition: Image.cpp:1767
size_t strokeMiterLimit(void) const
Definition: Image.cpp:1517
void selectiveBlur(const double radius_, const double sigma_, const double threshold_)
Definition: Image.cpp:4297
void adaptiveThreshold(const size_t width, const size_t height, const ::ssize_t offset=0)
Definition: Image.cpp:1839
void autoOrient(void)
Definition: Image.cpp:2077
void inverseFourierTransform(const Image &phase_)
Definition: Image.cpp:3325
void floodFillTexture(const Geometry &point_, const Image &texture_)
Definition: Image.cpp:3022
void randomThreshold(const Geometry &thresholds_)
Definition: Image.cpp:3996
Color backgroundColor(void) const
Definition: Image.cpp:385
bool isOpaque(void) const
Definition: Image.cpp:1022
void cdl(const std::string &cdl_)
Definition: Image.cpp:2189
FillRule fillRule(void) const
Definition: Image.cpp:776
Image separate(const ChannelType channel_) const
Definition: Image.cpp:4323
void isValid(const bool isValid_)
Definition: Image.cpp:1033
void border(const Geometry &geometry_=borderGeometryDefault)
Definition: Image.cpp:2145
void chromaBluePrimary(const double x_, const double y_)
Definition: Image.cpp:2247
Image mask(void) const
Definition: Image.cpp:1121
bool antiAlias(void) const
Definition: Image.cpp:336
void sample(const Geometry &geometry_)
Definition: Image.cpp:4241
bool debug(void) const
Definition: Image.cpp:625
void affineTransform(const DrawableAffine &affine)
Definition: Image.cpp:1876
void houghLine(const size_t width_, const size_t height_, const size_t threshold_=40)
Definition: Image.cpp:3301
void levelizeChannel(const ChannelType channel_, const double blackPoint_, const double whitePoint_, const double gamma_=1.0)
Definition: Image.cpp:3458
void sketch(const double radius_=0.0, const double sigma_=1.0, const double angle_=0.0)
Definition: Image.cpp:4461
const MagickCore::ImageInfo * constImageInfo(void) const
Definition: Image.cpp:5038
ColorspaceType colorSpace(void) const
Definition: Image.cpp:557
void gaussianBlurChannel(const ChannelType channel_, const double width_, const double sigma_)
Definition: Image.cpp:3224
std::string formatExpression(const std::string expression)
Definition: Image.cpp:899
ImageType type(void) const
Definition: Image.cpp:1716
std::string backgroundTexture(void) const
Definition: Image.cpp:396
void blueShift(const double factor_=1.5)
Definition: Image.cpp:2109
void ry(const double ry_)
Definition: Drawable.h:320
off_t fileSize(void) const
Definition: Image.cpp:754
const double * strokeDashArray(void) const
Definition: Image.cpp:1473
MagickPPExport int operator>(const Magick::Color &left_, const Magick::Color &right_)
Definition: Color.cpp:35
void clutChannel(const ChannelType channel_, const Image &clutImage_)
Definition: Image.cpp:2334
void transpose(void)
Definition: Image.cpp:4781
std::string tileName(void) const
Definition: Image.cpp:1675
Geometry geometry(void) const
Definition: Image.cpp:923
MagickPPExport int operator==(const Magick::Color &left_, const Magick::Color &right_)
Definition: Color.cpp:20
size_t length(void) const
Definition: Blob.cpp:123
class MagickPPExport Image
Definition: Drawable.h:647
LineJoin strokeLineJoin(void) const
Definition: Image.cpp:1506
void autoLevelChannel(const ChannelType channel_)
Definition: Image.cpp:2070
void negateChannel(const ChannelType channel_, const bool grayscale_=false)
Definition: Image.cpp:3697
size_t quantizeTreeDepth(void) const
Definition: Image.cpp:1374
const PixelPacket * getConstPixels(const ::ssize_t x_, const ::ssize_t y_, const size_t columns_, const size_t rows_) const
Definition: Image.cpp:3249
void repage()
Definition: Image.cpp:4118
void brightnessContrast(const double brightness_=0.0, const double contrast_=0.0)
Definition: Image.cpp:2159
MagickCore::QuantizeInfo * quantizeInfo(void)
Definition: Image.cpp:5053
void flop(void)
Definition: Image.cpp:3084
void despeckle(void)
Definition: Image.cpp:2707
void channel(const ChannelType channel_)
Definition: Image.cpp:2196
void strokePattern(const Image &strokePattern_)
Definition: Image.cpp:1522
size_t rows(void) const
Definition: Image.h:1640
void normalize(void)
Definition: Image.cpp:3705
ImageChannelStatistics opacity
Definition: Image.h:83
size_t scene(void) const
Definition: Image.cpp:1422
std::string fontFamily(void) const
Definition: Image.cpp:843
void chromaGreenPrimary(const double x_, const double y_)
Definition: Image.cpp:2260
#define GetPPException
Definition: Include.h:1506
void deskew(const double threshold_)
Definition: Image.cpp:2696
void fontTypeMetrics(const std::string &text_, TypeMetric *metrics)
Definition: Image.cpp:3095
void attenuate(const double attenuate_)
Definition: Image.cpp:363
void transformOrigin(const double x_, const double y_)
Definition: Image.cpp:4718
void colorMap(const size_t index_, const Color &color_)
Definition: Image.cpp:2370
bool matte(void) const
Definition: Image.cpp:1151
size_t gifDisposeMethod(void) const
Definition: Image.cpp:939
void oilPaint(const double radius_=3.0)
Definition: Image.cpp:3712
Color boxColor(void) const
Definition: Image.cpp:460
void xNegative(bool xNegative_)
Definition: Geometry.h:304
void isValid(bool isValid_)
Definition: Geometry.h:253
void copyPixels(const Image &source_, const Geometry &geometry_, const Offset &offset_)
Definition: Image.cpp:2594
void autoGamma(void)
Definition: Image.cpp:2049
bool monochrome(void) const
Definition: Image.cpp:1214
void addNoiseChannel(const ChannelType channel_, const NoiseType noiseType_)
Definition: Image.cpp:1863
void cycleColormap(const ::ssize_t amount_)
Definition: Image.cpp:2624
Options * options(void)
Definition: Image.cpp:5043
void modifyImage(void)
Definition: Image.cpp:5063
const void * data(void) const
Definition: Blob.cpp:118
void autoLevel(void)
Definition: Image.cpp:2063
void selectiveBlurChannel(const ChannelType channel_, const double radius_, const double sigma_, const double threshold_)
Definition: Image.cpp:4310
size_t animationDelay(void) const
Definition: Image.cpp:347
void levelColorsChannel(const ChannelType channel_, const Color &blackColor_, const Color &whiteColor_, const bool invert_=true)
Definition: Image.cpp:3419
void colorize(const unsigned int opacity_, const Color &penColor_)
Definition: Image.cpp:2364
bool verbose(void) const
Definition: Image.cpp:1732
void haldClut(const Image &clutImage_)
Definition: Image.cpp:3294
void transformSkewY(const double skewy_)
Definition: Image.cpp:1703
void shear(const double xShearAngle_, const double yShearAngle_)
Definition: Image.cpp:4424
Blob iptcProfile(void) const
Definition: Image.cpp:1010
PixelPacket * getPixels(const ::ssize_t x_, const ::ssize_t y_, const size_t columns_, const size_t rows_)
Definition: Image.cpp:3274
void transparent(const Color &color_)
Definition: Image.cpp:4736
void transformReset(void)
Definition: Image.cpp:4724
void rotate(const double degrees_)
Definition: Image.cpp:4206
void map(const Image &mapImage_, const bool dither_=false)
Definition: Image.cpp:3518
void lowlightColor(const Color color_)
Definition: Image.cpp:1076