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  ssize_t
761  max_length;
762 
763  modifyImage();
764 
765  max_length=sizeof(image()->filename)-1;
766  fileName_.copy(image()->filename,max_length);
767  if ((ssize_t) fileName_.length() > max_length)
768  image()->filename[max_length]=0;
769  else
770  image()->filename[fileName_.length()]=0;
771 
772  options()->fileName(fileName_);
773 }
774 
775 std::string Magick::Image::fileName(void) const
776 {
777  return(constOptions()->fileName());
778 }
779 
780 MagickCore::MagickSizeType Magick::Image::fileSize(void) const
781 {
782  return(GetBlobSize(constImage()));
783 }
784 
786 {
787  modifyImage();
788  options()->fillColor(fillColor_);
789 }
790 
792 {
793  return(constOptions()->fillColor());
794 }
795 
796 void Magick::Image::fillRule(const Magick::FillRule &fillRule_)
797 {
798  modifyImage();
799  options()->fillRule(fillRule_);
800 }
801 
802 Magick::FillRule Magick::Image::fillRule(void) const
803 {
804  return constOptions()->fillRule();
805 }
806 
807 void Magick::Image::fillPattern(const Image &fillPattern_)
808 {
809  modifyImage();
810  if (fillPattern_.isValid())
811  options()->fillPattern(fillPattern_.constImage());
812  else
813  options()->fillPattern(static_cast<MagickCore::Image*>(NULL));
814 }
815 
817 {
818  // FIXME: This is inordinately innefficient
819  const MagickCore::Image
820  *tmpTexture;
821 
822  Image
823  texture;
824 
825  tmpTexture=constOptions()->fillPattern();
826 
827  if (tmpTexture)
828  {
830  *image;
831 
833  image=CloneImage(tmpTexture,0,0,MagickTrue,exceptionInfo);
834  texture.replaceImage(image);
836  }
837  return(texture);
838 }
839 
840 void Magick::Image::filterType(const Magick::FilterType filterType_)
841 {
842  modifyImage();
843  image()->filter=filterType_;
844 }
845 
846 Magick::FilterType Magick::Image::filterType(void) const
847 {
848  return(constImage()->filter);
849 }
850 
851 void Magick::Image::font(const std::string &font_)
852 {
853  modifyImage();
854  options()->font(font_);
855 }
856 
857 std::string Magick::Image::font(void) const
858 {
859  return(constOptions()->font());
860 }
861 
862 void Magick::Image::fontFamily(const std::string &family_)
863 {
864  modifyImage();
865  options()->fontFamily(family_);
866 }
867 
868 std::string Magick::Image::fontFamily(void) const
869 {
870  return(constOptions()->fontFamily());
871 }
872 
873 void Magick::Image::fontPointsize(const double pointSize_)
874 {
875  modifyImage();
876  options()->fontPointsize(pointSize_);
877 }
878 
880 {
881  return(constOptions()->fontPointsize());
882 }
883 
884 void Magick::Image::fontStyle(const StyleType pointSize_)
885 {
886  modifyImage();
887  options()->fontStyle(pointSize_);
888 }
889 
890 Magick::StyleType Magick::Image::fontStyle(void) const
891 {
892  return(constOptions()->fontStyle());
893 }
894 
895 void Magick::Image::fontWeight(const size_t weight_)
896 {
897  modifyImage();
898  options()->fontWeight(weight_);
899 }
900 
901 size_t Magick::Image::fontWeight(void) const
902 {
903  return(constOptions()->fontWeight());
904 }
905 
906 std::string Magick::Image::format(void) const
907 {
908  const MagickInfo
909  *magick_info;
910 
912  magick_info=GetMagickInfo(constImage()->magick,exceptionInfo);
914 
915  if ((magick_info != 0) && (*magick_info->description != '\0'))
916  return(std::string(magick_info->description));
917 
918  if (!quiet())
919  throwExceptionExplicit(MagickCore::CorruptImageWarning,
920  "Unrecognized image magick type");
921 
922  return(std::string());
923 }
924 
925 std::string Magick::Image::formatExpression(const std::string expression)
926 {
927  char
928  *text;
929 
930  std::string
931  text_string;
932 
934  modifyImage();
935  text=InterpretImageProperties(imageInfo(),image(),expression.c_str(),
936  exceptionInfo);
937  if (text != (char *) NULL)
938  {
939  text_string=std::string(text);
940  text=DestroyString(text);
941  }
943  return(text_string);
944 }
945 
946 double Magick::Image::gamma(void) const
947 {
948  return(constImage()->gamma);
949 }
950 
952 {
953  if (constImage()->geometry)
954  return Geometry(constImage()->geometry);
955 
956  if (!quiet())
957  throwExceptionExplicit(MagickCore::OptionWarning,
958  "Image does not contain a geometry");
959 
960  return(Geometry());
961 }
962 
964  const MagickCore::DisposeType disposeMethod_)
965 {
966  modifyImage();
967  image()->dispose=disposeMethod_;
968 }
969 
970 MagickCore::DisposeType Magick::Image::gifDisposeMethod(void) const
971 {
972  return(constImage()->dispose);
973 }
974 
975 bool Magick::Image::hasChannel(const PixelChannel channel) const
976 {
977  if (GetPixelChannelTraits(constImage(),channel) == UndefinedPixelTrait)
978  return(false);
979 
980  if (channel == GreenPixelChannel || channel == BluePixelChannel)
981  return (GetPixelChannelOffset(constImage(),channel) == (ssize_t)channel);
982 
983  return(true);
984 }
985 
987 {
988  std::string
989  value;
990 
991  value=color_;
992  artifact("compare:highlight-color",value);
993 }
994 
996 {
997  profile("icc",colorProfile_);
998 }
999 
1001 {
1002  const StringInfo
1003  *color_profile;
1004 
1005  color_profile=GetImageProfile(constImage(),"icc");
1006  if (color_profile == (StringInfo *) NULL)
1007  return(Blob());
1008  return(Blob(GetStringInfoDatum(color_profile),GetStringInfoLength(
1009  color_profile)));
1010 }
1011 
1012 void Magick::Image::interlaceType(const Magick::InterlaceType interlace_)
1013 {
1014  modifyImage();
1015  image()->interlace=interlace_;
1016  options()->interlaceType(interlace_);
1017 }
1018 
1019 Magick::InterlaceType Magick::Image::interlaceType(void) const
1020 {
1021  return(constImage()->interlace);
1022 }
1023 
1024 void Magick::Image::interpolate(const PixelInterpolateMethod interpolate_)
1025 {
1026  modifyImage();
1027  image()->interpolate=interpolate_;
1028 }
1029 
1030 Magick::PixelInterpolateMethod Magick::Image::interpolate(void) const
1031 {
1032  return constImage()->interpolate;
1033 }
1034 
1035 void Magick::Image::iptcProfile(const Magick::Blob &iptcProfile_)
1036 {
1037  modifyImage();
1038  if (iptcProfile_.data() != 0)
1039  {
1040  StringInfo
1041  *iptc_profile;
1042 
1043  iptc_profile=AcquireStringInfo(iptcProfile_.length());
1044  SetStringInfoDatum(iptc_profile,(unsigned char *) iptcProfile_.data());
1046  (void) SetImageProfile(image(),"iptc",iptc_profile,exceptionInfo);
1047  iptc_profile=DestroyStringInfo(iptc_profile);
1049  }
1050 }
1051 
1053 {
1054  const StringInfo
1055  *iptc_profile;
1056 
1057  iptc_profile=GetImageProfile(constImage(),"iptc");
1058  if (iptc_profile == (StringInfo *) NULL)
1059  return(Blob());
1060  return(Blob(GetStringInfoDatum(iptc_profile),GetStringInfoLength(
1061  iptc_profile)));
1062 }
1063 
1064 bool Magick::Image::isOpaque(void) const
1065 {
1066  MagickBooleanType
1067  result;
1068 
1070  result=IsImageOpaque(constImage(),exceptionInfo);
1072  return(result != MagickFalse ? true : false);
1073 }
1074 
1075 void Magick::Image::isValid(const bool isValid_)
1076 {
1077  if (!isValid_)
1078  {
1079  delete _imgRef;
1080  _imgRef=new ImageRef;
1081  }
1082  else if (!isValid())
1083  {
1084  // Construct with single-pixel black image to make
1085  // image valid. This is an obvious hack.
1086  size(Geometry(1,1));
1087  read("xc:black");
1088  }
1089 }
1090 
1091 bool Magick::Image::isValid(void) const
1092 {
1093  return rows() && columns();
1094 }
1095 
1096 void Magick::Image::label(const std::string &label_)
1097 {
1098  modifyImage();
1100  (void) SetImageProperty(image(),"Label",NULL,exceptionInfo);
1101  if (label_.length() > 0)
1102  (void) SetImageProperty(image(),"Label",label_.c_str(),exceptionInfo);
1104 }
1105 
1106 std::string Magick::Image::label(void) const
1107 {
1108  const char
1109  *value;
1110 
1112  value=GetImageProperty(constImage(),"Label",exceptionInfo);
1114 
1115  if (value)
1116  return(std::string(value));
1117 
1118  return(std::string());
1119 }
1120 
1122 {
1123  std::string
1124  value;
1125 
1126  value=color_;
1127  artifact("compare:lowlight-color",value);
1128 }
1129 
1130 void Magick::Image::magick(const std::string &magick_)
1131 {
1132  size_t
1133  length;
1134 
1135  modifyImage();
1136 
1137  length=sizeof(image()->magick)-1;
1138  if (magick_.length() < length)
1139  length=magick_.length();
1140 
1141  if (!magick_.empty())
1142  magick_.copy(image()->magick,length);
1143  image()->magick[length]=0;
1144 
1145  options()->magick(magick_);
1146 }
1147 
1148 std::string Magick::Image::magick(void) const
1149 {
1150  if (*(constImage()->magick) != '\0')
1151  return(std::string(constImage()->magick));
1152 
1153  return(constOptions()->magick());
1154 }
1155 
1157 {
1158  std::string
1159  value;
1160 
1161  value=color_;
1162  artifact("compare:masklight-color",value);
1163 }
1164 
1166 {
1167  return(constImage()->error.mean_error_per_pixel);
1168 }
1169 
1170 void Magick::Image::modulusDepth(const size_t depth_)
1171 {
1172  modifyImage();
1174  SetImageDepth(image(),depth_,exceptionInfo);
1176  options()->depth(depth_);
1177 }
1178 
1180 {
1181  size_t
1182  depth;
1183 
1185  depth=GetImageDepth(constImage(),exceptionInfo);
1187  return(depth);
1188 }
1189 
1190 void Magick::Image::monochrome(const bool monochromeFlag_)
1191 {
1192  modifyImage();
1193  options()->monochrome(monochromeFlag_);
1194 }
1195 
1197 {
1198  return(constOptions()->monochrome());
1199 }
1200 
1202 {
1203  if (constImage()->montage)
1204  return Magick::Geometry(constImage()->montage);
1205 
1206  if (!quiet())
1207  throwExceptionExplicit(MagickCore::CorruptImageWarning,
1208  "Image does not contain a montage");
1209 
1210  return(Magick::Geometry());
1211 }
1212 
1214 {
1215  return(constImage()->error.normalized_maximum_error);
1216 }
1217 
1219 {
1220  return(constImage()->error.normalized_mean_error);
1221 }
1222 
1223 void Magick::Image::orientation(const Magick::OrientationType orientation_)
1224 {
1225  modifyImage();
1226  image()->orientation=orientation_;
1227 }
1228 
1229 Magick::OrientationType Magick::Image::orientation(void) const
1230 {
1231  return(constImage()->orientation);
1232 }
1233 
1235 {
1236  modifyImage();
1237  options()->page(pageSize_);
1238  image()->page=pageSize_;
1239 }
1240 
1242 {
1244  constImage()->page.x,constImage()->page.y));
1245 }
1246 
1247 void Magick::Image::quality(const size_t quality_)
1248 {
1249  modifyImage();
1250  image()->quality=quality_;
1251  options()->quality(quality_);
1252 }
1253 
1254 size_t Magick::Image::quality(void) const
1255 {
1256  return(constImage()->quality);
1257 }
1258 
1259 void Magick::Image::quantizeColors(const size_t colors_)
1260 {
1261  modifyImage();
1262  options()->quantizeColors(colors_);
1263 }
1264 
1266 {
1267  return(constOptions()->quantizeColors());
1268 }
1269 
1271  const Magick::ColorspaceType colorSpace_)
1272 {
1273  modifyImage();
1274  options()->quantizeColorSpace(colorSpace_);
1275 }
1276 
1277 Magick::ColorspaceType Magick::Image::quantizeColorSpace(void) const
1278 {
1279  return(constOptions()->quantizeColorSpace());
1280 }
1281 
1282 void Magick::Image::quantizeDither(const bool ditherFlag_)
1283 {
1284  modifyImage();
1285  options()->quantizeDither(ditherFlag_);
1286 }
1287 
1289 {
1290  return(constOptions()->quantizeDither());
1291 }
1292 
1293 void Magick::Image::quantizeDitherMethod(const DitherMethod ditherMethod_)
1294 {
1295  modifyImage();
1296  options()->quantizeDitherMethod(ditherMethod_);
1297 }
1298 
1299 MagickCore::DitherMethod Magick::Image::quantizeDitherMethod(void) const
1300 {
1301  return(constOptions()->quantizeDitherMethod());
1302 }
1303 
1304 void Magick::Image::quantizeTreeDepth(const size_t treeDepth_)
1305 {
1306  modifyImage();
1307  options()->quantizeTreeDepth(treeDepth_);
1308 }
1309 
1311 {
1312  return(constOptions()->quantizeTreeDepth());
1313 }
1314 
1315 void Magick::Image::quiet(const bool quiet_)
1316 {
1317  modifyImage();
1318  options()->quiet(quiet_);
1319 }
1320 
1321 bool Magick::Image::quiet(void) const
1322 {
1323  return(constOptions()->quiet());
1324 }
1325 
1327  const Magick::RenderingIntent renderingIntent_)
1328 {
1329  modifyImage();
1330  image()->rendering_intent=renderingIntent_;
1331 }
1332 
1333 Magick::RenderingIntent Magick::Image::renderingIntent(void) const
1334 {
1335  return(static_cast<Magick::RenderingIntent>(constImage()->rendering_intent));
1336 }
1337 
1339  const Magick::ResolutionType resolutionUnits_)
1340 {
1341  modifyImage();
1342  image()->units=resolutionUnits_;
1343  options()->resolutionUnits(resolutionUnits_);
1344 }
1345 
1346 Magick::ResolutionType Magick::Image::resolutionUnits(void) const
1347 {
1348  return(static_cast<Magick::ResolutionType>(constImage()->units));
1349 }
1350 
1351 size_t Magick::Image::rows(void) const
1352 {
1353  return(constImage()->rows);
1354 }
1355 
1356 void Magick::Image::scene(const size_t scene_)
1357 {
1358  modifyImage();
1359  image()->scene=scene_;
1360 }
1361 
1362 size_t Magick::Image::scene(void) const
1363 {
1364  return(constImage()->scene);
1365 }
1366 
1367 void Magick::Image::size(const Geometry &geometry_)
1368 {
1369  modifyImage();
1370  options()->size(geometry_);
1371  image()->rows=geometry_.height();
1372  image()->columns=geometry_.width();
1373 }
1374 
1376 {
1378 }
1379 
1380 void Magick::Image::strokeAntiAlias(const bool flag_)
1381 {
1382  modifyImage();
1383  options()->strokeAntiAlias(flag_);
1384 }
1385 
1387 {
1388  return(constOptions()->strokeAntiAlias());
1389 }
1390 
1392 {
1393  std::string
1394  value;
1395 
1396  modifyImage();
1397  options()->strokeColor(strokeColor_);
1398  value=strokeColor_;
1399  artifact("stroke",value);
1400 }
1401 
1403 {
1404  return(constOptions()->strokeColor());
1405 }
1406 
1407 void Magick::Image::strokeDashArray(const double *strokeDashArray_)
1408 {
1409  modifyImage();
1410  options()->strokeDashArray(strokeDashArray_);
1411 }
1412 
1413 const double* Magick::Image::strokeDashArray(void) const
1414 {
1415  return(constOptions()->strokeDashArray());
1416 }
1417 
1418 void Magick::Image::strokeDashOffset(const double strokeDashOffset_)
1419 {
1420  modifyImage();
1421  options()->strokeDashOffset(strokeDashOffset_);
1422 }
1423 
1425 {
1426  return(constOptions()->strokeDashOffset());
1427 }
1428 
1429 void Magick::Image::strokeLineCap(const Magick::LineCap lineCap_)
1430 {
1431  modifyImage();
1432  options()->strokeLineCap(lineCap_);
1433 }
1434 
1435 Magick::LineCap Magick::Image::strokeLineCap(void) const
1436 {
1437  return(constOptions()->strokeLineCap());
1438 }
1439 
1440 void Magick::Image::strokeLineJoin(const Magick::LineJoin lineJoin_)
1441 {
1442  modifyImage();
1443  options()->strokeLineJoin(lineJoin_);
1444 }
1445 
1446 Magick::LineJoin Magick::Image::strokeLineJoin(void) const
1447 {
1448  return(constOptions()->strokeLineJoin());
1449 }
1450 
1451 void Magick::Image::strokeMiterLimit(const size_t strokeMiterLimit_)
1452 {
1453  modifyImage();
1454  options()->strokeMiterLimit(strokeMiterLimit_);
1455 }
1456 
1458 {
1459  return(constOptions()->strokeMiterLimit());
1460 }
1461 
1462 void Magick::Image::strokePattern(const Image &strokePattern_)
1463 {
1464  modifyImage();
1465  if(strokePattern_.isValid())
1466  options()->strokePattern(strokePattern_.constImage());
1467  else
1468  options()->strokePattern(static_cast<MagickCore::Image*>(NULL));
1469 }
1470 
1472 {
1473  // FIXME: This is inordinately innefficient
1474  const MagickCore::Image
1475  *tmpTexture;
1476 
1477  Image
1478  texture;
1479 
1480  tmpTexture=constOptions()->strokePattern();
1481 
1482  if (tmpTexture)
1483  {
1485  *image;
1486 
1488  image=CloneImage(tmpTexture,0,0,MagickTrue,exceptionInfo);
1489  texture.replaceImage(image);
1491  }
1492  return(texture);
1493 }
1494 
1495 void Magick::Image::strokeWidth(const double strokeWidth_)
1496 {
1497  char
1498  value[MagickPathExtent];
1499 
1500  modifyImage();
1501  options()->strokeWidth(strokeWidth_);
1502  FormatLocaleString(value,MagickPathExtent,"%.20g",strokeWidth_);
1503  (void) SetImageArtifact(image(),"strokewidth",value);
1504 }
1505 
1506 double Magick::Image::strokeWidth(void) const
1507 {
1508  return(constOptions()->strokeWidth());
1509 }
1510 
1511 void Magick::Image::subImage(const size_t subImage_)
1512 {
1513  modifyImage();
1514  options()->subImage(subImage_);
1515 }
1516 
1517 size_t Magick::Image::subImage(void) const
1518 {
1519  return(constOptions()->subImage());
1520 }
1521 
1522 void Magick::Image::subRange(const size_t subRange_)
1523 {
1524  modifyImage();
1525  options()->subRange(subRange_);
1526 }
1527 
1528 size_t Magick::Image::subRange(void) const
1529 {
1530  return(constOptions()->subRange());
1531 }
1532 
1533 void Magick::Image::textAntiAlias(const bool flag_)
1534 {
1535  modifyImage();
1536  options()->textAntiAlias(flag_);
1537 }
1538 
1540 {
1541  return(constOptions()->textAntiAlias());
1542 }
1543 
1544 void Magick::Image::textDirection(DirectionType direction_)
1545 {
1546  modifyImage();
1547  options()->textDirection(direction_);
1548 }
1549 
1550 Magick::DirectionType Magick::Image::textDirection(void) const
1551 {
1552  return(constOptions()->textDirection());
1553 }
1554 
1555 void Magick::Image::textEncoding(const std::string &encoding_)
1556 {
1557  modifyImage();
1558  options()->textEncoding(encoding_);
1559 }
1560 
1561 std::string Magick::Image::textEncoding(void) const
1562 {
1563  return(constOptions()->textEncoding());
1564 }
1565 
1566 void Magick::Image::textGravity(GravityType gravity_)
1567 {
1568  modifyImage();
1569  options()->textGravity(gravity_);
1570 }
1571 
1572 Magick::GravityType Magick::Image::textGravity(void) const
1573 {
1574  return(constOptions()->textGravity());
1575 }
1576 
1578 {
1579  modifyImage();
1580  options()->textInterlineSpacing(spacing_);
1581 }
1582 
1584 {
1585  return(constOptions()->textInterlineSpacing());
1586 }
1587 
1589 {
1590  modifyImage();
1591  options()->textInterwordSpacing(spacing_);
1592 }
1593 
1595 {
1596  return(constOptions()->textInterwordSpacing());
1597 }
1598 
1599 void Magick::Image::textKerning(double kerning_)
1600 {
1601  modifyImage();
1602  options()->textKerning(kerning_);
1603 }
1604 
1605 double Magick::Image::textKerning(void) const
1606 {
1607  return(constOptions()->textKerning());
1608 }
1609 
1610 void Magick::Image::textUnderColor(const Color &underColor_)
1611 {
1612  modifyImage();
1613  options()->textUnderColor(underColor_);
1614 }
1615 
1617 {
1618  return(constOptions()->textUnderColor());
1619 }
1620 
1621 size_t Magick::Image::totalColors(void) const
1622 {
1623  size_t
1624  colors;
1625 
1627  colors=GetNumberColors(constImage(),(FILE *) NULL,exceptionInfo);
1629  return colors;
1630 }
1631 
1632 void Magick::Image::transformRotation(const double angle_)
1633 {
1634  modifyImage();
1635  options()->transformRotation(angle_);
1636 }
1637 
1638 void Magick::Image::transformSkewX(const double skewx_)
1639 {
1640  modifyImage();
1641  options()->transformSkewX(skewx_);
1642 }
1643 
1644 void Magick::Image::transformSkewY(const double skewy_)
1645 {
1646  modifyImage();
1647  options()->transformSkewY(skewy_);
1648 }
1649 
1650 Magick::ImageType Magick::Image::type(void) const
1651 {
1652  if (constOptions()->type() != UndefinedType)
1653  return(constOptions()->type());
1654  return(GetImageType(constImage()));
1655 }
1656 
1657 void Magick::Image::type(const Magick::ImageType type_)
1658 {
1659  modifyImage();
1660  options()->type(type_);
1662  SetImageType(image(),type_,exceptionInfo);
1664 }
1665 
1666 void Magick::Image::verbose(const bool verboseFlag_)
1667 {
1668  modifyImage();
1669  options()->verbose(verboseFlag_);
1670 }
1671 
1672 bool Magick::Image::verbose(void) const
1673 {
1674  return(constOptions()->verbose());
1675 }
1676 
1678  const VirtualPixelMethod virtualPixelMethod_)
1679 {
1680  modifyImage();
1682  SetImageVirtualPixelMethod(image(),virtualPixelMethod_,exceptionInfo);
1684 }
1685 
1686 Magick::VirtualPixelMethod Magick::Image::virtualPixelMethod(void) const
1687 {
1688  return(GetImageVirtualPixelMethod(constImage()));
1689 }
1690 
1691 void Magick::Image::x11Display(const std::string &display_)
1692 {
1693  modifyImage();
1694  options()->x11Display(display_);
1695 }
1696 
1697 std::string Magick::Image::x11Display(void) const
1698 {
1699  return(constOptions()->x11Display());
1700 }
1701 
1702 double Magick::Image::xResolution(void) const
1703 {
1704  return(constImage()->resolution.x);
1705 }
1706 
1707 double Magick::Image::yResolution(void) const
1708 {
1709  return(constImage()->resolution.y);
1710 }
1711 
1712 void Magick::Image::adaptiveBlur(const double radius_,const double sigma_)
1713 {
1715  *newImage;
1716 
1718  newImage=AdaptiveBlurImage(constImage(),radius_,sigma_,exceptionInfo);
1719  replaceImage(newImage);
1721 }
1722 
1724 {
1726  *newImage;
1727 
1728  size_t
1729  height=rows(),
1730  width=columns();
1731 
1732  ssize_t
1733  x=0,
1734  y=0;
1735 
1736  ParseMetaGeometry(static_cast<std::string>(geometry_).c_str(),&x,&y,&width,
1737  &height);
1738 
1740  newImage=AdaptiveResizeImage(constImage(),width,height,exceptionInfo);
1741  replaceImage(newImage);
1743 }
1744 
1745 void Magick::Image::adaptiveSharpen(const double radius_,const double sigma_)
1746 {
1748  *newImage;
1749 
1751  newImage=AdaptiveSharpenImage(constImage(),radius_,sigma_,exceptionInfo);
1752  replaceImage(newImage);
1754 }
1755 
1756 void Magick::Image::adaptiveSharpenChannel(const ChannelType channel_,
1757  const double radius_,const double sigma_ )
1758 {
1760  *newImage;
1761 
1763  GetAndSetPPChannelMask(channel_);
1764  newImage=AdaptiveSharpenImage(constImage(),radius_,sigma_,exceptionInfo);
1766  replaceImage(newImage);
1768 }
1769 
1770 void Magick::Image::adaptiveThreshold(const size_t width_,const size_t height_,
1771  const double bias_)
1772 {
1773 
1775  *newImage;
1776 
1778  newImage=AdaptiveThresholdImage(constImage(),width_,height_,bias_,
1779  exceptionInfo);
1780  replaceImage(newImage);
1782 }
1783 
1784 void Magick::Image::addNoise(const NoiseType noiseType_,const double attenuate_)
1785 {
1787  *newImage;
1788 
1790  newImage=AddNoiseImage(constImage(),noiseType_,attenuate_,exceptionInfo);
1791  replaceImage(newImage);
1793 }
1794 
1795 void Magick::Image::addNoiseChannel(const ChannelType channel_,
1796  const NoiseType noiseType_,const double attenuate_)
1797 {
1799  *newImage;
1800 
1802  GetAndSetPPChannelMask(channel_);
1803  newImage=AddNoiseImage(constImage(),noiseType_,attenuate_,exceptionInfo);
1805  replaceImage(newImage);
1807 }
1808 
1810 {
1811  AffineMatrix
1812  _affine;
1813 
1815  *newImage;
1816 
1817  _affine.sx=affine_.sx();
1818  _affine.sy=affine_.sy();
1819  _affine.rx=affine_.rx();
1820  _affine.ry=affine_.ry();
1821  _affine.tx=affine_.tx();
1822  _affine.ty=affine_.ty();
1823 
1825  newImage=AffineTransformImage(constImage(),&_affine,exceptionInfo);
1826  replaceImage(newImage);
1828 }
1829 
1830 void Magick::Image::alpha(const unsigned int alpha_)
1831 {
1832  modifyImage();
1834  SetImageAlpha(image(),alpha_,exceptionInfo);
1836 }
1837 
1838 void Magick::Image::alphaChannel(AlphaChannelOption alphaOption_)
1839 {
1840  modifyImage();
1842  SetImageAlphaChannel(image(),alphaOption_,exceptionInfo);
1844 }
1845 
1846 void Magick::Image::annotate(const std::string &text_,
1847  const Geometry &location_)
1848 {
1849  annotate(text_,location_,NorthWestGravity,0.0);
1850 }
1851 
1852 void Magick::Image::annotate(const std::string &text_,
1853  const Geometry &boundingArea_,const GravityType gravity_)
1854 {
1855  annotate(text_,boundingArea_,gravity_,0.0);
1856 }
1857 
1858 void Magick::Image::annotate(const std::string &text_,
1859  const Geometry &boundingArea_,const GravityType gravity_,
1860  const double degrees_)
1861 {
1862  AffineMatrix
1863  oaffine;
1864 
1865  char
1866  boundingArea[MagickPathExtent];
1867 
1868  DrawInfo
1869  *drawInfo;
1870 
1871  modifyImage();
1872 
1873  drawInfo=options()->drawInfo();
1874  drawInfo->text=DestroyString(drawInfo->text);
1875  drawInfo->text=const_cast<char *>(text_.c_str());
1876  drawInfo->geometry=DestroyString(drawInfo->geometry);
1877 
1878  if (boundingArea_.isValid())
1879  {
1880  if (boundingArea_.width() == 0 || boundingArea_.height() == 0)
1881  {
1882  FormatLocaleString(boundingArea,MagickPathExtent,"%+.20g%+.20g",
1883  (double) boundingArea_.xOff(),(double) boundingArea_.yOff());
1884  }
1885  else
1886  {
1887  (void) CopyMagickString(boundingArea,
1888  std::string(boundingArea_).c_str(), MagickPathExtent);
1889  }
1890  drawInfo->geometry=boundingArea;
1891  }
1892 
1893  drawInfo->gravity=gravity_;
1894 
1895  oaffine=drawInfo->affine;
1896  if (degrees_ != 0.0)
1897  {
1898  AffineMatrix
1899  affine,
1900  current;
1901 
1902  affine.sx=1.0;
1903  affine.rx=0.0;
1904  affine.ry=0.0;
1905  affine.sy=1.0;
1906  affine.tx=0.0;
1907  affine.ty=0.0;
1908 
1909  current=drawInfo->affine;
1910  affine.sx=cos(DegreesToRadians(fmod(degrees_,360.0)));
1911  affine.rx=sin(DegreesToRadians(fmod(degrees_,360.0)));
1912  affine.ry=(-sin(DegreesToRadians(fmod(degrees_,360.0))));
1913  affine.sy=cos(DegreesToRadians(fmod(degrees_,360.0)));
1914 
1915  drawInfo->affine.sx=current.sx*affine.sx+current.ry*affine.rx;
1916  drawInfo->affine.rx=current.rx*affine.sx+current.sy*affine.rx;
1917  drawInfo->affine.ry=current.sx*affine.ry+current.ry*affine.sy;
1918  drawInfo->affine.sy=current.rx*affine.ry+current.sy*affine.sy;
1919  drawInfo->affine.tx=current.sx*affine.tx+current.ry*affine.ty
1920  +current.tx;
1921  }
1922 
1924  AnnotateImage(image(),drawInfo,exceptionInfo);
1925 
1926  // Restore original values
1927  drawInfo->affine=oaffine;
1928  drawInfo->text=(char *) NULL;
1929  drawInfo->geometry=(char *) NULL;
1930 
1932 }
1933 
1934 void Magick::Image::annotate(const std::string &text_,
1935  const GravityType gravity_)
1936 {
1937  DrawInfo
1938  *drawInfo;
1939 
1940  modifyImage();
1941 
1942  drawInfo=options()->drawInfo();
1943  drawInfo->text=DestroyString(drawInfo->text);
1944  drawInfo->text=const_cast<char *>(text_.c_str());
1945  drawInfo->gravity=gravity_;
1946 
1948  AnnotateImage(image(),drawInfo,exceptionInfo);
1949 
1950  drawInfo->gravity=NorthWestGravity;
1951  drawInfo->text=(char *) NULL;
1952 
1954 }
1955 
1956 void Magick::Image::artifact(const std::string &name_,const std::string &value_)
1957 {
1958  modifyImage();
1959  (void) SetImageArtifact(image(),name_.c_str(),value_.c_str());
1960 }
1961 
1962 std::string Magick::Image::artifact(const std::string &name_) const
1963 {
1964  const char
1965  *value;
1966 
1967  value=GetImageArtifact(constImage(),name_.c_str());
1968  if (value)
1969  return(std::string(value));
1970  return(std::string());
1971 }
1972 
1973 void Magick::Image::attribute(const std::string name_,const char *value_)
1974 {
1975  modifyImage();
1977  SetImageProperty(image(),name_.c_str(),value_,exceptionInfo);
1979 }
1980 
1981 void Magick::Image::attribute(const std::string name_,const std::string value_)
1982 {
1983  modifyImage();
1985  SetImageProperty(image(),name_.c_str(),value_.c_str(),exceptionInfo);
1987 }
1988 
1989 std::string Magick::Image::attribute(const std::string name_) const
1990 {
1991  const char
1992  *value;
1993 
1995  value=GetImageProperty(constImage(),name_.c_str(),exceptionInfo);
1997 
1998  if (value)
1999  return(std::string(value));
2000 
2001  return(std::string()); // Intentionally no exception
2002 }
2003 
2005 {
2006  modifyImage();
2008  (void) SyncImageSettings(imageInfo(),image(),exceptionInfo);
2009  (void) AutoGammaImage(image(),exceptionInfo);
2011 }
2012 
2013 void Magick::Image::autoGammaChannel(const ChannelType channel_)
2014 {
2015  modifyImage();
2017  GetAndSetPPChannelMask(channel_);
2018  (void) SyncImageSettings(imageInfo(),image(),exceptionInfo);
2019  (void) AutoGammaImage(image(),exceptionInfo);
2022 }
2023 
2025 {
2026  modifyImage();
2028  (void) AutoLevelImage(image(),exceptionInfo);
2030 }
2031 
2032 void Magick::Image::autoLevelChannel(const ChannelType channel_)
2033 {
2034  modifyImage();
2036  GetAndSetPPChannelMask(channel_);
2037  (void) AutoLevelImage(image(),exceptionInfo);
2040 }
2041 
2043 {
2045  *newImage;
2046 
2047  if (image()->orientation == UndefinedOrientation ||
2048  image()->orientation == TopLeftOrientation)
2049  return;
2050 
2052  newImage=AutoOrientImage(constImage(),image()->orientation,exceptionInfo);
2053  replaceImage(newImage);
2055 }
2056 
2057 void Magick::Image::autoThreshold(const AutoThresholdMethod method_)
2058 {
2059  modifyImage();
2061  AutoThresholdImage(image(),method_, exceptionInfo);
2063 }
2064 
2065 void Magick::Image::blackThreshold(const std::string &threshold_)
2066 {
2067  modifyImage();
2069  BlackThresholdImage(image(),threshold_.c_str(),exceptionInfo);
2071 }
2072 
2073 void Magick::Image::blackThresholdChannel(const ChannelType channel_,
2074  const std::string &threshold_)
2075 {
2076  modifyImage();
2078  GetAndSetPPChannelMask(channel_);
2079  BlackThresholdImage(image(),threshold_.c_str(),exceptionInfo);
2082 }
2083 
2084 void Magick::Image::blueShift(const double factor_)
2085 {
2087  *newImage;
2088 
2090  newImage=BlueShiftImage(constImage(),factor_,exceptionInfo);
2091  replaceImage(newImage);
2093 }
2094 
2095 void Magick::Image::blur(const double radius_,const double sigma_)
2096 {
2098  *newImage;
2099 
2101  newImage=BlurImage(constImage(),radius_,sigma_,exceptionInfo);
2102  replaceImage(newImage);
2104 }
2105 
2106 void Magick::Image::blurChannel(const ChannelType channel_,
2107  const double radius_,const double sigma_)
2108 {
2110  *newImage;
2111 
2113  GetAndSetPPChannelMask(channel_);
2114  newImage=BlurImage(constImage(),radius_,sigma_,exceptionInfo);
2116  replaceImage(newImage);
2118 }
2119 
2120 void Magick::Image::border(const Geometry &geometry_)
2121 {
2123  *newImage;
2124 
2125  RectangleInfo
2126  borderInfo=geometry_;
2127 
2129  newImage=BorderImage(constImage(),&borderInfo,image()->compose,
2130  exceptionInfo);
2131  replaceImage(newImage);
2133 }
2134 
2135 void Magick::Image::brightnessContrast(const double brightness_,
2136  const double contrast_)
2137 {
2138  modifyImage();
2140  BrightnessContrastImage(image(),brightness_,contrast_,exceptionInfo);
2142 }
2143 
2144 void Magick::Image::brightnessContrastChannel(const ChannelType channel_,
2145  const double brightness_,const double contrast_)
2146 {
2147  modifyImage();
2149  GetAndSetPPChannelMask(channel_);
2150  BrightnessContrastImage(image(),brightness_,contrast_,exceptionInfo);
2153 }
2154 
2155 void Magick::Image::cannyEdge(const double radius_,const double sigma_,
2156  const double lowerPercent_,const double upperPercent_)
2157 {
2159  *newImage;
2160 
2161  modifyImage();
2163  newImage=CannyEdgeImage(constImage(),radius_,sigma_,lowerPercent_,
2164  upperPercent_,exceptionInfo);
2165  replaceImage(newImage);
2167 }
2168 
2169 void Magick::Image::cdl(const std::string &cdl_)
2170 {
2171  modifyImage();
2173  (void) ColorDecisionListImage(image(),cdl_.c_str(),exceptionInfo);
2175 }
2176 
2177 void Magick::Image::channel(const ChannelType channel_)
2178 {
2180  *newImage;
2181 
2183  newImage=SeparateImage(image(),channel_,exceptionInfo);
2184  replaceImage(newImage);
2186 }
2187 
2188 void Magick::Image::charcoal(const double radius_,const double sigma_)
2189 {
2191  *newImage;
2192 
2194  newImage=CharcoalImage(image(),radius_,sigma_,exceptionInfo);
2195  replaceImage(newImage);
2197 }
2198 
2199 void Magick::Image::charcoalChannel(const ChannelType channel_,
2200  const double radius_,const double sigma_)
2201 {
2203  *newImage;
2204 
2206  GetAndSetPPChannelMask(channel_);
2207  newImage=CharcoalImage(image(),radius_,sigma_,exceptionInfo);
2209  replaceImage(newImage);
2211 }
2212 
2213 void Magick::Image::chop(const Geometry &geometry_)
2214 {
2216  *newImage;
2217 
2218  RectangleInfo
2219  chopInfo=geometry_;
2220 
2222  newImage=ChopImage(image(),&chopInfo,exceptionInfo);
2223  replaceImage(newImage);
2225 }
2226 
2227 void Magick::Image::chromaBluePrimary(const double x_,const double y_,
2228  const double z_)
2229 {
2230  modifyImage();
2231  image()->chromaticity.blue_primary.x=x_;
2232  image()->chromaticity.blue_primary.y=y_;
2233  image()->chromaticity.blue_primary.z=z_;
2234 }
2235 
2236 void Magick::Image::chromaBluePrimary(double *x_,double *y_,double *z_) const
2237 {
2238  *x_=constImage()->chromaticity.blue_primary.x;
2239  *y_=constImage()->chromaticity.blue_primary.y;
2240  *z_=constImage()->chromaticity.blue_primary.z;
2241 }
2242 
2243 void Magick::Image::chromaGreenPrimary(const double x_,const double y_,
2244  const double z_)
2245 {
2246  modifyImage();
2247  image()->chromaticity.green_primary.x=x_;
2248  image()->chromaticity.green_primary.y=y_;
2249  image()->chromaticity.green_primary.z=z_;
2250 }
2251 
2252 void Magick::Image::chromaGreenPrimary(double *x_,double *y_,double *z_) const
2253 {
2254  *x_=constImage()->chromaticity.green_primary.x;
2255  *y_=constImage()->chromaticity.green_primary.y;
2256  *z_=constImage()->chromaticity.green_primary.z;
2257 }
2258 
2259 void Magick::Image::chromaRedPrimary(const double x_,const double y_,
2260  const double z_)
2261 {
2262  modifyImage();
2263  image()->chromaticity.red_primary.x=x_;
2264  image()->chromaticity.red_primary.y=y_;
2265  image()->chromaticity.red_primary.z=z_;
2266 }
2267 
2268 void Magick::Image::chromaRedPrimary(double *x_,double *y_,double *z_) const
2269 {
2270  *x_=constImage()->chromaticity.red_primary.x;
2271  *y_=constImage()->chromaticity.red_primary.y;
2272  *z_=constImage()->chromaticity.red_primary.z;
2273 }
2274 
2275 void Magick::Image::chromaWhitePoint(const double x_,const double y_,
2276  const double z_)
2277 {
2278  modifyImage();
2279  image()->chromaticity.white_point.x=x_;
2280  image()->chromaticity.white_point.y=y_;
2281  image()->chromaticity.white_point.z=z_;
2282 }
2283 
2284 void Magick::Image::chromaWhitePoint(double *x_,double *y_,double *z_) const
2285 {
2286  *x_=constImage()->chromaticity.white_point.x;
2287  *y_=constImage()->chromaticity.white_point.y;
2288  *z_=constImage()->chromaticity.white_point.z;
2289 }
2290 
2292 {
2293  modifyImage();
2295  ClampImage(image(),exceptionInfo);
2297 }
2298 
2299 void Magick::Image::clampChannel(const ChannelType channel_)
2300 {
2301  modifyImage();
2303  GetAndSetPPChannelMask(channel_);
2304  ClampImage(image(),exceptionInfo);
2307 }
2308 
2310 {
2311  modifyImage();
2313  ClipImage(image(),exceptionInfo);
2315 }
2316 
2317 void Magick::Image::clipPath(const std::string pathname_,const bool inside_)
2318 {
2319  modifyImage();
2321  ClipImagePath(image(),pathname_.c_str(),(MagickBooleanType) inside_,
2322  exceptionInfo);
2324 }
2325 
2326 void Magick::Image::clut(const Image &clutImage_,
2327  const PixelInterpolateMethod method)
2328 {
2329  modifyImage();
2331  ClutImage(image(),clutImage_.constImage(),method,exceptionInfo);
2333 }
2334 
2335 void Magick::Image::clutChannel(const ChannelType channel_,
2336  const Image &clutImage_,const PixelInterpolateMethod method)
2337 {
2338  modifyImage();
2340  GetAndSetPPChannelMask(channel_);
2341  ClutImage(image(),clutImage_.constImage(),method,exceptionInfo);
2344 }
2345 
2346 void Magick::Image::colorize(const unsigned int alpha_,const Color &penColor_)
2347 {
2348  colorize(alpha_,alpha_,alpha_,penColor_);
2349 }
2350 
2351 void Magick::Image::colorize(const unsigned int alphaRed_,
2352  const unsigned int alphaGreen_,const unsigned int alphaBlue_,
2353  const Color &penColor_)
2354 {
2355  char
2356  blend[MagickPathExtent];
2357 
2359  *newImage;
2360 
2361  PixelInfo
2362  target;
2363 
2364  if (!penColor_.isValid())
2365  throwExceptionExplicit(MagickCore::OptionError,
2366  "Pen color argument is invalid");
2367 
2368  FormatLocaleString(blend,MagickPathExtent,"%u/%u/%u",alphaRed_,alphaGreen_,
2369  alphaBlue_);
2370 
2371  target=static_cast<PixelInfo>(penColor_);
2373  newImage=ColorizeImage(image(),blend,&target,exceptionInfo);
2374  replaceImage(newImage);
2376 }
2377 
2378 void Magick::Image::colorMap(const size_t index_,const Color &color_)
2379 {
2381  *imageptr;
2382 
2383  imageptr=image();
2384 
2385  if (index_ > (MaxColormapSize-1))
2386  throwExceptionExplicit(MagickCore::OptionError,
2387  "Colormap index must be less than MaxColormapSize");
2388 
2389  if (!color_.isValid())
2390  throwExceptionExplicit(MagickCore::OptionError,
2391  "Color argument is invalid");
2392 
2393  modifyImage();
2394 
2395  // Ensure that colormap size is large enough
2396  if (colorMapSize() < (index_+1))
2397  colorMapSize(index_+1);
2398 
2399  // Set color at index in colormap
2400  (imageptr->colormap)[index_]=color_;
2401 }
2402 
2403 Magick::Color Magick::Image::colorMap(const size_t index_) const
2404 {
2405  if (!constImage()->colormap)
2406  {
2407  throwExceptionExplicit(MagickCore::OptionError,
2408  "Image does not contain a colormap");
2409  return(Color());
2410  }
2411 
2412  if (index_ > constImage()->colors-1)
2413  throwExceptionExplicit(MagickCore::OptionError,"Index out of range");
2414 
2415  return(Magick::Color((constImage()->colormap)[index_]));
2416 }
2417 
2418 void Magick::Image::colorMatrix(const size_t order_,
2419  const double *color_matrix_)
2420 {
2421  KernelInfo
2422  *kernel_info;
2423 
2425  kernel_info=AcquireKernelInfo((const char *) NULL,exceptionInfo);
2426  if (kernel_info != (KernelInfo *) NULL)
2427  {
2428  kernel_info->width=order_;
2429  kernel_info->height=order_;
2430  kernel_info->values=(MagickRealType *) AcquireAlignedMemory(order_,
2431  order_*sizeof(*kernel_info->values));
2432  if (kernel_info->values != (MagickRealType *) NULL)
2433  {
2435  *newImage;
2436 
2437  for (ssize_t i=0; i < (ssize_t) (order_*order_); i++)
2438  kernel_info->values[i]=color_matrix_[i];
2439  newImage=ColorMatrixImage(image(),kernel_info,exceptionInfo);
2440  replaceImage(newImage);
2441  }
2442  kernel_info=DestroyKernelInfo(kernel_info);
2443  }
2445 }
2446 
2447 bool Magick::Image::compare(const Image &reference_) const
2448 {
2449  bool
2450  status;
2451 
2452  Image
2453  ref=reference_;
2454 
2456  status=static_cast<bool>(IsImagesEqual(constImage(),ref.constImage(),
2457  exceptionInfo));
2459  return(status);
2460 }
2461 
2462 double Magick::Image::compare(const Image &reference_,const MetricType metric_)
2463 {
2464  double
2465  distortion=0.0;
2466 
2468  GetImageDistortion(image(),reference_.constImage(),metric_,&distortion,
2469  exceptionInfo);
2471  return(distortion);
2472 }
2473 
2474 double Magick::Image::compareChannel(const ChannelType channel_,
2475  const Image &reference_,const MetricType metric_)
2476 {
2477  double
2478  distortion=0.0;
2479 
2481  GetAndSetPPChannelMask(channel_);
2482  GetImageDistortion(image(),reference_.constImage(),metric_,&distortion,
2483  exceptionInfo);
2486  return(distortion);
2487 }
2488 
2490  const MetricType metric_,double *distortion)
2491 {
2493  *newImage;
2494 
2496  newImage=CompareImages(image(),reference_.constImage(),metric_,distortion,
2497  exceptionInfo);
2499  if (newImage == (MagickCore::Image *) NULL)
2500  return(Magick::Image());
2501  else
2502  return(Magick::Image(newImage));
2503 }
2504 
2506  const Image &reference_,const MetricType metric_,double *distortion)
2507 {
2509  *newImage;
2510 
2512  GetAndSetPPChannelMask(channel_);
2513  newImage=CompareImages(image(),reference_.constImage(),metric_,distortion,
2514  exceptionInfo);
2517  if (newImage == (MagickCore::Image *) NULL)
2518  return(Magick::Image());
2519  else
2520  return(Magick::Image(newImage));
2521 }
2522 
2523 void Magick::Image::composite(const Image &compositeImage_,
2524  const Geometry &offset_,const CompositeOperator compose_)
2525 {
2526  size_t
2527  height=rows(),
2528  width=columns();
2529 
2530  ssize_t
2531  x=offset_.xOff(),
2532  y=offset_.yOff();
2533 
2534  ParseMetaGeometry(static_cast<std::string>(offset_).c_str(),&x,&y,&width,
2535  &height);
2536 
2537  modifyImage();
2539  CompositeImage(image(),compositeImage_.constImage(),compose_,MagickTrue,
2540  x,y,exceptionInfo);
2542 }
2543 
2544 void Magick::Image::composite(const Image &compositeImage_,
2545  const GravityType gravity_,const CompositeOperator compose_)
2546 {
2547  RectangleInfo
2548  geometry;
2549 
2550  modifyImage();
2551  SetGeometry(compositeImage_.constImage(),&geometry);
2552  GravityAdjustGeometry(columns(),rows(),gravity_,&geometry);
2553 
2555  CompositeImage(image(),compositeImage_.constImage(),compose_,MagickTrue,
2556  geometry.x,geometry.y,exceptionInfo);
2558 }
2559 
2560 void Magick::Image::composite(const Image &compositeImage_,
2561  const ssize_t xOffset_,const ssize_t yOffset_,
2562  const CompositeOperator compose_)
2563 {
2564  // Image supplied as compositeImage is composited with current image and
2565  // results in updating current image.
2566  modifyImage();
2568  CompositeImage(image(),compositeImage_.constImage(),compose_,MagickTrue,
2569  xOffset_,yOffset_,exceptionInfo);
2571 }
2572 
2573 void Magick::Image::connectedComponents(const size_t connectivity_)
2574 {
2576  *newImage;
2577 
2579  newImage=ConnectedComponentsImage(constImage(),connectivity_,
2580  (CCObjectInfo **) NULL,exceptionInfo);
2581  replaceImage(newImage);
2583 }
2584 
2585 void Magick::Image::contrast(const bool sharpen_)
2586 {
2587  modifyImage();
2589  ContrastImage(image(),(MagickBooleanType) sharpen_,exceptionInfo);
2591 }
2592 
2593 void Magick::Image::contrastStretch(const double blackPoint_,
2594  const double whitePoint_)
2595 {
2596  modifyImage();
2598  ContrastStretchImage(image(),blackPoint_,whitePoint_,exceptionInfo);
2600 }
2601 
2602 void Magick::Image::contrastStretchChannel(const ChannelType channel_,
2603  const double blackPoint_,const double whitePoint_)
2604 {
2605  modifyImage();
2607  GetAndSetPPChannelMask(channel_);
2608  ContrastStretchImage(image(),blackPoint_,whitePoint_,exceptionInfo);
2611 }
2612 
2613 void Magick::Image::convolve(const size_t order_,const double *kernel_)
2614 {
2615  KernelInfo
2616  *kernel_info;
2617 
2619  kernel_info=AcquireKernelInfo((const char *) NULL,exceptionInfo);
2620  kernel_info->width=order_;
2621  kernel_info->height=order_;
2622  kernel_info->x=(ssize_t) (order_-1)/2;
2623  kernel_info->y=(ssize_t) (order_-1)/2;
2624  kernel_info->values=(MagickRealType *) AcquireAlignedMemory(order_,
2625  order_*sizeof(*kernel_info->values));
2626  if (kernel_info->values != (MagickRealType *) NULL)
2627  {
2629  *newImage;
2630 
2631  for (ssize_t i=0; i < (ssize_t) (order_*order_); i++)
2632  kernel_info->values[i]=kernel_[i];
2633  newImage=ConvolveImage(image(),kernel_info,exceptionInfo);
2634  replaceImage(newImage);
2635  }
2636  kernel_info=DestroyKernelInfo(kernel_info);
2638 }
2639 
2640 void Magick::Image::copyPixels(const Image &source_,const Geometry &geometry_,
2641  const Offset &offset_)
2642 {
2643  const OffsetInfo
2644  offset=offset_;
2645 
2646  const RectangleInfo
2647  geometry=geometry_;
2648 
2650  (void) CopyImagePixels(image(),source_.constImage(),&geometry,&offset,
2651  exceptionInfo);
2653 }
2654 
2655 void Magick::Image::crop(const Geometry &geometry_)
2656 {
2658  *newImage;
2659 
2660  RectangleInfo
2661  cropInfo=geometry_;
2662 
2664  newImage=CropImage(constImage(),&cropInfo,exceptionInfo);
2665  replaceImage(newImage);
2667 }
2668 
2669 void Magick::Image::cycleColormap(const ssize_t amount_)
2670 {
2671  modifyImage();
2673  CycleColormapImage(image(),amount_,exceptionInfo);
2675 }
2676 
2677 void Magick::Image::decipher(const std::string &passphrase_)
2678 {
2679  modifyImage();
2681  DecipherImage(image(),passphrase_.c_str(),exceptionInfo);
2683 }
2684 
2685 void Magick::Image::defineSet(const std::string &magick_,
2686  const std::string &key_,bool flag_)
2687 {
2688  std::string
2689  definition;
2690 
2691  modifyImage();
2692  definition=magick_ + ":" + key_;
2693  if (flag_)
2694  (void) SetImageOption(imageInfo(),definition.c_str(),"");
2695  else
2696  DeleteImageOption(imageInfo(),definition.c_str());
2697 }
2698 
2699 bool Magick::Image::defineSet(const std::string &magick_,
2700  const std::string &key_ ) const
2701 {
2702  const char
2703  *option;
2704 
2705  std::string
2706  key;
2707 
2708  key=magick_ + ":" + key_;
2709  option=GetImageOption(constImageInfo(),key.c_str());
2710  if (option)
2711  return(true);
2712  return(false);
2713 }
2714 
2715 void Magick::Image::defineValue(const std::string &magick_,
2716  const std::string &key_,const std::string &value_)
2717 {
2718  std::string
2719  format,
2720  option;
2721 
2722  modifyImage();
2723  format=magick_ + ":" + key_;
2724  option=value_;
2725  (void) SetImageOption(imageInfo(),format.c_str(),option.c_str());
2726 }
2727 
2728 std::string Magick::Image::defineValue(const std::string &magick_,
2729  const std::string &key_) const
2730 {
2731  const char
2732  *option;
2733 
2734  std::string
2735  definition;
2736 
2737  definition=magick_ + ":" + key_;
2738  option=GetImageOption(constImageInfo(),definition.c_str());
2739  if (option)
2740  return(std::string(option));
2741  return(std::string());
2742 }
2743 
2744 void Magick::Image::deskew(const double threshold_)
2745 {
2747  *newImage;
2748 
2750  newImage=DeskewImage(constImage(),threshold_,exceptionInfo);
2751  replaceImage(newImage);
2753 }
2754 
2756 {
2758  *newImage;
2759 
2761  newImage=DespeckleImage(constImage(),exceptionInfo);
2762  replaceImage(newImage);
2764 }
2765 
2767 {
2769  DisplayImages(imageInfo(),image(),exceptionInfo);
2771 }
2772 
2773 void Magick::Image::distort(const DistortMethod method_,
2774  const size_t numberArguments_,const double *arguments_,const bool bestfit_)
2775 {
2777  *newImage;
2778 
2780  newImage=DistortImage(constImage(), method_,numberArguments_,arguments_,
2781  bestfit_ == true ? MagickTrue : MagickFalse,exceptionInfo);
2782  replaceImage(newImage);
2784 }
2785 
2787 {
2788  DrawingWand
2789  *wand;
2790 
2791  modifyImage();
2792 
2793  wand=AcquireDrawingWand(options()->drawInfo(),image());
2794 
2795  if(wand)
2796  {
2797  drawable_.operator()(wand);
2798 
2799  DrawRender(wand);
2800 
2801  ClonePPDrawException(wand);
2802  wand=DestroyDrawingWand(wand);
2804  }
2805 }
2806 
2807 void Magick::Image::draw(const std::vector<Magick::Drawable> &drawable_)
2808 {
2809  DrawingWand
2810  *wand;
2811 
2812  modifyImage();
2813 
2814  wand= AcquireDrawingWand(options()->drawInfo(),image());
2815 
2816  if(wand)
2817  {
2818  for (std::vector<Magick::Drawable>::const_iterator p = drawable_.begin();
2819  p != drawable_.end(); p++ )
2820  {
2821  p->operator()(wand);
2822  if (DrawGetExceptionType(wand) != MagickCore::UndefinedException)
2823  break;
2824  }
2825 
2826  if (DrawGetExceptionType(wand) == MagickCore::UndefinedException)
2827  DrawRender(wand);
2828 
2829  ClonePPDrawException(wand);
2830  wand=DestroyDrawingWand(wand);
2832  }
2833 }
2834 
2835 void Magick::Image::edge(const double radius_)
2836 {
2838  *newImage;
2839 
2841  newImage=EdgeImage(constImage(),radius_,exceptionInfo);
2842  replaceImage(newImage);
2844 }
2845 
2846 void Magick::Image::emboss(const double radius_,const double sigma_)
2847 {
2849  *newImage;
2850 
2852  newImage=EmbossImage(constImage(),radius_,sigma_,exceptionInfo);
2853  replaceImage(newImage);
2855 }
2856 
2857 void Magick::Image::encipher(const std::string &passphrase_)
2858 {
2859  modifyImage();
2861  EncipherImage(image(),passphrase_.c_str(),exceptionInfo);
2863 }
2864 
2866 {
2868  *newImage;
2869 
2871  newImage=EnhanceImage(constImage(),exceptionInfo);
2872  replaceImage(newImage);
2874 }
2875 
2877 {
2878  modifyImage();
2880  EqualizeImage(image(),exceptionInfo);
2882 }
2883 
2885 {
2886  modifyImage();
2888  (void) SetImageBackgroundColor(image(),exceptionInfo);
2890 }
2891 
2892 void Magick::Image::evaluate(const ChannelType channel_,
2893  const MagickEvaluateOperator operator_,double rvalue_)
2894 {
2896  GetAndSetPPChannelMask(channel_);
2897  EvaluateImage(image(),operator_,rvalue_,exceptionInfo);
2900 }
2901 
2902 void Magick::Image::evaluate(const ChannelType channel_,
2903  const MagickFunction function_,const size_t number_parameters_,
2904  const double *parameters_)
2905 {
2907  GetAndSetPPChannelMask(channel_);
2908  FunctionImage(image(),function_,number_parameters_,parameters_,
2909  exceptionInfo);
2912 }
2913 
2914 void Magick::Image::evaluate(const ChannelType channel_,const ssize_t x_,
2915  const ssize_t y_,const size_t columns_,const size_t rows_,
2916  const MagickEvaluateOperator operator_,const double rvalue_)
2917 {
2918  RectangleInfo
2919  geometry;
2920 
2922  *cropImage;
2923 
2924  geometry.width = columns_;
2925  geometry.height = rows_;
2926  geometry.x = x_;
2927  geometry.y = y_;
2928 
2930  cropImage=CropImage(image(),&geometry,exceptionInfo);
2931  GetAndSetPPChannelMask(channel_);
2932  EvaluateImage(cropImage,operator_,rvalue_,exceptionInfo);
2934  (void) CompositeImage(image(),cropImage,image()->alpha_trait ==
2935  BlendPixelTrait ? OverCompositeOp : CopyCompositeOp,MagickFalse,
2936  geometry.x,geometry.y,exceptionInfo );
2937  cropImage=DestroyImageList(cropImage);
2939 }
2940 
2941 void Magick::Image::extent(const Geometry &geometry_ )
2942 {
2944  *newImage;
2945 
2946  RectangleInfo
2947  extentInfo=geometry_;
2948 
2949  modifyImage();
2950  extentInfo.x=geometry_.xOff();
2951  extentInfo.y=geometry_.yOff();
2953  newImage=ExtentImage(image(),&extentInfo,exceptionInfo);
2954  replaceImage(newImage);
2956 }
2957 
2958 void Magick::Image::extent(const Geometry &geometry_,
2959  const Color &backgroundColor_)
2960 {
2961  backgroundColor(backgroundColor_);
2962  extent(geometry_);
2963 }
2964 
2965 void Magick::Image::extent(const Geometry &geometry_,
2966  const Color &backgroundColor_,const GravityType gravity_)
2967 {
2968  backgroundColor(backgroundColor_);
2969  extent(geometry_,gravity_);
2970 }
2971 
2972 void Magick::Image::extent(const Geometry &geometry_,
2973  const GravityType gravity_)
2974 {
2975  RectangleInfo
2976  geometry;
2977 
2978  SetGeometry(image(),&geometry);
2979  geometry.width=geometry_.width();
2980  geometry.height=geometry_.height();
2981  GravityAdjustGeometry(image()->columns,image()->rows,gravity_,&geometry);
2982  extent(geometry);
2983 }
2984 
2986 {
2988  *newImage;
2989 
2991  newImage=FlipImage(constImage(),exceptionInfo);
2992  replaceImage(newImage);
2994 }
2995 
2996 void Magick::Image::floodFillAlpha(const ssize_t x_,const ssize_t y_,
2997  const unsigned int alpha_,const bool invert_)
2998 {
2999  PixelInfo
3000  target;
3001 
3002  modifyImage();
3003 
3004  target=static_cast<PixelInfo>(pixelColor(x_,y_));
3005  target.alpha=alpha_;
3007  GetAndSetPPChannelMask(AlphaChannel);
3008  FloodfillPaintImage(image(),options()->drawInfo(),&target,x_,y_,
3009  (MagickBooleanType)invert_,exceptionInfo);
3012 }
3013 
3014 void Magick::Image::floodFillAlpha(const ssize_t x_,const ssize_t y_,
3015  const unsigned int alpha_,const Color &target_,const bool invert_)
3016 {
3017  PixelInfo
3018  target;
3019 
3020  modifyImage();
3021 
3022  target=static_cast<PixelInfo>(target_);
3023  target.alpha=alpha_;
3025  GetAndSetPPChannelMask(AlphaChannel);
3026  FloodfillPaintImage(image(),options()->drawInfo(),&target,x_,y_,
3027  (MagickBooleanType)invert_,exceptionInfo);
3030 }
3031 
3033  const Magick::Color &fillColor_,const bool invert_)
3034 {
3035  floodFillColor(point_.xOff(),point_.yOff(),fillColor_,invert_);
3036 }
3037 
3038 void Magick::Image::floodFillColor(const ssize_t x_,const ssize_t y_,
3039  const Magick::Color &fillColor_,const bool invert_)
3040 {
3041  PixelInfo
3042  pixel;
3043 
3044  modifyImage();
3045 
3046  pixel=static_cast<PixelInfo>(pixelColor(x_,y_));
3047  floodFill(x_,y_,(Magick::Image *)NULL,fillColor_,&pixel,invert_);
3048 }
3049 
3051  const Magick::Color &fillColor_,const Magick::Color &borderColor_,
3052  const bool invert_)
3053 {
3054  floodFillColor(point_.xOff(),point_.yOff(),fillColor_,borderColor_,invert_);
3055 }
3056 
3057 void Magick::Image::floodFillColor(const ssize_t x_,const ssize_t y_,
3058  const Magick::Color &fillColor_,const Magick::Color &borderColor_,
3059  const bool invert_)
3060 {
3061  PixelInfo
3062  pixel;
3063 
3064  modifyImage();
3065 
3066  pixel=static_cast<PixelInfo>(borderColor_);
3067  floodFill(x_,y_,(Magick::Image *)NULL,fillColor_,&pixel,invert_);
3068 }
3069 
3071  const Magick::Image &texture_,const bool invert_)
3072 {
3073  floodFillTexture(point_.xOff(),point_.yOff(),texture_,invert_);
3074 }
3075 
3076 void Magick::Image::floodFillTexture(const ssize_t x_,const ssize_t y_,
3077  const Magick::Image &texture_,const bool invert_)
3078 {
3079  PixelInfo
3080  pixel;
3081 
3082  modifyImage();
3083 
3084  pixel=static_cast<PixelInfo>(pixelColor(x_,y_));
3085  floodFill(x_,y_,&texture_,Magick::Color(),&pixel,invert_);
3086 }
3087 
3089  const Magick::Image &texture_,const Magick::Color &borderColor_,
3090  const bool invert_)
3091 {
3092  floodFillTexture(point_.xOff(),point_.yOff(),texture_,borderColor_,invert_);
3093 }
3094 
3095 void Magick::Image::floodFillTexture(const ssize_t x_,const ssize_t y_,
3096  const Magick::Image &texture_,const Magick::Color &borderColor_,
3097  const bool invert_)
3098 {
3099  PixelInfo
3100  pixel;
3101 
3102  modifyImage();
3103 
3104  pixel=static_cast<PixelInfo>(borderColor_);
3105  floodFill(x_,y_,&texture_,Magick::Color(),&pixel,invert_);
3106 }
3107 
3109 {
3111  *newImage;
3112 
3114  newImage=FlopImage(constImage(),exceptionInfo);
3115  replaceImage(newImage);
3117 }
3118 
3119 void Magick::Image::fontTypeMetrics(const std::string &text_,
3120  TypeMetric *metrics)
3121 {
3122  DrawInfo
3123  *drawInfo;
3124 
3125  drawInfo=options()->drawInfo();
3126  drawInfo->text=const_cast<char *>(text_.c_str());
3128  GetTypeMetrics(image(),drawInfo,&(metrics->_typeMetric),exceptionInfo);
3129  drawInfo->text=0;
3131 }
3132 
3133 void Magick::Image::fontTypeMetricsMultiline(const std::string &text_,
3134  TypeMetric *metrics)
3135 {
3136  DrawInfo
3137  *drawInfo;
3138 
3139  drawInfo=options()->drawInfo();
3140  drawInfo->text=const_cast<char *>(text_.c_str());
3142  GetMultilineTypeMetrics(image(),drawInfo,&(metrics->_typeMetric),exceptionInfo);
3143  drawInfo->text=0;
3145 }
3146 
3147 void Magick::Image::frame(const Geometry &geometry_)
3148 {
3149  FrameInfo
3150  info;
3151 
3153  *newImage;
3154 
3155  info.x=static_cast<ssize_t>(geometry_.width());
3156  info.y=static_cast<ssize_t>(geometry_.height());
3157  info.width=columns() + (static_cast<size_t>(info.x) << 1);
3158  info.height=rows() + (static_cast<size_t>(info.y) << 1);
3159  info.outer_bevel=geometry_.xOff();
3160  info.inner_bevel=geometry_.yOff();
3161 
3163  newImage=FrameImage(constImage(),&info,image()->compose,exceptionInfo);
3164  replaceImage(newImage);
3166 }
3167 
3168 void Magick::Image::frame(const size_t width_,const size_t height_,
3169  const ssize_t innerBevel_,const ssize_t outerBevel_)
3170 {
3171  FrameInfo
3172  info;
3173 
3175  *newImage;
3176 
3177  info.x=static_cast<ssize_t>(width_);
3178  info.y=static_cast<ssize_t>(height_);
3179  info.width=columns() + (static_cast<size_t>(info.x) << 1);
3180  info.height=rows() + (static_cast<size_t>(info.y) << 1);
3181  info.outer_bevel=static_cast<ssize_t>(outerBevel_);
3182  info.inner_bevel=static_cast<ssize_t>(innerBevel_);
3183 
3185  newImage=FrameImage(constImage(),&info,image()->compose,exceptionInfo);
3186  replaceImage(newImage);
3188 }
3189 
3190 void Magick::Image::fx(const std::string expression_)
3191 {
3193  *newImage;
3194 
3196  newImage=FxImage(constImage(),expression_.c_str(),exceptionInfo);
3197  replaceImage(newImage);
3199 }
3200 
3201 void Magick::Image::fx(const std::string expression_,
3202  const Magick::ChannelType channel_)
3203 {
3205  *newImage;
3206 
3208  GetAndSetPPChannelMask(channel_);
3209  newImage=FxImage(constImage(),expression_.c_str(),exceptionInfo);
3211  replaceImage(newImage);
3213 }
3214 
3215 void Magick::Image::gamma(const double gamma_)
3216 {
3217  modifyImage();
3219  GammaImage(image(),gamma_,exceptionInfo);
3221 }
3222 
3223 void Magick::Image::gamma(const double gammaRed_,const double gammaGreen_,
3224  const double gammaBlue_)
3225 {
3226  modifyImage();
3228  GetAndSetPPChannelMask(RedChannel);
3229  (void) GammaImage(image(),gammaRed_,exceptionInfo);
3230  SetPPChannelMask(GreenChannel);
3231  (void) GammaImage(image(),gammaGreen_,exceptionInfo);
3232  SetPPChannelMask(BlueChannel);
3233  (void) GammaImage(image(),gammaBlue_,exceptionInfo);
3236 }
3237 
3238 void Magick::Image::gaussianBlur(const double radius_,const double sigma_)
3239 {
3241  *newImage;
3242 
3244  newImage=GaussianBlurImage(constImage(),radius_,sigma_,exceptionInfo);
3245  replaceImage(newImage);
3247 }
3248 
3249 void Magick::Image::gaussianBlurChannel(const ChannelType channel_,
3250  const double radius_,const double sigma_)
3251 {
3253  *newImage;
3254 
3256  GetAndSetPPChannelMask(channel_);
3257  newImage=GaussianBlurImage(constImage(),radius_,sigma_,exceptionInfo);
3259  replaceImage(newImage);
3261 }
3262 
3263 const Magick::Quantum *Magick::Image::getConstPixels(const ssize_t x_,
3264  const ssize_t y_,const size_t columns_,const size_t rows_) const
3265 {
3266  const Quantum
3267  *p;
3268 
3270  p=GetVirtualPixels(constImage(),x_, y_,columns_, rows_,exceptionInfo);
3272  return(p);
3273 }
3274 
3275 const void *Magick::Image::getConstMetacontent(void) const
3276 {
3277  const void
3278  *result;
3279 
3280  result=GetVirtualMetacontent(constImage());
3281 
3282  if(!result)
3283  throwExceptionExplicit(MagickCore::OptionError,
3284  "Unable to retrieve meta content.");
3285 
3286  return(result);
3287 }
3288 
3290 {
3291  void
3292  *result;
3293 
3294  result=GetAuthenticMetacontent(image());
3295 
3296  if(!result)
3297  throwExceptionExplicit(MagickCore::OptionError,
3298  "Unable to retrieve meta content.");
3299 
3300  return(result);
3301 }
3302 
3303 Magick::Quantum *Magick::Image::getPixels(const ssize_t x_,const ssize_t y_,
3304  const size_t columns_,const size_t rows_)
3305 {
3306  Quantum
3307  *result;
3308 
3309  modifyImage();
3311  result=GetAuthenticPixels(image(),x_, y_,columns_,rows_,exceptionInfo);
3313 
3314  return(result);
3315 }
3316 
3317 void Magick::Image::grayscale(const PixelIntensityMethod method_)
3318 {
3319  modifyImage();
3321  (void) GrayscaleImage(image(),method_,exceptionInfo);
3323 }
3324 
3325 void Magick::Image::haldClut(const Image &clutImage_)
3326 {
3327  modifyImage();
3329  (void) HaldClutImage(image(),clutImage_.constImage(),exceptionInfo);
3331 }
3332 
3333 void Magick::Image::houghLine(const size_t width_,const size_t height_,
3334  const size_t threshold_)
3335 {
3337  *newImage;
3338 
3340  newImage=HoughLineImage(constImage(),width_,height_,threshold_,
3341  exceptionInfo);
3342  replaceImage(newImage);
3344 }
3345 
3346 Magick::ImageType Magick::Image::identifyType(void) const
3347 {
3348  ImageType
3349  image_type;
3350 
3352  image_type=IdentifyImageType(constImage(),exceptionInfo);
3354  return(image_type);
3355 }
3356 
3357 void Magick::Image::implode(const double factor_)
3358 {
3360  *newImage;
3361 
3363  newImage=ImplodeImage(constImage(),factor_,image()->interpolate,
3364  exceptionInfo);
3365  replaceImage(newImage);
3367 }
3368 
3370 {
3371  inverseFourierTransform(phase_,true);
3372 }
3373 
3375  const bool magnitude_)
3376 {
3378  *newImage;
3379 
3381  newImage=InverseFourierTransformImage(constImage(),phase_.constImage(),
3382  magnitude_ == true ? MagickTrue : MagickFalse,exceptionInfo);
3383  replaceImage(newImage);
3385 }
3386 
3387 void Magick::Image::kuwahara(const double radius_,const double sigma_)
3388 {
3390  *newImage;
3391 
3393  newImage=KuwaharaImage(constImage(),radius_,sigma_,exceptionInfo);
3394  replaceImage(newImage);
3396 }
3397 
3398 void Magick::Image::kuwaharaChannel(const ChannelType channel_,
3399  const double radius_,const double sigma_)
3400 {
3402  *newImage;
3403 
3405  GetAndSetPPChannelMask(channel_);
3406  newImage=KuwaharaImage(constImage(),radius_,sigma_,exceptionInfo);
3407  replaceImage(newImage);
3410 }
3411 
3412 void Magick::Image::level(const double blackPoint_,const double whitePoint_,
3413  const double gamma_)
3414 {
3415  modifyImage();
3417  (void) LevelImage(image(),blackPoint_,whitePoint_,gamma_,exceptionInfo);
3419 }
3420 
3421 void Magick::Image::levelChannel(const ChannelType channel_,
3422  const double blackPoint_,const double whitePoint_,const double gamma_)
3423 {
3424  modifyImage();
3426  GetAndSetPPChannelMask(channel_);
3427  (void) LevelImage(image(),blackPoint_,whitePoint_,gamma_,exceptionInfo);
3430 }
3431 
3432 void Magick::Image::levelColors(const Color &blackColor_,
3433  const Color &whiteColor_,const bool invert_)
3434 {
3435  PixelInfo
3436  black,
3437  white;
3438 
3439  modifyImage();
3440 
3441  black=static_cast<PixelInfo>(blackColor_);
3442  white=static_cast<PixelInfo>(whiteColor_);
3444  (void) LevelImageColors(image(),&black,&white,invert_ == true ?
3445  MagickTrue : MagickFalse,exceptionInfo);
3447 }
3448 
3449 void Magick::Image::levelColorsChannel(const ChannelType channel_,
3450  const Color &blackColor_,const Color &whiteColor_,const bool invert_)
3451 {
3452  PixelInfo
3453  black,
3454  white;
3455 
3456  modifyImage();
3457 
3458  black=static_cast<PixelInfo>(blackColor_);
3459  white=static_cast<PixelInfo>(whiteColor_);
3461  GetAndSetPPChannelMask(channel_);
3462  (void) LevelImageColors(image(),&black,&white,invert_ == true ?
3463  MagickTrue : MagickFalse,exceptionInfo);
3466 }
3467 
3468 void Magick::Image::levelize(const double blackPoint_,const double whitePoint_,
3469  const double gamma_)
3470 {
3471  modifyImage();
3473  (void) LevelizeImage(image(),blackPoint_,whitePoint_,gamma_,exceptionInfo);
3475 }
3476 
3477 void Magick::Image::levelizeChannel(const ChannelType channel_,
3478  const double blackPoint_,const double whitePoint_,const double gamma_)
3479 {
3480  modifyImage();
3482  GetAndSetPPChannelMask(channel_);
3483  (void) LevelizeImage(image(),blackPoint_,whitePoint_,gamma_,exceptionInfo);
3486 }
3487 
3488 void Magick::Image::linearStretch(const double blackPoint_,
3489  const double whitePoint_)
3490 {
3491  modifyImage();
3493  LinearStretchImage(image(),blackPoint_,whitePoint_,exceptionInfo);
3495 }
3496 
3498 {
3500  *newImage;
3501 
3502  size_t
3503  height=rows(),
3504  width=columns();
3505 
3506  ssize_t
3507  x=0,
3508  y=0;
3509 
3510  ParseMetaGeometry(static_cast<std::string>(geometry_).c_str(),&x,&y,&width,
3511  &height);
3512 
3514  newImage=LiquidRescaleImage(image(),width,height,x,y,exceptionInfo);
3515  replaceImage(newImage);
3517 }
3518 
3519 void Magick::Image::localContrast(const double radius_,const double strength_)
3520 {
3522  *newImage;
3523 
3525  newImage=LocalContrastImage(constImage(),radius_,strength_,exceptionInfo);
3526  replaceImage(newImage);
3528 }
3529 
3531 {
3533  *newImage;
3534 
3536  newImage=MagnifyImage(constImage(),exceptionInfo);
3537  replaceImage(newImage);
3539 }
3540 
3541 void Magick::Image::map(const Image &mapImage_,const bool dither_)
3542 {
3543  modifyImage();
3545  options()->quantizeDither(dither_);
3546  RemapImage(options()->quantizeInfo(),image(),mapImage_.constImage(),
3547  exceptionInfo);
3549 }
3550 
3551 void Magick::Image::meanShift(const size_t width_,const size_t height_,
3552  const double color_distance_)
3553 {
3555  *newImage;
3556 
3558  newImage=MeanShiftImage(constImage(),width_,height_,color_distance_,
3559  exceptionInfo);
3560  replaceImage(newImage);
3562 }
3563 
3564 void Magick::Image::medianFilter(const double radius_)
3565 {
3567  *newImage;
3568 
3570  newImage=StatisticImage(image(),MedianStatistic,(size_t) radius_,
3571  (size_t) radius_,exceptionInfo);
3572  replaceImage(newImage);
3574 }
3575 
3577 {
3579  *newImage;
3580 
3582  newImage=MinifyImage(constImage(),exceptionInfo);
3583  replaceImage(newImage);
3585 }
3586 
3587 void Magick::Image::modulate(const double brightness_,const double saturation_,
3588  const double hue_)
3589 {
3590  char
3591  modulate[MagickPathExtent + 1];
3592 
3593  FormatLocaleString(modulate,MagickPathExtent,"%3.6f,%3.6f,%3.6f",brightness_,
3594  saturation_,hue_);
3595 
3596  modifyImage();
3598  ModulateImage(image(),modulate,exceptionInfo);
3600 }
3601 
3603 {
3604  return(ImageMoments(*this));
3605 }
3606 
3607 void Magick::Image::morphology(const MorphologyMethod method_,
3608  const std::string kernel_,const ssize_t iterations_)
3609 {
3610  KernelInfo
3611  *kernel;
3612 
3614  *newImage;
3615 
3617  kernel=AcquireKernelInfo(kernel_.c_str(),exceptionInfo);
3618  if (kernel == (KernelInfo *) NULL)
3619  throwExceptionExplicit(MagickCore::OptionError,"Unable to parse kernel.");
3620  newImage=MorphologyImage(constImage(),method_,iterations_,kernel,
3621  exceptionInfo);
3622  replaceImage(newImage);
3623  kernel=DestroyKernelInfo(kernel);
3625 }
3626 
3627 void Magick::Image::morphology(const MorphologyMethod method_,
3628  const KernelInfoType kernel_,const std::string arguments_,
3629  const ssize_t iterations_)
3630 {
3631  const char
3632  *option;
3633 
3634  std::string
3635  kernel;
3636 
3637  option=CommandOptionToMnemonic(MagickKernelOptions,kernel_);
3638  if (option == (const char *)NULL)
3639  {
3640  throwExceptionExplicit(MagickCore::OptionError,
3641  "Unable to determine kernel type.");
3642  return;
3643  }
3644  kernel=std::string(option);
3645  if (!arguments_.empty())
3646  kernel+=":"+arguments_;
3647 
3648  morphology(method_,kernel,iterations_);
3649 }
3650 
3651 void Magick::Image::morphologyChannel(const ChannelType channel_,
3652  const MorphologyMethod method_,const std::string kernel_,
3653  const ssize_t iterations_)
3654 {
3655  KernelInfo
3656  *kernel;
3657 
3659  *newImage;
3660 
3661 
3663  kernel=AcquireKernelInfo(kernel_.c_str(),exceptionInfo);
3664  if (kernel == (KernelInfo *)NULL)
3665  {
3666  throwExceptionExplicit(MagickCore::OptionError,
3667  "Unable to parse kernel.");
3668  return;
3669  }
3670  GetAndSetPPChannelMask(channel_);
3671  newImage=MorphologyImage(constImage(),method_,iterations_,kernel,
3672  exceptionInfo);
3674  replaceImage(newImage);
3675  kernel=DestroyKernelInfo(kernel);
3677 }
3678 
3679 void Magick::Image::morphologyChannel(const ChannelType channel_,
3680  const MorphologyMethod method_,const KernelInfoType kernel_,
3681  const std::string arguments_,const ssize_t iterations_)
3682 {
3683  const char
3684  *option;
3685 
3686  std::string
3687  kernel;
3688 
3689  option=CommandOptionToMnemonic(MagickKernelOptions,kernel_);
3690  if (option == (const char *)NULL)
3691  {
3692  throwExceptionExplicit(MagickCore::OptionError,
3693  "Unable to determine kernel type.");
3694  return;
3695  }
3696 
3697  kernel=std::string(option);
3698  if (!arguments_.empty())
3699  kernel+=":"+arguments_;
3700 
3701  morphologyChannel(channel_,method_,kernel,iterations_);
3702 }
3703 
3704 void Magick::Image::motionBlur(const double radius_,const double sigma_,
3705  const double angle_)
3706 {
3708  *newImage;
3709 
3711  newImage=MotionBlurImage(constImage(),radius_,sigma_,angle_,exceptionInfo);
3712  replaceImage(newImage);
3714 }
3715 
3716 void Magick::Image::negate(const bool grayscale_)
3717 {
3718  modifyImage();
3720  NegateImage(image(),(MagickBooleanType) grayscale_,exceptionInfo);
3722 }
3723 
3724 void Magick::Image::negateChannel(const ChannelType channel_,
3725  const bool grayscale_)
3726 {
3727  modifyImage();
3729  GetAndSetPPChannelMask(channel_);
3730  NegateImage(image(),(MagickBooleanType) grayscale_,exceptionInfo);
3733 }
3734 
3736 {
3737  modifyImage();
3739  NormalizeImage(image(),exceptionInfo);
3741 }
3742 
3743 void Magick::Image::oilPaint(const double radius_,const double sigma_)
3744 {
3746  *newImage;
3747 
3749  newImage=OilPaintImage(constImage(),radius_,sigma_,exceptionInfo);
3750  replaceImage(newImage);
3752 }
3753 
3754 void Magick::Image::opaque(const Color &opaqueColor_,const Color &penColor_,
3755  const bool invert_)
3756 {
3757  std::string
3758  opaqueColor,
3759  penColor;
3760 
3761  PixelInfo
3762  opaque,
3763  pen;
3764 
3765  if (!opaqueColor_.isValid())
3766  throwExceptionExplicit(MagickCore::OptionError,
3767  "Opaque color argument is invalid");
3768 
3769  if (!penColor_.isValid())
3770  throwExceptionExplicit(MagickCore::OptionError,
3771  "Pen color argument is invalid");
3772 
3773  modifyImage();
3774  opaqueColor=opaqueColor_;
3775  penColor=penColor_;
3776 
3778  (void) QueryColorCompliance(opaqueColor.c_str(),AllCompliance,&opaque,
3779  exceptionInfo);
3780  (void) QueryColorCompliance(penColor.c_str(),AllCompliance,&pen,
3781  exceptionInfo);
3782  OpaquePaintImage(image(),&opaque,&pen,invert_ ? MagickTrue : MagickFalse,
3783  exceptionInfo);
3785 }
3786 
3787 void Magick::Image::orderedDither(std::string thresholdMap_)
3788 {
3789  modifyImage();
3791  (void) OrderedDitherImage(image(),thresholdMap_.c_str(),exceptionInfo);
3793 }
3794 
3795 void Magick::Image::orderedDitherChannel(const ChannelType channel_,
3796  std::string thresholdMap_)
3797 {
3798  modifyImage();
3800  GetAndSetPPChannelMask(channel_);
3801  (void)OrderedDitherImage(image(),thresholdMap_.c_str(),exceptionInfo);
3804 }
3805 
3806 void Magick::Image::perceptible(const double epsilon_)
3807 {
3808  modifyImage();
3810  PerceptibleImage(image(),epsilon_,exceptionInfo);
3812 }
3813 
3814 void Magick::Image::perceptibleChannel(const ChannelType channel_,
3815  const double epsilon_)
3816 {
3817  modifyImage();
3819  GetAndSetPPChannelMask(channel_);
3820  PerceptibleImage(image(),epsilon_,exceptionInfo);
3823 }
3824 
3826 {
3827  return(ImagePerceptualHash(*this));
3828 }
3829 
3830 void Magick::Image::ping(const std::string &imageSpec_)
3831 {
3833  *newImage;
3834 
3836  options()->fileName(imageSpec_);
3837  newImage=PingImage(imageInfo(),exceptionInfo);
3838  read(newImage,exceptionInfo);
3839 }
3840 
3841 void Magick::Image::ping(const Blob& blob_)
3842 {
3844  *newImage;
3845 
3847  newImage=PingBlob(imageInfo(),blob_.data(),blob_.length(),exceptionInfo);
3848  read(newImage,exceptionInfo);
3849 }
3850 
3851 void Magick::Image::pixelColor(const ssize_t x_,const ssize_t y_,
3852  const Color &color_)
3853 {
3854  PixelInfo
3855  packet;
3856 
3857  Quantum
3858  *pixel;
3859 
3860  // Test arguments to ensure they are within the image.
3861  if (y_ > (ssize_t) rows() || x_ > (ssize_t) columns())
3862  throwExceptionExplicit(MagickCore::OptionError,
3863  "Access outside of image boundary");
3864 
3865  modifyImage();
3866 
3867  // Set image to DirectClass
3868  classType(DirectClass );
3869 
3870  // Get pixel view
3871  Pixels pixels(*this);
3872  // Set pixel value
3873  pixel=pixels.get(x_, y_, 1, 1 );
3874  packet=color_;
3875  MagickCore::SetPixelViaPixelInfo(constImage(),&packet,pixel);
3876  // Tell ImageMagick that pixels have been updated
3877  pixels.sync();
3878 }
3879 
3880 Magick::Color Magick::Image::pixelColor(const ssize_t x_,
3881  const ssize_t y_) const
3882 {
3883  const Quantum
3884  *pixel;
3885 
3886  pixel=getConstPixels(x_,y_,1,1);
3887  if (pixel)
3888  {
3889  PixelInfo
3890  packet;
3891 
3892  MagickCore::GetPixelInfoPixel(constImage(),pixel,&packet);
3893  return(Color(packet));
3894  }
3895 
3896  return(Color()); // invalid
3897 }
3898 
3899 void Magick::Image::polaroid(const std::string &caption_,const double angle_,
3900  const PixelInterpolateMethod method_)
3901 {
3903  *newImage;
3904 
3906  newImage=PolaroidImage(constImage(),options()->drawInfo(),caption_.c_str(),
3907  angle_,method_,exceptionInfo);
3908  replaceImage(newImage);
3910 }
3911 
3912 void Magick::Image::posterize(const size_t levels_,const DitherMethod method_)
3913 {
3914  modifyImage();
3916  PosterizeImage(image(),levels_,method_,exceptionInfo);
3918 }
3919 
3920 void Magick::Image::posterizeChannel(const ChannelType channel_,
3921  const size_t levels_,const DitherMethod method_)
3922 {
3923  modifyImage();
3925  GetAndSetPPChannelMask(channel_);
3926  PosterizeImage(image(),levels_,method_,exceptionInfo);
3929 }
3930 
3931 void Magick::Image::process(std::string name_,const ssize_t argc,
3932  const char **argv)
3933 {
3934  modifyImage();
3935 
3937  (void) InvokeDynamicImageFilter(name_.c_str(),&image(),argc,argv,
3938  exceptionInfo);
3940 }
3941 
3942 void Magick::Image::profile(const std::string name_,
3943  const Magick::Blob &profile_)
3944 {
3945  modifyImage();
3947  (void) ProfileImage(image(),name_.c_str(),(unsigned char *)profile_.data(),
3948  profile_.length(),exceptionInfo);
3950 }
3951 
3952 Magick::Blob Magick::Image::profile(const std::string name_) const
3953 {
3954  const StringInfo
3955  *profile;
3956 
3957  profile=GetImageProfile(constImage(),name_.c_str());
3958 
3959  if (profile == (StringInfo *) NULL)
3960  return(Blob());
3961  return(Blob((void*) GetStringInfoDatum(profile),GetStringInfoLength(
3962  profile)));
3963 }
3964 
3965 void Magick::Image::quantize(const bool measureError_)
3966 {
3967  modifyImage();
3968 
3969  if (measureError_)
3970  options()->quantizeInfo()->measure_error=MagickTrue;
3971  else
3972  options()->quantizeInfo()->measure_error=MagickFalse;
3973 
3975  QuantizeImage(options()->quantizeInfo(),image(),exceptionInfo);
3977 }
3978 
3979 void Magick::Image::raise(const Geometry &geometry_,const bool raisedFlag_)
3980 {
3981  RectangleInfo
3982  raiseInfo=geometry_;
3983 
3985  modifyImage();
3986  RaiseImage(image(),&raiseInfo,raisedFlag_ == true ? MagickTrue : MagickFalse,
3987  exceptionInfo);
3989 }
3990 
3991 void Magick::Image::randomThreshold(const double low_,const double high_)
3992 {
3994  (void) RandomThresholdImage(image(),low_,high_,exceptionInfo);
3996 }
3997 
3998 void Magick::Image::randomThresholdChannel(const ChannelType channel_,
3999  const double low_,const double high_)
4000 {
4001  modifyImage();
4003  GetAndSetPPChannelMask(channel_);
4004  (void) RandomThresholdImage(image(),low_,high_,exceptionInfo);
4007 }
4008 
4009 void Magick::Image::read(const Blob &blob_)
4010 {
4012  *newImage;
4013 
4015  newImage=BlobToImage(imageInfo(),static_cast<const void *>(blob_.data()),
4016  blob_.length(),exceptionInfo);
4017  read(newImage,exceptionInfo);
4018 }
4019 
4020 void Magick::Image::read(const Blob &blob_,const Geometry &size_)
4021 {
4022  size(size_);
4023  read(blob_);
4024 }
4025 
4026 void Magick::Image::read(const Blob &blob_,const Geometry &size_,
4027  const size_t depth_)
4028 {
4029  size(size_);
4030  depth(depth_);
4031  read(blob_);
4032 }
4033 
4034 void Magick::Image::read(const Blob &blob_,const Geometry &size_,
4035  const size_t depth_,const std::string &magick_)
4036 {
4037  size(size_);
4038  depth(depth_);
4039  magick(magick_);
4040  // Set explicit image format
4041  fileName(magick_ + ':');
4042  read(blob_);
4043 }
4044 
4045 void Magick::Image::read(const Blob &blob_,const Geometry &size_,
4046  const std::string &magick_)
4047 {
4048  size(size_);
4049  magick(magick_);
4050  // Set explicit image format
4051  fileName(magick_ + ':');
4052  read(blob_);
4053 }
4054 
4055 void Magick::Image::read(const Geometry &size_,const std::string &imageSpec_)
4056 {
4057  size(size_);
4058  read(imageSpec_);
4059 }
4060 
4061 void Magick::Image::read(const size_t width_,const size_t height_,
4062  const std::string &map_,const StorageType type_,const void *pixels_)
4063 {
4065  *newImage;
4066 
4068  newImage=ConstituteImage(width_,height_,map_.c_str(),type_, pixels_,
4069  exceptionInfo);
4070  replaceImage(newImage);
4072 }
4073 
4074 void Magick::Image::read(const std::string &imageSpec_)
4075 {
4077  *newImage;
4078 
4080  options()->fileName(imageSpec_);
4081  newImage=ReadImage(imageInfo(),exceptionInfo);
4082  read(newImage,exceptionInfo);
4083 }
4084 
4086 {
4087  mask(mask_,ReadPixelMask);
4088 }
4089 
4091 {
4092  return(mask(ReadPixelMask));
4093 }
4094 
4095 void Magick::Image::readPixels(const Magick::QuantumType quantum_,
4096  const unsigned char *source_)
4097 {
4098  QuantumInfo
4099  *quantum_info;
4100 
4101  quantum_info=AcquireQuantumInfo(imageInfo(),image());
4103  ImportQuantumPixels(image(),(MagickCore::CacheView *) NULL,quantum_info,
4104  quantum_,source_,exceptionInfo);
4105  quantum_info=DestroyQuantumInfo(quantum_info);
4107 }
4108 
4110 {
4111  reduceNoise(3);
4112 }
4113 
4114 void Magick::Image::reduceNoise(const size_t order_)
4115 {
4117  *newImage;
4118 
4120  newImage=StatisticImage(constImage(),NonpeakStatistic,order_,
4121  order_,exceptionInfo);
4122  replaceImage(newImage);
4124 }
4125 
4127 {
4128  modifyImage();
4129  options()->page(Geometry());
4130  image()->page.width = 0;
4131  image()->page.height = 0;
4132  image()->page.x = 0;
4133  image()->page.y = 0;
4134 }
4135 
4136 void Magick::Image::resample(const Point &density_)
4137 {
4139  *newImage;
4140 
4142  newImage=ResampleImage(constImage(),density_.x(),density_.y(),
4143  image()->filter,exceptionInfo);
4144  replaceImage(newImage);
4146 }
4147 
4148 void Magick::Image::resize(const Geometry &geometry_)
4149 {
4151  *newImage;
4152 
4153  size_t
4154  height=rows(),
4155  width=columns();
4156 
4157  ssize_t
4158  x=0,
4159  y=0;
4160 
4161  // Calculate new size. This code should be supported using binary arguments
4162  // in the ImageMagick library.
4163  ParseMetaGeometry(static_cast<std::string>(geometry_).c_str(),&x,&y,&width,
4164  &height);
4165 
4167  newImage=ResizeImage(constImage(),width,height,image()->filter,
4168  exceptionInfo);
4169  replaceImage(newImage);
4171 }
4172 
4173 void Magick::Image::roll(const Geometry &roll_)
4174 {
4176  *newImage;
4177 
4179  newImage=RollImage(constImage(),roll_.xOff(),roll_.yOff(),exceptionInfo);
4180  replaceImage(newImage);
4182 }
4183 
4184 void Magick::Image::roll(const size_t columns_,const size_t rows_)
4185 {
4187  *newImage;
4188 
4190  newImage=RollImage(constImage(),static_cast<ssize_t>(columns_),
4191  static_cast<ssize_t>(rows_),exceptionInfo);
4192  replaceImage(newImage);
4194 }
4195 
4196 void Magick::Image::rotate(const double degrees_)
4197 {
4199  *newImage;
4200 
4202  newImage=RotateImage(constImage(),degrees_,exceptionInfo);
4203  replaceImage(newImage);
4205 }
4206 
4207 void Magick::Image::rotationalBlur(const double angle_)
4208 {
4210  *newImage;
4211 
4213  newImage=RotationalBlurImage(constImage(),angle_,exceptionInfo);
4214  replaceImage(newImage);
4216 }
4217 
4218 void Magick::Image::rotationalBlurChannel(const ChannelType channel_,
4219  const double angle_)
4220 {
4222  *newImage;
4223 
4225  GetAndSetPPChannelMask(channel_);
4226  newImage=RotationalBlurImage(constImage(),angle_,exceptionInfo);
4228  replaceImage(newImage);
4230 }
4231 
4232 void Magick::Image::sample(const Geometry &geometry_)
4233 {
4235  *newImage;
4236 
4237  size_t
4238  height=rows(),
4239  width=columns();
4240 
4241  ssize_t
4242  x=0,
4243  y=0;
4244 
4245  ParseMetaGeometry(static_cast<std::string>(geometry_).c_str(),&x,&y,&width,
4246  &height);
4247 
4249  newImage=SampleImage(constImage(),width,height,exceptionInfo);
4250  replaceImage(newImage);
4252 }
4253 
4254 void Magick::Image::scale(const Geometry &geometry_)
4255 {
4257  *newImage;
4258 
4259  size_t
4260  height=rows(),
4261  width=columns();
4262 
4263  ssize_t
4264  x=0,
4265  y=0;
4266 
4267  ParseMetaGeometry(static_cast<std::string>(geometry_).c_str(),&x,&y,&width,
4268  &height);
4269 
4271  newImage=ScaleImage(constImage(),width,height,exceptionInfo);
4272  replaceImage(newImage);
4274 }
4275 
4276 void Magick::Image::segment(const double clusterThreshold_,
4277  const double smoothingThreshold_)
4278 {
4279  modifyImage();
4281  SegmentImage(image(),options()->quantizeColorSpace(),
4282  (MagickBooleanType) options()->verbose(),clusterThreshold_,
4283  smoothingThreshold_,exceptionInfo);
4284  SyncImage(image(),exceptionInfo);
4286 }
4287 
4288 void Magick::Image::selectiveBlur(const double radius_,const double sigma_,
4289  const double threshold_)
4290 {
4292  *newImage;
4293 
4295  newImage=SelectiveBlurImage(constImage(),radius_,sigma_,threshold_,
4296  exceptionInfo);
4297  replaceImage(newImage);
4299 }
4300 
4301 void Magick::Image::selectiveBlurChannel(const ChannelType channel_,
4302  const double radius_,const double sigma_,const double threshold_)
4303 {
4305  *newImage;
4306 
4308  GetAndSetPPChannelMask(channel_);
4309  newImage=SelectiveBlurImage(constImage(),radius_,sigma_,threshold_,
4310  exceptionInfo);
4312  replaceImage(newImage);
4314 }
4315 
4316 Magick::Image Magick::Image::separate(const ChannelType channel_) const
4317 {
4319  *image;
4320 
4322  image=SeparateImage(constImage(),channel_,exceptionInfo);
4324  if (image == (MagickCore::Image *) NULL)
4325  return(Magick::Image());
4326  else
4327  return(Magick::Image(image));
4328 }
4329 
4330 void Magick::Image::sepiaTone(const double threshold_)
4331 {
4333  *newImage;
4334 
4336  newImage=SepiaToneImage(constImage(),threshold_,exceptionInfo);
4337  replaceImage(newImage);
4339 }
4340 
4341 bool Magick::Image::setColorMetric(const Image &reference_)
4342 {
4343  bool
4344  status;
4345 
4346  Image
4347  ref=reference_;
4348 
4350  modifyImage();
4351  status=static_cast<bool>(SetImageColorMetric(image(),ref.constImage(),
4352  exceptionInfo));
4354  return(status);
4355 }
4356 
4357 Magick::Quantum *Magick::Image::setPixels(const ssize_t x_,const ssize_t y_,
4358  const size_t columns_,const size_t rows_)
4359 {
4360  Quantum
4361  *result;
4362 
4363  modifyImage();
4365  result=QueueAuthenticPixels(image(),x_,y_,columns_,rows_,exceptionInfo);
4367  return(result);
4368 }
4369 
4370 void Magick::Image::shade(const double azimuth_,const double elevation_,
4371  const bool colorShading_)
4372 {
4374  *newImage;
4375 
4377  newImage=ShadeImage(constImage(),colorShading_ == true ?
4378  MagickTrue : MagickFalse,azimuth_,elevation_,exceptionInfo);
4379  replaceImage(newImage);
4381 }
4382 
4383 void Magick::Image::shadow(const double percent_opacity_,const double sigma_,
4384  const ssize_t x_,const ssize_t y_)
4385 {
4387  *newImage;
4388 
4390  newImage=ShadowImage(constImage(),percent_opacity_, sigma_,x_, y_,
4391  exceptionInfo);
4392  replaceImage(newImage);
4394 }
4395 
4396 void Magick::Image::sharpen(const double radius_,const double sigma_)
4397 {
4399  *newImage;
4400 
4402  newImage=SharpenImage(constImage(),radius_,sigma_,exceptionInfo);
4403  replaceImage(newImage);
4405 }
4406 
4407 void Magick::Image::sharpenChannel(const ChannelType channel_,
4408  const double radius_,const double sigma_)
4409 {
4411  *newImage;
4412 
4414  GetAndSetPPChannelMask(channel_);
4415  newImage=SharpenImage(constImage(),radius_,sigma_,exceptionInfo);
4417  replaceImage(newImage);
4419 }
4420 
4421 void Magick::Image::shave(const Geometry &geometry_)
4422 {
4424  *newImage;
4425 
4426  RectangleInfo
4427  shaveInfo=geometry_;
4428 
4430  newImage=ShaveImage(constImage(),&shaveInfo,exceptionInfo);
4431  replaceImage(newImage);
4433 }
4434 
4435 void Magick::Image::shear(const double xShearAngle_,const double yShearAngle_)
4436 {
4438  *newImage;
4439 
4441  newImage=ShearImage(constImage(),xShearAngle_,yShearAngle_,exceptionInfo);
4442  replaceImage(newImage);
4444 }
4445 
4446 void Magick::Image::sigmoidalContrast(const bool sharpen_,
4447  const double contrast,const double midpoint)
4448 {
4449  modifyImage();
4451  (void) SigmoidalContrastImage(image(),(MagickBooleanType) sharpen_,contrast,
4452  midpoint,exceptionInfo);
4454 }
4455 
4456 std::string Magick::Image::signature(const bool force_) const
4457 {
4458  return(_imgRef->signature(force_));
4459 }
4460 
4461 void Magick::Image::sketch(const double radius_,const double sigma_,
4462  const double angle_)
4463 {
4465  *newImage;
4466 
4468  newImage=SketchImage(constImage(),radius_,sigma_,angle_,exceptionInfo);
4469  replaceImage(newImage);
4471 }
4472 
4473 void Magick::Image::solarize(const double factor_)
4474 {
4475  modifyImage();
4477  SolarizeImage(image(),factor_,exceptionInfo);
4479 }
4480 
4481 void Magick::Image::sparseColor(const ChannelType channel_,
4482  const SparseColorMethod method_,const size_t numberArguments_,
4483  const double *arguments_)
4484 {
4486  *newImage;
4487 
4489  GetAndSetPPChannelMask(channel_);
4490  newImage=SparseColorImage(constImage(),method_,numberArguments_,arguments_,
4491  exceptionInfo);
4493  replaceImage(newImage);
4495 }
4496 
4497 void Magick::Image::splice(const Geometry &geometry_)
4498 {
4500  *newImage;
4501 
4502  RectangleInfo
4503  spliceInfo=geometry_;
4504 
4506  newImage=SpliceImage(constImage(),&spliceInfo,exceptionInfo);
4507  replaceImage(newImage);
4509 }
4510 
4511 void Magick::Image::splice(const Geometry &geometry_,
4512  const Color &backgroundColor_)
4513 {
4514  backgroundColor(backgroundColor_);
4515  splice(geometry_);
4516 }
4517 
4518 void Magick::Image::splice(const Geometry &geometry_,
4519  const Color &backgroundColor_,const GravityType gravity_)
4520 {
4521  backgroundColor(backgroundColor_);
4522  image()->gravity=gravity_;
4523  splice(geometry_);
4524 }
4525 
4526 void Magick::Image::spread(const double amount_)
4527 {
4529  *newImage;
4530 
4532  newImage=SpreadImage(constImage(),image()->interpolate,amount_,exceptionInfo);
4533  replaceImage(newImage);
4535 }
4536 
4538 {
4539  return(ImageStatistics(*this));
4540 }
4541 
4542 void Magick::Image::stegano(const Image &watermark_)
4543 {
4545  *newImage;
4546 
4548  newImage=SteganoImage(constImage(),watermark_.constImage(),exceptionInfo);
4549  replaceImage(newImage);
4551 }
4552 
4553 void Magick::Image::stereo(const Image &rightImage_)
4554 {
4556  *newImage;
4557 
4559  newImage=StereoImage(constImage(),rightImage_.constImage(),exceptionInfo);
4560  replaceImage(newImage);
4562 }
4563 
4565 {
4566  modifyImage();
4568  StripImage(image(),exceptionInfo);
4570 }
4571 
4573  const MetricType metric_,Geometry *offset_,double *similarityMetric_,
4574  const double similarityThreshold)
4575 {
4577  *newImage;
4578 
4579  RectangleInfo
4580  offset;
4581 
4583  newImage=SimilarityImage(image(),reference_.constImage(),metric_,
4584  similarityThreshold,&offset,similarityMetric_,exceptionInfo);
4586  if (offset_ != (Geometry *) NULL)
4587  *offset_=offset;
4588  if (newImage == (MagickCore::Image *) NULL)
4589  return(Magick::Image());
4590  else
4591  return(Magick::Image(newImage));
4592 }
4593 
4594 void Magick::Image::swirl(const double degrees_)
4595 {
4597  *newImage;
4598 
4600  newImage=SwirlImage(constImage(),degrees_,image()->interpolate,
4601  exceptionInfo);
4602  replaceImage(newImage);
4604 }
4605 
4607 {
4609  (void) SyncAuthenticPixels(image(),exceptionInfo);
4611 }
4612 
4613 void Magick::Image::texture(const Image &texture_)
4614 {
4615  modifyImage();
4617  TextureImage(image(),texture_.constImage(),exceptionInfo);
4619 }
4620 
4621 void Magick::Image::threshold(const double threshold_)
4622 {
4623  modifyImage();
4625  BilevelImage(image(),threshold_,exceptionInfo);
4627 }
4628 
4629 void Magick::Image::thumbnail(const Geometry &geometry_)
4630 {
4632  *newImage;
4633 
4634  size_t
4635  height=rows(),
4636  width=columns();
4637 
4638  ssize_t
4639  x=0,
4640  y=0;
4641 
4642  ParseMetaGeometry(static_cast<std::string>(geometry_).c_str(),&x,&y,&width,
4643  &height);
4644 
4646  newImage=ThumbnailImage(constImage(),width,height,exceptionInfo);
4647  replaceImage(newImage);
4649 }
4650 
4651 void Magick::Image::tint(const std::string opacity_)
4652 {
4654  *newImage;
4655 
4656  PixelInfo
4657  color;
4658 
4660  color=static_cast<PixelInfo>(constOptions()->fillColor());
4661  newImage=TintImage(constImage(),opacity_.c_str(),&color,exceptionInfo);
4662  replaceImage(newImage);
4664 }
4665 
4666 void Magick::Image::transformOrigin(const double x_,const double y_)
4667 {
4668  modifyImage();
4669  options()->transformOrigin(x_,y_);
4670 }
4671 
4673 {
4674  modifyImage();
4675  options()->transformReset();
4676 }
4677 
4678 void Magick::Image::transformScale(const double sx_,const double sy_)
4679 {
4680  modifyImage();
4681  options()->transformScale(sx_,sy_);
4682 }
4683 
4684 void Magick::Image::transparent(const Color &color_,const bool inverse_)
4685 {
4686  PixelInfo
4687  target;
4688 
4689  std::string
4690  color;
4691 
4692  if (!color_.isValid())
4693  throwExceptionExplicit(MagickCore::OptionError,
4694  "Color argument is invalid");
4695 
4696  color=color_;
4698  (void) QueryColorCompliance(color.c_str(),AllCompliance,&target,
4699  exceptionInfo);
4700  modifyImage();
4701  TransparentPaintImage(image(),&target,TransparentAlpha,
4702  inverse_ == true ? MagickTrue : MagickFalse,exceptionInfo);
4704 }
4705 
4707  const Color &colorHigh_)
4708 {
4709  std::string
4710  colorHigh,
4711  colorLow;
4712 
4713  PixelInfo
4714  targetHigh,
4715  targetLow;
4716 
4717  if (!colorLow_.isValid() || !colorHigh_.isValid())
4718  throwExceptionExplicit(MagickCore::OptionError,
4719  "Color argument is invalid");
4720 
4721  colorLow=colorLow_;
4722  colorHigh=colorHigh_;
4723 
4725  (void) QueryColorCompliance(colorLow.c_str(),AllCompliance,&targetLow,
4726  exceptionInfo);
4727  (void) QueryColorCompliance(colorHigh.c_str(),AllCompliance,&targetHigh,
4728  exceptionInfo);
4729  modifyImage();
4730  TransparentPaintImageChroma(image(),&targetLow,&targetHigh,TransparentAlpha,
4731  MagickFalse,exceptionInfo);
4733 }
4734 
4736 {
4738  *newImage;
4739 
4741  newImage=TransposeImage(constImage(),exceptionInfo);
4742  replaceImage(newImage);
4744 }
4745 
4747 {
4749  *newImage;
4750 
4752  newImage=TransverseImage(constImage(),exceptionInfo);
4753  replaceImage(newImage);
4755 }
4756 
4758 {
4760  *newImage;
4761 
4763  newImage=TrimImage(constImage(),exceptionInfo);
4764  replaceImage(newImage);
4766 }
4767 
4769 {
4771  *image;
4772 
4774  image=UniqueImageColors(constImage(),exceptionInfo);
4776  if (image == (MagickCore::Image *) NULL)
4777  return(Magick::Image());
4778  else
4779  return(Magick::Image(image));
4780 }
4781 
4782 void Magick::Image::unsharpmask(const double radius_,const double sigma_,
4783  const double amount_,const double threshold_)
4784 {
4786  *newImage;
4787 
4789  newImage=UnsharpMaskImage(constImage(),radius_,sigma_,amount_,threshold_,
4790  exceptionInfo);
4791  replaceImage(newImage);
4793 }
4794 
4795 void Magick::Image::unsharpmaskChannel(const ChannelType channel_,
4796  const double radius_,const double sigma_,const double amount_,
4797  const double threshold_)
4798 {
4800  *newImage;
4801 
4803  GetAndSetPPChannelMask(channel_);
4804  newImage=UnsharpMaskImage(constImage(),radius_,sigma_,amount_,threshold_,
4805  exceptionInfo);
4807  replaceImage(newImage);
4809 }
4810 
4811 void Magick::Image::vignette(const double radius_,const double sigma_,
4812  const ssize_t x_,const ssize_t y_)
4813 {
4815  *newImage;
4816 
4818  newImage=VignetteImage(constImage(),radius_,sigma_,x_,y_,exceptionInfo);
4819  replaceImage(newImage);
4821 }
4822 
4823 void Magick::Image::wave(const double amplitude_,const double wavelength_)
4824 {
4826  *newImage;
4827 
4829  newImage=WaveImage(constImage(),amplitude_,wavelength_,image()->interpolate,
4830  exceptionInfo);
4831  replaceImage(newImage);
4833 }
4834 
4835 void Magick::Image::waveletDenoise(const double threshold_,
4836  const double softness_)
4837 {
4839  *newImage;
4840 
4842  newImage=WaveletDenoiseImage(constImage(),threshold_,softness_,
4843  exceptionInfo);
4844  replaceImage(newImage);
4846 }
4847 
4848 void Magick::Image::whiteThreshold(const std::string &threshold_)
4849 {
4850  modifyImage();
4852  WhiteThresholdImage(image(),threshold_.c_str(),exceptionInfo);
4854 }
4855 
4856 void Magick::Image::whiteThresholdChannel(const ChannelType channel_,
4857  const std::string &threshold_)
4858 {
4859  modifyImage();
4861  GetAndSetPPChannelMask(channel_);
4862  WhiteThresholdImage(image(),threshold_.c_str(),exceptionInfo);
4865 }
4866 
4868 {
4869  size_t
4870  length=0;
4871 
4872  void
4873  *data;
4874 
4875  modifyImage();
4877  data=ImagesToBlob(constImageInfo(),image(),&length,exceptionInfo);
4878  if (length > 0)
4879  blob_->updateNoCopy(data,length,Blob::MallocAllocator);
4880  else
4881  data=RelinquishMagickMemory(data);
4883 }
4884 
4885 void Magick::Image::write(Blob *blob_,const std::string &magick_)
4886 {
4887  size_t
4888  length=0;
4889 
4890  void
4891  *data;
4892 
4893  modifyImage();
4894  magick(magick_);
4896  data=ImagesToBlob(constImageInfo(),image(),&length,exceptionInfo);
4897  if (length > 0)
4898  blob_->updateNoCopy(data,length,Blob::MallocAllocator);
4899  else
4900  data=RelinquishMagickMemory(data);
4902 }
4903 
4904 void Magick::Image::write(Blob *blob_,const std::string &magick_,
4905  const size_t depth_)
4906 {
4907  size_t
4908  length=0;
4909 
4910  void
4911  *data;
4912 
4913  modifyImage();
4914  magick(magick_);
4915  depth(depth_);
4917  data=ImagesToBlob(constImageInfo(),image(),&length,exceptionInfo);
4918  if (length > 0)
4919  blob_->updateNoCopy(data,length,Blob::MallocAllocator);
4920  else
4921  data=RelinquishMagickMemory(data);
4923 }
4924 
4925 void Magick::Image::write(const ssize_t x_,const ssize_t y_,
4926  const size_t columns_,const size_t rows_,const std::string &map_,
4927  const StorageType type_,void *pixels_)
4928 {
4930  ExportImagePixels(image(),x_,y_,columns_,rows_,map_.c_str(),type_,pixels_,
4931  exceptionInfo);
4933 }
4934 
4935 void Magick::Image::write(const std::string &imageSpec_)
4936 {
4937  modifyImage();
4938  fileName(imageSpec_);
4940  WriteImage(constImageInfo(),image(),exceptionInfo);
4942 }
4943 
4945 {
4946  mask(mask_,WritePixelMask);
4947 }
4948 
4950 {
4951  return(mask(WritePixelMask));
4952 }
4953 
4954 void Magick::Image::writePixels(const Magick::QuantumType quantum_,
4955  unsigned char *destination_)
4956 {
4957  QuantumInfo
4958  *quantum_info;
4959 
4960  quantum_info=AcquireQuantumInfo(imageInfo(),image());
4962  ExportQuantumPixels(image(),(MagickCore::CacheView *) NULL,quantum_info,
4963  quantum_,destination_, exceptionInfo);
4964  quantum_info=DestroyQuantumInfo(quantum_info);
4966 }
4967 
4968 void Magick::Image::zoom(const Geometry &geometry_)
4969 {
4971  *newImage;
4972 
4973  size_t
4974  height=rows(),
4975  width=columns();
4976 
4977  ssize_t
4978  x=0,
4979  y=0;
4980 
4981  ParseMetaGeometry(static_cast<std::string>(geometry_).c_str(),&x,&y,&width,
4982  &height);
4983 
4985  newImage=ResizeImage(constImage(),width,height,image()->filter,exceptionInfo);
4986  replaceImage(newImage);
4988 }
4989 
4991  : _imgRef(new ImageRef(image_))
4992 {
4993 }
4994 
4996 {
4997  return(_imgRef->image());
4998 }
4999 
5001 {
5002  return(_imgRef->image());
5003 }
5004 
5005 MagickCore::ImageInfo *Magick::Image::imageInfo(void)
5006 {
5007  return(_imgRef->options()->imageInfo());
5008 }
5009 
5010 const MagickCore::ImageInfo *Magick::Image::constImageInfo(void) const
5011 {
5012  return(_imgRef->options()->imageInfo());
5013 }
5014 
5016 {
5017  return(_imgRef->options());
5018 }
5019 
5021 {
5022  return(_imgRef->options());
5023 }
5024 
5025 MagickCore::QuantizeInfo *Magick::Image::quantizeInfo(void)
5026 {
5027  return(_imgRef->options()->quantizeInfo());
5028 }
5029 
5030 const MagickCore::QuantizeInfo *Magick::Image::constQuantizeInfo(void) const
5031 {
5032  return(_imgRef->options()->quantizeInfo());
5033 }
5034 
5036 {
5037  if (!_imgRef->isShared())
5038  return;
5039 
5041  replaceImage(CloneImage(image(),0,0,MagickTrue,exceptionInfo));
5043 }
5044 
5046 {
5048  *image;
5049 
5050  if (replacement_)
5051  image=replacement_;
5052  else
5053  {
5055  image=AcquireImage(constImageInfo(),exceptionInfo);
5057  }
5058 
5059  _imgRef=ImageRef::replaceImage(_imgRef,image);
5060  return(image);
5061 }
5062 
5064  MagickCore::ExceptionInfo *exceptionInfo)
5065 {
5066  // Ensure that multiple image frames were not read.
5067  if (image != (MagickCore::Image *) NULL &&
5068  image->next != (MagickCore::Image *) NULL)
5069  {
5071  *next;
5072 
5073  // Destroy any extra image frames
5074  next=image->next;
5075  image->next=(MagickCore::Image *) NULL;
5076  next->previous=(MagickCore::Image *) NULL;
5077  DestroyImageList(next);
5078  }
5080  if (exceptionInfo->severity == MagickCore::UndefinedException &&
5081  image == (MagickCore::Image *) NULL)
5082  {
5083  (void) MagickCore::DestroyExceptionInfo(exceptionInfo);
5084  if (!quiet())
5085  throwExceptionExplicit(MagickCore::ImageWarning,
5086  "No image was loaded.");
5087  return;
5088  }
5090 }
5091 
5092 void Magick::Image::floodFill(const ssize_t x_,const ssize_t y_,
5093  const Magick::Image *fillPattern_,const Magick::Color &fill_,
5094  const MagickCore::PixelInfo *target_,const bool invert_)
5095 {
5097  fillColor;
5098 
5100  *fillPattern;
5101 
5102  // Set drawing fill pattern or fill color
5103  fillColor=options()->fillColor();
5104  fillPattern=(MagickCore::Image *)NULL;
5105  if (options()->fillPattern() != (MagickCore::Image *)NULL)
5106  {
5108  fillPattern=CloneImage(options()->fillPattern(),0,0,MagickTrue,
5109  exceptionInfo);
5111  }
5112 
5113  if (fillPattern_ == (Magick::Image *)NULL)
5114  {
5116  options()->fillColor(fill_);
5117  }
5118  else
5119  options()->fillPattern(fillPattern_->constImage());
5120 
5122  (void) FloodfillPaintImage(image(),options()->drawInfo(),
5123  target_,static_cast<ssize_t>(x_),static_cast<ssize_t>(y_),
5124  (MagickBooleanType) invert_,exceptionInfo);
5125 
5126  options()->fillColor(fillColor);
5127  options()->fillPattern(fillPattern);
5129 }
5130 
5131 void Magick::Image::mask(const Magick::Image &mask_,const PixelMask type)
5132 {
5133  modifyImage();
5134 
5136  if (mask_.isValid())
5137  SetImageMask(image(),type,mask_.constImage(),exceptionInfo);
5138  else
5139  SetImageMask(image(),type,(MagickCore::Image *) NULL,
5140  exceptionInfo);
5142 }
5143 
5144 Magick::Image Magick::Image::mask(const PixelMask type) const
5145 {
5147  *image;
5148 
5150  image = GetImageMask(constImage(),type,exceptionInfo);
5152 
5153  if (image == (MagickCore::Image *) NULL)
5154  return(Magick::Image());
5155  else
5156  return(Magick::Image(image));
5157 }
void localContrast(const double radius_, const double strength_)
Definition: Image.cpp:3519
Point density(void) const
Definition: Image.cpp:672
void gaussianBlur(const double radius_, const double sigma_)
Definition: Image.cpp:3238
void swirl(const double degrees_)
Definition: Image.cpp:4594
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:3607
void fillRule(const FillRule &fillRule_)
Definition: Options.cpp:275
void decipher(const std::string &passphrase_)
Definition: Image.cpp:2677
void clip(void)
Definition: Image.cpp:2309
size_t scene(void) const
Definition: Image.cpp:1362
MagickPPExport int operator!=(const Magick::Color &left_, const Magick::Color &right_)
Definition: Color.cpp:36
ImageMoments moments(void) const
Definition: Image.cpp:3602
void textUnderColor(const Color &underColor_)
Definition: Options.cpp:780
void page(const Geometry &pageSize_)
Definition: Options.cpp:425
void splice(const Geometry &geometry_)
Definition: Image.cpp:4497
void width(size_t width_)
Definition: Geometry.cpp:397
#define RestorePPChannelMask
Definition: Include.h:1538
size_t animationDelay(void) const
Definition: Image.cpp:359
void resize(const Geometry &geometry_)
Definition: Image.cpp:4148
bool adjoin(void) const
Definition: Image.cpp:300
Image writeMask(void) const
Definition: Image.cpp:4949
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:2144
RenderingIntent renderingIntent(void) const
Definition: Image.cpp:1333
StyleType fontStyle(void) const
Definition: Image.cpp:890
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:3587
size_t strokeMiterLimit(void) const
Definition: Image.cpp:1457
MagickCore::QuantizeInfo * quantizeInfo(void)
Definition: Options.cpp:972
void annotate(const std::string &text_, const Geometry &location_)
Definition: Image.cpp:1846
void transformSkewX(const double skewx_)
Definition: Image.cpp:1638
void depth(const size_t depth_)
Definition: Options.cpp:194
VirtualPixelMethod virtualPixelMethod(void) const
Definition: Image.cpp:1686
void fillPattern(const MagickCore::Image *fillPattern_)
Definition: Options.cpp:255
Magick::ImageStatistics statistics() const
Definition: Image.cpp:4537
bool setColorMetric(const Image &reference_)
Definition: Image.cpp:4341
void subImage(const size_t subImage_)
Definition: Options.cpp:678
void chromaGreenPrimary(const double x_, const double y_, const double z_)
Definition: Image.cpp:2243
void fx(const std::string expression_)
Definition: Image.cpp:3190
#define ThrowImageException
Definition: Image.cpp:30
Color matteColor(void) const
Definition: Image.cpp:348
OrientationType orientation(void) const
Definition: Image.cpp:1229
double meanErrorPerPixel(void) const
Definition: Image.cpp:1165
void process(std::string name_, const ::ssize_t argc_, const char **argv_)
Definition: Image.cpp:3931
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:1770
void writePixels(const QuantumType quantum_, unsigned char *destination_)
Definition: Image.cpp:4954
void charcoal(const double radius_=0.0, const double sigma_=1.0)
Definition: Image.cpp:2188
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:3263
void blur(const double radius_=0.0, const double sigma_=1.0)
Definition: Image.cpp:2095
Color borderColor(void) const
Definition: Image.cpp:440
std::string label(void) const
Definition: Image.cpp:1106
void contrast(const bool sharpen_)
Definition: Image.cpp:2585
void quantizeColorSpace(const ColorspaceType colorSpace_)
Definition: Options.cpp:461
void profile(const std::string name_, const Blob &colorProfile_)
Definition: Image.cpp:3942
Blob iccColorProfile(void) const
Definition: Image.cpp:1000
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:5000
void medianFilter(const double radius_=0.0)
Definition: Image.cpp:3564
void enhance(void)
Definition: Image.cpp:2865
size_t subRange(void) const
Definition: Image.cpp:1528
void height(size_t height_)
Definition: Geometry.cpp:357
void chop(const Geometry &geometry_)
Definition: Image.cpp:2213
MagickPPExport const char * raiseGeometryDefault
Definition: Image.cpp:34
void composite(const Image &compositeImage_, const Geometry &offset_, const CompositeOperator compose_=InCompositeOp)
Definition: Image.cpp:2523
void liquidRescale(const Geometry &geometry_)
Definition: Image.cpp:3497
void unsharpmask(const double radius_, const double sigma_, const double amount_, const double threshold_)
Definition: Image.cpp:4782
Color textUnderColor(void) const
Definition: Image.cpp:1616
#define DegreesToRadians(x)
Definition: Image.cpp:29
void readPixels(const QuantumType quantum_, const unsigned char *source_)
Definition: Image.cpp:4095
void negate(const bool grayscale_=false)
Definition: Image.cpp:3716
void connectedComponents(const size_t connectivity_)
Definition: Image.cpp:2573
void raise(const Geometry &geometry_=raiseGeometryDefault, const bool raisedFlag_=false)
Definition: Image.cpp:3979
void sparseColor(const ChannelType channel_, const SparseColorMethod method_, const size_t numberArguments_, const double *arguments_)
Definition: Image.cpp:4481
void clutChannel(const ChannelType channel_, const Image &clutImage_, const PixelInterpolateMethod method)
Definition: Image.cpp:2335
void whiteThreshold(const std::string &threshold_)
Definition: Image.cpp:4848
std::string directory(void) const
Definition: Image.cpp:704
void textInterwordSpacing(const double spacing_)
Definition: Options.cpp:758
void crop(const Geometry &geometry_)
Definition: Image.cpp:2655
void strokeColor(const Color &strokeColor_)
Definition: Options.cpp:567
void adaptiveResize(const Geometry &geometry_)
Definition: Image.cpp:1723
ImageType type(void) const
Definition: Image.cpp:1650
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:857
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:2317
void fontPointsize(const double pointSize_)
Definition: Options.cpp:329
void posterizeChannel(const ChannelType channel_, const size_t levels_, const DitherMethod method_)
Definition: Image.cpp:3920
size_t quality(void) const
Definition: Image.cpp:1254
void defineValue(const std::string &magick_, const std::string &key_, const std::string &value_)
Definition: Image.cpp:2715
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:4811
std::string comment(void) const
Definition: Image.cpp:604
Image separate(const ChannelType channel_) const
Definition: Image.cpp:4316
void verbose(const bool verboseFlag_)
Definition: Options.cpp:935
bool textAntiAlias(void) const
Definition: Image.cpp:1539
std::string magick(void) const
Definition: Image.cpp:1148
void shade(const double azimuth_=30, const double elevation_=30, const bool colorShading_=false)
Definition: Image.cpp:4370
STL namespace.
void transformReset(void)
Definition: Options.cpp:815
size_t modulusDepth(void) const
Definition: Image.cpp:1179
void waveletDenoise(const double threshold_, const double softness_)
Definition: Image.cpp:4835
Image & operator=(const Image &image_)
Definition: Image.cpp:280
void transformRotation(const double angle_)
Definition: Options.cpp:825
void write(Blob *blob_)
Definition: Image.cpp:4867
void meanShift(const size_t width_, const size_t height_, const double color_distance_)
Definition: Image.cpp:3551
void strokeAntiAlias(const bool flag_)
Definition: Options.cpp:556
void kuwaharaChannel(const ChannelType channel_, const double radius_=0.0, const double sigma_=1.0)
Definition: Image.cpp:3398
MagickSizeType fileSize(void) const
Definition: Image.cpp:780
void equalize(void)
Definition: Image.cpp:2876
void zoom(const Geometry &geometry_)
Definition: Image.cpp:4968
void autoThreshold(const AutoThresholdMethod method_)
Definition: Image.cpp:2057
void blurChannel(const ChannelType channel_, const double radius_=0.0, const double sigma_=1.0)
Definition: Image.cpp:2106
void morphologyChannel(const ChannelType channel_, const MorphologyMethod method_, const std::string kernel_, const ssize_t iterations_=1)
Definition: Image.cpp:3651
void highlightColor(const Color color_)
Definition: Image.cpp:986
std::string fileName(void) const
Definition: Image.cpp:775
ColorspaceType colorSpace(void) const
Definition: Image.cpp:570
const Options * constOptions(void) const
Definition: Image.cpp:5020
MagickPPExport int operator<(const Magick::Color &left_, const Magick::Color &right_)
Definition: Color.cpp:48
size_t quantizeColors(void) const
Definition: Image.cpp:1265
void yOff(::ssize_t yOff_)
Definition: Geometry.cpp:428
void quiet(const bool quiet_)
Definition: Options.cpp:503
Image uniqueColors(void) const
Definition: Image.cpp:4768
Image readMask(void) const
Definition: Image.cpp:4090
const MagickCore::ImageInfo * constImageInfo(void) const
Definition: Image.cpp:5010
void fontFamily(const std::string &family_)
Definition: Options.cpp:307
void posterize(const size_t levels_, const DitherMethod method_)
Definition: Image.cpp:3912
void colorspaceType(const ColorspaceType colorspace_)
Definition: Options.cpp:133
void rotationalBlurChannel(const ChannelType channel_, const double angle_)
Definition: Image.cpp:4218
void strokePattern(const MagickCore::Image *strokePattern_)
Definition: Options.cpp:648
void adaptiveSharpen(const double radius_=0.0, const double sigma_=1.0)
Definition: Image.cpp:1745
std::string fontFamily(void) const
Definition: Image.cpp:868
void oilPaint(const double radius_=0.0, const double sigma=1.0)
Definition: Image.cpp:3743
void contrastStretchChannel(const ChannelType channel_, const double blackPoint_, const double whitePoint_)
Definition: Image.cpp:2602
MagickCore::Image * replaceImage(MagickCore::Image *replacement_)
Definition: Image.cpp:5045
void floodFillTexture(const Geometry &point_, const Image &texture_, const bool invert_=false)
Definition: Image.cpp:3070
void transformScale(const double sx_, const double sy_)
Definition: Image.cpp:4678
FillRule fillRule(void) const
Definition: Image.cpp:802
void encipher(const std::string &passphrase_)
Definition: Image.cpp:2857
void textDirection(const DirectionType direction_)
Definition: Options.cpp:709
void spread(const double amount_=3.0)
Definition: Image.cpp:4526
CompressionType compressType(void) const
Definition: Image.cpp:636
bool verbose(void) const
Definition: Image.cpp:1672
void quantizeDitherMethod(const DitherMethod ditherMethod_)
Definition: Options.cpp:483
double compareChannel(const ChannelType channel_, const Image &reference_, const MetricType metric_)
Definition: Image.cpp:2474
void linearStretch(const double blackPoint_, const double whitePoint_)
Definition: Image.cpp:3488
void randomThresholdChannel(const ChannelType channel_, const double low_, const double high_)
Definition: Image.cpp:3998
size_t quantizeTreeDepth(void) const
Definition: Image.cpp:1310
void extent(const Geometry &geometry_)
Definition: Image.cpp:2941
void colorMatrix(const size_t order_, const double *color_matrix_)
Definition: Image.cpp:2418
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:638
Image strokePattern(void) const
Definition: Image.cpp:1471
void fontTypeMetricsMultiline(const std::string &text_, TypeMetric *metrics)
Definition: Image.cpp:3133
Geometry page(void) const
Definition: Image.cpp:1241
void motionBlur(const double radius_, const double sigma_, const double angle_)
Definition: Image.cpp:3704
bool debug(void) const
Definition: Image.cpp:647
void perceptibleChannel(const ChannelType channel_, const double epsilon_)
Definition: Image.cpp:3814
void emboss(const double radius_=0.0, const double sigma_=1.0)
Definition: Image.cpp:2846
void magnify(void)
Definition: Image.cpp:3530
ImageType identifyType(void) const
Definition: Image.cpp:3346
void polaroid(const std::string &caption_, const double angle_, const PixelInterpolateMethod method_)
Definition: Image.cpp:3899
void levelColors(const Color &blackColor_, const Color &whiteColor_, const bool invert_=true)
Definition: Image.cpp:3432
void segment(const double clusterThreshold_=1.0, const double smoothingThreshold_=1.5)
Definition: Image.cpp:4276
size_t decrease()
Definition: ImageRef.cpp:48
void grayscale(const PixelIntensityMethod method_)
Definition: Image.cpp:3317
void reduceNoise(void)
Definition: Image.cpp:4109
void clampChannel(const ChannelType channel_)
Definition: Image.cpp:2299
double strokeDashOffset(void) const
Definition: Image.cpp:1424
void channelDepth(const ChannelType channel_, const size_t depth_)
Definition: Image.cpp:467
void orderedDither(std::string thresholdMap_)
Definition: Image.cpp:3787
void strokeDashArray(const double *strokeDashArray_)
Definition: Options.cpp:580
DitherMethod quantizeDitherMethod(void) const
Definition: Image.cpp:1299
void strokeLineCap(const LineCap lineCap_)
Definition: Options.cpp:618
void stegano(const Image &watermark_)
Definition: Image.cpp:4542
void textEncoding(const std::string &encoding_)
Definition: Options.cpp:721
void sharpen(const double radius_=0.0, const double sigma_=1.0)
Definition: Image.cpp:4396
void colorFuzz(const double fuzz_)
Definition: Options.cpp:153
size_t subImage(void) const
Definition: Image.cpp:1517
void resample(const Point &density_)
Definition: Image.cpp:4136
MagickCore::Image *& image(void)
Definition: Image.cpp:4995
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:1064
void trim(void)
Definition: Image.cpp:4757
size_t depth(void) const
Definition: Image.cpp:699
MagickPPExport int operator<=(const Magick::Color &left_, const Magick::Color &right_)
Definition: Color.cpp:70
void solarize(const double factor_=50.0)
Definition: Image.cpp:4473
void textInterlineSpacing(const double spacing_)
Definition: Options.cpp:747
double fontPointsize(void) const
Definition: Image.cpp:879
void updateNoCopy(void *data_, const size_t length_, const Allocator allocator_=NewAllocator)
Definition: Blob.cpp:121
void textGravity(const GravityType gravity_)
Definition: Options.cpp:735
MagickPPExport int operator>=(const Magick::Color &left_, const Magick::Color &right_)
Definition: Color.cpp:64
void stereo(const Image &rightImage_)
Definition: Image.cpp:4553
void defineSet(const std::string &magick_, const std::string &key_, bool flag_)
Definition: Image.cpp:2685
void transformScale(const double sx_, const double sy_)
Definition: Options.cpp:851
void quantize(const bool measureError_=false)
Definition: Image.cpp:3965
void read(const Blob &blob_)
Definition: Image.cpp:4009
void autoGammaChannel(const ChannelType channel_)
Definition: Image.cpp:2013
void frame(const Geometry &geometry_=frameGeometryDefault)
Definition: Image.cpp:3147
void font(const std::string &font_)
Definition: Options.cpp:285
void orderedDitherChannel(const ChannelType channel_, std::string thresholdMap_)
Definition: Image.cpp:3795
void fontWeight(const size_t weight_)
Definition: Options.cpp:352
#define ThrowPPDrawException(quiet)
Definition: Include.h:1542
Blob iptcProfile(void) const
Definition: Image.cpp:1052
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:3303
void flip(void)
Definition: Image.cpp:2985
LineCap strokeLineCap(void) const
Definition: Image.cpp:1435
void shave(const Geometry &geometry_)
Definition: Image.cpp:4421
void strokeWidth(const double strokeWidth_)
Definition: Options.cpp:667
std::string textEncoding(void) const
Definition: Image.cpp:1561
#define MagickPPExport
Definition: Include.h:268
void tint(const std::string opacity_)
Definition: Image.cpp:4651
void perceptible(const double epsilon_)
Definition: Image.cpp:3806
void blackThreshold(const std::string &threshold_)
Definition: Image.cpp:2065
bool isValid(void) const
Definition: Image.cpp:1091
void erase(void)
Definition: Image.cpp:2884
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:4407
FilterType filterType(void) const
Definition: Image.cpp:846
double xResolution(void) const
Definition: Image.cpp:1702
bool quantizeDither(void) const
Definition: Image.cpp:1288
InterlaceType interlaceType(void) const
Definition: Image.cpp:1019
const void * getConstMetacontent(void) const
Definition: Image.cpp:3275
std::string format(void) const
Definition: Image.cpp:906
void blackThresholdChannel(const ChannelType channel_, const std::string &threshold_)
Definition: Image.cpp:2073
void edge(const double radius_=0.0)
Definition: Image.cpp:2835
size_t colorMapSize(void) const
Definition: Image.cpp:550
void kuwahara(const double radius_=0.0, const double sigma_=1.0)
Definition: Image.cpp:3387
void resolutionUnits(const ResolutionType resolutionUnits_)
Definition: Options.cpp:513
std::string signature(const bool force_=false) const
Definition: Image.cpp:4456
void texture(const Image &texture_)
Definition: Image.cpp:4613
void xOff(::ssize_t xOff_)
Definition: Geometry.cpp:418
void sepiaTone(const double threshold_)
Definition: Image.cpp:4330
size_t totalColors(void) const
Definition: Image.cpp:1621
PixelInterpolateMethod interpolate(void) const
Definition: Image.cpp:1030
void transparentChroma(const Color &colorLow_, const Color &colorHigh_)
Definition: Image.cpp:4706
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:4383
void whiteThresholdChannel(const ChannelType channel_, const std::string &threshold_)
Definition: Image.cpp:4856
void minify(void)
Definition: Image.cpp:3576
void syncPixels(void)
Definition: Image.cpp:4606
void scale(const Geometry &geometry_)
Definition: Image.cpp:4254
Image subImageSearch(const Image &reference_, const MetricType metric_, Geometry *offset_, double *similarityMetric_, const double similarityThreshold=(-1.0))
Definition: Image.cpp:4572
MagickCore::ImageInfo * imageInfo(void)
Definition: Image.cpp:5005
void unsharpmaskChannel(const ChannelType channel_, const double radius_, const double sigma_, const double amount_, const double threshold_)
Definition: Image.cpp:4795
void transformRotation(const double angle_)
Definition: Image.cpp:1632
void artifact(const std::string &name_, const std::string &value_)
Definition: Image.cpp:1956
double textKerning(void) const
Definition: Image.cpp:1605
double colorFuzz(void) const
Definition: Image.cpp:533
void transverse(void)
Definition: Image.cpp:4746
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:2155
MagickPPExport const char * frameGeometryDefault
Definition: Image.cpp:33
void textAntiAlias(const bool flag_)
Definition: Options.cpp:698
const MagickCore::QuantizeInfo * constQuantizeInfo(void) const
Definition: Image.cpp:5030
void draw(const Drawable &drawable_)
Definition: Image.cpp:2786
void randomThreshold(const double low_, const double high_)
Definition: Image.cpp:3991
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:2892
void rotationalBlur(const double angle_)
Definition: Image.cpp:4207
ColorspaceType colorSpaceType(void) const
Definition: Image.cpp:584
Geometry boundingBox(void) const
Definition: Image.cpp:445
void implode(const double factor_)
Definition: Image.cpp:3357
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:1795
Color strokeColor(void) const
Definition: Image.cpp:1402
double normalizedMeanError(void) const
Definition: Image.cpp:1218
#define ClonePPDrawException(wand)
Definition: Include.h:1534
void masklightColor(const Color color_)
Definition: Image.cpp:1156
void chromaBluePrimary(const double x_, const double y_, const double z_)
Definition: Image.cpp:2227
void clamp(void)
Definition: Image.cpp:2291
const double * strokeDashArray(void) const
Definition: Image.cpp:1413
void levelize(const double blackPoint_, const double whitePoint_, const double gamma_=1.0)
Definition: Image.cpp:3468
void adaptiveSharpenChannel(const ChannelType channel_, const double radius_=0.0, const double sigma_=1.0)
Definition: Image.cpp:1756
void wave(const double amplitude_=25.0, const double wavelength_=150.0)
Definition: Image.cpp:4823
double gamma(void) const
Definition: Image.cpp:946
void threshold(const double threshold_)
Definition: Image.cpp:4621
void convolve(const size_t order_, const double *kernel_)
Definition: Image.cpp:2613
void roll(const Geometry &roll_)
Definition: Image.cpp:4173
void rx(const double rx_)
Definition: Drawable.h:260
double yResolution(void) const
Definition: Image.cpp:1707
void strip(void)
Definition: Image.cpp:4564
void gaussianBlurChannel(const ChannelType channel_, const double radius_, const double sigma_)
Definition: Image.cpp:3249
void thumbnail(const Geometry &geometry_)
Definition: Image.cpp:4629
void alphaChannel(AlphaChannelOption alphaOption_)
Definition: Image.cpp:1838
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:1712
void display(void)
Definition: Image.cpp:2766
void ping(const std::string &imageSpec_)
Definition: Image.cpp:3830
void selectiveBlur(const double radius_, const double sigma_, const double threshold_)
Definition: Image.cpp:4288
void autoOrient(void)
Definition: Image.cpp:2042
void transparent(const Color &color_, const bool inverse_=false)
Definition: Image.cpp:4684
void inverseFourierTransform(const Image &phase_)
Definition: Image.cpp:3369
void magick(const std::string &magick_)
Definition: Options.cpp:389
void colorize(const unsigned int alpha_, const Color &penColor_)
Definition: Image.cpp:2346
double x(void) const
Definition: Geometry.cpp:701
DirectionType textDirection() const
Definition: Image.cpp:1550
#define GetAndSetPPChannelMask(channel)
Definition: Include.h:1530
void cdl(const std::string &cdl_)
Definition: Image.cpp:2169
void quality(const size_t quality_)
Definition: Options.cpp:441
Geometry geometry(void) const
Definition: Image.cpp:951
void quantizeTreeDepth(const size_t treeDepth_)
Definition: Options.cpp:493
void fontStyle(const StyleType style_)
Definition: Options.cpp:340
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:2773
void isValid(const bool isValid_)
Definition: Image.cpp:1075
void border(const Geometry &geometry_=borderGeometryDefault)
Definition: Image.cpp:2120
void addNoise(const NoiseType noiseType_, const double attenuate_=1.0)
Definition: Image.cpp:1784
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:4232
void clut(const Image &clutImage_, const PixelInterpolateMethod method)
Definition: Image.cpp:2326
void affineTransform(const DrawableAffine &affine)
Definition: Image.cpp:1809
double normalizedMaxError(void) const
Definition: Image.cpp:1213
size_t rows(void) const
Definition: Image.cpp:1351
void isValid(const bool valid_)
Definition: Color.cpp:301
size_t columns(void) const
Definition: Image.cpp:589
Magick::ImagePerceptualHash perceptualHash() const
Definition: Image.cpp:3825
void attribute(const std::string name_, const char *value_)
Definition: Image.cpp:1973
void houghLine(const size_t width_, const size_t height_, const size_t threshold_=40)
Definition: Image.cpp:3333
void levelizeChannel(const ChannelType channel_, const double blackPoint_, const double whitePoint_, const double gamma_=1.0)
Definition: Image.cpp:3477
Color fillColor(void) const
Definition: Image.cpp:791
Geometry montageGeometry(void) const
Definition: Image.cpp:1201
void sketch(const double radius_=0.0, const double sigma_=1.0, const double angle_=0.0)
Definition: Image.cpp:4461
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:688
Image fillPattern(void) const
Definition: Image.cpp:816
void transformOrigin(const double tx_, const double ty_)
Definition: Options.cpp:791
void transformSkewY(const double skewy_)
Definition: Options.cpp:900
std::string formatExpression(const std::string expression)
Definition: Image.cpp:925
void transformSkewX(const double skewx_)
Definition: Options.cpp:875
void x11Display(const std::string &display_)
Definition: Options.cpp:945
void quantizeColors(const size_t colors_)
Definition: Options.cpp:451
LineJoin strokeLineJoin(void) const
Definition: Image.cpp:1446
void blueShift(const double factor_=1.5)
Definition: Image.cpp:2084
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:608
void chromaRedPrimary(const double x_, const double y_, const double z_)
Definition: Image.cpp:2259
size_t baseColumns(void) const
Definition: Image.cpp:403
double textInterwordSpacing(void) const
Definition: Image.cpp:1594
MagickPPExport int operator>(const Magick::Color &left_, const Magick::Color &right_)
Definition: Color.cpp:42
void transpose(void)
Definition: Image.cpp:4735
MagickCore::DrawInfo * drawInfo(void)
Definition: Options.cpp:962
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:1321
ResolutionType resolutionUnits(void) const
Definition: Image.cpp:1346
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:4357
class MagickPPExport Image
Definition: Drawable.h:720
void chromaWhitePoint(const double x_, const double y_, const double z_)
Definition: Image.cpp:2275
void autoLevelChannel(const ChannelType channel_)
Definition: Image.cpp:2032
void quantizeDither(const bool ditherFlag_)
Definition: Options.cpp:471
void interlaceType(const InterlaceType interlace_)
Definition: Options.cpp:379
void negateChannel(const ChannelType channel_, const bool grayscale_=false)
Definition: Image.cpp:3724
std::string x11Display(void) const
Definition: Image.cpp:1697
size_t fontWeight(void) const
Definition: Image.cpp:901
void repage()
Definition: Image.cpp:4126
double textInterlineSpacing(void) const
Definition: Image.cpp:1583
GravityType textGravity() const
Definition: Image.cpp:1572
void brightnessContrast(const double brightness_=0.0, const double contrast_=0.0)
Definition: Image.cpp:2135
MagickCore::Image *& image(void)
Definition: ImageRef.cpp:66
MagickCore::QuantizeInfo * quantizeInfo(void)
Definition: Image.cpp:5025
size_t length(void) const
Definition: Blob.cpp:108
void floodFillColor(const Geometry &point_, const Color &fillColor_, const bool invert_=false)
Definition: Image.cpp:3032
void type(const ImageType type_)
Definition: Options.cpp:925
void flop(void)
Definition: Image.cpp:3108
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:3421
void despeckle(void)
Definition: Image.cpp:2755