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