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