Magick++  7.0.10
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);
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 (bool(alphaFlag_) != bool(constImage()->alpha_trait))
315  SetImageAlpha(image(),OpaqueAlpha,exceptionInfo);
317 
318  image()->alpha_trait=alphaFlag_ ? BlendPixelTrait : UndefinedPixelTrait;
319 }
320 
321 bool Magick::Image::alpha(void) const
322 {
323  if (constImage()->alpha_trait == BlendPixelTrait)
324  return(true);
325  else
326  return(false);
327 }
328 
329 void Magick::Image::matteColor(const Color &matteColor_)
330 {
331  modifyImage();
332 
333  if (matteColor_.isValid())
334  {
335  image()->matte_color=matteColor_;
336  options()->matteColor(matteColor_);
337  }
338  else
339  {
340  // Set to default matte color
341  Color tmpColor("#BDBDBD");
342  image()->matte_color=tmpColor;
343  options()->matteColor(tmpColor);
344  }
345 }
346 
348 {
349  return(Color(constImage()->matte_color));
350 }
351 
352 void Magick::Image::animationDelay(const size_t delay_)
353 {
354  modifyImage();
355  image()->delay=delay_;
356 }
357 
359 {
360  return(constImage()->delay);
361 }
362 
363 void Magick::Image::animationIterations(const size_t iterations_)
364 {
365  modifyImage();
366  image()->iterations=iterations_;
367 }
368 
370 {
371  return(constImage()->iterations);
372 }
373 
374 void Magick::Image::backgroundColor(const Color &backgroundColor_)
375 {
376  modifyImage();
377 
378  if (backgroundColor_.isValid())
379  image()->background_color=backgroundColor_;
380  else
381  image()->background_color=Color();
382 
383  options()->backgroundColor(backgroundColor_);
384 }
385 
387 {
388  return(constOptions()->backgroundColor());
389 }
390 
391 void Magick::Image::backgroundTexture(const std::string &backgroundTexture_)
392 {
393  modifyImage();
394  options()->backgroundTexture(backgroundTexture_);
395 }
396 
397 std::string Magick::Image::backgroundTexture(void) const
398 {
399  return(constOptions()->backgroundTexture());
400 }
401 
402 size_t Magick::Image::baseColumns(void) const
403 {
404  return(constImage()->magick_columns);
405 }
406 
407 std::string Magick::Image::baseFilename(void) const
408 {
409  return(std::string(constImage()->magick_filename));
410 }
411 
412 size_t Magick::Image::baseRows(void) const
413 {
414  return(constImage()->magick_rows);
415 }
416 
418 {
419  image()->black_point_compensation=(MagickBooleanType) flag_;
420 }
421 
423 {
424  return(static_cast<bool>(constImage()->black_point_compensation));
425 }
426 
427 void Magick::Image::borderColor(const Color &borderColor_)
428 {
429  modifyImage();
430 
431  if (borderColor_.isValid())
432  image()->border_color=borderColor_;
433  else
434  image()->border_color=Color();
435 
436  options()->borderColor(borderColor_);
437 }
438 
440 {
441  return(constOptions()->borderColor());
442 }
443 
445 {
446  RectangleInfo
447  bbox;
448 
450  bbox=GetImageBoundingBox(constImage(),exceptionInfo);
452  return(Geometry(bbox));
453 }
454 
455 void Magick::Image::boxColor(const Color &boxColor_)
456 {
457  modifyImage();
458  options()->boxColor(boxColor_);
459 }
460 
462 {
463  return(constOptions()->boxColor());
464 }
465 
466 void Magick::Image::channelDepth(const ChannelType channel_,
467  const size_t depth_)
468 {
469  modifyImage();
471  GetAndSetPPChannelMask(channel_);
472  SetImageDepth(image(),depth_,exceptionInfo);
475 }
476 
477 size_t Magick::Image::channelDepth(const ChannelType channel_)
478 {
479  size_t
480  channel_depth;
481 
483  GetAndSetPPChannelMask(channel_);
484  channel_depth=GetImageDepth(constImage(),exceptionInfo);
487  return(channel_depth);
488 }
489 
491 {
492  return(constImage()->number_channels);
493 }
494 
495 void Magick::Image::classType(const ClassType class_)
496 {
497  if (classType() == PseudoClass && class_ == DirectClass)
498  {
499  // Use SyncImage to synchronize the DirectClass pixels with the
500  // color map and then set to DirectClass type.
501  modifyImage();
503  SyncImage(image(),exceptionInfo);
505  image()->colormap=(PixelInfo *)RelinquishMagickMemory(image()->colormap);
506  image()->storage_class=static_cast<MagickCore::ClassType>(DirectClass);
507  return;
508  }
509 
510  if (classType() == DirectClass && class_ == PseudoClass)
511  {
512  // Quantize to create PseudoClass color map
513  modifyImage();
514  quantizeColors(MaxColormapSize);
515  quantize();
516  image()->storage_class=static_cast<MagickCore::ClassType>(PseudoClass);
517  }
518 }
519 
520 Magick::ClassType Magick::Image::classType(void) const
521 {
522  return static_cast<Magick::ClassType>(constImage()->storage_class);
523 }
524 
525 void Magick::Image::colorFuzz(const double fuzz_)
526 {
527  modifyImage();
528  image()->fuzz=fuzz_;
529  options()->colorFuzz(fuzz_);
530 }
531 
532 double Magick::Image::colorFuzz(void) const
533 {
534  return(constOptions()->colorFuzz());
535 }
536 
537 void Magick::Image::colorMapSize(const size_t entries_)
538 {
539  if (entries_ >MaxColormapSize)
540  throwExceptionExplicit(MagickCore::OptionError,
541  "Colormap entries must not exceed MaxColormapSize");
542 
543  modifyImage();
545  (void) AcquireImageColormap(image(),entries_,exceptionInfo);
547 }
548 
549 size_t Magick::Image::colorMapSize(void) const
550 {
551  if (!constImage()->colormap)
552  throwExceptionExplicit(MagickCore::OptionError,
553  "Image does not contain a colormap");
554 
555  return(constImage()->colors);
556 }
557 
558 void Magick::Image::colorSpace(const ColorspaceType colorSpace_)
559 {
560  if (image()->colorspace == colorSpace_)
561  return;
562 
563  modifyImage();
565  TransformImageColorspace(image(),colorSpace_,exceptionInfo);
567 }
568 
569 Magick::ColorspaceType Magick::Image::colorSpace(void) const
570 {
571  return (constImage()->colorspace);
572 }
573 
574 void Magick::Image::colorSpaceType(const ColorspaceType colorSpace_)
575 {
576  modifyImage();
578  SetImageColorspace(image(),colorSpace_,exceptionInfo);
580  options()->colorspaceType(colorSpace_);
581 }
582 
583 Magick::ColorspaceType Magick::Image::colorSpaceType(void) const
584 {
585  return(constOptions()->colorspaceType());
586 }
587 
588 size_t Magick::Image::columns(void) const
589 {
590  return(constImage()->columns);
591 }
592 
593 void Magick::Image::comment(const std::string &comment_)
594 {
595  modifyImage();
597  SetImageProperty(image(),"Comment",NULL,exceptionInfo);
598  if (comment_.length() > 0)
599  SetImageProperty(image(),"Comment",comment_.c_str(),exceptionInfo);
601 }
602 
603 std::string Magick::Image::comment(void) const
604 {
605  const char
606  *value;
607 
609  value=GetImageProperty(constImage(),"Comment",exceptionInfo);
611 
612  if (value)
613  return(std::string(value));
614 
615  return(std::string()); // Intentionally no exception
616 }
617 
618 void Magick::Image::compose(const CompositeOperator compose_)
619 {
620  image()->compose=compose_;
621 }
622 
623 Magick::CompositeOperator Magick::Image::compose(void) const
624 {
625  return(constImage()->compose);
626 }
627 
628 void Magick::Image::compressType(const CompressionType compressType_)
629 {
630  modifyImage();
631  image()->compression=compressType_;
632  options()->compressType(compressType_);
633 }
634 
635 Magick::CompressionType Magick::Image::compressType(void) const
636 {
637  return(constImage()->compression);
638 }
639 
640 void Magick::Image::debug(const bool flag_)
641 {
642  modifyImage();
643  options()->debug(flag_);
644 }
645 
646 bool Magick::Image::debug(void) const
647 {
648  return(constOptions()->debug());
649 }
650 
651 void Magick::Image::density(const Point &density_)
652 {
653  modifyImage();
654  options()->density(density_);
655  if (density_.isValid())
656  {
657  image()->resolution.x=density_.x();
658  if (density_.y() != 0.0)
659  image()->resolution.y=density_.y();
660  else
661  image()->resolution.y=density_.x();
662  }
663  else
664  {
665  // Reset to default
666  image()->resolution.x=0.0;
667  image()->resolution.y=0.0;
668  }
669 }
670 
672 {
673  if (isValid())
674  {
675  ssize_t
676  x_resolution=72,
677  y_resolution=72;
678 
679  if (constImage()->resolution.x > 0.0)
680  x_resolution=constImage()->resolution.x;
681 
682  if (constImage()->resolution.y > 0.0)
683  y_resolution=constImage()->resolution.y;
684 
685  return(Point(x_resolution,y_resolution));
686  }
687 
688  return(constOptions()->density());
689 }
690 
691 void Magick::Image::depth(const size_t depth_)
692 {
693  modifyImage();
694  image()->depth=depth_;
695  options()->depth(depth_);
696 }
697 
698 size_t Magick::Image::depth(void) const
699 {
700  return(constImage()->depth);
701 }
702 
703 std::string Magick::Image::directory(void) const
704 {
705  if (constImage()->directory)
706  return(std::string(constImage()->directory));
707 
708  if (!quiet())
709  throwExceptionExplicit(MagickCore::CorruptImageWarning,
710  "Image does not contain a directory");
711 
712  return(std::string());
713 }
714 
715 void Magick::Image::endian(const Magick::EndianType endian_)
716 {
717  modifyImage();
718  options()->endian(endian_);
719  image()->endian=endian_;
720 }
721 
722 Magick::EndianType Magick::Image::endian(void) const
723 {
724  return(constImage()->endian);
725 }
726 
727 void Magick::Image::exifProfile(const Magick::Blob &exifProfile_)
728 {
729  modifyImage();
730 
731  if (exifProfile_.data() != 0)
732  {
733  StringInfo
734  *exif_profile;
735 
736  exif_profile=AcquireStringInfo(exifProfile_.length());
737  SetStringInfoDatum(exif_profile,(unsigned char *) exifProfile_.data());
739  (void) SetImageProfile(image(),"exif",exif_profile,exceptionInfo);
740  exif_profile=DestroyStringInfo(exif_profile);
742  }
743 }
744 
746 {
747  const StringInfo
748  *exif_profile;
749 
750  exif_profile=GetImageProfile(constImage(),"exif");
751  if (exif_profile == (StringInfo *) NULL)
752  return(Blob());
753  return(Blob(GetStringInfoDatum(exif_profile),
754  GetStringInfoLength(exif_profile)));
755 }
756 
757 void Magick::Image::fileName(const std::string &fileName_)
758 {
759  ssize_t
760  max_length;
761 
762  modifyImage();
763 
764  max_length=sizeof(image()->filename)-1;
765  fileName_.copy(image()->filename,max_length);
766  if ((ssize_t) fileName_.length() > max_length)
767  image()->filename[max_length]=0;
768  else
769  image()->filename[fileName_.length()]=0;
770 
771  options()->fileName(fileName_);
772 }
773 
774 std::string Magick::Image::fileName(void) const
775 {
776  return(constOptions()->fileName());
777 }
778 
779 MagickCore::MagickSizeType Magick::Image::fileSize(void) const
780 {
781  return(GetBlobSize(constImage()));
782 }
783 
785 {
786  modifyImage();
787  options()->fillColor(fillColor_);
788 }
789 
791 {
792  return(constOptions()->fillColor());
793 }
794 
795 void Magick::Image::fillRule(const Magick::FillRule &fillRule_)
796 {
797  modifyImage();
798  options()->fillRule(fillRule_);
799 }
800 
801 Magick::FillRule Magick::Image::fillRule(void) const
802 {
803  return constOptions()->fillRule();
804 }
805 
806 void Magick::Image::fillPattern(const Image &fillPattern_)
807 {
808  modifyImage();
809  if (fillPattern_.isValid())
810  options()->fillPattern(fillPattern_.constImage());
811  else
812  options()->fillPattern(static_cast<MagickCore::Image*>(NULL));
813 }
814 
816 {
817  // FIXME: This is inordinately innefficient
818  const MagickCore::Image
819  *tmpTexture;
820 
821  Image
822  texture;
823 
824  tmpTexture=constOptions()->fillPattern();
825 
826  if (tmpTexture)
827  {
829  *image;
830 
832  image=CloneImage(tmpTexture,0,0,MagickTrue,exceptionInfo);
833  texture.replaceImage(image);
835  }
836  return(texture);
837 }
838 
839 void Magick::Image::filterType(const Magick::FilterType filterType_)
840 {
841  modifyImage();
842  image()->filter=filterType_;
843 }
844 
845 Magick::FilterType Magick::Image::filterType(void) const
846 {
847  return(constImage()->filter);
848 }
849 
850 void Magick::Image::font(const std::string &font_)
851 {
852  modifyImage();
853  options()->font(font_);
854 }
855 
856 std::string Magick::Image::font(void) const
857 {
858  return(constOptions()->font());
859 }
860 
861 void Magick::Image::fontFamily(const std::string &family_)
862 {
863  modifyImage();
864  options()->fontFamily(family_);
865 }
866 
867 std::string Magick::Image::fontFamily(void) const
868 {
869  return(constOptions()->fontFamily());
870 }
871 
872 void Magick::Image::fontPointsize(const double pointSize_)
873 {
874  modifyImage();
875  options()->fontPointsize(pointSize_);
876 }
877 
879 {
880  return(constOptions()->fontPointsize());
881 }
882 
883 void Magick::Image::fontStyle(const StyleType pointSize_)
884 {
885  modifyImage();
886  options()->fontStyle(pointSize_);
887 }
888 
889 Magick::StyleType Magick::Image::fontStyle(void) const
890 {
891  return(constOptions()->fontStyle());
892 }
893 
894 void Magick::Image::fontWeight(const size_t weight_)
895 {
896  modifyImage();
897  options()->fontWeight(weight_);
898 }
899 
900 size_t Magick::Image::fontWeight(void) const
901 {
902  return(constOptions()->fontWeight());
903 }
904 
905 std::string Magick::Image::format(void) const
906 {
907  const MagickInfo
908  *magick_info;
909 
911  magick_info=GetMagickInfo(constImage()->magick,exceptionInfo);
913 
914  if ((magick_info != 0) && (*magick_info->description != '\0'))
915  return(std::string(magick_info->description));
916 
917  if (!quiet())
918  throwExceptionExplicit(MagickCore::CorruptImageWarning,
919  "Unrecognized image magick type");
920 
921  return(std::string());
922 }
923 
924 std::string Magick::Image::formatExpression(const std::string expression)
925 {
926  char
927  *text;
928 
929  std::string
930  text_string;
931 
933  modifyImage();
934  text=InterpretImageProperties(imageInfo(),image(),expression.c_str(),
935  exceptionInfo);
936  if (text != (char *) NULL)
937  {
938  text_string=std::string(text);
939  text=DestroyString(text);
940  }
942  return(text_string);
943 }
944 
945 double Magick::Image::gamma(void) const
946 {
947  return(constImage()->gamma);
948 }
949 
951 {
952  if (constImage()->geometry)
953  return Geometry(constImage()->geometry);
954 
955  if (!quiet())
956  throwExceptionExplicit(MagickCore::OptionWarning,
957  "Image does not contain a geometry");
958 
959  return(Geometry());
960 }
961 
963  const MagickCore::DisposeType disposeMethod_)
964 {
965  modifyImage();
966  image()->dispose=disposeMethod_;
967 }
968 
969 MagickCore::DisposeType Magick::Image::gifDisposeMethod(void) const
970 {
971  return(constImage()->dispose);
972 }
973 
974 bool Magick::Image::hasChannel(const PixelChannel channel) const
975 {
976  if (GetPixelChannelTraits(constImage(),channel) == UndefinedPixelTrait)
977  return(false);
978 
979  if (channel == GreenPixelChannel || channel == BluePixelChannel)
980  return (GetPixelChannelOffset(constImage(),channel) == (ssize_t)channel);
981 
982  return(true);
983 }
984 
986 {
987  std::string
988  value;
989 
990  value=color_;
991  artifact("compare:highlight-color",value);
992 }
993 
995 {
996  profile("icc",colorProfile_);
997 }
998 
1000 {
1001  const StringInfo
1002  *color_profile;
1003 
1004  color_profile=GetImageProfile(constImage(),"icc");
1005  if (color_profile == (StringInfo *) NULL)
1006  return(Blob());
1007  return(Blob(GetStringInfoDatum(color_profile),GetStringInfoLength(
1008  color_profile)));
1009 }
1010 
1011 void Magick::Image::interlaceType(const Magick::InterlaceType interlace_)
1012 {
1013  modifyImage();
1014  image()->interlace=interlace_;
1015  options()->interlaceType(interlace_);
1016 }
1017 
1018 Magick::InterlaceType Magick::Image::interlaceType(void) const
1019 {
1020  return(constImage()->interlace);
1021 }
1022 
1023 void Magick::Image::interpolate(const PixelInterpolateMethod interpolate_)
1024 {
1025  modifyImage();
1026  image()->interpolate=interpolate_;
1027 }
1028 
1029 Magick::PixelInterpolateMethod Magick::Image::interpolate(void) const
1030 {
1031  return constImage()->interpolate;
1032 }
1033 
1034 void Magick::Image::iptcProfile(const Magick::Blob &iptcProfile_)
1035 {
1036  modifyImage();
1037  if (iptcProfile_.data() != 0)
1038  {
1039  StringInfo
1040  *iptc_profile;
1041 
1042  iptc_profile=AcquireStringInfo(iptcProfile_.length());
1043  SetStringInfoDatum(iptc_profile,(unsigned char *) iptcProfile_.data());
1045  (void) SetImageProfile(image(),"iptc",iptc_profile,exceptionInfo);
1046  iptc_profile=DestroyStringInfo(iptc_profile);
1048  }
1049 }
1050 
1052 {
1053  const StringInfo
1054  *iptc_profile;
1055 
1056  iptc_profile=GetImageProfile(constImage(),"iptc");
1057  if (iptc_profile == (StringInfo *) NULL)
1058  return(Blob());
1059  return(Blob(GetStringInfoDatum(iptc_profile),GetStringInfoLength(
1060  iptc_profile)));
1061 }
1062 
1063 bool Magick::Image::isOpaque(void) const
1064 {
1065  MagickBooleanType
1066  result;
1067 
1069  result=IsImageOpaque(constImage(),exceptionInfo);
1071  return(result != MagickFalse ? true : false);
1072 }
1073 
1074 void Magick::Image::isValid(const bool isValid_)
1075 {
1076  if (!isValid_)
1077  {
1078  delete _imgRef;
1079  _imgRef=new ImageRef;
1080  }
1081  else if (!isValid())
1082  {
1083  // Construct with single-pixel black image to make
1084  // image valid. This is an obvious hack.
1085  size(Geometry(1,1));
1086  read("xc:black");
1087  }
1088 }
1089 
1090 bool Magick::Image::isValid(void) const
1091 {
1092  return rows() && columns();
1093 }
1094 
1095 void Magick::Image::label(const std::string &label_)
1096 {
1097  modifyImage();
1099  (void) SetImageProperty(image(),"Label",NULL,exceptionInfo);
1100  if (label_.length() > 0)
1101  (void) SetImageProperty(image(),"Label",label_.c_str(),exceptionInfo);
1103 }
1104 
1105 std::string Magick::Image::label(void) const
1106 {
1107  const char
1108  *value;
1109 
1111  value=GetImageProperty(constImage(),"Label",exceptionInfo);
1113 
1114  if (value)
1115  return(std::string(value));
1116 
1117  return(std::string());
1118 }
1119 
1121 {
1122  std::string
1123  value;
1124 
1125  value=color_;
1126  artifact("compare:lowlight-color",value);
1127 }
1128 
1129 void Magick::Image::magick(const std::string &magick_)
1130 {
1131  size_t
1132  length;
1133 
1134  modifyImage();
1135 
1136  length=sizeof(image()->magick)-1;
1137  if (magick_.length() < length)
1138  length=magick_.length();
1139 
1140  if (!magick_.empty())
1141  magick_.copy(image()->magick,length);
1142  image()->magick[length]=0;
1143 
1144  options()->magick(magick_);
1145 }
1146 
1147 std::string Magick::Image::magick(void) const
1148 {
1149  if (*(constImage()->magick) != '\0')
1150  return(std::string(constImage()->magick));
1151 
1152  return(constOptions()->magick());
1153 }
1154 
1156 {
1157  std::string
1158  value;
1159 
1160  value=color_;
1161  artifact("compare:masklight-color",value);
1162 }
1163 
1165 {
1166  return(constImage()->error.mean_error_per_pixel);
1167 }
1168 
1169 void Magick::Image::modulusDepth(const size_t depth_)
1170 {
1171  modifyImage();
1173  SetImageDepth(image(),depth_,exceptionInfo);
1175  options()->depth(depth_);
1176 }
1177 
1179 {
1180  size_t
1181  depth;
1182 
1184  depth=GetImageDepth(constImage(),exceptionInfo);
1186  return(depth);
1187 }
1188 
1189 void Magick::Image::monochrome(const bool monochromeFlag_)
1190 {
1191  modifyImage();
1192  options()->monochrome(monochromeFlag_);
1193 }
1194 
1196 {
1197  return(constOptions()->monochrome());
1198 }
1199 
1201 {
1202  if (constImage()->montage)
1203  return Magick::Geometry(constImage()->montage);
1204 
1205  if (!quiet())
1206  throwExceptionExplicit(MagickCore::CorruptImageWarning,
1207  "Image does not contain a montage");
1208 
1209  return(Magick::Geometry());
1210 }
1211 
1213 {
1214  return(constImage()->error.normalized_maximum_error);
1215 }
1216 
1218 {
1219  return(constImage()->error.normalized_mean_error);
1220 }
1221 
1222 void Magick::Image::orientation(const Magick::OrientationType orientation_)
1223 {
1224  modifyImage();
1225  image()->orientation=orientation_;
1226 }
1227 
1228 Magick::OrientationType Magick::Image::orientation(void) const
1229 {
1230  return(constImage()->orientation);
1231 }
1232 
1234 {
1235  modifyImage();
1236  options()->page(pageSize_);
1237  image()->page=pageSize_;
1238 }
1239 
1241 {
1242  return(Geometry(constImage()->page.width,constImage()->page.height,
1243  constImage()->page.x,constImage()->page.y));
1244 }
1245 
1246 void Magick::Image::quality(const size_t quality_)
1247 {
1248  modifyImage();
1249  image()->quality=quality_;
1250  options()->quality(quality_);
1251 }
1252 
1253 size_t Magick::Image::quality(void) const
1254 {
1255  return(constImage()->quality);
1256 }
1257 
1258 void Magick::Image::quantizeColors(const size_t colors_)
1259 {
1260  modifyImage();
1261  options()->quantizeColors(colors_);
1262 }
1263 
1265 {
1266  return(constOptions()->quantizeColors());
1267 }
1268 
1270  const Magick::ColorspaceType colorSpace_)
1271 {
1272  modifyImage();
1273  options()->quantizeColorSpace(colorSpace_);
1274 }
1275 
1276 Magick::ColorspaceType Magick::Image::quantizeColorSpace(void) const
1277 {
1278  return(constOptions()->quantizeColorSpace());
1279 }
1280 
1281 void Magick::Image::quantizeDither(const bool ditherFlag_)
1282 {
1283  modifyImage();
1284  options()->quantizeDither(ditherFlag_);
1285 }
1286 
1288 {
1289  return(constOptions()->quantizeDither());
1290 }
1291 
1292 void Magick::Image::quantizeDitherMethod(const DitherMethod ditherMethod_)
1293 {
1294  modifyImage();
1295  options()->quantizeDitherMethod(ditherMethod_);
1296 }
1297 
1298 MagickCore::DitherMethod Magick::Image::quantizeDitherMethod(void) const
1299 {
1300  return(constOptions()->quantizeDitherMethod());
1301 }
1302 
1303 void Magick::Image::quantizeTreeDepth(const size_t treeDepth_)
1304 {
1305  modifyImage();
1306  options()->quantizeTreeDepth(treeDepth_);
1307 }
1308 
1310 {
1311  return(constOptions()->quantizeTreeDepth());
1312 }
1313 
1314 void Magick::Image::quiet(const bool quiet_)
1315 {
1316  modifyImage();
1317  options()->quiet(quiet_);
1318 }
1319 
1320 bool Magick::Image::quiet(void) const
1321 {
1322  return(constOptions()->quiet());
1323 }
1324 
1326  const Magick::RenderingIntent renderingIntent_)
1327 {
1328  modifyImage();
1329  image()->rendering_intent=renderingIntent_;
1330 }
1331 
1332 Magick::RenderingIntent Magick::Image::renderingIntent(void) const
1333 {
1334  return(static_cast<Magick::RenderingIntent>(constImage()->rendering_intent));
1335 }
1336 
1338  const Magick::ResolutionType resolutionUnits_)
1339 {
1340  modifyImage();
1341  image()->units=resolutionUnits_;
1342  options()->resolutionUnits(resolutionUnits_);
1343 }
1344 
1345 Magick::ResolutionType Magick::Image::resolutionUnits(void) const
1346 {
1347  return(static_cast<Magick::ResolutionType>(constImage()->units));
1348 }
1349 
1350 size_t Magick::Image::rows(void) const
1351 {
1352  return(constImage()->rows);
1353 }
1354 
1355 void Magick::Image::scene(const size_t scene_)
1356 {
1357  modifyImage();
1358  image()->scene=scene_;
1359 }
1360 
1361 size_t Magick::Image::scene(void) const
1362 {
1363  return(constImage()->scene);
1364 }
1365 
1366 void Magick::Image::size(const Geometry &geometry_)
1367 {
1368  modifyImage();
1369  options()->size(geometry_);
1370  image()->rows=geometry_.height();
1371  image()->columns=geometry_.width();
1372 }
1373 
1375 {
1376  return(Magick::Geometry(constImage()->columns,constImage()->rows));
1377 }
1378 
1379 void Magick::Image::strokeAntiAlias(const bool flag_)
1380 {
1381  modifyImage();
1382  options()->strokeAntiAlias(flag_);
1383 }
1384 
1386 {
1387  return(constOptions()->strokeAntiAlias());
1388 }
1389 
1391 {
1392  std::string
1393  value;
1394 
1395  modifyImage();
1396  options()->strokeColor(strokeColor_);
1397  value=strokeColor_;
1398  artifact("stroke",value);
1399 }
1400 
1402 {
1403  return(constOptions()->strokeColor());
1404 }
1405 
1406 void Magick::Image::strokeDashArray(const double *strokeDashArray_)
1407 {
1408  modifyImage();
1409  options()->strokeDashArray(strokeDashArray_);
1410 }
1411 
1412 const double* Magick::Image::strokeDashArray(void) const
1413 {
1414  return(constOptions()->strokeDashArray());
1415 }
1416 
1417 void Magick::Image::strokeDashOffset(const double strokeDashOffset_)
1418 {
1419  modifyImage();
1420  options()->strokeDashOffset(strokeDashOffset_);
1421 }
1422 
1424 {
1425  return(constOptions()->strokeDashOffset());
1426 }
1427 
1428 void Magick::Image::strokeLineCap(const Magick::LineCap lineCap_)
1429 {
1430  modifyImage();
1431  options()->strokeLineCap(lineCap_);
1432 }
1433 
1434 Magick::LineCap Magick::Image::strokeLineCap(void) const
1435 {
1436  return(constOptions()->strokeLineCap());
1437 }
1438 
1439 void Magick::Image::strokeLineJoin(const Magick::LineJoin lineJoin_)
1440 {
1441  modifyImage();
1442  options()->strokeLineJoin(lineJoin_);
1443 }
1444 
1445 Magick::LineJoin Magick::Image::strokeLineJoin(void) const
1446 {
1447  return(constOptions()->strokeLineJoin());
1448 }
1449 
1450 void Magick::Image::strokeMiterLimit(const size_t strokeMiterLimit_)
1451 {
1452  modifyImage();
1453  options()->strokeMiterLimit(strokeMiterLimit_);
1454 }
1455 
1457 {
1458  return(constOptions()->strokeMiterLimit());
1459 }
1460 
1461 void Magick::Image::strokePattern(const Image &strokePattern_)
1462 {
1463  modifyImage();
1464  if(strokePattern_.isValid())
1465  options()->strokePattern(strokePattern_.constImage());
1466  else
1467  options()->strokePattern(static_cast<MagickCore::Image*>(NULL));
1468 }
1469 
1471 {
1472  // FIXME: This is inordinately innefficient
1473  const MagickCore::Image
1474  *tmpTexture;
1475 
1476  Image
1477  texture;
1478 
1479  tmpTexture=constOptions()->strokePattern();
1480 
1481  if (tmpTexture)
1482  {
1484  *image;
1485 
1487  image=CloneImage(tmpTexture,0,0,MagickTrue,exceptionInfo);
1488  texture.replaceImage(image);
1490  }
1491  return(texture);
1492 }
1493 
1494 void Magick::Image::strokeWidth(const double strokeWidth_)
1495 {
1496  char
1497  value[MagickPathExtent];
1498 
1499  modifyImage();
1500  options()->strokeWidth(strokeWidth_);
1501  FormatLocaleString(value,MagickPathExtent,"%.20g",strokeWidth_);
1502  (void) SetImageArtifact(image(),"strokewidth",value);
1503 }
1504 
1505 double Magick::Image::strokeWidth(void) const
1506 {
1507  return(constOptions()->strokeWidth());
1508 }
1509 
1510 void Magick::Image::subImage(const size_t subImage_)
1511 {
1512  modifyImage();
1513  options()->subImage(subImage_);
1514 }
1515 
1516 size_t Magick::Image::subImage(void) const
1517 {
1518  return(constOptions()->subImage());
1519 }
1520 
1521 void Magick::Image::subRange(const size_t subRange_)
1522 {
1523  modifyImage();
1524  options()->subRange(subRange_);
1525 }
1526 
1527 size_t Magick::Image::subRange(void) const
1528 {
1529  return(constOptions()->subRange());
1530 }
1531 
1532 void Magick::Image::textAntiAlias(const bool flag_)
1533 {
1534  modifyImage();
1535  options()->textAntiAlias(flag_);
1536 }
1537 
1539 {
1540  return(constOptions()->textAntiAlias());
1541 }
1542 
1543 void Magick::Image::textDirection(DirectionType direction_)
1544 {
1545  modifyImage();
1546  options()->textDirection(direction_);
1547 }
1548 
1549 Magick::DirectionType Magick::Image::textDirection(void) const
1550 {
1551  return(constOptions()->textDirection());
1552 }
1553 
1554 void Magick::Image::textEncoding(const std::string &encoding_)
1555 {
1556  modifyImage();
1557  options()->textEncoding(encoding_);
1558 }
1559 
1560 std::string Magick::Image::textEncoding(void) const
1561 {
1562  return(constOptions()->textEncoding());
1563 }
1564 
1565 void Magick::Image::textGravity(GravityType gravity_)
1566 {
1567  modifyImage();
1568  options()->textGravity(gravity_);
1569 }
1570 
1571 Magick::GravityType Magick::Image::textGravity(void) const
1572 {
1573  return(constOptions()->textGravity());
1574 }
1575 
1577 {
1578  modifyImage();
1579  options()->textInterlineSpacing(spacing_);
1580 }
1581 
1583 {
1584  return(constOptions()->textInterlineSpacing());
1585 }
1586 
1588 {
1589  modifyImage();
1590  options()->textInterwordSpacing(spacing_);
1591 }
1592 
1594 {
1595  return(constOptions()->textInterwordSpacing());
1596 }
1597 
1598 void Magick::Image::textKerning(double kerning_)
1599 {
1600  modifyImage();
1601  options()->textKerning(kerning_);
1602 }
1603 
1604 double Magick::Image::textKerning(void) const
1605 {
1606  return(constOptions()->textKerning());
1607 }
1608 
1609 void Magick::Image::textUnderColor(const Color &underColor_)
1610 {
1611  modifyImage();
1612  options()->textUnderColor(underColor_);
1613 }
1614 
1616 {
1617  return(constOptions()->textUnderColor());
1618 }
1619 
1620 size_t Magick::Image::totalColors(void) const
1621 {
1622  size_t
1623  colors;
1624 
1626  colors=GetNumberColors(constImage(),(FILE *) NULL,exceptionInfo);
1628  return colors;
1629 }
1630 
1631 void Magick::Image::transformRotation(const double angle_)
1632 {
1633  modifyImage();
1634  options()->transformRotation(angle_);
1635 }
1636 
1637 void Magick::Image::transformSkewX(const double skewx_)
1638 {
1639  modifyImage();
1640  options()->transformSkewX(skewx_);
1641 }
1642 
1643 void Magick::Image::transformSkewY(const double skewy_)
1644 {
1645  modifyImage();
1646  options()->transformSkewY(skewy_);
1647 }
1648 
1649 Magick::ImageType Magick::Image::type(void) const
1650 {
1651  if (constOptions()->type() != UndefinedType)
1652  return(constOptions()->type());
1653  return(GetImageType(constImage()));
1654 }
1655 
1656 void Magick::Image::type(const Magick::ImageType type_)
1657 {
1658  modifyImage();
1659  options()->type(type_);
1661  SetImageType(image(),type_,exceptionInfo);
1663 }
1664 
1665 void Magick::Image::verbose(const bool verboseFlag_)
1666 {
1667  modifyImage();
1668  options()->verbose(verboseFlag_);
1669 }
1670 
1671 bool Magick::Image::verbose(void) const
1672 {
1673  return(constOptions()->verbose());
1674 }
1675 
1677  const VirtualPixelMethod virtualPixelMethod_)
1678 {
1679  modifyImage();
1681  SetImageVirtualPixelMethod(image(),virtualPixelMethod_,exceptionInfo);
1683 }
1684 
1685 Magick::VirtualPixelMethod Magick::Image::virtualPixelMethod(void) const
1686 {
1687  return(GetImageVirtualPixelMethod(constImage()));
1688 }
1689 
1690 void Magick::Image::x11Display(const std::string &display_)
1691 {
1692  modifyImage();
1693  options()->x11Display(display_);
1694 }
1695 
1696 std::string Magick::Image::x11Display(void) const
1697 {
1698  return(constOptions()->x11Display());
1699 }
1700 
1701 double Magick::Image::xResolution(void) const
1702 {
1703  return(constImage()->resolution.x);
1704 }
1705 
1706 double Magick::Image::yResolution(void) const
1707 {
1708  return(constImage()->resolution.y);
1709 }
1710 
1711 void Magick::Image::adaptiveBlur(const double radius_,const double sigma_)
1712 {
1714  *newImage;
1715 
1717  newImage=AdaptiveBlurImage(constImage(),radius_,sigma_,exceptionInfo);
1718  replaceImage(newImage);
1720 }
1721 
1723 {
1725  *newImage;
1726 
1727  size_t
1728  height=rows(),
1729  width=columns();
1730 
1731  ssize_t
1732  x=0,
1733  y=0;
1734 
1735  ParseMetaGeometry(static_cast<std::string>(geometry_).c_str(),&x,&y,&width,
1736  &height);
1737 
1739  newImage=AdaptiveResizeImage(constImage(),width,height,exceptionInfo);
1740  replaceImage(newImage);
1742 }
1743 
1744 void Magick::Image::adaptiveSharpen(const double radius_,const double sigma_)
1745 {
1747  *newImage;
1748 
1750  newImage=AdaptiveSharpenImage(constImage(),radius_,sigma_,exceptionInfo);
1751  replaceImage(newImage);
1753 }
1754 
1755 void Magick::Image::adaptiveSharpenChannel(const ChannelType channel_,
1756  const double radius_,const double sigma_ )
1757 {
1759  *newImage;
1760 
1762  GetAndSetPPChannelMask(channel_);
1763  newImage=AdaptiveSharpenImage(constImage(),radius_,sigma_,exceptionInfo);
1765  replaceImage(newImage);
1767 }
1768 
1769 void Magick::Image::adaptiveThreshold(const size_t width_,const size_t height_,
1770  const double bias_)
1771 {
1772 
1774  *newImage;
1775 
1777  newImage=AdaptiveThresholdImage(constImage(),width_,height_,bias_,
1778  exceptionInfo);
1779  replaceImage(newImage);
1781 }
1782 
1783 void Magick::Image::addNoise(const NoiseType noiseType_,const double attenuate_)
1784 {
1786  *newImage;
1787 
1789  newImage=AddNoiseImage(constImage(),noiseType_,attenuate_,exceptionInfo);
1790  replaceImage(newImage);
1792 }
1793 
1794 void Magick::Image::addNoiseChannel(const ChannelType channel_,
1795  const NoiseType noiseType_,const double attenuate_)
1796 {
1798  *newImage;
1799 
1801  GetAndSetPPChannelMask(channel_);
1802  newImage=AddNoiseImage(constImage(),noiseType_,attenuate_,exceptionInfo);
1804  replaceImage(newImage);
1806 }
1807 
1809 {
1810  AffineMatrix
1811  _affine;
1812 
1814  *newImage;
1815 
1816  _affine.sx=affine_.sx();
1817  _affine.sy=affine_.sy();
1818  _affine.rx=affine_.rx();
1819  _affine.ry=affine_.ry();
1820  _affine.tx=affine_.tx();
1821  _affine.ty=affine_.ty();
1822 
1824  newImage=AffineTransformImage(constImage(),&_affine,exceptionInfo);
1825  replaceImage(newImage);
1827 }
1828 
1829 void Magick::Image::alpha(const unsigned int alpha_)
1830 {
1831  modifyImage();
1833  SetImageAlpha(image(),alpha_,exceptionInfo);
1835 }
1836 
1837 void Magick::Image::alphaChannel(AlphaChannelOption alphaOption_)
1838 {
1839  modifyImage();
1841  SetImageAlphaChannel(image(),alphaOption_,exceptionInfo);
1843 }
1844 
1845 void Magick::Image::annotate(const std::string &text_,
1846  const Geometry &location_)
1847 {
1848  annotate(text_,location_,NorthWestGravity,0.0);
1849 }
1850 
1851 void Magick::Image::annotate(const std::string &text_,
1852  const Geometry &boundingArea_,const GravityType gravity_)
1853 {
1854  annotate(text_,boundingArea_,gravity_,0.0);
1855 }
1856 
1857 void Magick::Image::annotate(const std::string &text_,
1858  const Geometry &boundingArea_,const GravityType gravity_,
1859  const double degrees_)
1860 {
1861  AffineMatrix
1862  oaffine;
1863 
1864  char
1865  boundingArea[MagickPathExtent];
1866 
1867  DrawInfo
1868  *drawInfo;
1869 
1870  modifyImage();
1871 
1872  drawInfo=options()->drawInfo();
1873  drawInfo->text=DestroyString(drawInfo->text);
1874  drawInfo->text=const_cast<char *>(text_.c_str());
1875  drawInfo->geometry=DestroyString(drawInfo->geometry);
1876 
1877  if (boundingArea_.isValid())
1878  {
1879  if (boundingArea_.width() == 0 || boundingArea_.height() == 0)
1880  {
1881  FormatLocaleString(boundingArea,MagickPathExtent,"%+.20g%+.20g",
1882  (double) boundingArea_.xOff(),(double) boundingArea_.yOff());
1883  }
1884  else
1885  {
1886  (void) CopyMagickString(boundingArea,
1887  std::string(boundingArea_).c_str(), MagickPathExtent);
1888  }
1889  drawInfo->geometry=boundingArea;
1890  }
1891 
1892  drawInfo->gravity=gravity_;
1893 
1894  oaffine=drawInfo->affine;
1895  if (degrees_ != 0.0)
1896  {
1897  AffineMatrix
1898  affine,
1899  current;
1900 
1901  affine.sx=1.0;
1902  affine.rx=0.0;
1903  affine.ry=0.0;
1904  affine.sy=1.0;
1905  affine.tx=0.0;
1906  affine.ty=0.0;
1907 
1908  current=drawInfo->affine;
1909  affine.sx=cos(DegreesToRadians(fmod(degrees_,360.0)));
1910  affine.rx=sin(DegreesToRadians(fmod(degrees_,360.0)));
1911  affine.ry=(-sin(DegreesToRadians(fmod(degrees_,360.0))));
1912  affine.sy=cos(DegreesToRadians(fmod(degrees_,360.0)));
1913 
1914  drawInfo->affine.sx=current.sx*affine.sx+current.ry*affine.rx;
1915  drawInfo->affine.rx=current.rx*affine.sx+current.sy*affine.rx;
1916  drawInfo->affine.ry=current.sx*affine.ry+current.ry*affine.sy;
1917  drawInfo->affine.sy=current.rx*affine.ry+current.sy*affine.sy;
1918  drawInfo->affine.tx=current.sx*affine.tx+current.ry*affine.ty
1919  +current.tx;
1920  }
1921 
1923  AnnotateImage(image(),drawInfo,exceptionInfo);
1924 
1925  // Restore original values
1926  drawInfo->affine=oaffine;
1927  drawInfo->text=(char *) NULL;
1928  drawInfo->geometry=(char *) NULL;
1929 
1931 }
1932 
1933 void Magick::Image::annotate(const std::string &text_,
1934  const GravityType gravity_)
1935 {
1936  DrawInfo
1937  *drawInfo;
1938 
1939  modifyImage();
1940 
1941  drawInfo=options()->drawInfo();
1942  drawInfo->text=DestroyString(drawInfo->text);
1943  drawInfo->text=const_cast<char *>(text_.c_str());
1944  drawInfo->gravity=gravity_;
1945 
1947  AnnotateImage(image(),drawInfo,exceptionInfo);
1948 
1949  drawInfo->gravity=NorthWestGravity;
1950  drawInfo->text=(char *) NULL;
1951 
1953 }
1954 
1955 void Magick::Image::artifact(const std::string &name_,const std::string &value_)
1956 {
1957  modifyImage();
1958  (void) SetImageArtifact(image(),name_.c_str(),value_.c_str());
1959 }
1960 
1961 std::string Magick::Image::artifact(const std::string &name_) const
1962 {
1963  const char
1964  *value;
1965 
1966  value=GetImageArtifact(constImage(),name_.c_str());
1967  if (value)
1968  return(std::string(value));
1969  return(std::string());
1970 }
1971 
1972 void Magick::Image::attribute(const std::string name_,const char *value_)
1973 {
1974  modifyImage();
1976  SetImageProperty(image(),name_.c_str(),value_,exceptionInfo);
1978 }
1979 
1980 void Magick::Image::attribute(const std::string name_,const std::string value_)
1981 {
1982  modifyImage();
1984  SetImageProperty(image(),name_.c_str(),value_.c_str(),exceptionInfo);
1986 }
1987 
1988 std::string Magick::Image::attribute(const std::string name_) const
1989 {
1990  const char
1991  *value;
1992 
1994  value=GetImageProperty(constImage(),name_.c_str(),exceptionInfo);
1996 
1997  if (value)
1998  return(std::string(value));
1999 
2000  return(std::string()); // Intentionally no exception
2001 }
2002 
2004 {
2005  modifyImage();
2007  (void) SyncImageSettings(imageInfo(),image(),exceptionInfo);
2008  (void) AutoGammaImage(image(),exceptionInfo);
2010 }
2011 
2012 void Magick::Image::autoGammaChannel(const ChannelType channel_)
2013 {
2014  modifyImage();
2016  GetAndSetPPChannelMask(channel_);
2017  (void) SyncImageSettings(imageInfo(),image(),exceptionInfo);
2018  (void) AutoGammaImage(image(),exceptionInfo);
2021 }
2022 
2024 {
2025  modifyImage();
2027  (void) AutoLevelImage(image(),exceptionInfo);
2029 }
2030 
2031 void Magick::Image::autoLevelChannel(const ChannelType channel_)
2032 {
2033  modifyImage();
2035  GetAndSetPPChannelMask(channel_);
2036  (void) AutoLevelImage(image(),exceptionInfo);
2039 }
2040 
2042 {
2044  *newImage;
2045 
2046  if (image()->orientation == UndefinedOrientation ||
2047  image()->orientation == TopLeftOrientation)
2048  return;
2049 
2051  newImage=AutoOrientImage(constImage(),image()->orientation,exceptionInfo);
2052  replaceImage(newImage);
2054 }
2055 
2056 void Magick::Image::autoThreshold(const AutoThresholdMethod method_)
2057 {
2058  modifyImage();
2060  AutoThresholdImage(image(),method_, exceptionInfo);
2062 }
2063 
2064 void Magick::Image::blackThreshold(const std::string &threshold_)
2065 {
2066  modifyImage();
2068  BlackThresholdImage(image(),threshold_.c_str(),exceptionInfo);
2070 }
2071 
2072 void Magick::Image::blackThresholdChannel(const ChannelType channel_,
2073  const std::string &threshold_)
2074 {
2075  modifyImage();
2077  GetAndSetPPChannelMask(channel_);
2078  BlackThresholdImage(image(),threshold_.c_str(),exceptionInfo);
2081 }
2082 
2083 void Magick::Image::blueShift(const double factor_)
2084 {
2086  *newImage;
2087 
2089  newImage=BlueShiftImage(constImage(),factor_,exceptionInfo);
2090  replaceImage(newImage);
2092 }
2093 
2094 void Magick::Image::blur(const double radius_,const double sigma_)
2095 {
2097  *newImage;
2098 
2100  newImage=BlurImage(constImage(),radius_,sigma_,exceptionInfo);
2101  replaceImage(newImage);
2103 }
2104 
2105 void Magick::Image::blurChannel(const ChannelType channel_,
2106  const double radius_,const double sigma_)
2107 {
2109  *newImage;
2110 
2112  GetAndSetPPChannelMask(channel_);
2113  newImage=BlurImage(constImage(),radius_,sigma_,exceptionInfo);
2115  replaceImage(newImage);
2117 }
2118 
2119 void Magick::Image::border(const Geometry &geometry_)
2120 {
2122  *newImage;
2123 
2124  RectangleInfo
2125  borderInfo=geometry_;
2126 
2128  newImage=BorderImage(constImage(),&borderInfo,image()->compose,
2129  exceptionInfo);
2130  replaceImage(newImage);
2132 }
2133 
2134 void Magick::Image::brightnessContrast(const double brightness_,
2135  const double contrast_)
2136 {
2137  modifyImage();
2139  BrightnessContrastImage(image(),brightness_,contrast_,exceptionInfo);
2141 }
2142 
2143 void Magick::Image::brightnessContrastChannel(const ChannelType channel_,
2144  const double brightness_,const double contrast_)
2145 {
2146  modifyImage();
2148  GetAndSetPPChannelMask(channel_);
2149  BrightnessContrastImage(image(),brightness_,contrast_,exceptionInfo);
2152 }
2153 
2154 void Magick::Image::cannyEdge(const double radius_,const double sigma_,
2155  const double lowerPercent_,const double upperPercent_)
2156 {
2158  *newImage;
2159 
2160  modifyImage();
2162  newImage=CannyEdgeImage(constImage(),radius_,sigma_,lowerPercent_,
2163  upperPercent_,exceptionInfo);
2164  replaceImage(newImage);
2166 }
2167 
2168 void Magick::Image::cdl(const std::string &cdl_)
2169 {
2170  modifyImage();
2172  (void) ColorDecisionListImage(image(),cdl_.c_str(),exceptionInfo);
2174 }
2175 
2176 void Magick::Image::channel(const ChannelType channel_)
2177 {
2179  *newImage;
2180 
2182  newImage=SeparateImage(image(),channel_,exceptionInfo);
2183  replaceImage(newImage);
2185 }
2186 
2187 void Magick::Image::charcoal(const double radius_,const double sigma_)
2188 {
2190  *newImage;
2191 
2193  newImage=CharcoalImage(image(),radius_,sigma_,exceptionInfo);
2194  replaceImage(newImage);
2196 }
2197 
2198 void Magick::Image::charcoalChannel(const ChannelType channel_,
2199  const double radius_,const double sigma_)
2200 {
2202  *newImage;
2203 
2205  GetAndSetPPChannelMask(channel_);
2206  newImage=CharcoalImage(image(),radius_,sigma_,exceptionInfo);
2208  replaceImage(newImage);
2210 }
2211 
2212 void Magick::Image::chop(const Geometry &geometry_)
2213 {
2215  *newImage;
2216 
2217  RectangleInfo
2218  chopInfo=geometry_;
2219 
2221  newImage=ChopImage(image(),&chopInfo,exceptionInfo);
2222  replaceImage(newImage);
2224 }
2225 
2226 void Magick::Image::chromaBluePrimary(const double x_,const double y_,
2227  const double z_)
2228 {
2229  modifyImage();
2230  image()->chromaticity.blue_primary.x=x_;
2231  image()->chromaticity.blue_primary.y=y_;
2232  image()->chromaticity.blue_primary.z=z_;
2233 }
2234 
2235 void Magick::Image::chromaBluePrimary(double *x_,double *y_,double *z_) const
2236 {
2237  *x_=constImage()->chromaticity.blue_primary.x;
2238  *y_=constImage()->chromaticity.blue_primary.y;
2239  *z_=constImage()->chromaticity.blue_primary.z;
2240 }
2241 
2242 void Magick::Image::chromaGreenPrimary(const double x_,const double y_,
2243  const double z_)
2244 {
2245  modifyImage();
2246  image()->chromaticity.green_primary.x=x_;
2247  image()->chromaticity.green_primary.y=y_;
2248  image()->chromaticity.green_primary.z=z_;
2249 }
2250 
2251 void Magick::Image::chromaGreenPrimary(double *x_,double *y_,double *z_) const
2252 {
2253  *x_=constImage()->chromaticity.green_primary.x;
2254  *y_=constImage()->chromaticity.green_primary.y;
2255  *z_=constImage()->chromaticity.green_primary.z;
2256 }
2257 
2258 void Magick::Image::chromaRedPrimary(const double x_,const double y_,
2259  const double z_)
2260 {
2261  modifyImage();
2262  image()->chromaticity.red_primary.x=x_;
2263  image()->chromaticity.red_primary.y=y_;
2264  image()->chromaticity.red_primary.z=z_;
2265 }
2266 
2267 void Magick::Image::chromaRedPrimary(double *x_,double *y_,double *z_) const
2268 {
2269  *x_=constImage()->chromaticity.red_primary.x;
2270  *y_=constImage()->chromaticity.red_primary.y;
2271  *z_=constImage()->chromaticity.red_primary.z;
2272 }
2273 
2274 void Magick::Image::chromaWhitePoint(const double x_,const double y_,
2275  const double z_)
2276 {
2277  modifyImage();
2278  image()->chromaticity.white_point.x=x_;
2279  image()->chromaticity.white_point.y=y_;
2280  image()->chromaticity.white_point.z=z_;
2281 }
2282 
2283 void Magick::Image::chromaWhitePoint(double *x_,double *y_,double *z_) const
2284 {
2285  *x_=constImage()->chromaticity.white_point.x;
2286  *y_=constImage()->chromaticity.white_point.y;
2287  *z_=constImage()->chromaticity.white_point.z;
2288 }
2289 
2291 {
2292  modifyImage();
2294  ClampImage(image(),exceptionInfo);
2296 }
2297 
2298 void Magick::Image::clampChannel(const ChannelType channel_)
2299 {
2300  modifyImage();
2302  GetAndSetPPChannelMask(channel_);
2303  ClampImage(image(),exceptionInfo);
2306 }
2307 
2309 {
2310  modifyImage();
2312  ClipImage(image(),exceptionInfo);
2314 }
2315 
2316 void Magick::Image::clipPath(const std::string pathname_,const bool inside_)
2317 {
2318  modifyImage();
2320  ClipImagePath(image(),pathname_.c_str(),(MagickBooleanType) inside_,
2321  exceptionInfo);
2323 }
2324 
2325 void Magick::Image::clut(const Image &clutImage_,
2326  const PixelInterpolateMethod method)
2327 {
2328  modifyImage();
2330  ClutImage(image(),clutImage_.constImage(),method,exceptionInfo);
2332 }
2333 
2334 void Magick::Image::clutChannel(const ChannelType channel_,
2335  const Image &clutImage_,const PixelInterpolateMethod method)
2336 {
2337  modifyImage();
2339  GetAndSetPPChannelMask(channel_);
2340  ClutImage(image(),clutImage_.constImage(),method,exceptionInfo);
2343 }
2344 
2345 void Magick::Image::colorize(const unsigned int alpha_,const Color &penColor_)
2346 {
2347  colorize(alpha_,alpha_,alpha_,penColor_);
2348 }
2349 
2350 void Magick::Image::colorize(const unsigned int alphaRed_,
2351  const unsigned int alphaGreen_,const unsigned int alphaBlue_,
2352  const Color &penColor_)
2353 {
2354  char
2355  blend[MagickPathExtent];
2356 
2358  *newImage;
2359 
2360  PixelInfo
2361  target;
2362 
2363  if (!penColor_.isValid())
2364  throwExceptionExplicit(MagickCore::OptionError,
2365  "Pen color argument is invalid");
2366 
2367  FormatLocaleString(blend,MagickPathExtent,"%u/%u/%u",alphaRed_,alphaGreen_,
2368  alphaBlue_);
2369 
2370  target=static_cast<PixelInfo>(penColor_);
2372  newImage=ColorizeImage(image(),blend,&target,exceptionInfo);
2373  replaceImage(newImage);
2375 }
2376 
2377 void Magick::Image::colorMap(const size_t index_,const Color &color_)
2378 {
2380  *imageptr;
2381 
2382  imageptr=image();
2383 
2384  if (index_ > (MaxColormapSize-1))
2385  throwExceptionExplicit(MagickCore::OptionError,
2386  "Colormap index must be less than MaxColormapSize");
2387 
2388  if (!color_.isValid())
2389  throwExceptionExplicit(MagickCore::OptionError,
2390  "Color argument is invalid");
2391 
2392  modifyImage();
2393 
2394  // Ensure that colormap size is large enough
2395  if (colorMapSize() < (index_+1))
2396  colorMapSize(index_+1);
2397 
2398  // Set color at index in colormap
2399  (imageptr->colormap)[index_]=color_;
2400 }
2401 
2402 Magick::Color Magick::Image::colorMap(const size_t index_) const
2403 {
2404  if (!constImage()->colormap)
2405  {
2406  throwExceptionExplicit(MagickCore::OptionError,
2407  "Image does not contain a colormap");
2408  return(Color());
2409  }
2410 
2411  if (index_ > constImage()->colors-1)
2412  throwExceptionExplicit(MagickCore::OptionError,"Index out of range");
2413 
2414  return(Magick::Color((constImage()->colormap)[index_]));
2415 }
2416 
2417 void Magick::Image::colorMatrix(const size_t order_,
2418  const double *color_matrix_)
2419 {
2420  KernelInfo
2421  *kernel_info;
2422 
2424  kernel_info=AcquireKernelInfo((const char *) NULL,exceptionInfo);
2425  if (kernel_info != (KernelInfo *) NULL)
2426  {
2427  kernel_info->width=order_;
2428  kernel_info->height=order_;
2429  kernel_info->values=(MagickRealType *) AcquireAlignedMemory(order_,
2430  order_*sizeof(*kernel_info->values));
2431  if (kernel_info->values != (MagickRealType *) NULL)
2432  {
2434  *newImage;
2435 
2436  for (ssize_t i=0; i < (ssize_t) (order_*order_); i++)
2437  kernel_info->values[i]=color_matrix_[i];
2438  newImage=ColorMatrixImage(image(),kernel_info,exceptionInfo);
2439  replaceImage(newImage);
2440  }
2441  kernel_info=DestroyKernelInfo(kernel_info);
2442  }
2444 }
2445 
2446 bool Magick::Image::compare(const Image &reference_) const
2447 {
2448  bool
2449  status;
2450 
2451  Image
2452  ref=reference_;
2453 
2455  status=static_cast<bool>(IsImagesEqual(constImage(),ref.constImage(),
2456  exceptionInfo));
2458  return(status);
2459 }
2460 
2461 double Magick::Image::compare(const Image &reference_,const MetricType metric_)
2462 {
2463  double
2464  distortion=0.0;
2465 
2467  GetImageDistortion(image(),reference_.constImage(),metric_,&distortion,
2468  exceptionInfo);
2470  return(distortion);
2471 }
2472 
2473 double Magick::Image::compareChannel(const ChannelType channel_,
2474  const Image &reference_,const MetricType metric_)
2475 {
2476  double
2477  distortion=0.0;
2478 
2480  GetAndSetPPChannelMask(channel_);
2481  GetImageDistortion(image(),reference_.constImage(),metric_,&distortion,
2482  exceptionInfo);
2485  return(distortion);
2486 }
2487 
2489  const MetricType metric_,double *distortion)
2490 {
2492  *newImage;
2493 
2495  newImage=CompareImages(image(),reference_.constImage(),metric_,distortion,
2496  exceptionInfo);
2498  if (newImage == (MagickCore::Image *) NULL)
2499  return(Magick::Image());
2500  else
2501  return(Magick::Image(newImage));
2502 }
2503 
2505  const Image &reference_,const MetricType metric_,double *distortion)
2506 {
2508  *newImage;
2509 
2511  GetAndSetPPChannelMask(channel_);
2512  newImage=CompareImages(image(),reference_.constImage(),metric_,distortion,
2513  exceptionInfo);
2516  if (newImage == (MagickCore::Image *) NULL)
2517  return(Magick::Image());
2518  else
2519  return(Magick::Image(newImage));
2520 }
2521 
2522 void Magick::Image::composite(const Image &compositeImage_,
2523  const Geometry &offset_,const CompositeOperator compose_)
2524 {
2525  size_t
2526  height=rows(),
2527  width=columns();
2528 
2529  ssize_t
2530  x=offset_.xOff(),
2531  y=offset_.yOff();
2532 
2533  ParseMetaGeometry(static_cast<std::string>(offset_).c_str(),&x,&y,&width,
2534  &height);
2535 
2536  modifyImage();
2538  CompositeImage(image(),compositeImage_.constImage(),compose_,MagickTrue,
2539  x,y,exceptionInfo);
2541 }
2542 
2543 void Magick::Image::composite(const Image &compositeImage_,
2544  const GravityType gravity_,const CompositeOperator compose_)
2545 {
2546  RectangleInfo
2547  geometry;
2548 
2549  modifyImage();
2550  SetGeometry(compositeImage_.constImage(),&geometry);
2551  GravityAdjustGeometry(columns(),rows(),gravity_,&geometry);
2552 
2554  CompositeImage(image(),compositeImage_.constImage(),compose_,MagickTrue,
2555  geometry.x,geometry.y,exceptionInfo);
2557 }
2558 
2559 void Magick::Image::composite(const Image &compositeImage_,
2560  const ssize_t xOffset_,const ssize_t yOffset_,
2561  const CompositeOperator compose_)
2562 {
2563  // Image supplied as compositeImage is composited with current image and
2564  // results in updating current image.
2565  modifyImage();
2567  CompositeImage(image(),compositeImage_.constImage(),compose_,MagickTrue,
2568  xOffset_,yOffset_,exceptionInfo);
2570 }
2571 
2572 void Magick::Image::connectedComponents(const size_t connectivity_)
2573 {
2575  *newImage;
2576 
2578  newImage=ConnectedComponentsImage(constImage(),connectivity_,
2579  (CCObjectInfo **) NULL,exceptionInfo);
2580  replaceImage(newImage);
2582 }
2583 
2584 void Magick::Image::contrast(const bool sharpen_)
2585 {
2586  modifyImage();
2588  ContrastImage(image(),(MagickBooleanType) sharpen_,exceptionInfo);
2590 }
2591 
2592 void Magick::Image::contrastStretch(const double blackPoint_,
2593  const double whitePoint_)
2594 {
2595  modifyImage();
2597  ContrastStretchImage(image(),blackPoint_,whitePoint_,exceptionInfo);
2599 }
2600 
2601 void Magick::Image::contrastStretchChannel(const ChannelType channel_,
2602  const double blackPoint_,const double whitePoint_)
2603 {
2604  modifyImage();
2606  GetAndSetPPChannelMask(channel_);
2607  ContrastStretchImage(image(),blackPoint_,whitePoint_,exceptionInfo);
2610 }
2611 
2612 void Magick::Image::convolve(const size_t order_,const double *kernel_)
2613 {
2614  KernelInfo
2615  *kernel_info;
2616 
2618  kernel_info=AcquireKernelInfo((const char *) NULL,exceptionInfo);
2619  kernel_info->width=order_;
2620  kernel_info->height=order_;
2621  kernel_info->x=(ssize_t) (order_-1)/2;
2622  kernel_info->y=(ssize_t) (order_-1)/2;
2623  kernel_info->values=(MagickRealType *) AcquireAlignedMemory(order_,
2624  order_*sizeof(*kernel_info->values));
2625  if (kernel_info->values != (MagickRealType *) NULL)
2626  {
2628  *newImage;
2629 
2630  for (ssize_t i=0; i < (ssize_t) (order_*order_); i++)
2631  kernel_info->values[i]=kernel_[i];
2632  newImage=ConvolveImage(image(),kernel_info,exceptionInfo);
2633  replaceImage(newImage);
2634  }
2635  kernel_info=DestroyKernelInfo(kernel_info);
2637 }
2638 
2639 void Magick::Image::copyPixels(const Image &source_,const Geometry &geometry_,
2640  const Offset &offset_)
2641 {
2642  const OffsetInfo
2643  offset=offset_;
2644 
2645  const RectangleInfo
2646  geometry=geometry_;
2647 
2649  (void) CopyImagePixels(image(),source_.constImage(),&geometry,&offset,
2650  exceptionInfo);
2652 }
2653 
2654 void Magick::Image::crop(const Geometry &geometry_)
2655 {
2657  *newImage;
2658 
2659  RectangleInfo
2660  cropInfo=geometry_;
2661 
2663  newImage=CropImage(constImage(),&cropInfo,exceptionInfo);
2664  replaceImage(newImage);
2666 }
2667 
2668 void Magick::Image::cycleColormap(const ssize_t amount_)
2669 {
2670  modifyImage();
2672  CycleColormapImage(image(),amount_,exceptionInfo);
2674 }
2675 
2676 void Magick::Image::decipher(const std::string &passphrase_)
2677 {
2678  modifyImage();
2680  DecipherImage(image(),passphrase_.c_str(),exceptionInfo);
2682 }
2683 
2684 void Magick::Image::defineSet(const std::string &magick_,
2685  const std::string &key_,bool flag_)
2686 {
2687  std::string
2688  definition;
2689 
2690  modifyImage();
2691  definition=magick_ + ":" + key_;
2692  if (flag_)
2693  (void) SetImageOption(imageInfo(),definition.c_str(),"");
2694  else
2695  DeleteImageOption(imageInfo(),definition.c_str());
2696 }
2697 
2698 bool Magick::Image::defineSet(const std::string &magick_,
2699  const std::string &key_ ) const
2700 {
2701  const char
2702  *option;
2703 
2704  std::string
2705  key;
2706 
2707  key=magick_ + ":" + key_;
2708  option=GetImageOption(constImageInfo(),key.c_str());
2709  if (option)
2710  return(true);
2711  return(false);
2712 }
2713 
2714 void Magick::Image::defineValue(const std::string &magick_,
2715  const std::string &key_,const std::string &value_)
2716 {
2717  std::string
2718  format,
2719  option;
2720 
2721  modifyImage();
2722  format=magick_ + ":" + key_;
2723  option=value_;
2724  (void) SetImageOption(imageInfo(),format.c_str(),option.c_str());
2725 }
2726 
2727 std::string Magick::Image::defineValue(const std::string &magick_,
2728  const std::string &key_) const
2729 {
2730  const char
2731  *option;
2732 
2733  std::string
2734  definition;
2735 
2736  definition=magick_ + ":" + key_;
2737  option=GetImageOption(constImageInfo(),definition.c_str());
2738  if (option)
2739  return(std::string(option));
2740  return(std::string());
2741 }
2742 
2743 void Magick::Image::deskew(const double threshold_)
2744 {
2746  *newImage;
2747 
2749  newImage=DeskewImage(constImage(),threshold_,exceptionInfo);
2750  replaceImage(newImage);
2752 }
2753 
2755 {
2757  *newImage;
2758 
2760  newImage=DespeckleImage(constImage(),exceptionInfo);
2761  replaceImage(newImage);
2763 }
2764 
2766 {
2768  DisplayImages(imageInfo(),image(),exceptionInfo);
2770 }
2771 
2772 void Magick::Image::distort(const DistortMethod method_,
2773  const size_t numberArguments_,const double *arguments_,const bool bestfit_)
2774 {
2776  *newImage;
2777 
2779  newImage=DistortImage(constImage(), method_,numberArguments_,arguments_,
2780  bestfit_ == true ? MagickTrue : MagickFalse,exceptionInfo);
2781  replaceImage(newImage);
2783 }
2784 
2786 {
2787  DrawingWand
2788  *wand;
2789 
2790  modifyImage();
2791 
2792  wand=AcquireDrawingWand(options()->drawInfo(),image());
2793 
2794  if(wand)
2795  {
2796  drawable_.operator()(wand);
2797 
2798  DrawRender(wand);
2799 
2800  ClonePPDrawException(wand);
2801  wand=DestroyDrawingWand(wand);
2802  ThrowPPDrawException(quiet());
2803  }
2804 }
2805 
2806 void Magick::Image::draw(const std::vector<Magick::Drawable> &drawable_)
2807 {
2808  DrawingWand
2809  *wand;
2810 
2811  modifyImage();
2812 
2813  wand= AcquireDrawingWand(options()->drawInfo(),image());
2814 
2815  if(wand)
2816  {
2817  for (std::vector<Magick::Drawable>::const_iterator p = drawable_.begin();
2818  p != drawable_.end(); p++ )
2819  {
2820  p->operator()(wand);
2821  if (DrawGetExceptionType(wand) != MagickCore::UndefinedException)
2822  break;
2823  }
2824 
2825  if (DrawGetExceptionType(wand) == MagickCore::UndefinedException)
2826  DrawRender(wand);
2827 
2828  ClonePPDrawException(wand);
2829  wand=DestroyDrawingWand(wand);
2830  ThrowPPDrawException(quiet());
2831  }
2832 }
2833 
2834 void Magick::Image::edge(const double radius_)
2835 {
2837  *newImage;
2838 
2840  newImage=EdgeImage(constImage(),radius_,exceptionInfo);
2841  replaceImage(newImage);
2843 }
2844 
2845 void Magick::Image::emboss(const double radius_,const double sigma_)
2846 {
2848  *newImage;
2849 
2851  newImage=EmbossImage(constImage(),radius_,sigma_,exceptionInfo);
2852  replaceImage(newImage);
2854 }
2855 
2856 void Magick::Image::encipher(const std::string &passphrase_)
2857 {
2858  modifyImage();
2860  EncipherImage(image(),passphrase_.c_str(),exceptionInfo);
2862 }
2863 
2865 {
2867  *newImage;
2868 
2870  newImage=EnhanceImage(constImage(),exceptionInfo);
2871  replaceImage(newImage);
2873 }
2874 
2876 {
2877  modifyImage();
2879  EqualizeImage(image(),exceptionInfo);
2881 }
2882 
2884 {
2885  modifyImage();
2887  (void) SetImageBackgroundColor(image(),exceptionInfo);
2889 }
2890 
2891 void Magick::Image::evaluate(const ChannelType channel_,
2892  const MagickEvaluateOperator operator_,double rvalue_)
2893 {
2895  GetAndSetPPChannelMask(channel_);
2896  EvaluateImage(image(),operator_,rvalue_,exceptionInfo);
2899 }
2900 
2901 void Magick::Image::evaluate(const ChannelType channel_,
2902  const MagickFunction function_,const size_t number_parameters_,
2903  const double *parameters_)
2904 {
2906  GetAndSetPPChannelMask(channel_);
2907  FunctionImage(image(),function_,number_parameters_,parameters_,
2908  exceptionInfo);
2911 }
2912 
2913 void Magick::Image::evaluate(const ChannelType channel_,const ssize_t x_,
2914  const ssize_t y_,const size_t columns_,const size_t rows_,
2915  const MagickEvaluateOperator operator_,const double rvalue_)
2916 {
2917  RectangleInfo
2918  geometry;
2919 
2921  *cropImage;
2922 
2923  geometry.width = columns_;
2924  geometry.height = rows_;
2925  geometry.x = x_;
2926  geometry.y = y_;
2927 
2929  cropImage=CropImage(image(),&geometry,exceptionInfo);
2930  GetAndSetPPChannelMask(channel_);
2931  EvaluateImage(cropImage,operator_,rvalue_,exceptionInfo);
2933  (void) CompositeImage(image(),cropImage,image()->alpha_trait ==
2934  BlendPixelTrait ? OverCompositeOp : CopyCompositeOp,MagickFalse,
2935  geometry.x,geometry.y,exceptionInfo );
2936  cropImage=DestroyImageList(cropImage);
2938 }
2939 
2940 void Magick::Image::extent(const Geometry &geometry_ )
2941 {
2943  *newImage;
2944 
2945  RectangleInfo
2946  extentInfo=geometry_;
2947 
2948  modifyImage();
2949  extentInfo.x=geometry_.xOff();
2950  extentInfo.y=geometry_.yOff();
2952  newImage=ExtentImage(image(),&extentInfo,exceptionInfo);
2953  replaceImage(newImage);
2955 }
2956 
2957 void Magick::Image::extent(const Geometry &geometry_,
2958  const Color &backgroundColor_)
2959 {
2960  backgroundColor(backgroundColor_);
2961  extent(geometry_);
2962 }
2963 
2964 void Magick::Image::extent(const Geometry &geometry_,
2965  const Color &backgroundColor_,const GravityType gravity_)
2966 {
2967  backgroundColor(backgroundColor_);
2968  extent(geometry_,gravity_);
2969 }
2970 
2971 void Magick::Image::extent(const Geometry &geometry_,
2972  const GravityType gravity_)
2973 {
2974  RectangleInfo
2975  geometry;
2976 
2977  SetGeometry(image(),&geometry);
2978  geometry.width=geometry_.width();
2979  geometry.height=geometry_.height();
2980  GravityAdjustGeometry(image()->columns,image()->rows,gravity_,&geometry);
2981  extent(geometry);
2982 }
2983 
2985 {
2987  *newImage;
2988 
2990  newImage=FlipImage(constImage(),exceptionInfo);
2991  replaceImage(newImage);
2993 }
2994 
2995 void Magick::Image::floodFillAlpha(const ssize_t x_,const ssize_t y_,
2996  const unsigned int alpha_,const bool invert_)
2997 {
2998  PixelInfo
2999  target;
3000 
3001  modifyImage();
3002 
3003  target=static_cast<PixelInfo>(pixelColor(x_,y_));
3004  target.alpha=alpha_;
3006  GetAndSetPPChannelMask(AlphaChannel);
3007  FloodfillPaintImage(image(),options()->drawInfo(),&target,x_,y_,
3008  (MagickBooleanType)invert_,exceptionInfo);
3011 }
3012 
3013 void Magick::Image::floodFillAlpha(const ssize_t x_,const ssize_t y_,
3014  const unsigned int alpha_,const Color &target_,const bool invert_)
3015 {
3016  PixelInfo
3017  target;
3018 
3019  modifyImage();
3020 
3021  target=static_cast<PixelInfo>(target_);
3022  target.alpha=alpha_;
3024  GetAndSetPPChannelMask(AlphaChannel);
3025  FloodfillPaintImage(image(),options()->drawInfo(),&target,x_,y_,
3026  (MagickBooleanType)invert_,exceptionInfo);
3029 }
3030 
3032  const Magick::Color &fillColor_,const bool invert_)
3033 {
3034  floodFillColor(point_.xOff(),point_.yOff(),fillColor_,invert_);
3035 }
3036 
3037 void Magick::Image::floodFillColor(const ssize_t x_,const ssize_t y_,
3038  const Magick::Color &fillColor_,const bool invert_)
3039 {
3040  PixelInfo
3041  pixel;
3042 
3043  modifyImage();
3044 
3045  pixel=static_cast<PixelInfo>(pixelColor(x_,y_));
3046  floodFill(x_,y_,(Magick::Image *)NULL,fillColor_,&pixel,invert_);
3047 }
3048 
3050  const Magick::Color &fillColor_,const Magick::Color &borderColor_,
3051  const bool invert_)
3052 {
3053  floodFillColor(point_.xOff(),point_.yOff(),fillColor_,borderColor_,invert_);
3054 }
3055 
3056 void Magick::Image::floodFillColor(const ssize_t x_,const ssize_t y_,
3057  const Magick::Color &fillColor_,const Magick::Color &borderColor_,
3058  const bool invert_)
3059 {
3060  PixelInfo
3061  pixel;
3062 
3063  modifyImage();
3064 
3065  pixel=static_cast<PixelInfo>(borderColor_);
3066  floodFill(x_,y_,(Magick::Image *)NULL,fillColor_,&pixel,invert_);
3067 }
3068 
3070  const Magick::Image &texture_,const bool invert_)
3071 {
3072  floodFillTexture(point_.xOff(),point_.yOff(),texture_,invert_);
3073 }
3074 
3075 void Magick::Image::floodFillTexture(const ssize_t x_,const ssize_t y_,
3076  const Magick::Image &texture_,const bool invert_)
3077 {
3078  PixelInfo
3079  pixel;
3080 
3081  modifyImage();
3082 
3083  pixel=static_cast<PixelInfo>(pixelColor(x_,y_));
3084  floodFill(x_,y_,&texture_,Magick::Color(),&pixel,invert_);
3085 }
3086 
3088  const Magick::Image &texture_,const Magick::Color &borderColor_,
3089  const bool invert_)
3090 {
3091  floodFillTexture(point_.xOff(),point_.yOff(),texture_,borderColor_,invert_);
3092 }
3093 
3094 void Magick::Image::floodFillTexture(const ssize_t x_,const ssize_t y_,
3095  const Magick::Image &texture_,const Magick::Color &borderColor_,
3096  const bool invert_)
3097 {
3098  PixelInfo
3099  pixel;
3100 
3101  modifyImage();
3102 
3103  pixel=static_cast<PixelInfo>(borderColor_);
3104  floodFill(x_,y_,&texture_,Magick::Color(),&pixel,invert_);
3105 }
3106 
3108 {
3110  *newImage;
3111 
3113  newImage=FlopImage(constImage(),exceptionInfo);
3114  replaceImage(newImage);
3116 }
3117 
3118 void Magick::Image::fontTypeMetrics(const std::string &text_,
3119  TypeMetric *metrics)
3120 {
3121  DrawInfo
3122  *drawInfo;
3123 
3124  drawInfo=options()->drawInfo();
3125  drawInfo->text=const_cast<char *>(text_.c_str());
3127  GetTypeMetrics(image(),drawInfo,&(metrics->_typeMetric),exceptionInfo);
3128  drawInfo->text=0;
3130 }
3131 
3132 void Magick::Image::fontTypeMetricsMultiline(const std::string &text_,
3133  TypeMetric *metrics)
3134 {
3135  DrawInfo
3136  *drawInfo;
3137 
3138  drawInfo=options()->drawInfo();
3139  drawInfo->text=const_cast<char *>(text_.c_str());
3141  GetMultilineTypeMetrics(image(),drawInfo,&(metrics->_typeMetric),exceptionInfo);
3142  drawInfo->text=0;
3144 }
3145 
3146 void Magick::Image::frame(const Geometry &geometry_)
3147 {
3148  FrameInfo
3149  info;
3150 
3152  *newImage;
3153 
3154  info.x=static_cast<ssize_t>(geometry_.width());
3155  info.y=static_cast<ssize_t>(geometry_.height());
3156  info.width=columns() + (static_cast<size_t>(info.x) << 1);
3157  info.height=rows() + (static_cast<size_t>(info.y) << 1);
3158  info.outer_bevel=geometry_.xOff();
3159  info.inner_bevel=geometry_.yOff();
3160 
3162  newImage=FrameImage(constImage(),&info,image()->compose,exceptionInfo);
3163  replaceImage(newImage);
3165 }
3166 
3167 void Magick::Image::frame(const size_t width_,const size_t height_,
3168  const ssize_t innerBevel_,const ssize_t outerBevel_)
3169 {
3170  FrameInfo
3171  info;
3172 
3174  *newImage;
3175 
3176  info.x=static_cast<ssize_t>(width_);
3177  info.y=static_cast<ssize_t>(height_);
3178  info.width=columns() + (static_cast<size_t>(info.x) << 1);
3179  info.height=rows() + (static_cast<size_t>(info.y) << 1);
3180  info.outer_bevel=static_cast<ssize_t>(outerBevel_);
3181  info.inner_bevel=static_cast<ssize_t>(innerBevel_);
3182 
3184  newImage=FrameImage(constImage(),&info,image()->compose,exceptionInfo);
3185  replaceImage(newImage);
3187 }
3188 
3189 void Magick::Image::fx(const std::string expression_)
3190 {
3192  *newImage;
3193 
3195  newImage=FxImage(constImage(),expression_.c_str(),exceptionInfo);
3196  replaceImage(newImage);
3198 }
3199 
3200 void Magick::Image::fx(const std::string expression_,
3201  const Magick::ChannelType channel_)
3202 {
3204  *newImage;
3205 
3207  GetAndSetPPChannelMask(channel_);
3208  newImage=FxImage(constImage(),expression_.c_str(),exceptionInfo);
3210  replaceImage(newImage);
3212 }
3213 
3214 void Magick::Image::gamma(const double gamma_)
3215 {
3216  modifyImage();
3218  GammaImage(image(),gamma_,exceptionInfo);
3220 }
3221 
3222 void Magick::Image::gamma(const double gammaRed_,const double gammaGreen_,
3223  const double gammaBlue_)
3224 {
3225  modifyImage();
3227  GetAndSetPPChannelMask(RedChannel);
3228  (void) GammaImage(image(),gammaRed_,exceptionInfo);
3229  SetPPChannelMask(GreenChannel);
3230  (void) GammaImage(image(),gammaGreen_,exceptionInfo);
3231  SetPPChannelMask(BlueChannel);
3232  (void) GammaImage(image(),gammaBlue_,exceptionInfo);
3235 }
3236 
3237 void Magick::Image::gaussianBlur(const double radius_,const double sigma_)
3238 {
3240  *newImage;
3241 
3243  newImage=GaussianBlurImage(constImage(),radius_,sigma_,exceptionInfo);
3244  replaceImage(newImage);
3246 }
3247 
3248 void Magick::Image::gaussianBlurChannel(const ChannelType channel_,
3249  const double radius_,const double sigma_)
3250 {
3252  *newImage;
3253 
3255  GetAndSetPPChannelMask(channel_);
3256  newImage=GaussianBlurImage(constImage(),radius_,sigma_,exceptionInfo);
3258  replaceImage(newImage);
3260 }
3261 
3262 const Magick::Quantum *Magick::Image::getConstPixels(const ssize_t x_,
3263  const ssize_t y_,const size_t columns_,const size_t rows_) const
3264 {
3265  const Quantum
3266  *p;
3267 
3269  p=GetVirtualPixels(constImage(),x_, y_,columns_, rows_,exceptionInfo);
3271  return(p);
3272 }
3273 
3274 const void *Magick::Image::getConstMetacontent(void) const
3275 {
3276  const void
3277  *result;
3278 
3279  result=GetVirtualMetacontent(constImage());
3280 
3281  if(!result)
3282  throwExceptionExplicit(MagickCore::OptionError,
3283  "Unable to retrieve meta content.");
3284 
3285  return(result);
3286 }
3287 
3289 {
3290  void
3291  *result;
3292 
3293  result=GetAuthenticMetacontent(image());
3294 
3295  if(!result)
3296  throwExceptionExplicit(MagickCore::OptionError,
3297  "Unable to retrieve meta content.");
3298 
3299  return(result);
3300 }
3301 
3302 Magick::Quantum *Magick::Image::getPixels(const ssize_t x_,const ssize_t y_,
3303  const size_t columns_,const size_t rows_)
3304 {
3305  Quantum
3306  *result;
3307 
3308  modifyImage();
3310  result=GetAuthenticPixels(image(),x_, y_,columns_,rows_,exceptionInfo);
3312 
3313  return(result);
3314 }
3315 
3316 void Magick::Image::grayscale(const PixelIntensityMethod method_)
3317 {
3318  modifyImage();
3320  (void) GrayscaleImage(image(),method_,exceptionInfo);
3322 }
3323 
3324 void Magick::Image::haldClut(const Image &clutImage_)
3325 {
3326  modifyImage();
3328  (void) HaldClutImage(image(),clutImage_.constImage(),exceptionInfo);
3330 }
3331 
3332 void Magick::Image::houghLine(const size_t width_,const size_t height_,
3333  const size_t threshold_)
3334 {
3336  *newImage;
3337 
3339  newImage=HoughLineImage(constImage(),width_,height_,threshold_,
3340  exceptionInfo);
3341  replaceImage(newImage);
3343 }
3344 
3345 Magick::ImageType Magick::Image::identifyType(void) const
3346 {
3347  ImageType
3348  image_type;
3349 
3351  image_type=IdentifyImageType(constImage(),exceptionInfo);
3353  return(image_type);
3354 }
3355 
3356 void Magick::Image::implode(const double factor_)
3357 {
3359  *newImage;
3360 
3362  newImage=ImplodeImage(constImage(),factor_,image()->interpolate,
3363  exceptionInfo);
3364  replaceImage(newImage);
3366 }
3367 
3369 {
3370  inverseFourierTransform(phase_,true);
3371 }
3372 
3374  const bool magnitude_)
3375 {
3377  *newImage;
3378 
3380  newImage=InverseFourierTransformImage(constImage(),phase_.constImage(),
3381  magnitude_ == true ? MagickTrue : MagickFalse,exceptionInfo);
3382  replaceImage(newImage);
3384 }
3385 
3386 void Magick::Image::kuwahara(const double radius_,const double sigma_)
3387 {
3389  *newImage;
3390 
3392  newImage=KuwaharaImage(constImage(),radius_,sigma_,exceptionInfo);
3393  replaceImage(newImage);
3395 }
3396 
3397 void Magick::Image::kuwaharaChannel(const ChannelType channel_,
3398  const double radius_,const double sigma_)
3399 {
3401  *newImage;
3402 
3404  GetAndSetPPChannelMask(channel_);
3405  newImage=KuwaharaImage(constImage(),radius_,sigma_,exceptionInfo);
3406  replaceImage(newImage);
3409 }
3410 
3411 void Magick::Image::level(const double blackPoint_,const double whitePoint_,
3412  const double gamma_)
3413 {
3414  modifyImage();
3416  (void) LevelImage(image(),blackPoint_,whitePoint_,gamma_,exceptionInfo);
3418 }
3419 
3420 void Magick::Image::levelChannel(const ChannelType channel_,
3421  const double blackPoint_,const double whitePoint_,const double gamma_)
3422 {
3423  modifyImage();
3425  GetAndSetPPChannelMask(channel_);
3426  (void) LevelImage(image(),blackPoint_,whitePoint_,gamma_,exceptionInfo);
3429 }
3430 
3431 void Magick::Image::levelColors(const Color &blackColor_,
3432  const Color &whiteColor_,const bool invert_)
3433 {
3434  PixelInfo
3435  black,
3436  white;
3437 
3438  modifyImage();
3439 
3440  black=static_cast<PixelInfo>(blackColor_);
3441  white=static_cast<PixelInfo>(whiteColor_);
3443  (void) LevelImageColors(image(),&black,&white,invert_ == true ?
3444  MagickTrue : MagickFalse,exceptionInfo);
3446 }
3447 
3448 void Magick::Image::levelColorsChannel(const ChannelType channel_,
3449  const Color &blackColor_,const Color &whiteColor_,const bool invert_)
3450 {
3451  PixelInfo
3452  black,
3453  white;
3454 
3455  modifyImage();
3456 
3457  black=static_cast<PixelInfo>(blackColor_);
3458  white=static_cast<PixelInfo>(whiteColor_);
3460  GetAndSetPPChannelMask(channel_);
3461  (void) LevelImageColors(image(),&black,&white,invert_ == true ?
3462  MagickTrue : MagickFalse,exceptionInfo);
3465 }
3466 
3467 void Magick::Image::levelize(const double blackPoint_,const double whitePoint_,
3468  const double gamma_)
3469 {
3470  modifyImage();
3472  (void) LevelizeImage(image(),blackPoint_,whitePoint_,gamma_,exceptionInfo);
3474 }
3475 
3476 void Magick::Image::levelizeChannel(const ChannelType channel_,
3477  const double blackPoint_,const double whitePoint_,const double gamma_)
3478 {
3479  modifyImage();
3481  GetAndSetPPChannelMask(channel_);
3482  (void) LevelizeImage(image(),blackPoint_,whitePoint_,gamma_,exceptionInfo);
3485 }
3486 
3487 void Magick::Image::linearStretch(const double blackPoint_,
3488  const double whitePoint_)
3489 {
3490  modifyImage();
3492  LinearStretchImage(image(),blackPoint_,whitePoint_,exceptionInfo);
3494 }
3495 
3497 {
3499  *newImage;
3500 
3501  size_t
3502  height=rows(),
3503  width=columns();
3504 
3505  ssize_t
3506  x=0,
3507  y=0;
3508 
3509  ParseMetaGeometry(static_cast<std::string>(geometry_).c_str(),&x,&y,&width,
3510  &height);
3511 
3513  newImage=LiquidRescaleImage(image(),width,height,x,y,exceptionInfo);
3514  replaceImage(newImage);
3516 }
3517 
3518 void Magick::Image::localContrast(const double radius_,const double strength_)
3519 {
3521  *newImage;
3522 
3524  newImage=LocalContrastImage(constImage(),radius_,strength_,exceptionInfo);
3525  replaceImage(newImage);
3527 }
3528 
3529 void Magick::Image::localContrastChannel(const ChannelType channel_,
3530  const double radius_,const double strength_)
3531 {
3533  *newImage;
3534 
3536  GetAndSetPPChannelMask(channel_);
3537  newImage=LocalContrastImage(constImage(),radius_,strength_,exceptionInfo);
3539  replaceImage(newImage);
3541 }
3542 
3544 {
3546  *newImage;
3547 
3549  newImage=MagnifyImage(constImage(),exceptionInfo);
3550  replaceImage(newImage);
3552 }
3553 
3554 void Magick::Image::map(const Image &mapImage_,const bool dither_)
3555 {
3556  modifyImage();
3558  options()->quantizeDither(dither_);
3559  RemapImage(options()->quantizeInfo(),image(),mapImage_.constImage(),
3560  exceptionInfo);
3562 }
3563 
3564 void Magick::Image::meanShift(const size_t width_,const size_t height_,
3565  const double color_distance_)
3566 {
3568  *newImage;
3569 
3571  newImage=MeanShiftImage(constImage(),width_,height_,color_distance_,
3572  exceptionInfo);
3573  replaceImage(newImage);
3575 }
3576 
3577 void Magick::Image::medianFilter(const double radius_)
3578 {
3580  *newImage;
3581 
3583  newImage=StatisticImage(image(),MedianStatistic,(size_t) radius_,
3584  (size_t) radius_,exceptionInfo);
3585  replaceImage(newImage);
3587 }
3588 
3590 {
3592  *newImage;
3593 
3595  newImage=MinifyImage(constImage(),exceptionInfo);
3596  replaceImage(newImage);
3598 }
3599 
3600 void Magick::Image::modulate(const double brightness_,const double saturation_,
3601  const double hue_)
3602 {
3603  char
3604  modulate[MagickPathExtent + 1];
3605 
3606  FormatLocaleString(modulate,MagickPathExtent,"%3.6f,%3.6f,%3.6f",brightness_,
3607  saturation_,hue_);
3608 
3609  modifyImage();
3611  ModulateImage(image(),modulate,exceptionInfo);
3613 }
3614 
3616 {
3617  return(ImageMoments(*this));
3618 }
3619 
3620 void Magick::Image::morphology(const MorphologyMethod method_,
3621  const std::string kernel_,const ssize_t iterations_)
3622 {
3623  KernelInfo
3624  *kernel;
3625 
3627  *newImage;
3628 
3630  kernel=AcquireKernelInfo(kernel_.c_str(),exceptionInfo);
3631  if (kernel == (KernelInfo *) NULL)
3632  throwExceptionExplicit(MagickCore::OptionError,"Unable to parse kernel.");
3633  newImage=MorphologyImage(constImage(),method_,iterations_,kernel,
3634  exceptionInfo);
3635  replaceImage(newImage);
3636  kernel=DestroyKernelInfo(kernel);
3638 }
3639 
3640 void Magick::Image::morphology(const MorphologyMethod method_,
3641  const KernelInfoType kernel_,const std::string arguments_,
3642  const ssize_t iterations_)
3643 {
3644  const char
3645  *option;
3646 
3647  std::string
3648  kernel;
3649 
3650  option=CommandOptionToMnemonic(MagickKernelOptions,kernel_);
3651  if (option == (const char *)NULL)
3652  {
3653  throwExceptionExplicit(MagickCore::OptionError,
3654  "Unable to determine kernel type.");
3655  return;
3656  }
3657  kernel=std::string(option);
3658  if (!arguments_.empty())
3659  kernel+=":"+arguments_;
3660 
3661  morphology(method_,kernel,iterations_);
3662 }
3663 
3664 void Magick::Image::morphologyChannel(const ChannelType channel_,
3665  const MorphologyMethod method_,const std::string kernel_,
3666  const ssize_t iterations_)
3667 {
3668  KernelInfo
3669  *kernel;
3670 
3672  *newImage;
3673 
3674 
3676  kernel=AcquireKernelInfo(kernel_.c_str(),exceptionInfo);
3677  if (kernel == (KernelInfo *)NULL)
3678  {
3679  throwExceptionExplicit(MagickCore::OptionError,
3680  "Unable to parse kernel.");
3681  return;
3682  }
3683  GetAndSetPPChannelMask(channel_);
3684  newImage=MorphologyImage(constImage(),method_,iterations_,kernel,
3685  exceptionInfo);
3687  replaceImage(newImage);
3688  kernel=DestroyKernelInfo(kernel);
3690 }
3691 
3692 void Magick::Image::morphologyChannel(const ChannelType channel_,
3693  const MorphologyMethod method_,const KernelInfoType kernel_,
3694  const std::string arguments_,const ssize_t iterations_)
3695 {
3696  const char
3697  *option;
3698 
3699  std::string
3700  kernel;
3701 
3702  option=CommandOptionToMnemonic(MagickKernelOptions,kernel_);
3703  if (option == (const char *)NULL)
3704  {
3705  throwExceptionExplicit(MagickCore::OptionError,
3706  "Unable to determine kernel type.");
3707  return;
3708  }
3709 
3710  kernel=std::string(option);
3711  if (!arguments_.empty())
3712  kernel+=":"+arguments_;
3713 
3714  morphologyChannel(channel_,method_,kernel,iterations_);
3715 }
3716 
3717 void Magick::Image::motionBlur(const double radius_,const double sigma_,
3718  const double angle_)
3719 {
3721  *newImage;
3722 
3724  newImage=MotionBlurImage(constImage(),radius_,sigma_,angle_,exceptionInfo);
3725  replaceImage(newImage);
3727 }
3728 
3729 void Magick::Image::negate(const bool grayscale_)
3730 {
3731  modifyImage();
3733  NegateImage(image(),(MagickBooleanType) grayscale_,exceptionInfo);
3735 }
3736 
3737 void Magick::Image::negateChannel(const ChannelType channel_,
3738  const bool grayscale_)
3739 {
3740  modifyImage();
3742  GetAndSetPPChannelMask(channel_);
3743  NegateImage(image(),(MagickBooleanType) grayscale_,exceptionInfo);
3746 }
3747 
3749 {
3750  modifyImage();
3752  NormalizeImage(image(),exceptionInfo);
3754 }
3755 
3756 void Magick::Image::oilPaint(const double radius_,const double sigma_)
3757 {
3759  *newImage;
3760 
3762  newImage=OilPaintImage(constImage(),radius_,sigma_,exceptionInfo);
3763  replaceImage(newImage);
3765 }
3766 
3767 void Magick::Image::opaque(const Color &opaqueColor_,const Color &penColor_,
3768  const bool invert_)
3769 {
3770  std::string
3771  opaqueColor,
3772  penColor;
3773 
3774  PixelInfo
3775  opaque,
3776  pen;
3777 
3778  if (!opaqueColor_.isValid())
3779  throwExceptionExplicit(MagickCore::OptionError,
3780  "Opaque color argument is invalid");
3781 
3782  if (!penColor_.isValid())
3783  throwExceptionExplicit(MagickCore::OptionError,
3784  "Pen color argument is invalid");
3785 
3786  modifyImage();
3787  opaqueColor=opaqueColor_;
3788  penColor=penColor_;
3789 
3791  (void) QueryColorCompliance(opaqueColor.c_str(),AllCompliance,&opaque,
3792  exceptionInfo);
3793  (void) QueryColorCompliance(penColor.c_str(),AllCompliance,&pen,
3794  exceptionInfo);
3795  OpaquePaintImage(image(),&opaque,&pen,invert_ ? MagickTrue : MagickFalse,
3796  exceptionInfo);
3798 }
3799 
3800 void Magick::Image::orderedDither(std::string thresholdMap_)
3801 {
3802  modifyImage();
3804  (void) OrderedDitherImage(image(),thresholdMap_.c_str(),exceptionInfo);
3806 }
3807 
3808 void Magick::Image::orderedDitherChannel(const ChannelType channel_,
3809  std::string thresholdMap_)
3810 {
3811  modifyImage();
3813  GetAndSetPPChannelMask(channel_);
3814  (void)OrderedDitherImage(image(),thresholdMap_.c_str(),exceptionInfo);
3817 }
3818 
3819 void Magick::Image::perceptible(const double epsilon_)
3820 {
3821  modifyImage();
3823  PerceptibleImage(image(),epsilon_,exceptionInfo);
3825 }
3826 
3827 void Magick::Image::perceptibleChannel(const ChannelType channel_,
3828  const double epsilon_)
3829 {
3830  modifyImage();
3832  GetAndSetPPChannelMask(channel_);
3833  PerceptibleImage(image(),epsilon_,exceptionInfo);
3836 }
3837 
3839 {
3840  return(ImagePerceptualHash(*this));
3841 }
3842 
3843 void Magick::Image::ping(const std::string &imageSpec_)
3844 {
3846  *newImage;
3847 
3849  options()->fileName(imageSpec_);
3850  newImage=PingImage(imageInfo(),exceptionInfo);
3851  read(newImage,exceptionInfo);
3852 }
3853 
3854 void Magick::Image::ping(const Blob& blob_)
3855 {
3857  *newImage;
3858 
3860  newImage=PingBlob(imageInfo(),blob_.data(),blob_.length(),exceptionInfo);
3861  read(newImage,exceptionInfo);
3862 }
3863 
3864 void Magick::Image::pixelColor(const ssize_t x_,const ssize_t y_,
3865  const Color &color_)
3866 {
3867  PixelInfo
3868  packet;
3869 
3870  Quantum
3871  *pixel;
3872 
3873  // Test arguments to ensure they are within the image.
3874  if (y_ > (ssize_t) rows() || x_ > (ssize_t) columns())
3875  throwExceptionExplicit(MagickCore::OptionError,
3876  "Access outside of image boundary");
3877 
3878  modifyImage();
3879 
3880  // Set image to DirectClass
3881  classType(DirectClass );
3882 
3883  // Get pixel view
3884  Pixels pixels(*this);
3885  // Set pixel value
3886  pixel=pixels.get(x_, y_, 1, 1 );
3887  packet=color_;
3888  MagickCore::SetPixelViaPixelInfo(constImage(),&packet,pixel);
3889  // Tell ImageMagick that pixels have been updated
3890  pixels.sync();
3891 }
3892 
3893 Magick::Color Magick::Image::pixelColor(const ssize_t x_,
3894  const ssize_t y_) const
3895 {
3896  const Quantum
3897  *pixel;
3898 
3899  pixel=getConstPixels(x_,y_,1,1);
3900  if (pixel)
3901  {
3902  PixelInfo
3903  packet;
3904 
3905  MagickCore::GetPixelInfoPixel(constImage(),pixel,&packet);
3906  return(Color(packet));
3907  }
3908 
3909  return(Color()); // invalid
3910 }
3911 
3912 void Magick::Image::polaroid(const std::string &caption_,const double angle_,
3913  const PixelInterpolateMethod method_)
3914 {
3916  *newImage;
3917 
3919  newImage=PolaroidImage(constImage(),options()->drawInfo(),caption_.c_str(),
3920  angle_,method_,exceptionInfo);
3921  replaceImage(newImage);
3923 }
3924 
3925 void Magick::Image::posterize(const size_t levels_,const DitherMethod method_)
3926 {
3927  modifyImage();
3929  PosterizeImage(image(),levels_,method_,exceptionInfo);
3931 }
3932 
3933 void Magick::Image::posterizeChannel(const ChannelType channel_,
3934  const size_t levels_,const DitherMethod method_)
3935 {
3936  modifyImage();
3938  GetAndSetPPChannelMask(channel_);
3939  PosterizeImage(image(),levels_,method_,exceptionInfo);
3942 }
3943 
3944 void Magick::Image::process(std::string name_,const ssize_t argc,
3945  const char **argv)
3946 {
3947  modifyImage();
3948 
3950  (void) InvokeDynamicImageFilter(name_.c_str(),&image(),argc,argv,
3951  exceptionInfo);
3953 }
3954 
3955 void Magick::Image::profile(const std::string name_,
3956  const Magick::Blob &profile_)
3957 {
3958  modifyImage();
3960  (void) ProfileImage(image(),name_.c_str(),(unsigned char *)profile_.data(),
3961  profile_.length(),exceptionInfo);
3963 }
3964 
3965 Magick::Blob Magick::Image::profile(const std::string name_) const
3966 {
3967  const StringInfo
3968  *profile;
3969 
3970  profile=GetImageProfile(constImage(),name_.c_str());
3971 
3972  if (profile == (StringInfo *) NULL)
3973  return(Blob());
3974  return(Blob((void*) GetStringInfoDatum(profile),GetStringInfoLength(
3975  profile)));
3976 }
3977 
3978 void Magick::Image::quantize(const bool measureError_)
3979 {
3980  modifyImage();
3981 
3982  if (measureError_)
3983  options()->quantizeInfo()->measure_error=MagickTrue;
3984  else
3985  options()->quantizeInfo()->measure_error=MagickFalse;
3986 
3988  QuantizeImage(options()->quantizeInfo(),image(),exceptionInfo);
3990 }
3991 
3992 void Magick::Image::raise(const Geometry &geometry_,const bool raisedFlag_)
3993 {
3994  RectangleInfo
3995  raiseInfo=geometry_;
3996 
3998  modifyImage();
3999  RaiseImage(image(),&raiseInfo,raisedFlag_ == true ? MagickTrue : MagickFalse,
4000  exceptionInfo);
4002 }
4003 
4004 void Magick::Image::randomThreshold(const double low_,const double high_)
4005 {
4007  (void) RandomThresholdImage(image(),low_,high_,exceptionInfo);
4009 }
4010 
4011 void Magick::Image::randomThresholdChannel(const ChannelType channel_,
4012  const double low_,const double high_)
4013 {
4014  modifyImage();
4016  GetAndSetPPChannelMask(channel_);
4017  (void) RandomThresholdImage(image(),low_,high_,exceptionInfo);
4020 }
4021 
4022 void Magick::Image::read(const Blob &blob_)
4023 {
4025  *newImage;
4026 
4028  newImage=BlobToImage(imageInfo(),static_cast<const void *>(blob_.data()),
4029  blob_.length(),exceptionInfo);
4030  read(newImage,exceptionInfo);
4031 }
4032 
4033 void Magick::Image::read(const Blob &blob_,const Geometry &size_)
4034 {
4035  size(size_);
4036  read(blob_);
4037 }
4038 
4039 void Magick::Image::read(const Blob &blob_,const Geometry &size_,
4040  const size_t depth_)
4041 {
4042  size(size_);
4043  depth(depth_);
4044  read(blob_);
4045 }
4046 
4047 void Magick::Image::read(const Blob &blob_,const Geometry &size_,
4048  const size_t depth_,const std::string &magick_)
4049 {
4050  size(size_);
4051  depth(depth_);
4052  magick(magick_);
4053  // Set explicit image format
4054  fileName(magick_ + ':');
4055  read(blob_);
4056 }
4057 
4058 void Magick::Image::read(const Blob &blob_,const Geometry &size_,
4059  const std::string &magick_)
4060 {
4061  size(size_);
4062  magick(magick_);
4063  // Set explicit image format
4064  fileName(magick_ + ':');
4065  read(blob_);
4066 }
4067 
4068 void Magick::Image::read(const Geometry &size_,const std::string &imageSpec_)
4069 {
4070  size(size_);
4071  read(imageSpec_);
4072 }
4073 
4074 void Magick::Image::read(const size_t width_,const size_t height_,
4075  const std::string &map_,const StorageType type_,const void *pixels_)
4076 {
4078  *newImage;
4079 
4081  newImage=ConstituteImage(width_,height_,map_.c_str(),type_, pixels_,
4082  exceptionInfo);
4083  replaceImage(newImage);
4085 }
4086 
4087 void Magick::Image::read(const std::string &imageSpec_)
4088 {
4090  *newImage;
4091 
4093  options()->fileName(imageSpec_);
4094  newImage=ReadImage(imageInfo(),exceptionInfo);
4095  read(newImage,exceptionInfo);
4096 }
4097 
4099 {
4100  mask(mask_,ReadPixelMask);
4101 }
4102 
4104 {
4105  return(mask(ReadPixelMask));
4106 }
4107 
4108 void Magick::Image::readPixels(const Magick::QuantumType quantum_,
4109  const unsigned char *source_)
4110 {
4111  QuantumInfo
4112  *quantum_info;
4113 
4114  quantum_info=AcquireQuantumInfo(imageInfo(),image());
4116  ImportQuantumPixels(image(),(MagickCore::CacheView *) NULL,quantum_info,
4117  quantum_,source_,exceptionInfo);
4118  quantum_info=DestroyQuantumInfo(quantum_info);
4120 }
4121 
4123 {
4124  reduceNoise(3);
4125 }
4126 
4127 void Magick::Image::reduceNoise(const size_t order_)
4128 {
4130  *newImage;
4131 
4133  newImage=StatisticImage(constImage(),NonpeakStatistic,order_,
4134  order_,exceptionInfo);
4135  replaceImage(newImage);
4137 }
4138 
4140 {
4141  modifyImage();
4142  options()->page(Geometry());
4143  image()->page.width = 0;
4144  image()->page.height = 0;
4145  image()->page.x = 0;
4146  image()->page.y = 0;
4147 }
4148 
4149 void Magick::Image::resample(const Point &density_)
4150 {
4152  *newImage;
4153 
4155  newImage=ResampleImage(constImage(),density_.x(),density_.y(),
4156  image()->filter,exceptionInfo);
4157  replaceImage(newImage);
4159 }
4160 
4161 void Magick::Image::resize(const Geometry &geometry_)
4162 {
4164  *newImage;
4165 
4166  size_t
4167  height=rows(),
4168  width=columns();
4169 
4170  ssize_t
4171  x=0,
4172  y=0;
4173 
4174  // Calculate new size. This code should be supported using binary arguments
4175  // in the ImageMagick library.
4176  ParseMetaGeometry(static_cast<std::string>(geometry_).c_str(),&x,&y,&width,
4177  &height);
4178 
4180  newImage=ResizeImage(constImage(),width,height,image()->filter,
4181  exceptionInfo);
4182  replaceImage(newImage);
4184 }
4185 
4186 void Magick::Image::roll(const Geometry &roll_)
4187 {
4189  *newImage;
4190 
4192  newImage=RollImage(constImage(),roll_.xOff(),roll_.yOff(),exceptionInfo);
4193  replaceImage(newImage);
4195 }
4196 
4197 void Magick::Image::roll(const size_t columns_,const size_t rows_)
4198 {
4200  *newImage;
4201 
4203  newImage=RollImage(constImage(),static_cast<ssize_t>(columns_),
4204  static_cast<ssize_t>(rows_),exceptionInfo);
4205  replaceImage(newImage);
4207 }
4208 
4209 void Magick::Image::rotate(const double degrees_)
4210 {
4212  *newImage;
4213 
4215  newImage=RotateImage(constImage(),degrees_,exceptionInfo);
4216  replaceImage(newImage);
4218 }
4219 
4220 void Magick::Image::rotationalBlur(const double angle_)
4221 {
4223  *newImage;
4224 
4226  newImage=RotationalBlurImage(constImage(),angle_,exceptionInfo);
4227  replaceImage(newImage);
4229 }
4230 
4231 void Magick::Image::rotationalBlurChannel(const ChannelType channel_,
4232  const double angle_)
4233 {
4235  *newImage;
4236 
4238  GetAndSetPPChannelMask(channel_);
4239  newImage=RotationalBlurImage(constImage(),angle_,exceptionInfo);
4241  replaceImage(newImage);
4243 }
4244 
4245 void Magick::Image::sample(const Geometry &geometry_)
4246 {
4248  *newImage;
4249 
4250  size_t
4251  height=rows(),
4252  width=columns();
4253 
4254  ssize_t
4255  x=0,
4256  y=0;
4257 
4258  ParseMetaGeometry(static_cast<std::string>(geometry_).c_str(),&x,&y,&width,
4259  &height);
4260 
4262  newImage=SampleImage(constImage(),width,height,exceptionInfo);
4263  replaceImage(newImage);
4265 }
4266 
4267 void Magick::Image::scale(const Geometry &geometry_)
4268 {
4270  *newImage;
4271 
4272  size_t
4273  height=rows(),
4274  width=columns();
4275 
4276  ssize_t
4277  x=0,
4278  y=0;
4279 
4280  ParseMetaGeometry(static_cast<std::string>(geometry_).c_str(),&x,&y,&width,
4281  &height);
4282 
4284  newImage=ScaleImage(constImage(),width,height,exceptionInfo);
4285  replaceImage(newImage);
4287 }
4288 
4289 void Magick::Image::segment(const double clusterThreshold_,
4290  const double smoothingThreshold_)
4291 {
4292  modifyImage();
4294  SegmentImage(image(),options()->quantizeColorSpace(),
4295  (MagickBooleanType) options()->verbose(),clusterThreshold_,
4296  smoothingThreshold_,exceptionInfo);
4297  SyncImage(image(),exceptionInfo);
4299 }
4300 
4301 void Magick::Image::selectiveBlur(const double radius_,const double sigma_,
4302  const double threshold_)
4303 {
4305  *newImage;
4306 
4308  newImage=SelectiveBlurImage(constImage(),radius_,sigma_,threshold_,
4309  exceptionInfo);
4310  replaceImage(newImage);
4312 }
4313 
4314 void Magick::Image::selectiveBlurChannel(const ChannelType channel_,
4315  const double radius_,const double sigma_,const double threshold_)
4316 {
4318  *newImage;
4319 
4321  GetAndSetPPChannelMask(channel_);
4322  newImage=SelectiveBlurImage(constImage(),radius_,sigma_,threshold_,
4323  exceptionInfo);
4325  replaceImage(newImage);
4327 }
4328 
4329 Magick::Image Magick::Image::separate(const ChannelType channel_) const
4330 {
4332  *image;
4333 
4335  image=SeparateImage(constImage(),channel_,exceptionInfo);
4337  if (image == (MagickCore::Image *) NULL)
4338  return(Magick::Image());
4339  else
4340  return(Magick::Image(image));
4341 }
4342 
4343 void Magick::Image::sepiaTone(const double threshold_)
4344 {
4346  *newImage;
4347 
4349  newImage=SepiaToneImage(constImage(),threshold_,exceptionInfo);
4350  replaceImage(newImage);
4352 }
4353 
4354 bool Magick::Image::setColorMetric(const Image &reference_)
4355 {
4356  bool
4357  status;
4358 
4359  Image
4360  ref=reference_;
4361 
4363  modifyImage();
4364  status=static_cast<bool>(SetImageColorMetric(image(),ref.constImage(),
4365  exceptionInfo));
4367  return(status);
4368 }
4369 
4370 Magick::Quantum *Magick::Image::setPixels(const ssize_t x_,const ssize_t y_,
4371  const size_t columns_,const size_t rows_)
4372 {
4373  Quantum
4374  *result;
4375 
4376  modifyImage();
4378  result=QueueAuthenticPixels(image(),x_,y_,columns_,rows_,exceptionInfo);
4380  return(result);
4381 }
4382 
4383 void Magick::Image::shade(const double azimuth_,const double elevation_,
4384  const bool colorShading_)
4385 {
4387  *newImage;
4388 
4390  newImage=ShadeImage(constImage(),colorShading_ == true ?
4391  MagickTrue : MagickFalse,azimuth_,elevation_,exceptionInfo);
4392  replaceImage(newImage);
4394 }
4395 
4396 void Magick::Image::shadow(const double percent_opacity_,const double sigma_,
4397  const ssize_t x_,const ssize_t y_)
4398 {
4400  *newImage;
4401 
4403  newImage=ShadowImage(constImage(),percent_opacity_, sigma_,x_, y_,
4404  exceptionInfo);
4405  replaceImage(newImage);
4407 }
4408 
4409 void Magick::Image::sharpen(const double radius_,const double sigma_)
4410 {
4412  *newImage;
4413 
4415  newImage=SharpenImage(constImage(),radius_,sigma_,exceptionInfo);
4416  replaceImage(newImage);
4418 }
4419 
4420 void Magick::Image::sharpenChannel(const ChannelType channel_,
4421  const double radius_,const double sigma_)
4422 {
4424  *newImage;
4425 
4427  GetAndSetPPChannelMask(channel_);
4428  newImage=SharpenImage(constImage(),radius_,sigma_,exceptionInfo);
4430  replaceImage(newImage);
4432 }
4433 
4434 void Magick::Image::shave(const Geometry &geometry_)
4435 {
4437  *newImage;
4438 
4439  RectangleInfo
4440  shaveInfo=geometry_;
4441 
4443  newImage=ShaveImage(constImage(),&shaveInfo,exceptionInfo);
4444  replaceImage(newImage);
4446 }
4447 
4448 void Magick::Image::shear(const double xShearAngle_,const double yShearAngle_)
4449 {
4451  *newImage;
4452 
4454  newImage=ShearImage(constImage(),xShearAngle_,yShearAngle_,exceptionInfo);
4455  replaceImage(newImage);
4457 }
4458 
4459 void Magick::Image::sigmoidalContrast(const bool sharpen_,
4460  const double contrast,const double midpoint)
4461 {
4462  modifyImage();
4464  (void) SigmoidalContrastImage(image(),(MagickBooleanType) sharpen_,contrast,
4465  midpoint,exceptionInfo);
4467 }
4468 
4469 std::string Magick::Image::signature(const bool force_) const
4470 {
4471  return(_imgRef->signature(force_));
4472 }
4473 
4474 void Magick::Image::sketch(const double radius_,const double sigma_,
4475  const double angle_)
4476 {
4478  *newImage;
4479 
4481  newImage=SketchImage(constImage(),radius_,sigma_,angle_,exceptionInfo);
4482  replaceImage(newImage);
4484 }
4485 
4486 void Magick::Image::solarize(const double factor_)
4487 {
4488  modifyImage();
4490  SolarizeImage(image(),factor_,exceptionInfo);
4492 }
4493 
4494 void Magick::Image::sparseColor(const ChannelType channel_,
4495  const SparseColorMethod method_,const size_t numberArguments_,
4496  const double *arguments_)
4497 {
4499  *newImage;
4500 
4502  GetAndSetPPChannelMask(channel_);
4503  newImage=SparseColorImage(constImage(),method_,numberArguments_,arguments_,
4504  exceptionInfo);
4506  replaceImage(newImage);
4508 }
4509 
4510 void Magick::Image::splice(const Geometry &geometry_)
4511 {
4513  *newImage;
4514 
4515  RectangleInfo
4516  spliceInfo=geometry_;
4517 
4519  newImage=SpliceImage(constImage(),&spliceInfo,exceptionInfo);
4520  replaceImage(newImage);
4522 }
4523 
4524 void Magick::Image::splice(const Geometry &geometry_,
4525  const Color &backgroundColor_)
4526 {
4527  backgroundColor(backgroundColor_);
4528  splice(geometry_);
4529 }
4530 
4531 void Magick::Image::splice(const Geometry &geometry_,
4532  const Color &backgroundColor_,const GravityType gravity_)
4533 {
4534  backgroundColor(backgroundColor_);
4535  image()->gravity=gravity_;
4536  splice(geometry_);
4537 }
4538 
4539 void Magick::Image::spread(const double amount_)
4540 {
4542  *newImage;
4543 
4545  newImage=SpreadImage(constImage(),image()->interpolate,amount_,exceptionInfo);
4546  replaceImage(newImage);
4548 }
4549 
4551 {
4552  return(ImageStatistics(*this));
4553 }
4554 
4555 void Magick::Image::stegano(const Image &watermark_)
4556 {
4558  *newImage;
4559 
4561  newImage=SteganoImage(constImage(),watermark_.constImage(),exceptionInfo);
4562  replaceImage(newImage);
4564 }
4565 
4566 void Magick::Image::stereo(const Image &rightImage_)
4567 {
4569  *newImage;
4570 
4572  newImage=StereoImage(constImage(),rightImage_.constImage(),exceptionInfo);
4573  replaceImage(newImage);
4575 }
4576 
4578 {
4579  modifyImage();
4581  StripImage(image(),exceptionInfo);
4583 }
4584 
4586  const MetricType metric_,Geometry *offset_,double *similarityMetric_,
4587  const double similarityThreshold)
4588 {
4590  *newImage;
4591 
4592  RectangleInfo
4593  offset;
4594 
4596  newImage=SimilarityImage(image(),reference_.constImage(),metric_,
4597  similarityThreshold,&offset,similarityMetric_,exceptionInfo);
4599  if (offset_ != (Geometry *) NULL)
4600  *offset_=offset;
4601  if (newImage == (MagickCore::Image *) NULL)
4602  return(Magick::Image());
4603  else
4604  return(Magick::Image(newImage));
4605 }
4606 
4607 void Magick::Image::swirl(const double degrees_)
4608 {
4610  *newImage;
4611 
4613  newImage=SwirlImage(constImage(),degrees_,image()->interpolate,
4614  exceptionInfo);
4615  replaceImage(newImage);
4617 }
4618 
4620 {
4622  (void) SyncAuthenticPixels(image(),exceptionInfo);
4624 }
4625 
4626 void Magick::Image::texture(const Image &texture_)
4627 {
4628  modifyImage();
4630  TextureImage(image(),texture_.constImage(),exceptionInfo);
4632 }
4633 
4634 void Magick::Image::threshold(const double threshold_)
4635 {
4636  modifyImage();
4638  BilevelImage(image(),threshold_,exceptionInfo);
4640 }
4641 
4642 void Magick::Image::thumbnail(const Geometry &geometry_)
4643 {
4645  *newImage;
4646 
4647  size_t
4648  height=rows(),
4649  width=columns();
4650 
4651  ssize_t
4652  x=0,
4653  y=0;
4654 
4655  ParseMetaGeometry(static_cast<std::string>(geometry_).c_str(),&x,&y,&width,
4656  &height);
4657 
4659  newImage=ThumbnailImage(constImage(),width,height,exceptionInfo);
4660  replaceImage(newImage);
4662 }
4663 
4664 void Magick::Image::tint(const std::string opacity_)
4665 {
4667  *newImage;
4668 
4669  PixelInfo
4670  color;
4671 
4673  color=static_cast<PixelInfo>(constOptions()->fillColor());
4674  newImage=TintImage(constImage(),opacity_.c_str(),&color,exceptionInfo);
4675  replaceImage(newImage);
4677 }
4678 
4679 void Magick::Image::transformOrigin(const double x_,const double y_)
4680 {
4681  modifyImage();
4682  options()->transformOrigin(x_,y_);
4683 }
4684 
4686 {
4687  modifyImage();
4688  options()->transformReset();
4689 }
4690 
4691 void Magick::Image::transformScale(const double sx_,const double sy_)
4692 {
4693  modifyImage();
4694  options()->transformScale(sx_,sy_);
4695 }
4696 
4697 void Magick::Image::transparent(const Color &color_,const bool inverse_)
4698 {
4699  PixelInfo
4700  target;
4701 
4702  std::string
4703  color;
4704 
4705  if (!color_.isValid())
4706  throwExceptionExplicit(MagickCore::OptionError,
4707  "Color argument is invalid");
4708 
4709  color=color_;
4711  (void) QueryColorCompliance(color.c_str(),AllCompliance,&target,
4712  exceptionInfo);
4713  modifyImage();
4714  TransparentPaintImage(image(),&target,TransparentAlpha,
4715  inverse_ == true ? MagickTrue : MagickFalse,exceptionInfo);
4717 }
4718 
4720  const Color &colorHigh_)
4721 {
4722  std::string
4723  colorHigh,
4724  colorLow;
4725 
4726  PixelInfo
4727  targetHigh,
4728  targetLow;
4729 
4730  if (!colorLow_.isValid() || !colorHigh_.isValid())
4731  throwExceptionExplicit(MagickCore::OptionError,
4732  "Color argument is invalid");
4733 
4734  colorLow=colorLow_;
4735  colorHigh=colorHigh_;
4736 
4738  (void) QueryColorCompliance(colorLow.c_str(),AllCompliance,&targetLow,
4739  exceptionInfo);
4740  (void) QueryColorCompliance(colorHigh.c_str(),AllCompliance,&targetHigh,
4741  exceptionInfo);
4742  modifyImage();
4743  TransparentPaintImageChroma(image(),&targetLow,&targetHigh,TransparentAlpha,
4744  MagickFalse,exceptionInfo);
4746 }
4747 
4749 {
4751  *newImage;
4752 
4754  newImage=TransposeImage(constImage(),exceptionInfo);
4755  replaceImage(newImage);
4757 }
4758 
4760 {
4762  *newImage;
4763 
4765  newImage=TransverseImage(constImage(),exceptionInfo);
4766  replaceImage(newImage);
4768 }
4769 
4771 {
4773  *newImage;
4774 
4776  newImage=TrimImage(constImage(),exceptionInfo);
4777  replaceImage(newImage);
4779 }
4780 
4782 {
4784  *image;
4785 
4787  image=UniqueImageColors(constImage(),exceptionInfo);
4789  if (image == (MagickCore::Image *) NULL)
4790  return(Magick::Image());
4791  else
4792  return(Magick::Image(image));
4793 }
4794 
4795 void Magick::Image::unsharpmask(const double radius_,const double sigma_,
4796  const double amount_,const double threshold_)
4797 {
4799  *newImage;
4800 
4802  newImage=UnsharpMaskImage(constImage(),radius_,sigma_,amount_,threshold_,
4803  exceptionInfo);
4804  replaceImage(newImage);
4806 }
4807 
4808 void Magick::Image::unsharpmaskChannel(const ChannelType channel_,
4809  const double radius_,const double sigma_,const double amount_,
4810  const double threshold_)
4811 {
4813  *newImage;
4814 
4816  GetAndSetPPChannelMask(channel_);
4817  newImage=UnsharpMaskImage(constImage(),radius_,sigma_,amount_,threshold_,
4818  exceptionInfo);
4820  replaceImage(newImage);
4822 }
4823 
4824 void Magick::Image::vignette(const double radius_,const double sigma_,
4825  const ssize_t x_,const ssize_t y_)
4826 {
4828  *newImage;
4829 
4831  newImage=VignetteImage(constImage(),radius_,sigma_,x_,y_,exceptionInfo);
4832  replaceImage(newImage);
4834 }
4835 
4836 void Magick::Image::wave(const double amplitude_,const double wavelength_)
4837 {
4839  *newImage;
4840 
4842  newImage=WaveImage(constImage(),amplitude_,wavelength_,image()->interpolate,
4843  exceptionInfo);
4844  replaceImage(newImage);
4846 }
4847 
4848 void Magick::Image::waveletDenoise(const double threshold_,
4849  const double softness_)
4850 {
4852  *newImage;
4853 
4855  newImage=WaveletDenoiseImage(constImage(),threshold_,softness_,
4856  exceptionInfo);
4857  replaceImage(newImage);
4859 }
4860 
4861 void Magick::Image::whiteThreshold(const std::string &threshold_)
4862 {
4863  modifyImage();
4865  WhiteThresholdImage(image(),threshold_.c_str(),exceptionInfo);
4867 }
4868 
4869 void Magick::Image::whiteThresholdChannel(const ChannelType channel_,
4870  const std::string &threshold_)
4871 {
4872  modifyImage();
4874  GetAndSetPPChannelMask(channel_);
4875  WhiteThresholdImage(image(),threshold_.c_str(),exceptionInfo);
4878 }
4879 
4881 {
4882  size_t
4883  length=0;
4884 
4885  void
4886  *data;
4887 
4888  modifyImage();
4890  data=ImagesToBlob(constImageInfo(),image(),&length,exceptionInfo);
4891  if (length > 0)
4892  blob_->updateNoCopy(data,length,Blob::MallocAllocator);
4893  else
4894  data=RelinquishMagickMemory(data);
4896 }
4897 
4898 void Magick::Image::write(Blob *blob_,const std::string &magick_)
4899 {
4900  size_t
4901  length=0;
4902 
4903  void
4904  *data;
4905 
4906  modifyImage();
4907  magick(magick_);
4909  data=ImagesToBlob(constImageInfo(),image(),&length,exceptionInfo);
4910  if (length > 0)
4911  blob_->updateNoCopy(data,length,Blob::MallocAllocator);
4912  else
4913  data=RelinquishMagickMemory(data);
4915 }
4916 
4917 void Magick::Image::write(Blob *blob_,const std::string &magick_,
4918  const size_t depth_)
4919 {
4920  size_t
4921  length=0;
4922 
4923  void
4924  *data;
4925 
4926  modifyImage();
4927  magick(magick_);
4928  depth(depth_);
4930  data=ImagesToBlob(constImageInfo(),image(),&length,exceptionInfo);
4931  if (length > 0)
4932  blob_->updateNoCopy(data,length,Blob::MallocAllocator);
4933  else
4934  data=RelinquishMagickMemory(data);
4936 }
4937 
4938 void Magick::Image::write(const ssize_t x_,const ssize_t y_,
4939  const size_t columns_,const size_t rows_,const std::string &map_,
4940  const StorageType type_,void *pixels_)
4941 {
4943  ExportImagePixels(image(),x_,y_,columns_,rows_,map_.c_str(),type_,pixels_,
4944  exceptionInfo);
4946 }
4947 
4948 void Magick::Image::write(const std::string &imageSpec_)
4949 {
4950  modifyImage();
4951  fileName(imageSpec_);
4953  WriteImage(constImageInfo(),image(),exceptionInfo);
4955 }
4956 
4958 {
4959  mask(mask_,WritePixelMask);
4960 }
4961 
4963 {
4964  return(mask(WritePixelMask));
4965 }
4966 
4967 void Magick::Image::writePixels(const Magick::QuantumType quantum_,
4968  unsigned char *destination_)
4969 {
4970  QuantumInfo
4971  *quantum_info;
4972 
4973  quantum_info=AcquireQuantumInfo(imageInfo(),image());
4975  ExportQuantumPixels(image(),(MagickCore::CacheView *) NULL,quantum_info,
4976  quantum_,destination_, exceptionInfo);
4977  quantum_info=DestroyQuantumInfo(quantum_info);
4979 }
4980 
4981 void Magick::Image::zoom(const Geometry &geometry_)
4982 {
4984  *newImage;
4985 
4986  size_t
4987  height=rows(),
4988  width=columns();
4989 
4990  ssize_t
4991  x=0,
4992  y=0;
4993 
4994  ParseMetaGeometry(static_cast<std::string>(geometry_).c_str(),&x,&y,&width,
4995  &height);
4996 
4998  newImage=ResizeImage(constImage(),width,height,image()->filter,exceptionInfo);
4999  replaceImage(newImage);
5001 }
5002 
5004  : _imgRef(new ImageRef(image_))
5005 {
5006 }
5007 
5009 {
5010  return(_imgRef->image());
5011 }
5012 
5014 {
5015  return(_imgRef->image());
5016 }
5017 
5018 MagickCore::ImageInfo *Magick::Image::imageInfo(void)
5019 {
5020  return(_imgRef->options()->imageInfo());
5021 }
5022 
5023 const MagickCore::ImageInfo *Magick::Image::constImageInfo(void) const
5024 {
5025  return(_imgRef->options()->imageInfo());
5026 }
5027 
5029 {
5030  return(_imgRef->options());
5031 }
5032 
5034 {
5035  return(_imgRef->options());
5036 }
5037 
5038 MagickCore::QuantizeInfo *Magick::Image::quantizeInfo(void)
5039 {
5040  return(_imgRef->options()->quantizeInfo());
5041 }
5042 
5043 const MagickCore::QuantizeInfo *Magick::Image::constQuantizeInfo(void) const
5044 {
5045  return(_imgRef->options()->quantizeInfo());
5046 }
5047 
5049 {
5050  if (!_imgRef->isShared())
5051  return;
5052 
5054  replaceImage(CloneImage(image(),0,0,MagickTrue,exceptionInfo));
5056 }
5057 
5059 {
5061  *image;
5062 
5063  if (replacement_)
5064  image=replacement_;
5065  else
5066  {
5068  image=AcquireImage(constImageInfo(),exceptionInfo);
5070  }
5071 
5072  _imgRef=ImageRef::replaceImage(_imgRef,image);
5073  return(image);
5074 }
5075 
5077  MagickCore::ExceptionInfo *exceptionInfo)
5078 {
5079  // Ensure that multiple image frames were not read.
5080  if (image != (MagickCore::Image *) NULL &&
5081  image->next != (MagickCore::Image *) NULL)
5082  {
5084  *next;
5085 
5086  // Destroy any extra image frames
5087  next=image->next;
5088  image->next=(MagickCore::Image *) NULL;
5089  next->previous=(MagickCore::Image *) NULL;
5090  DestroyImageList(next);
5091  }
5092  replaceImage(image);
5093  if (exceptionInfo->severity == MagickCore::UndefinedException &&
5094  image == (MagickCore::Image *) NULL)
5095  {
5096  (void) MagickCore::DestroyExceptionInfo(exceptionInfo);
5097  if (!quiet())
5098  throwExceptionExplicit(MagickCore::ImageWarning,
5099  "No image was loaded.");
5100  return;
5101  }
5103 }
5104 
5105 void Magick::Image::floodFill(const ssize_t x_,const ssize_t y_,
5106  const Magick::Image *fillPattern_,const Magick::Color &fill_,
5107  const MagickCore::PixelInfo *target_,const bool invert_)
5108 {
5110  fillColor;
5111 
5113  *fillPattern;
5114 
5115  // Set drawing fill pattern or fill color
5116  fillColor=options()->fillColor();
5117  fillPattern=(MagickCore::Image *)NULL;
5118  if (options()->fillPattern() != (MagickCore::Image *)NULL)
5119  {
5121  fillPattern=CloneImage(options()->fillPattern(),0,0,MagickTrue,
5122  exceptionInfo);
5124  }
5125 
5126  if (fillPattern_ == (Magick::Image *)NULL)
5127  {
5128  options()->fillPattern((MagickCore::Image *)NULL);
5129  options()->fillColor(fill_);
5130  }
5131  else
5132  options()->fillPattern(fillPattern_->constImage());
5133 
5135  (void) FloodfillPaintImage(image(),options()->drawInfo(),
5136  target_,static_cast<ssize_t>(x_),static_cast<ssize_t>(y_),
5137  (MagickBooleanType) invert_,exceptionInfo);
5138 
5139  options()->fillColor(fillColor);
5140  options()->fillPattern(fillPattern);
5142 }
5143 
5144 void Magick::Image::mask(const Magick::Image &mask_,const PixelMask type)
5145 {
5146  modifyImage();
5147 
5149  if (mask_.isValid())
5150  SetImageMask(image(),type,mask_.constImage(),exceptionInfo);
5151  else
5152  SetImageMask(image(),type,(MagickCore::Image *) NULL,
5153  exceptionInfo);
5155 }
5156 
5157 Magick::Image Magick::Image::mask(const PixelMask type) const
5158 {
5160  *image;
5161 
5163  image = GetImageMask(constImage(),type,exceptionInfo);
5165 
5166  if (image == (MagickCore::Image *) NULL)
5167  return(Magick::Image());
5168  else
5169  return(Magick::Image(image));
5170 }
void localContrast(const double radius_, const double strength_)
Definition: Image.cpp:3518
Point density(void) const
Definition: Image.cpp:671
void gaussianBlur(const double radius_, const double sigma_)
Definition: Image.cpp:3237
void swirl(const double degrees_)
Definition: Image.cpp:4607
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:3620
void decipher(const std::string &passphrase_)
Definition: Image.cpp:2676
void clip(void)
Definition: Image.cpp:2308
size_t scene(void) const
Definition: Image.cpp:1361
MagickPPExport int operator!=(const Magick::Color &left_, const Magick::Color &right_)
Definition: Color.cpp:36
ImageMoments moments(void) const
Definition: Image.cpp:3615
void splice(const Geometry &geometry_)
Definition: Image.cpp:4510
void width(size_t width_)
Definition: Geometry.cpp:397
#define RestorePPChannelMask
Definition: Include.h:1556
size_t animationDelay(void) const
Definition: Image.cpp:358
void resize(const Geometry &geometry_)
Definition: Image.cpp:4161
bool adjoin(void) const
Definition: Image.cpp:300
Image writeMask(void) const
Definition: Image.cpp:4962
void localContrastChannel(const ChannelType channel_, const double radius_, const double strength_)
Definition: Image.cpp:3529
void brightnessContrastChannel(const ChannelType channel_, const double brightness_=0.0, const double contrast_=0.0)
Definition: Image.cpp:2143
RenderingIntent renderingIntent(void) const
Definition: Image.cpp:1332
StyleType fontStyle(void) const
Definition: Image.cpp:889
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:3600
size_t strokeMiterLimit(void) const
Definition: Image.cpp:1456
void annotate(const std::string &text_, const Geometry &location_)
Definition: Image.cpp:1845
void transformSkewX(const double skewx_)
Definition: Image.cpp:1637
VirtualPixelMethod virtualPixelMethod(void) const
Definition: Image.cpp:1685
Magick::ImageStatistics statistics() const
Definition: Image.cpp:4550
bool setColorMetric(const Image &reference_)
Definition: Image.cpp:4354
void chromaGreenPrimary(const double x_, const double y_, const double z_)
Definition: Image.cpp:2242
void fx(const std::string expression_)
Definition: Image.cpp:3189
#define ThrowImageException
Definition: Image.cpp:30
Color matteColor(void) const
Definition: Image.cpp:347
OrientationType orientation(void) const
Definition: Image.cpp:1228
double meanErrorPerPixel(void) const
Definition: Image.cpp:1164
void process(std::string name_, const ::ssize_t argc_, const char **argv_)
Definition: Image.cpp:3944
Blob exifProfile(void) const
Definition: Image.cpp:745
void adaptiveThreshold(const size_t width_, const size_t height_, const double bias_=0.0)
Definition: Image.cpp:1769
void writePixels(const QuantumType quantum_, unsigned char *destination_)
Definition: Image.cpp:4967
void charcoal(const double radius_=0.0, const double sigma_=1.0)
Definition: Image.cpp:2187
EndianType endian(void) const
Definition: Image.cpp:722
const Quantum * getConstPixels(const ::ssize_t x_, const ::ssize_t y_, const size_t columns_, const size_t rows_) const
Definition: Image.cpp:3262
void blur(const double radius_=0.0, const double sigma_=1.0)
Definition: Image.cpp:2094
Color borderColor(void) const
Definition: Image.cpp:439
std::string label(void) const
Definition: Image.cpp:1105
void contrast(const bool sharpen_)
Definition: Image.cpp:2584
void profile(const std::string name_, const Blob &colorProfile_)
Definition: Image.cpp:3955
Blob iccColorProfile(void) const
Definition: Image.cpp:999
const MagickCore::Image * constImage(void) const
Definition: Image.cpp:5013
void medianFilter(const double radius_=0.0)
Definition: Image.cpp:3577
void enhance(void)
Definition: Image.cpp:2864
size_t subRange(void) const
Definition: Image.cpp:1527
void height(size_t height_)
Definition: Geometry.cpp:357
void chop(const Geometry &geometry_)
Definition: Image.cpp:2212
MagickPPExport const char * raiseGeometryDefault
Definition: Image.cpp:34
void composite(const Image &compositeImage_, const Geometry &offset_, const CompositeOperator compose_=InCompositeOp)
Definition: Image.cpp:2522
void liquidRescale(const Geometry &geometry_)
Definition: Image.cpp:3496
void unsharpmask(const double radius_, const double sigma_, const double amount_, const double threshold_)
Definition: Image.cpp:4795
Color textUnderColor(void) const
Definition: Image.cpp:1615
#define DegreesToRadians(x)
Definition: Image.cpp:29
void readPixels(const QuantumType quantum_, const unsigned char *source_)
Definition: Image.cpp:4108
void negate(const bool grayscale_=false)
Definition: Image.cpp:3729
void connectedComponents(const size_t connectivity_)
Definition: Image.cpp:2572
void raise(const Geometry &geometry_=raiseGeometryDefault, const bool raisedFlag_=false)
Definition: Image.cpp:3992
void sparseColor(const ChannelType channel_, const SparseColorMethod method_, const size_t numberArguments_, const double *arguments_)
Definition: Image.cpp:4494
void clutChannel(const ChannelType channel_, const Image &clutImage_, const PixelInterpolateMethod method)
Definition: Image.cpp:2334
void whiteThreshold(const std::string &threshold_)
Definition: Image.cpp:4861
std::string directory(void) const
Definition: Image.cpp:703
void crop(const Geometry &geometry_)
Definition: Image.cpp:2654
void adaptiveResize(const Geometry &geometry_)
Definition: Image.cpp:1722
ImageType type(void) const
Definition: Image.cpp:1649
bool alpha(void) const
Definition: Image.cpp:321
std::string backgroundTexture(void) const
Definition: Image.cpp:397
std::string font(void) const
Definition: Image.cpp:856
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:2316
void posterizeChannel(const ChannelType channel_, const size_t levels_, const DitherMethod method_)
Definition: Image.cpp:3933
size_t quality(void) const
Definition: Image.cpp:1253
void defineValue(const std::string &magick_, const std::string &key_, const std::string &value_)
Definition: Image.cpp:2714
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:4824
std::string comment(void) const
Definition: Image.cpp:603
Image separate(const ChannelType channel_) const
Definition: Image.cpp:4329
bool textAntiAlias(void) const
Definition: Image.cpp:1538
std::string magick(void) const
Definition: Image.cpp:1147
void shade(const double azimuth_=30, const double elevation_=30, const bool colorShading_=false)
Definition: Image.cpp:4383
STL namespace.
size_t modulusDepth(void) const
Definition: Image.cpp:1178
void waveletDenoise(const double threshold_, const double softness_)
Definition: Image.cpp:4848
Image & operator=(const Image &image_)
Definition: Image.cpp:280
void write(Blob *blob_)
Definition: Image.cpp:4880
void meanShift(const size_t width_, const size_t height_, const double color_distance_)
Definition: Image.cpp:3564
void kuwaharaChannel(const ChannelType channel_, const double radius_=0.0, const double sigma_=1.0)
Definition: Image.cpp:3397
MagickSizeType fileSize(void) const
Definition: Image.cpp:779
void equalize(void)
Definition: Image.cpp:2875
void zoom(const Geometry &geometry_)
Definition: Image.cpp:4981
void autoThreshold(const AutoThresholdMethod method_)
Definition: Image.cpp:2056
void blurChannel(const ChannelType channel_, const double radius_=0.0, const double sigma_=1.0)
Definition: Image.cpp:2105
void morphologyChannel(const ChannelType channel_, const MorphologyMethod method_, const std::string kernel_, const ssize_t iterations_=1)
Definition: Image.cpp:3664
void highlightColor(const Color color_)
Definition: Image.cpp:985
std::string fileName(void) const
Definition: Image.cpp:774
ColorspaceType colorSpace(void) const
Definition: Image.cpp:569
const Options * constOptions(void) const
Definition: Image.cpp:5033
MagickPPExport int operator<(const Magick::Color &left_, const Magick::Color &right_)
Definition: Color.cpp:48
size_t quantizeColors(void) const
Definition: Image.cpp:1264
void yOff(::ssize_t yOff_)
Definition: Geometry.cpp:428
Image uniqueColors(void) const
Definition: Image.cpp:4781
Image readMask(void) const
Definition: Image.cpp:4103
const MagickCore::ImageInfo * constImageInfo(void) const
Definition: Image.cpp:5023
void posterize(const size_t levels_, const DitherMethod method_)
Definition: Image.cpp:3925
void rotationalBlurChannel(const ChannelType channel_, const double angle_)
Definition: Image.cpp:4231
void adaptiveSharpen(const double radius_=0.0, const double sigma_=1.0)
Definition: Image.cpp:1744
std::string fontFamily(void) const
Definition: Image.cpp:867
void oilPaint(const double radius_=0.0, const double sigma=1.0)
Definition: Image.cpp:3756
void contrastStretchChannel(const ChannelType channel_, const double blackPoint_, const double whitePoint_)
Definition: Image.cpp:2601
MagickCore::Image * replaceImage(MagickCore::Image *replacement_)
Definition: Image.cpp:5058
void floodFillTexture(const Geometry &point_, const Image &texture_, const bool invert_=false)
Definition: Image.cpp:3069
void transformScale(const double sx_, const double sy_)
Definition: Image.cpp:4691
FillRule fillRule(void) const
Definition: Image.cpp:801
void encipher(const std::string &passphrase_)
Definition: Image.cpp:2856
void spread(const double amount_=3.0)
Definition: Image.cpp:4539
CompressionType compressType(void) const
Definition: Image.cpp:635
bool verbose(void) const
Definition: Image.cpp:1671
double compareChannel(const ChannelType channel_, const Image &reference_, const MetricType metric_)
Definition: Image.cpp:2473
void linearStretch(const double blackPoint_, const double whitePoint_)
Definition: Image.cpp:3487
void randomThresholdChannel(const ChannelType channel_, const double low_, const double high_)
Definition: Image.cpp:4011
size_t quantizeTreeDepth(void) const
Definition: Image.cpp:1309
void extent(const Geometry &geometry_)
Definition: Image.cpp:2940
void colorMatrix(const size_t order_, const double *color_matrix_)
Definition: Image.cpp:2417
void pixelColor(const ::ssize_t x_, const ::ssize_t y_, const Color &color_)
std::string baseFilename(void) const
Definition: Image.cpp:407
Image strokePattern(void) const
Definition: Image.cpp:1470
void fontTypeMetricsMultiline(const std::string &text_, TypeMetric *metrics)
Definition: Image.cpp:3132
Geometry page(void) const
Definition: Image.cpp:1240
void motionBlur(const double radius_, const double sigma_, const double angle_)
Definition: Image.cpp:3717
bool debug(void) const
Definition: Image.cpp:646
void perceptibleChannel(const ChannelType channel_, const double epsilon_)
Definition: Image.cpp:3827
void emboss(const double radius_=0.0, const double sigma_=1.0)
Definition: Image.cpp:2845
void magnify(void)
Definition: Image.cpp:3543
ImageType identifyType(void) const
Definition: Image.cpp:3345
void polaroid(const std::string &caption_, const double angle_, const PixelInterpolateMethod method_)
Definition: Image.cpp:3912
void levelColors(const Color &blackColor_, const Color &whiteColor_, const bool invert_=true)
Definition: Image.cpp:3431
void segment(const double clusterThreshold_=1.0, const double smoothingThreshold_=1.5)
Definition: Image.cpp:4289
void grayscale(const PixelIntensityMethod method_)
Definition: Image.cpp:3316
void reduceNoise(void)
Definition: Image.cpp:4122
void clampChannel(const ChannelType channel_)
Definition: Image.cpp:2298
double strokeDashOffset(void) const
Definition: Image.cpp:1423
void channelDepth(const ChannelType channel_, const size_t depth_)
Definition: Image.cpp:466
void orderedDither(std::string thresholdMap_)
Definition: Image.cpp:3800
DitherMethod quantizeDitherMethod(void) const
Definition: Image.cpp:1298
void stegano(const Image &watermark_)
Definition: Image.cpp:4555
void sharpen(const double radius_=0.0, const double sigma_=1.0)
Definition: Image.cpp:4409
size_t subImage(void) const
Definition: Image.cpp:1516
void resample(const Point &density_)
Definition: Image.cpp:4149
MagickCore::Image *& image(void)
Definition: Image.cpp:5008
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:1063
void trim(void)
Definition: Image.cpp:4770
size_t depth(void) const
Definition: Image.cpp:698
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:4486
double fontPointsize(void) const
Definition: Image.cpp:878
void updateNoCopy(void *data_, const size_t length_, const Allocator allocator_=NewAllocator)
Definition: Blob.cpp:121
MagickPPExport int operator>=(const Magick::Color &left_, const Magick::Color &right_)
Definition: Color.cpp:64
void stereo(const Image &rightImage_)
Definition: Image.cpp:4566
void defineSet(const std::string &magick_, const std::string &key_, bool flag_)
Definition: Image.cpp:2684
void quantize(const bool measureError_=false)
Definition: Image.cpp:3978
void read(const Blob &blob_)
Definition: Image.cpp:4022
void autoGammaChannel(const ChannelType channel_)
Definition: Image.cpp:2012
void frame(const Geometry &geometry_=frameGeometryDefault)
Definition: Image.cpp:3146
void orderedDitherChannel(const ChannelType channel_, std::string thresholdMap_)
Definition: Image.cpp:3808
#define ThrowPPDrawException(quiet)
Definition: Include.h:1560
Blob iptcProfile(void) const
Definition: Image.cpp:1051
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:3302
void flip(void)
Definition: Image.cpp:2984
LineCap strokeLineCap(void) const
Definition: Image.cpp:1434
void shave(const Geometry &geometry_)
Definition: Image.cpp:4434
std::string textEncoding(void) const
Definition: Image.cpp:1560
#define MagickPPExport
Definition: Include.h:281
void tint(const std::string opacity_)
Definition: Image.cpp:4664
void perceptible(const double epsilon_)
Definition: Image.cpp:3819
void blackThreshold(const std::string &threshold_)
Definition: Image.cpp:2064
bool isValid(void) const
Definition: Image.cpp:1090
void erase(void)
Definition: Image.cpp:2883
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:4420
FilterType filterType(void) const
Definition: Image.cpp:845
double xResolution(void) const
Definition: Image.cpp:1701
bool quantizeDither(void) const
Definition: Image.cpp:1287
InterlaceType interlaceType(void) const
Definition: Image.cpp:1018
void fillPattern(const Image &fillPattern_)
Definition: Image.cpp:806
const void * getConstMetacontent(void) const
Definition: Image.cpp:3274
std::string format(void) const
Definition: Image.cpp:905
void blackThresholdChannel(const ChannelType channel_, const std::string &threshold_)
Definition: Image.cpp:2072
void edge(const double radius_=0.0)
Definition: Image.cpp:2834
size_t colorMapSize(void) const
Definition: Image.cpp:549
void kuwahara(const double radius_=0.0, const double sigma_=1.0)
Definition: Image.cpp:3386
std::string signature(const bool force_=false) const
Definition: Image.cpp:4469
void texture(const Image &texture_)
Definition: Image.cpp:4626
void xOff(::ssize_t xOff_)
Definition: Geometry.cpp:418
void sepiaTone(const double threshold_)
Definition: Image.cpp:4343
size_t totalColors(void) const
Definition: Image.cpp:1620
PixelInterpolateMethod interpolate(void) const
Definition: Image.cpp:1029
void transparentChroma(const Color &colorLow_, const Color &colorHigh_)
Definition: Image.cpp:4719
void sy(const double sy_)
Definition: Drawable.h:251
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:4396
void whiteThresholdChannel(const ChannelType channel_, const std::string &threshold_)
Definition: Image.cpp:4869
void minify(void)
Definition: Image.cpp:3589
void syncPixels(void)
Definition: Image.cpp:4619
void scale(const Geometry &geometry_)
Definition: Image.cpp:4267
MagickCore::ImageInfo * imageInfo(void)
Definition: Image.cpp:5018
Image subImageSearch(const Image &reference_, const MetricType metric_, Geometry *offset_, double *similarityMetric_, const double similarityThreshold=(-1.0))
Definition: Image.cpp:4585
void unsharpmaskChannel(const ChannelType channel_, const double radius_, const double sigma_, const double amount_, const double threshold_)
Definition: Image.cpp:4808
void transformRotation(const double angle_)
Definition: Image.cpp:1631
void artifact(const std::string &name_, const std::string &value_)
Definition: Image.cpp:1955
double textKerning(void) const
Definition: Image.cpp:1604
double colorFuzz(void) const
Definition: Image.cpp:532
void transverse(void)
Definition: Image.cpp:4759
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:2154
MagickPPExport const char * frameGeometryDefault
Definition: Image.cpp:33
const MagickCore::QuantizeInfo * constQuantizeInfo(void) const
Definition: Image.cpp:5043
void draw(const Drawable &drawable_)
Definition: Image.cpp:2785
void randomThreshold(const double low_, const double high_)
Definition: Image.cpp:4004
MagickPPExport void throwExceptionExplicit(const MagickCore::ExceptionType severity_, const char *reason_, const char *description_=(char *) NULL)
Definition: Exception.cpp:806
void evaluate(const ChannelType channel_, const MagickEvaluateOperator operator_, double rvalue_)
Definition: Image.cpp:2891
void rotationalBlur(const double angle_)
Definition: Image.cpp:4220
ColorspaceType colorSpaceType(void) const
Definition: Image.cpp:583
Geometry boundingBox(void) const
Definition: Image.cpp:444
void implode(const double factor_)
Definition: Image.cpp:3356
void addNoiseChannel(const ChannelType channel_, const NoiseType noiseType_, const double attenuate_=1.0)
Definition: Image.cpp:1794
Color strokeColor(void) const
Definition: Image.cpp:1401
double normalizedMeanError(void) const
Definition: Image.cpp:1217
#define ClonePPDrawException(wand)
Definition: Include.h:1552
void masklightColor(const Color color_)
Definition: Image.cpp:1155
void chromaBluePrimary(const double x_, const double y_, const double z_)
Definition: Image.cpp:2226
void clamp(void)
Definition: Image.cpp:2290
const double * strokeDashArray(void) const
Definition: Image.cpp:1412
void levelize(const double blackPoint_, const double whitePoint_, const double gamma_=1.0)
Definition: Image.cpp:3467
void adaptiveSharpenChannel(const ChannelType channel_, const double radius_=0.0, const double sigma_=1.0)
Definition: Image.cpp:1755
void wave(const double amplitude_=25.0, const double wavelength_=150.0)
Definition: Image.cpp:4836
double gamma(void) const
Definition: Image.cpp:945
void threshold(const double threshold_)
Definition: Image.cpp:4634
void convolve(const size_t order_, const double *kernel_)
Definition: Image.cpp:2612
void roll(const Geometry &roll_)
Definition: Image.cpp:4186
void rx(const double rx_)
Definition: Drawable.h:260
double yResolution(void) const
Definition: Image.cpp:1706
void strip(void)
Definition: Image.cpp:4577
void gaussianBlurChannel(const ChannelType channel_, const double radius_, const double sigma_)
Definition: Image.cpp:3248
void thumbnail(const Geometry &geometry_)
Definition: Image.cpp:4642
void alphaChannel(AlphaChannelOption alphaOption_)
Definition: Image.cpp:1837
CompositeOperator compose(void) const
Definition: Image.cpp:623
bool blackPointCompensation(void) const
Definition: Image.cpp:422
void adaptiveBlur(const double radius_=0.0, const double sigma_=1.0)
Definition: Image.cpp:1711
void display(void)
Definition: Image.cpp:2765
void ping(const std::string &imageSpec_)
Definition: Image.cpp:3843
void selectiveBlur(const double radius_, const double sigma_, const double threshold_)
Definition: Image.cpp:4301
void autoOrient(void)
Definition: Image.cpp:2041
void transparent(const Color &color_, const bool inverse_=false)
Definition: Image.cpp:4697
void inverseFourierTransform(const Image &phase_)
Definition: Image.cpp:3368
void colorize(const unsigned int alpha_, const Color &penColor_)
Definition: Image.cpp:2345
double x(void) const
Definition: Geometry.cpp:701
DirectionType textDirection() const
Definition: Image.cpp:1549
#define GetAndSetPPChannelMask(channel)
Definition: Include.h:1548
void cdl(const std::string &cdl_)
Definition: Image.cpp:2168
Geometry geometry(void) const
Definition: Image.cpp:950
size_t animationIterations(void) const
Definition: Image.cpp:369
void distort(const DistortMethod method_, const size_t numberArguments_, const double *arguments_, const bool bestfit_=false)
Definition: Image.cpp:2772
void isValid(const bool isValid_)
Definition: Image.cpp:1074
void border(const Geometry &geometry_=borderGeometryDefault)
Definition: Image.cpp:2119
void addNoise(const NoiseType noiseType_, const double attenuate_=1.0)
Definition: Image.cpp:1783
Color backgroundColor(void) const
Definition: Image.cpp:386
void sample(const Geometry &geometry_)
Definition: Image.cpp:4245
void clut(const Image &clutImage_, const PixelInterpolateMethod method)
Definition: Image.cpp:2325
void affineTransform(const DrawableAffine &affine)
Definition: Image.cpp:1808
double normalizedMaxError(void) const
Definition: Image.cpp:1212
size_t rows(void) const
Definition: Image.cpp:1350
void isValid(const bool valid_)
Definition: Color.cpp:301
size_t columns(void) const
Definition: Image.cpp:588
Magick::ImagePerceptualHash perceptualHash() const
Definition: Image.cpp:3838
void attribute(const std::string name_, const char *value_)
Definition: Image.cpp:1972
void houghLine(const size_t width_, const size_t height_, const size_t threshold_=40)
Definition: Image.cpp:3332
void levelizeChannel(const ChannelType channel_, const double blackPoint_, const double whitePoint_, const double gamma_=1.0)
Definition: Image.cpp:3476
Color fillColor(void) const
Definition: Image.cpp:790
Geometry montageGeometry(void) const
Definition: Image.cpp:1200
void sketch(const double radius_=0.0, const double sigma_=1.0, const double angle_=0.0)
Definition: Image.cpp:4474
double y(void) const
Definition: Geometry.cpp:706
const void * data(void) const
Definition: Blob.cpp:103
Image fillPattern(void) const
Definition: Image.cpp:815
std::string formatExpression(const std::string expression)
Definition: Image.cpp:924
LineJoin strokeLineJoin(void) const
Definition: Image.cpp:1445
void blueShift(const double factor_=1.5)
Definition: Image.cpp:2083
static ImageRef * replaceImage(ImageRef *imgRef, MagickCore::Image *replacement_)
Definition: ImageRef.cpp:100
void ry(const double ry_)
Definition: Drawable.h:269
void chromaRedPrimary(const double x_, const double y_, const double z_)
Definition: Image.cpp:2258
size_t baseColumns(void) const
Definition: Image.cpp:402
double textInterwordSpacing(void) const
Definition: Image.cpp:1593
MagickPPExport int operator>(const Magick::Color &left_, const Magick::Color &right_)
Definition: Color.cpp:42
void transpose(void)
Definition: Image.cpp:4748
MagickPPExport int operator==(const Magick::Color &left_, const Magick::Color &right_)
Definition: Color.cpp:20
bool quiet(void) const
Definition: Image.cpp:1320
ResolutionType resolutionUnits(void) const
Definition: Image.cpp:1345
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:4370
class MagickPPExport Image
Definition: Drawable.h:720
void chromaWhitePoint(const double x_, const double y_, const double z_)
Definition: Image.cpp:2274
void autoLevelChannel(const ChannelType channel_)
Definition: Image.cpp:2031
void negateChannel(const ChannelType channel_, const bool grayscale_=false)
Definition: Image.cpp:3737
std::string x11Display(void) const
Definition: Image.cpp:1696
size_t fontWeight(void) const
Definition: Image.cpp:900
void repage()
Definition: Image.cpp:4139
double textInterlineSpacing(void) const
Definition: Image.cpp:1582
GravityType textGravity() const
Definition: Image.cpp:1571
void brightnessContrast(const double brightness_=0.0, const double contrast_=0.0)
Definition: Image.cpp:2134
MagickCore::QuantizeInfo * quantizeInfo(void)
Definition: Image.cpp:5038
size_t length(void) const
Definition: Blob.cpp:108
void floodFillColor(const Geometry &point_, const Color &fillColor_, const bool invert_=false)
Definition: Image.cpp:3031
void flop(void)
Definition: Image.cpp:3107
ClassType classType(void) const
Definition: Image.cpp:520
void levelChannel(const ChannelType channel_, const double blackPoint_, const double whitePoint_, const double gamma_=1.0)
Definition: Image.cpp:3420
void despeckle(void)
Definition: Image.cpp:2754
void sigmoidalContrast(const bool sharpen_, const double contrast, const double midpoint=QuantumRange/2.0)
Definition: Image.cpp:4459
void channel(const ChannelType channel_)
Definition: Image.cpp:2176
void strokePattern(const Image &strokePattern_)
Definition: Image.cpp:1461
void normalize(void)
Definition: Image.cpp:3748
void * getMetacontent(void)
Definition: Image.cpp:3288
void options(Options *options_)
Definition: ImageRef.cpp:89
void charcoalChannel(const ChannelType channel_, const double radius_=0.0, const double sigma_=1.0)
Definition: Image.cpp:2198
#define GetPPException
Definition: Include.h:1544
bool hasChannel(const PixelChannel channel) const
Definition: Image.cpp:974
void deskew(const double threshold_)
Definition: Image.cpp:2743
size_t baseRows(void) const
Definition: Image.cpp:412
void fontTypeMetrics(const std::string &text_, TypeMetric *metrics)
Definition: Image.cpp:3118
void transformOrigin(const double x_, const double y_)
Definition: Image.cpp:4679
void opaque(const Color &opaqueColor_, const Color &penColor_, const bool invert_=false)
Definition: Image.cpp:3767
void colorMap(const size_t index_, const Color &color_)
Definition: Image.cpp:2377
double strokeWidth(void) const
Definition: Image.cpp:1505
void isValid(bool isValid_)
Definition: Geometry.cpp:367
void copyPixels(const Image &source_, const Geometry &geometry_, const Offset &offset_)
Definition: Image.cpp:2639
ColorspaceType quantizeColorSpace(void) const
Definition: Image.cpp:1276
void autoGamma(void)
Definition: Image.cpp:2003
size_t channels() const
Definition: Image.cpp:490
bool monochrome(void) const
Definition: Image.cpp:1195
void cycleColormap(const ::ssize_t amount_)
Definition: Image.cpp:2668
void level(const double blackPoint_, const double whitePoint_, const double gamma_=1.0)
Definition: Image.cpp:3411
Options * options(void)
Definition: Image.cpp:5028
void modifyImage(void)
Definition: Image.cpp:5048
bool strokeAntiAlias(void) const
Definition: Image.cpp:1385
bool compare(const Image &reference_) const
Definition: Image.cpp:2446
void autoLevel(void)
Definition: Image.cpp:2023
void contrastStretch(const double blackPoint_, const double whitePoint_)
Definition: Image.cpp:2592
void selectiveBlurChannel(const ChannelType channel_, const double radius_, const double sigma_, const double threshold_)
Definition: Image.cpp:4314
void levelColorsChannel(const ChannelType channel_, const Color &blackColor_, const Color &whiteColor_, const bool invert_=true)
Definition: Image.cpp:3448
Color boxColor(void) const
Definition: Image.cpp:461
void haldClut(const Image &clutImage_)
Definition: Image.cpp:3324
void transformSkewY(const double skewy_)
Definition: Image.cpp:1643
void shear(const double xShearAngle_, const double yShearAngle_)
Definition: Image.cpp:4448
#define SetPPChannelMask(channel)
Definition: Include.h:1558
DisposeType gifDisposeMethod(void) const
Definition: Image.cpp:969
Geometry size(void) const
Definition: Image.cpp:1374
void transformReset(void)
Definition: Image.cpp:4685
void rotate(const double degrees_)
Definition: Image.cpp:4209
void map(const Image &mapImage_, const bool dither_=false)
Definition: Image.cpp:3554
void lowlightColor(const Color color_)
Definition: Image.cpp:1120