Magick++  7.0.7
Convert, Edit, Or Compose Bitmap Images
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-2017
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"
26 
27 #define AbsoluteValue(x) ((x) < 0 ? -(x) : (x))
28 #define MagickPI 3.14159265358979323846264338327950288419716939937510
29 #define DegreesToRadians(x) (MagickPI*(x)/180.0)
30 #define ThrowImageException ThrowPPException(quiet())
31 
35 
37  const Magick::Image &right_)
38 {
39  // If image pixels and signature are the same, then the image is identical
40  return((left_.rows() == right_.rows()) &&
41  (left_.columns() == right_.columns()) &&
42  (left_.signature() == right_.signature()));
43 }
44 
46  const Magick::Image &right_)
47 {
48  return(!(left_ == right_));
49 }
50 
52  const Magick::Image &right_)
53 {
54  return(!(left_ < right_) && (left_ != right_));
55 }
56 
58  const Magick::Image &right_)
59 {
60  // If image pixels are less, then image is smaller
61  return((left_.rows() * left_.columns()) <
62  (right_.rows() * right_.columns()));
63 }
64 
66  const Magick::Image &right_)
67 {
68  return((left_ > right_) || (left_ == right_));
69 }
70 
72  const Magick::Image &right_)
73 {
74  return((left_ < right_) || ( left_ == right_));
75 }
76 
78  : _imgRef(new ImageRef)
79 {
80 }
81 
83  : _imgRef(new ImageRef)
84 {
85  try
86  {
87  // Initialize, Allocate and Read images
88  quiet(true);
89  read(blob_);
90  quiet(false);
91  }
92  catch (const Error&)
93  {
94  // Release resources
95  delete _imgRef;
96  throw;
97  }
98 }
99 
100 Magick::Image::Image(const Blob &blob_,const Geometry &size_)
101  : _imgRef(new ImageRef)
102 {
103  try
104  {
105  // Read from Blob
106  quiet(true);
107  read(blob_, size_);
108  quiet(false);
109  }
110  catch(const Error&)
111  {
112  // Release resources
113  delete _imgRef;
114  throw;
115  }
116 }
117 
118 Magick::Image::Image(const Blob &blob_,const Geometry &size_,
119  const size_t depth_)
120  : _imgRef(new ImageRef)
121 {
122  try
123  {
124  // Read from Blob
125  quiet(true);
126  read(blob_,size_,depth_);
127  quiet(false);
128  }
129  catch(const Error&)
130  {
131  // Release resources
132  delete _imgRef;
133  throw;
134  }
135 }
136 
137 Magick::Image::Image(const Blob &blob_,const Geometry &size_,
138  const size_t depth_,const std::string &magick_)
139  : _imgRef(new ImageRef)
140 {
141  try
142  {
143  // Read from Blob
144  quiet(true);
145  read(blob_,size_,depth_,magick_);
146  quiet(false);
147  }
148  catch(const Error&)
149  {
150  // Release resources
151  delete _imgRef;
152  throw;
153  }
154 }
155 
156 Magick::Image::Image(const Blob &blob_,const Geometry &size_,
157  const std::string &magick_)
158  : _imgRef(new ImageRef)
159 {
160  try
161  {
162  // Read from Blob
163  quiet(true);
164  read(blob_,size_,magick_);
165  quiet(false);
166  }
167  catch(const Error&)
168  {
169  // Release resources
170  delete _imgRef;
171  throw;
172  }
173 }
174 
175 Magick::Image::Image(const Geometry &size_,const Color &color_)
176  : _imgRef(new ImageRef)
177 {
178  // xc: prefix specifies an X11 color string
179  std::string imageSpec("xc:");
180  imageSpec+=color_;
181 
182  try
183  {
184  quiet(true);
185  // Set image size
186  size(size_);
187 
188  // Initialize, Allocate and Read images
189  read(imageSpec);
190  quiet(false);
191  }
192  catch(const Error&)
193  {
194  // Release resources
195  delete _imgRef;
196  throw;
197  }
198 }
199 
201  : _imgRef(image_._imgRef)
202 {
203  _imgRef->increase();
204 }
205 
206 Magick::Image::Image(const Image &image_,const Geometry &geometry_)
207  : _imgRef(new ImageRef)
208 {
209  const RectangleInfo
210  geometry=geometry_;
211 
212  OffsetInfo
213  offset;
214 
216  *image;
217 
219  image=CloneImage(image_.constImage(),geometry_.width(),geometry_.height(),
220  MagickTrue,exceptionInfo);
221  replaceImage(image);
222  _imgRef->options(new Options(*image_.constOptions()));
223  offset.x=0;
224  offset.y=0;
225  (void) CopyImagePixels(image,image_.constImage(),&geometry,&offset,
226  exceptionInfo);
228 }
229 
230 Magick::Image::Image(const size_t width_,const size_t height_,
231  const std::string &map_,const StorageType type_,const void *pixels_)
232  : _imgRef(new ImageRef)
233 {
234  try
235  {
236  quiet(true);
237  read(width_,height_,map_.c_str(),type_,pixels_);
238  quiet(false);
239  }
240  catch(const Error&)
241  {
242  // Release resources
243  delete _imgRef;
244  throw;
245  }
246 }
247 
248 Magick::Image::Image(const std::string &imageSpec_)
249  : _imgRef(new ImageRef)
250 {
251  try
252  {
253  // Initialize, Allocate and Read images
254  quiet(true);
255  read(imageSpec_);
256  quiet(false);
257  }
258  catch(const Error&)
259  {
260  // Release resources
261  delete _imgRef;
262  throw;
263  }
264 }
265 
267 {
268  try
269  {
270  if (_imgRef->decrease() == 0)
271  delete _imgRef;
272  }
273  catch(Magick::Exception)
274  {
275  }
276 
277  _imgRef=(Magick::ImageRef *) NULL;
278 }
279 
281 {
282  if (this != &image_)
283  {
284  image_._imgRef->increase();
285  if (_imgRef->decrease() == 0)
286  delete _imgRef;
287 
288  // Use new image reference
289  _imgRef=image_._imgRef;
290  }
291  return(*this);
292 }
293 
294 void Magick::Image::adjoin(const bool flag_)
295 {
296  modifyImage();
297  options()->adjoin(flag_);
298 }
299 
300 bool Magick::Image::adjoin(void) const
301 {
302  return(constOptions()->adjoin());
303 }
304 
305 void Magick::Image::alpha(const bool alphaFlag_)
306 {
307  modifyImage();
308 
309  // If matte channel is requested, but image doesn't already have a
310  // matte channel, then create an opaque matte channel. Likewise, if
311  // the image already has a matte channel but a matte channel is not
312  // desired, then set the matte channel to opaque.
314  if ((alphaFlag_ && !constImage()->alpha_trait) ||
315  (constImage()->alpha_trait && !alphaFlag_))
316  SetImageAlpha(image(),OpaqueAlpha,exceptionInfo);
318 
319  image()->alpha_trait=alphaFlag_ ? BlendPixelTrait : UndefinedPixelTrait;
320 }
321 
322 bool Magick::Image::alpha(void) const
323 {
324  if (constImage()->alpha_trait == BlendPixelTrait)
325  return(true);
326  else
327  return(false);
328 }
329 
330 void Magick::Image::matteColor(const Color &matteColor_)
331 {
332  modifyImage();
333 
334  if (matteColor_.isValid())
335  {
336  image()->matte_color=matteColor_;
337  options()->matteColor(matteColor_);
338  }
339  else
340  {
341  // Set to default matte color
342  Color tmpColor("#BDBDBD");
343  image()->matte_color=tmpColor;
344  options()->matteColor(tmpColor);
345  }
346 }
347 
349 {
350  return(Color(constImage()->matte_color));
351 }
352 
353 void Magick::Image::animationDelay(const size_t delay_)
354 {
355  modifyImage();
356  image()->delay=delay_;
357 }
358 
360 {
361  return(constImage()->delay);
362 }
363 
364 void Magick::Image::animationIterations(const size_t iterations_)
365 {
366  modifyImage();
367  image()->iterations=iterations_;
368 }
369 
371 {
372  return(constImage()->iterations);
373 }
374 
375 void Magick::Image::backgroundColor(const Color &backgroundColor_)
376 {
377  modifyImage();
378 
379  if (backgroundColor_.isValid())
380  image()->background_color=backgroundColor_;
381  else
382  image()->background_color=Color();
383 
384  options()->backgroundColor(backgroundColor_);
385 }
386 
388 {
389  return(constOptions()->backgroundColor());
390 }
391 
392 void Magick::Image::backgroundTexture(const std::string &backgroundTexture_)
393 {
394  modifyImage();
395  options()->backgroundTexture(backgroundTexture_);
396 }
397 
398 std::string Magick::Image::backgroundTexture(void) const
399 {
400  return(constOptions()->backgroundTexture());
401 }
402 
403 size_t Magick::Image::baseColumns(void) const
404 {
405  return(constImage()->magick_columns);
406 }
407 
408 std::string Magick::Image::baseFilename(void) const
409 {
410  return(std::string(constImage()->magick_filename));
411 }
412 
413 size_t Magick::Image::baseRows(void) const
414 {
415  return(constImage()->magick_rows);
416 }
417 
419 {
420  image()->black_point_compensation=(MagickBooleanType) flag_;
421 }
422 
424 {
425  return(static_cast<bool>(constImage()->black_point_compensation));
426 }
427 
428 void Magick::Image::borderColor(const Color &borderColor_)
429 {
430  modifyImage();
431 
432  if (borderColor_.isValid())
433  image()->border_color=borderColor_;
434  else
435  image()->border_color=Color();
436 
437  options()->borderColor(borderColor_);
438 }
439 
441 {
442  return(constOptions()->borderColor());
443 }
444 
446 {
447  RectangleInfo
448  bbox;
449 
451  bbox=GetImageBoundingBox(constImage(),exceptionInfo);
453  return(Geometry(bbox));
454 }
455 
456 void Magick::Image::boxColor(const Color &boxColor_)
457 {
458  modifyImage();
459  options()->boxColor(boxColor_);
460 }
461 
463 {
464  return(constOptions()->boxColor());
465 }
466 
467 void Magick::Image::channelDepth(const ChannelType channel_,
468  const size_t depth_)
469 {
470  modifyImage();
472  GetAndSetPPChannelMask(channel_);
473  SetImageDepth(image(),depth_,exceptionInfo);
476 }
477 
478 size_t Magick::Image::channelDepth(const ChannelType channel_)
479 {
480  size_t
481  channel_depth;
482 
484  GetAndSetPPChannelMask(channel_);
485  channel_depth=GetImageDepth(constImage(),exceptionInfo);
488  return(channel_depth);
489 }
490 
492 {
493  return(constImage()->number_channels);
494 }
495 
496 void Magick::Image::classType(const ClassType class_)
497 {
498  if (classType() == PseudoClass && class_ == DirectClass)
499  {
500  // Use SyncImage to synchronize the DirectClass pixels with the
501  // color map and then set to DirectClass type.
502  modifyImage();
504  SyncImage(image(),exceptionInfo);
506  image()->colormap=(PixelInfo *)RelinquishMagickMemory(image()->colormap);
507  image()->storage_class=static_cast<MagickCore::ClassType>(DirectClass);
508  return;
509  }
510 
511  if (classType() == DirectClass && class_ == PseudoClass)
512  {
513  // Quantize to create PseudoClass color map
514  modifyImage();
515  quantizeColors(MaxColormapSize);
516  quantize();
517  image()->storage_class=static_cast<MagickCore::ClassType>(PseudoClass);
518  }
519 }
520 
521 Magick::ClassType Magick::Image::classType(void) const
522 {
523  return static_cast<Magick::ClassType>(constImage()->storage_class);
524 }
525 
526 void Magick::Image::colorFuzz(const double fuzz_)
527 {
528  modifyImage();
529  image()->fuzz=fuzz_;
530  options()->colorFuzz(fuzz_);
531 }
532 
533 double Magick::Image::colorFuzz(void) const
534 {
535  return(constOptions()->colorFuzz());
536 }
537 
538 void Magick::Image::colorMapSize(const size_t entries_)
539 {
540  if (entries_ >MaxColormapSize)
541  throwExceptionExplicit(MagickCore::OptionError,
542  "Colormap entries must not exceed MaxColormapSize");
543 
544  modifyImage();
546  (void) AcquireImageColormap(image(),entries_,exceptionInfo);
548 }
549 
550 size_t Magick::Image::colorMapSize(void) const
551 {
552  if (!constImage()->colormap)
553  throwExceptionExplicit(MagickCore::OptionError,
554  "Image does not contain a colormap");
555 
556  return(constImage()->colors);
557 }
558 
559 void Magick::Image::colorSpace(const ColorspaceType colorSpace_)
560 {
561  if (image()->colorspace == colorSpace_)
562  return;
563 
564  modifyImage();
566  TransformImageColorspace(image(),colorSpace_,exceptionInfo);
568 }
569 
570 Magick::ColorspaceType Magick::Image::colorSpace(void) const
571 {
572  return (constImage()->colorspace);
573 }
574 
575 void Magick::Image::colorSpaceType(const ColorspaceType colorSpace_)
576 {
577  modifyImage();
579  SetImageColorspace(image(),colorSpace_,exceptionInfo);
581  options()->colorspaceType(colorSpace_);
582 }
583 
584 Magick::ColorspaceType Magick::Image::colorSpaceType(void) const
585 {
586  return(constOptions()->colorspaceType());
587 }
588 
589 size_t Magick::Image::columns(void) const
590 {
591  return(constImage()->columns);
592 }
593 
594 void Magick::Image::comment(const std::string &comment_)
595 {
596  modifyImage();
598  SetImageProperty(image(),"Comment",NULL,exceptionInfo);
599  if (comment_.length() > 0)
600  SetImageProperty(image(),"Comment",comment_.c_str(),exceptionInfo);
602 }
603 
604 std::string Magick::Image::comment(void) const
605 {
606  const char
607  *value;
608 
610  value=GetImageProperty(constImage(),"Comment",exceptionInfo);
612 
613  if (value)
614  return(std::string(value));
615 
616  return(std::string()); // Intentionally no exception
617 }
618 
619 void Magick::Image::compose(const CompositeOperator compose_)
620 {
621  image()->compose=compose_;
622 }
623 
624 Magick::CompositeOperator Magick::Image::compose(void) const
625 {
626  return(constImage()->compose);
627 }
628 
629 void Magick::Image::compressType(const CompressionType compressType_)
630 {
631  modifyImage();
632  image()->compression=compressType_;
633  options()->compressType(compressType_);
634 }
635 
636 Magick::CompressionType Magick::Image::compressType(void) const
637 {
638  return(constImage()->compression);
639 }
640 
641 void Magick::Image::debug(const bool flag_)
642 {
643  modifyImage();
644  options()->debug(flag_);
645 }
646 
647 bool Magick::Image::debug(void) const
648 {
649  return(constOptions()->debug());
650 }
651 
652 void Magick::Image::density(const Point &density_)
653 {
654  modifyImage();
655  options()->density(density_);
656  if (density_.isValid())
657  {
658  image()->resolution.x=density_.x();
659  if (density_.y() != 0.0)
660  image()->resolution.y=density_.y();
661  else
662  image()->resolution.y=density_.x();
663  }
664  else
665  {
666  // Reset to default
667  image()->resolution.x=0.0;
668  image()->resolution.y=0.0;
669  }
670 }
671 
673 {
674  if (isValid())
675  {
676  ssize_t
677  x_resolution=72,
678  y_resolution=72;
679 
680  if (constImage()->resolution.x > 0.0)
681  x_resolution=constImage()->resolution.x;
682 
683  if (constImage()->resolution.y > 0.0)
684  y_resolution=constImage()->resolution.y;
685 
686  return(Point(x_resolution,y_resolution));
687  }
688 
689  return(constOptions()->density());
690 }
691 
692 void Magick::Image::depth(const size_t depth_)
693 {
694  modifyImage();
695  image()->depth=depth_;
696  options()->depth(depth_);
697 }
698 
699 size_t Magick::Image::depth(void) const
700 {
701  return(constImage()->depth);
702 }
703 
704 std::string Magick::Image::directory(void) const
705 {
706  if (constImage()->directory)
707  return(std::string(constImage()->directory));
708 
709  if (!quiet())
710  throwExceptionExplicit(MagickCore::CorruptImageWarning,
711  "Image does not contain a directory");
712 
713  return(std::string());
714 }
715 
716 void Magick::Image::endian(const Magick::EndianType endian_)
717 {
718  modifyImage();
719  options()->endian(endian_);
720  image()->endian=endian_;
721 }
722 
723 Magick::EndianType Magick::Image::endian(void) const
724 {
725  return(constImage()->endian);
726 }
727 
728 void Magick::Image::exifProfile(const Magick::Blob &exifProfile_)
729 {
730  modifyImage();
731 
732  if (exifProfile_.data() != 0)
733  {
734  StringInfo
735  *exif_profile;
736 
737  exif_profile=AcquireStringInfo(exifProfile_.length());
738  SetStringInfoDatum(exif_profile,(unsigned char *) exifProfile_.data());
740  (void) SetImageProfile(image(),"exif",exif_profile,exceptionInfo);
741  exif_profile=DestroyStringInfo(exif_profile);
743  }
744 }
745 
747 {
748  const StringInfo
749  *exif_profile;
750 
751  exif_profile=GetImageProfile(constImage(),"exif");
752  if (exif_profile == (StringInfo *) NULL)
753  return(Blob());
754  return(Blob(GetStringInfoDatum(exif_profile),
755  GetStringInfoLength(exif_profile)));
756 }
757 
758 void Magick::Image::fileName(const std::string &fileName_)
759 {
760  modifyImage();
761 
762  fileName_.copy(image()->filename,sizeof(image()->filename)-1);
763  image()->filename[fileName_.length()]=0; // Null terminate
764 
765  options()->fileName(fileName_);
766 }
767 
768 std::string Magick::Image::fileName(void) const
769 {
770  return(constOptions()->fileName());
771 }
772 
773 MagickCore::MagickSizeType Magick::Image::fileSize(void) const
774 {
775  return(GetBlobSize(constImage()));
776 }
777 
779 {
780  modifyImage();
781  options()->fillColor(fillColor_);
782 }
783 
785 {
786  return(constOptions()->fillColor());
787 }
788 
789 void Magick::Image::fillRule(const Magick::FillRule &fillRule_)
790 {
791  modifyImage();
792  options()->fillRule(fillRule_);
793 }
794 
795 Magick::FillRule Magick::Image::fillRule(void) const
796 {
797  return constOptions()->fillRule();
798 }
799 
800 void Magick::Image::fillPattern(const Image &fillPattern_)
801 {
802  modifyImage();
803  if (fillPattern_.isValid())
804  options()->fillPattern(fillPattern_.constImage());
805  else
806  options()->fillPattern(static_cast<MagickCore::Image*>(NULL));
807 }
808 
810 {
811  // FIXME: This is inordinately innefficient
812  const MagickCore::Image
813  *tmpTexture;
814 
815  Image
816  texture;
817 
818  tmpTexture=constOptions()->fillPattern();
819 
820  if (tmpTexture)
821  {
823  *image;
824 
826  image=CloneImage(tmpTexture,0,0,MagickTrue,exceptionInfo);
827  texture.replaceImage(image);
829  }
830  return(texture);
831 }
832 
833 void Magick::Image::filterType(const Magick::FilterType filterType_)
834 {
835  modifyImage();
836  image()->filter=filterType_;
837 }
838 
839 Magick::FilterType Magick::Image::filterType(void) const
840 {
841  return(constImage()->filter);
842 }
843 
844 void Magick::Image::font(const std::string &font_)
845 {
846  modifyImage();
847  options()->font(font_);
848 }
849 
850 std::string Magick::Image::font(void) const
851 {
852  return(constOptions()->font());
853 }
854 
855 void Magick::Image::fontFamily(const std::string &family_)
856 {
857  modifyImage();
858  options()->fontFamily(family_);
859 }
860 
861 std::string Magick::Image::fontFamily(void) const
862 {
863  return(constOptions()->fontFamily());
864 }
865 
866 void Magick::Image::fontPointsize(const double pointSize_)
867 {
868  modifyImage();
869  options()->fontPointsize(pointSize_);
870 }
871 
873 {
874  return(constOptions()->fontPointsize());
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 std::string Magick::Image::format(void) const
900 {
901  const MagickInfo
902  *magick_info;
903 
905  magick_info=GetMagickInfo(constImage()->magick,exceptionInfo);
907 
908  if ((magick_info != 0) && (*magick_info->description != '\0'))
909  return(std::string(magick_info->description));
910 
911  if (!quiet())
912  throwExceptionExplicit(MagickCore::CorruptImageWarning,
913  "Unrecognized image magick type");
914 
915  return(std::string());
916 }
917 
918 std::string Magick::Image::formatExpression(const std::string expression)
919 {
920  char
921  *text;
922 
923  std::string
924  text_string;
925 
927  modifyImage();
928  text=InterpretImageProperties(imageInfo(),image(),expression.c_str(),
929  exceptionInfo);
930  if (text != (char *) NULL)
931  {
932  text_string=std::string(text);
933  text=DestroyString(text);
934  }
936  return(text_string);
937 }
938 
939 double Magick::Image::gamma(void) const
940 {
941  return(constImage()->gamma);
942 }
943 
945 {
946  if (constImage()->geometry)
947  return Geometry(constImage()->geometry);
948 
949  if (!quiet())
950  throwExceptionExplicit(MagickCore::OptionWarning,
951  "Image does not contain a geometry");
952 
953  return(Geometry());
954 }
955 
957  const MagickCore::DisposeType disposeMethod_)
958 {
959  modifyImage();
960  image()->dispose=disposeMethod_;
961 }
962 
963 MagickCore::DisposeType Magick::Image::gifDisposeMethod(void) const
964 {
965  return(constImage()->dispose);
966 }
967 
968 bool Magick::Image::hasChannel(const PixelChannel channel) const
969 {
970  if (GetPixelChannelTraits(constImage(),channel) == UndefinedPixelTrait)
971  return(false);
972 
973  if (channel == GreenPixelChannel || channel == BluePixelChannel)
974  return (GetPixelChannelOffset(constImage(),channel) == (ssize_t)channel);
975 
976  return(true);
977 }
978 
980 {
981  std::string
982  value;
983 
984  value=color_;
985  artifact("compare:highlight-color",value);
986 }
987 
989 {
990  profile("icc",colorProfile_);
991 }
992 
994 {
995  const StringInfo
996  *color_profile;
997 
998  color_profile=GetImageProfile(constImage(),"icc");
999  if (color_profile == (StringInfo *) NULL)
1000  return(Blob());
1001  return(Blob(GetStringInfoDatum(color_profile),GetStringInfoLength(
1002  color_profile)));
1003 }
1004 
1005 void Magick::Image::interlaceType(const Magick::InterlaceType interlace_)
1006 {
1007  modifyImage();
1008  image()->interlace=interlace_;
1009  options()->interlaceType(interlace_);
1010 }
1011 
1012 Magick::InterlaceType Magick::Image::interlaceType(void) const
1013 {
1014  return(constImage()->interlace);
1015 }
1016 
1017 void Magick::Image::interpolate(const PixelInterpolateMethod interpolate_)
1018 {
1019  modifyImage();
1020  image()->interpolate=interpolate_;
1021 }
1022 
1023 Magick::PixelInterpolateMethod Magick::Image::interpolate(void) const
1024 {
1025  return constImage()->interpolate;
1026 }
1027 
1028 void Magick::Image::iptcProfile(const Magick::Blob &iptcProfile_)
1029 {
1030  modifyImage();
1031  if (iptcProfile_.data() != 0)
1032  {
1033  StringInfo
1034  *iptc_profile;
1035 
1036  iptc_profile=AcquireStringInfo(iptcProfile_.length());
1037  SetStringInfoDatum(iptc_profile,(unsigned char *) iptcProfile_.data());
1039  (void) SetImageProfile(image(),"iptc",iptc_profile,exceptionInfo);
1040  iptc_profile=DestroyStringInfo(iptc_profile);
1042  }
1043 }
1044 
1046 {
1047  const StringInfo
1048  *iptc_profile;
1049 
1050  iptc_profile=GetImageProfile(constImage(),"iptc");
1051  if (iptc_profile == (StringInfo *) NULL)
1052  return(Blob());
1053  return(Blob(GetStringInfoDatum(iptc_profile),GetStringInfoLength(
1054  iptc_profile)));
1055 }
1056 
1057 bool Magick::Image::isOpaque(void) const
1058 {
1059  MagickBooleanType
1060  result;
1061 
1063  result=IsImageOpaque(constImage(),exceptionInfo);
1065  return(result != MagickFalse ? true : false);
1066 }
1067 
1068 void Magick::Image::isValid(const bool isValid_)
1069 {
1070  if (!isValid_)
1071  {
1072  delete _imgRef;
1073  _imgRef=new ImageRef;
1074  }
1075  else if (!isValid())
1076  {
1077  // Construct with single-pixel black image to make
1078  // image valid. This is an obvious hack.
1079  size(Geometry(1,1));
1080  read("xc:black");
1081  }
1082 }
1083 
1084 bool Magick::Image::isValid(void) const
1085 {
1086  return rows() && columns();
1087 }
1088 
1089 void Magick::Image::label(const std::string &label_)
1090 {
1091  modifyImage();
1093  (void) SetImageProperty(image(),"Label",NULL,exceptionInfo);
1094  if (label_.length() > 0)
1095  (void) SetImageProperty(image(),"Label",label_.c_str(),exceptionInfo);
1097 }
1098 
1099 std::string Magick::Image::label(void) const
1100 {
1101  const char
1102  *value;
1103 
1105  value=GetImageProperty(constImage(),"Label",exceptionInfo);
1107 
1108  if (value)
1109  return(std::string(value));
1110 
1111  return(std::string());
1112 }
1113 
1115 {
1116  std::string
1117  value;
1118 
1119  value=color_;
1120  artifact("compare:lowlight-color",value);
1121 }
1122 
1123 void Magick::Image::magick(const std::string &magick_)
1124 {
1125  size_t
1126  length;
1127 
1128  modifyImage();
1129 
1130  length=sizeof(image()->magick)-1;
1131  if (magick_.length() < length)
1132  length=magick_.length();
1133 
1134  if (!magick_.empty())
1135  magick_.copy(image()->magick,length);
1136  image()->magick[length]=0;
1137 
1138  options()->magick(magick_);
1139 }
1140 
1141 std::string Magick::Image::magick(void) const
1142 {
1143  if (*(constImage()->magick) != '\0')
1144  return(std::string(constImage()->magick));
1145 
1146  return(constOptions()->magick());
1147 }
1148 
1150 {
1151  std::string
1152  value;
1153 
1154  value=color_;
1155  artifact("compare:masklight-color",value);
1156 }
1157 
1159 {
1160  return(constImage()->error.mean_error_per_pixel);
1161 }
1162 
1163 void Magick::Image::modulusDepth(const size_t depth_)
1164 {
1165  modifyImage();
1167  SetImageDepth(image(),depth_,exceptionInfo);
1169  options()->depth(depth_);
1170 }
1171 
1173 {
1174  size_t
1175  depth;
1176 
1178  depth=GetImageDepth(constImage(),exceptionInfo);
1180  return(depth);
1181 }
1182 
1183 void Magick::Image::monochrome(const bool monochromeFlag_)
1184 {
1185  modifyImage();
1186  options()->monochrome(monochromeFlag_);
1187 }
1188 
1190 {
1191  return(constOptions()->monochrome());
1192 }
1193 
1195 {
1196  if (constImage()->montage)
1197  return Magick::Geometry(constImage()->montage);
1198 
1199  if (!quiet())
1200  throwExceptionExplicit(MagickCore::CorruptImageWarning,
1201  "Image does not contain a montage");
1202 
1203  return(Magick::Geometry());
1204 }
1205 
1207 {
1208  return(constImage()->error.normalized_maximum_error);
1209 }
1210 
1212 {
1213  return(constImage()->error.normalized_mean_error);
1214 }
1215 
1216 void Magick::Image::orientation(const Magick::OrientationType orientation_)
1217 {
1218  modifyImage();
1219  image()->orientation=orientation_;
1220 }
1221 
1222 Magick::OrientationType Magick::Image::orientation(void) const
1223 {
1224  return(constImage()->orientation);
1225 }
1226 
1228 {
1229  modifyImage();
1230  options()->page(pageSize_);
1231  image()->page=pageSize_;
1232 }
1233 
1235 {
1237  constImage()->page.x,constImage()->page.y));
1238 }
1239 
1240 void Magick::Image::quality(const size_t quality_)
1241 {
1242  modifyImage();
1243  image()->quality=quality_;
1244  options()->quality(quality_);
1245 }
1246 
1247 size_t Magick::Image::quality(void) const
1248 {
1249  return(constImage()->quality);
1250 }
1251 
1252 void Magick::Image::quantizeColors(const size_t colors_)
1253 {
1254  modifyImage();
1255  options()->quantizeColors(colors_);
1256 }
1257 
1259 {
1260  return(constOptions()->quantizeColors());
1261 }
1262 
1264  const Magick::ColorspaceType colorSpace_)
1265 {
1266  modifyImage();
1267  options()->quantizeColorSpace(colorSpace_);
1268 }
1269 
1270 Magick::ColorspaceType Magick::Image::quantizeColorSpace(void) const
1271 {
1272  return(constOptions()->quantizeColorSpace());
1273 }
1274 
1275 void Magick::Image::quantizeDither(const bool ditherFlag_)
1276 {
1277  modifyImage();
1278  options()->quantizeDither(ditherFlag_);
1279 }
1280 
1282 {
1283  return(constOptions()->quantizeDither());
1284 }
1285 
1286 void Magick::Image::quantizeDitherMethod(const DitherMethod ditherMethod_)
1287 {
1288  modifyImage();
1289  options()->quantizeDitherMethod(ditherMethod_);
1290 }
1291 
1292 MagickCore::DitherMethod Magick::Image::quantizeDitherMethod(void) const
1293 {
1294  return(constOptions()->quantizeDitherMethod());
1295 }
1296 
1297 void Magick::Image::quantizeTreeDepth(const size_t treeDepth_)
1298 {
1299  modifyImage();
1300  options()->quantizeTreeDepth(treeDepth_);
1301 }
1302 
1304 {
1305  return(constOptions()->quantizeTreeDepth());
1306 }
1307 
1308 void Magick::Image::quiet(const bool quiet_)
1309 {
1310  modifyImage();
1311  options()->quiet(quiet_);
1312 }
1313 
1314 bool Magick::Image::quiet(void) const
1315 {
1316  return(constOptions()->quiet());
1317 }
1318 
1320  const Magick::RenderingIntent renderingIntent_)
1321 {
1322  modifyImage();
1323  image()->rendering_intent=renderingIntent_;
1324 }
1325 
1326 Magick::RenderingIntent Magick::Image::renderingIntent(void) const
1327 {
1328  return(static_cast<Magick::RenderingIntent>(constImage()->rendering_intent));
1329 }
1330 
1332  const Magick::ResolutionType resolutionUnits_)
1333 {
1334  modifyImage();
1335  image()->units=resolutionUnits_;
1336  options()->resolutionUnits(resolutionUnits_);
1337 }
1338 
1339 Magick::ResolutionType Magick::Image::resolutionUnits(void) const
1340 {
1341  return(static_cast<Magick::ResolutionType>(constImage()->units));
1342 }
1343 
1344 size_t Magick::Image::rows(void) const
1345 {
1346  return(constImage()->rows);
1347 }
1348 
1349 void Magick::Image::scene(const size_t scene_)
1350 {
1351  modifyImage();
1352  image()->scene=scene_;
1353 }
1354 
1355 size_t Magick::Image::scene(void) const
1356 {
1357  return(constImage()->scene);
1358 }
1359 
1360 void Magick::Image::size(const Geometry &geometry_)
1361 {
1362  modifyImage();
1363  options()->size(geometry_);
1364  image()->rows=geometry_.height();
1365  image()->columns=geometry_.width();
1366 }
1367 
1369 {
1371 }
1372 
1373 void Magick::Image::strokeAntiAlias(const bool flag_)
1374 {
1375  modifyImage();
1376  options()->strokeAntiAlias(flag_);
1377 }
1378 
1380 {
1381  return(constOptions()->strokeAntiAlias());
1382 }
1383 
1385 {
1386  std::string
1387  value;
1388 
1389  modifyImage();
1390  options()->strokeColor(strokeColor_);
1391  value=strokeColor_;
1392  artifact("stroke",value);
1393 }
1394 
1396 {
1397  return(constOptions()->strokeColor());
1398 }
1399 
1400 void Magick::Image::strokeDashArray(const double *strokeDashArray_)
1401 {
1402  modifyImage();
1403  options()->strokeDashArray(strokeDashArray_);
1404 }
1405 
1406 const double* Magick::Image::strokeDashArray(void) const
1407 {
1408  return(constOptions()->strokeDashArray());
1409 }
1410 
1411 void Magick::Image::strokeDashOffset(const double strokeDashOffset_)
1412 {
1413  modifyImage();
1414  options()->strokeDashOffset(strokeDashOffset_);
1415 }
1416 
1418 {
1419  return(constOptions()->strokeDashOffset());
1420 }
1421 
1422 void Magick::Image::strokeLineCap(const Magick::LineCap lineCap_)
1423 {
1424  modifyImage();
1425  options()->strokeLineCap(lineCap_);
1426 }
1427 
1428 Magick::LineCap Magick::Image::strokeLineCap(void) const
1429 {
1430  return(constOptions()->strokeLineCap());
1431 }
1432 
1433 void Magick::Image::strokeLineJoin(const Magick::LineJoin lineJoin_)
1434 {
1435  modifyImage();
1436  options()->strokeLineJoin(lineJoin_);
1437 }
1438 
1439 Magick::LineJoin Magick::Image::strokeLineJoin(void) const
1440 {
1441  return(constOptions()->strokeLineJoin());
1442 }
1443 
1444 void Magick::Image::strokeMiterLimit(const size_t strokeMiterLimit_)
1445 {
1446  modifyImage();
1447  options()->strokeMiterLimit(strokeMiterLimit_);
1448 }
1449 
1451 {
1452  return(constOptions()->strokeMiterLimit());
1453 }
1454 
1455 void Magick::Image::strokePattern(const Image &strokePattern_)
1456 {
1457  modifyImage();
1458  if(strokePattern_.isValid())
1459  options()->strokePattern(strokePattern_.constImage());
1460  else
1461  options()->strokePattern(static_cast<MagickCore::Image*>(NULL));
1462 }
1463 
1465 {
1466  // FIXME: This is inordinately innefficient
1467  const MagickCore::Image
1468  *tmpTexture;
1469 
1470  Image
1471  texture;
1472 
1473  tmpTexture=constOptions()->strokePattern();
1474 
1475  if (tmpTexture)
1476  {
1478  *image;
1479 
1481  image=CloneImage(tmpTexture,0,0,MagickTrue,exceptionInfo);
1482  texture.replaceImage(image);
1484  }
1485  return(texture);
1486 }
1487 
1488 void Magick::Image::strokeWidth(const double strokeWidth_)
1489 {
1490  char
1491  value[MagickPathExtent];
1492 
1493  modifyImage();
1494  options()->strokeWidth(strokeWidth_);
1495  FormatLocaleString(value,MagickPathExtent,"%.20g",strokeWidth_);
1496  (void) SetImageArtifact(image(),"strokewidth",value);
1497 }
1498 
1499 double Magick::Image::strokeWidth(void) const
1500 {
1501  return(constOptions()->strokeWidth());
1502 }
1503 
1504 void Magick::Image::subImage(const size_t subImage_)
1505 {
1506  modifyImage();
1507  options()->subImage(subImage_);
1508 }
1509 
1510 size_t Magick::Image::subImage(void) const
1511 {
1512  return(constOptions()->subImage());
1513 }
1514 
1515 void Magick::Image::subRange(const size_t subRange_)
1516 {
1517  modifyImage();
1518  options()->subRange(subRange_);
1519 }
1520 
1521 size_t Magick::Image::subRange(void) const
1522 {
1523  return(constOptions()->subRange());
1524 }
1525 
1526 void Magick::Image::textAntiAlias(const bool flag_)
1527 {
1528  modifyImage();
1529  options()->textAntiAlias(flag_);
1530 }
1531 
1533 {
1534  return(constOptions()->textAntiAlias());
1535 }
1536 
1537 void Magick::Image::textDirection(DirectionType direction_)
1538 {
1539  modifyImage();
1540  options()->textDirection(direction_);
1541 }
1542 
1543 Magick::DirectionType Magick::Image::textDirection(void) const
1544 {
1545  return(constOptions()->textDirection());
1546 }
1547 
1548 void Magick::Image::textEncoding(const std::string &encoding_)
1549 {
1550  modifyImage();
1551  options()->textEncoding(encoding_);
1552 }
1553 
1554 std::string Magick::Image::textEncoding(void) const
1555 {
1556  return(constOptions()->textEncoding());
1557 }
1558 
1559 void Magick::Image::textGravity(GravityType gravity_)
1560 {
1561  modifyImage();
1562  options()->textGravity(gravity_);
1563 }
1564 
1565 Magick::GravityType Magick::Image::textGravity(void) const
1566 {
1567  return(constOptions()->textGravity());
1568 }
1569 
1571 {
1572  modifyImage();
1573  options()->textInterlineSpacing(spacing_);
1574 }
1575 
1577 {
1578  return(constOptions()->textInterlineSpacing());
1579 }
1580 
1582 {
1583  modifyImage();
1584  options()->textInterwordSpacing(spacing_);
1585 }
1586 
1588 {
1589  return(constOptions()->textInterwordSpacing());
1590 }
1591 
1592 void Magick::Image::textKerning(double kerning_)
1593 {
1594  modifyImage();
1595  options()->textKerning(kerning_);
1596 }
1597 
1598 double Magick::Image::textKerning(void) const
1599 {
1600  return(constOptions()->textKerning());
1601 }
1602 
1603 void Magick::Image::textUnderColor(const Color &underColor_)
1604 {
1605  modifyImage();
1606  options()->textUnderColor(underColor_);
1607 }
1608 
1610 {
1611  return(constOptions()->textUnderColor());
1612 }
1613 
1614 size_t Magick::Image::totalColors(void) const
1615 {
1616  size_t
1617  colors;
1618 
1620  colors=GetNumberColors(constImage(),(FILE *) NULL,exceptionInfo);
1622  return colors;
1623 }
1624 
1625 void Magick::Image::transformRotation(const double angle_)
1626 {
1627  modifyImage();
1628  options()->transformRotation(angle_);
1629 }
1630 
1631 void Magick::Image::transformSkewX(const double skewx_)
1632 {
1633  modifyImage();
1634  options()->transformSkewX(skewx_);
1635 }
1636 
1637 void Magick::Image::transformSkewY(const double skewy_)
1638 {
1639  modifyImage();
1640  options()->transformSkewY(skewy_);
1641 }
1642 
1643 Magick::ImageType Magick::Image::type(void) const
1644 {
1645  if (constOptions()->type() != UndefinedType)
1646  return(constOptions()->type());
1647  return(GetImageType(constImage()));
1648 }
1649 
1650 void Magick::Image::type(const Magick::ImageType type_)
1651 {
1652  modifyImage();
1653  options()->type(type_);
1655  SetImageType(image(),type_,exceptionInfo);
1657 }
1658 
1659 void Magick::Image::verbose(const bool verboseFlag_)
1660 {
1661  modifyImage();
1662  options()->verbose(verboseFlag_);
1663 }
1664 
1665 bool Magick::Image::verbose(void) const
1666 {
1667  return(constOptions()->verbose());
1668 }
1669 
1671  const VirtualPixelMethod virtualPixelMethod_)
1672 {
1673  modifyImage();
1675  SetImageVirtualPixelMethod(image(),virtualPixelMethod_,exceptionInfo);
1677 }
1678 
1679 Magick::VirtualPixelMethod Magick::Image::virtualPixelMethod(void) const
1680 {
1681  return(GetImageVirtualPixelMethod(constImage()));
1682 }
1683 
1684 void Magick::Image::x11Display(const std::string &display_)
1685 {
1686  modifyImage();
1687  options()->x11Display(display_);
1688 }
1689 
1690 std::string Magick::Image::x11Display(void) const
1691 {
1692  return(constOptions()->x11Display());
1693 }
1694 
1695 double Magick::Image::xResolution(void) const
1696 {
1697  return(constImage()->resolution.x);
1698 }
1699 
1700 double Magick::Image::yResolution(void) const
1701 {
1702  return(constImage()->resolution.y);
1703 }
1704 
1705 void Magick::Image::adaptiveBlur(const double radius_,const double sigma_)
1706 {
1708  *newImage;
1709 
1711  newImage=AdaptiveBlurImage(constImage(),radius_,sigma_,exceptionInfo);
1712  replaceImage(newImage);
1714 }
1715 
1717 {
1719  *newImage;
1720 
1721  size_t
1722  height=rows(),
1723  width=columns();
1724 
1725  ssize_t
1726  x=0,
1727  y=0;
1728 
1729  ParseMetaGeometry(static_cast<std::string>(geometry_).c_str(),&x,&y,&width,
1730  &height);
1731 
1733  newImage=AdaptiveResizeImage(constImage(),width,height,exceptionInfo);
1734  replaceImage(newImage);
1736 }
1737 
1738 void Magick::Image::adaptiveSharpen(const double radius_,const double sigma_)
1739 {
1741  *newImage;
1742 
1744  newImage=AdaptiveSharpenImage(constImage(),radius_,sigma_,exceptionInfo);
1745  replaceImage(newImage);
1747 }
1748 
1749 void Magick::Image::adaptiveSharpenChannel(const ChannelType channel_,
1750  const double radius_,const double sigma_ )
1751 {
1753  *newImage;
1754 
1756  GetAndSetPPChannelMask(channel_);
1757  newImage=AdaptiveSharpenImage(constImage(),radius_,sigma_,exceptionInfo);
1759  replaceImage(newImage);
1761 }
1762 
1763 void Magick::Image::adaptiveThreshold(const size_t width_,const size_t height_,
1764  const double bias_)
1765 {
1766 
1768  *newImage;
1769 
1771  newImage=AdaptiveThresholdImage(constImage(),width_,height_,bias_,
1772  exceptionInfo);
1773  replaceImage(newImage);
1775 }
1776 
1777 void Magick::Image::addNoise(const NoiseType noiseType_,const double attenuate_)
1778 {
1780  *newImage;
1781 
1783  newImage=AddNoiseImage(constImage(),noiseType_,attenuate_,exceptionInfo);
1784  replaceImage(newImage);
1786 }
1787 
1788 void Magick::Image::addNoiseChannel(const ChannelType channel_,
1789  const NoiseType noiseType_,const double attenuate_)
1790 {
1792  *newImage;
1793 
1795  GetAndSetPPChannelMask(channel_);
1796  newImage=AddNoiseImage(constImage(),noiseType_,attenuate_,exceptionInfo);
1798  replaceImage(newImage);
1800 }
1801 
1803 {
1804  AffineMatrix
1805  _affine;
1806 
1808  *newImage;
1809 
1810  _affine.sx=affine_.sx();
1811  _affine.sy=affine_.sy();
1812  _affine.rx=affine_.rx();
1813  _affine.ry=affine_.ry();
1814  _affine.tx=affine_.tx();
1815  _affine.ty=affine_.ty();
1816 
1818  newImage=AffineTransformImage(constImage(),&_affine,exceptionInfo);
1819  replaceImage(newImage);
1821 }
1822 
1823 void Magick::Image::alpha(const unsigned int alpha_)
1824 {
1825  modifyImage();
1827  SetImageAlpha(image(),alpha_,exceptionInfo);
1829 }
1830 
1831 void Magick::Image::alphaChannel(AlphaChannelOption alphaOption_)
1832 {
1833  modifyImage();
1835  SetImageAlphaChannel(image(),alphaOption_,exceptionInfo);
1837 }
1838 
1839 void Magick::Image::annotate(const std::string &text_,
1840  const Geometry &location_)
1841 {
1842  annotate(text_,location_,NorthWestGravity,0.0);
1843 }
1844 
1845 void Magick::Image::annotate(const std::string &text_,
1846  const Geometry &boundingArea_,const GravityType gravity_)
1847 {
1848  annotate(text_,boundingArea_,gravity_,0.0);
1849 }
1850 
1851 void Magick::Image::annotate(const std::string &text_,
1852  const Geometry &boundingArea_,const GravityType gravity_,
1853  const double degrees_)
1854 {
1855  AffineMatrix
1856  oaffine;
1857 
1858  char
1859  boundingArea[MagickPathExtent];
1860 
1861  DrawInfo
1862  *drawInfo;
1863 
1864  modifyImage();
1865 
1866  drawInfo=options()->drawInfo();
1867  drawInfo->text=DestroyString(drawInfo->text);
1868  drawInfo->text=const_cast<char *>(text_.c_str());
1869  drawInfo->geometry=DestroyString(drawInfo->geometry);
1870 
1871  if (boundingArea_.isValid())
1872  {
1873  if (boundingArea_.width() == 0 || boundingArea_.height() == 0)
1874  {
1875  FormatLocaleString(boundingArea,MagickPathExtent,"%+.20g%+.20g",
1876  (double) boundingArea_.xOff(),(double) boundingArea_.yOff());
1877  }
1878  else
1879  {
1880  (void) CopyMagickString(boundingArea,
1881  std::string(boundingArea_).c_str(), MagickPathExtent);
1882  }
1883  drawInfo->geometry=boundingArea;
1884  }
1885 
1886  drawInfo->gravity=gravity_;
1887 
1888  oaffine=drawInfo->affine;
1889  if (degrees_ != 0.0)
1890  {
1891  AffineMatrix
1892  affine,
1893  current;
1894 
1895  affine.sx=1.0;
1896  affine.rx=0.0;
1897  affine.ry=0.0;
1898  affine.sy=1.0;
1899  affine.tx=0.0;
1900  affine.ty=0.0;
1901 
1902  current=drawInfo->affine;
1903  affine.sx=cos(DegreesToRadians(fmod(degrees_,360.0)));
1904  affine.rx=sin(DegreesToRadians(fmod(degrees_,360.0)));
1905  affine.ry=(-sin(DegreesToRadians(fmod(degrees_,360.0))));
1906  affine.sy=cos(DegreesToRadians(fmod(degrees_,360.0)));
1907 
1908  drawInfo->affine.sx=current.sx*affine.sx+current.ry*affine.rx;
1909  drawInfo->affine.rx=current.rx*affine.sx+current.sy*affine.rx;
1910  drawInfo->affine.ry=current.sx*affine.ry+current.ry*affine.sy;
1911  drawInfo->affine.sy=current.rx*affine.ry+current.sy*affine.sy;
1912  drawInfo->affine.tx=current.sx*affine.tx+current.ry*affine.ty
1913  +current.tx;
1914  }
1915 
1917  AnnotateImage(image(),drawInfo,exceptionInfo);
1918 
1919  // Restore original values
1920  drawInfo->affine=oaffine;
1921  drawInfo->text=(char *) NULL;
1922  drawInfo->geometry=(char *) NULL;
1923 
1925 }
1926 
1927 void Magick::Image::annotate(const std::string &text_,
1928  const GravityType gravity_)
1929 {
1930  DrawInfo
1931  *drawInfo;
1932 
1933  modifyImage();
1934 
1935  drawInfo=options()->drawInfo();
1936  drawInfo->text=DestroyString(drawInfo->text);
1937  drawInfo->text=const_cast<char *>(text_.c_str());
1938  drawInfo->gravity=gravity_;
1939 
1941  AnnotateImage(image(),drawInfo,exceptionInfo);
1942 
1943  drawInfo->gravity=NorthWestGravity;
1944  drawInfo->text=(char *) NULL;
1945 
1947 }
1948 
1949 void Magick::Image::artifact(const std::string &name_,const std::string &value_)
1950 {
1951  modifyImage();
1952  (void) SetImageArtifact(image(),name_.c_str(),value_.c_str());
1953 }
1954 
1955 std::string Magick::Image::artifact(const std::string &name_) const
1956 {
1957  const char
1958  *value;
1959 
1960  value=GetImageArtifact(constImage(),name_.c_str());
1961  if (value)
1962  return(std::string(value));
1963  return(std::string());
1964 }
1965 
1966 void Magick::Image::attribute(const std::string name_,const char *value_)
1967 {
1968  modifyImage();
1970  SetImageProperty(image(),name_.c_str(),value_,exceptionInfo);
1972 }
1973 
1974 void Magick::Image::attribute(const std::string name_,const std::string value_)
1975 {
1976  modifyImage();
1978  SetImageProperty(image(),name_.c_str(),value_.c_str(),exceptionInfo);
1980 }
1981 
1982 std::string Magick::Image::attribute(const std::string name_) const
1983 {
1984  const char
1985  *value;
1986 
1988  value=GetImageProperty(constImage(),name_.c_str(),exceptionInfo);
1990 
1991  if (value)
1992  return(std::string(value));
1993 
1994  return(std::string()); // Intentionally no exception
1995 }
1996 
1998 {
1999  modifyImage();
2001  (void) SyncImageSettings(imageInfo(),image(),exceptionInfo);
2002  (void) AutoGammaImage(image(),exceptionInfo);
2004 }
2005 
2006 void Magick::Image::autoGammaChannel(const ChannelType channel_)
2007 {
2008  modifyImage();
2010  GetAndSetPPChannelMask(channel_);
2011  (void) SyncImageSettings(imageInfo(),image(),exceptionInfo);
2012  (void) AutoGammaImage(image(),exceptionInfo);
2015 }
2016 
2018 {
2019  modifyImage();
2021  (void) AutoLevelImage(image(),exceptionInfo);
2023 }
2024 
2025 void Magick::Image::autoLevelChannel(const ChannelType channel_)
2026 {
2027  modifyImage();
2029  GetAndSetPPChannelMask(channel_);
2030  (void) AutoLevelImage(image(),exceptionInfo);
2033 }
2034 
2036 {
2038  *newImage;
2039 
2040  if (image()->orientation == UndefinedOrientation ||
2041  image()->orientation == TopLeftOrientation)
2042  return;
2043 
2045  newImage=AutoOrientImage(constImage(),image()->orientation,exceptionInfo);
2046  replaceImage(newImage);
2048 }
2049 
2050 void Magick::Image::autoThreshold(const AutoThresholdMethod method_)
2051 {
2052  modifyImage();
2054  AutoThresholdImage(image(),method_, exceptionInfo);
2056 }
2057 
2058 void Magick::Image::blackThreshold(const std::string &threshold_)
2059 {
2060  modifyImage();
2062  BlackThresholdImage(image(),threshold_.c_str(),exceptionInfo);
2064 }
2065 
2066 void Magick::Image::blackThresholdChannel(const ChannelType channel_,
2067  const std::string &threshold_)
2068 {
2069  modifyImage();
2071  GetAndSetPPChannelMask(channel_);
2072  BlackThresholdImage(image(),threshold_.c_str(),exceptionInfo);
2075 }
2076 
2077 void Magick::Image::blueShift(const double factor_)
2078 {
2080  *newImage;
2081 
2083  newImage=BlueShiftImage(constImage(),factor_,exceptionInfo);
2084  replaceImage(newImage);
2086 }
2087 
2088 void Magick::Image::blur(const double radius_,const double sigma_)
2089 {
2091  *newImage;
2092 
2094  newImage=BlurImage(constImage(),radius_,sigma_,exceptionInfo);
2095  replaceImage(newImage);
2097 }
2098 
2099 void Magick::Image::blurChannel(const ChannelType channel_,
2100  const double radius_,const double sigma_)
2101 {
2103  *newImage;
2104 
2106  GetAndSetPPChannelMask(channel_);
2107  newImage=BlurImage(constImage(),radius_,sigma_,exceptionInfo);
2109  replaceImage(newImage);
2111 }
2112 
2113 void Magick::Image::border(const Geometry &geometry_)
2114 {
2116  *newImage;
2117 
2118  RectangleInfo
2119  borderInfo=geometry_;
2120 
2122  newImage=BorderImage(constImage(),&borderInfo,image()->compose,
2123  exceptionInfo);
2124  replaceImage(newImage);
2126 }
2127 
2128 void Magick::Image::brightnessContrast(const double brightness_,
2129  const double contrast_)
2130 {
2131  modifyImage();
2133  BrightnessContrastImage(image(),brightness_,contrast_,exceptionInfo);
2135 }
2136 
2137 void Magick::Image::brightnessContrastChannel(const ChannelType channel_,
2138  const double brightness_,const double contrast_)
2139 {
2140  modifyImage();
2142  GetAndSetPPChannelMask(channel_);
2143  BrightnessContrastImage(image(),brightness_,contrast_,exceptionInfo);
2146 }
2147 
2148 void Magick::Image::cannyEdge(const double radius_,const double sigma_,
2149  const double lowerPercent_,const double upperPercent_)
2150 {
2152  *newImage;
2153 
2154  modifyImage();
2156  newImage=CannyEdgeImage(constImage(),radius_,sigma_,lowerPercent_,
2157  upperPercent_,exceptionInfo);
2158  replaceImage(newImage);
2160 }
2161 
2162 void Magick::Image::cdl(const std::string &cdl_)
2163 {
2164  modifyImage();
2166  (void) ColorDecisionListImage(image(),cdl_.c_str(),exceptionInfo);
2168 }
2169 
2170 void Magick::Image::channel(const ChannelType channel_)
2171 {
2173  *newImage;
2174 
2176  newImage=SeparateImage(image(),channel_,exceptionInfo);
2177  replaceImage(newImage);
2179 }
2180 
2181 void Magick::Image::charcoal(const double radius_,const double sigma_)
2182 {
2184  *newImage;
2185 
2187  newImage=CharcoalImage(image(),radius_,sigma_,exceptionInfo);
2188  replaceImage(newImage);
2190 }
2191 
2192 void Magick::Image::charcoalChannel(const ChannelType channel_,
2193  const double radius_,const double sigma_)
2194 {
2196  *newImage;
2197 
2199  GetAndSetPPChannelMask(channel_);
2200  newImage=CharcoalImage(image(),radius_,sigma_,exceptionInfo);
2202  replaceImage(newImage);
2204 }
2205 
2206 void Magick::Image::chop(const Geometry &geometry_)
2207 {
2209  *newImage;
2210 
2211  RectangleInfo
2212  chopInfo=geometry_;
2213 
2215  newImage=ChopImage(image(),&chopInfo,exceptionInfo);
2216  replaceImage(newImage);
2218 }
2219 
2220 void Magick::Image::chromaBluePrimary(const double x_,const double y_,
2221  const double z_)
2222 {
2223  modifyImage();
2224  image()->chromaticity.blue_primary.x=x_;
2225  image()->chromaticity.blue_primary.y=y_;
2226  image()->chromaticity.blue_primary.z=z_;
2227 }
2228 
2229 void Magick::Image::chromaBluePrimary(double *x_,double *y_,double *z_) const
2230 {
2231  *x_=constImage()->chromaticity.blue_primary.x;
2232  *y_=constImage()->chromaticity.blue_primary.y;
2233  *z_=constImage()->chromaticity.blue_primary.z;
2234 }
2235 
2236 void Magick::Image::chromaGreenPrimary(const double x_,const double y_,
2237  const double z_)
2238 {
2239  modifyImage();
2240  image()->chromaticity.green_primary.x=x_;
2241  image()->chromaticity.green_primary.y=y_;
2242  image()->chromaticity.green_primary.z=z_;
2243 }
2244 
2245 void Magick::Image::chromaGreenPrimary(double *x_,double *y_,double *z_) const
2246 {
2247  *x_=constImage()->chromaticity.green_primary.x;
2248  *y_=constImage()->chromaticity.green_primary.y;
2249  *z_=constImage()->chromaticity.green_primary.z;
2250 }
2251 
2252 void Magick::Image::chromaRedPrimary(const double x_,const double y_,
2253  const double z_)
2254 {
2255  modifyImage();
2256  image()->chromaticity.red_primary.x=x_;
2257  image()->chromaticity.red_primary.y=y_;
2258  image()->chromaticity.red_primary.z=z_;
2259 }
2260 
2261 void Magick::Image::chromaRedPrimary(double *x_,double *y_,double *z_) const
2262 {
2263  *x_=constImage()->chromaticity.red_primary.x;
2264  *y_=constImage()->chromaticity.red_primary.y;
2265  *z_=constImage()->chromaticity.red_primary.z;
2266 }
2267 
2268 void Magick::Image::chromaWhitePoint(const double x_,const double y_,
2269  const double z_)
2270 {
2271  modifyImage();
2272  image()->chromaticity.white_point.x=x_;
2273  image()->chromaticity.white_point.y=y_;
2274  image()->chromaticity.white_point.z=z_;
2275 }
2276 
2277 void Magick::Image::chromaWhitePoint(double *x_,double *y_,double *z_) const
2278 {
2279  *x_=constImage()->chromaticity.white_point.x;
2280  *y_=constImage()->chromaticity.white_point.y;
2281  *z_=constImage()->chromaticity.white_point.z;
2282 }
2283 
2285 {
2286  modifyImage();
2288  ClampImage(image(),exceptionInfo);
2290 }
2291 
2292 void Magick::Image::clampChannel(const ChannelType channel_)
2293 {
2294  modifyImage();
2296  GetAndSetPPChannelMask(channel_);
2297  ClampImage(image(),exceptionInfo);
2300 }
2301 
2303 {
2304  modifyImage();
2306  ClipImage(image(),exceptionInfo);
2308 }
2309 
2310 void Magick::Image::clipPath(const std::string pathname_,const bool inside_)
2311 {
2312  modifyImage();
2314  ClipImagePath(image(),pathname_.c_str(),(MagickBooleanType) inside_,
2315  exceptionInfo);
2317 }
2318 
2319 void Magick::Image::clut(const Image &clutImage_,
2320  const PixelInterpolateMethod method)
2321 {
2322  modifyImage();
2324  ClutImage(image(),clutImage_.constImage(),method,exceptionInfo);
2326 }
2327 
2328 void Magick::Image::clutChannel(const ChannelType channel_,
2329  const Image &clutImage_,const PixelInterpolateMethod method)
2330 {
2331  modifyImage();
2333  GetAndSetPPChannelMask(channel_);
2334  ClutImage(image(),clutImage_.constImage(),method,exceptionInfo);
2337 }
2338 
2339 void Magick::Image::colorize(const unsigned int alpha_,const Color &penColor_)
2340 {
2341  colorize(alpha_,alpha_,alpha_,penColor_);
2342 }
2343 
2344 void Magick::Image::colorize(const unsigned int alphaRed_,
2345  const unsigned int alphaGreen_,const unsigned int alphaBlue_,
2346  const Color &penColor_)
2347 {
2348  char
2349  blend[MagickPathExtent];
2350 
2352  *newImage;
2353 
2354  PixelInfo
2355  target;
2356 
2357  if (!penColor_.isValid())
2358  throwExceptionExplicit(MagickCore::OptionError,
2359  "Pen color argument is invalid");
2360 
2361  FormatLocaleString(blend,MagickPathExtent,"%u/%u/%u",alphaRed_,alphaGreen_,
2362  alphaBlue_);
2363 
2364  target=static_cast<PixelInfo>(penColor_);
2366  newImage=ColorizeImage(image(),blend,&target,exceptionInfo);
2367  replaceImage(newImage);
2369 }
2370 
2371 void Magick::Image::colorMap(const size_t index_,const Color &color_)
2372 {
2374  *imageptr;
2375 
2376  imageptr=image();
2377 
2378  if (index_ > (MaxColormapSize-1))
2379  throwExceptionExplicit(MagickCore::OptionError,
2380  "Colormap index must be less than MaxColormapSize");
2381 
2382  if (!color_.isValid())
2383  throwExceptionExplicit(MagickCore::OptionError,
2384  "Color argument is invalid");
2385 
2386  modifyImage();
2387 
2388  // Ensure that colormap size is large enough
2389  if (colorMapSize() < (index_+1))
2390  colorMapSize(index_+1);
2391 
2392  // Set color at index in colormap
2393  (imageptr->colormap)[index_]=color_;
2394 }
2395 
2396 Magick::Color Magick::Image::colorMap(const size_t index_) const
2397 {
2398  if (!constImage()->colormap)
2399  {
2400  throwExceptionExplicit(MagickCore::OptionError,
2401  "Image does not contain a colormap");
2402  return(Color());
2403  }
2404 
2405  if (index_ > constImage()->colors-1)
2406  throwExceptionExplicit(MagickCore::OptionError,"Index out of range");
2407 
2408  return(Magick::Color((constImage()->colormap)[index_]));
2409 }
2410 
2411 void Magick::Image::colorMatrix(const size_t order_,
2412  const double *color_matrix_)
2413 {
2414  KernelInfo
2415  *kernel_info;
2416 
2418  kernel_info=AcquireKernelInfo((const char *) NULL,exceptionInfo);
2419  if (kernel_info != (KernelInfo *) NULL)
2420  {
2421  kernel_info->width=order_;
2422  kernel_info->height=order_;
2423  kernel_info->values=(MagickRealType *) AcquireAlignedMemory(order_,
2424  order_*sizeof(*kernel_info->values));
2425  if (kernel_info->values != (MagickRealType *) NULL)
2426  {
2428  *newImage;
2429 
2430  for (ssize_t i=0; i < (ssize_t) (order_*order_); i++)
2431  kernel_info->values[i]=color_matrix_[i];
2432  newImage=ColorMatrixImage(image(),kernel_info,exceptionInfo);
2433  replaceImage(newImage);
2434  }
2435  kernel_info=DestroyKernelInfo(kernel_info);
2436  }
2438 }
2439 
2440 bool Magick::Image::compare(const Image &reference_) const
2441 {
2442  bool
2443  status;
2444 
2445  Image
2446  ref=reference_;
2447 
2449  status=static_cast<bool>(IsImagesEqual(constImage(),ref.constImage(),
2450  exceptionInfo));
2452  return(status);
2453 }
2454 
2455 double Magick::Image::compare(const Image &reference_,const MetricType metric_)
2456 {
2457  double
2458  distortion=0.0;
2459 
2461  GetImageDistortion(image(),reference_.constImage(),metric_,&distortion,
2462  exceptionInfo);
2464  return(distortion);
2465 }
2466 
2467 double Magick::Image::compareChannel(const ChannelType channel_,
2468  const Image &reference_,const MetricType metric_)
2469 {
2470  double
2471  distortion=0.0;
2472 
2474  GetAndSetPPChannelMask(channel_);
2475  GetImageDistortion(image(),reference_.constImage(),metric_,&distortion,
2476  exceptionInfo);
2479  return(distortion);
2480 }
2481 
2483  const MetricType metric_,double *distortion)
2484 {
2486  *newImage;
2487 
2489  newImage=CompareImages(image(),reference_.constImage(),metric_,distortion,
2490  exceptionInfo);
2492  if (newImage == (MagickCore::Image *) NULL)
2493  return(Magick::Image());
2494  else
2495  return(Magick::Image(newImage));
2496 }
2497 
2499  const Image &reference_,const MetricType metric_,double *distortion)
2500 {
2502  *newImage;
2503 
2505  GetAndSetPPChannelMask(channel_);
2506  newImage=CompareImages(image(),reference_.constImage(),metric_,distortion,
2507  exceptionInfo);
2510  if (newImage == (MagickCore::Image *) NULL)
2511  return(Magick::Image());
2512  else
2513  return(Magick::Image(newImage));
2514 }
2515 
2516 void Magick::Image::composite(const Image &compositeImage_,
2517  const Geometry &offset_,const CompositeOperator compose_)
2518 {
2519  size_t
2520  height=rows(),
2521  width=columns();
2522 
2523  ssize_t
2524  x=offset_.xOff(),
2525  y=offset_.yOff();
2526 
2527  ParseMetaGeometry(static_cast<std::string>(offset_).c_str(),&x,&y,&width,
2528  &height);
2529 
2530  modifyImage();
2532  CompositeImage(image(),compositeImage_.constImage(),compose_,MagickTrue,
2533  x,y,exceptionInfo);
2535 }
2536 
2537 void Magick::Image::composite(const Image &compositeImage_,
2538  const GravityType gravity_,const CompositeOperator compose_)
2539 {
2540  RectangleInfo
2541  geometry;
2542 
2543  modifyImage();
2544  SetGeometry(compositeImage_.constImage(),&geometry);
2545  GravityAdjustGeometry(columns(),rows(),gravity_,&geometry);
2546 
2548  CompositeImage(image(),compositeImage_.constImage(),compose_,MagickTrue,
2549  geometry.x,geometry.y,exceptionInfo);
2551 }
2552 
2553 void Magick::Image::composite(const Image &compositeImage_,
2554  const ssize_t xOffset_,const ssize_t yOffset_,
2555  const CompositeOperator compose_)
2556 {
2557  // Image supplied as compositeImage is composited with current image and
2558  // results in updating current image.
2559  modifyImage();
2561  CompositeImage(image(),compositeImage_.constImage(),compose_,MagickTrue,
2562  xOffset_,yOffset_,exceptionInfo);
2564 }
2565 
2566 void Magick::Image::connectedComponents(const size_t connectivity_)
2567 {
2569  *newImage;
2570 
2572  newImage=ConnectedComponentsImage(constImage(),connectivity_,
2573  (CCObjectInfo **) NULL,exceptionInfo);
2574  replaceImage(newImage);
2576 }
2577 
2578 void Magick::Image::contrast(const bool sharpen_)
2579 {
2580  modifyImage();
2582  ContrastImage(image(),(MagickBooleanType) sharpen_,exceptionInfo);
2584 }
2585 
2586 void Magick::Image::contrastStretch(const double blackPoint_,
2587  const double whitePoint_)
2588 {
2589  modifyImage();
2591  ContrastStretchImage(image(),blackPoint_,whitePoint_,exceptionInfo);
2593 }
2594 
2595 void Magick::Image::contrastStretchChannel(const ChannelType channel_,
2596  const double blackPoint_,const double whitePoint_)
2597 {
2598  modifyImage();
2600  GetAndSetPPChannelMask(channel_);
2601  ContrastStretchImage(image(),blackPoint_,whitePoint_,exceptionInfo);
2604 }
2605 
2606 void Magick::Image::convolve(const size_t order_,const double *kernel_)
2607 {
2608  KernelInfo
2609  *kernel_info;
2610 
2612  kernel_info=AcquireKernelInfo((const char *) NULL,exceptionInfo);
2613  kernel_info->width=order_;
2614  kernel_info->height=order_;
2615  kernel_info->x=(ssize_t) (order_-1)/2;
2616  kernel_info->y=(ssize_t) (order_-1)/2;
2617  kernel_info->values=(MagickRealType *) AcquireAlignedMemory(order_,
2618  order_*sizeof(*kernel_info->values));
2619  if (kernel_info->values != (MagickRealType *) NULL)
2620  {
2622  *newImage;
2623 
2624  for (ssize_t i=0; i < (ssize_t) (order_*order_); i++)
2625  kernel_info->values[i]=kernel_[i];
2626  newImage=ConvolveImage(image(),kernel_info,exceptionInfo);
2627  replaceImage(newImage);
2628  }
2629  kernel_info=DestroyKernelInfo(kernel_info);
2631 }
2632 
2633 void Magick::Image::copyPixels(const Image &source_,const Geometry &geometry_,
2634  const Offset &offset_)
2635 {
2636  const OffsetInfo
2637  offset=offset_;
2638 
2639  const RectangleInfo
2640  geometry=geometry_;
2641 
2643  (void) CopyImagePixels(image(),source_.constImage(),&geometry,&offset,
2644  exceptionInfo);
2646 }
2647 
2648 void Magick::Image::crop(const Geometry &geometry_)
2649 {
2651  *newImage;
2652 
2653  RectangleInfo
2654  cropInfo=geometry_;
2655 
2657  newImage=CropImage(constImage(),&cropInfo,exceptionInfo);
2658  replaceImage(newImage);
2660 }
2661 
2662 void Magick::Image::cycleColormap(const ssize_t amount_)
2663 {
2664  modifyImage();
2666  CycleColormapImage(image(),amount_,exceptionInfo);
2668 }
2669 
2670 void Magick::Image::decipher(const std::string &passphrase_)
2671 {
2672  modifyImage();
2674  DecipherImage(image(),passphrase_.c_str(),exceptionInfo);
2676 }
2677 
2678 void Magick::Image::defineSet(const std::string &magick_,
2679  const std::string &key_,bool flag_)
2680 {
2681  std::string
2682  definition;
2683 
2684  modifyImage();
2685  definition=magick_ + ":" + key_;
2686  if (flag_)
2687  (void) SetImageOption(imageInfo(),definition.c_str(),"");
2688  else
2689  DeleteImageOption(imageInfo(),definition.c_str());
2690 }
2691 
2692 bool Magick::Image::defineSet(const std::string &magick_,
2693  const std::string &key_ ) const
2694 {
2695  const char
2696  *option;
2697 
2698  std::string
2699  key;
2700 
2701  key=magick_ + ":" + key_;
2702  option=GetImageOption(constImageInfo(),key.c_str());
2703  if (option)
2704  return(true);
2705  return(false);
2706 }
2707 
2708 void Magick::Image::defineValue(const std::string &magick_,
2709  const std::string &key_,const std::string &value_)
2710 {
2711  std::string
2712  format,
2713  option;
2714 
2715  modifyImage();
2716  format=magick_ + ":" + key_;
2717  option=value_;
2718  (void) SetImageOption(imageInfo(),format.c_str(),option.c_str());
2719 }
2720 
2721 std::string Magick::Image::defineValue(const std::string &magick_,
2722  const std::string &key_) const
2723 {
2724  const char
2725  *option;
2726 
2727  std::string
2728  definition;
2729 
2730  definition=magick_ + ":" + key_;
2731  option=GetImageOption(constImageInfo(),definition.c_str());
2732  if (option)
2733  return(std::string(option));
2734  return(std::string());
2735 }
2736 
2737 void Magick::Image::deskew(const double threshold_)
2738 {
2740  *newImage;
2741 
2743  newImage=DeskewImage(constImage(),threshold_,exceptionInfo);
2744  replaceImage(newImage);
2746 }
2747 
2749 {
2751  *newImage;
2752 
2754  newImage=DespeckleImage(constImage(),exceptionInfo);
2755  replaceImage(newImage);
2757 }
2758 
2760 {
2762  DisplayImages(imageInfo(),image(),exceptionInfo);
2764 }
2765 
2766 void Magick::Image::distort(const DistortMethod method_,
2767  const size_t numberArguments_,const double *arguments_,const bool bestfit_)
2768 {
2770  *newImage;
2771 
2773  newImage=DistortImage(constImage(), method_,numberArguments_,arguments_,
2774  bestfit_ == true ? MagickTrue : MagickFalse,exceptionInfo);
2775  replaceImage(newImage);
2777 }
2778 
2780 {
2781  DrawingWand
2782  *wand;
2783 
2784  modifyImage();
2785 
2786  wand=AcquireDrawingWand(options()->drawInfo(),image());
2787 
2788  if(wand)
2789  {
2790  drawable_.operator()(wand);
2791 
2792  DrawRender(wand);
2793 
2794  ClonePPDrawException(wand);
2795  wand=DestroyDrawingWand(wand);
2797  }
2798 }
2799 
2800 void Magick::Image::draw(const std::vector<Magick::Drawable> &drawable_)
2801 {
2802  DrawingWand
2803  *wand;
2804 
2805  modifyImage();
2806 
2807  wand= AcquireDrawingWand(options()->drawInfo(),image());
2808 
2809  if(wand)
2810  {
2811  for (std::vector<Magick::Drawable>::const_iterator p = drawable_.begin();
2812  p != drawable_.end(); p++ )
2813  {
2814  p->operator()(wand);
2815  if (DrawGetExceptionType(wand) != MagickCore::UndefinedException)
2816  break;
2817  }
2818 
2819  if (DrawGetExceptionType(wand) == MagickCore::UndefinedException)
2820  DrawRender(wand);
2821 
2822  ClonePPDrawException(wand);
2823  wand=DestroyDrawingWand(wand);
2825  }
2826 }
2827 
2828 void Magick::Image::edge(const double radius_)
2829 {
2831  *newImage;
2832 
2834  newImage=EdgeImage(constImage(),radius_,exceptionInfo);
2835  replaceImage(newImage);
2837 }
2838 
2839 void Magick::Image::emboss(const double radius_,const double sigma_)
2840 {
2842  *newImage;
2843 
2845  newImage=EmbossImage(constImage(),radius_,sigma_,exceptionInfo);
2846  replaceImage(newImage);
2848 }
2849 
2850 void Magick::Image::encipher(const std::string &passphrase_)
2851 {
2852  modifyImage();
2854  EncipherImage(image(),passphrase_.c_str(),exceptionInfo);
2856 }
2857 
2859 {
2861  *newImage;
2862 
2864  newImage=EnhanceImage(constImage(),exceptionInfo);
2865  replaceImage(newImage);
2867 }
2868 
2870 {
2871  modifyImage();
2873  EqualizeImage(image(),exceptionInfo);
2875 }
2876 
2878 {
2879  modifyImage();
2881  (void) SetImageBackgroundColor(image(),exceptionInfo);
2883 }
2884 
2885 void Magick::Image::evaluate(const ChannelType channel_,
2886  const MagickEvaluateOperator operator_,double rvalue_)
2887 {
2889  GetAndSetPPChannelMask(channel_);
2890  EvaluateImage(image(),operator_,rvalue_,exceptionInfo);
2893 }
2894 
2895 void Magick::Image::evaluate(const ChannelType channel_,
2896  const MagickFunction function_,const size_t number_parameters_,
2897  const double *parameters_)
2898 {
2900  GetAndSetPPChannelMask(channel_);
2901  FunctionImage(image(),function_,number_parameters_,parameters_,
2902  exceptionInfo);
2905 }
2906 
2907 void Magick::Image::evaluate(const ChannelType channel_,const ssize_t x_,
2908  const ssize_t y_,const size_t columns_,const size_t rows_,
2909  const MagickEvaluateOperator operator_,const double rvalue_)
2910 {
2911  RectangleInfo
2912  geometry;
2913 
2915  *cropImage;
2916 
2917  geometry.width = columns_;
2918  geometry.height = rows_;
2919  geometry.x = x_;
2920  geometry.y = y_;
2921 
2923  cropImage=CropImage(image(),&geometry,exceptionInfo);
2924  GetAndSetPPChannelMask(channel_);
2925  EvaluateImage(cropImage,operator_,rvalue_,exceptionInfo);
2927  (void) CompositeImage(image(),cropImage,image()->alpha_trait ==
2928  BlendPixelTrait ? OverCompositeOp : CopyCompositeOp,MagickFalse,
2929  geometry.x,geometry.y,exceptionInfo );
2930  cropImage=DestroyImageList(cropImage);
2932 }
2933 
2934 void Magick::Image::extent(const Geometry &geometry_ )
2935 {
2937  *newImage;
2938 
2939  RectangleInfo
2940  extentInfo=geometry_;
2941 
2942  modifyImage();
2943  extentInfo.x=geometry_.xOff();
2944  extentInfo.y=geometry_.yOff();
2946  newImage=ExtentImage(image(),&extentInfo,exceptionInfo);
2947  replaceImage(newImage);
2949 }
2950 
2951 void Magick::Image::extent(const Geometry &geometry_,
2952  const Color &backgroundColor_)
2953 {
2954  backgroundColor(backgroundColor_);
2955  extent(geometry_);
2956 }
2957 
2958 void Magick::Image::extent(const Geometry &geometry_,
2959  const Color &backgroundColor_,const GravityType gravity_)
2960 {
2961  backgroundColor(backgroundColor_);
2962  extent(geometry_,gravity_);
2963 }
2964 
2965 void Magick::Image::extent(const Geometry &geometry_,
2966  const GravityType gravity_)
2967 {
2968  RectangleInfo
2969  geometry;
2970 
2971  SetGeometry(image(),&geometry);
2972  geometry.width=geometry_.width();
2973  geometry.height=geometry_.height();
2974  GravityAdjustGeometry(image()->columns,image()->rows,gravity_,&geometry);
2975  extent(geometry);
2976 }
2977 
2979 {
2981  *newImage;
2982 
2984  newImage=FlipImage(constImage(),exceptionInfo);
2985  replaceImage(newImage);
2987 }
2988 
2989 void Magick::Image::floodFillAlpha(const ssize_t x_,const ssize_t y_,
2990  const unsigned int alpha_,const bool invert_)
2991 {
2992  PixelInfo
2993  target;
2994 
2995  modifyImage();
2996 
2997  target=static_cast<PixelInfo>(pixelColor(x_,y_));
2998  target.alpha=alpha_;
3000  GetAndSetPPChannelMask(AlphaChannel);
3001  FloodfillPaintImage(image(),options()->drawInfo(),&target,x_,y_,
3002  (MagickBooleanType)invert_,exceptionInfo);
3005 }
3006 
3007 void Magick::Image::floodFillAlpha(const ssize_t x_,const ssize_t y_,
3008  const unsigned int alpha_,const Color &target_,const bool invert_)
3009 {
3010  PixelInfo
3011  target;
3012 
3013  modifyImage();
3014 
3015  target=static_cast<PixelInfo>(target_);
3016  target.alpha=alpha_;
3018  GetAndSetPPChannelMask(AlphaChannel);
3019  FloodfillPaintImage(image(),options()->drawInfo(),&target,x_,y_,
3020  (MagickBooleanType)invert_,exceptionInfo);
3023 }
3024 
3026  const Magick::Color &fillColor_,const bool invert_)
3027 {
3028  floodFillColor(point_.xOff(),point_.yOff(),fillColor_,invert_);
3029 }
3030 
3031 void Magick::Image::floodFillColor(const ssize_t x_,const ssize_t y_,
3032  const Magick::Color &fillColor_,const bool invert_)
3033 {
3034  PixelInfo
3035  pixel;
3036 
3037  modifyImage();
3038 
3039  pixel=static_cast<PixelInfo>(pixelColor(x_,y_));
3040  floodFill(x_,y_,(Magick::Image *)NULL,fillColor_,&pixel,invert_);
3041 }
3042 
3044  const Magick::Color &fillColor_,const Magick::Color &borderColor_,
3045  const bool invert_)
3046 {
3047  floodFillColor(point_.xOff(),point_.yOff(),fillColor_,borderColor_,invert_);
3048 }
3049 
3050 void Magick::Image::floodFillColor(const ssize_t x_,const ssize_t y_,
3051  const Magick::Color &fillColor_,const Magick::Color &borderColor_,
3052  const bool invert_)
3053 {
3054  PixelInfo
3055  pixel;
3056 
3057  modifyImage();
3058 
3059  pixel=static_cast<PixelInfo>(borderColor_);
3060  floodFill(x_,y_,(Magick::Image *)NULL,fillColor_,&pixel,invert_);
3061 }
3062 
3064  const Magick::Image &texture_,const bool invert_)
3065 {
3066  floodFillTexture(point_.xOff(),point_.yOff(),texture_,invert_);
3067 }
3068 
3069 void Magick::Image::floodFillTexture(const ssize_t x_,const ssize_t y_,
3070  const Magick::Image &texture_,const bool invert_)
3071 {
3072  PixelInfo
3073  pixel;
3074 
3075  modifyImage();
3076 
3077  pixel=static_cast<PixelInfo>(pixelColor(x_,y_));
3078  floodFill(x_,y_,&texture_,Magick::Color(),&pixel,invert_);
3079 }
3080 
3082  const Magick::Image &texture_,const Magick::Color &borderColor_,
3083  const bool invert_)
3084 {
3085  floodFillTexture(point_.xOff(),point_.yOff(),texture_,borderColor_,invert_);
3086 }
3087 
3088 void Magick::Image::floodFillTexture(const ssize_t x_,const ssize_t y_,
3089  const Magick::Image &texture_,const Magick::Color &borderColor_,
3090  const bool invert_)
3091 {
3092  PixelInfo
3093  pixel;
3094 
3095  modifyImage();
3096 
3097  pixel=static_cast<PixelInfo>(borderColor_);
3098  floodFill(x_,y_,&texture_,Magick::Color(),&pixel,invert_);
3099 }
3100 
3102 {
3104  *newImage;
3105 
3107  newImage=FlopImage(constImage(),exceptionInfo);
3108  replaceImage(newImage);
3110 }
3111 
3112 void Magick::Image::fontTypeMetrics(const std::string &text_,
3113  TypeMetric *metrics)
3114 {
3115  DrawInfo
3116  *drawInfo;
3117 
3118  drawInfo=options()->drawInfo();
3119  drawInfo->text=const_cast<char *>(text_.c_str());
3121  GetTypeMetrics(image(),drawInfo,&(metrics->_typeMetric),exceptionInfo);
3122  drawInfo->text=0;
3124 }
3125 
3126 void Magick::Image::fontTypeMetricsMultiline(const std::string &text_,
3127  TypeMetric *metrics)
3128 {
3129  DrawInfo
3130  *drawInfo;
3131 
3132  drawInfo=options()->drawInfo();
3133  drawInfo->text=const_cast<char *>(text_.c_str());
3135  GetMultilineTypeMetrics(image(),drawInfo,&(metrics->_typeMetric),exceptionInfo);
3136  drawInfo->text=0;
3138 }
3139 
3140 void Magick::Image::frame(const Geometry &geometry_)
3141 {
3142  FrameInfo
3143  info;
3144 
3146  *newImage;
3147 
3148  info.x=static_cast<ssize_t>(geometry_.width());
3149  info.y=static_cast<ssize_t>(geometry_.height());
3150  info.width=columns() + (static_cast<size_t>(info.x) << 1);
3151  info.height=rows() + (static_cast<size_t>(info.y) << 1);
3152  info.outer_bevel=geometry_.xOff();
3153  info.inner_bevel=geometry_.yOff();
3154 
3156  newImage=FrameImage(constImage(),&info,image()->compose,exceptionInfo);
3157  replaceImage(newImage);
3159 }
3160 
3161 void Magick::Image::frame(const size_t width_,const size_t height_,
3162  const ssize_t innerBevel_,const ssize_t outerBevel_)
3163 {
3164  FrameInfo
3165  info;
3166 
3168  *newImage;
3169 
3170  info.x=static_cast<ssize_t>(width_);
3171  info.y=static_cast<ssize_t>(height_);
3172  info.width=columns() + (static_cast<size_t>(info.x) << 1);
3173  info.height=rows() + (static_cast<size_t>(info.y) << 1);
3174  info.outer_bevel=static_cast<ssize_t>(outerBevel_);
3175  info.inner_bevel=static_cast<ssize_t>(innerBevel_);
3176 
3178  newImage=FrameImage(constImage(),&info,image()->compose,exceptionInfo);
3179  replaceImage(newImage);
3181 }
3182 
3183 void Magick::Image::fx(const std::string expression_)
3184 {
3186  *newImage;
3187 
3189  newImage=FxImage(constImage(),expression_.c_str(),exceptionInfo);
3190  replaceImage(newImage);
3192 }
3193 
3194 void Magick::Image::fx(const std::string expression_,
3195  const Magick::ChannelType channel_)
3196 {
3198  *newImage;
3199 
3201  GetAndSetPPChannelMask(channel_);
3202  newImage=FxImage(constImage(),expression_.c_str(),exceptionInfo);
3204  replaceImage(newImage);
3206 }
3207 
3208 void Magick::Image::gamma(const double gamma_)
3209 {
3210  modifyImage();
3212  GammaImage(image(),gamma_,exceptionInfo);
3214 }
3215 
3216 void Magick::Image::gamma(const double gammaRed_,const double gammaGreen_,
3217  const double gammaBlue_)
3218 {
3219  modifyImage();
3221  GetAndSetPPChannelMask(RedChannel);
3222  (void) GammaImage(image(),gammaRed_,exceptionInfo);
3223  SetPPChannelMask(GreenChannel);
3224  (void) GammaImage(image(),gammaGreen_,exceptionInfo);
3225  SetPPChannelMask(BlueChannel);
3226  (void) GammaImage(image(),gammaBlue_,exceptionInfo);
3229 }
3230 
3231 void Magick::Image::gaussianBlur(const double radius_,const double sigma_)
3232 {
3234  *newImage;
3235 
3237  newImage=GaussianBlurImage(constImage(),radius_,sigma_,exceptionInfo);
3238  replaceImage(newImage);
3240 }
3241 
3242 void Magick::Image::gaussianBlurChannel(const ChannelType channel_,
3243  const double radius_,const double sigma_)
3244 {
3246  *newImage;
3247 
3249  GetAndSetPPChannelMask(channel_);
3250  newImage=GaussianBlurImage(constImage(),radius_,sigma_,exceptionInfo);
3252  replaceImage(newImage);
3254 }
3255 
3256 const Magick::Quantum *Magick::Image::getConstPixels(const ssize_t x_,
3257  const ssize_t y_,const size_t columns_,const size_t rows_) const
3258 {
3259  const Quantum
3260  *p;
3261 
3263  p=GetVirtualPixels(constImage(),x_, y_,columns_, rows_,exceptionInfo);
3265  return(p);
3266 }
3267 
3268 const void *Magick::Image::getConstMetacontent(void) const
3269 {
3270  const void
3271  *result;
3272 
3273  result=GetVirtualMetacontent(constImage());
3274 
3275  if(!result)
3276  throwExceptionExplicit(MagickCore::OptionError,
3277  "Unable to retrieve meta content.");
3278 
3279  return(result);
3280 }
3281 
3283 {
3284  void
3285  *result;
3286 
3287  result=GetAuthenticMetacontent(image());
3288 
3289  if(!result)
3290  throwExceptionExplicit(MagickCore::OptionError,
3291  "Unable to retrieve meta content.");
3292 
3293  return(result);
3294 }
3295 
3296 Magick::Quantum *Magick::Image::getPixels(const ssize_t x_,const ssize_t y_,
3297  const size_t columns_,const size_t rows_)
3298 {
3299  Quantum
3300  *result;
3301 
3302  modifyImage();
3304  result=GetAuthenticPixels(image(),x_, y_,columns_,rows_,exceptionInfo);
3306 
3307  return(result);
3308 }
3309 
3310 void Magick::Image::grayscale(const PixelIntensityMethod method_)
3311 {
3312  modifyImage();
3314  (void) GrayscaleImage(image(),method_,exceptionInfo);
3316 }
3317 
3318 void Magick::Image::haldClut(const Image &clutImage_)
3319 {
3320  modifyImage();
3322  (void) HaldClutImage(image(),clutImage_.constImage(),exceptionInfo);
3324 }
3325 
3326 void Magick::Image::houghLine(const size_t width_,const size_t height_,
3327  const size_t threshold_)
3328 {
3330  *newImage;
3331 
3333  newImage=HoughLineImage(constImage(),width_,height_,threshold_,
3334  exceptionInfo);
3335  replaceImage(newImage);
3337 }
3338 
3339 Magick::ImageType Magick::Image::identifyType(void) const
3340 {
3341  ImageType
3342  image_type;
3343 
3345  image_type=IdentifyImageType(constImage(),exceptionInfo);
3347  return(image_type);
3348 }
3349 
3350 void Magick::Image::implode(const double factor_)
3351 {
3353  *newImage;
3354 
3356  newImage=ImplodeImage(constImage(),factor_,image()->interpolate,
3357  exceptionInfo);
3358  replaceImage(newImage);
3360 }
3361 
3363 {
3364  inverseFourierTransform(phase_,true);
3365 }
3366 
3368  const bool magnitude_)
3369 {
3371  *newImage;
3372 
3374  newImage=InverseFourierTransformImage(constImage(),phase_.constImage(),
3375  magnitude_ == true ? MagickTrue : MagickFalse,exceptionInfo);
3376  replaceImage(newImage);
3378 }
3379 
3380 void Magick::Image::kuwahara(const double radius_,const double sigma_)
3381 {
3383  *newImage;
3384 
3386  newImage=KuwaharaImage(constImage(),radius_,sigma_,exceptionInfo);
3387  replaceImage(newImage);
3389 }
3390 
3391 void Magick::Image::kuwaharaChannel(const ChannelType channel_,
3392  const double radius_,const double sigma_)
3393 {
3395  *newImage;
3396 
3398  GetAndSetPPChannelMask(channel_);
3399  newImage=KuwaharaImage(constImage(),radius_,sigma_,exceptionInfo);
3400  replaceImage(newImage);
3403 }
3404 
3405 void Magick::Image::level(const double blackPoint_,const double whitePoint_,
3406  const double gamma_)
3407 {
3408  modifyImage();
3410  (void) LevelImage(image(),blackPoint_,whitePoint_,gamma_,exceptionInfo);
3412 }
3413 
3414 void Magick::Image::levelChannel(const ChannelType channel_,
3415  const double blackPoint_,const double whitePoint_,const double gamma_)
3416 {
3417  modifyImage();
3419  GetAndSetPPChannelMask(channel_);
3420  (void) LevelImage(image(),blackPoint_,whitePoint_,gamma_,exceptionInfo);
3423 }
3424 
3425 void Magick::Image::levelColors(const Color &blackColor_,
3426  const Color &whiteColor_,const bool invert_)
3427 {
3428  PixelInfo
3429  black,
3430  white;
3431 
3432  modifyImage();
3433 
3434  black=static_cast<PixelInfo>(blackColor_);
3435  white=static_cast<PixelInfo>(whiteColor_);
3437  (void) LevelImageColors(image(),&black,&white,invert_ == true ?
3438  MagickTrue : MagickFalse,exceptionInfo);
3440 }
3441 
3442 void Magick::Image::levelColorsChannel(const ChannelType channel_,
3443  const Color &blackColor_,const Color &whiteColor_,const bool invert_)
3444 {
3445  PixelInfo
3446  black,
3447  white;
3448 
3449  modifyImage();
3450 
3451  black=static_cast<PixelInfo>(blackColor_);
3452  white=static_cast<PixelInfo>(whiteColor_);
3454  GetAndSetPPChannelMask(channel_);
3455  (void) LevelImageColors(image(),&black,&white,invert_ == true ?
3456  MagickTrue : MagickFalse,exceptionInfo);
3459 }
3460 
3461 void Magick::Image::levelize(const double blackPoint_,const double whitePoint_,
3462  const double gamma_)
3463 {
3464  modifyImage();
3466  (void) LevelizeImage(image(),blackPoint_,whitePoint_,gamma_,exceptionInfo);
3468 }
3469 
3470 void Magick::Image::levelizeChannel(const ChannelType channel_,
3471  const double blackPoint_,const double whitePoint_,const double gamma_)
3472 {
3473  modifyImage();
3475  GetAndSetPPChannelMask(channel_);
3476  (void) LevelizeImage(image(),blackPoint_,whitePoint_,gamma_,exceptionInfo);
3479 }
3480 
3481 void Magick::Image::linearStretch(const double blackPoint_,
3482  const double whitePoint_)
3483 {
3484  modifyImage();
3486  LinearStretchImage(image(),blackPoint_,whitePoint_,exceptionInfo);
3488 }
3489 
3491 {
3493  *newImage;
3494 
3495  size_t
3496  height=rows(),
3497  width=columns();
3498 
3499  ssize_t
3500  x=0,
3501  y=0;
3502 
3503  ParseMetaGeometry(static_cast<std::string>(geometry_).c_str(),&x,&y,&width,
3504  &height);
3505 
3507  newImage=LiquidRescaleImage(image(),width,height,x,y,exceptionInfo);
3508  replaceImage(newImage);
3510 }
3511 
3512 void Magick::Image::localContrast(const double radius_,const double strength_)
3513 {
3515  *newImage;
3516 
3518  newImage=LocalContrastImage(constImage(),radius_,strength_,exceptionInfo);
3519  replaceImage(newImage);
3521 }
3522 
3524 {
3526  *newImage;
3527 
3529  newImage=MagnifyImage(constImage(),exceptionInfo);
3530  replaceImage(newImage);
3532 }
3533 
3534 void Magick::Image::map(const Image &mapImage_,const bool dither_)
3535 {
3536  modifyImage();
3538  options()->quantizeDither(dither_);
3539  RemapImage(options()->quantizeInfo(),image(),mapImage_.constImage(),
3540  exceptionInfo);
3542 }
3543 
3544 void Magick::Image::meanShift(const size_t width_,const size_t height_,
3545  const double color_distance_)
3546 {
3548  *newImage;
3549 
3551  newImage=MeanShiftImage(constImage(),width_,height_,color_distance_,
3552  exceptionInfo);
3553  replaceImage(newImage);
3555 }
3556 
3557 void Magick::Image::medianFilter(const double radius_)
3558 {
3560  *newImage;
3561 
3563  newImage=StatisticImage(image(),MedianStatistic,(size_t) radius_,
3564  (size_t) radius_,exceptionInfo);
3565  replaceImage(newImage);
3567 }
3568 
3570 {
3572  *newImage;
3573 
3575  newImage=MinifyImage(constImage(),exceptionInfo);
3576  replaceImage(newImage);
3578 }
3579 
3580 void Magick::Image::modulate(const double brightness_,const double saturation_,
3581  const double hue_)
3582 {
3583  char
3584  modulate[MagickPathExtent + 1];
3585 
3586  FormatLocaleString(modulate,MagickPathExtent,"%3.6f,%3.6f,%3.6f",brightness_,
3587  saturation_,hue_);
3588 
3589  modifyImage();
3591  ModulateImage(image(),modulate,exceptionInfo);
3593 }
3594 
3596 {
3597  return(ImageMoments(*this));
3598 }
3599 
3600 void Magick::Image::morphology(const MorphologyMethod method_,
3601  const std::string kernel_,const ssize_t iterations_)
3602 {
3603  KernelInfo
3604  *kernel;
3605 
3607  *newImage;
3608 
3610  kernel=AcquireKernelInfo(kernel_.c_str(),exceptionInfo);
3611  if (kernel == (KernelInfo *) NULL)
3612  throwExceptionExplicit(MagickCore::OptionError,"Unable to parse kernel.");
3613  newImage=MorphologyImage(constImage(),method_,iterations_,kernel,
3614  exceptionInfo);
3615  replaceImage(newImage);
3616  kernel=DestroyKernelInfo(kernel);
3618 }
3619 
3620 void Magick::Image::morphology(const MorphologyMethod method_,
3621  const KernelInfoType kernel_,const std::string arguments_,
3622  const ssize_t iterations_)
3623 {
3624  const char
3625  *option;
3626 
3627  std::string
3628  kernel;
3629 
3630  option=CommandOptionToMnemonic(MagickKernelOptions,kernel_);
3631  if (option == (const char *)NULL)
3632  {
3633  throwExceptionExplicit(MagickCore::OptionError,
3634  "Unable to determine kernel type.");
3635  return;
3636  }
3637  kernel=std::string(option);
3638  if (!arguments_.empty())
3639  kernel+=":"+arguments_;
3640 
3641  morphology(method_,kernel,iterations_);
3642 }
3643 
3644 void Magick::Image::morphologyChannel(const ChannelType channel_,
3645  const MorphologyMethod method_,const std::string kernel_,
3646  const ssize_t iterations_)
3647 {
3648  KernelInfo
3649  *kernel;
3650 
3652  *newImage;
3653 
3654 
3656  kernel=AcquireKernelInfo(kernel_.c_str(),exceptionInfo);
3657  if (kernel == (KernelInfo *)NULL)
3658  {
3659  throwExceptionExplicit(MagickCore::OptionError,
3660  "Unable to parse kernel.");
3661  return;
3662  }
3663  GetAndSetPPChannelMask(channel_);
3664  newImage=MorphologyImage(constImage(),method_,iterations_,kernel,
3665  exceptionInfo);
3667  replaceImage(newImage);
3668  kernel=DestroyKernelInfo(kernel);
3670 }
3671 
3672 void Magick::Image::morphologyChannel(const ChannelType channel_,
3673  const MorphologyMethod method_,const KernelInfoType kernel_,
3674  const std::string arguments_,const ssize_t iterations_)
3675 {
3676  const char
3677  *option;
3678 
3679  std::string
3680  kernel;
3681 
3682  option=CommandOptionToMnemonic(MagickKernelOptions,kernel_);
3683  if (option == (const char *)NULL)
3684  {
3685  throwExceptionExplicit(MagickCore::OptionError,
3686  "Unable to determine kernel type.");
3687  return;
3688  }
3689 
3690  kernel=std::string(option);
3691  if (!arguments_.empty())
3692  kernel+=":"+arguments_;
3693 
3694  morphologyChannel(channel_,method_,kernel,iterations_);
3695 }
3696 
3697 void Magick::Image::motionBlur(const double radius_,const double sigma_,
3698  const double angle_)
3699 {
3701  *newImage;
3702 
3704  newImage=MotionBlurImage(constImage(),radius_,sigma_,angle_,exceptionInfo);
3705  replaceImage(newImage);
3707 }
3708 
3709 void Magick::Image::negate(const bool grayscale_)
3710 {
3711  modifyImage();
3713  NegateImage(image(),(MagickBooleanType) grayscale_,exceptionInfo);
3715 }
3716 
3717 void Magick::Image::negateChannel(const ChannelType channel_,
3718  const bool grayscale_)
3719 {
3720  modifyImage();
3722  GetAndSetPPChannelMask(channel_);
3723  NegateImage(image(),(MagickBooleanType) grayscale_,exceptionInfo);
3726 }
3727 
3729 {
3730  modifyImage();
3732  NormalizeImage(image(),exceptionInfo);
3734 }
3735 
3736 void Magick::Image::oilPaint(const double radius_,const double sigma_)
3737 {
3739  *newImage;
3740 
3742  newImage=OilPaintImage(constImage(),radius_,sigma_,exceptionInfo);
3743  replaceImage(newImage);
3745 }
3746 
3747 void Magick::Image::opaque(const Color &opaqueColor_,const Color &penColor_,
3748  const bool invert_)
3749 {
3750  std::string
3751  opaqueColor,
3752  penColor;
3753 
3754  PixelInfo
3755  opaque,
3756  pen;
3757 
3758  if (!opaqueColor_.isValid())
3759  throwExceptionExplicit(MagickCore::OptionError,
3760  "Opaque color argument is invalid");
3761 
3762  if (!penColor_.isValid())
3763  throwExceptionExplicit(MagickCore::OptionError,
3764  "Pen color argument is invalid");
3765 
3766  modifyImage();
3767  opaqueColor=opaqueColor_;
3768  penColor=penColor_;
3769 
3771  (void) QueryColorCompliance(opaqueColor.c_str(),AllCompliance,&opaque,
3772  exceptionInfo);
3773  (void) QueryColorCompliance(penColor.c_str(),AllCompliance,&pen,
3774  exceptionInfo);
3775  OpaquePaintImage(image(),&opaque,&pen,invert_ ? MagickTrue : MagickFalse,
3776  exceptionInfo);
3778 }
3779 
3780 void Magick::Image::orderedDither(std::string thresholdMap_)
3781 {
3782  modifyImage();
3784  (void) OrderedDitherImage(image(),thresholdMap_.c_str(),exceptionInfo);
3786 }
3787 
3788 void Magick::Image::orderedDitherChannel(const ChannelType channel_,
3789  std::string thresholdMap_)
3790 {
3791  modifyImage();
3793  GetAndSetPPChannelMask(channel_);
3794  (void)OrderedDitherImage(image(),thresholdMap_.c_str(),exceptionInfo);
3797 }
3798 
3799 void Magick::Image::perceptible(const double epsilon_)
3800 {
3801  modifyImage();
3803  PerceptibleImage(image(),epsilon_,exceptionInfo);
3805 }
3806 
3807 void Magick::Image::perceptibleChannel(const ChannelType channel_,
3808  const double epsilon_)
3809 {
3810  modifyImage();
3812  GetAndSetPPChannelMask(channel_);
3813  PerceptibleImage(image(),epsilon_,exceptionInfo);
3816 }
3817 
3819 {
3820  return(ImagePerceptualHash(*this));
3821 }
3822 
3823 void Magick::Image::ping(const std::string &imageSpec_)
3824 {
3826  *newImage;
3827 
3829  options()->fileName(imageSpec_);
3830  newImage=PingImage(imageInfo(),exceptionInfo);
3831  read(newImage,exceptionInfo);
3832 }
3833 
3834 void Magick::Image::ping(const Blob& blob_)
3835 {
3837  *newImage;
3838 
3840  newImage=PingBlob(imageInfo(),blob_.data(),blob_.length(),exceptionInfo);
3841  read(newImage,exceptionInfo);
3842 }
3843 
3844 void Magick::Image::pixelColor(const ssize_t x_,const ssize_t y_,
3845  const Color &color_)
3846 {
3847  PixelInfo
3848  packet;
3849 
3850  Quantum
3851  *pixel;
3852 
3853  // Test arguments to ensure they are within the image.
3854  if (y_ > (ssize_t) rows() || x_ > (ssize_t) columns())
3855  throwExceptionExplicit(MagickCore::OptionError,
3856  "Access outside of image boundary");
3857 
3858  modifyImage();
3859 
3860  // Set image to DirectClass
3861  classType(DirectClass );
3862 
3863  // Get pixel view
3864  Pixels pixels(*this);
3865  // Set pixel value
3866  pixel=pixels.get(x_, y_, 1, 1 );
3867  packet=color_;
3868  MagickCore::SetPixelViaPixelInfo(constImage(),&packet,pixel);
3869  // Tell ImageMagick that pixels have been updated
3870  pixels.sync();
3871 }
3872 
3873 Magick::Color Magick::Image::pixelColor(const ssize_t x_,
3874  const ssize_t y_) const
3875 {
3876  const Quantum
3877  *pixel;
3878 
3879  pixel=getConstPixels(x_,y_,1,1);
3880  if (pixel)
3881  {
3882  PixelInfo
3883  packet;
3884 
3885  MagickCore::GetPixelInfoPixel(constImage(),pixel,&packet);
3886  return(Color(packet));
3887  }
3888 
3889  return(Color()); // invalid
3890 }
3891 
3892 void Magick::Image::polaroid(const std::string &caption_,const double angle_,
3893  const PixelInterpolateMethod method_)
3894 {
3896  *newImage;
3897 
3899  newImage=PolaroidImage(constImage(),options()->drawInfo(),caption_.c_str(),
3900  angle_,method_,exceptionInfo);
3901  replaceImage(newImage);
3903 }
3904 
3905 void Magick::Image::posterize(const size_t levels_,const DitherMethod method_)
3906 {
3907  modifyImage();
3909  PosterizeImage(image(),levels_,method_,exceptionInfo);
3911 }
3912 
3913 void Magick::Image::posterizeChannel(const ChannelType channel_,
3914  const size_t levels_,const DitherMethod method_)
3915 {
3916  modifyImage();
3918  GetAndSetPPChannelMask(channel_);
3919  PosterizeImage(image(),levels_,method_,exceptionInfo);
3922 }
3923 
3924 void Magick::Image::process(std::string name_,const ssize_t argc,
3925  const char **argv)
3926 {
3927  modifyImage();
3928 
3930  (void) InvokeDynamicImageFilter(name_.c_str(),&image(),argc,argv,
3931  exceptionInfo);
3933 }
3934 
3935 void Magick::Image::profile(const std::string name_,
3936  const Magick::Blob &profile_)
3937 {
3938  modifyImage();
3940  (void) ProfileImage(image(),name_.c_str(),(unsigned char *)profile_.data(),
3941  profile_.length(),exceptionInfo);
3943 }
3944 
3945 Magick::Blob Magick::Image::profile(const std::string name_) const
3946 {
3947  const StringInfo
3948  *profile;
3949 
3950  profile=GetImageProfile(constImage(),name_.c_str());
3951 
3952  if (profile == (StringInfo *) NULL)
3953  return(Blob());
3954  return(Blob((void*) GetStringInfoDatum(profile),GetStringInfoLength(
3955  profile)));
3956 }
3957 
3958 void Magick::Image::quantize(const bool measureError_)
3959 {
3960  modifyImage();
3961 
3962  if (measureError_)
3963  options()->quantizeInfo()->measure_error=MagickTrue;
3964  else
3965  options()->quantizeInfo()->measure_error=MagickFalse;
3966 
3968  QuantizeImage(options()->quantizeInfo(),image(),exceptionInfo);
3970 }
3971 
3972 void Magick::Image::raise(const Geometry &geometry_,const bool raisedFlag_)
3973 {
3974  RectangleInfo
3975  raiseInfo=geometry_;
3976 
3978  modifyImage();
3979  RaiseImage(image(),&raiseInfo,raisedFlag_ == true ? MagickTrue : MagickFalse,
3980  exceptionInfo);
3982 }
3983 
3984 void Magick::Image::randomThreshold(const double low_,const double high_)
3985 {
3987  (void) RandomThresholdImage(image(),low_,high_,exceptionInfo);
3989 }
3990 
3991 void Magick::Image::randomThresholdChannel(const ChannelType channel_,
3992  const double low_,const double high_)
3993 {
3994  modifyImage();
3996  GetAndSetPPChannelMask(channel_);
3997  (void) RandomThresholdImage(image(),low_,high_,exceptionInfo);
4000 }
4001 
4002 void Magick::Image::read(const Blob &blob_)
4003 {
4005  *newImage;
4006 
4008  newImage=BlobToImage(imageInfo(),static_cast<const void *>(blob_.data()),
4009  blob_.length(),exceptionInfo);
4010  read(newImage,exceptionInfo);
4011 }
4012 
4013 void Magick::Image::read(const Blob &blob_,const Geometry &size_)
4014 {
4015  size(size_);
4016  read(blob_);
4017 }
4018 
4019 void Magick::Image::read(const Blob &blob_,const Geometry &size_,
4020  const size_t depth_)
4021 {
4022  size(size_);
4023  depth(depth_);
4024  read(blob_);
4025 }
4026 
4027 void Magick::Image::read(const Blob &blob_,const Geometry &size_,
4028  const size_t depth_,const std::string &magick_)
4029 {
4030  size(size_);
4031  depth(depth_);
4032  magick(magick_);
4033  // Set explicit image format
4034  fileName(magick_ + ':');
4035  read(blob_);
4036 }
4037 
4038 void Magick::Image::read(const Blob &blob_,const Geometry &size_,
4039  const std::string &magick_)
4040 {
4041  size(size_);
4042  magick(magick_);
4043  // Set explicit image format
4044  fileName(magick_ + ':');
4045  read(blob_);
4046 }
4047 
4048 void Magick::Image::read(const Geometry &size_,const std::string &imageSpec_)
4049 {
4050  size(size_);
4051  read(imageSpec_);
4052 }
4053 
4054 void Magick::Image::read(const size_t width_,const size_t height_,
4055  const std::string &map_,const StorageType type_,const void *pixels_)
4056 {
4058  *newImage;
4059 
4061  newImage=ConstituteImage(width_,height_,map_.c_str(),type_, pixels_,
4062  exceptionInfo);
4063  replaceImage(newImage);
4065 }
4066 
4067 void Magick::Image::read(const std::string &imageSpec_)
4068 {
4070  *newImage;
4071 
4073  options()->fileName(imageSpec_);
4074  newImage=ReadImage(imageInfo(),exceptionInfo);
4075  read(newImage,exceptionInfo);
4076 }
4077 
4079 {
4080  mask(mask_,ReadPixelMask);
4081 }
4082 
4084 {
4085  return(mask(ReadPixelMask));
4086 }
4087 
4088 void Magick::Image::readPixels(const Magick::QuantumType quantum_,
4089  const unsigned char *source_)
4090 {
4091  QuantumInfo
4092  *quantum_info;
4093 
4094  quantum_info=AcquireQuantumInfo(imageInfo(),image());
4096  ImportQuantumPixels(image(),(MagickCore::CacheView *) NULL,quantum_info,
4097  quantum_,source_,exceptionInfo);
4098  quantum_info=DestroyQuantumInfo(quantum_info);
4100 }
4101 
4103 {
4104  reduceNoise(3);
4105 }
4106 
4107 void Magick::Image::reduceNoise(const size_t order_)
4108 {
4110  *newImage;
4111 
4113  newImage=StatisticImage(constImage(),NonpeakStatistic,order_,
4114  order_,exceptionInfo);
4115  replaceImage(newImage);
4117 }
4118 
4120 {
4121  modifyImage();
4122  options()->page(Geometry());
4123  image()->page.width = 0;
4124  image()->page.height = 0;
4125  image()->page.x = 0;
4126  image()->page.y = 0;
4127 }
4128 
4129 void Magick::Image::resample(const Point &density_)
4130 {
4132  *newImage;
4133 
4135  newImage=ResampleImage(constImage(),density_.x(),density_.y(),
4136  image()->filter,exceptionInfo);
4137  replaceImage(newImage);
4139 }
4140 
4141 void Magick::Image::resize(const Geometry &geometry_)
4142 {
4144  *newImage;
4145 
4146  size_t
4147  height=rows(),
4148  width=columns();
4149 
4150  ssize_t
4151  x=0,
4152  y=0;
4153 
4154  // Calculate new size. This code should be supported using binary arguments
4155  // in the ImageMagick library.
4156  ParseMetaGeometry(static_cast<std::string>(geometry_).c_str(),&x,&y,&width,
4157  &height);
4158 
4160  newImage=ResizeImage(constImage(),width,height,image()->filter,
4161  exceptionInfo);
4162  replaceImage(newImage);
4164 }
4165 
4166 void Magick::Image::roll(const Geometry &roll_)
4167 {
4169  *newImage;
4170 
4172  newImage=RollImage(constImage(),roll_.xOff(),roll_.yOff(),exceptionInfo);
4173  replaceImage(newImage);
4175 }
4176 
4177 void Magick::Image::roll(const size_t columns_,const size_t rows_)
4178 {
4180  *newImage;
4181 
4183  newImage=RollImage(constImage(),static_cast<ssize_t>(columns_),
4184  static_cast<ssize_t>(rows_),exceptionInfo);
4185  replaceImage(newImage);
4187 }
4188 
4189 void Magick::Image::rotate(const double degrees_)
4190 {
4192  *newImage;
4193 
4195  newImage=RotateImage(constImage(),degrees_,exceptionInfo);
4196  replaceImage(newImage);
4198 }
4199 
4200 void Magick::Image::rotationalBlur(const double angle_)
4201 {
4203  *newImage;
4204 
4206  newImage=RotationalBlurImage(constImage(),angle_,exceptionInfo);
4207  replaceImage(newImage);
4209 }
4210 
4211 void Magick::Image::rotationalBlurChannel(const ChannelType channel_,
4212  const double angle_)
4213 {
4215  *newImage;
4216 
4218  GetAndSetPPChannelMask(channel_);
4219  newImage=RotationalBlurImage(constImage(),angle_,exceptionInfo);
4221  replaceImage(newImage);
4223 }
4224 
4225 void Magick::Image::sample(const Geometry &geometry_)
4226 {
4228  *newImage;
4229 
4230  size_t
4231  height=rows(),
4232  width=columns();
4233 
4234  ssize_t
4235  x=0,
4236  y=0;
4237 
4238  ParseMetaGeometry(static_cast<std::string>(geometry_).c_str(),&x,&y,&width,
4239  &height);
4240 
4242  newImage=SampleImage(constImage(),width,height,exceptionInfo);
4243  replaceImage(newImage);
4245 }
4246 
4247 void Magick::Image::scale(const Geometry &geometry_)
4248 {
4250  *newImage;
4251 
4252  size_t
4253  height=rows(),
4254  width=columns();
4255 
4256  ssize_t
4257  x=0,
4258  y=0;
4259 
4260  ParseMetaGeometry(static_cast<std::string>(geometry_).c_str(),&x,&y,&width,
4261  &height);
4262 
4264  newImage=ScaleImage(constImage(),width,height,exceptionInfo);
4265  replaceImage(newImage);
4267 }
4268 
4269 void Magick::Image::segment(const double clusterThreshold_,
4270  const double smoothingThreshold_)
4271 {
4272  modifyImage();
4274  SegmentImage(image(),options()->quantizeColorSpace(),
4275  (MagickBooleanType) options()->verbose(),clusterThreshold_,
4276  smoothingThreshold_,exceptionInfo);
4277  SyncImage(image(),exceptionInfo);
4279 }
4280 
4281 void Magick::Image::selectiveBlur(const double radius_,const double sigma_,
4282  const double threshold_)
4283 {
4285  *newImage;
4286 
4288  newImage=SelectiveBlurImage(constImage(),radius_,sigma_,threshold_,
4289  exceptionInfo);
4290  replaceImage(newImage);
4292 }
4293 
4294 void Magick::Image::selectiveBlurChannel(const ChannelType channel_,
4295  const double radius_,const double sigma_,const double threshold_)
4296 {
4298  *newImage;
4299 
4301  GetAndSetPPChannelMask(channel_);
4302  newImage=SelectiveBlurImage(constImage(),radius_,sigma_,threshold_,
4303  exceptionInfo);
4305  replaceImage(newImage);
4307 }
4308 
4309 Magick::Image Magick::Image::separate(const ChannelType channel_) const
4310 {
4312  *image;
4313 
4315  image=SeparateImage(constImage(),channel_,exceptionInfo);
4317  if (image == (MagickCore::Image *) NULL)
4318  return(Magick::Image());
4319  else
4320  return(Magick::Image(image));
4321 }
4322 
4323 void Magick::Image::sepiaTone(const double threshold_)
4324 {
4326  *newImage;
4327 
4329  newImage=SepiaToneImage(constImage(),threshold_,exceptionInfo);
4330  replaceImage(newImage);
4332 }
4333 
4334 bool Magick::Image::setColorMetric(const Image &reference_)
4335 {
4336  bool
4337  status;
4338 
4339  Image
4340  ref=reference_;
4341 
4343  modifyImage();
4344  status=static_cast<bool>(SetImageColorMetric(image(),ref.constImage(),
4345  exceptionInfo));
4347  return(status);
4348 }
4349 
4350 Magick::Quantum *Magick::Image::setPixels(const ssize_t x_,const ssize_t y_,
4351  const size_t columns_,const size_t rows_)
4352 {
4353  Quantum
4354  *result;
4355 
4356  modifyImage();
4358  result=QueueAuthenticPixels(image(),x_,y_,columns_,rows_,exceptionInfo);
4360  return(result);
4361 }
4362 
4363 void Magick::Image::shade(const double azimuth_,const double elevation_,
4364  const bool colorShading_)
4365 {
4367  *newImage;
4368 
4370  newImage=ShadeImage(constImage(),colorShading_ == true ?
4371  MagickTrue : MagickFalse,azimuth_,elevation_,exceptionInfo);
4372  replaceImage(newImage);
4374 }
4375 
4376 void Magick::Image::shadow(const double percent_opacity_,const double sigma_,
4377  const ssize_t x_,const ssize_t y_)
4378 {
4380  *newImage;
4381 
4383  newImage=ShadowImage(constImage(),percent_opacity_, sigma_,x_, y_,
4384  exceptionInfo);
4385  replaceImage(newImage);
4387 }
4388 
4389 void Magick::Image::sharpen(const double radius_,const double sigma_)
4390 {
4392  *newImage;
4393 
4395  newImage=SharpenImage(constImage(),radius_,sigma_,exceptionInfo);
4396  replaceImage(newImage);
4398 }
4399 
4400 void Magick::Image::sharpenChannel(const ChannelType channel_,
4401  const double radius_,const double sigma_)
4402 {
4404  *newImage;
4405 
4407  GetAndSetPPChannelMask(channel_);
4408  newImage=SharpenImage(constImage(),radius_,sigma_,exceptionInfo);
4410  replaceImage(newImage);
4412 }
4413 
4414 void Magick::Image::shave(const Geometry &geometry_)
4415 {
4417  *newImage;
4418 
4419  RectangleInfo
4420  shaveInfo=geometry_;
4421 
4423  newImage=ShaveImage(constImage(),&shaveInfo,exceptionInfo);
4424  replaceImage(newImage);
4426 }
4427 
4428 void Magick::Image::shear(const double xShearAngle_,const double yShearAngle_)
4429 {
4431  *newImage;
4432 
4434  newImage=ShearImage(constImage(),xShearAngle_,yShearAngle_,exceptionInfo);
4435  replaceImage(newImage);
4437 }
4438 
4439 void Magick::Image::sigmoidalContrast(const bool sharpen_,
4440  const double contrast,const double midpoint)
4441 {
4442  modifyImage();
4444  (void) SigmoidalContrastImage(image(),(MagickBooleanType) sharpen_,contrast,
4445  midpoint,exceptionInfo);
4447 }
4448 
4449 std::string Magick::Image::signature(const bool force_) const
4450 {
4451  return(_imgRef->signature(force_));
4452 }
4453 
4454 void Magick::Image::sketch(const double radius_,const double sigma_,
4455  const double angle_)
4456 {
4458  *newImage;
4459 
4461  newImage=SketchImage(constImage(),radius_,sigma_,angle_,exceptionInfo);
4462  replaceImage(newImage);
4464 }
4465 
4466 void Magick::Image::solarize(const double factor_)
4467 {
4468  modifyImage();
4470  SolarizeImage(image(),factor_,exceptionInfo);
4472 }
4473 
4474 void Magick::Image::sparseColor(const ChannelType channel_,
4475  const SparseColorMethod method_,const size_t numberArguments_,
4476  const double *arguments_)
4477 {
4479  *newImage;
4480 
4482  GetAndSetPPChannelMask(channel_);
4483  newImage=SparseColorImage(constImage(),method_,numberArguments_,arguments_,
4484  exceptionInfo);
4486  replaceImage(newImage);
4488 }
4489 
4490 void Magick::Image::splice(const Geometry &geometry_)
4491 {
4493  *newImage;
4494 
4495  RectangleInfo
4496  spliceInfo=geometry_;
4497 
4499  newImage=SpliceImage(constImage(),&spliceInfo,exceptionInfo);
4500  replaceImage(newImage);
4502 }
4503 
4504 void Magick::Image::splice(const Geometry &geometry_,
4505  const Color &backgroundColor_)
4506 {
4507  backgroundColor(backgroundColor_);
4508  splice(geometry_);
4509 }
4510 
4511 void Magick::Image::splice(const Geometry &geometry_,
4512  const Color &backgroundColor_,const GravityType gravity_)
4513 {
4514  backgroundColor(backgroundColor_);
4515  image()->gravity=gravity_;
4516  splice(geometry_);
4517 }
4518 
4519 void Magick::Image::spread(const double amount_)
4520 {
4522  *newImage;
4523 
4525  newImage=SpreadImage(constImage(),image()->interpolate,amount_,exceptionInfo);
4526  replaceImage(newImage);
4528 }
4529 
4531 {
4532  return(ImageStatistics(*this));
4533 }
4534 
4535 void Magick::Image::stegano(const Image &watermark_)
4536 {
4538  *newImage;
4539 
4541  newImage=SteganoImage(constImage(),watermark_.constImage(),exceptionInfo);
4542  replaceImage(newImage);
4544 }
4545 
4546 void Magick::Image::stereo(const Image &rightImage_)
4547 {
4549  *newImage;
4550 
4552  newImage=StereoImage(constImage(),rightImage_.constImage(),exceptionInfo);
4553  replaceImage(newImage);
4555 }
4556 
4558 {
4559  modifyImage();
4561  StripImage(image(),exceptionInfo);
4563 }
4564 
4566  const MetricType metric_,Geometry *offset_,double *similarityMetric_,
4567  const double similarityThreshold)
4568 {
4570  *newImage;
4571 
4572  RectangleInfo
4573  offset;
4574 
4576  newImage=SimilarityImage(image(),reference_.constImage(),metric_,
4577  similarityThreshold,&offset,similarityMetric_,exceptionInfo);
4579  if (offset_ != (Geometry *) NULL)
4580  *offset_=offset;
4581  if (newImage == (MagickCore::Image *) NULL)
4582  return(Magick::Image());
4583  else
4584  return(Magick::Image(newImage));
4585 }
4586 
4587 void Magick::Image::swirl(const double degrees_)
4588 {
4590  *newImage;
4591 
4593  newImage=SwirlImage(constImage(),degrees_,image()->interpolate,
4594  exceptionInfo);
4595  replaceImage(newImage);
4597 }
4598 
4600 {
4602  (void) SyncAuthenticPixels(image(),exceptionInfo);
4604 }
4605 
4606 void Magick::Image::texture(const Image &texture_)
4607 {
4608  modifyImage();
4610  TextureImage(image(),texture_.constImage(),exceptionInfo);
4612 }
4613 
4614 void Magick::Image::threshold(const double threshold_)
4615 {
4616  modifyImage();
4618  BilevelImage(image(),threshold_,exceptionInfo);
4620 }
4621 
4622 void Magick::Image::thumbnail(const Geometry &geometry_)
4623 {
4625  *newImage;
4626 
4627  size_t
4628  height=rows(),
4629  width=columns();
4630 
4631  ssize_t
4632  x=0,
4633  y=0;
4634 
4635  ParseMetaGeometry(static_cast<std::string>(geometry_).c_str(),&x,&y,&width,
4636  &height);
4637 
4639  newImage=ThumbnailImage(constImage(),width,height,exceptionInfo);
4640  replaceImage(newImage);
4642 }
4643 
4644 void Magick::Image::tint(const std::string opacity_)
4645 {
4647  *newImage;
4648 
4649  PixelInfo
4650  color;
4651 
4653  color=static_cast<PixelInfo>(constOptions()->fillColor());
4654  newImage=TintImage(constImage(),opacity_.c_str(),&color,exceptionInfo);
4655  replaceImage(newImage);
4657 }
4658 
4659 void Magick::Image::transformOrigin(const double x_,const double y_)
4660 {
4661  modifyImage();
4662  options()->transformOrigin(x_,y_);
4663 }
4664 
4666 {
4667  modifyImage();
4668  options()->transformReset();
4669 }
4670 
4671 void Magick::Image::transformScale(const double sx_,const double sy_)
4672 {
4673  modifyImage();
4674  options()->transformScale(sx_,sy_);
4675 }
4676 
4677 void Magick::Image::transparent(const Color &color_,const bool inverse_)
4678 {
4679  PixelInfo
4680  target;
4681 
4682  std::string
4683  color;
4684 
4685  if (!color_.isValid())
4686  throwExceptionExplicit(MagickCore::OptionError,
4687  "Color argument is invalid");
4688 
4689  color=color_;
4691  (void) QueryColorCompliance(color.c_str(),AllCompliance,&target,
4692  exceptionInfo);
4693  modifyImage();
4694  TransparentPaintImage(image(),&target,TransparentAlpha,
4695  inverse_ == true ? MagickTrue : MagickFalse,exceptionInfo);
4697 }
4698 
4700  const Color &colorHigh_)
4701 {
4702  std::string
4703  colorHigh,
4704  colorLow;
4705 
4706  PixelInfo
4707  targetHigh,
4708  targetLow;
4709 
4710  if (!colorLow_.isValid() || !colorHigh_.isValid())
4711  throwExceptionExplicit(MagickCore::OptionError,
4712  "Color argument is invalid");
4713 
4714  colorLow=colorLow_;
4715  colorHigh=colorHigh_;
4716 
4718  (void) QueryColorCompliance(colorLow.c_str(),AllCompliance,&targetLow,
4719  exceptionInfo);
4720  (void) QueryColorCompliance(colorHigh.c_str(),AllCompliance,&targetHigh,
4721  exceptionInfo);
4722  modifyImage();
4723  TransparentPaintImageChroma(image(),&targetLow,&targetHigh,TransparentAlpha,
4724  MagickFalse,exceptionInfo);
4726 }
4727 
4729 {
4731  *newImage;
4732 
4734  newImage=TransposeImage(constImage(),exceptionInfo);
4735  replaceImage(newImage);
4737 }
4738 
4740 {
4742  *newImage;
4743 
4745  newImage=TransverseImage(constImage(),exceptionInfo);
4746  replaceImage(newImage);
4748 }
4749 
4751 {
4753  *newImage;
4754 
4756  newImage=TrimImage(constImage(),exceptionInfo);
4757  replaceImage(newImage);
4759 }
4760 
4762 {
4764  *image;
4765 
4767  image=UniqueImageColors(constImage(),exceptionInfo);
4769  if (image == (MagickCore::Image *) NULL)
4770  return(Magick::Image());
4771  else
4772  return(Magick::Image(image));
4773 }
4774 
4775 void Magick::Image::unsharpmask(const double radius_,const double sigma_,
4776  const double amount_,const double threshold_)
4777 {
4779  *newImage;
4780 
4782  newImage=UnsharpMaskImage(constImage(),radius_,sigma_,amount_,threshold_,
4783  exceptionInfo);
4784  replaceImage(newImage);
4786 }
4787 
4788 void Magick::Image::unsharpmaskChannel(const ChannelType channel_,
4789  const double radius_,const double sigma_,const double amount_,
4790  const double threshold_)
4791 {
4793  *newImage;
4794 
4796  GetAndSetPPChannelMask(channel_);
4797  newImage=UnsharpMaskImage(constImage(),radius_,sigma_,amount_,threshold_,
4798  exceptionInfo);
4800  replaceImage(newImage);
4802 }
4803 
4804 void Magick::Image::vignette(const double radius_,const double sigma_,
4805  const ssize_t x_,const ssize_t y_)
4806 {
4808  *newImage;
4809 
4811  newImage=VignetteImage(constImage(),radius_,sigma_,x_,y_,exceptionInfo);
4812  replaceImage(newImage);
4814 }
4815 
4816 void Magick::Image::wave(const double amplitude_,const double wavelength_)
4817 {
4819  *newImage;
4820 
4822  newImage=WaveImage(constImage(),amplitude_,wavelength_,image()->interpolate,
4823  exceptionInfo);
4824  replaceImage(newImage);
4826 }
4827 
4828 void Magick::Image::waveletDenoise(const double threshold_,
4829  const double softness_)
4830 {
4832  *newImage;
4833 
4835  newImage=WaveletDenoiseImage(constImage(),threshold_,softness_,
4836  exceptionInfo);
4837  replaceImage(newImage);
4839 }
4840 
4841 void Magick::Image::whiteThreshold(const std::string &threshold_)
4842 {
4843  modifyImage();
4845  WhiteThresholdImage(image(),threshold_.c_str(),exceptionInfo);
4847 }
4848 
4849 void Magick::Image::whiteThresholdChannel(const ChannelType channel_,
4850  const std::string &threshold_)
4851 {
4852  modifyImage();
4854  GetAndSetPPChannelMask(channel_);
4855  WhiteThresholdImage(image(),threshold_.c_str(),exceptionInfo);
4858 }
4859 
4861 {
4862  size_t
4863  length=0;
4864 
4865  void
4866  *data;
4867 
4868  modifyImage();
4870  data=ImagesToBlob(constImageInfo(),image(),&length,exceptionInfo);
4871  if (length > 0)
4872  blob_->updateNoCopy(data,length,Blob::MallocAllocator);
4874 }
4875 
4876 void Magick::Image::write(Blob *blob_,const std::string &magick_)
4877 {
4878  size_t
4879  length=0;
4880 
4881  void
4882  *data;
4883 
4884  modifyImage();
4885  magick(magick_);
4887  data=ImagesToBlob(constImageInfo(),image(),&length,exceptionInfo);
4888  if (length > 0)
4889  blob_->updateNoCopy(data,length,Blob::MallocAllocator);
4891 }
4892 
4893 void Magick::Image::write(Blob *blob_,const std::string &magick_,
4894  const size_t depth_)
4895 {
4896  size_t
4897  length=0;
4898 
4899  void
4900  *data;
4901 
4902  modifyImage();
4903  magick(magick_);
4904  depth(depth_);
4906  data=ImagesToBlob(constImageInfo(),image(),&length,exceptionInfo);
4907  if (length > 0)
4908  blob_->updateNoCopy(data,length,Blob::MallocAllocator);
4910 }
4911 
4912 void Magick::Image::write(const ssize_t x_,const ssize_t y_,
4913  const size_t columns_,const size_t rows_,const std::string &map_,
4914  const StorageType type_,void *pixels_)
4915 {
4917  ExportImagePixels(image(),x_,y_,columns_,rows_,map_.c_str(),type_,pixels_,
4918  exceptionInfo);
4920 }
4921 
4922 void Magick::Image::write(const std::string &imageSpec_)
4923 {
4924  modifyImage();
4925  fileName(imageSpec_);
4927  WriteImage(constImageInfo(),image(),exceptionInfo);
4929 }
4930 
4932 {
4933  mask(mask_,WritePixelMask);
4934 }
4935 
4937 {
4938  return(mask(WritePixelMask));
4939 }
4940 
4941 void Magick::Image::writePixels(const Magick::QuantumType quantum_,
4942  unsigned char *destination_)
4943 {
4944  QuantumInfo
4945  *quantum_info;
4946 
4947  quantum_info=AcquireQuantumInfo(imageInfo(),image());
4949  ExportQuantumPixels(image(),(MagickCore::CacheView *) NULL,quantum_info,
4950  quantum_,destination_, exceptionInfo);
4951  quantum_info=DestroyQuantumInfo(quantum_info);
4953 }
4954 
4955 void Magick::Image::zoom(const Geometry &geometry_)
4956 {
4958  *newImage;
4959 
4960  size_t
4961  height=rows(),
4962  width=columns();
4963 
4964  ssize_t
4965  x=0,
4966  y=0;
4967 
4968  ParseMetaGeometry(static_cast<std::string>(geometry_).c_str(),&x,&y,&width,
4969  &height);
4970 
4972  newImage=ResizeImage(constImage(),width,height,image()->filter,exceptionInfo);
4973  replaceImage(newImage);
4975 }
4976 
4978  : _imgRef(new ImageRef(image_))
4979 {
4980 }
4981 
4983 {
4984  return(_imgRef->image());
4985 }
4986 
4988 {
4989  return(_imgRef->image());
4990 }
4991 
4992 MagickCore::ImageInfo *Magick::Image::imageInfo(void)
4993 {
4994  return(_imgRef->options()->imageInfo());
4995 }
4996 
4997 const MagickCore::ImageInfo *Magick::Image::constImageInfo(void) const
4998 {
4999  return(_imgRef->options()->imageInfo());
5000 }
5001 
5003 {
5004  return(_imgRef->options());
5005 }
5006 
5008 {
5009  return(_imgRef->options());
5010 }
5011 
5012 MagickCore::QuantizeInfo *Magick::Image::quantizeInfo(void)
5013 {
5014  return(_imgRef->options()->quantizeInfo());
5015 }
5016 
5017 const MagickCore::QuantizeInfo *Magick::Image::constQuantizeInfo(void) const
5018 {
5019  return(_imgRef->options()->quantizeInfo());
5020 }
5021 
5023 {
5024  if (!_imgRef->isShared())
5025  return;
5026 
5028  replaceImage(CloneImage(image(),0,0,MagickTrue,exceptionInfo));
5030 }
5031 
5033 {
5035  *image;
5036 
5037  if (replacement_)
5038  image=replacement_;
5039  else
5040  {
5042  image=AcquireImage(constImageInfo(),exceptionInfo);
5044  }
5045 
5046  _imgRef=ImageRef::replaceImage(_imgRef,image);
5047  return(image);
5048 }
5049 
5051  MagickCore::ExceptionInfo *exceptionInfo)
5052 {
5053  // Ensure that multiple image frames were not read.
5054  if (image != (MagickCore::Image *) NULL &&
5055  image->next != (MagickCore::Image *) NULL)
5056  {
5058  *next;
5059 
5060  // Destroy any extra image frames
5061  next=image->next;
5062  image->next=(MagickCore::Image *) NULL;
5063  next->previous=(MagickCore::Image *) NULL;
5064  DestroyImageList(next);
5065  }
5067  if (exceptionInfo->severity == MagickCore::UndefinedException &&
5068  image == (MagickCore::Image *) NULL)
5069  {
5070  (void) MagickCore::DestroyExceptionInfo(exceptionInfo);
5071  if (!quiet())
5072  throwExceptionExplicit(MagickCore::ImageWarning,
5073  "No image was loaded.");
5074  return;
5075  }
5077 }
5078 
5079 void Magick::Image::floodFill(const ssize_t x_,const ssize_t y_,
5080  const Magick::Image *fillPattern_,const Magick::Color &fill_,
5081  const MagickCore::PixelInfo *target_,const bool invert_)
5082 {
5084  fillColor;
5085 
5087  *fillPattern;
5088 
5089  // Set drawing fill pattern or fill color
5090  fillColor=options()->fillColor();
5091  fillPattern=(MagickCore::Image *)NULL;
5092  if (options()->fillPattern() != (MagickCore::Image *)NULL)
5093  {
5095  fillPattern=CloneImage(options()->fillPattern(),0,0,MagickTrue,
5096  exceptionInfo);
5098  }
5099 
5100  if (fillPattern_ == (Magick::Image *)NULL)
5101  {
5103  options()->fillColor(fill_);
5104  }
5105  else
5106  options()->fillPattern(fillPattern_->constImage());
5107 
5109  (void) FloodfillPaintImage(image(),options()->drawInfo(),
5110  target_,static_cast<ssize_t>(x_),static_cast<ssize_t>(y_),
5111  (MagickBooleanType) invert_,exceptionInfo);
5112 
5113  options()->fillColor(fillColor);
5114  options()->fillPattern(fillPattern);
5116 }
5117 
5118 void Magick::Image::mask(const Magick::Image &mask_,const PixelMask type)
5119 {
5120  modifyImage();
5121 
5123  if (mask_.isValid())
5124  SetImageMask(image(),type,mask_.constImage(),exceptionInfo);
5125  else
5126  SetImageMask(image(),type,(MagickCore::Image *) NULL,
5127  exceptionInfo);
5129 }
5130 
5131 Magick::Image Magick::Image::mask(const PixelMask type) const
5132 {
5134  *image;
5135 
5137  image = GetImageMask(constImage(),type,exceptionInfo);
5139 
5140  if (image == (MagickCore::Image *) NULL)
5141  return(Magick::Image());
5142  else
5143  return(Magick::Image(image));
5144 }
void localContrast(const double radius_, const double strength_)
Definition: Image.cpp:3512
Point density(void) const
Definition: Image.cpp:672
void gaussianBlur(const double radius_, const double sigma_)
Definition: Image.cpp:3231
void swirl(const double degrees_)
Definition: Image.cpp:4587
class MagickPPExport Color
Definition: Color.h:16
MagickPPExport const char * borderGeometryDefault
Definition: Image.cpp:32
void morphology(const MorphologyMethod method_, const std::string kernel_, const ssize_t iterations_=1)
Definition: Image.cpp:3600
void fillRule(const FillRule &fillRule_)
Definition: Options.cpp:271
void decipher(const std::string &passphrase_)
Definition: Image.cpp:2670
void clip(void)
Definition: Image.cpp:2302
size_t scene(void) const
Definition: Image.cpp:1355
MagickPPExport int operator!=(const Magick::Color &left_, const Magick::Color &right_)
Definition: Color.cpp:29
ImageMoments moments(void) const
Definition: Image.cpp:3595
void textUnderColor(const Color &underColor_)
Definition: Options.cpp:776
void page(const Geometry &pageSize_)
Definition: Options.cpp:421
void splice(const Geometry &geometry_)
Definition: Image.cpp:4490
void width(size_t width_)
Definition: Geometry.cpp:397
#define RestorePPChannelMask
Definition: Include.h:1526
size_t animationDelay(void) const
Definition: Image.cpp:359
void resize(const Geometry &geometry_)
Definition: Image.cpp:4141
bool adjoin(void) const
Definition: Image.cpp:300
Image writeMask(void) const
Definition: Image.cpp:4936
void backgroundColor(const Color &color_)
Definition: Options.cpp:86
void brightnessContrastChannel(const ChannelType channel_, const double brightness_=0.0, const double contrast_=0.0)
Definition: Image.cpp:2137
RenderingIntent renderingIntent(void) const
Definition: Image.cpp:1326
StyleType fontStyle(void) const
Definition: Image.cpp:883
void ty(const double ty_)
Definition: Drawable.h:287
virtual ~Image()
Definition: Image.cpp:266
void modulate(const double brightness_, const double saturation_, const double hue_)
Definition: Image.cpp:3580
size_t strokeMiterLimit(void) const
Definition: Image.cpp:1450
MagickCore::QuantizeInfo * quantizeInfo(void)
Definition: Options.cpp:968
void annotate(const std::string &text_, const Geometry &location_)
Definition: Image.cpp:1839
void transformSkewX(const double skewx_)
Definition: Image.cpp:1631
void depth(const size_t depth_)
Definition: Options.cpp:194
VirtualPixelMethod virtualPixelMethod(void) const
Definition: Image.cpp:1679
void fillPattern(const MagickCore::Image *fillPattern_)
Definition: Options.cpp:251
Magick::ImageStatistics statistics() const
Definition: Image.cpp:4530
bool setColorMetric(const Image &reference_)
Definition: Image.cpp:4334
void subImage(const size_t subImage_)
Definition: Options.cpp:674
void chromaGreenPrimary(const double x_, const double y_, const double z_)
Definition: Image.cpp:2236
void fx(const std::string expression_)
Definition: Image.cpp:3183
#define ThrowImageException
Definition: Image.cpp:30
Color matteColor(void) const
Definition: Image.cpp:348
OrientationType orientation(void) const
Definition: Image.cpp:1222
double meanErrorPerPixel(void) const
Definition: Image.cpp:1158
void process(std::string name_, const ::ssize_t argc_, const char **argv_)
Definition: Image.cpp:3924
Blob exifProfile(void) const
Definition: Image.cpp:746
void adaptiveThreshold(const size_t width_, const size_t height_, const double bias_=0.0)
Definition: Image.cpp:1763
void writePixels(const QuantumType quantum_, unsigned char *destination_)
Definition: Image.cpp:4941
void charcoal(const double radius_=0.0, const double sigma_=1.0)
Definition: Image.cpp:2181
EndianType endian(void) const
Definition: Image.cpp:723
const Quantum * getConstPixels(const ::ssize_t x_, const ::ssize_t y_, const size_t columns_, const size_t rows_) const
Definition: Image.cpp:3256
void blur(const double radius_=0.0, const double sigma_=1.0)
Definition: Image.cpp:2088
Color borderColor(void) const
Definition: Image.cpp:440
std::string label(void) const
Definition: Image.cpp:1099
void contrast(const bool sharpen_)
Definition: Image.cpp:2578
void quantizeColorSpace(const ColorspaceType colorSpace_)
Definition: Options.cpp:457
void profile(const std::string name_, const Blob &colorProfile_)
Definition: Image.cpp:3935
Blob iccColorProfile(void) const
Definition: Image.cpp:993
Quantum * get(const ::ssize_t x_, const ::ssize_t y_, const size_t columns_, const size_t rows_)
Definition: Pixels.cpp:37
const MagickCore::Image * constImage(void) const
Definition: Image.cpp:4987
void medianFilter(const double radius_=0.0)
Definition: Image.cpp:3557
void enhance(void)
Definition: Image.cpp:2858
size_t subRange(void) const
Definition: Image.cpp:1521
void height(size_t height_)
Definition: Geometry.cpp:357
void chop(const Geometry &geometry_)
Definition: Image.cpp:2206
MagickPPExport const char * raiseGeometryDefault
Definition: Image.cpp:34
void composite(const Image &compositeImage_, const Geometry &offset_, const CompositeOperator compose_=InCompositeOp)
Definition: Image.cpp:2516
void liquidRescale(const Geometry &geometry_)
Definition: Image.cpp:3490
void unsharpmask(const double radius_, const double sigma_, const double amount_, const double threshold_)
Definition: Image.cpp:4775
Color textUnderColor(void) const
Definition: Image.cpp:1609
#define DegreesToRadians(x)
Definition: Image.cpp:29
void readPixels(const QuantumType quantum_, const unsigned char *source_)
Definition: Image.cpp:4088
void negate(const bool grayscale_=false)
Definition: Image.cpp:3709
void connectedComponents(const size_t connectivity_)
Definition: Image.cpp:2566
void raise(const Geometry &geometry_=raiseGeometryDefault, const bool raisedFlag_=false)
Definition: Image.cpp:3972
void sparseColor(const ChannelType channel_, const SparseColorMethod method_, const size_t numberArguments_, const double *arguments_)
Definition: Image.cpp:4474
void clutChannel(const ChannelType channel_, const Image &clutImage_, const PixelInterpolateMethod method)
Definition: Image.cpp:2328
void whiteThreshold(const std::string &threshold_)
Definition: Image.cpp:4841
std::string directory(void) const
Definition: Image.cpp:704
void textInterwordSpacing(const double spacing_)
Definition: Options.cpp:754
void crop(const Geometry &geometry_)
Definition: Image.cpp:2648
void strokeColor(const Color &strokeColor_)
Definition: Options.cpp:563
void adaptiveResize(const Geometry &geometry_)
Definition: Image.cpp:1716
ImageType type(void) const
Definition: Image.cpp:1643
bool alpha(void) const
Definition: Image.cpp:322
std::string backgroundTexture(void) const
Definition: Image.cpp:398
std::string font(void) const
Definition: Image.cpp:850
bool isValid() const
Definition: Geometry.cpp:696
void tx(const double tx_)
Definition: Drawable.h:278
void clipPath(const std::string pathname_, const bool inside_)
Definition: Image.cpp:2310
void fontPointsize(const double pointSize_)
Definition: Options.cpp:325
void posterizeChannel(const ChannelType channel_, const size_t levels_, const DitherMethod method_)
Definition: Image.cpp:3913
size_t quality(void) const
Definition: Image.cpp:1247
void defineValue(const std::string &magick_, const std::string &key_, const std::string &value_)
Definition: Image.cpp:2708
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:4804
std::string comment(void) const
Definition: Image.cpp:604
Image separate(const ChannelType channel_) const
Definition: Image.cpp:4309
void verbose(const bool verboseFlag_)
Definition: Options.cpp:931
bool textAntiAlias(void) const
Definition: Image.cpp:1532
std::string magick(void) const
Definition: Image.cpp:1141
void shade(const double azimuth_=30, const double elevation_=30, const bool colorShading_=false)
Definition: Image.cpp:4363
STL namespace.
void transformReset(void)
Definition: Options.cpp:811
size_t modulusDepth(void) const
Definition: Image.cpp:1172
void waveletDenoise(const double threshold_, const double softness_)
Definition: Image.cpp:4828
Image & operator=(const Image &image_)
Definition: Image.cpp:280
void transformRotation(const double angle_)
Definition: Options.cpp:821
void write(Blob *blob_)
Definition: Image.cpp:4860
void meanShift(const size_t width_, const size_t height_, const double color_distance_)
Definition: Image.cpp:3544
void strokeAntiAlias(const bool flag_)
Definition: Options.cpp:552
void kuwaharaChannel(const ChannelType channel_, const double radius_=0.0, const double sigma_=1.0)
Definition: Image.cpp:3391
MagickSizeType fileSize(void) const
Definition: Image.cpp:773
void equalize(void)
Definition: Image.cpp:2869
void zoom(const Geometry &geometry_)
Definition: Image.cpp:4955
void autoThreshold(const AutoThresholdMethod method_)
Definition: Image.cpp:2050
void blurChannel(const ChannelType channel_, const double radius_=0.0, const double sigma_=1.0)
Definition: Image.cpp:2099
void morphologyChannel(const ChannelType channel_, const MorphologyMethod method_, const std::string kernel_, const ssize_t iterations_=1)
Definition: Image.cpp:3644
void highlightColor(const Color color_)
Definition: Image.cpp:979
std::string fileName(void) const
Definition: Image.cpp:768
ColorspaceType colorSpace(void) const
Definition: Image.cpp:570
const Options * constOptions(void) const
Definition: Image.cpp:5007
MagickPPExport int operator<(const Magick::Color &left_, const Magick::Color &right_)
Definition: Color.cpp:41
size_t quantizeColors(void) const
Definition: Image.cpp:1258
void yOff(::ssize_t yOff_)
Definition: Geometry.cpp:428
void quiet(const bool quiet_)
Definition: Options.cpp:499
Image uniqueColors(void) const
Definition: Image.cpp:4761
Image readMask(void) const
Definition: Image.cpp:4083
const MagickCore::ImageInfo * constImageInfo(void) const
Definition: Image.cpp:4997
void fontFamily(const std::string &family_)
Definition: Options.cpp:303
void posterize(const size_t levels_, const DitherMethod method_)
Definition: Image.cpp:3905
void colorspaceType(const ColorspaceType colorspace_)
Definition: Options.cpp:133
void rotationalBlurChannel(const ChannelType channel_, const double angle_)
Definition: Image.cpp:4211
void strokePattern(const MagickCore::Image *strokePattern_)
Definition: Options.cpp:644
void adaptiveSharpen(const double radius_=0.0, const double sigma_=1.0)
Definition: Image.cpp:1738
std::string fontFamily(void) const
Definition: Image.cpp:861
void oilPaint(const double radius_=0.0, const double sigma=1.0)
Definition: Image.cpp:3736
void contrastStretchChannel(const ChannelType channel_, const double blackPoint_, const double whitePoint_)
Definition: Image.cpp:2595
MagickCore::Image * replaceImage(MagickCore::Image *replacement_)
Definition: Image.cpp:5032
void floodFillTexture(const Geometry &point_, const Image &texture_, const bool invert_=false)
Definition: Image.cpp:3063
void transformScale(const double sx_, const double sy_)
Definition: Image.cpp:4671
FillRule fillRule(void) const
Definition: Image.cpp:795
void encipher(const std::string &passphrase_)
Definition: Image.cpp:2850
void textDirection(const DirectionType direction_)
Definition: Options.cpp:705
void spread(const double amount_=3.0)
Definition: Image.cpp:4519
CompressionType compressType(void) const
Definition: Image.cpp:636
bool verbose(void) const
Definition: Image.cpp:1665
void quantizeDitherMethod(const DitherMethod ditherMethod_)
Definition: Options.cpp:479
double compareChannel(const ChannelType channel_, const Image &reference_, const MetricType metric_)
Definition: Image.cpp:2467
void linearStretch(const double blackPoint_, const double whitePoint_)
Definition: Image.cpp:3481
void randomThresholdChannel(const ChannelType channel_, const double low_, const double high_)
Definition: Image.cpp:3991
size_t quantizeTreeDepth(void) const
Definition: Image.cpp:1303
void extent(const Geometry &geometry_)
Definition: Image.cpp:2934
void colorMatrix(const size_t order_, const double *color_matrix_)
Definition: Image.cpp:2411
void pixelColor(const ::ssize_t x_, const ::ssize_t y_, const Color &color_)
std::string baseFilename(void) const
Definition: Image.cpp:408
void strokeMiterLimit(const size_t miterLimit_)
Definition: Options.cpp:634
Image strokePattern(void) const
Definition: Image.cpp:1464
void fontTypeMetricsMultiline(const std::string &text_, TypeMetric *metrics)
Definition: Image.cpp:3126
Geometry page(void) const
Definition: Image.cpp:1234
void motionBlur(const double radius_, const double sigma_, const double angle_)
Definition: Image.cpp:3697
bool debug(void) const
Definition: Image.cpp:647
void perceptibleChannel(const ChannelType channel_, const double epsilon_)
Definition: Image.cpp:3807
void emboss(const double radius_=0.0, const double sigma_=1.0)
Definition: Image.cpp:2839
void magnify(void)
Definition: Image.cpp:3523
ImageType identifyType(void) const
Definition: Image.cpp:3339
void polaroid(const std::string &caption_, const double angle_, const PixelInterpolateMethod method_)
Definition: Image.cpp:3892
void levelColors(const Color &blackColor_, const Color &whiteColor_, const bool invert_=true)
Definition: Image.cpp:3425
void segment(const double clusterThreshold_=1.0, const double smoothingThreshold_=1.5)
Definition: Image.cpp:4269
size_t decrease()
Definition: ImageRef.cpp:48
void grayscale(const PixelIntensityMethod method_)
Definition: Image.cpp:3310
void reduceNoise(void)
Definition: Image.cpp:4102
void clampChannel(const ChannelType channel_)
Definition: Image.cpp:2292
double strokeDashOffset(void) const
Definition: Image.cpp:1417
void channelDepth(const ChannelType channel_, const size_t depth_)
Definition: Image.cpp:467
void orderedDither(std::string thresholdMap_)
Definition: Image.cpp:3780
void strokeDashArray(const double *strokeDashArray_)
Definition: Options.cpp:576
DitherMethod quantizeDitherMethod(void) const
Definition: Image.cpp:1292
void strokeLineCap(const LineCap lineCap_)
Definition: Options.cpp:614
void stegano(const Image &watermark_)
Definition: Image.cpp:4535
void textEncoding(const std::string &encoding_)
Definition: Options.cpp:717
void sharpen(const double radius_=0.0, const double sigma_=1.0)
Definition: Image.cpp:4389
void colorFuzz(const double fuzz_)
Definition: Options.cpp:153
size_t subImage(void) const
Definition: Image.cpp:1510
void resample(const Point &density_)
Definition: Image.cpp:4129
MagickCore::Image *& image(void)
Definition: Image.cpp:4982
void boxColor(const Color &boxColor_)
Definition: Options.cpp:123
void floodFillAlpha(const ::ssize_t x_, const ::ssize_t y_, const unsigned int alpha_, const bool invert_=false)
bool isOpaque(void) const
Definition: Image.cpp:1057
void trim(void)
Definition: Image.cpp:4750
size_t depth(void) const
Definition: Image.cpp:699
MagickPPExport int operator<=(const Magick::Color &left_, const Magick::Color &right_)
Definition: Color.cpp:63
void solarize(const double factor_=50.0)
Definition: Image.cpp:4466
void textInterlineSpacing(const double spacing_)
Definition: Options.cpp:743
double fontPointsize(void) const
Definition: Image.cpp:872
void updateNoCopy(void *data_, const size_t length_, const Allocator allocator_=NewAllocator)
Definition: Blob.cpp:121
void textGravity(const GravityType gravity_)
Definition: Options.cpp:731
MagickPPExport int operator>=(const Magick::Color &left_, const Magick::Color &right_)
Definition: Color.cpp:57
void stereo(const Image &rightImage_)
Definition: Image.cpp:4546
void defineSet(const std::string &magick_, const std::string &key_, bool flag_)
Definition: Image.cpp:2678
void transformScale(const double sx_, const double sy_)
Definition: Options.cpp:847
void quantize(const bool measureError_=false)
Definition: Image.cpp:3958
void read(const Blob &blob_)
Definition: Image.cpp:4002
void autoGammaChannel(const ChannelType channel_)
Definition: Image.cpp:2006
void frame(const Geometry &geometry_=frameGeometryDefault)
Definition: Image.cpp:3140
void font(const std::string &font_)
Definition: Options.cpp:281
void orderedDitherChannel(const ChannelType channel_, std::string thresholdMap_)
Definition: Image.cpp:3788
void fontWeight(const size_t weight_)
Definition: Options.cpp:348
#define ThrowPPDrawException(quiet)
Definition: Include.h:1530
Blob iptcProfile(void) const
Definition: Image.cpp:1045
void density(const Point &density_)
Definition: Options.cpp:178
Image(void)
Definition: Image.cpp:77
Quantum * getPixels(const ::ssize_t x_, const ::ssize_t y_, const size_t columns_, const size_t rows_)
Definition: Image.cpp:3296
void flip(void)
Definition: Image.cpp:2978
LineCap strokeLineCap(void) const
Definition: Image.cpp:1428
void shave(const Geometry &geometry_)
Definition: Image.cpp:4414
void strokeWidth(const double strokeWidth_)
Definition: Options.cpp:663
std::string textEncoding(void) const
Definition: Image.cpp:1554
#define MagickPPExport
Definition: Include.h:268
void tint(const std::string opacity_)
Definition: Image.cpp:4644
void perceptible(const double epsilon_)
Definition: Image.cpp:3799
void blackThreshold(const std::string &threshold_)
Definition: Image.cpp:2058
bool isValid(void) const
Definition: Image.cpp:1084
void erase(void)
Definition: Image.cpp:2877
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:4400
FilterType filterType(void) const
Definition: Image.cpp:839
double xResolution(void) const
Definition: Image.cpp:1695
bool quantizeDither(void) const
Definition: Image.cpp:1281
InterlaceType interlaceType(void) const
Definition: Image.cpp:1012
const void * getConstMetacontent(void) const
Definition: Image.cpp:3268
std::string format(void) const
Definition: Image.cpp:899
void blackThresholdChannel(const ChannelType channel_, const std::string &threshold_)
Definition: Image.cpp:2066
void edge(const double radius_=0.0)
Definition: Image.cpp:2828
size_t colorMapSize(void) const
Definition: Image.cpp:550
void kuwahara(const double radius_=0.0, const double sigma_=1.0)
Definition: Image.cpp:3380
void resolutionUnits(const ResolutionType resolutionUnits_)
Definition: Options.cpp:509
std::string signature(const bool force_=false) const
Definition: Image.cpp:4449
void texture(const Image &texture_)
Definition: Image.cpp:4606
void xOff(::ssize_t xOff_)
Definition: Geometry.cpp:418
void sepiaTone(const double threshold_)
Definition: Image.cpp:4323
size_t totalColors(void) const
Definition: Image.cpp:1614
PixelInterpolateMethod interpolate(void) const
Definition: Image.cpp:1023
void transparentChroma(const Color &colorLow_, const Color &colorHigh_)
Definition: Image.cpp:4699
void sy(const double sy_)
Definition: Drawable.h:251
void sync(void)
Definition: Pixels.cpp:92
void shadow(const double percentAlpha_=80.0, const double sigma_=0.5, const ssize_t x_=5, const ssize_t y_=5)
Definition: Image.cpp:4376
void whiteThresholdChannel(const ChannelType channel_, const std::string &threshold_)
Definition: Image.cpp:4849
void minify(void)
Definition: Image.cpp:3569
void syncPixels(void)
Definition: Image.cpp:4599
void scale(const Geometry &geometry_)
Definition: Image.cpp:4247
Image subImageSearch(const Image &reference_, const MetricType metric_, Geometry *offset_, double *similarityMetric_, const double similarityThreshold=(-1.0))
Definition: Image.cpp:4565
MagickCore::ImageInfo * imageInfo(void)
Definition: Image.cpp:4992
void unsharpmaskChannel(const ChannelType channel_, const double radius_, const double sigma_, const double amount_, const double threshold_)
Definition: Image.cpp:4788
void transformRotation(const double angle_)
Definition: Image.cpp:1625
void artifact(const std::string &name_, const std::string &value_)
Definition: Image.cpp:1949
double textKerning(void) const
Definition: Image.cpp:1598
double colorFuzz(void) const
Definition: Image.cpp:533
void transverse(void)
Definition: Image.cpp:4739
void sx(const double sx_)
Definition: Drawable.h:242
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:2148
MagickPPExport const char * frameGeometryDefault
Definition: Image.cpp:33
void textAntiAlias(const bool flag_)
Definition: Options.cpp:694
const MagickCore::QuantizeInfo * constQuantizeInfo(void) const
Definition: Image.cpp:5017
void draw(const Drawable &drawable_)
Definition: Image.cpp:2779
void randomThreshold(const double low_, const double high_)
Definition: Image.cpp:3984
MagickPPExport void throwExceptionExplicit(const MagickCore::ExceptionType severity_, const char *reason_, const char *description_=(char *) NULL)
Definition: Exception.cpp:807
void evaluate(const ChannelType channel_, const MagickEvaluateOperator operator_, double rvalue_)
Definition: Image.cpp:2885
void rotationalBlur(const double angle_)
Definition: Image.cpp:4200
ColorspaceType colorSpaceType(void) const
Definition: Image.cpp:584
Geometry boundingBox(void) const
Definition: Image.cpp:445
void implode(const double factor_)
Definition: Image.cpp:3350
void adjoin(const bool flag_)
Definition: Options.cpp:65
void addNoiseChannel(const ChannelType channel_, const NoiseType noiseType_, const double attenuate_=1.0)
Definition: Image.cpp:1788
Color strokeColor(void) const
Definition: Image.cpp:1395
double normalizedMeanError(void) const
Definition: Image.cpp:1211
#define ClonePPDrawException(wand)
Definition: Include.h:1522
void masklightColor(const Color color_)
Definition: Image.cpp:1149
void chromaBluePrimary(const double x_, const double y_, const double z_)
Definition: Image.cpp:2220
void clamp(void)
Definition: Image.cpp:2284
const double * strokeDashArray(void) const
Definition: Image.cpp:1406
void levelize(const double blackPoint_, const double whitePoint_, const double gamma_=1.0)
Definition: Image.cpp:3461
void adaptiveSharpenChannel(const ChannelType channel_, const double radius_=0.0, const double sigma_=1.0)
Definition: Image.cpp:1749
void wave(const double amplitude_=25.0, const double wavelength_=150.0)
Definition: Image.cpp:4816
double gamma(void) const
Definition: Image.cpp:939
void threshold(const double threshold_)
Definition: Image.cpp:4614
void convolve(const size_t order_, const double *kernel_)
Definition: Image.cpp:2606
void roll(const Geometry &roll_)
Definition: Image.cpp:4166
void rx(const double rx_)
Definition: Drawable.h:260
double yResolution(void) const
Definition: Image.cpp:1700
void strip(void)
Definition: Image.cpp:4557
void gaussianBlurChannel(const ChannelType channel_, const double radius_, const double sigma_)
Definition: Image.cpp:3242
void thumbnail(const Geometry &geometry_)
Definition: Image.cpp:4622
void alphaChannel(AlphaChannelOption alphaOption_)
Definition: Image.cpp:1831
CompositeOperator compose(void) const
Definition: Image.cpp:624
void matteColor(const Color &matteColor_)
Definition: Options.cpp:76
bool blackPointCompensation(void) const
Definition: Image.cpp:423
void adaptiveBlur(const double radius_=0.0, const double sigma_=1.0)
Definition: Image.cpp:1705
void display(void)
Definition: Image.cpp:2759
void ping(const std::string &imageSpec_)
Definition: Image.cpp:3823
void selectiveBlur(const double radius_, const double sigma_, const double threshold_)
Definition: Image.cpp:4281
void autoOrient(void)
Definition: Image.cpp:2035
void transparent(const Color &color_, const bool inverse_=false)
Definition: Image.cpp:4677
void inverseFourierTransform(const Image &phase_)
Definition: Image.cpp:3362
void magick(const std::string &magick_)
Definition: Options.cpp:385
void colorize(const unsigned int alpha_, const Color &penColor_)
Definition: Image.cpp:2339
double x(void) const
Definition: Geometry.cpp:701
DirectionType textDirection() const
Definition: Image.cpp:1543
#define GetAndSetPPChannelMask(channel)
Definition: Include.h:1518
void cdl(const std::string &cdl_)
Definition: Image.cpp:2162
void quality(const size_t quality_)
Definition: Options.cpp:437
Geometry geometry(void) const
Definition: Image.cpp:944
void quantizeTreeDepth(const size_t treeDepth_)
Definition: Options.cpp:489
void fontStyle(const StyleType style_)
Definition: Options.cpp:336
size_t animationIterations(void) const
Definition: Image.cpp:370
void distort(const DistortMethod method_, const size_t numberArguments_, const double *arguments_, const bool bestfit_=false)
Definition: Image.cpp:2766
void isValid(const bool isValid_)
Definition: Image.cpp:1068
void border(const Geometry &geometry_=borderGeometryDefault)
Definition: Image.cpp:2113
void addNoise(const NoiseType noiseType_, const double attenuate_=1.0)
Definition: Image.cpp:1777
Color backgroundColor(void) const
Definition: Image.cpp:387
void backgroundTexture(const std::string &backgroundTexture_)
Definition: Options.cpp:96
void sample(const Geometry &geometry_)
Definition: Image.cpp:4225
void clut(const Image &clutImage_, const PixelInterpolateMethod method)
Definition: Image.cpp:2319
void affineTransform(const DrawableAffine &affine)
Definition: Image.cpp:1802
double normalizedMaxError(void) const
Definition: Image.cpp:1206
size_t rows(void) const
Definition: Image.cpp:1344
void isValid(const bool valid_)
Definition: Color.cpp:292
size_t columns(void) const
Definition: Image.cpp:589
Magick::ImagePerceptualHash perceptualHash() const
Definition: Image.cpp:3818
void attribute(const std::string name_, const char *value_)
Definition: Image.cpp:1966
void houghLine(const size_t width_, const size_t height_, const size_t threshold_=40)
Definition: Image.cpp:3326
void levelizeChannel(const ChannelType channel_, const double blackPoint_, const double whitePoint_, const double gamma_=1.0)
Definition: Image.cpp:3470
Color fillColor(void) const
Definition: Image.cpp:784
Geometry montageGeometry(void) const
Definition: Image.cpp:1194
void sketch(const double radius_=0.0, const double sigma_=1.0, const double angle_=0.0)
Definition: Image.cpp:4454
double y(void) const
Definition: Geometry.cpp:706
const void * data(void) const
Definition: Blob.cpp:103
void subRange(const size_t subRange_)
Definition: Options.cpp:684
Image fillPattern(void) const
Definition: Image.cpp:809
void transformOrigin(const double tx_, const double ty_)
Definition: Options.cpp:787
void transformSkewY(const double skewy_)
Definition: Options.cpp:896
std::string formatExpression(const std::string expression)
Definition: Image.cpp:918
void transformSkewX(const double skewx_)
Definition: Options.cpp:871
void x11Display(const std::string &display_)
Definition: Options.cpp:941
void quantizeColors(const size_t colors_)
Definition: Options.cpp:447
LineJoin strokeLineJoin(void) const
Definition: Image.cpp:1439
void blueShift(const double factor_=1.5)
Definition: Image.cpp:2077
static ImageRef * replaceImage(ImageRef *imgRef, MagickCore::Image *replacement_)
Definition: ImageRef.cpp:100
void ry(const double ry_)
Definition: Drawable.h:269
void strokeDashOffset(const double strokeDashOffset_)
Definition: Options.cpp:604
void chromaRedPrimary(const double x_, const double y_, const double z_)
Definition: Image.cpp:2252
size_t baseColumns(void) const
Definition: Image.cpp:403
double textInterwordSpacing(void) const
Definition: Image.cpp:1587
MagickPPExport int operator>(const Magick::Color &left_, const Magick::Color &right_)
Definition: Color.cpp:35
void transpose(void)
Definition: Image.cpp:4728
MagickCore::DrawInfo * drawInfo(void)
Definition: Options.cpp:958
MagickPPExport int operator==(const Magick::Color &left_, const Magick::Color &right_)
Definition: Color.cpp:20
void endian(const EndianType endian_)
Definition: Options.cpp:204
bool quiet(void) const
Definition: Image.cpp:1314
ResolutionType resolutionUnits(void) const
Definition: Image.cpp:1339
class MagickPPExport Point
Definition: Geometry.h:198
Quantum * setPixels(const ::ssize_t x_, const ::ssize_t y_, const size_t columns_, const size_t rows_)
Definition: Image.cpp:4350
class MagickPPExport Image
Definition: Drawable.h:720
void chromaWhitePoint(const double x_, const double y_, const double z_)
Definition: Image.cpp:2268
void autoLevelChannel(const ChannelType channel_)
Definition: Image.cpp:2025
void quantizeDither(const bool ditherFlag_)
Definition: Options.cpp:467
void interlaceType(const InterlaceType interlace_)
Definition: Options.cpp:375
void negateChannel(const ChannelType channel_, const bool grayscale_=false)
Definition: Image.cpp:3717
std::string x11Display(void) const
Definition: Image.cpp:1690
size_t fontWeight(void) const
Definition: Image.cpp:894
void repage()
Definition: Image.cpp:4119
double textInterlineSpacing(void) const
Definition: Image.cpp:1576
GravityType textGravity() const
Definition: Image.cpp:1565
void brightnessContrast(const double brightness_=0.0, const double contrast_=0.0)
Definition: Image.cpp:2128
MagickCore::Image *& image(void)
Definition: ImageRef.cpp:66
MagickCore::QuantizeInfo * quantizeInfo(void)
Definition: Image.cpp:5012
size_t length(void) const
Definition: Blob.cpp:108
void floodFillColor(const Geometry &point_, const Color &fillColor_, const bool invert_=false)
Definition: Image.cpp:3025
void type(const ImageType type_)
Definition: Options.cpp:921
void flop(void)
Definition: Image.cpp:3101
ClassType classType(void) const
Definition: Image.cpp:521
void levelChannel(const ChannelType channel_, const double blackPoint_, const double whitePoint_, const double gamma_=1.0)
Definition: Image.cpp:3414
void despeckle(void)
Definition: Image.cpp:2748
void sigmoidalContrast(const bool sharpen_, const double contrast, const double midpoint=QuantumRange/2.0)
Definition: Image.cpp:4439
void monochrome(const bool monochromeFlag_)
Definition: Options.cpp:411