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  modifyImage();
673  image()->depth=depth_;
674  options()->depth(depth_);
675 }
676 
677 size_t Magick::Image::depth(void) const
678 {
679  return(constImage()->depth);
680 }
681 
682 std::string Magick::Image::directory(void) const
683 {
684  if (constImage()->directory)
685  return(std::string(constImage()->directory));
686 
687  throwExceptionExplicit(CorruptImageWarning,
688  "Image does not contain a directory");
689 
690  return(std::string());
691 }
692 
693 void Magick::Image::endian(const Magick::EndianType endian_)
694 {
695  modifyImage();
696  options()->endian(endian_);
697  image()->endian=endian_;
698 }
699 
700 Magick::EndianType Magick::Image::endian(void) const
701 {
702  return(constImage()->endian);
703 }
704 
705 void Magick::Image::exifProfile(const Magick::Blob &exifProfile_)
706 {
707  if (exifProfile_.data() != 0)
708  {
709  StringInfo
710  *exif_profile;
711 
712  modifyImage();
713  exif_profile=AcquireStringInfo(exifProfile_.length());
714  SetStringInfoDatum(exif_profile,(unsigned char *) exifProfile_.data());
715  (void) SetImageProfile(image(),"exif",exif_profile);
716  exif_profile=DestroyStringInfo(exif_profile);
717  }
718 }
719 
721 {
722  const StringInfo
723  *exif_profile;
724 
725  exif_profile=GetImageProfile(constImage(),"exif");
726  if (exif_profile == (StringInfo *) NULL)
727  return(Blob());
728 
729  return(Blob(GetStringInfoDatum(exif_profile),GetStringInfoLength(
730  exif_profile)));
731 }
732 
733 void Magick::Image::fileName(const std::string &fileName_)
734 {
735  ssize_t
736  max_length;
737 
738  modifyImage();
739 
740  max_length=sizeof(image()->filename)-1;
741  fileName_.copy(image()->filename,max_length);
742  if ((ssize_t) fileName_.length() > max_length)
743  image()->filename[max_length]=0;
744  else
745  image()->filename[fileName_.length()]=0;
746 
747  options()->fileName(fileName_);
748 }
749 
750 std::string Magick::Image::fileName(void) const
751 {
752  return(constOptions()->fileName());
753 }
754 
755 off_t Magick::Image::fileSize(void) const
756 {
757  return((off_t) GetBlobSize(constImage()));
758 }
759 
761 {
762  modifyImage();
763  options()->fillColor(fillColor_);
764 }
765 
767 {
768  return(constOptions()->fillColor());
769 }
770 
771 void Magick::Image::fillRule(const Magick::FillRule &fillRule_)
772 {
773  modifyImage();
774  options()->fillRule(fillRule_);
775 }
776 
777 Magick::FillRule Magick::Image::fillRule(void) const
778 {
779  return(constOptions()->fillRule());
780 }
781 
782 void Magick::Image::fillPattern(const Image &fillPattern_)
783 {
784  modifyImage();
785  if(fillPattern_.isValid())
786  options()->fillPattern(fillPattern_.constImage());
787  else
788  options()->fillPattern(static_cast<MagickCore::Image*>(NULL));
789 }
790 
792 {
793  // FIXME: This is inordinately innefficient
794  const MagickCore::Image
795  *tmpTexture;
796 
797  Image
798  texture;
799 
800  tmpTexture=constOptions()->fillPattern();
801 
802  if(tmpTexture)
803  {
805  *image;
806 
808  image=CloneImage(tmpTexture,0,0,MagickTrue,exceptionInfo);
809  texture.replaceImage(image);
811  }
812 
813  return(texture);
814 }
815 
816 void Magick::Image::filterType(const Magick::FilterTypes filterType_)
817 {
818  modifyImage();
819  image()->filter=filterType_;
820 }
821 
822 Magick::FilterTypes Magick::Image::filterType(void) const
823 {
824  return(constImage()->filter);
825 }
826 
827 void Magick::Image::font(const std::string &font_)
828 {
829  modifyImage();
830  options()->font(font_);
831 }
832 
833 std::string Magick::Image::font(void) const
834 {
835  return(constOptions()->font());
836 }
837 
838 void Magick::Image::fontFamily(const std::string &family_)
839 {
840  modifyImage();
841  options()->fontFamily(family_);
842 }
843 
844 std::string Magick::Image::fontFamily(void) const
845 {
846  return(constOptions()->fontFamily());
847 }
848 
849 
850 void Magick::Image::fontPointsize(const double pointSize_)
851 {
852  modifyImage();
853  options()->fontPointsize(pointSize_);
854 }
855 
857 {
858  return(constOptions()->fontPointsize());
859 }
860 
861 std::string Magick::Image::format(void) const
862 {
863  const MagickInfo
864  *magick_info;
865 
867  magick_info=GetMagickInfo(constImage()->magick,exceptionInfo);
869 
870  if ((magick_info != 0) && (*magick_info->description != '\0'))
871  return(std::string(magick_info->description));
872 
873  throwExceptionExplicit(CorruptImageWarning,"Unrecognized image magick type");
874  return(std::string());
875 }
876 
877 void Magick::Image::fontStyle(const StyleType pointSize_)
878 {
879  modifyImage();
880  options()->fontStyle(pointSize_);
881 }
882 
883 Magick::StyleType Magick::Image::fontStyle(void) const
884 {
885  return(constOptions()->fontStyle());
886 }
887 
888 void Magick::Image::fontWeight(const size_t weight_)
889 {
890  modifyImage();
891  options()->fontWeight(weight_);
892 }
893 
894 size_t Magick::Image::fontWeight(void) const
895 {
896  return(constOptions()->fontWeight());
897 }
898 
899 
900 std::string Magick::Image::formatExpression(const std::string expression)
901 {
902  char
903  *text;
904 
905  std::string
906  text_string;
907 
908  modifyImage();
909  text=InterpretImageProperties(constImageInfo(),image(),expression.c_str());
910  if (text != (char *) NULL)
911  {
912  text_string=std::string(text);
913  text=DestroyString(text);
914  }
915  throwImageException();
916  return(text_string);
917 }
918 
919 double Magick::Image::gamma(void) const
920 {
921  return(constImage()->gamma);
922 }
923 
925 {
926  if (constImage()->geometry)
927  return(Geometry(constImage()->geometry));
928 
929  throwExceptionExplicit(OptionWarning,"Image does not contain a geometry");
930 
931  return(Geometry());
932 }
933 
934 void Magick::Image::gifDisposeMethod(const size_t disposeMethod_)
935 {
936  modifyImage();
937  image()->dispose=(DisposeType) disposeMethod_;
938 }
939 
941 {
942  // FIXME: It would be better to return an enumeration
943  return ((size_t) constImage()->dispose);
944 }
945 
947 {
948  std::string
949  value;
950 
951  value=color_;
952  artifact("highlight-color",value);
953 }
954 
956 {
957  profile("icc",colorProfile_);
958 }
959 
961 {
962  const StringInfo
963  *color_profile;
964 
965  color_profile=GetImageProfile(constImage(),"icc");
966  if (color_profile == (StringInfo *) NULL)
967  return Blob();
968 
969  return(Blob(GetStringInfoDatum(color_profile),GetStringInfoLength(
970  color_profile)));
971 }
972 
973 void Magick::Image::interlaceType(const InterlaceType interlace_)
974 {
975  modifyImage();
976  image()->interlace=interlace_;
977  options()->interlaceType(interlace_);
978 }
979 
980 Magick::InterlaceType Magick::Image::interlaceType(void) const
981 {
982  return constImage()->interlace;
983 }
984 
985 void Magick::Image::interpolate(const InterpolatePixelMethod interpolate_)
986 {
987  modifyImage();
988  image()->interpolate=interpolate_;
989 }
990 
991 Magick::InterpolatePixelMethod Magick::Image::interpolate(void) const
992 {
993  return constImage()->interpolate;
994 }
995 
996 void Magick::Image::iptcProfile(const Magick::Blob &iptcProfile_)
997 {
998  modifyImage();
999  if (iptcProfile_.data() != 0)
1000  {
1001  StringInfo
1002  *iptc_profile;
1003 
1004  iptc_profile=AcquireStringInfo(iptcProfile_.length());
1005  SetStringInfoDatum(iptc_profile,(unsigned char *) iptcProfile_.data());
1006  (void) SetImageProfile(image(),"iptc",iptc_profile);
1007  iptc_profile=DestroyStringInfo(iptc_profile );
1008  }
1009 }
1010 
1012 {
1013  const StringInfo
1014  *iptc_profile;
1015 
1016  iptc_profile=GetImageProfile(constImage(),"iptc");
1017  if (iptc_profile == (StringInfo *) NULL)
1018  return(Blob());
1019  return(Blob(GetStringInfoDatum(iptc_profile),GetStringInfoLength(
1020  iptc_profile)));
1021 }
1022 
1023 bool Magick::Image::isOpaque(void) const
1024 {
1025  MagickBooleanType
1026  result;
1027 
1029  result=IsOpaqueImage(constImage(),exceptionInfo);
1031  return(result != MagickFalse ? true : false);
1032 }
1033 
1034 void Magick::Image::isValid(const bool isValid_)
1035 {
1036  if (!isValid_)
1037  {
1038  delete _imgRef;
1039  _imgRef = new ImageRef;
1040  }
1041  else if (!isValid())
1042  {
1043  // Construct with single-pixel black image to make
1044  // image valid. This is an obvious hack.
1045  size(Geometry(1,1));
1046  read("xc:black");
1047  }
1048 }
1049 
1050 bool Magick::Image::isValid(void) const
1051 {
1052  return(rows() && columns());
1053 }
1054 
1055 void Magick::Image::label(const std::string &label_)
1056 {
1057  modifyImage();
1058  (void) SetImageProperty(image(),"Label",NULL);
1059  if (label_.length() > 0)
1060  (void) SetImageProperty(image(),"Label",label_.c_str());
1061  throwImageException();
1062 }
1063 
1064 std::string Magick::Image::label(void) const
1065 {
1066  const char
1067  *value;
1068 
1069  value=GetImageProperty(constImage(),"Label");
1070 
1071  if (value)
1072  return(std::string(value));
1073 
1074  return(std::string());
1075 }
1076 
1078 {
1079  std::string
1080  value;
1081 
1082  value=color_;
1083  artifact("lowlight-color",value);
1084 }
1085 
1086 void Magick::Image::magick(const std::string &magick_)
1087 {
1088  size_t
1089  length;
1090 
1091  modifyImage();
1092 
1093  length=sizeof(image()->magick)-1;
1094  if (magick_.length() < length)
1095  length=magick_.length();
1096 
1097  if (!magick_.empty())
1098  magick_.copy(image()->magick,length);
1099  image()->magick[length]=0;
1100 
1101  options()->magick(magick_);
1102 }
1103 
1104 std::string Magick::Image::magick(void) const
1105 {
1106  if (*(constImage()->magick) != '\0')
1107  return(std::string(constImage()->magick));
1108 
1109  return(constOptions()->magick());
1110 }
1111 
1113 {
1114  modifyImage();
1115 
1116  if (mask_.isValid())
1117  SetImageMask(image(),mask_.constImage());
1118  else
1119  SetImageMask(image(),0);
1120 }
1121 
1123 {
1125  *image;
1126 
1128  image=GetImageMask(constImage(),exceptionInfo);
1130 
1131  if (image == (MagickCore::Image *) NULL)
1132  return(Magick::Image());
1133  else
1134  return(Magick::Image(image));
1135 }
1136 
1137 void Magick::Image::matte(const bool matteFlag_)
1138 {
1139  modifyImage();
1140 
1141  // If matte channel is requested, but image doesn't already have a
1142  // matte channel, then create an opaque matte channel. Likewise, if
1143  // the image already has a matte channel but a matte channel is not
1144  // desired, then set the matte channel to opaque.
1145  if (bool(matteFlag_) != bool(constImage()->matte))
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 char *value_)
2031 {
2032  modifyImage();
2033  SetImageProperty(image(),name_.c_str(),value_);
2034 }
2035 
2036 void Magick::Image::attribute(const std::string name_,const std::string value_)
2037 {
2038  modifyImage();
2039  SetImageProperty(image(),name_.c_str(),value_.c_str());
2040 }
2041 
2042 std::string Magick::Image::attribute(const std::string name_) const
2043 {
2044  const char
2045  *value;
2046 
2047  value=GetImageProperty(constImage(),name_.c_str());
2048 
2049  if (value)
2050  return(std::string(value));
2051 
2052  return(std::string()); // Intentionally no exception
2053 }
2054 
2056 {
2057  modifyImage();
2058  (void) AutoGammaImage(image());
2059  throwImageException();
2060 }
2061 
2062 void Magick::Image::autoGammaChannel(const ChannelType channel_)
2063 {
2064  modifyImage();
2065  (void) AutoGammaImageChannel(image(),channel_);
2066  throwImageException();
2067 }
2068 
2070 {
2071  modifyImage();
2072  (void) AutoLevelImage(image());
2073  throwImageException();
2074 }
2075 
2076 void Magick::Image::autoLevelChannel(const ChannelType channel_)
2077 {
2078  modifyImage();
2079  (void) AutoLevelImageChannel(image(),channel_);
2080  throwImageException();
2081 }
2082 
2084 {
2086  *newImage;
2087 
2088  if (image()->orientation == UndefinedOrientation ||
2089  image()->orientation == TopLeftOrientation)
2090  return;
2091 
2093  newImage=AutoOrientImage(constImage(),image()->orientation,exceptionInfo);
2094  replaceImage(newImage);
2096 }
2097 
2098 void Magick::Image::blackThreshold(const std::string &threshold_)
2099 {
2100  modifyImage();
2101  BlackThresholdImage(image(),threshold_.c_str());
2102  throwImageException();
2103 }
2104 
2105 void Magick::Image::blackThresholdChannel(const ChannelType channel_,
2106  const std::string &threshold_)
2107 {
2108  modifyImage();
2110  BlackThresholdImageChannel(image(),channel_,threshold_.c_str(),
2111  exceptionInfo);
2113 }
2114 
2115 void Magick::Image::blueShift(const double factor_)
2116 {
2118  *newImage;
2119 
2121  newImage=BlueShiftImage(constImage(),factor_,exceptionInfo);
2122  replaceImage(newImage);
2124 }
2125 
2126 // Blur image
2127 void Magick::Image::blur(const double radius_, const double sigma_)
2128 {
2130  *newImage;
2131 
2133  newImage=BlurImage(constImage(),radius_,sigma_,exceptionInfo);
2134  replaceImage(newImage);
2136 }
2137 
2138 void Magick::Image::blurChannel(const ChannelType channel_,
2139  const double radius_,const double sigma_)
2140 {
2142  *newImage;
2143 
2145  newImage=BlurImageChannel(constImage(),channel_,radius_,sigma_,
2146  exceptionInfo);
2147  replaceImage(newImage);
2149 }
2150 
2151 void Magick::Image::border(const Geometry &geometry_)
2152 {
2154  *newImage;
2155 
2156  RectangleInfo
2157  borderInfo=geometry_;
2158 
2160  newImage=BorderImage(constImage(),&borderInfo,exceptionInfo);
2161  replaceImage(newImage);
2163 }
2164 
2165 void Magick::Image::brightnessContrast(const double brightness_,
2166  const double contrast_)
2167 {
2168  modifyImage();
2169  BrightnessContrastImage(image(),brightness_,contrast_);
2170  throwImageException();
2171 }
2172 
2173 void Magick::Image::brightnessContrastChannel(const ChannelType channel_,
2174  const double brightness_,const double contrast_)
2175 {
2176  modifyImage();
2177  BrightnessContrastImageChannel(image(),channel_,brightness_,contrast_);
2178  throwImageException();
2179 }
2180 
2181 void Magick::Image::cannyEdge(const double radius_,const double sigma_,
2182  const double lowerPercent_,const double upperPercent_)
2183 {
2185  *newImage;
2186 
2187  modifyImage();
2189  newImage=CannyEdgeImage(constImage(),radius_,sigma_,lowerPercent_,
2190  upperPercent_,exceptionInfo);
2191  replaceImage(newImage);
2193 }
2194 
2195 void Magick::Image::cdl(const std::string &cdl_)
2196 {
2197  modifyImage();
2198  (void) ColorDecisionListImage(image(),cdl_.c_str());
2199  throwImageException();
2200 }
2201 
2202 void Magick::Image::channel(const ChannelType channel_)
2203 {
2204  modifyImage();
2205  SeparateImageChannel(image(),channel_);
2206  throwImageException();
2207 }
2208 
2209 void Magick::Image::channelDepth(const ChannelType channel_,
2210  const size_t depth_)
2211 {
2212  modifyImage();
2213  SetImageChannelDepth(image(),channel_,depth_);
2214  throwImageException();
2215 }
2216 
2217 size_t Magick::Image::channelDepth(const ChannelType channel_)
2218 {
2219  size_t
2220  channel_depth;
2221 
2223  channel_depth=GetImageChannelDepth(constImage(), channel_,exceptionInfo);
2225  return channel_depth;
2226 }
2227 
2228 void Magick::Image::charcoal(const double radius_,const double sigma_)
2229 {
2231  *newImage;
2232 
2234  newImage=CharcoalImage(constImage(),radius_,sigma_,exceptionInfo);
2235  replaceImage(newImage);
2237 }
2238 
2239 void Magick::Image::chop(const Geometry &geometry_)
2240 {
2242  *newImage;
2243 
2244  RectangleInfo
2245  chopInfo=geometry_;
2246 
2248  newImage=ChopImage(constImage(),&chopInfo,exceptionInfo);
2249  replaceImage(newImage);
2251 }
2252 
2253 void Magick::Image::chromaBluePrimary(const double x_,const double y_)
2254 {
2255  modifyImage();
2256  image()->chromaticity.blue_primary.x=x_;
2257  image()->chromaticity.blue_primary.y=y_;
2258 }
2259 
2260 void Magick::Image::chromaBluePrimary(double *x_,double *y_) const
2261 {
2262  *x_=constImage()->chromaticity.blue_primary.x;
2263  *y_=constImage()->chromaticity.blue_primary.y;
2264 }
2265 
2266 void Magick::Image::chromaGreenPrimary(const double x_,const double y_)
2267 {
2268  modifyImage();
2269  image()->chromaticity.green_primary.x=x_;
2270  image()->chromaticity.green_primary.y=y_;
2271 }
2272 
2273 void Magick::Image::chromaGreenPrimary(double *x_,double *y_) const
2274 {
2275  *x_=constImage()->chromaticity.green_primary.x;
2276  *y_=constImage()->chromaticity.green_primary.y;
2277 }
2278 
2279 void Magick::Image::chromaRedPrimary(const double x_,const double y_)
2280 {
2281  modifyImage();
2282  image()->chromaticity.red_primary.x=x_;
2283  image()->chromaticity.red_primary.y=y_;
2284 }
2285 
2286 void Magick::Image::chromaRedPrimary(double *x_,double *y_) const
2287 {
2288  *x_=constImage()->chromaticity.red_primary.x;
2289  *y_=constImage()->chromaticity.red_primary.y;
2290 }
2291 
2292 void Magick::Image::chromaWhitePoint(const double x_,const double y_)
2293 {
2294  modifyImage();
2295  image()->chromaticity.white_point.x=x_;
2296  image()->chromaticity.white_point.y=y_;
2297 }
2298 
2299 void Magick::Image::chromaWhitePoint(double *x_,double *y_) const
2300 {
2301  *x_=constImage()->chromaticity.white_point.x;
2302  *y_=constImage()->chromaticity.white_point.y;
2303 }
2304 
2306 {
2307  modifyImage();
2308  ClampImage(image());
2309  throwImageException();
2310 }
2311 
2312 void Magick::Image::clampChannel(const ChannelType channel_)
2313 {
2314  modifyImage();
2315  ClampImageChannel(image(),channel_);
2316  throwImageException();
2317 }
2318 
2320 {
2321  modifyImage();
2322  ClipImage(image());
2323  throwImageException();
2324 }
2325 
2326 void Magick::Image::clipPath(const std::string pathname_,const bool inside_)
2327 {
2328  modifyImage();
2329  ClipImagePath(image(),pathname_.c_str(),(MagickBooleanType) inside_);
2330  throwImageException();
2331 }
2332 
2333 void Magick::Image::clut(const Image &clutImage_)
2334 {
2335  modifyImage();
2336  ClutImage(image(),clutImage_.constImage());
2337  throwImageException();
2338 }
2339 
2340 void Magick::Image::clutChannel(const ChannelType channel_,
2341  const Image &clutImage_)
2342 {
2343  modifyImage();
2344  ClutImageChannel(image(),channel_,clutImage_.constImage());
2345  throwImageException();
2346 }
2347 
2348 void Magick::Image::colorize(const unsigned int opacityRed_,
2349  const unsigned int opacityGreen_,const unsigned int opacityBlue_,
2350  const Color &penColor_)
2351 {
2352  char
2353  opacity[MaxTextExtent];
2354 
2356  *newImage;
2357 
2358  if (!penColor_.isValid())
2359  throwExceptionExplicit( OptionError, "Pen color argument is invalid" );
2360 
2361  FormatLocaleString(opacity,MaxTextExtent,"%u/%u/%u",opacityRed_,
2362  opacityGreen_,opacityBlue_);
2363 
2365  newImage=ColorizeImage(image(),opacity,penColor_,exceptionInfo);
2366  replaceImage(newImage);
2368 }
2369 
2370 void Magick::Image::colorize(const unsigned int opacity_,
2371  const Color &penColor_)
2372 {
2373  colorize(opacity_,opacity_,opacity_,penColor_);
2374 }
2375 
2376 void Magick::Image::colorMap(const size_t index_,const Color &color_)
2377 {
2378  if (index_ > (MaxColormapSize-1) )
2379  throwExceptionExplicit(OptionError,
2380  "Colormap index must be less than MaxColormapSize");
2381 
2382  if (!color_.isValid())
2383  throwExceptionExplicit(OptionError,"Color argument is invalid");
2384 
2385  modifyImage();
2386 
2387  // Ensure that colormap size is large enough
2388  if (colorMapSize() < (index_+1))
2389  colorMapSize(index_+1);
2390 
2391  // Set color at index in colormap
2392  (image()->colormap)[index_]=color_;
2393 }
2394 
2395 Magick::Color Magick::Image::colorMap(const size_t index_) const
2396 {
2397  if (!constImage()->colormap)
2398  {
2399  throwExceptionExplicit(OptionError,"Image does not contain a colormap");
2400  return(Color());
2401  }
2402 
2403  if (index_ > constImage()->colors-1)
2404  throwExceptionExplicit(OptionError,"Index out of range");
2405 
2406  return(Color((constImage()->colormap)[index_]));
2407 }
2408 
2409 void Magick::Image::colorMatrix(const size_t order_,
2410  const double *color_matrix_)
2411 {
2412  KernelInfo
2413  *kernel_info;
2414 
2416  *newImage;
2417 
2419 
2420  kernel_info=AcquireKernelInfo("1");
2421  if (kernel_info != (KernelInfo *) NULL)
2422  {
2423  kernel_info->width=order_;
2424  kernel_info->height=order_;
2425  kernel_info->values=(double *) color_matrix_;
2426  newImage=ColorMatrixImage(constImage(),kernel_info,exceptionInfo);
2427  kernel_info->values=(double *) NULL;
2428  kernel_info=DestroyKernelInfo(kernel_info);
2429  replaceImage(newImage);
2431  }
2432 }
2433 
2434 bool Magick::Image::compare(const Image &reference_)
2435 {
2436  bool
2437  status;
2438 
2439  Image
2440  ref=reference_;
2441 
2442  modifyImage();
2443  ref.modifyImage();
2444  status=static_cast<bool>(IsImagesEqual(image(),ref.constImage()));
2445  throwImageException();
2446  return(status);
2447 }
2448 
2449 double Magick::Image::compare(const Image &reference_,const MetricType metric_)
2450 {
2451  double
2452  distortion=0.0;
2453 
2455  GetImageDistortion(image(),reference_.constImage(),metric_,&distortion,
2456  exceptionInfo);
2458  return(distortion);
2459 }
2460 
2461 double Magick::Image::compareChannel(const ChannelType channel_,
2462  const Image &reference_,const MetricType metric_)
2463 {
2464  double
2465  distortion=0.0;
2466 
2468  GetImageChannelDistortion(image(),reference_.constImage(),channel_,metric_,
2469  &distortion,exceptionInfo);
2471  return(distortion);
2472 }
2473 
2475  const MetricType metric_,double *distortion)
2476 {
2478  *newImage;
2479 
2481  newImage=CompareImages(image(),reference_.constImage(),metric_,distortion,
2482  exceptionInfo);
2484  if (newImage == (MagickCore::Image *) NULL)
2485  return(Magick::Image());
2486  else
2487  return(Magick::Image(newImage));
2488 }
2489 
2491  const Image &reference_,const MetricType metric_,double *distortion)
2492 {
2494  *newImage;
2495 
2497  newImage=CompareImageChannels(image(),reference_.constImage(),channel_,
2498  metric_,distortion,exceptionInfo);
2500  if (newImage == (MagickCore::Image *) NULL)
2501  return(Magick::Image());
2502  else
2503  return(Magick::Image(newImage));
2504 }
2505 
2506 void Magick::Image::composite(const Image &compositeImage_,
2507  const Geometry &offset_,const CompositeOperator compose_)
2508 {
2509  size_t
2510  height=rows(),
2511  width=columns();
2512 
2513  ssize_t
2514  x=offset_.xOff(),
2515  y=offset_.yOff();
2516 
2517  modifyImage();
2518  ParseMetaGeometry(static_cast<std::string>(offset_).c_str(),&x,&y,&width,
2519  &height);
2520 
2521  CompositeImage(image(),compose_,compositeImage_.constImage(),x,y);
2522  throwImageException();
2523 }
2524 
2525 void Magick::Image::composite(const Image &compositeImage_,
2526  const GravityType gravity_,const CompositeOperator compose_)
2527 {
2528  RectangleInfo
2529  geometry;
2530 
2531  modifyImage();
2532 
2533  SetGeometry(compositeImage_.constImage(),&geometry);
2534  GravityAdjustGeometry(columns(),rows(),gravity_,&geometry);
2535 
2536  CompositeImage(image(),compose_,compositeImage_.constImage(),geometry.x,
2537  geometry.y);
2538  throwImageException();
2539 }
2540 
2541 void Magick::Image::composite(const Image &compositeImage_,
2542  const ssize_t xOffset_,const ssize_t yOffset_,
2543  const CompositeOperator compose_)
2544 {
2545  // Image supplied as compositeImage is composited with current image and
2546  // results in updating current image.
2547  modifyImage();
2548 
2549  CompositeImage(image(),compose_,compositeImage_.constImage(),xOffset_,
2550  yOffset_);
2551  throwImageException();
2552 }
2553 
2554 void Magick::Image::connectedComponents(const size_t connectivity_)
2555 {
2557  *newImage;
2558 
2560  newImage=ConnectedComponentsImage(constImage(),connectivity_,exceptionInfo);
2561  replaceImage(newImage);
2563 }
2564 
2565 void Magick::Image::contrast(const size_t sharpen_)
2566 {
2567  modifyImage();
2568  ContrastImage(image(),(MagickBooleanType) sharpen_);
2569  throwImageException();
2570 }
2571 
2572 void Magick::Image::contrastStretch(const double black_point_,
2573  const double white_point_)
2574 {
2575  modifyImage();
2576  ContrastStretchImageChannel(image(),DefaultChannels,black_point_,
2577  white_point_);
2578  throwImageException();
2579 }
2580 
2581 void Magick::Image::contrastStretchChannel(const ChannelType channel_,
2582  const double black_point_,const double white_point_)
2583 {
2584  modifyImage();
2585  ContrastStretchImageChannel(image(),channel_,black_point_,white_point_);
2586  throwImageException();
2587 }
2588 
2589 void Magick::Image::convolve(const size_t order_,const double *kernel_)
2590 {
2592  *newImage;
2593 
2595  newImage=ConvolveImage(constImage(),order_,kernel_,exceptionInfo);
2596  replaceImage(newImage);
2598 }
2599 
2600 void Magick::Image::copyPixels(const Image &source_,const Geometry &geometry_,
2601  const Offset &offset_)
2602 {
2603  const OffsetInfo
2604  offset=offset_;
2605 
2606  const RectangleInfo
2607  geometry=geometry_;
2608 
2610  (void) CopyImagePixels(image(),source_.constImage(),&geometry,&offset,
2611  exceptionInfo);
2613 }
2614 
2615 
2616 void Magick::Image::crop(const Geometry &geometry_)
2617 {
2619  *newImage;
2620 
2621  RectangleInfo
2622  cropInfo=geometry_;
2623 
2625  newImage=CropImage(constImage(),&cropInfo,exceptionInfo);
2626  replaceImage(newImage);
2628 }
2629 
2630 void Magick::Image::cycleColormap(const ssize_t amount_)
2631 {
2632  modifyImage();
2633  CycleColormapImage(image(),amount_);
2634  throwImageException();
2635 }
2636 
2637 void Magick::Image::decipher(const std::string &passphrase_)
2638 {
2639  modifyImage();
2641  DecipherImage(image(),passphrase_.c_str(),exceptionInfo);
2643 }
2644 
2645 void Magick::Image::defineSet(const std::string &magick_,
2646  const std::string &key_,bool flag_)
2647 {
2648  std::string
2649  definition;
2650 
2651  modifyImage();
2652  definition=magick_ + ":" + key_;
2653  if (flag_)
2654  (void) SetImageOption(imageInfo(),definition.c_str(),"");
2655  else
2656  DeleteImageOption(imageInfo(),definition.c_str());
2657 }
2658 
2659 bool Magick::Image::defineSet(const std::string &magick_,
2660  const std::string &key_) const
2661 {
2662  const char
2663  *option;
2664 
2665  std::string
2666  key;
2667 
2668  key=magick_ + ":" + key_;
2669  option=GetImageOption(constImageInfo(),key.c_str());
2670  if (option)
2671  return(true);
2672  return(false);
2673 }
2674 
2675 void Magick::Image::defineValue(const std::string &magick_,
2676  const std::string &key_,const std::string &value_)
2677 {
2678  std::string
2679  format;
2680 
2681  modifyImage();
2682  format=magick_ + ":" + key_;
2683  (void) SetImageOption(imageInfo(),format.c_str(),value_.c_str());
2684 }
2685 
2686 std::string Magick::Image::defineValue(const std::string &magick_,
2687  const std::string &key_) const
2688 {
2689  const char
2690  *option;
2691 
2692  std::string
2693  definition;
2694 
2695  definition=magick_ + ":" + key_;
2696  option=GetImageOption(constImageInfo(),definition.c_str());
2697  if (option)
2698  return(std::string(option));
2699  return(std::string());
2700 }
2701 
2702 void Magick::Image::deskew(const double threshold_)
2703 {
2705  *newImage;
2706 
2708  newImage=DeskewImage(constImage(),threshold_,exceptionInfo);
2709  replaceImage(newImage);
2711 }
2712 
2714 {
2716  *newImage;
2717 
2719  newImage=DespeckleImage(constImage(),exceptionInfo);
2720  replaceImage(newImage);
2722 }
2723 
2724 Magick::ImageType Magick::Image::determineType(void) const
2725 {
2726  ImageType
2727  image_type;
2728 
2730  image_type=GetImageType(constImage(),exceptionInfo);
2732  return(image_type);
2733 }
2734 
2736 {
2737  DisplayImages(imageInfo(),image());
2738 }
2739 
2740 void Magick::Image::distort(const DistortImageMethod method_,
2741  const size_t number_arguments_,const double *arguments_,const bool bestfit_)
2742 {
2744  *newImage;
2745 
2747  newImage=DistortImage(constImage(),method_,number_arguments_,arguments_,
2748  bestfit_ == true ? MagickTrue : MagickFalse,exceptionInfo);
2749  replaceImage(newImage);
2751 }
2752 
2754 {
2755  DrawingWand
2756  *wand;
2757 
2758  modifyImage();
2759 
2760  wand=AcquireDrawingWand(options()->drawInfo(),image());
2761 
2762  if(wand)
2763  {
2764  drawable_.operator()(wand);
2765 
2766  if (constImage()->exception.severity == UndefinedException)
2767  DrawRender(wand);
2768 
2769  wand=DestroyDrawingWand(wand);
2770  }
2771 
2772  throwImageException();
2773 }
2774 
2775 void Magick::Image::draw(const std::list<Magick::Drawable> &drawable_)
2776 {
2777  DrawingWand
2778  *wand;
2779 
2780  modifyImage();
2781 
2782  wand=AcquireDrawingWand(options()->drawInfo(),image());
2783 
2784  if(wand)
2785  {
2786  for (std::list<Magick::Drawable>::const_iterator p = drawable_.begin();
2787  p != drawable_.end(); p++)
2788  {
2789  p->operator()(wand);
2790  if (constImage()->exception.severity != UndefinedException)
2791  break;
2792  }
2793 
2794  if (constImage()->exception.severity == UndefinedException)
2795  DrawRender(wand);
2796 
2797  wand=DestroyDrawingWand(wand);
2798  }
2799 
2800  throwImageException();
2801 }
2802 
2803 void Magick::Image::edge(const double radius_)
2804 {
2806  *newImage;
2807 
2809  newImage=EdgeImage(constImage(),radius_,exceptionInfo);
2810  replaceImage(newImage);
2812 }
2813 
2814 void Magick::Image::emboss(const double radius_,const double sigma_)
2815 {
2817  *newImage;
2818 
2820  newImage=EmbossImage(constImage(),radius_,sigma_,exceptionInfo);
2821  replaceImage(newImage);
2823 }
2824 
2825 void Magick::Image::encipher(const std::string &passphrase_)
2826 {
2827  modifyImage();
2829  EncipherImage(image(),passphrase_.c_str(),exceptionInfo);
2831 }
2832 
2834 {
2836  *newImage;
2837 
2839  newImage=EnhanceImage(constImage(),exceptionInfo);
2840  replaceImage(newImage);
2842 }
2843 
2845 {
2846  modifyImage();
2847  EqualizeImage(image());
2848  throwImageException();
2849 }
2850 
2852 {
2853  modifyImage();
2854  (void) SetImageBackgroundColor(image());
2855  throwImageException();
2856 }
2857 
2858 void Magick::Image::extent(const Geometry &geometry_)
2859 {
2861  *newImage;
2862 
2863  RectangleInfo
2864  extentInfo;
2865 
2866  modifyImage();
2867 
2869  extentInfo=geometry_;
2870  extentInfo.x=geometry_.xOff();
2871  extentInfo.y=geometry_.yOff();
2872  newImage=ExtentImage(constImage(),&extentInfo,exceptionInfo);
2873  replaceImage(newImage);
2875 }
2876 
2877 void Magick::Image::extent(const Geometry &geometry_,
2878  const Color &backgroundColor_)
2879 {
2880  backgroundColor(backgroundColor_);
2881  extent(geometry_);
2882 }
2883 
2884 void Magick::Image::extent(const Geometry &geometry_,
2885  const Color &backgroundColor_,const GravityType gravity_)
2886 {
2887  image()->gravity=gravity_;
2888  backgroundColor(backgroundColor_);
2889  extent(geometry_,gravity_);
2890 }
2891 
2892 void Magick::Image::extent(const Geometry &geometry_,
2893  const GravityType gravity_)
2894 {
2895  RectangleInfo
2896  geometry;
2897 
2898  SetGeometry(image(),&geometry);
2899  geometry.width=geometry_.width();
2900  geometry.height=geometry_.height();
2901  GravityAdjustGeometry(image()->columns,image()->rows,gravity_,&geometry);
2902  extent(geometry);
2903 }
2904 
2906 {
2908  *newImage;
2909 
2911  newImage=FlipImage(constImage(),exceptionInfo);
2912  replaceImage(newImage);
2914 }
2915 
2917  const Magick::Color &fillColor_)
2918 {
2919  floodFillColor(point_.xOff(),point_.yOff(),fillColor_,false);
2920 }
2921 
2923  const Magick::Color &fillColor_,const bool invert_)
2924 {
2925  floodFillColor(point_.xOff(),point_.yOff(),fillColor_,invert_);
2926 }
2927 
2928 void Magick::Image::floodFillColor(const ssize_t x_,const ssize_t y_,
2929  const Magick::Color &fillColor_)
2930 {
2931  floodFillColor(x_,y_,fillColor_,false);
2932 }
2933 
2934 void Magick::Image::floodFillColor(const ssize_t x_,const ssize_t y_,
2935  const Magick::Color &fillColor_,const bool invert_)
2936 {
2937  PixelPacket
2938  pixel;
2939 
2940  modifyImage();
2941 
2942  pixel=pixelColor(x_,y_);
2943  floodFill(x_,y_,(Magick::Image *)NULL,fillColor_,&pixel,invert_);
2944 }
2945 
2947  const Magick::Color &fillColor_,const Magick::Color &borderColor_)
2948 {
2949  floodFillColor(point_.xOff(),point_.yOff(),fillColor_,borderColor_,false);
2950 }
2951 
2953  const Magick::Color &fillColor_,const Magick::Color &borderColor_,
2954  const bool invert_)
2955 {
2956  floodFillColor(point_.xOff(),point_.yOff(),fillColor_,borderColor_,invert_);
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 {
2962  floodFillColor(x_,y_,fillColor_,borderColor_,false);
2963 }
2964 
2965 void Magick::Image::floodFillColor(const ssize_t x_,const ssize_t y_,
2966  const Magick::Color &fillColor_,const Magick::Color &borderColor_,
2967  const bool invert_)
2968 {
2969  PixelPacket
2970  pixel;
2971 
2972  modifyImage();
2973 
2974  pixel=static_cast<PixelPacket>(borderColor_);
2975  floodFill(x_,y_,(Magick::Image *)NULL,fillColor_,&pixel,invert_);
2976 }
2977 
2978 void Magick::Image::floodFillOpacity(const ssize_t x_,const ssize_t y_,
2979  const unsigned int opacity_,const bool invert_)
2980 {
2981  MagickPixelPacket
2982  target;
2983 
2984  PixelPacket
2985  pixel;
2986 
2987  modifyImage();
2988 
2989  GetMagickPixelPacket(constImage(),&target);
2990  pixel=static_cast<PixelPacket>(pixelColor(x_,y_));
2991  target.red=pixel.red;
2992  target.green=pixel.green;
2993  target.blue=pixel.blue;
2994  target.opacity=opacity_;
2995  (void) FloodfillPaintImage(image(),OpacityChannel,options()->drawInfo(),
2996  &target,x_,y_,(MagickBooleanType)invert_);
2997  throwImageException();
2998 }
2999 
3000 void Magick::Image::floodFillOpacity(const ssize_t x_,const ssize_t y_,
3001  const unsigned int opacity_,const PaintMethod method_)
3002 {
3003  floodFillOpacity(x_,y_,opacity_,method_ == FloodfillMethod ? false : true);
3004 }
3005 
3006 void Magick::Image::floodFillOpacity(const ::ssize_t x_,const ::ssize_t y_,
3007  const unsigned int opacity_,const Color &target_,const bool invert_)
3008 {
3009  MagickPixelPacket
3010  target;
3011 
3012  PixelPacket
3013  pixel;
3014 
3015  modifyImage();
3016 
3017  GetMagickPixelPacket(constImage(),&target);
3018  pixel=static_cast<PixelPacket>(target_);
3019  target.red=pixel.red;
3020  target.green=pixel.green;
3021  target.blue=pixel.blue;
3022  target.opacity=opacity_;
3023  (void) FloodfillPaintImage(image(),OpacityChannel,options()->drawInfo(),
3024  &target,x_,y_,(MagickBooleanType)invert_);
3025  throwImageException();
3026 }
3027 
3029  const Magick::Image &texture_)
3030 {
3031  floodFillTexture(point_.xOff(),point_.yOff(),texture_,false);
3032 }
3033 
3035  const Magick::Image &texture_,const bool invert_)
3036 {
3037  floodFillTexture(point_.xOff(),point_.yOff(),texture_,invert_);
3038 }
3039 
3040 void Magick::Image::floodFillTexture(const ssize_t x_,const ssize_t y_,
3041  const Magick::Image &texture_)
3042 {
3043  floodFillTexture(x_,y_,texture_,false);
3044 }
3045 
3046 void Magick::Image::floodFillTexture(const ssize_t x_,const ssize_t y_,
3047  const Magick::Image &texture_,const bool invert_)
3048 {
3049  PixelPacket
3050  pixel;
3051 
3052  modifyImage();
3053 
3054  pixel=static_cast<PixelPacket>(pixelColor(x_,y_));
3055  floodFill(x_,y_,&texture_,Magick::Color(),&pixel,invert_);
3056 }
3057 
3059  const Magick::Image &texture_,const Magick::Color &borderColor_)
3060 {
3061  floodFillTexture(point_.xOff(),point_.yOff(),texture_,borderColor_,false);
3062 }
3063 
3065  const Magick::Image &texture_,const Magick::Color &borderColor_,
3066  const bool invert_)
3067 {
3068  floodFillTexture(point_.xOff(),point_.yOff(),texture_,borderColor_,invert_);
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 {
3074  floodFillTexture(x_,y_,texture_,borderColor_,false);
3075 }
3076 
3077 void Magick::Image::floodFillTexture(const ssize_t x_,const ssize_t y_,
3078  const Magick::Image &texture_,const Magick::Color &borderColor_,
3079  const bool invert_)
3080 {
3081  PixelPacket
3082  pixel;
3083 
3084  modifyImage();
3085 
3086  pixel=static_cast<PixelPacket>(borderColor_);
3087  floodFill(x_,y_,&texture_,Magick::Color(),&pixel,invert_);
3088 }
3089 
3091 {
3093  *newImage;
3094 
3096  newImage=FlopImage(constImage(),exceptionInfo);
3097  replaceImage(newImage);
3099 }
3100 
3101 void Magick::Image::fontTypeMetrics(const std::string &text_,
3102  TypeMetric *metrics)
3103 {
3104  DrawInfo
3105  *drawInfo;
3106 
3107  drawInfo=options()->drawInfo();
3108  drawInfo->text=const_cast<char *>(text_.c_str());
3109  if (GetTypeMetrics(image(),drawInfo,&(metrics->_typeMetric)) == MagickFalse)
3110  throwImageException();
3111  drawInfo->text=0;
3112 }
3113 
3114 void Magick::Image::fontTypeMetricsMultiline(const std::string &text_,
3115  TypeMetric *metrics)
3116 {
3117  DrawInfo
3118  *drawInfo;
3119 
3120  drawInfo=options()->drawInfo();
3121  drawInfo->text=const_cast<char *>(text_.c_str());
3122  GetMultilineTypeMetrics(image(),drawInfo,&(metrics->_typeMetric));
3123  drawInfo->text=0;
3124 }
3125 
3126 void Magick::Image::frame(const Geometry &geometry_)
3127 {
3128  FrameInfo
3129  info;
3130 
3132  *newImage;
3133 
3134  info.x=static_cast<ssize_t>(geometry_.width());
3135  info.y=static_cast<ssize_t>(geometry_.height());
3136  info.width=columns() + ( static_cast<size_t>(info.x) << 1 );
3137  info.height=rows() + ( static_cast<size_t>(info.y) << 1 );
3138  info.outer_bevel=geometry_.xOff();
3139  info.inner_bevel=geometry_.yOff();
3140 
3142  newImage=FrameImage(constImage(),&info,exceptionInfo);
3143  replaceImage(newImage);
3145 }
3146 
3147 void Magick::Image::frame(const size_t width_,const size_t height_,
3148  const ssize_t innerBevel_,const ssize_t outerBevel_)
3149 {
3150  FrameInfo
3151  info;
3152 
3154  *newImage;
3155 
3156  info.x=static_cast<ssize_t>(width_);
3157  info.y=static_cast<ssize_t>(height_);
3158  info.width=columns() + ( static_cast<size_t>(info.x) << 1 );
3159  info.height=rows() + ( static_cast<size_t>(info.y) << 1 );
3160  info.outer_bevel=static_cast<ssize_t>(outerBevel_);
3161  info.inner_bevel=static_cast<ssize_t>(innerBevel_);
3162 
3164  newImage=FrameImage(constImage(),&info,exceptionInfo);
3165  replaceImage(newImage);
3167 }
3168 
3169 void Magick::Image::fx(const std::string expression)
3170 {
3172  *newImage;
3173 
3175  newImage=FxImageChannel(constImage(),DefaultChannels,expression.c_str(),
3176  exceptionInfo);
3177  replaceImage(newImage);
3179 }
3180 
3181 void Magick::Image::fx(const std::string expression,
3182  const Magick::ChannelType channel)
3183 {
3185  *newImage;
3186 
3188  newImage=FxImageChannel(constImage(),channel,expression.c_str(),
3189  exceptionInfo);
3190  replaceImage(newImage);
3192 }
3193 
3194 void Magick::Image::gamma(const double gamma_)
3195 {
3196  char
3197  gamma[MaxTextExtent + 1];
3198 
3199  FormatLocaleString(gamma,MaxTextExtent,"%3.6f",gamma_);
3200 
3201  modifyImage();
3202  GammaImage(image(),gamma);
3203 }
3204 
3205 void Magick::Image::gamma(const double gammaRed_,const double gammaGreen_,
3206  const double gammaBlue_)
3207 {
3208  char
3209  gamma[MaxTextExtent + 1];
3210 
3211  FormatLocaleString(gamma,MaxTextExtent,"%3.6f/%3.6f/%3.6f/",gammaRed_,
3212  gammaGreen_,gammaBlue_);
3213 
3214  modifyImage();
3215  GammaImage(image(),gamma);
3216  throwImageException();
3217 }
3218 
3219 void Magick::Image::gaussianBlur(const double width_,const double sigma_)
3220 {
3222  *newImage;
3223 
3225  newImage=GaussianBlurImage(constImage(),width_,sigma_,exceptionInfo);
3226  replaceImage(newImage);
3228 }
3229 
3230 void Magick::Image::gaussianBlurChannel(const ChannelType channel_,
3231  const double width_,const double sigma_)
3232 {
3234  *newImage;
3235 
3237  newImage=GaussianBlurImageChannel(constImage(),channel_,width_,sigma_,
3238  exceptionInfo);
3239  replaceImage(newImage);
3241 }
3242 
3243 const Magick::IndexPacket* Magick::Image::getConstIndexes(void) const
3244 {
3245  const Magick::IndexPacket
3246  *result;
3247 
3248  result=GetVirtualIndexQueue(constImage());
3249  if (!result)
3250  throwImageException();
3251 
3252  return(result);
3253 }
3254 
3255 const Magick::PixelPacket* Magick::Image::getConstPixels(const ssize_t x_,
3256  const ssize_t y_,const size_t columns_,const size_t rows_) const
3257 {
3258  const PixelPacket
3259  *result;
3260 
3262  result=GetVirtualPixels(constImage(),x_,y_,columns_,rows_,exceptionInfo);
3264  return(result);
3265 }
3266 
3267 Magick::IndexPacket *Magick::Image::getIndexes(void)
3268 {
3269  Magick::IndexPacket
3270  *result;
3271 
3272  result=GetAuthenticIndexQueue(image());
3273 
3274  if(!result)
3275  throwImageException();
3276 
3277  return(result);
3278 }
3279 
3280 Magick::PixelPacket *Magick::Image::getPixels(const ssize_t x_,
3281  const ssize_t y_,const size_t columns_,const size_t rows_)
3282 {
3283  PixelPacket
3284  *result;
3285 
3286  modifyImage();
3288  result=GetAuthenticPixels(image(),x_,y_,columns_,rows_,exceptionInfo);
3290  return(result);
3291 }
3292 
3293 void Magick::Image::grayscale(const PixelIntensityMethod method_)
3294 {
3295  modifyImage();
3296  (void) GrayscaleImage(image(),method_);
3297  throwImageException();
3298 }
3299 
3300 void Magick::Image::haldClut(const Image &clutImage_)
3301 {
3302  modifyImage();
3303  (void) HaldClutImage(image(),clutImage_.constImage());
3304  throwImageException();
3305 }
3306 
3307 void Magick::Image::houghLine(const size_t width_,const size_t height_,
3308  const size_t threshold_)
3309 {
3311  *newImage;
3312 
3314  newImage=HoughLineImage(constImage(),width_,height_,threshold_,
3315  exceptionInfo);
3316  replaceImage(newImage);
3318 }
3319 
3320 void Magick::Image::implode(const double factor_)
3321 {
3323  *newImage;
3324 
3326  newImage=ImplodeImage(constImage(),factor_,exceptionInfo);
3327  replaceImage(newImage);
3329 }
3330 
3332 {
3333  inverseFourierTransform(phase_,true);
3334 }
3335 
3337  const bool magnitude_)
3338 {
3340  *newImage;
3341 
3343  newImage=InverseFourierTransformImage(constImage(),phase_.constImage(),
3344  magnitude_ == true ? MagickTrue : MagickFalse,exceptionInfo);
3345  replaceImage(newImage);
3347 }
3348 
3349 void Magick::Image::kuwahara(const double radius_,const double sigma_)
3350 {
3352  *newImage;
3353 
3355  newImage=KuwaharaImage(constImage(),radius_,sigma_,exceptionInfo);
3356  replaceImage(newImage);
3358 }
3359 
3360 void Magick::Image::kuwaharaChannel(const ChannelType channel_,
3361  const double radius_,const double sigma_)
3362 {
3364  *newImage;
3365 
3367  newImage=KuwaharaImageChannel(constImage(),channel_,radius_,sigma_,
3368  exceptionInfo);
3369  replaceImage(newImage);
3371 }
3372 
3373 void Magick::Image::level(const double black_point,const double white_point,
3374  const double gamma)
3375 {
3376  char
3377  levels[MaxTextExtent];
3378 
3379  modifyImage();
3380  FormatLocaleString(levels,MaxTextExtent,"%g,%g,%g",black_point,white_point,
3381  gamma);
3382  (void) LevelImage(image(),levels);
3383  throwImageException();
3384 }
3385 
3386 void Magick::Image::levelChannel(const Magick::ChannelType channel,
3387  const double black_point,const double white_point,const double gamma)
3388 {
3389  modifyImage();
3390  (void) LevelImageChannel(image(),channel,black_point,white_point,gamma);
3391  throwImageException();
3392 }
3393 
3394 void Magick::Image::levelColors(const Color &blackColor_,
3395  const Color &whiteColor_,const bool invert_)
3396 {
3397  MagickPixelPacket
3398  black,
3399  white;
3400 
3401  PixelPacket
3402  pixel;
3403 
3404  modifyImage();
3405 
3406  GetMagickPixelPacket(image(),&black);
3407  pixel=static_cast<PixelPacket>(blackColor_);
3408  black.red=pixel.red;
3409  black.green=pixel.green;
3410  black.blue=pixel.blue;
3411  black.opacity=pixel.opacity;
3412 
3413  GetMagickPixelPacket(image(),&white);
3414  pixel=static_cast<PixelPacket>(whiteColor_);
3415  white.red=pixel.red;
3416  white.green=pixel.green;
3417  white.blue=pixel.blue;
3418  white.opacity=pixel.opacity;
3419 
3420  (void) LevelColorsImage(image(),&black,&white,
3421  invert_ == true ? MagickTrue : MagickFalse);
3422  throwImageException();
3423 }
3424 
3425 void Magick::Image::levelColorsChannel(const ChannelType channel_,
3426  const Color &blackColor_,const Color &whiteColor_,const bool invert_)
3427 {
3428  MagickPixelPacket
3429  black,
3430  white;
3431 
3432  PixelPacket
3433  pixel;
3434 
3435  modifyImage();
3436 
3437  GetMagickPixelPacket(image(),&black);
3438  pixel=static_cast<PixelPacket>(blackColor_);
3439  black.red=pixel.red;
3440  black.green=pixel.green;
3441  black.blue=pixel.blue;
3442  black.opacity=pixel.opacity;
3443 
3444  GetMagickPixelPacket(image(),&white);
3445  pixel=static_cast<PixelPacket>(whiteColor_);
3446  white.red=pixel.red;
3447  white.green=pixel.green;
3448  white.blue=pixel.blue;
3449  white.opacity=pixel.opacity;
3450 
3451  (void) LevelColorsImageChannel(image(),channel_,&black,&white,
3452  invert_ == true ? MagickTrue : MagickFalse);
3453  throwImageException();
3454 }
3455 
3456 void Magick::Image::levelize(const double blackPoint_,const double whitePoint_,
3457  const double gamma_)
3458 {
3459  modifyImage();
3460  (void) LevelizeImage(image(),blackPoint_,whitePoint_,gamma_);
3461  throwImageException();
3462 }
3463 
3464 void Magick::Image::levelizeChannel(const ChannelType channel_,
3465  const double blackPoint_,const double whitePoint_,const double gamma_)
3466 {
3467  modifyImage();
3468  (void) LevelizeImageChannel(image(),channel_,blackPoint_,whitePoint_,gamma_);
3469  throwImageException();
3470 }
3471 
3472 void Magick::Image::linearStretch(const double blackPoint_,
3473  const double whitePoint_)
3474 {
3475  modifyImage();
3476  LinearStretchImage(image(),blackPoint_,whitePoint_);
3477  throwImageException();
3478 }
3479 
3481 {
3483  *newImage;
3484 
3485  size_t
3486  height=rows(),
3487  width=columns();
3488 
3489  ssize_t
3490  x=0,
3491  y=0;
3492 
3493  ParseMetaGeometry(static_cast<std::string>(geometry_).c_str(),&x,&y,&width,
3494  &height);
3495 
3497  newImage=LiquidRescaleImage(constImage(),width,height,x,y,exceptionInfo);
3498  replaceImage(newImage);
3500 }
3501 
3502 void Magick::Image::localContrast(const double radius_,const double strength_)
3503 {
3505  *newImage;
3506 
3508  newImage=LocalContrastImage(constImage(),radius_,strength_,exceptionInfo);
3509  replaceImage(newImage);
3511 }
3512 
3514 {
3516  *newImage;
3517 
3519  newImage=MagnifyImage(constImage(),exceptionInfo);
3520  replaceImage(newImage);
3522 }
3523 
3524 void Magick::Image::map(const Image &mapImage_,const bool dither_)
3525 {
3526  modifyImage();
3527  options()->quantizeDither(dither_);
3528  RemapImage(options()->quantizeInfo(),image(),mapImage_.constImage());
3529  throwImageException();
3530 }
3531 
3533  const unsigned int opacity_,const ssize_t x_,const ssize_t y_,
3534  const Magick::PaintMethod method_)
3535 {
3536  floodFillOpacity(x_,y_,opacity_,target_,
3537  method_ == FloodfillMethod ? false : true);
3538 }
3539 
3540 void Magick::Image::medianFilter(const double radius_)
3541 {
3543  *newImage;
3544 
3546  newImage=StatisticImage(constImage(),MedianStatistic,(size_t) radius_,
3547  (size_t) radius_,exceptionInfo);
3548  replaceImage(newImage);
3550 }
3551 
3552 void Magick::Image::mergeLayers(const ImageLayerMethod layerMethod_)
3553 {
3555  *newImage;
3556 
3558  newImage=MergeImageLayers(image(),layerMethod_,exceptionInfo);
3559  replaceImage(newImage);
3561 }
3562 
3564 {
3566  *newImage;
3567 
3569  newImage=MinifyImage(constImage(),exceptionInfo);
3570  replaceImage(newImage);
3572 }
3573 
3574 void Magick::Image::modulate(const double brightness_,const double saturation_,
3575  const double hue_)
3576 {
3577  char
3578  modulate[MaxTextExtent + 1];
3579 
3580  FormatLocaleString(modulate,MaxTextExtent,"%3.6f,%3.6f,%3.6f",brightness_,
3581  saturation_,hue_);
3582 
3583  modifyImage();
3584  ModulateImage(image(),modulate);
3585  throwImageException();
3586 }
3587 
3589 {
3590  return(ImageMoments(*this));
3591 }
3592 
3593 void Magick::Image::morphology(const MorphologyMethod method_,
3594  const std::string kernel_,const ssize_t iterations_)
3595 {
3596  KernelInfo
3597  *kernel;
3598 
3600  *newImage;
3601 
3602  kernel=AcquireKernelInfo(kernel_.c_str());
3603  if (kernel == (KernelInfo *)NULL)
3604  throwExceptionExplicit(OptionError,"Unable to parse kernel.");
3605 
3607  newImage=MorphologyImage(constImage(),method_,iterations_,kernel,
3608  exceptionInfo);
3609  replaceImage(newImage);
3610  kernel=DestroyKernelInfo(kernel);
3612 }
3613 
3614 void Magick::Image::morphology(const MorphologyMethod method_,
3615  const KernelInfoType kernel_,const std::string arguments_,
3616  const ssize_t iterations_)
3617 {
3618  const char
3619  *option;
3620 
3621  std::string
3622  kernel;
3623 
3624  option=CommandOptionToMnemonic(MagickKernelOptions,kernel_);
3625  if (option == (const char *)NULL)
3626  {
3627  throwExceptionExplicit(OptionError,"Unable to determine kernel type.");
3628  return;
3629  }
3630 
3631  kernel=std::string(option);
3632  if (!arguments_.empty())
3633  kernel+=":"+arguments_;
3634 
3635  morphology(method_,kernel,iterations_);
3636 }
3637 
3638 void Magick::Image::morphologyChannel(const ChannelType channel_,
3639  const MorphologyMethod method_,const std::string kernel_,
3640  const ssize_t iterations_)
3641 {
3642  KernelInfo
3643  *kernel;
3644 
3646  *newImage;
3647 
3648  kernel=AcquireKernelInfo(kernel_.c_str());
3649  if (kernel == (KernelInfo *)NULL)
3650  {
3651  throwExceptionExplicit(OptionError,"Unable to parse kernel.");
3652  return;
3653  }
3654 
3656  newImage=MorphologyImageChannel(constImage(),channel_,method_,iterations_,
3657  kernel,exceptionInfo);
3658  replaceImage(newImage);
3659  kernel=DestroyKernelInfo(kernel);
3661 }
3662 
3663 void Magick::Image::morphologyChannel(const ChannelType channel_,
3664  const MorphologyMethod method_,const KernelInfoType kernel_,
3665  const std::string arguments_,const ssize_t iterations_)
3666 {
3667  const char
3668  *option;
3669 
3670  std::string
3671  kernel;
3672 
3673  option=CommandOptionToMnemonic(MagickKernelOptions,kernel_);
3674  if (option == (const char *)NULL)
3675  {
3676  throwExceptionExplicit(OptionError,"Unable to determine kernel type.");
3677  return;
3678  }
3679 
3680  kernel=std::string(option);
3681  if (!arguments_.empty())
3682  kernel+=":"+arguments_;
3683 
3684  morphologyChannel(channel_,method_,kernel,iterations_);
3685 }
3686 
3687 void Magick::Image::motionBlur(const double radius_,const double sigma_,
3688  const double angle_)
3689 {
3691  *newImage;
3692 
3694  newImage=MotionBlurImage(constImage(),radius_,sigma_,angle_,exceptionInfo);
3695  replaceImage(newImage);
3697 }
3698 
3699 void Magick::Image::negate(const bool grayscale_)
3700 {
3701  modifyImage();
3702  NegateImage(image(),(MagickBooleanType) grayscale_);
3703  throwImageException();
3704 }
3705 
3706 void Magick::Image::negateChannel(const ChannelType channel_,
3707  const bool grayscale_)
3708 {
3709  modifyImage();
3710  NegateImageChannel(image(),channel_,(MagickBooleanType) grayscale_);
3711  throwImageException();
3712 }
3713 
3715 {
3716  modifyImage();
3717  NormalizeImage(image());
3718  throwImageException();
3719 }
3720 
3721 void Magick::Image::oilPaint(const double radius_)
3722 {
3724  *newImage;
3725 
3727  newImage=OilPaintImage(constImage(),radius_,exceptionInfo);
3728  replaceImage(newImage);
3730 }
3731 
3732 void Magick::Image::opacity(const unsigned int opacity_)
3733 {
3734  modifyImage();
3735  SetImageOpacity(image(),opacity_);
3736 }
3737 void Magick::Image::opaque(const Color &opaqueColor_,const Color &penColor_,
3738  const bool invert_)
3739 {
3740  MagickPixelPacket
3741  opaque,
3742  pen;
3743 
3744  std::string
3745  opaqueColor,
3746  penColor;
3747 
3748  if (!opaqueColor_.isValid())
3749  throwExceptionExplicit(OptionError,"Opaque color argument is invalid");
3750 
3751  if (!penColor_.isValid())
3752  throwExceptionExplicit(OptionError,"Pen color argument is invalid");
3753 
3754  opaqueColor=opaqueColor_;
3755  penColor=penColor_;
3756 
3757  (void) QueryMagickColor(opaqueColor.c_str(),&opaque,&image()->exception);
3758  (void) QueryMagickColor(penColor.c_str(),&pen,&image()->exception);
3759  modifyImage();
3760  OpaquePaintImage(image(),&opaque,&pen,invert_ ? MagickTrue : MagickFalse);
3761  throwImageException();
3762 }
3763 
3764 void Magick::Image::orderedDither(std::string thresholdMap_)
3765 {
3766  modifyImage();
3768  (void) OrderedPosterizeImage(image(),thresholdMap_.c_str(),exceptionInfo);
3770 }
3771 
3772 void Magick::Image::orderedDitherChannel(const ChannelType channel_,
3773  std::string thresholdMap_)
3774 {
3775  modifyImage();
3777  (void) OrderedPosterizeImageChannel(image(),channel_,thresholdMap_.c_str(),
3778  exceptionInfo);
3780 }
3781 
3782 void Magick::Image::perceptible(const double epsilon_)
3783 {
3784  modifyImage();
3785  PerceptibleImage(image(),epsilon_);
3786  throwImageException();
3787 }
3788 
3789 void Magick::Image::perceptibleChannel(const ChannelType channel_,
3790  const double epsilon_)
3791 {
3792  modifyImage();
3793  PerceptibleImageChannel(image(),channel_,epsilon_);
3794  throwImageException();
3795 }
3796 
3797 void Magick::Image::ping(const Blob& blob_)
3798 {
3800  *newImage;
3801 
3803  newImage=PingBlob(imageInfo(),blob_.data(),blob_.length(),exceptionInfo);
3804  read(newImage,exceptionInfo);
3805 }
3806 
3807 void Magick::Image::ping(const std::string &imageSpec_)
3808 {
3810  *newImage;
3811 
3813  options()->fileName(imageSpec_);
3814  newImage=PingImage(imageInfo(),exceptionInfo);
3815  read(newImage,exceptionInfo);
3816 }
3817 
3818 void Magick::Image::pixelColor(const ssize_t x_,const ssize_t y_,
3819  const Color &color_)
3820 {
3821  // Test arguments to ensure they are within the image.
3822  if (y_ > (ssize_t) rows() || x_ > (ssize_t) columns())
3823  throwExceptionExplicit(OptionError,"Access outside of image boundary");
3824 
3825  modifyImage();
3826 
3827  // Set image to DirectClass
3828  classType(DirectClass);
3829 
3830  // Get pixel view
3831  Pixels pixels(*this);
3832  // Set pixel value
3833  *(pixels.get(x_,y_,1,1))=color_;
3834  // Tell ImageMagick that pixels have been updated
3835  pixels.sync();
3836 }
3837 
3838 Magick::Color Magick::Image::pixelColor(const ssize_t x_,
3839  const ssize_t y_) const
3840 {
3841  ClassType
3842  storage_class;
3843 
3844  storage_class=classType();
3845  if (storage_class == DirectClass)
3846  {
3847  const PixelPacket
3848  *pixel;
3849 
3850  pixel=getConstPixels(x_,y_,1,1);
3851  if (pixel)
3852  return(Color(*pixel));
3853  }
3854  else if (storage_class == PseudoClass)
3855  {
3856  const IndexPacket
3857  *indexes;
3858 
3859  indexes=getConstIndexes();
3860  if(indexes)
3861  return(colorMap((size_t) *indexes));
3862  }
3863 
3864  return(Color()); // invalid
3865 }
3866 
3867 void Magick::Image::polaroid(const std::string &caption_,const double angle_)
3868 {
3870  *newImage;
3871 
3873  (void) SetImageProperty(image(),"Caption",caption_.c_str());
3874  newImage=PolaroidImage(constImage(),options()->drawInfo(),angle_,
3875  exceptionInfo);
3876  replaceImage(newImage);
3878 }
3879 
3880 void Magick::Image::posterize(const size_t levels_,const bool dither_)
3881 {
3882  modifyImage();
3883  PosterizeImage(image(),levels_,(MagickBooleanType) dither_);
3884  throwImageException();
3885 }
3886 
3887 void Magick::Image::posterizeChannel(const ChannelType channel_,
3888  const size_t levels_,const bool dither_)
3889 {
3890  modifyImage();
3891  PosterizeImageChannel(image(),channel_,levels_,
3892  (MagickBooleanType) dither_);
3893  throwImageException();
3894 }
3895 
3896 void Magick::Image::process(std::string name_,const ssize_t argc,
3897  const char **argv)
3898 {
3899  size_t
3900  status;
3901 
3902  modifyImage();
3903 
3904  status=InvokeDynamicImageFilter(name_.c_str(),&image(),argc, argv,
3905  &image()->exception);
3906 
3907  if (status == false)
3908  throwImageException();
3909 }
3910 
3911 void Magick::Image::profile(const std::string name_,
3912  const Magick::Blob &profile_)
3913 {
3914  ssize_t
3915  result;
3916 
3917  modifyImage();
3918  result=ProfileImage(image(),name_.c_str(),(unsigned char *)profile_.data(),
3919  profile_.length(),MagickTrue);
3920 
3921  if (!result)
3922  throwImageException();
3923 }
3924 
3925 Magick::Blob Magick::Image::profile(const std::string name_) const
3926 {
3927  const StringInfo
3928  *profile;
3929 
3930  profile=GetImageProfile(constImage(),name_.c_str());
3931 
3932  if (profile == (StringInfo *) NULL)
3933  return(Blob());
3934  return(Blob((void*) GetStringInfoDatum(profile),GetStringInfoLength(
3935  profile)));
3936 }
3937 
3938 void Magick::Image::quantize(const bool measureError_)
3939 {
3940  modifyImage();
3941 
3942  if (measureError_)
3943  options()->quantizeInfo()->measure_error=MagickTrue;
3944  else
3945  options()->quantizeInfo()->measure_error=MagickFalse;
3946 
3947  QuantizeImage(options()->quantizeInfo(),image());
3948 
3949  throwImageException();
3950 }
3951 
3952 void Magick::Image::quantumOperator(const ChannelType channel_,
3953  const MagickEvaluateOperator operator_,double rvalue_)
3954 {
3956  EvaluateImageChannel(image(),channel_,operator_,rvalue_,exceptionInfo);
3958 }
3959 
3960 void Magick::Image::quantumOperator(const ChannelType channel_,
3961  const MagickFunction function_,const size_t number_parameters_,
3962  const double *parameters_)
3963 {
3965  FunctionImageChannel(image(),channel_,function_,number_parameters_,
3966  parameters_,exceptionInfo);
3968 }
3969 
3970 void Magick::Image::quantumOperator(const ssize_t x_,const ssize_t y_,
3971  const size_t columns_,const size_t rows_,const ChannelType channel_,
3972  const MagickEvaluateOperator operator_,const double rvalue_)
3973 {
3975  *cropImage;
3976 
3977  RectangleInfo
3978  geometry;
3979 
3981  geometry.width=columns_;
3982  geometry.height=rows_;
3983  geometry.x=x_;
3984  geometry.y=y_;
3985  cropImage=CropImage(image(),&geometry,exceptionInfo);
3986  EvaluateImageChannel(cropImage,channel_,operator_,rvalue_,exceptionInfo);
3987  (void) CompositeImage(image(),image()->matte != MagickFalse ?
3988  OverCompositeOp : CopyCompositeOp,cropImage,geometry.x, geometry.y);
3989  cropImage=DestroyImageList(cropImage);
3991 }
3992 
3993 void Magick::Image::raise(const Geometry &geometry_,const bool raisedFlag_)
3994 {
3995  RectangleInfo
3996  raiseInfo;
3997 
3998  raiseInfo=geometry_;
3999  modifyImage();
4000  RaiseImage(image(),&raiseInfo,raisedFlag_ == true ?
4001  MagickTrue : MagickFalse);
4002  throwImageException();
4003 }
4004 
4005 void Magick::Image::randomThreshold( const Geometry &thresholds_ )
4006 {
4008  modifyImage();
4009  (void) RandomThresholdImage(image(),static_cast<std::string>(
4010  thresholds_).c_str(),exceptionInfo);
4012 }
4013 
4015  const ChannelType channel_)
4016 {
4018  modifyImage();
4019  (void) RandomThresholdImageChannel(image(),channel_,static_cast<std::string>(
4020  thresholds_).c_str(),exceptionInfo);
4022 }
4023 
4024 void Magick::Image::read(const Blob &blob_)
4025 {
4027  *newImage;
4028 
4030  newImage=BlobToImage(imageInfo(),static_cast<const void *>(blob_.data()),
4031  blob_.length(),exceptionInfo);
4032  read(newImage,exceptionInfo);
4033 }
4034 
4035 void Magick::Image::read(const Blob &blob_,const Geometry &size_)
4036 {
4037  size(size_);
4038  read(blob_);
4039 }
4040 
4041 void Magick::Image::read(const Blob &blob_,const Geometry &size_,
4042  const size_t depth_)
4043 {
4044  size(size_);
4045  depth(depth_);
4046  read(blob_);
4047 }
4048 
4049 void Magick::Image::read(const Blob &blob_,const Geometry &size_,
4050  const size_t depth_,const std::string &magick_)
4051 {
4052  size(size_);
4053  depth(depth_);
4054  magick(magick_);
4055  fileName(magick_ + ':');
4056  read(blob_);
4057 }
4058 
4059 void Magick::Image::read(const Blob &blob_,const Geometry &size_,
4060  const std::string &magick_)
4061 {
4062  size(size_);
4063  magick(magick_);
4064  fileName(magick_ + ':');
4065  read(blob_);
4066 }
4067 
4068 void Magick::Image::read(const Geometry &size_,const std::string &imageSpec_)
4069 {
4070  size(size_);
4071  read(imageSpec_);
4072 }
4073 
4074 void Magick::Image::read(const size_t width_,const size_t height_,
4075  const std::string &map_,const StorageType type_,const void *pixels_)
4076 {
4078  *newImage;
4079 
4081  newImage=ConstituteImage(width_,height_,map_.c_str(),type_,pixels_,
4082  exceptionInfo);
4083  replaceImage(newImage);
4085  if (newImage)
4086  throwException(&newImage->exception,quiet());
4087 }
4088 
4089 void Magick::Image::read(const std::string &imageSpec_)
4090 {
4092  *newImage;
4093 
4094  options()->fileName(imageSpec_);
4095 
4097  newImage=ReadImage(imageInfo(),exceptionInfo);
4098  read(newImage,exceptionInfo);
4099 }
4100 
4101 void Magick::Image::readPixels(const Magick::QuantumType quantum_,
4102  const unsigned char *source_)
4103 {
4104  QuantumInfo
4105  *quantum_info;
4106 
4108  quantum_info=AcquireQuantumInfo(imageInfo(),image());
4109  ImportQuantumPixels(image(),(MagickCore::CacheView *) NULL,quantum_info,
4110  quantum_,source_,exceptionInfo);
4111  quantum_info=DestroyQuantumInfo(quantum_info);
4113 }
4114 
4115 void Magick::Image::reduceNoise(const double order_)
4116 {
4118  *newImage;
4119 
4121  newImage=StatisticImage(constImage(),NonpeakStatistic,(size_t) order_,
4122  (size_t) order_,exceptionInfo);
4123  replaceImage(newImage);
4125 }
4126 
4128 {
4129  modifyImage();
4130  options()->page(Geometry());
4131  image()->page.width = 0;
4132  image()->page.height = 0;
4133  image()->page.x = 0;
4134  image()->page.y = 0;
4135 }
4136 
4137 void Magick::Image::resample(const Geometry &geometry_)
4138 {
4140  *newImage;
4141 
4142  size_t
4143  width=columns(),
4144  height=rows();
4145 
4146  ssize_t
4147  x=0,
4148  y=0;
4149 
4150  ParseMetaGeometry(static_cast<std::string>(geometry_).c_str(),&x, &y,&width,
4151  &height);
4152 
4154  newImage=ResampleImage(constImage(),width,height,image()->filter,1.0,
4155  exceptionInfo);
4156  replaceImage(newImage);
4158 }
4159 
4160 void Magick::Image::resize(const Geometry &geometry_)
4161 {
4163  *newImage;
4164 
4165  size_t
4166  width=columns(),
4167  height=rows();
4168 
4169  ssize_t
4170  x=0,
4171  y=0;
4172 
4173  ParseMetaGeometry(static_cast<std::string>(geometry_).c_str(),&x, &y,&width,
4174  &height);
4175 
4177  newImage=ResizeImage(constImage(),width,height,image()->filter,1.0,
4178  exceptionInfo);
4179  replaceImage(newImage);
4181 }
4182 
4183 void Magick::Image::roll(const Geometry &roll_)
4184 {
4186  *newImage;
4187 
4188  ssize_t
4189  xOff=roll_.xOff(),
4190  yOff=roll_.yOff();
4191 
4192  if (roll_.xNegative())
4193  xOff=0-xOff;
4194  if (roll_.yNegative())
4195  yOff=0-yOff;
4196 
4198  newImage=RollImage(constImage(),xOff,yOff,exceptionInfo);
4199  replaceImage(newImage);
4201 }
4202 
4203 void Magick::Image::roll(const size_t columns_,const size_t rows_)
4204 {
4206  *newImage;
4207 
4209  newImage=RollImage(constImage(),static_cast<ssize_t>(columns_),
4210  static_cast<ssize_t>(rows_),exceptionInfo);
4211  replaceImage(newImage);
4213 }
4214 
4215 void Magick::Image::rotate(const double degrees_)
4216 {
4218  *newImage;
4219 
4221  newImage=RotateImage(constImage(),degrees_,exceptionInfo);
4222  replaceImage(newImage);
4224 }
4225 
4226 void Magick::Image::rotationalBlur(const double angle_)
4227 {
4229  *newImage;
4230 
4232  newImage=RotationalBlurImage(constImage(),angle_,exceptionInfo);
4233  replaceImage(newImage);
4235 }
4236 
4237 void Magick::Image::rotationalBlurChannel(const ChannelType channel_,
4238  const double angle_)
4239 {
4241  *newImage;
4242 
4244  newImage=RotationalBlurImageChannel(constImage(),channel_,angle_,
4245  exceptionInfo);
4246  replaceImage(newImage);
4248 }
4249 
4250 void Magick::Image::sample(const Geometry &geometry_)
4251 {
4253  *newImage;
4254 
4255  size_t
4256  height=rows(),
4257  width=columns();
4258 
4259  ssize_t
4260  x=0,
4261  y=0;
4262 
4263  ParseMetaGeometry(static_cast<std::string>(geometry_).c_str(),&x,&y,&width,
4264  &height);
4265 
4267  newImage=SampleImage(constImage(),width,height,exceptionInfo);
4268  replaceImage(newImage);
4270 }
4271 
4272 void Magick::Image::scale(const Geometry &geometry_)
4273 {
4275  *newImage;
4276 
4277  size_t
4278  height=rows(),
4279  width=columns();
4280 
4281  ssize_t
4282  x=0,
4283  y=0;
4284 
4285  ParseMetaGeometry(static_cast<std::string>(geometry_).c_str(),&x,&y,&width,
4286  &height);
4287 
4289  newImage=ScaleImage(constImage(),width,height,exceptionInfo);
4290  replaceImage(newImage);
4292 }
4293 
4294 void Magick::Image::segment(const double clusterThreshold_,
4295  const double smoothingThreshold_)
4296 {
4297  modifyImage();
4298  SegmentImage(image(),options()->quantizeColorSpace(),
4299  (MagickBooleanType) options()->verbose(),clusterThreshold_,
4300  smoothingThreshold_);
4301  throwImageException();
4302  SyncImage(image());
4303  throwImageException();
4304 }
4305 
4306 void Magick::Image::selectiveBlur(const double radius_,const double sigma_,
4307  const double threshold_)
4308 {
4310  *newImage;
4311 
4313  newImage=SelectiveBlurImage(constImage(),radius_,sigma_,threshold_,
4314  exceptionInfo);
4315  replaceImage(newImage);
4317 }
4318 
4319 void Magick::Image::selectiveBlurChannel(const ChannelType channel_,
4320  const double radius_,const double sigma_,const double threshold_)
4321 {
4323  *newImage;
4324 
4326  newImage=SelectiveBlurImageChannel(constImage(),channel_,radius_,sigma_,
4327  threshold_,exceptionInfo);
4328  replaceImage(newImage);
4330 }
4331 
4332 Magick::Image Magick::Image::separate(const ChannelType channel_) const
4333 {
4335  *image;
4336 
4338  image=SeparateImage(constImage(),channel_,exceptionInfo);
4340  if (image == (MagickCore::Image *) NULL)
4341  return(Magick::Image());
4342  else
4343  return(Magick::Image(image));
4344 }
4345 
4346 void Magick::Image::sepiaTone(const double threshold_)
4347 {
4349  *newImage;
4350 
4352  newImage=SepiaToneImage(constImage(),threshold_,exceptionInfo);
4353  replaceImage(newImage);
4355 }
4356 
4357 Magick::PixelPacket *Magick::Image::setPixels(const ssize_t x_,
4358  const ssize_t y_,const size_t columns_,const size_t rows_)
4359 {
4360  PixelPacket
4361  *result;
4362 
4363  modifyImage();
4365  result=QueueAuthenticPixels(image(),x_, y_,columns_,rows_,exceptionInfo);
4367  return(result);
4368 }
4369 
4370 void Magick::Image::shade(const double azimuth_,const double elevation_,
4371  const bool colorShading_)
4372 {
4374  *newImage;
4375 
4377  newImage=ShadeImage(constImage(),colorShading_ == true ?
4378  MagickTrue : MagickFalse,azimuth_,elevation_,exceptionInfo);
4379  replaceImage(newImage);
4381 }
4382 
4383 void Magick::Image::shadow(const double percent_opacity_,const double sigma_,
4384  const ssize_t x_,const ssize_t y_)
4385 {
4387  *newImage;
4388 
4390  newImage=ShadowImage(constImage(),percent_opacity_,sigma_,x_,y_,exceptionInfo);
4391  replaceImage(newImage);
4393 }
4394 
4395 void Magick::Image::sharpen(const double radius_,const double sigma_)
4396 {
4398  *newImage;
4399 
4401  newImage=SharpenImage(constImage(),radius_,sigma_,exceptionInfo);
4402  replaceImage(newImage);
4404 }
4405 
4406 void Magick::Image::sharpenChannel(const ChannelType channel_,
4407  const double radius_,const double sigma_)
4408 {
4410  *newImage;
4411 
4413  newImage=SharpenImageChannel(constImage(),channel_,radius_,sigma_,
4414  exceptionInfo);
4415  replaceImage(newImage);
4417 }
4418 
4419 void Magick::Image::shave(const Geometry &geometry_)
4420 {
4422  *newImage;
4423 
4424  RectangleInfo
4425  shaveInfo=geometry_;
4426 
4428  newImage=ShaveImage(constImage(),&shaveInfo,exceptionInfo);
4429  replaceImage(newImage);
4431 }
4432 
4433 void Magick::Image::shear(const double xShearAngle_,const double yShearAngle_)
4434 {
4436  *newImage;
4437 
4439  newImage=ShearImage(constImage(),xShearAngle_,yShearAngle_,exceptionInfo);
4440  replaceImage(newImage);
4442 }
4443 
4444 void Magick::Image::sigmoidalContrast(const size_t sharpen_,
4445  const double contrast,const double midpoint)
4446 {
4447  modifyImage();
4448  (void) SigmoidalContrastImageChannel(image(),DefaultChannels,
4449  (MagickBooleanType) sharpen_,contrast,midpoint);
4450  throwImageException();
4451 }
4452 
4453 std::string Magick::Image::signature(const bool force_) const
4454 {
4455  const char
4456  *property;
4457 
4458  Lock lock(&_imgRef->_mutexLock);
4459 
4460  // Re-calculate image signature if necessary
4461  if (force_ || !GetImageProperty(constImage(), "Signature") ||
4462  constImage()->taint)
4463  SignatureImage(const_cast<MagickCore::Image *>(constImage()));
4464 
4465  property=GetImageProperty(constImage(),"Signature");
4466 
4467  return(std::string(property));
4468 }
4469 
4470 void Magick::Image::sketch(const double radius_,const double sigma_,
4471  const double angle_)
4472 {
4474  *newImage;
4475 
4477  newImage=SketchImage(constImage(),radius_,sigma_,angle_,exceptionInfo);
4478  replaceImage(newImage);
4480 }
4481 
4482 void Magick::Image::solarize(const double factor_)
4483 {
4484  modifyImage();
4485  SolarizeImage(image(),factor_);
4486  throwImageException();
4487 }
4488 
4489 void Magick::Image::sparseColor(const ChannelType channel,
4490  const SparseColorMethod method,const size_t number_arguments,
4491  const double *arguments)
4492 {
4494  *newImage;
4495 
4497  newImage=SparseColorImage(constImage(),channel,method,number_arguments,
4498  arguments,exceptionInfo);
4499  replaceImage(newImage);
4501 }
4502 
4503 void Magick::Image::splice(const Geometry &geometry_)
4504 {
4506  *newImage;
4507 
4508  RectangleInfo
4509  spliceInfo=geometry_;
4510 
4512  newImage=SpliceImage(constImage(),&spliceInfo,exceptionInfo);
4513  replaceImage(newImage);
4515 }
4516 
4517 void Magick::Image::splice(const Geometry &geometry_,
4518  const Color &backgroundColor_)
4519 {
4520  backgroundColor(backgroundColor_);
4521  splice(geometry_);
4522 }
4523 
4524 void Magick::Image::splice(const Geometry &geometry_,
4525  const Color &backgroundColor_,const GravityType gravity_)
4526 {
4527  backgroundColor(backgroundColor_);
4528  image()->gravity=gravity_;
4529  splice(geometry_);
4530 }
4531 
4532 void Magick::Image::spread(const size_t amount_)
4533 {
4535  *newImage;
4536 
4538  newImage=SpreadImage(constImage(),amount_,exceptionInfo);
4539  replaceImage(newImage);
4541 }
4542 
4544 {
4545  double
4546  maximum,
4547  minimum;
4548 
4550  (void) GetImageChannelRange(constImage(),RedChannel,&minimum,&maximum,
4551  exceptionInfo);
4552  statistics->red.minimum=minimum;
4553  statistics->red.maximum=maximum;
4554  (void) GetImageChannelMean(constImage(),RedChannel,&statistics->red.mean,
4555  &statistics->red.standard_deviation,exceptionInfo);
4556  (void) GetImageChannelKurtosis(constImage(),RedChannel,
4557  &statistics->red.kurtosis,&statistics->red.skewness,exceptionInfo);
4558  (void) GetImageChannelRange(constImage(),GreenChannel,&minimum,&maximum,
4559  exceptionInfo);
4560  statistics->green.minimum=minimum;
4561  statistics->green.maximum=maximum;
4562  (void) GetImageChannelMean(constImage(),GreenChannel,&statistics->green.mean,
4563  &statistics->green.standard_deviation,exceptionInfo);
4564  (void) GetImageChannelKurtosis(constImage(),GreenChannel,
4565  &statistics->green.kurtosis,&statistics->green.skewness,exceptionInfo);
4566  (void) GetImageChannelRange(constImage(),BlueChannel,&minimum,&maximum,
4567  exceptionInfo);
4568  statistics->blue.minimum=minimum;
4569  statistics->blue.maximum=maximum;
4570  (void) GetImageChannelMean(constImage(),BlueChannel,&statistics->blue.mean,
4571  &statistics->blue.standard_deviation,exceptionInfo);
4572  (void) GetImageChannelKurtosis(constImage(),BlueChannel,
4573  &statistics->blue.kurtosis,&statistics->blue.skewness,exceptionInfo);
4574  (void) GetImageChannelRange(constImage(),OpacityChannel,&minimum,&maximum,
4575  exceptionInfo);
4576  statistics->opacity.minimum=minimum;
4577  statistics->opacity.maximum=maximum;
4578  (void) GetImageChannelMean(constImage(),OpacityChannel,
4579  &statistics->opacity.mean,&statistics->opacity.standard_deviation,
4580  exceptionInfo);
4581  (void) GetImageChannelKurtosis(constImage(),OpacityChannel,
4582  &statistics->opacity.kurtosis,&statistics->opacity.skewness,
4583  exceptionInfo);
4585 }
4586 
4587 void Magick::Image::stegano(const Image &watermark_)
4588 {
4590  *newImage;
4591 
4593  newImage=SteganoImage(constImage(),watermark_.constImage(),exceptionInfo);
4594  replaceImage(newImage);
4596 }
4597 
4598 void Magick::Image::stereo(const Image &rightImage_)
4599 {
4601  *newImage;
4602 
4604  newImage=StereoImage(constImage(),rightImage_.constImage(),exceptionInfo);
4605  replaceImage(newImage);
4607 }
4608 
4610 {
4611  modifyImage();
4612  StripImage(image());
4613  throwImageException();
4614 }
4615 
4617  const MetricType metric_,Geometry *offset_,double *similarityMetric_,
4618  const double similarityThreshold)
4619 {
4620  char
4621  artifact[MaxTextExtent];
4622 
4624  *newImage;
4625 
4626  RectangleInfo
4627  offset;
4628 
4629  modifyImage();
4630  (void) FormatLocaleString(artifact,MaxTextExtent,"%g",similarityThreshold);
4631  (void) SetImageArtifact(image(),"compare:similarity-threshold",artifact);
4632 
4634  newImage=SimilarityMetricImage(image(),reference_.constImage(),metric_,
4635  &offset,similarityMetric_,exceptionInfo);
4637  if (offset_ != (Geometry *) NULL)
4638  *offset_=offset;
4639  if (newImage == (MagickCore::Image *) NULL)
4640  return(Magick::Image());
4641  else
4642  return(Magick::Image(newImage));
4643 }
4644 
4645 void Magick::Image::swirl(const double degrees_)
4646 {
4648  *newImage;
4649 
4651  newImage=SwirlImage(constImage(),degrees_,exceptionInfo);
4652  replaceImage(newImage);
4654 }
4655 
4657 {
4659  (void) SyncAuthenticPixels(image(),exceptionInfo);
4661 }
4662 
4663 void Magick::Image::texture(const Image &texture_)
4664 {
4665  modifyImage();
4666  TextureImage(image(),texture_.constImage());
4667  throwImageException();
4668 }
4669 
4670 void Magick::Image::threshold(const double threshold_)
4671 {
4672  modifyImage();
4673  BilevelImage(image(),threshold_);
4674  throwImageException();
4675 }
4676 
4677 void Magick::Image::thumbnail(const Geometry &geometry_)
4678 {
4680  *newImage;
4681 
4682  size_t
4683  height=rows(),
4684  width=columns();
4685 
4686  ssize_t
4687  x=0,
4688  y=0;
4689 
4690  ParseMetaGeometry(static_cast<std::string>(geometry_).c_str(),&x,&y,&width,
4691  &height);
4692 
4694  newImage=ThumbnailImage(constImage(),width,height,exceptionInfo);
4695  replaceImage(newImage);
4697 }
4698 
4699 void Magick::Image::tint(const std::string opacity_)
4700 {
4702  *newImage;
4703 
4705  newImage=TintImage(constImage(),opacity_.c_str(),constOptions()->fillColor(),
4706  exceptionInfo);
4707  replaceImage(newImage);
4709 }
4710 
4711 void Magick::Image::transform(const Geometry &imageGeometry_)
4712 {
4713  modifyImage();
4714  TransformImage(&(image()),0,std::string(imageGeometry_).c_str());
4715  throwImageException();
4716 }
4717 
4718 void Magick::Image::transform(const Geometry &imageGeometry_,
4719  const Geometry &cropGeometry_)
4720 {
4721  modifyImage();
4722  TransformImage(&(image()),std::string(cropGeometry_).c_str(),
4723  std::string(imageGeometry_).c_str());
4724  throwImageException();
4725 }
4726 
4727 void Magick::Image::transformOrigin(const double x_,const double y_)
4728 {
4729  modifyImage();
4730  options()->transformOrigin(x_,y_);
4731 }
4732 
4734 {
4735  modifyImage();
4736  options()->transformReset();
4737 }
4738 
4739 void Magick::Image::transformScale(const double sx_,const double sy_)
4740 {
4741  modifyImage();
4742  options()->transformScale(sx_,sy_);
4743 }
4744 
4746 {
4747  MagickPixelPacket
4748  target;
4749 
4750  std::string
4751  color;
4752 
4753  if (!color_.isValid())
4754  throwExceptionExplicit(OptionError,"Color argument is invalid");
4755 
4756  color=color_;
4757 
4758  (void) QueryMagickColor(std::string(color_).c_str(),&target,
4759  &image()->exception);
4760  modifyImage();
4761  TransparentPaintImage(image(),&target,TransparentOpacity,MagickFalse);
4762  throwImageException();
4763 }
4764 
4766  const Color &colorHigh_)
4767 {
4768  MagickPixelPacket
4769  targetHigh,
4770  targetLow;
4771 
4772  std::string
4773  colorHigh,
4774  colorLow;
4775 
4776  if (!colorLow_.isValid() || !colorHigh_.isValid())
4777  throwExceptionExplicit(OptionError,"Color argument is invalid");
4778 
4779  colorLow=colorLow_;
4780  colorHigh=colorHigh_;
4781 
4782  (void) QueryMagickColor(colorLow.c_str(),&targetLow,&image()->exception);
4783  (void) QueryMagickColor(colorHigh.c_str(),&targetHigh,&image()->exception);
4784  modifyImage();
4785  TransparentPaintImageChroma(image(),&targetLow,&targetHigh,
4786  TransparentOpacity,MagickFalse);
4787  throwImageException();
4788 }
4789 
4791 {
4793  *newImage;
4794 
4796  newImage=TransposeImage(constImage(),exceptionInfo);
4797  replaceImage(newImage);
4799 }
4800 
4802 {
4804  *newImage;
4805 
4807  newImage=TransverseImage(constImage(),exceptionInfo);
4808  replaceImage(newImage);
4810 }
4811 
4813 {
4815  *newImage;
4816 
4818  newImage=TrimImage(constImage(),exceptionInfo);
4819  replaceImage(newImage);
4821 }
4822 
4824 {
4826  *image;
4827 
4829  image=UniqueImageColors(constImage(),exceptionInfo);
4831  if (image == (MagickCore::Image *) NULL)
4832  return(Magick::Image());
4833  else
4834  return(Magick::Image(image));
4835 }
4836 
4837 void Magick::Image::unsharpmask(const double radius_,const double sigma_,
4838  const double amount_,const double threshold_)
4839 {
4841  *newImage;
4842 
4844  newImage=UnsharpMaskImage(constImage(),radius_,sigma_,amount_,threshold_,
4845  exceptionInfo);
4846  replaceImage(newImage);
4848 }
4849 
4850 void Magick::Image::unsharpmaskChannel(const ChannelType channel_,
4851  const double radius_,const double sigma_,const double amount_,
4852  const double threshold_)
4853 {
4855  *newImage;
4856 
4858  newImage=UnsharpMaskImageChannel(constImage(),channel_,radius_,sigma_,
4859  amount_,threshold_,exceptionInfo);
4860  replaceImage(newImage);
4862 }
4863 
4864 void Magick::Image::vignette(const double radius_,const double sigma_,
4865  const ssize_t x_,const ssize_t y_)
4866 {
4868  *newImage;
4869 
4871  newImage=VignetteImage(constImage(),radius_,sigma_,x_,y_,exceptionInfo);
4872  replaceImage(newImage);
4874 }
4875 
4876 void Magick::Image::wave(const double amplitude_,const double wavelength_)
4877 {
4879  *newImage;
4880 
4882  newImage=WaveImage(constImage(),amplitude_,wavelength_,exceptionInfo);
4883  replaceImage(newImage);
4885 }
4886 
4887 void Magick::Image::waveletDenoise(const double threshold_,
4888  const double softness_)
4889 {
4891  *newImage;
4892 
4894  newImage=WaveletDenoiseImage(constImage(),threshold_,softness_,
4895  exceptionInfo);
4896  replaceImage(newImage);
4898 }
4899 
4900 void Magick::Image::whiteThreshold(const std::string &threshold_)
4901 {
4902  modifyImage();
4903  WhiteThresholdImage(image(),threshold_.c_str());
4904  throwImageException();
4905 }
4906 
4907 void Magick::Image::whiteThresholdChannel(const ChannelType channel_,
4908  const std::string &threshold_)
4909 {
4910  modifyImage();
4912  WhiteThresholdImageChannel(image(),channel_,threshold_.c_str(),
4913  exceptionInfo);
4915 }
4916 
4918 {
4919  size_t
4920  length=0;
4921 
4922  void
4923  *data;
4924 
4925  modifyImage();
4927  data=ImagesToBlob(constImageInfo(),image(),&length,exceptionInfo);
4928  if (length > 0)
4929  blob_->updateNoCopy(data,length,Blob::MallocAllocator);
4930  else
4931  data=RelinquishMagickMemory(data);
4933  throwImageException();
4934 }
4935 
4936 void Magick::Image::write(Blob *blob_,const std::string &magick_)
4937 {
4938  size_t
4939  length=0;
4940 
4941  void
4942  *data;
4943 
4944  modifyImage();
4945  magick(magick_);
4947  data=ImagesToBlob(constImageInfo(),image(),&length,exceptionInfo);
4948  if (length > 0)
4949  blob_->updateNoCopy(data,length,Blob::MallocAllocator);
4950  else
4951  data=RelinquishMagickMemory(data);
4953  throwImageException();
4954 }
4955 
4956 void Magick::Image::write(Blob *blob_,const std::string &magick_,
4957  const size_t depth_)
4958 {
4959  size_t
4960  length=0;
4961 
4962  void
4963  *data;
4964 
4965  modifyImage();
4966  magick(magick_);
4967  depth(depth_);
4969  data=ImagesToBlob(constImageInfo(),image(),&length,exceptionInfo);
4970  if (length > 0)
4971  blob_->updateNoCopy(data,length,Blob::MallocAllocator);
4972  else
4973  data=RelinquishMagickMemory(data);
4975  throwImageException();
4976 }
4977 
4978 void Magick::Image::write(const ssize_t x_,const ssize_t y_,
4979  const size_t columns_,const size_t rows_,const std::string &map_,
4980  const StorageType type_,void *pixels_)
4981 {
4983  ExportImagePixels(constImage(),x_,y_,columns_,rows_,map_.c_str(),type_,
4984  pixels_,exceptionInfo);
4986 }
4987 
4988 void Magick::Image::write(const std::string &imageSpec_)
4989 {
4990  modifyImage();
4991  fileName(imageSpec_);
4992  WriteImage(constImageInfo(),image());
4993  throwImageException();
4994 }
4995 
4996 void Magick::Image::writePixels(const Magick::QuantumType quantum_,
4997  unsigned char *destination_)
4998 {
4999  QuantumInfo
5000  *quantum_info;
5001 
5002  quantum_info=AcquireQuantumInfo(imageInfo(),image());
5004  ExportQuantumPixels(constImage(),(MagickCore::CacheView *) NULL,quantum_info,
5005  quantum_,destination_,exceptionInfo);
5006  quantum_info=DestroyQuantumInfo(quantum_info);
5008 }
5009 
5010 void Magick::Image::zoom(const Geometry &geometry_)
5011 {
5013  *newImage;
5014 
5015  size_t
5016  height=rows(),
5017  width=columns();
5018 
5019  ssize_t
5020  x=0,
5021  y=0;
5022 
5023  ParseMetaGeometry(static_cast<std::string>(geometry_).c_str(),&x,&y,&width,
5024  &height);
5025 
5027  newImage=ResizeImage(constImage(),width,height,image()->filter,image()->blur,
5028  exceptionInfo);
5029  replaceImage(newImage);
5031 }
5032 
5034  : _imgRef(new ImageRef(image_))
5035 {
5036 }
5037 
5039 {
5040  return(_imgRef->image());
5041 }
5042 
5044 {
5045  return(_imgRef->image());
5046 }
5047 
5048 MagickCore::ImageInfo *Magick::Image::imageInfo(void)
5049 {
5050  return(_imgRef->options()->imageInfo());
5051 }
5052 
5053 const MagickCore::ImageInfo *Magick::Image::constImageInfo(void) const
5054 {
5055  return(_imgRef->options()->imageInfo());
5056 }
5057 
5059 {
5060  return(_imgRef->options());
5061 }
5062 
5064 {
5065  return(_imgRef->options());
5066 }
5067 
5068 MagickCore::QuantizeInfo *Magick::Image::quantizeInfo(void)
5069 {
5070  return(_imgRef->options()->quantizeInfo());
5071 }
5072 
5073 const MagickCore::QuantizeInfo *Magick::Image::constQuantizeInfo(void) const
5074 {
5075  return(_imgRef->options()->quantizeInfo());
5076 }
5077 
5079 {
5080  {
5081  Lock lock(&_imgRef->_mutexLock);
5082  if (_imgRef->_refCount == 1)
5083  return;
5084  }
5085 
5087  replaceImage(CloneImage(constImage(),0,0,MagickTrue,exceptionInfo));
5089  return;
5090 }
5091 
5093 {
5095  *image;
5096 
5097  if (replacement_)
5098  image=replacement_;
5099  else
5100  image=AcquireImage(constImageInfo());
5101 
5102  {
5103  Lock lock(&_imgRef->_mutexLock);
5104 
5105  if (_imgRef->_refCount == 1)
5106  {
5107  // We own the image, just replace it, and de-register
5108  _imgRef->image(image);
5109  }
5110  else
5111  {
5112  // We don't own the image, dereference and replace with copy
5113  --_imgRef->_refCount;
5114  _imgRef=new ImageRef(image,constOptions());
5115  }
5116  }
5117 
5118  return(_imgRef->_image);
5119 }
5120 
5122 {
5123  // Throw C++ exception while resetting Image exception to default state
5124  throwException(&const_cast<MagickCore::Image*>(constImage())->exception,
5125  quiet());
5126 }
5127 
5129  MagickCore::ExceptionInfo *exceptionInfo)
5130 {
5131  // Ensure that multiple image frames were not read.
5132  if (image != (MagickCore::Image *) NULL &&
5133  image->next != (MagickCore::Image *) NULL)
5134  {
5136  *next;
5137 
5138  // Destroy any extra image frames
5139  next=image->next;
5140  image->next=(MagickCore::Image *) NULL;
5141  next->previous=(MagickCore::Image *) NULL;
5142  DestroyImageList(next);
5143  }
5144  replaceImage(image);
5145  if (exceptionInfo->severity == MagickCore::UndefinedException &&
5146  image == (MagickCore::Image *) NULL)
5147  {
5148  (void) MagickCore::DestroyExceptionInfo(exceptionInfo);
5149  if (!quiet())
5150  throwExceptionExplicit(MagickCore::ImageWarning,
5151  "No image was loaded.");
5152  return;
5153  }
5154  else
5155  {
5157  }
5158  if (image != (MagickCore::Image *) NULL)
5159  throwException(&image->exception,quiet());
5160 }
5161 
5162 void Magick::Image::floodFill(const ssize_t x_,const ssize_t y_,
5163  const Magick::Image *fillPattern_,const Magick::Color &fill_,
5164  const MagickCore::PixelPacket *target_,const bool invert_)
5165 {
5167  fillColor;
5168 
5170  *fillPattern;
5171 
5172  MagickPixelPacket
5173  target;
5174 
5175  // Set drawing fill pattern or fill color
5176  fillColor=options()->fillColor();
5177  fillPattern=(MagickCore::Image *)NULL;
5178  if (options()->fillPattern() != (MagickCore::Image *)NULL)
5179  {
5181  fillPattern=CloneImage(options()->fillPattern(),0,0,MagickTrue,
5182  exceptionInfo);
5184  }
5185 
5186  if (fillPattern_ == (Magick::Image *)NULL)
5187  {
5188  options()->fillPattern((MagickCore::Image *)NULL);
5189  options()->fillColor(fill_);
5190  }
5191  else
5192  options()->fillPattern(fillPattern_->constImage());
5193 
5194  GetMagickPixelPacket(image(),&target);
5195  target.red=target_->red;
5196  target.green=target_->green;
5197  target.blue=target_->blue;
5198 
5199  (void) FloodfillPaintImage(image(),DefaultChannels,options()->drawInfo(),
5200  &target,static_cast<ssize_t>(x_),static_cast<ssize_t>(y_),
5201  (MagickBooleanType) invert_);
5202 
5203  options()->fillColor(fillColor);
5204  options()->fillPattern(fillPattern);
5205  throwImageException();
5206 }
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:2740
void localContrast(const double radius_, const double strength_)
Definition: Image.cpp:3502
ImageChannelStatistics blue
Definition: Image.h:82
void swirl(const double degrees_)
Definition: Image.cpp:4645
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:3593
size_t colorMapSize(void) const
Definition: Image.cpp:539
void decipher(const std::string &passphrase_)
Definition: Image.cpp:2637
ImageChannelStatistics green
Definition: Image.h:81
void clip(void)
Definition: Image.cpp:2319
MagickPPExport int operator!=(const Magick::Color &left_, const Magick::Color &right_)
Definition: Color.cpp:36
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:4444
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:4503
void width(size_t width_)
Definition: Geometry.h:283
void resize(const Geometry &geometry_)
Definition: Image.cpp:4160
void brightnessContrastChannel(const ChannelType channel_, const double brightness_=0.0, const double contrast_=0.0)
Definition: Image.cpp:2173
double colorFuzz(void) const
Definition: Image.cpp:524
void ty(const double ty_)
Definition: Drawable.h:333
std::string magick(void) const
Definition: Image.cpp:1104
const MagickCore::QuantizeInfo * constQuantizeInfo(void) const
Definition: Image.cpp:5073
virtual ~Image()
Definition: Image.cpp:270
void modulate(const double brightness_, const double saturation_, const double hue_)
Definition: Image.cpp:3574
bool compare(const Image &reference_)
Definition: Image.cpp:2434
void isValid(bool valid_)
Definition: Color.cpp:256
void transform(const Geometry &imageGeometry_)
Definition: Image.cpp:4711
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:3386
void matteFloodfill(const Color &target_, const unsigned int opacity_, const ::ssize_t x_, const ::ssize_t y_, const PaintMethod method_)
Definition: Image.cpp:3532
void addNoise(const NoiseType noiseType_)
Definition: Image.cpp:1852
Blob iccColorProfile(void) const
Definition: Image.cpp:960
void floodFillColor(const Geometry &point_, const Color &fillColor_)
Definition: Image.cpp:2916
InterpolatePixelMethod interpolate(void) const
Definition: Image.cpp:991
void floodFillOpacity(const ::ssize_t x_, const ::ssize_t y_, const unsigned int opacity_, const bool invert_=false)
IndexPacket * getIndexes(void)
Definition: Image.cpp:3267
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:4489
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:3896
void writePixels(const QuantumType quantum_, unsigned char *destination_)
Definition: Image.cpp:4996
void charcoal(const double radius_=0.0, const double sigma_=1.0)
Definition: Image.cpp:2228
void blur(const double radius_=0.0, const double sigma_=1.0)
Definition: Image.cpp:2127
size_t baseRows(void) const
Definition: Image.cpp:411
size_t depth(void) const
Definition: Image.cpp:677
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:3911
ImageMoments moments(void) const
Definition: Image.cpp:3588
std::string view(void) const
Definition: Image.cpp:1743
void medianFilter(const double radius_=0.0)
Definition: Image.cpp:3540
DitherMethod quantizeDitherMethod(void) const
Definition: Image.cpp:1363
void enhance(void)
Definition: Image.cpp:2833
void height(size_t height_)
Definition: Geometry.h:243
void chop(const Geometry &geometry_)
Definition: Image.cpp:2239
MagickPPExport const char * raiseGeometryDefault
Definition: Image.cpp:35
void composite(const Image &compositeImage_, const Geometry &offset_, const CompositeOperator compose_=InCompositeOp)
Definition: Image.cpp:2506
void liquidRescale(const Geometry &geometry_)
Definition: Image.cpp:3480
Image clipMask(void) const
Definition: Image.cpp:502
ClassType classType(void) const
Definition: Image.h:1618
void unsharpmask(const double radius_, const double sigma_, const double amount_, const double threshold_)
Definition: Image.cpp:4837
#define DegreesToRadians(x)
Definition: Image.cpp:30
void readPixels(const QuantumType quantum_, const unsigned char *source_)
Definition: Image.cpp:4101
void clut(const Image &clutImage_)
Definition: Image.cpp:2333
void negate(const bool grayscale_=false)
Definition: Image.cpp:3699
static MagickSizeType memory(void)
void connectedComponents(const size_t connectivity_)
Definition: Image.cpp:2554
std::string baseFilename(void) const
Definition: Image.cpp:406
void raise(const Geometry &geometry_=raiseGeometryDefault, const bool raisedFlag_=false)
Definition: Image.cpp:3993
void fx(const std::string expression)
Definition: Image.cpp:3169
void whiteThreshold(const std::string &threshold_)
Definition: Image.cpp:4900
double gamma(void) const
Definition: Image.cpp:919
std::string textEncoding(void) const
Definition: Image.cpp:1609
void crop(const Geometry &geometry_)
Definition: Image.cpp:2616
void adaptiveResize(const Geometry &geometry_)
Definition: Image.cpp:1793
Image uniqueColors(void) const
Definition: Image.cpp:4823
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:324
DirectionType textDirection() const
Definition: Image.cpp:1598
void clipPath(const std::string pathname_, const bool inside_)
Definition: Image.cpp:2326
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:2675
ImageType determineType(void) const
Definition: Image.cpp:2724
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:4864
void shade(const double azimuth_=30, const double elevation_=30, const bool colorShading_=false)
Definition: Image.cpp:4370
void polaroid(const std::string &caption_, const double angle_)
Definition: Image.cpp:3867
void waveletDenoise(const double threshold_, const double softness_)
Definition: Image.cpp:4887
Image & operator=(const Image &image_)
Definition: Image.cpp:287
void write(Blob *blob_)
Definition: Image.cpp:4917
void yNegative(bool yNegative_)
Definition: Geometry.h:324
void statistics(ImageStatistics *statistics) const
Definition: Image.cpp:4543
void kuwaharaChannel(const ChannelType channel_, const double radius_=0.0, const double sigma_=1.0)
Definition: Image.cpp:3360
void equalize(void)
Definition: Image.cpp:2844
void zoom(const Geometry &geometry_)
Definition: Image.cpp:5010
CompositeOperator compose(void) const
Definition: Image.cpp:602
StyleType fontStyle(void) const
Definition: Image.cpp:883
void randomThresholdChannel(const Geometry &thresholds_, const ChannelType channel_)
Definition: Image.cpp:4014
FilterTypes filterType(void) const
Definition: Image.cpp:822
void blurChannel(const ChannelType channel_, const double radius_=0.0, const double sigma_=1.0)
Definition: Image.cpp:2138
void morphologyChannel(const ChannelType channel_, const MorphologyMethod method_, const std::string kernel_, const ssize_t iterations_=1)
Definition: Image.cpp:3638
void highlightColor(const Color color_)
Definition: Image.cpp:946
MagickPPExport int operator<(const Magick::Color &left_, const Magick::Color &right_)
Definition: Color.cpp:48
void yOff(::ssize_t yOff_)
Definition: Geometry.h:334
size_t fontWeight(void) const
Definition: Image.cpp:894
double fontPointsize(void) const
Definition: Image.cpp:856
size_t quantizeColors(void) const
Definition: Image.cpp:1329
bool isValid(void) const
Definition: Image.cpp:1050
void rotationalBlurChannel(const ChannelType channel_, const double angle_)
Definition: Image.cpp:4237
InterlaceType interlaceType(void) const
Definition: Image.cpp:980
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:3373
MagickCore::Image * replaceImage(MagickCore::Image *replacement_)
Definition: Image.cpp:5092
void transformScale(const double sx_, const double sy_)
Definition: Image.cpp:4739
size_t modulusDepth(void) const
Definition: Image.cpp:1197
void encipher(const std::string &passphrase_)
Definition: Image.cpp:2825
Color strokeColor(void) const
Definition: Image.cpp:1462
void contrastStretch(const double black_point_, const double white_point_)
Definition: Image.cpp:2572
double compareChannel(const ChannelType channel_, const Image &reference_, const MetricType metric_)
Definition: Image.cpp:2461
void linearStretch(const double blackPoint_, const double whitePoint_)
Definition: Image.cpp:3472
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:4383
Geometry density(void) const
Definition: Image.cpp:650
void extent(const Geometry &geometry_)
Definition: Image.cpp:2858
void colorMatrix(const size_t order_, const double *color_matrix_)
Definition: Image.cpp:2409
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:3114
void motionBlur(const double radius_, const double sigma_, const double angle_)
Definition: Image.cpp:3687
void perceptibleChannel(const ChannelType channel_, const double epsilon_)
Definition: Image.cpp:3789
std::string format(void) const
Definition: Image.cpp:861
void emboss(const double radius_=0.0, const double sigma_=1.0)
Definition: Image.cpp:2814
void magnify(void)
Definition: Image.cpp:3513
void levelColors(const Color &blackColor_, const Color &whiteColor_, const bool invert_=true)
Definition: Image.cpp:3394
void segment(const double clusterThreshold_=1.0, const double smoothingThreshold_=1.5)
Definition: Image.cpp:4294
ColorspaceType quantizeColorSpace(void) const
Definition: Image.cpp:1341
void grayscale(const PixelIntensityMethod method_)
Definition: Image.cpp:3293
void reduceNoise(void)
Definition: Image.h:1637
void clampChannel(const ChannelType channel_)
Definition: Image.cpp:2312
void channelDepth(const ChannelType channel_, const size_t depth_)
Definition: Image.cpp:2209
void quantumOperator(const ChannelType channel_, const MagickEvaluateOperator operator_, double rvalue_)
Definition: Image.cpp:3952
void orderedDither(std::string thresholdMap_)
Definition: Image.cpp:3764
bool adjoin(void) const
Definition: Image.cpp:325
void stegano(const Image &watermark_)
Definition: Image.cpp:4587
void sharpen(const double radius_=0.0, const double sigma_=1.0)
Definition: Image.cpp:4395
std::string label(void) const
Definition: Image.cpp:1064
void chromaWhitePoint(const double x_, const double y_)
Definition: Image.cpp:2292
std::string signature(const bool force_=false) const
Definition: Image.cpp:4453
EndianType endian(void) const
Definition: Image.cpp:700
MagickPPExport void throwException(MagickCore::ExceptionInfo *exception_, const bool quiet_=false)
MagickCore::Image *& image(void)
Definition: Image.cpp:5038
void trim(void)
Definition: Image.cpp:4812
double yResolution(void) const
Definition: Image.cpp:1777
MagickPPExport int operator<=(const Magick::Color &left_, const Magick::Color &right_)
Definition: Color.cpp:70
void solarize(const double factor_=50.0)
Definition: Image.cpp:4482
Geometry size(void) const
Definition: Image.cpp:1435
size_t columns(void) const
Definition: Image.h:1623
Color penColor(void) const
Definition: Image.cpp:1273
std::string directory(void) const
Definition: Image.cpp:682
ImageChannelStatistics red
Definition: Image.h:80
MagickPPExport int operator>=(const Magick::Color &left_, const Magick::Color &right_)
Definition: Color.cpp:64
void stereo(const Image &rightImage_)
Definition: Image.cpp:4598
void defineSet(const std::string &magick_, const std::string &key_, bool flag_)
Definition: Image.cpp:2645
void quantize(const bool measureError_=false)
Definition: Image.cpp:3938
void read(const Blob &blob_)
Definition: Image.cpp:4024
OrientationType orientation(void) const
Definition: Image.cpp:1246
const IndexPacket * getConstIndexes(void) const
Definition: Image.cpp:3243
void autoGammaChannel(const ChannelType channel_)
Definition: Image.cpp:2062
void frame(const Geometry &geometry_=frameGeometryDefault)
Definition: Image.cpp:3126
ColorspaceType colorspaceType(void) const
Definition: Image.cpp:570
void orderedDitherChannel(const ChannelType channel_, std::string thresholdMap_)
Definition: Image.cpp:3772
void throwImageException(void) const
Definition: Image.cpp:5121
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:3737
void flip(void)
Definition: Image.cpp:2905
void shave(const Geometry &geometry_)
Definition: Image.cpp:4419
#define AbsoluteValue(x)
Definition: Image.cpp:28
CompressionType compressType(void) const
Definition: Image.cpp:614
#define MagickPPExport
Definition: Include.h:261
void tint(const std::string opacity_)
Definition: Image.cpp:4699
void perceptible(const double epsilon_)
Definition: Image.cpp:3782
double textKerning(void) const
Definition: Image.cpp:1653
void blackThreshold(const std::string &threshold_)
Definition: Image.cpp:2098
void erase(void)
Definition: Image.cpp:2851
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:4406
Image fillPattern(void) const
Definition: Image.cpp:791
void fillPattern(const Image &fillPattern_)
Definition: Image.cpp:782
void spread(const size_t amount_=3)
Definition: Image.cpp:4532
void blackThresholdChannel(const ChannelType channel_, const std::string &threshold_)
Definition: Image.cpp:2105
void edge(const double radius_=0.0)
Definition: Image.cpp:2803
double normalizedMeanError(void) const
Definition: Image.cpp:1235
void kuwahara(const double radius_=0.0, const double sigma_=1.0)
Definition: Image.cpp:3349
double strokeDashOffset(void) const
Definition: Image.cpp:1484
void texture(const Image &texture_)
Definition: Image.cpp:4663
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:3552
void sepiaTone(const double threshold_)
Definition: Image.cpp:4346
std::string fileName(void) const
Definition: Image.cpp:750
std::string font(void) const
Definition: Image.cpp:833
void transparentChroma(const Color &colorLow_, const Color &colorHigh_)
Definition: Image.cpp:4765
void sy(const double sy_)
Definition: Drawable.h:297
void whiteThresholdChannel(const ChannelType channel_, const std::string &threshold_)
Definition: Image.cpp:4907
void minify(void)
Definition: Image.cpp:3563
void syncPixels(void)
Definition: Image.cpp:4656
void scale(const Geometry &geometry_)
Definition: Image.cpp:4272
MagickCore::ImageInfo * imageInfo(void)
Definition: Image.cpp:5048
Image subImageSearch(const Image &reference_, const MetricType metric_, Geometry *offset_, double *similarityMetric_, const double similarityThreshold=(-1.0))
Definition: Image.cpp:4616
double normalizedMaxError(void) const
Definition: Image.cpp:1230
const MagickCore::Image * constImage(void) const
Definition: Image.cpp:5043
void unsharpmaskChannel(const ChannelType channel_, const double radius_, const double sigma_, const double amount_, const double threshold_)
Definition: Image.cpp:4850
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:4801
double xResolution(void) const
Definition: Image.cpp:1772
void sx(const double sx_)
Definition: Drawable.h:288
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:2181
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:4357
ResolutionType resolutionUnits(void) const
Definition: Image.cpp:1411
void draw(const Drawable &drawable_)
Definition: Image.cpp:2753
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:2565
void rotationalBlur(const double angle_)
Definition: Image.cpp:4226
void chromaRedPrimary(const double x_, const double y_)
Definition: Image.cpp:2279
void opacity(const unsigned int opacity_)
Definition: Image.cpp:3732
void resample(const Geometry &geometry_)
Definition: Image.cpp:4137
void posterizeChannel(const ChannelType channel_, const size_t levels_, const bool dither_=false)
Definition: Image.cpp:3887
void updateNoCopy(void *data_, const size_t length_, Allocator allocator_=NewAllocator)
Definition: Blob.cpp:148
void implode(const double factor_)
Definition: Image.cpp:3320
Color fillColor(void) const
Definition: Image.cpp:766
size_t subRange(void) const
Definition: Image.cpp:1587
void gaussianBlur(const double width_, const double sigma_)
Definition: Image.cpp:3219
double textInterwordSpacing(void) const
Definition: Image.cpp:1642
Blob exifProfile(void) const
Definition: Image.cpp:720
void ping(const Blob &blob_)
Definition: Image.cpp:3797
void contrastStretchChannel(const ChannelType channel_, const double black_point_, const double white_point_)
Definition: Image.cpp:2581
LineCap strokeLineCap(void) const
Definition: Image.cpp:1495
void clamp(void)
Definition: Image.cpp:2305
void levelize(const double blackPoint_, const double whitePoint_, const double gamma_=1.0)
Definition: Image.cpp:3456
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:4876
void threshold(const double threshold_)
Definition: Image.cpp:4670
void convolve(const size_t order_, const double *kernel_)
Definition: Image.cpp:2589
void roll(const Geometry &roll_)
Definition: Image.cpp:4183
void rx(const double rx_)
Definition: Drawable.h:306
Geometry boundingBox(void) const
Definition: Image.cpp:443
const Options * constOptions(void) const
Definition: Image.cpp:5063
VirtualPixelMethod virtualPixelMethod(void) const
Definition: Image.cpp:1756
void strip(void)
Definition: Image.cpp:4609
void thumbnail(const Geometry &geometry_)
Definition: Image.cpp:4677
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:2735
void posterize(const size_t levels_, const bool dither_=false)
Definition: Image.cpp:3880
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:4306
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:2083
void inverseFourierTransform(const Image &phase_)
Definition: Image.cpp:3331
void floodFillTexture(const Geometry &point_, const Image &texture_)
Definition: Image.cpp:3028
void randomThreshold(const Geometry &thresholds_)
Definition: Image.cpp:4005
Color backgroundColor(void) const
Definition: Image.cpp:385
bool isOpaque(void) const
Definition: Image.cpp:1023
void cdl(const std::string &cdl_)
Definition: Image.cpp:2195
FillRule fillRule(void) const
Definition: Image.cpp:777
Image separate(const ChannelType channel_) const
Definition: Image.cpp:4332
void isValid(const bool isValid_)
Definition: Image.cpp:1034
void border(const Geometry &geometry_=borderGeometryDefault)
Definition: Image.cpp:2151
void chromaBluePrimary(const double x_, const double y_)
Definition: Image.cpp:2253
Image mask(void) const
Definition: Image.cpp:1122
bool antiAlias(void) const
Definition: Image.cpp:336
void sample(const Geometry &geometry_)
Definition: Image.cpp:4250
bool debug(void) const
Definition: Image.cpp:625
void affineTransform(const DrawableAffine &affine)
Definition: Image.cpp:1876
void attribute(const std::string name_, const char *value_)
Definition: Image.cpp:2030
void houghLine(const size_t width_, const size_t height_, const size_t threshold_=40)
Definition: Image.cpp:3307
void levelizeChannel(const ChannelType channel_, const double blackPoint_, const double whitePoint_, const double gamma_=1.0)
Definition: Image.cpp:3464
void sketch(const double radius_=0.0, const double sigma_=1.0, const double angle_=0.0)
Definition: Image.cpp:4470
const MagickCore::ImageInfo * constImageInfo(void) const
Definition: Image.cpp:5053
ColorspaceType colorSpace(void) const
Definition: Image.cpp:557
void gaussianBlurChannel(const ChannelType channel_, const double width_, const double sigma_)
Definition: Image.cpp:3230
std::string formatExpression(const std::string expression)
Definition: Image.cpp:900
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:2115
void ry(const double ry_)
Definition: Drawable.h:315
off_t fileSize(void) const
Definition: Image.cpp:755
const double * strokeDashArray(void) const
Definition: Image.cpp:1473
MagickPPExport int operator>(const Magick::Color &left_, const Magick::Color &right_)
Definition: Color.cpp:42
void clutChannel(const ChannelType channel_, const Image &clutImage_)
Definition: Image.cpp:2340
void transpose(void)
Definition: Image.cpp:4790
std::string tileName(void) const
Definition: Image.cpp:1675
Geometry geometry(void) const
Definition: Image.cpp:924
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:642
LineJoin strokeLineJoin(void) const
Definition: Image.cpp:1506
void autoLevelChannel(const ChannelType channel_)
Definition: Image.cpp:2076
void negateChannel(const ChannelType channel_, const bool grayscale_=false)
Definition: Image.cpp:3706
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:3255
void repage()
Definition: Image.cpp:4127
void brightnessContrast(const double brightness_=0.0, const double contrast_=0.0)
Definition: Image.cpp:2165
MagickCore::QuantizeInfo * quantizeInfo(void)
Definition: Image.cpp:5068
void flop(void)
Definition: Image.cpp:3090
void despeckle(void)
Definition: Image.cpp:2713
void channel(const ChannelType channel_)
Definition: Image.cpp:2202
void strokePattern(const Image &strokePattern_)
Definition: Image.cpp:1522
size_t rows(void) const
Definition: Image.h:1642
void normalize(void)
Definition: Image.cpp:3714
ImageChannelStatistics opacity
Definition: Image.h:83
size_t scene(void) const
Definition: Image.cpp:1422
std::string fontFamily(void) const
Definition: Image.cpp:844
void chromaGreenPrimary(const double x_, const double y_)
Definition: Image.cpp:2266
#define GetPPException
Definition: Include.h:1520
void deskew(const double threshold_)
Definition: Image.cpp:2702
void fontTypeMetrics(const std::string &text_, TypeMetric *metrics)
Definition: Image.cpp:3101
void attenuate(const double attenuate_)
Definition: Image.cpp:363
void transformOrigin(const double x_, const double y_)
Definition: Image.cpp:4727
void colorMap(const size_t index_, const Color &color_)
Definition: Image.cpp:2376
bool matte(void) const
Definition: Image.cpp:1151
size_t gifDisposeMethod(void) const
Definition: Image.cpp:940
void oilPaint(const double radius_=3.0)
Definition: Image.cpp:3721
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:2600
void autoGamma(void)
Definition: Image.cpp:2055
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:2630
Options * options(void)
Definition: Image.cpp:5058
void modifyImage(void)
Definition: Image.cpp:5078
const void * data(void) const
Definition: Blob.cpp:118
void autoLevel(void)
Definition: Image.cpp:2069
void selectiveBlurChannel(const ChannelType channel_, const double radius_, const double sigma_, const double threshold_)
Definition: Image.cpp:4319
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:3425
void colorize(const unsigned int opacity_, const Color &penColor_)
Definition: Image.cpp:2370
bool verbose(void) const
Definition: Image.cpp:1732
void haldClut(const Image &clutImage_)
Definition: Image.cpp:3300
void transformSkewY(const double skewy_)
Definition: Image.cpp:1703
void shear(const double xShearAngle_, const double yShearAngle_)
Definition: Image.cpp:4433
Blob iptcProfile(void) const
Definition: Image.cpp:1011
PixelPacket * getPixels(const ::ssize_t x_, const ::ssize_t y_, const size_t columns_, const size_t rows_)
Definition: Image.cpp:3280
void transparent(const Color &color_)
Definition: Image.cpp:4745
void transformReset(void)
Definition: Image.cpp:4733
void rotate(const double degrees_)
Definition: Image.cpp:4215
void map(const Image &mapImage_, const bool dither_=false)
Definition: Image.cpp:3524
void lowlightColor(const Color color_)
Definition: Image.cpp:1077