From: dirk Date: Fri, 9 Jan 2015 23:20:02 +0000 (+0000) Subject: Added new quiet method to the Image class of Magick++ to prevent throwing of warning... X-Git-Tag: 7.0.1-0~1466 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=77328896b876314656427663695bc7b2c9be3f74;p=imagemagick Added new quiet method to the Image class of Magick++ to prevent throwing of warning exceptions. --- diff --git a/Magick++/lib/BlobRef.cpp b/Magick++/lib/BlobRef.cpp index a0408b506..e217cf05a 100644 --- a/Magick++/lib/BlobRef.cpp +++ b/Magick++/lib/BlobRef.cpp @@ -1,7 +1,7 @@ // This may look like C code, but it is really -*- C++ -*- // // Copyright Bob Friesenhahn, 1999, 2000, 2001, 2002, 2004 -// Copyright Dirk Lemstra 2014 +// Copyright Dirk Lemstra 2014-2015 // // Implementation of Blob // @@ -50,7 +50,8 @@ size_t Magick::BlobRef::decrease() if (_refCount == 0) { _mutexLock.unlock(); - throwExceptionExplicit(OptionError,"Invalid call to decrease"); + throwExceptionExplicit(MagickCore::OptionError, + "Invalid call to decrease"); } count=--_refCount; _mutexLock.unlock(); diff --git a/Magick++/lib/CoderInfo.cpp b/Magick++/lib/CoderInfo.cpp index b6a44edf6..4a00b3452 100644 --- a/Magick++/lib/CoderInfo.cpp +++ b/Magick++/lib/CoderInfo.cpp @@ -51,9 +51,10 @@ Magick::CoderInfo::CoderInfo(const std::string &name_) GetPPException; magickInfo=GetMagickInfo(name_.c_str(),exceptionInfo); - ThrowPPException; + ThrowPPException(false); if (magickInfo == 0) - throwExceptionExplicit(OptionError,"Coder not found",name_.c_str()); + throwExceptionExplicit(MagickCore::OptionError,"Coder not found", + name_.c_str()); else { _description=string(magickInfo->description); diff --git a/Magick++/lib/Color.cpp b/Magick++/lib/Color.cpp index f94ff101e..b883a51fb 100644 --- a/Magick++/lib/Color.cpp +++ b/Magick++/lib/Color.cpp @@ -1,7 +1,7 @@ // This may look like C code, but it is really -*- C++ -*- // // Copyright Bob Friesenhahn, 1999, 2000, 2001, 2002, 2003 -// Copyright Dirk Lemstra 2013-2014 +// Copyright Dirk Lemstra 2013-2015 // // Color Implementation // @@ -228,7 +228,7 @@ const Magick::Color& Magick::Color::operator=(const std::string &color_) } else _isValid = false; - ThrowPPException; + ThrowPPException(true); return(*this); } diff --git a/Magick++/lib/Exception.cpp b/Magick++/lib/Exception.cpp index cf08f7fae..438c58459 100644 --- a/Magick++/lib/Exception.cpp +++ b/Magick++/lib/Exception.cpp @@ -1,7 +1,7 @@ // This may look like C code, but it is really -*- C++ -*- // // Copyright Bob Friesenhahn, 1999, 2000, 2001, 2002, 2003 -// Copyright Dirk Lemstra 2014 +// Copyright Dirk Lemstra 2014-2015 // // Implementation of Exception and derived classes // @@ -703,120 +703,122 @@ Magick::Exception* Magick::createException(const MagickCore::ExceptionInfo *exce std::string message=formatExceptionMessage(exception_); switch (exception_->severity) { - case BlobError: - case BlobFatalError: + case MagickCore::BlobError: + case MagickCore::BlobFatalError: return new ErrorBlob(message); - case BlobWarning: + case MagickCore::BlobWarning: return new WarningBlob(message); - case CacheError: - case CacheFatalError: + case MagickCore::CacheError: + case MagickCore::CacheFatalError: return new ErrorCache(message); - case CacheWarning: + case MagickCore::CacheWarning: return new WarningCache(message); - case CoderError: - case CoderFatalError: + case MagickCore::CoderError: + case MagickCore::CoderFatalError: return new ErrorCoder(message); - case CoderWarning: + case MagickCore::CoderWarning: return new WarningCoder(message); - case ConfigureError: - case ConfigureFatalError: + case MagickCore::ConfigureError: + case MagickCore::ConfigureFatalError: return new ErrorConfigure(message); - case ConfigureWarning: + case MagickCore::ConfigureWarning: return new WarningConfigure(message); - case CorruptImageError: - case CorruptImageFatalError: + case MagickCore::CorruptImageError: + case MagickCore::CorruptImageFatalError: return new ErrorCorruptImage(message); - case CorruptImageWarning: + case MagickCore::CorruptImageWarning: return new WarningCorruptImage(message); - case DelegateError: - case DelegateFatalError: + case MagickCore::DelegateError: + case MagickCore::DelegateFatalError: return new ErrorDelegate(message); - case DelegateWarning: + case MagickCore::DelegateWarning: return new WarningDelegate(message); - case DrawError: - case DrawFatalError: + case MagickCore::DrawError: + case MagickCore::DrawFatalError: return new ErrorDraw(message); - case DrawWarning: + case MagickCore::DrawWarning: return new WarningDraw(message); - case FileOpenError: - case FileOpenFatalError: + case MagickCore::FileOpenError: + case MagickCore::FileOpenFatalError: return new ErrorFileOpen(message); - case FileOpenWarning: + case MagickCore::FileOpenWarning: return new WarningFileOpen(message); - case ImageError: - case ImageFatalError: + case MagickCore::ImageError: + case MagickCore::ImageFatalError: return new ErrorImage(message); - case ImageWarning: + case MagickCore::ImageWarning: return new WarningImage(message); - case MissingDelegateError: - case MissingDelegateFatalError: + case MagickCore::MissingDelegateError: + case MagickCore::MissingDelegateFatalError: return new ErrorMissingDelegate(message); - case MissingDelegateWarning: + case MagickCore::MissingDelegateWarning: return new WarningMissingDelegate(message); - case ModuleError: - case ModuleFatalError: + case MagickCore::ModuleError: + case MagickCore::ModuleFatalError: return new ErrorModule(message); - case ModuleWarning: + case MagickCore::ModuleWarning: return new WarningModule(message); - case MonitorError: - case MonitorFatalError: + case MagickCore::MonitorError: + case MagickCore::MonitorFatalError: return new ErrorMonitor(message); - case MonitorWarning: + case MagickCore::MonitorWarning: return new WarningMonitor(message); - case OptionError: - case OptionFatalError: + case MagickCore::OptionError: + case MagickCore::OptionFatalError: return new ErrorOption(message); - case OptionWarning: + case MagickCore::OptionWarning: return new WarningOption(message); - case PolicyWarning: + case MagickCore::PolicyWarning: return new WarningPolicy(message); - case PolicyError: - case PolicyFatalError: + case MagickCore::PolicyError: + case MagickCore::PolicyFatalError: return new ErrorPolicy(message); - case RegistryError: - case RegistryFatalError: + case MagickCore::RegistryError: + case MagickCore::RegistryFatalError: return new ErrorRegistry(message); - case RegistryWarning: + case MagickCore::RegistryWarning: return new WarningRegistry(message); - case ResourceLimitError: - case ResourceLimitFatalError: + case MagickCore::ResourceLimitError: + case MagickCore::ResourceLimitFatalError: return new ErrorResourceLimit(message); - case ResourceLimitWarning: + case MagickCore::ResourceLimitWarning: return new WarningResourceLimit(message); - case StreamError: - case StreamFatalError: + case MagickCore::StreamError: + case MagickCore::StreamFatalError: return new ErrorStream(message); - case StreamWarning: + case MagickCore::StreamWarning: return new WarningStream(message); - case TypeError: - case TypeFatalError: + case MagickCore::TypeError: + case MagickCore::TypeFatalError: return new ErrorType(message); - case TypeWarning: + case MagickCore::TypeWarning: return new WarningType(message); - case UndefinedException: + case MagickCore::UndefinedException: default: return new ErrorUndefined(message); - case XServerError: - case XServerFatalError: + case MagickCore::XServerError: + case MagickCore::XServerFatalError: return new ErrorXServer(message); - case XServerWarning: + case MagickCore::XServerWarning: return new WarningXServer(message); } } MagickPPExport void Magick::throwExceptionExplicit( - const ExceptionType severity_,const char* reason_,const char* description_) + const MagickCore::ExceptionType severity_,const char* reason_, + const char* description_) { // Just return if there is no reported error - if (severity_ == UndefinedException) + if (severity_ == MagickCore::UndefinedException) return; GetPPException; - ThrowException(exceptionInfo,severity_,reason_, description_); - ThrowPPException; + ThrowException(exceptionInfo,severity_,reason_,description_); + ThrowPPException(false); } -MagickPPExport void Magick::throwException(ExceptionInfo *exception_) +MagickPPExport void Magick::throwException(ExceptionInfo *exception_, + const bool quiet_) { const ExceptionInfo *p; @@ -825,17 +827,20 @@ MagickPPExport void Magick::throwException(ExceptionInfo *exception_) *nestedException, *q; - ExceptionType + MagickCore::ExceptionType severity; size_t index; + std::string + message; + // Just return if there is no reported error - if (exception_->severity == UndefinedException) + if (exception_->severity == MagickCore::UndefinedException) return; - std::string message=formatExceptionMessage(exception_); + message=formatExceptionMessage(exception_); nestedException=(Exception *) NULL; LockSemaphoreInfo(exception_->semaphore); if (exception_->exceptions != (void *) NULL) @@ -863,107 +868,114 @@ MagickPPExport void Magick::throwException(ExceptionInfo *exception_) } UnlockSemaphoreInfo(exception_->semaphore); severity=exception_->severity; + + if ((quiet_) && (severity < MagickCore::ErrorException)) + { + delete nestedException; + return; + } + DestroyExceptionInfo(exception_); switch (severity) { - case BlobError: - case BlobFatalError: + case MagickCore::BlobError: + case MagickCore::BlobFatalError: throw ErrorBlob(message,nestedException); - case BlobWarning: + case MagickCore::BlobWarning: throw WarningBlob(message,nestedException); - case CacheError: - case CacheFatalError: + case MagickCore::CacheError: + case MagickCore::CacheFatalError: throw ErrorCache(message,nestedException); - case CacheWarning: + case MagickCore::CacheWarning: throw WarningCache(message,nestedException); - case CoderError: - case CoderFatalError: + case MagickCore::CoderError: + case MagickCore::CoderFatalError: throw ErrorCoder(message,nestedException); - case CoderWarning: + case MagickCore::CoderWarning: throw WarningCoder(message,nestedException); - case ConfigureError: - case ConfigureFatalError: + case MagickCore::ConfigureError: + case MagickCore::ConfigureFatalError: throw ErrorConfigure(message,nestedException); - case ConfigureWarning: + case MagickCore::ConfigureWarning: throw WarningConfigure(message,nestedException); - case CorruptImageError: - case CorruptImageFatalError: + case MagickCore::CorruptImageError: + case MagickCore::CorruptImageFatalError: throw ErrorCorruptImage(message,nestedException); - case CorruptImageWarning: + case MagickCore::CorruptImageWarning: throw WarningCorruptImage(message,nestedException); - case DelegateError: - case DelegateFatalError: + case MagickCore::DelegateError: + case MagickCore::DelegateFatalError: throw ErrorDelegate(message,nestedException); - case DelegateWarning: + case MagickCore::DelegateWarning: throw WarningDelegate(message,nestedException); - case DrawError: - case DrawFatalError: + case MagickCore::DrawError: + case MagickCore::DrawFatalError: throw ErrorDraw(message,nestedException); - case DrawWarning: + case MagickCore::DrawWarning: throw WarningDraw(message,nestedException); - case FileOpenError: - case FileOpenFatalError: + case MagickCore::FileOpenError: + case MagickCore::FileOpenFatalError: throw ErrorFileOpen(message,nestedException); - case FileOpenWarning: + case MagickCore::FileOpenWarning: throw WarningFileOpen(message,nestedException); - case ImageError: - case ImageFatalError: + case MagickCore::ImageError: + case MagickCore::ImageFatalError: throw ErrorImage(message,nestedException); - case ImageWarning: + case MagickCore::ImageWarning: throw WarningImage(message,nestedException); - case MissingDelegateError: - case MissingDelegateFatalError: + case MagickCore::MissingDelegateError: + case MagickCore::MissingDelegateFatalError: throw ErrorMissingDelegate(message,nestedException); - case MissingDelegateWarning: + case MagickCore::MissingDelegateWarning: throw WarningMissingDelegate(message,nestedException); - case ModuleError: - case ModuleFatalError: + case MagickCore::ModuleError: + case MagickCore::ModuleFatalError: throw ErrorModule(message,nestedException); - case ModuleWarning: + case MagickCore::ModuleWarning: throw WarningModule(message,nestedException); - case MonitorError: - case MonitorFatalError: + case MagickCore::MonitorError: + case MagickCore::MonitorFatalError: throw ErrorMonitor(message,nestedException); - case MonitorWarning: + case MagickCore::MonitorWarning: throw WarningMonitor(message,nestedException); - case OptionError: - case OptionFatalError: + case MagickCore::OptionError: + case MagickCore::OptionFatalError: throw ErrorOption(message,nestedException); - case OptionWarning: + case MagickCore::OptionWarning: throw WarningOption(message,nestedException); - case PolicyWarning: + case MagickCore::PolicyWarning: throw WarningPolicy(message,nestedException); - case PolicyError: - case PolicyFatalError: + case MagickCore::PolicyError: + case MagickCore::PolicyFatalError: throw ErrorPolicy(message,nestedException); - case RegistryError: - case RegistryFatalError: + case MagickCore::RegistryError: + case MagickCore::RegistryFatalError: throw ErrorRegistry(message,nestedException); - case RegistryWarning: + case MagickCore::RegistryWarning: throw WarningRegistry(message,nestedException); - case ResourceLimitError: - case ResourceLimitFatalError: + case MagickCore::ResourceLimitError: + case MagickCore::ResourceLimitFatalError: throw ErrorResourceLimit(message,nestedException); - case ResourceLimitWarning: + case MagickCore::ResourceLimitWarning: throw WarningResourceLimit(message,nestedException); - case StreamError: - case StreamFatalError: + case MagickCore::StreamError: + case MagickCore::StreamFatalError: throw ErrorStream(message,nestedException); - case StreamWarning: + case MagickCore::StreamWarning: throw WarningStream(message,nestedException); - case TypeError: - case TypeFatalError: + case MagickCore::TypeError: + case MagickCore::TypeFatalError: throw ErrorType(message,nestedException); - case TypeWarning: + case MagickCore::TypeWarning: throw WarningType(message,nestedException); - case UndefinedException: + case MagickCore::UndefinedException: default: throw ErrorUndefined(message,nestedException); - case XServerError: - case XServerFatalError: + case MagickCore::XServerError: + case MagickCore::XServerFatalError: throw ErrorXServer(message,nestedException); - case XServerWarning: + case MagickCore::XServerWarning: throw WarningXServer(message,nestedException); } } \ No newline at end of file diff --git a/Magick++/lib/Functions.cpp b/Magick++/lib/Functions.cpp index d712bf870..87130c89d 100644 --- a/Magick++/lib/Functions.cpp +++ b/Magick++/lib/Functions.cpp @@ -1,7 +1,7 @@ // This may look like C code, but it is really -*- C++ -*- // // Copyright Bob Friesenhahn, 1999, 2002, 2003 -// Copyright Dirk Lemstra 2014 +// Copyright Dirk Lemstra 2014-2015 // // Simple C++ function wrappers for ImageMagick equivalents // @@ -30,7 +30,7 @@ MagickPPExport void Magick::DisableOpenCL(void) GetPPException; MagickCore::InitImageMagickOpenCL(MagickCore::MAGICK_OPENCL_OFF,NULL,NULL, exceptionInfo); - ThrowPPException; + ThrowPPException(false); } MagickPPExport bool Magick::EnableOpenCL(const bool useCache_) @@ -47,7 +47,7 @@ MagickPPExport bool Magick::EnableOpenCL(const bool useCache_) status=MagickCore::InitImageMagickOpenCL( MagickCore::MAGICK_OPENCL_DEVICE_SELECT_AUTO_CLEAR_CACHE,NULL,NULL, exceptionInfo) == MagickTrue; - ThrowPPException; + ThrowPPException(false); return(status); } diff --git a/Magick++/lib/Geometry.cpp b/Magick++/lib/Geometry.cpp index 06f02b335..e10a60f3a 100644 --- a/Magick++/lib/Geometry.cpp +++ b/Magick++/lib/Geometry.cpp @@ -278,7 +278,8 @@ Magick::Geometry::operator std::string() const geometry; if (!isValid()) - throwExceptionExplicit(OptionError,"Invalid geometry argument"); + throwExceptionExplicit(MagickCore::OptionError, + "Invalid geometry argument"); if (_width) { diff --git a/Magick++/lib/Image.cpp b/Magick++/lib/Image.cpp index ceec05d89..7aa178886 100644 --- a/Magick++/lib/Image.cpp +++ b/Magick++/lib/Image.cpp @@ -1,7 +1,7 @@ // This may look like C code, but it is really -*- C++ -*- // // Copyright Bob Friesenhahn, 1999, 2000, 2001, 2002, 2003 -// Copyright Dirk Lemstra 2013-2014 +// Copyright Dirk Lemstra 2013-2015 // // Implementation of Image // @@ -27,6 +27,7 @@ using namespace std; #define AbsoluteValue(x) ((x) < 0 ? -(x) : (x)) #define MagickPI 3.14159265358979323846264338327950288419716939937510 #define DegreesToRadians(x) (MagickPI*(x)/180.0) +#define ThrowImageException ThrowPPException(_quiet) MagickPPExport const char *Magick::borderGeometryDefault="6x6+0+0"; MagickPPExport const char *Magick::frameGeometryDefault="25x25+6+6"; @@ -74,12 +75,14 @@ MagickPPExport int Magick::operator <= (const Magick::Image &left_, } Magick::Image::Image(void) - : _imgRef(new ImageRef) + : _imgRef(new ImageRef), + _quiet(false) { } Magick::Image::Image(const Blob &blob_) - : _imgRef(new ImageRef) + : _imgRef(new ImageRef), + _quiet(false) { try { @@ -99,7 +102,8 @@ Magick::Image::Image(const Blob &blob_) } Magick::Image::Image(const Blob &blob_,const Geometry &size_) - : _imgRef(new ImageRef) + : _imgRef(new ImageRef), + _quiet(false) { try { @@ -120,7 +124,8 @@ Magick::Image::Image(const Blob &blob_,const Geometry &size_) Magick::Image::Image(const Blob &blob_,const Geometry &size_, const size_t depth_) - : _imgRef(new ImageRef) + : _imgRef(new ImageRef), + _quiet(false) { try { @@ -141,7 +146,8 @@ Magick::Image::Image(const Blob &blob_,const Geometry &size_, Magick::Image::Image(const Blob &blob_,const Geometry &size_, const size_t depth_,const std::string &magick_) - : _imgRef(new ImageRef) + : _imgRef(new ImageRef), + _quiet(false) { try { @@ -162,7 +168,8 @@ Magick::Image::Image(const Blob &blob_,const Geometry &size_, Magick::Image::Image(const Blob &blob_,const Geometry &size_, const std::string &magick_) - : _imgRef(new ImageRef) + : _imgRef(new ImageRef), + _quiet(false) { try { @@ -182,7 +189,8 @@ Magick::Image::Image(const Blob &blob_,const Geometry &size_, } Magick::Image::Image(const Geometry &size_,const Color &color_) - : _imgRef(new ImageRef) + : _imgRef(new ImageRef), + _quiet(false) { // xc: prefix specifies an X11 color string std::string imageSpec("xc:"); @@ -209,14 +217,16 @@ Magick::Image::Image(const Geometry &size_,const Color &color_) } Magick::Image::Image(const Image &image_) - : _imgRef(image_._imgRef) + : _imgRef(image_._imgRef), + _quiet(image_._quiet) { _imgRef->increase(); } Magick::Image::Image(const size_t width_,const size_t height_, const std::string &map_,const StorageType type_,const void *pixels_) - : _imgRef(new ImageRef) + : _imgRef(new ImageRef), + _quiet(false) { try { @@ -235,7 +245,8 @@ Magick::Image::Image(const size_t width_,const size_t height_, } Magick::Image::Image(const std::string &imageSpec_) - : _imgRef(new ImageRef) + : _imgRef(new ImageRef), + _quiet(false) { try { @@ -299,7 +310,7 @@ void Magick::Image::alpha(const bool matteFlag_) if ((matteFlag_ && !constImage()->alpha_trait) || (constImage()->alpha_trait && !matteFlag_)) SetImageAlpha(image(),OpaqueAlpha,exceptionInfo); - ThrowPPException; + ThrowImageException; image()->alpha_trait=matteFlag_ ? BlendPixelTrait : UndefinedPixelTrait; } @@ -455,7 +466,7 @@ Magick::Geometry Magick::Image::boundingBox(void) const GetPPException; bbox=GetImageBoundingBox(constImage(),exceptionInfo); - ThrowPPException; + ThrowImageException; return(Geometry(bbox)); } @@ -478,7 +489,7 @@ void Magick::Image::channelDepth(const ChannelType channel_, SetPPChannelMask(channel_); SetImageDepth(image(),depth_,exceptionInfo); RestorePPChannelMask; - ThrowPPException; + ThrowImageException; } size_t Magick::Image::channelDepth(const ChannelType channel_) @@ -490,7 +501,7 @@ size_t Magick::Image::channelDepth(const ChannelType channel_) SetPPChannelMask(channel_); channel_depth=GetImageDepth(constImage(),exceptionInfo); RestorePPChannelMask; - ThrowPPException; + ThrowImageException; return(channel_depth); } @@ -508,7 +519,7 @@ void Magick::Image::classType(const ClassType class_) modifyImage(); GetPPException; SyncImage(image(),exceptionInfo); - ThrowPPException; + ThrowImageException; image()->colormap=(PixelInfo *)RelinquishMagickMemory(image()->colormap); image()->storage_class=static_cast(DirectClass); return; @@ -544,19 +555,20 @@ double Magick::Image::colorFuzz(void) const void Magick::Image::colorMapSize(const size_t entries_) { if (entries_ >MaxColormapSize) - throwExceptionExplicit(OptionError, + throwExceptionExplicit(MagickCore::OptionError, "Colormap entries must not exceed MaxColormapSize"); modifyImage(); GetPPException; (void) AcquireImageColormap(image(),entries_,exceptionInfo); - ThrowPPException; + ThrowImageException; } size_t Magick::Image::colorMapSize(void) const { if (!constImage()->colormap) - throwExceptionExplicit(OptionError,"Image does not contain a colormap"); + throwExceptionExplicit(MagickCore::OptionError, + "Image does not contain a colormap"); return(constImage()->colors); } @@ -569,7 +581,7 @@ void Magick::Image::colorSpace(const ColorspaceType colorSpace_) modifyImage(); GetPPException; TransformImageColorspace(image(),colorSpace_,exceptionInfo); - ThrowPPException; + ThrowImageException; } Magick::ColorspaceType Magick::Image::colorSpace(void) const @@ -582,7 +594,7 @@ void Magick::Image::colorSpaceType(const ColorspaceType colorSpace_) modifyImage(); GetPPException; SetImageColorspace(image(),colorSpace_,exceptionInfo); - ThrowPPException; + ThrowImageException; options()->colorspaceType(colorSpace_); } @@ -603,7 +615,7 @@ void Magick::Image::comment(const std::string &comment_) SetImageProperty(image(),"Comment",NULL,exceptionInfo); if (comment_.length() > 0) SetImageProperty(image(),"Comment",comment_.c_str(),exceptionInfo); - ThrowPPException; + ThrowImageException; } std::string Magick::Image::comment(void) const @@ -613,7 +625,7 @@ std::string Magick::Image::comment(void) const GetPPException; value=GetImageProperty(constImage(),"Comment",exceptionInfo); - ThrowPPException; + ThrowImageException; if (value) return(std::string(value)); @@ -717,8 +729,9 @@ std::string Magick::Image::directory(void) const if (constImage()->directory) return(std::string(constImage()->directory)); - throwExceptionExplicit(CorruptImageWarning, - "Image does not contain a directory"); + if (!_quiet) + throwExceptionExplicit(MagickCore::CorruptImageWarning, + "Image does not contain a directory"); return(std::string()); } @@ -749,7 +762,7 @@ void Magick::Image::exifProfile(const Magick::Blob &exifProfile_) GetPPException; (void) SetImageProfile(image(),"exif",exif_profile,exceptionInfo); exif_profile=DestroyStringInfo(exif_profile); - ThrowPPException; + ThrowImageException; } } @@ -840,7 +853,7 @@ Magick::Image Magick::Image::fillPattern(void) const GetPPException; image=CloneImage(tmpTexture,0,0,MagickTrue,exceptionInfo); texture.replaceImage(image); - ThrowPPException; + ThrowImageException; } return(texture); } @@ -885,12 +898,15 @@ std::string Magick::Image::format(void) const GetPPException; magick_info=GetMagickInfo(constImage()->magick,exceptionInfo); - ThrowPPException; + ThrowImageException; if ((magick_info != 0) && (*magick_info->description != '\0')) return(std::string(magick_info->description)); - throwExceptionExplicit(CorruptImageWarning,"Unrecognized image magick type"); + if (!_quiet) + throwExceptionExplicit(MagickCore::CorruptImageWarning, + "Unrecognized image magick type"); + return(std::string()); } @@ -911,7 +927,7 @@ std::string Magick::Image::formatExpression(const std::string expression) text_string=std::string(text); text=DestroyString(text); } - ThrowPPException; + ThrowImageException; return(text_string); } @@ -925,7 +941,9 @@ Magick::Geometry Magick::Image::geometry(void) const if (constImage()->geometry) return Geometry(constImage()->geometry); - throwExceptionExplicit(OptionWarning,"Image does not contain a geometry"); + if (!_quiet) + throwExceptionExplicit(MagickCore::OptionWarning, + "Image does not contain a geometry"); return(Geometry()); } @@ -1004,7 +1022,7 @@ void Magick::Image::iptcProfile(const Magick::Blob &iptcProfile_) GetPPException; (void) SetImageProfile(image(),"iptc",iptc_profile,exceptionInfo); iptc_profile=DestroyStringInfo(iptc_profile); - ThrowPPException; + ThrowImageException; } } @@ -1048,7 +1066,7 @@ void Magick::Image::label(const std::string &label_) (void) SetImageProperty(image(),"Label",NULL,exceptionInfo); if (label_.length() > 0) (void) SetImageProperty(image(),"Label",label_.c_str(),exceptionInfo); - ThrowPPException; + ThrowImageException; } std::string Magick::Image::label(void) const @@ -1058,7 +1076,7 @@ std::string Magick::Image::label(void) const GetPPException; value=GetImageProperty(constImage(),"Label",exceptionInfo); - ThrowPPException; + ThrowImageException; if (value) return(std::string(value)); @@ -1084,7 +1102,7 @@ void Magick::Image::mask(const Magick::Image &mask_) SetImageMask(image(),mask_.constImage(),exceptionInfo); else SetImageMask(image(),(MagickCore::Image *) NULL,exceptionInfo); - ThrowPPException; + ThrowImageException; } Magick::Image Magick::Image::mask(void) const @@ -1094,7 +1112,7 @@ Magick::Image Magick::Image::mask(void) const GetPPException; image=GetImageMask(constImage(),exceptionInfo); - ThrowPPException; + ThrowImageException; if (image == (MagickCore::Image *) NULL) return(Magick::Image()); @@ -1130,7 +1148,7 @@ void Magick::Image::modulusDepth(const size_t depth_) modifyImage(); GetPPException; SetImageDepth(image(),depth_,exceptionInfo); - ThrowPPException; + ThrowImageException; options()->depth(depth_); } @@ -1141,7 +1159,7 @@ size_t Magick::Image::modulusDepth(void) const GetPPException; depth=GetImageDepth(constImage(),exceptionInfo); - ThrowPPException; + ThrowImageException; return(depth); } @@ -1161,7 +1179,8 @@ Magick::Geometry Magick::Image::montageGeometry(void) const if (constImage()->montage) return Magick::Geometry(constImage()->montage); - throwExceptionExplicit(CorruptImageWarning, + if (!_quiet) + throwExceptionExplicit(MagickCore::CorruptImageWarning, "Image does not contain a montage"); return(Magick::Geometry()); @@ -1269,6 +1288,16 @@ size_t Magick::Image::quantizeTreeDepth() const return(constOptions()->quantizeTreeDepth()); } +void Magick::Image::quiet(const bool quiet_) +{ + _quiet=quiet_; +} + +bool Magick::Image::quiet(void) const +{ + return(_quiet); +} + void Magick::Image::renderingIntent( const Magick::RenderingIntent renderingIntent_) { @@ -1433,7 +1462,7 @@ Magick::Image Magick::Image::strokePattern(void) const GetPPException; image=CloneImage(tmpTexture,0,0,MagickTrue,exceptionInfo); texture.replaceImage(image); - ThrowPPException; + ThrowImageException; } return(texture); } @@ -1549,7 +1578,7 @@ size_t Magick::Image::totalColors(void) const GetPPException; colors=GetNumberColors(constImage(),0,exceptionInfo); - ThrowPPException; + ThrowImageException; return colors; } @@ -1587,7 +1616,7 @@ void Magick::Image::type(const Magick::ImageType type_) options()->type(type_); GetPPException; SetImageType(image(),type_,exceptionInfo); - ThrowPPException; + ThrowImageException; } void Magick::Image::verbose(const bool verboseFlag_) @@ -1618,7 +1647,7 @@ void Magick::Image::virtualPixelMethod( modifyImage(); GetPPException; SetImageVirtualPixelMethod(image(),virtualPixelMethod_,exceptionInfo); - ThrowPPException; + ThrowImageException; } Magick::VirtualPixelMethod Magick::Image::virtualPixelMethod(void) const @@ -1655,7 +1684,7 @@ void Magick::Image::adaptiveBlur(const double radius_,const double sigma_) GetPPException; newImage=AdaptiveBlurImage(constImage(),radius_,sigma_,exceptionInfo); replaceImage(newImage); - ThrowPPException; + ThrowImageException; } void Magick::Image::adaptiveResize(const Geometry &geometry_) @@ -1677,7 +1706,7 @@ void Magick::Image::adaptiveResize(const Geometry &geometry_) GetPPException; newImage=AdaptiveResizeImage(constImage(),width,height,exceptionInfo); replaceImage(newImage); - ThrowPPException; + ThrowImageException; } void Magick::Image::adaptiveSharpen(const double radius_,const double sigma_) @@ -1688,7 +1717,7 @@ void Magick::Image::adaptiveSharpen(const double radius_,const double sigma_) GetPPException; newImage=AdaptiveSharpenImage(constImage(),radius_,sigma_,exceptionInfo); replaceImage(newImage); - ThrowPPException; + ThrowImageException; } void Magick::Image::adaptiveSharpenChannel(const ChannelType channel_, @@ -1702,7 +1731,7 @@ void Magick::Image::adaptiveSharpenChannel(const ChannelType channel_, newImage=AdaptiveSharpenImage(constImage(),radius_,sigma_,exceptionInfo); RestorePPChannelMask; replaceImage(newImage); - ThrowPPException; + ThrowImageException; } void Magick::Image::adaptiveThreshold(const size_t width_,const size_t height_, @@ -1716,7 +1745,7 @@ void Magick::Image::adaptiveThreshold(const size_t width_,const size_t height_, newImage=AdaptiveThresholdImage(constImage(),width_,height_,bias_, exceptionInfo); replaceImage(newImage); - ThrowPPException; + ThrowImageException; } void Magick::Image::addNoise(const NoiseType noiseType_) @@ -1727,7 +1756,7 @@ void Magick::Image::addNoise(const NoiseType noiseType_) GetPPException; newImage=AddNoiseImage(constImage(),noiseType_,1.0,exceptionInfo); replaceImage(newImage); - ThrowPPException; + ThrowImageException; } void Magick::Image::addNoiseChannel(const ChannelType channel_, @@ -1741,7 +1770,7 @@ void Magick::Image::addNoiseChannel(const ChannelType channel_, newImage=AddNoiseImage(constImage(),noiseType_,1.0,exceptionInfo); RestorePPChannelMask; replaceImage(newImage); - ThrowPPException; + ThrowImageException; } void Magick::Image::affineTransform(const DrawableAffine &affine_) @@ -1762,7 +1791,7 @@ void Magick::Image::affineTransform(const DrawableAffine &affine_) GetPPException; newImage=AffineTransformImage(constImage(),&_affine,exceptionInfo); replaceImage(newImage); - ThrowPPException; + ThrowImageException; } void Magick::Image::alpha(const unsigned int alpha_) @@ -1770,7 +1799,7 @@ void Magick::Image::alpha(const unsigned int alpha_) modifyImage(); GetPPException; SetImageAlpha(image(),alpha_,exceptionInfo); - ThrowPPException; + ThrowImageException; } void Magick::Image::alphaChannel(AlphaChannelOption alphaOption_) @@ -1778,7 +1807,7 @@ void Magick::Image::alphaChannel(AlphaChannelOption alphaOption_) modifyImage(); GetPPException; SetImageAlphaChannel(image(),alphaOption_,exceptionInfo); - ThrowPPException; + ThrowImageException; } void Magick::Image::annotate(const std::string &text_, @@ -1865,7 +1894,7 @@ void Magick::Image::annotate(const std::string &text_, drawInfo->text=0; drawInfo->geometry=0; - ThrowPPException; + ThrowImageException; } void Magick::Image::annotate(const std::string &text_, @@ -1886,7 +1915,7 @@ void Magick::Image::annotate(const std::string &text_, drawInfo->gravity=NorthWestGravity; drawInfo->text=0; - ThrowPPException; + ThrowImageException; } void Magick::Image::artifact(const std::string &name_,const std::string &value_) @@ -1911,7 +1940,7 @@ void Magick::Image::attribute(const std::string name_,const std::string value_) modifyImage(); GetPPException; SetImageProperty(image(),name_.c_str(),value_.c_str(),exceptionInfo); - ThrowPPException; + ThrowImageException; } std::string Magick::Image::attribute(const std::string name_) @@ -1921,7 +1950,7 @@ std::string Magick::Image::attribute(const std::string name_) GetPPException; value=GetImageProperty(constImage(),name_.c_str(),exceptionInfo); - ThrowPPException; + ThrowImageException; if (value) return(std::string(value)); @@ -1935,7 +1964,7 @@ void Magick::Image::autoGamma(void) GetPPException; (void) SyncImageSettings(imageInfo(),image(),exceptionInfo); (void) AutoGammaImage(image(),exceptionInfo); - ThrowPPException; + ThrowImageException; } void Magick::Image::autoGammaChannel(const ChannelType channel_) @@ -1946,7 +1975,7 @@ void Magick::Image::autoGammaChannel(const ChannelType channel_) (void) SyncImageSettings(imageInfo(),image(),exceptionInfo); (void) AutoGammaImage(image(),exceptionInfo); RestorePPChannelMask; - ThrowPPException; + ThrowImageException; } void Magick::Image::autoLevel(void) @@ -1955,7 +1984,7 @@ void Magick::Image::autoLevel(void) GetPPException; (void) SyncImageSettings(imageInfo(),image(),exceptionInfo); (void) AutoLevelImage(image(),exceptionInfo); - ThrowPPException; + ThrowImageException; } void Magick::Image::autoLevelChannel(const ChannelType channel_) @@ -1966,7 +1995,7 @@ void Magick::Image::autoLevelChannel(const ChannelType channel_) (void) SyncImageSettings(imageInfo(),image(),exceptionInfo); (void) AutoLevelImage(image(),exceptionInfo); RestorePPChannelMask; - ThrowPPException; + ThrowImageException; } void Magick::Image::autoOrient(void) @@ -1982,7 +2011,7 @@ void Magick::Image::autoOrient(void) (void) SyncImageSettings(imageInfo(),image(),exceptionInfo); newImage=AutoOrientImage(constImage(),image()->orientation,exceptionInfo); replaceImage(newImage); - ThrowPPException; + ThrowImageException; } void Magick::Image::blackThreshold(const std::string &threshold_) @@ -1990,7 +2019,7 @@ void Magick::Image::blackThreshold(const std::string &threshold_) modifyImage(); GetPPException; BlackThresholdImage(image(),threshold_.c_str(),exceptionInfo); - ThrowPPException; + ThrowImageException; } void Magick::Image::blackThresholdChannel(const ChannelType channel_, @@ -2001,7 +2030,7 @@ void Magick::Image::blackThresholdChannel(const ChannelType channel_, SetPPChannelMask(channel_); BlackThresholdImage(image(),threshold_.c_str(),exceptionInfo); RestorePPChannelMask; - ThrowPPException; + ThrowImageException; } void Magick::Image::blueShift(const double factor_) @@ -2012,7 +2041,7 @@ void Magick::Image::blueShift(const double factor_) GetPPException; newImage=BlueShiftImage(constImage(),factor_,exceptionInfo); replaceImage(newImage); - ThrowPPException; + ThrowImageException; } void Magick::Image::blur(const double radius_,const double sigma_) @@ -2023,7 +2052,7 @@ void Magick::Image::blur(const double radius_,const double sigma_) GetPPException; newImage=BlurImage(constImage(),radius_,sigma_,exceptionInfo); replaceImage(newImage); - ThrowPPException; + ThrowImageException; } void Magick::Image::blurChannel(const ChannelType channel_, @@ -2037,7 +2066,7 @@ void Magick::Image::blurChannel(const ChannelType channel_, newImage=BlurImage(constImage(),radius_,sigma_,exceptionInfo); RestorePPChannelMask; replaceImage(newImage); - ThrowPPException; + ThrowImageException; } void Magick::Image::border(const Geometry &geometry_) @@ -2052,7 +2081,7 @@ void Magick::Image::border(const Geometry &geometry_) newImage=BorderImage(constImage(),&borderInfo,image()->compose, exceptionInfo); replaceImage(newImage); - ThrowPPException; + ThrowImageException; } void Magick::Image::brightnessContrast(const double brightness_, @@ -2061,7 +2090,7 @@ void Magick::Image::brightnessContrast(const double brightness_, modifyImage(); GetPPException; BrightnessContrastImage(image(),brightness_,contrast_,exceptionInfo); - ThrowPPException; + ThrowImageException; } void Magick::Image::brightnessContrastChannel(const ChannelType channel_, @@ -2072,7 +2101,7 @@ void Magick::Image::brightnessContrastChannel(const ChannelType channel_, SetPPChannelMask(channel_); BrightnessContrastImage(image(),brightness_,contrast_,exceptionInfo); RestorePPChannelMask; - ThrowPPException; + ThrowImageException; } void Magick::Image::cannyEdge(const double radius_,const double sigma_, @@ -2086,7 +2115,7 @@ void Magick::Image::cannyEdge(const double radius_,const double sigma_, newImage=CannyEdgeImage(constImage(),radius_,sigma_,lowerPercent_, upperPercent_,exceptionInfo); replaceImage(newImage); - ThrowPPException; + ThrowImageException; } void Magick::Image::channel(const ChannelType channel_) @@ -2097,7 +2126,7 @@ void Magick::Image::channel(const ChannelType channel_) GetPPException; newImage=SeparateImage(image(),channel_,exceptionInfo); replaceImage(newImage); - ThrowPPException; + ThrowImageException; } void Magick::Image::charcoal(const double radius_,const double sigma_) @@ -2108,7 +2137,7 @@ void Magick::Image::charcoal(const double radius_,const double sigma_) GetPPException; newImage=CharcoalImage(image(),radius_,sigma_,exceptionInfo); replaceImage(newImage); - ThrowPPException; + ThrowImageException; } void Magick::Image::chop(const Geometry &geometry_) @@ -2122,7 +2151,7 @@ void Magick::Image::chop(const Geometry &geometry_) GetPPException; newImage=ChopImage(image(),&chopInfo,exceptionInfo); replaceImage(newImage); - ThrowPPException; + ThrowImageException; } void Magick::Image::chromaBluePrimary(const double x_,const double y_) @@ -2182,7 +2211,7 @@ void Magick::Image::cdl(const std::string &cdl_) modifyImage(); GetPPException; (void) ColorDecisionListImage(image(),cdl_.c_str(),exceptionInfo); - ThrowPPException; + ThrowImageException; } void Magick::Image::clamp(void) @@ -2190,7 +2219,7 @@ void Magick::Image::clamp(void) modifyImage(); GetPPException; ClampImage(image(),exceptionInfo); - ThrowPPException; + ThrowImageException; } void Magick::Image::clampChannel(const ChannelType channel_) @@ -2200,7 +2229,7 @@ void Magick::Image::clampChannel(const ChannelType channel_) SetPPChannelMask(channel_); ClampImage(image(),exceptionInfo); RestorePPChannelMask; - ThrowPPException; + ThrowImageException; } void Magick::Image::clip(void) @@ -2208,7 +2237,7 @@ void Magick::Image::clip(void) modifyImage(); GetPPException; ClipImage(image(),exceptionInfo); - ThrowPPException; + ThrowImageException; } void Magick::Image::clipPath(const std::string pathname_,const bool inside_) @@ -2217,7 +2246,7 @@ void Magick::Image::clipPath(const std::string pathname_,const bool inside_) GetPPException; ClipImagePath(image(),pathname_.c_str(),(MagickBooleanType) inside_, exceptionInfo); - ThrowPPException; + ThrowImageException; } void Magick::Image::clut(const Image &clutImage_, @@ -2226,7 +2255,7 @@ void Magick::Image::clut(const Image &clutImage_, modifyImage(); GetPPException; ClutImage(image(),clutImage_.constImage(),method,exceptionInfo); - ThrowPPException; + ThrowImageException; } void Magick::Image::clutChannel(const ChannelType channel_, @@ -2237,7 +2266,7 @@ void Magick::Image::clutChannel(const ChannelType channel_, SetPPChannelMask(channel_); ClutImage(image(),clutImage_.constImage(),method,exceptionInfo); RestorePPChannelMask; - ThrowPPException; + ThrowImageException; } void Magick::Image::colorize(const unsigned int alpha_,const Color &penColor_) @@ -2259,7 +2288,8 @@ void Magick::Image::colorize(const unsigned int alphaRed_, target; if (!penColor_.isValid()) - throwExceptionExplicit(OptionError,"Pen color argument is invalid"); + throwExceptionExplicit(MagickCore::OptionError, + "Pen color argument is invalid"); FormatLocaleString(blend,MaxTextExtent,"%u/%u/%u",alphaRed_,alphaGreen_, alphaBlue_); @@ -2268,7 +2298,7 @@ void Magick::Image::colorize(const unsigned int alphaRed_, GetPPException; newImage=ColorizeImage(image(),blend,&target,exceptionInfo); replaceImage(newImage); - ThrowPPException; + ThrowImageException; } void Magick::Image::colorMap(const size_t index_,const Color &color_) @@ -2279,11 +2309,12 @@ void Magick::Image::colorMap(const size_t index_,const Color &color_) imageptr=image(); if (index_ > (MaxColormapSize-1)) - throwExceptionExplicit(OptionError, + throwExceptionExplicit(MagickCore::OptionError, "Colormap index must be less than MaxColormapSize"); if (!color_.isValid()) - throwExceptionExplicit(OptionError,"Color argument is invalid"); + throwExceptionExplicit(MagickCore::OptionError, + "Color argument is invalid"); modifyImage(); @@ -2299,12 +2330,13 @@ Magick::Color Magick::Image::colorMap(const size_t index_) const { if (!constImage()->colormap) { - throwExceptionExplicit(OptionError,"Image does not contain a colormap"); + throwExceptionExplicit(MagickCore::OptionError, + "Image does not contain a colormap"); return(Color()); } if (index_ > constImage()->colors-1) - throwExceptionExplicit(OptionError,"Index out of range"); + throwExceptionExplicit(MagickCore::OptionError,"Index out of range"); return(Magick::Color((constImage()->colormap)[index_])); } @@ -2335,7 +2367,7 @@ void Magick::Image::colorMatrix(const size_t order_, } kernel_info=DestroyKernelInfo(kernel_info); } - ThrowPPException; + ThrowImageException; } bool Magick::Image::compare(const Image &reference_) @@ -2350,7 +2382,7 @@ bool Magick::Image::compare(const Image &reference_) modifyImage(); ref.modifyImage(); status=static_cast(IsImagesEqual(image(),ref.image(),exceptionInfo)); - ThrowPPException; + ThrowImageException; return(status); } @@ -2362,7 +2394,7 @@ double Magick::Image::compare(const Image &reference_,const MetricType metric_) GetPPException; GetImageDistortion(image(),reference_.constImage(),metric_,&distortion, exceptionInfo); - ThrowPPException; + ThrowImageException; return(distortion); } @@ -2377,7 +2409,7 @@ double Magick::Image::compareChannel(const ChannelType channel_, GetImageDistortion(image(),reference_.constImage(),metric_,&distortion, exceptionInfo); RestorePPChannelMask; - ThrowPPException; + ThrowImageException; return(distortion); } @@ -2390,7 +2422,7 @@ Magick::Image Magick::Image::compare(const Image &reference_, GetPPException; newImage=CompareImages(image(),reference_.constImage(),metric_,distortion, exceptionInfo); - ThrowPPException; + ThrowImageException; if (newImage == (MagickCore::Image *) NULL) return(Magick::Image()); else @@ -2408,7 +2440,7 @@ Magick::Image Magick::Image::compareChannel(const ChannelType channel_, newImage=CompareImages(image(),reference_.constImage(),metric_,distortion, exceptionInfo); RestorePPChannelMask; - ThrowPPException; + ThrowImageException; if (newImage == (MagickCore::Image *) NULL) return(Magick::Image()); else @@ -2433,7 +2465,7 @@ void Magick::Image::composite(const Image &compositeImage_, GetPPException; CompositeImage(image(),compositeImage_.constImage(),compose_,MagickTrue, x,y,exceptionInfo); - ThrowPPException; + ThrowImageException; } void Magick::Image::composite(const Image &compositeImage_, @@ -2449,7 +2481,7 @@ void Magick::Image::composite(const Image &compositeImage_, GetPPException; CompositeImage(image(),compositeImage_.constImage(),compose_,MagickTrue, geometry.x,geometry.y,exceptionInfo); - ThrowPPException; + ThrowImageException; } void Magick::Image::composite(const Image &compositeImage_, @@ -2462,7 +2494,7 @@ void Magick::Image::composite(const Image &compositeImage_, GetPPException; CompositeImage(image(),compositeImage_.constImage(),compose_,MagickTrue, xOffset_,yOffset_,exceptionInfo); - ThrowPPException; + ThrowImageException; } void Magick::Image::connectedComponents(const size_t connectivity_) @@ -2473,7 +2505,7 @@ void Magick::Image::connectedComponents(const size_t connectivity_) GetPPException; newImage=ConnectedComponentsImage(constImage(),connectivity_,exceptionInfo); replaceImage(newImage); - ThrowPPException; + ThrowImageException; } void Magick::Image::contrast(const size_t sharpen_) @@ -2481,7 +2513,7 @@ void Magick::Image::contrast(const size_t sharpen_) modifyImage(); GetPPException; ContrastImage(image(),(MagickBooleanType) sharpen_,exceptionInfo); - ThrowPPException; + ThrowImageException; } void Magick::Image::contrastStretch(const double blackPoint_, @@ -2490,7 +2522,7 @@ void Magick::Image::contrastStretch(const double blackPoint_, modifyImage(); GetPPException; ContrastStretchImage(image(),blackPoint_,whitePoint_,exceptionInfo); - ThrowPPException; + ThrowImageException; } void Magick::Image::contrastStretchChannel(const ChannelType channel_, @@ -2501,7 +2533,7 @@ void Magick::Image::contrastStretchChannel(const ChannelType channel_, SetPPChannelMask(channel_); ContrastStretchImage(image(),blackPoint_,whitePoint_,exceptionInfo); RestorePPChannelMask; - ThrowPPException; + ThrowImageException; } void Magick::Image::convolve(const size_t order_,const double *kernel_) @@ -2526,7 +2558,7 @@ void Magick::Image::convolve(const size_t order_,const double *kernel_) replaceImage(newImage); } kernel_info=DestroyKernelInfo(kernel_info); - ThrowPPException; + ThrowImageException; } void Magick::Image::crop(const Geometry &geometry_) @@ -2540,7 +2572,7 @@ void Magick::Image::crop(const Geometry &geometry_) GetPPException; newImage=CropImage(constImage(),&cropInfo,exceptionInfo); replaceImage(newImage); - ThrowPPException; + ThrowImageException; } void Magick::Image::cycleColormap(const ssize_t amount_) @@ -2548,7 +2580,7 @@ void Magick::Image::cycleColormap(const ssize_t amount_) modifyImage(); GetPPException; CycleColormapImage(image(),amount_,exceptionInfo); - ThrowPPException; + ThrowImageException; } void Magick::Image::decipher(const std::string &passphrase_) @@ -2556,7 +2588,7 @@ void Magick::Image::decipher(const std::string &passphrase_) modifyImage(); GetPPException; DecipherImage(image(),passphrase_.c_str(),exceptionInfo); - ThrowPPException; + ThrowImageException; } void Magick::Image::defineSet(const std::string &magick_, @@ -2626,7 +2658,7 @@ void Magick::Image::deskew(const double threshold_) GetPPException; newImage=DeskewImage(constImage(),threshold_,exceptionInfo); replaceImage(newImage); - ThrowPPException; + ThrowImageException; } void Magick::Image::despeckle(void) @@ -2637,7 +2669,7 @@ void Magick::Image::despeckle(void) GetPPException; newImage=DespeckleImage(constImage(),exceptionInfo); replaceImage(newImage); - ThrowPPException; + ThrowImageException; } Magick::ImageType Magick::Image::determineType(void) const @@ -2647,7 +2679,7 @@ Magick::ImageType Magick::Image::determineType(void) const GetPPException; image_type=GetImageType(constImage(),exceptionInfo); - ThrowPPException; + ThrowImageException; return(image_type); } @@ -2655,7 +2687,7 @@ void Magick::Image::display(void) { GetPPException; DisplayImages(imageInfo(),image(),exceptionInfo); - ThrowPPException; + ThrowImageException; } void Magick::Image::distort(const DistortImageMethod method_, @@ -2668,7 +2700,7 @@ void Magick::Image::distort(const DistortImageMethod method_, newImage=DistortImage(constImage(), method_,numberArguments_,arguments_, bestfit_ == true ? MagickTrue : MagickFalse,exceptionInfo); replaceImage(newImage); - ThrowPPException; + ThrowImageException; } void Magick::Image::draw(const Magick::Drawable &drawable_) @@ -2688,7 +2720,7 @@ void Magick::Image::draw(const Magick::Drawable &drawable_) ClonePPDrawException(wand); wand=DestroyDrawingWand(wand); - ThrowPPDrawException; + ThrowPPDrawException(_quiet); } } @@ -2707,16 +2739,16 @@ void Magick::Image::draw(const std::vector &drawable_) p != drawable_.end(); p++ ) { p->operator()(wand); - if (DrawGetExceptionType(wand) != UndefinedException) + if (DrawGetExceptionType(wand) != MagickCore::UndefinedException) break; } - if (DrawGetExceptionType(wand) == UndefinedException) + if (DrawGetExceptionType(wand) == MagickCore::UndefinedException) DrawRender(wand); ClonePPDrawException(wand); wand=DestroyDrawingWand(wand); - ThrowPPDrawException; + ThrowPPDrawException(_quiet); } } @@ -2728,7 +2760,7 @@ void Magick::Image::edge(const double radius_) GetPPException; newImage=EdgeImage(constImage(),radius_,exceptionInfo); replaceImage(newImage); - ThrowPPException; + ThrowImageException; } void Magick::Image::emboss(const double radius_,const double sigma_) @@ -2739,7 +2771,7 @@ void Magick::Image::emboss(const double radius_,const double sigma_) GetPPException; newImage=EmbossImage(constImage(),radius_,sigma_,exceptionInfo); replaceImage(newImage); - ThrowPPException; + ThrowImageException; } void Magick::Image::encipher(const std::string &passphrase_) @@ -2747,7 +2779,7 @@ void Magick::Image::encipher(const std::string &passphrase_) modifyImage(); GetPPException; EncipherImage(image(),passphrase_.c_str(),exceptionInfo); - ThrowPPException; + ThrowImageException; } void Magick::Image::enhance(void) @@ -2758,7 +2790,7 @@ void Magick::Image::enhance(void) GetPPException; newImage=EnhanceImage(constImage(),exceptionInfo); replaceImage(newImage); - ThrowPPException; + ThrowImageException; } void Magick::Image::equalize(void) @@ -2766,7 +2798,7 @@ void Magick::Image::equalize(void) modifyImage(); GetPPException; EqualizeImage(image(),exceptionInfo); - ThrowPPException; + ThrowImageException; } void Magick::Image::erase(void) @@ -2774,7 +2806,7 @@ void Magick::Image::erase(void) modifyImage(); GetPPException; (void) SetImageBackgroundColor(image(),exceptionInfo); - ThrowPPException; + ThrowImageException; } void Magick::Image::extent(const Geometry &geometry_ ) @@ -2791,7 +2823,7 @@ void Magick::Image::extent(const Geometry &geometry_ ) GetPPException; newImage=ExtentImage(image(),&extentInfo,exceptionInfo); replaceImage(newImage); - ThrowPPException; + ThrowImageException; } void Magick::Image::extent(const Geometry &geometry_, @@ -2829,7 +2861,7 @@ void Magick::Image::flip(void) GetPPException; newImage=FlipImage(constImage(),exceptionInfo); replaceImage(newImage); - ThrowPPException; + ThrowImageException; } void Magick::Image::floodFillAlpha(const ssize_t x_,const ssize_t y_, @@ -2847,7 +2879,7 @@ void Magick::Image::floodFillAlpha(const ssize_t x_,const ssize_t y_, FloodfillPaintImage(image(),options()->drawInfo(),&target,x_,y_, (MagickBooleanType)invert_,exceptionInfo); RestorePPChannelMask; - ThrowPPException; + ThrowImageException; } void Magick::Image::floodFillAlpha(const ssize_t x_,const ssize_t y_, @@ -2865,7 +2897,7 @@ void Magick::Image::floodFillAlpha(const ssize_t x_,const ssize_t y_, FloodfillPaintImage(image(),options()->drawInfo(),&target,x_,y_, (MagickBooleanType)invert_,exceptionInfo); RestorePPChannelMask; - ThrowPPException; + ThrowImageException; } void Magick::Image::floodFillColor(const Geometry &point_, @@ -2952,7 +2984,7 @@ void Magick::Image::flop(void) GetPPException; newImage=FlopImage(constImage(),exceptionInfo); replaceImage(newImage); - ThrowPPException; + ThrowImageException; } void Magick::Image::fontTypeMetrics(const std::string &text_, @@ -2966,7 +2998,7 @@ void Magick::Image::fontTypeMetrics(const std::string &text_, GetPPException; GetTypeMetrics(image(),drawInfo,&(metrics->_typeMetric),exceptionInfo); drawInfo->text=0; - ThrowPPException; + ThrowImageException; } void Magick::Image::fontTypeMetricsMultiline(const std::string &text_, @@ -2980,7 +3012,7 @@ void Magick::Image::fontTypeMetricsMultiline(const std::string &text_, GetPPException; GetMultilineTypeMetrics(image(),drawInfo,&(metrics->_typeMetric),exceptionInfo); drawInfo->text=0; - ThrowPPException; + ThrowImageException; } void Magick::Image::frame(const Geometry &geometry_) @@ -3001,7 +3033,7 @@ void Magick::Image::frame(const Geometry &geometry_) GetPPException; newImage=FrameImage(constImage(),&info,image()->compose,exceptionInfo); replaceImage(newImage); - ThrowPPException; + ThrowImageException; } void Magick::Image::frame(const size_t width_,const size_t height_, @@ -3023,7 +3055,7 @@ void Magick::Image::frame(const size_t width_,const size_t height_, GetPPException; newImage=FrameImage(constImage(),&info,image()->compose,exceptionInfo); replaceImage(newImage); - ThrowPPException; + ThrowImageException; } void Magick::Image::fx(const std::string expression_) @@ -3034,7 +3066,7 @@ void Magick::Image::fx(const std::string expression_) GetPPException; newImage=FxImage(constImage(),expression_.c_str(),exceptionInfo); replaceImage(newImage); - ThrowPPException; + ThrowImageException; } void Magick::Image::fx(const std::string expression_, @@ -3048,7 +3080,7 @@ void Magick::Image::fx(const std::string expression_, newImage=FxImage(constImage(),expression_.c_str(),exceptionInfo); RestorePPChannelMask; replaceImage(newImage); - ThrowPPException; + ThrowImageException; } void Magick::Image::gamma(const double gamma_) @@ -3056,7 +3088,7 @@ void Magick::Image::gamma(const double gamma_) modifyImage(); GetPPException; GammaImage(image(),gamma_,exceptionInfo); - ThrowPPException; + ThrowImageException; } void Magick::Image::gamma(const double gammaRed_,const double gammaGreen_, @@ -3071,7 +3103,7 @@ void Magick::Image::gamma(const double gammaRed_,const double gammaGreen_, modifyImage(); GetPPException; GammaImage(image(),atof(gamma),exceptionInfo); - ThrowPPException; + ThrowImageException; } void Magick::Image::gaussianBlur(const double width_,const double sigma_) @@ -3082,7 +3114,7 @@ void Magick::Image::gaussianBlur(const double width_,const double sigma_) GetPPException; newImage=GaussianBlurImage(constImage(),width_,sigma_,exceptionInfo); replaceImage(newImage); - ThrowPPException; + ThrowImageException; } void Magick::Image::gaussianBlurChannel(const ChannelType channel_, @@ -3096,7 +3128,7 @@ void Magick::Image::gaussianBlurChannel(const ChannelType channel_, newImage=GaussianBlurImage(constImage(),width_,sigma_,exceptionInfo); RestorePPChannelMask; replaceImage(newImage); - ThrowPPException; + ThrowImageException; } const Magick::Quantum *Magick::Image::getConstPixels(const ssize_t x_, @@ -3107,7 +3139,7 @@ const Magick::Quantum *Magick::Image::getConstPixels(const ssize_t x_, GetPPException; p=(*GetVirtualPixels)(constImage(),x_, y_,columns_, rows_,exceptionInfo); - ThrowPPException; + ThrowImageException; return(p); } @@ -3119,7 +3151,8 @@ const void *Magick::Image::getConstMetacontent(void) const result=GetVirtualMetacontent(constImage()); if(!result) - throwExceptionExplicit(OptionError,"Unable to retrieve meta content."); + throwExceptionExplicit(MagickCore::OptionError, + "Unable to retrieve meta content."); return(result); } @@ -3132,7 +3165,8 @@ void *Magick::Image::getMetacontent(void ) result=GetAuthenticMetacontent(image()); if(!result) - throwExceptionExplicit(OptionError,"Unable to retrieve meta content."); + throwExceptionExplicit(MagickCore::OptionError, + "Unable to retrieve meta content."); return(result); } @@ -3146,7 +3180,7 @@ Magick::Quantum *Magick::Image::getPixels(const ssize_t x_,const ssize_t y_, modifyImage(); GetPPException; result=(*GetAuthenticPixels)(image(),x_, y_,columns_,rows_,exceptionInfo); - ThrowPPException; + ThrowImageException; return(result); } @@ -3156,7 +3190,7 @@ void Magick::Image::grayscale(const PixelIntensityMethod method_) modifyImage(); GetPPException; (void) GrayscaleImage(image(),method_,exceptionInfo); - ThrowPPException; + ThrowImageException; } void Magick::Image::haldClut(const Image &clutImage_) @@ -3164,7 +3198,7 @@ void Magick::Image::haldClut(const Image &clutImage_) modifyImage(); GetPPException; (void) HaldClutImage(image(),clutImage_.constImage(),exceptionInfo); - ThrowPPException; + ThrowImageException; } void Magick::Image::houghLine(const size_t width_,const size_t height_, @@ -3177,7 +3211,7 @@ void Magick::Image::houghLine(const size_t width_,const size_t height_, newImage=HoughLineImage(constImage(),width_,height_,threshold_, exceptionInfo); replaceImage(newImage); - ThrowPPException; + ThrowImageException; } void Magick::Image::implode(const double factor_) @@ -3189,7 +3223,7 @@ void Magick::Image::implode(const double factor_) newImage=ImplodeImage(constImage(),factor_,image()->interpolate, exceptionInfo); replaceImage(newImage); - ThrowPPException; + ThrowImageException; } void Magick::Image::inverseFourierTransform(const Image &phase_) @@ -3207,7 +3241,7 @@ void Magick::Image::inverseFourierTransform(const Image &phase_, newImage=InverseFourierTransformImage(constImage(),phase_.constImage(), magnitude_ == true ? MagickTrue : MagickFalse,exceptionInfo); replaceImage(newImage); - ThrowPPException; + ThrowImageException; } void Magick::Image::kuwahara(const double radius_,const double sigma_) @@ -3218,7 +3252,7 @@ void Magick::Image::kuwahara(const double radius_,const double sigma_) GetPPException; newImage=KuwaharaImage(constImage(),radius_,sigma_,exceptionInfo); replaceImage(newImage); - ThrowPPException; + ThrowImageException; } void Magick::Image::kuwaharaChannel(const ChannelType channel_, @@ -3232,7 +3266,7 @@ void Magick::Image::kuwaharaChannel(const ChannelType channel_, newImage=KuwaharaImage(constImage(),radius_,sigma_,exceptionInfo); replaceImage(newImage); RestorePPChannelMask; - ThrowPPException; + ThrowImageException; } void Magick::Image::level(const double blackPoint_,const double whitePoint_, @@ -3241,7 +3275,7 @@ void Magick::Image::level(const double blackPoint_,const double whitePoint_, modifyImage(); GetPPException; (void) LevelImage(image(),blackPoint_,whitePoint_,gamma_,exceptionInfo); - ThrowPPException; + ThrowImageException; } void Magick::Image::levelChannel(const ChannelType channel_, @@ -3252,7 +3286,7 @@ void Magick::Image::levelChannel(const ChannelType channel_, SetPPChannelMask(channel_); (void) LevelImage(image(),blackPoint_,whitePoint_,gamma_,exceptionInfo); RestorePPChannelMask; - ThrowPPException; + ThrowImageException; } void Magick::Image::levelColors(const Color &blackColor_, @@ -3269,7 +3303,7 @@ void Magick::Image::levelColors(const Color &blackColor_, GetPPException; (void) LevelImageColors(image(),&black,&white,invert_ == true ? MagickTrue : MagickFalse,exceptionInfo); - ThrowPPException; + ThrowImageException; } void Magick::Image::levelColorsChannel(const ChannelType channel_, @@ -3288,7 +3322,7 @@ void Magick::Image::levelColorsChannel(const ChannelType channel_, (void) LevelImageColors(image(),&black,&white,invert_ == true ? MagickTrue : MagickFalse,exceptionInfo); RestorePPChannelMask; - ThrowPPException; + ThrowImageException; } void Magick::Image::linearStretch(const double blackPoint_, @@ -3297,7 +3331,7 @@ void Magick::Image::linearStretch(const double blackPoint_, modifyImage(); GetPPException; LinearStretchImage(image(),blackPoint_,whitePoint_,exceptionInfo); - ThrowPPException; + ThrowImageException; } void Magick::Image::liquidRescale(const Geometry &geometry_) @@ -3319,7 +3353,7 @@ void Magick::Image::liquidRescale(const Geometry &geometry_) GetPPException; newImage=LiquidRescaleImage(image(),width,height,x,y,exceptionInfo); replaceImage(newImage); - ThrowPPException; + ThrowImageException; } void Magick::Image::magnify(void) @@ -3330,7 +3364,7 @@ void Magick::Image::magnify(void) GetPPException; newImage=MagnifyImage(constImage(),exceptionInfo); replaceImage(newImage); - ThrowPPException; + ThrowImageException; } void Magick::Image::map(const Image &mapImage_,const bool dither_) @@ -3340,7 +3374,7 @@ void Magick::Image::map(const Image &mapImage_,const bool dither_) options()->quantizeDither(dither_); RemapImage(options()->quantizeInfo(),image(),mapImage_.constImage(), exceptionInfo); - ThrowPPException; + ThrowImageException; } void Magick::Image::medianFilter(const double radius_) @@ -3352,7 +3386,7 @@ void Magick::Image::medianFilter(const double radius_) newImage=StatisticImage(image(),MedianStatistic,(size_t) radius_, (size_t) radius_,exceptionInfo); replaceImage(newImage); - ThrowPPException; + ThrowImageException; } void Magick::Image::minify(void) @@ -3363,7 +3397,7 @@ void Magick::Image::minify(void) GetPPException; newImage=MinifyImage(constImage(),exceptionInfo); replaceImage(newImage); - ThrowPPException; + ThrowImageException; } void Magick::Image::modulate(const double brightness_,const double saturation_, @@ -3378,12 +3412,12 @@ void Magick::Image::modulate(const double brightness_,const double saturation_, modifyImage(); GetPPException; ModulateImage(image(),modulate,exceptionInfo); - ThrowPPException; + ThrowImageException; } Magick::ImageMoments Magick::Image::moments(void) { - return(ImageMoments(constImage())); + return(ImageMoments(*this)); } void Magick::Image::morphology(const MorphologyMethod method_, @@ -3398,12 +3432,12 @@ void Magick::Image::morphology(const MorphologyMethod method_, GetPPException; kernel=AcquireKernelInfo(kernel_.c_str(),exceptionInfo); if (kernel == (KernelInfo *) NULL) - throwExceptionExplicit(OptionError,"Unable to parse kernel."); + throwExceptionExplicit(MagickCore::OptionError,"Unable to parse kernel."); newImage=MorphologyImage(constImage(),method_,iterations_,kernel, exceptionInfo); replaceImage(newImage); kernel=DestroyKernelInfo(kernel); - ThrowPPException; + ThrowImageException; } void Magick::Image::morphology(const MorphologyMethod method_, @@ -3418,7 +3452,8 @@ void Magick::Image::morphology(const MorphologyMethod method_, option=CommandOptionToMnemonic(MagickKernelOptions,kernel_); if (option == (const char *)NULL) - throwExceptionExplicit(OptionError,"Unable to determine kernel type."); + throwExceptionExplicit(MagickCore::OptionError, + "Unable to determine kernel type."); kernel=std::string(option); if (!arguments_.empty()) @@ -3441,14 +3476,14 @@ void Magick::Image::morphologyChannel(const ChannelType channel_, GetPPException; kernel=AcquireKernelInfo(kernel_.c_str(),exceptionInfo); if (kernel == (KernelInfo *)NULL) - throwExceptionExplicit(OptionError,"Unable to parse kernel."); + throwExceptionExplicit(MagickCore::OptionError,"Unable to parse kernel."); SetPPChannelMask(channel_); newImage=MorphologyImage(constImage(),method_,iterations_,kernel, exceptionInfo); RestorePPChannelMask; replaceImage(newImage); kernel=DestroyKernelInfo(kernel); - ThrowPPException; + ThrowImageException; } void Magick::Image::morphologyChannel(const ChannelType channel_, @@ -3463,7 +3498,8 @@ void Magick::Image::morphologyChannel(const ChannelType channel_, option=CommandOptionToMnemonic(MagickKernelOptions,kernel_); if (option == (const char *)NULL) - throwExceptionExplicit(OptionError,"Unable to determine kernel type."); + throwExceptionExplicit(MagickCore::OptionError, + "Unable to determine kernel type."); kernel=std::string(option); if (!arguments_.empty()) @@ -3481,7 +3517,7 @@ void Magick::Image::motionBlur(const double radius_,const double sigma_, GetPPException; newImage=MotionBlurImage(constImage(),radius_,sigma_,angle_,exceptionInfo); replaceImage(newImage); - ThrowPPException; + ThrowImageException; } void Magick::Image::negate(const bool grayscale_) @@ -3489,7 +3525,7 @@ void Magick::Image::negate(const bool grayscale_) modifyImage(); GetPPException; NegateImage(image(),(MagickBooleanType) grayscale_,exceptionInfo); - ThrowPPException; + ThrowImageException; } void Magick::Image::negateChannel(const ChannelType channel_, @@ -3500,7 +3536,7 @@ void Magick::Image::negateChannel(const ChannelType channel_, SetPPChannelMask(channel_); NegateImage(image(),(MagickBooleanType) grayscale_,exceptionInfo); RestorePPChannelMask; - ThrowPPException; + ThrowImageException; } void Magick::Image::normalize(void) @@ -3508,7 +3544,7 @@ void Magick::Image::normalize(void) modifyImage(); GetPPException; NormalizeImage(image(),exceptionInfo); - ThrowPPException; + ThrowImageException; } void Magick::Image::oilPaint(const double radius_,const double sigma_) @@ -3519,7 +3555,7 @@ void Magick::Image::oilPaint(const double radius_,const double sigma_) GetPPException; newImage=OilPaintImage(constImage(),radius_,sigma_,exceptionInfo); replaceImage(newImage); - ThrowPPException; + ThrowImageException; } void Magick::Image::opaque(const Color &opaqueColor_,const Color &penColor_, @@ -3534,10 +3570,12 @@ void Magick::Image::opaque(const Color &opaqueColor_,const Color &penColor_, pen; if (!opaqueColor_.isValid()) - throwExceptionExplicit(OptionError,"Opaque color argument is invalid"); + throwExceptionExplicit(MagickCore::OptionError, + "Opaque color argument is invalid"); if (!penColor_.isValid()) - throwExceptionExplicit(OptionError,"Pen color argument is invalid"); + throwExceptionExplicit(MagickCore::OptionError, + "Pen color argument is invalid"); modifyImage(); opaqueColor=opaqueColor_; @@ -3550,7 +3588,7 @@ void Magick::Image::opaque(const Color &opaqueColor_,const Color &penColor_, exceptionInfo); OpaquePaintImage(image(),&opaque,&pen,invert_ ? MagickTrue : MagickFalse, exceptionInfo); - ThrowPPException; + ThrowImageException; } void Magick::Image::orderedDither(std::string thresholdMap_) @@ -3558,7 +3596,7 @@ void Magick::Image::orderedDither(std::string thresholdMap_) modifyImage(); GetPPException; (void) OrderedPosterizeImage(image(),thresholdMap_.c_str(),exceptionInfo); - ThrowPPException; + ThrowImageException; } void Magick::Image::orderedDitherChannel(const ChannelType channel_, @@ -3569,7 +3607,7 @@ void Magick::Image::orderedDitherChannel(const ChannelType channel_, SetPPChannelMask(channel_); (void) OrderedPosterizeImage(image(),thresholdMap_.c_str(),exceptionInfo); RestorePPChannelMask; - ThrowPPException; + ThrowImageException; } void Magick::Image::perceptible(const double epsilon_) @@ -3577,7 +3615,7 @@ void Magick::Image::perceptible(const double epsilon_) modifyImage(); GetPPException; PerceptibleImage(image(),epsilon_,exceptionInfo); - ThrowPPException; + ThrowImageException; } void Magick::Image::perceptibleChannel(const ChannelType channel_, @@ -3588,12 +3626,12 @@ void Magick::Image::perceptibleChannel(const ChannelType channel_, SetPPChannelMask(channel_); PerceptibleImage(image(),epsilon_,exceptionInfo); RestorePPChannelMask; - ThrowPPException; + ThrowImageException; } Magick::ImagePerceptualHash Magick::Image::perceptualHash() { - return(ImagePerceptualHash(constImage())); + return(ImagePerceptualHash(*this)); } void Magick::Image::ping(const std::string &imageSpec_) @@ -3628,7 +3666,8 @@ void Magick::Image::pixelColor(const ssize_t x_,const ssize_t y_, // Test arguments to ensure they are within the image. if (y_ > (ssize_t) rows() || x_ > (ssize_t) columns()) - throwExceptionExplicit(OptionError,"Access outside of image boundary"); + throwExceptionExplicit(MagickCore::OptionError, + "Access outside of image boundary"); modifyImage(); @@ -3674,7 +3713,7 @@ void Magick::Image::polaroid(const std::string &caption_,const double angle_, newImage=PolaroidImage(constImage(),options()->drawInfo(),caption_.c_str(), angle_,method_,exceptionInfo); replaceImage(newImage); - ThrowPPException; + ThrowImageException; } void Magick::Image::posterize(const size_t levels_,const DitherMethod method_) @@ -3682,7 +3721,7 @@ void Magick::Image::posterize(const size_t levels_,const DitherMethod method_) modifyImage(); GetPPException; PosterizeImage(image(),levels_,method_,exceptionInfo); - ThrowPPException; + ThrowImageException; } void Magick::Image::posterizeChannel(const ChannelType channel_, @@ -3693,7 +3732,7 @@ void Magick::Image::posterizeChannel(const ChannelType channel_, SetPPChannelMask(channel_); PosterizeImage(image(),levels_,method_,exceptionInfo); RestorePPChannelMask; - ThrowPPException; + ThrowImageException; } void Magick::Image::process(std::string name_,const ssize_t argc, @@ -3704,7 +3743,7 @@ void Magick::Image::process(std::string name_,const ssize_t argc, GetPPException; (void) InvokeDynamicImageFilter(name_.c_str(),&image(),argc,argv, exceptionInfo); - ThrowPPException; + ThrowImageException; } void Magick::Image::profile(const std::string name_, @@ -3714,7 +3753,7 @@ void Magick::Image::profile(const std::string name_, GetPPException; (void) ProfileImage(image(),name_.c_str(),(unsigned char *)profile_.data(), profile_.length(),exceptionInfo); - ThrowPPException; + ThrowImageException; } Magick::Blob Magick::Image::profile(const std::string name_) const @@ -3741,7 +3780,7 @@ void Magick::Image::quantize(const bool measureError_) GetPPException; QuantizeImage(options()->quantizeInfo(),image(),exceptionInfo); - ThrowPPException; + ThrowImageException; } void Magick::Image::quantumOperator(const ChannelType channel_, @@ -3751,7 +3790,7 @@ void Magick::Image::quantumOperator(const ChannelType channel_, SetPPChannelMask(channel_); EvaluateImage(image(),operator_,rvalue_,exceptionInfo); RestorePPChannelMask; - ThrowPPException; + ThrowImageException; } void Magick::Image::quantumOperator(const ssize_t x_,const ssize_t y_, @@ -3778,7 +3817,7 @@ void Magick::Image::quantumOperator(const ssize_t x_,const ssize_t y_, BlendPixelTrait ? OverCompositeOp : CopyCompositeOp,MagickFalse, geometry.x,geometry.y,exceptionInfo ); cropImage=DestroyImageList(cropImage); - ThrowPPException; + ThrowImageException; } void Magick::Image::raise(const Geometry &geometry_,const bool raisedFlag_) @@ -3790,7 +3829,7 @@ void Magick::Image::raise(const Geometry &geometry_,const bool raisedFlag_) modifyImage(); RaiseImage(image(),&raiseInfo,raisedFlag_ == true ? MagickTrue : MagickFalse, exceptionInfo); - ThrowPPException; + ThrowImageException; } void Magick::Image::randomThreshold(const Geometry &thresholds_) @@ -3798,7 +3837,7 @@ void Magick::Image::randomThreshold(const Geometry &thresholds_) GetPPException; (void) RandomThresholdImage(image(),static_cast( thresholds_).c_str(),exceptionInfo); - ThrowPPException; + ThrowImageException; } void Magick::Image::randomThresholdChannel(const ChannelType channel_, @@ -3810,7 +3849,7 @@ void Magick::Image::randomThresholdChannel(const ChannelType channel_, (void) RandomThresholdImage(image(),static_cast( thresholds_).c_str(),exceptionInfo); RestorePPChannelMask; - ThrowPPException; + ThrowImageException; } void Magick::Image::read(const Blob &blob_) @@ -3875,7 +3914,7 @@ void Magick::Image::read(const size_t width_,const size_t height_, newImage=ConstituteImage(width_,height_,map_.c_str(),type_, pixels_, exceptionInfo); replaceImage(newImage); - ThrowPPException; + ThrowImageException; } void Magick::Image::read(const std::string &imageSpec_) @@ -3900,7 +3939,7 @@ void Magick::Image::readPixels(const Magick::QuantumType quantum_, ImportQuantumPixels(image(),(MagickCore::CacheView *) NULL,quantum_info, quantum_,source_,exceptionInfo); quantum_info=DestroyQuantumInfo(quantum_info); - ThrowPPException; + ThrowImageException; } void Magick::Image::reduceNoise(void) @@ -3917,7 +3956,7 @@ void Magick::Image::reduceNoise(const double order_) newImage=StatisticImage(constImage(),NonpeakStatistic,(size_t) order_, (size_t) order_,exceptionInfo); replaceImage(newImage); - ThrowPPException; + ThrowImageException; } void Magick::Image::resample(const Point &density_) @@ -3929,7 +3968,7 @@ void Magick::Image::resample(const Point &density_) newImage=ResampleImage(constImage(),density_.x(),density_.y(), image()->filter,exceptionInfo); replaceImage(newImage); - ThrowPPException; + ThrowImageException; } void Magick::Image::resize(const Geometry &geometry_) @@ -3954,7 +3993,7 @@ void Magick::Image::resize(const Geometry &geometry_) newImage=ResizeImage(constImage(),width,height,image()->filter, exceptionInfo); replaceImage(newImage); - ThrowPPException; + ThrowImageException; } void Magick::Image::roll(const Geometry &roll_) @@ -3965,7 +4004,7 @@ void Magick::Image::roll(const Geometry &roll_) GetPPException; newImage=RollImage(constImage(),roll_.xOff(),roll_.yOff(),exceptionInfo); replaceImage(newImage); - ThrowPPException; + ThrowImageException; } void Magick::Image::roll(const size_t columns_,const size_t rows_) @@ -3977,7 +4016,7 @@ void Magick::Image::roll(const size_t columns_,const size_t rows_) newImage=RollImage(constImage(),static_cast(columns_), static_cast(rows_),exceptionInfo); replaceImage(newImage); - ThrowPPException; + ThrowImageException; } void Magick::Image::rotate(const double degrees_) @@ -3988,7 +4027,7 @@ void Magick::Image::rotate(const double degrees_) GetPPException; newImage=RotateImage(constImage(),degrees_,exceptionInfo); replaceImage(newImage); - ThrowPPException; + ThrowImageException; } void Magick::Image::rotationalBlur(const double angle_) @@ -3999,7 +4038,7 @@ void Magick::Image::rotationalBlur(const double angle_) GetPPException; newImage=RotationalBlurImage(constImage(),angle_,exceptionInfo); replaceImage(newImage); - ThrowPPException; + ThrowImageException; } void Magick::Image::rotationalBlurChannel(const ChannelType channel_, @@ -4013,7 +4052,7 @@ void Magick::Image::rotationalBlurChannel(const ChannelType channel_, newImage=RotationalBlurImage(constImage(),angle_,exceptionInfo); RestorePPChannelMask; replaceImage(newImage); - ThrowPPException; + ThrowImageException; } void Magick::Image::sample(const Geometry &geometry_) @@ -4035,7 +4074,7 @@ void Magick::Image::sample(const Geometry &geometry_) GetPPException; newImage=SampleImage(constImage(),width,height,exceptionInfo); replaceImage(newImage); - ThrowPPException; + ThrowImageException; } void Magick::Image::scale(const Geometry &geometry_) @@ -4057,7 +4096,7 @@ void Magick::Image::scale(const Geometry &geometry_) GetPPException; newImage=ScaleImage(constImage(),width,height,exceptionInfo); replaceImage(newImage); - ThrowPPException; + ThrowImageException; } void Magick::Image::segment(const double clusterThreshold_, @@ -4069,7 +4108,7 @@ void Magick::Image::segment(const double clusterThreshold_, (MagickBooleanType) options()->verbose(),clusterThreshold_, smoothingThreshold_,exceptionInfo); SyncImage(image(),exceptionInfo); - ThrowPPException; + ThrowImageException; } void Magick::Image::selectiveBlur(const double radius_,const double sigma_, @@ -4082,7 +4121,7 @@ void Magick::Image::selectiveBlur(const double radius_,const double sigma_, newImage=SelectiveBlurImage(constImage(),radius_,sigma_,threshold_, exceptionInfo); replaceImage(newImage); - ThrowPPException; + ThrowImageException; } void Magick::Image::selectiveBlurChannel(const ChannelType channel_, @@ -4097,7 +4136,7 @@ void Magick::Image::selectiveBlurChannel(const ChannelType channel_, exceptionInfo); RestorePPChannelMask; replaceImage(newImage); - ThrowPPException; + ThrowImageException; } Magick::Image Magick::Image::separate(const ChannelType channel_) @@ -4107,7 +4146,7 @@ Magick::Image Magick::Image::separate(const ChannelType channel_) GetPPException; image=SeparateImage(constImage(),channel_,exceptionInfo); - ThrowPPException; + ThrowImageException; if (image == (MagickCore::Image *) NULL) return(Magick::Image()); else @@ -4122,7 +4161,7 @@ void Magick::Image::sepiaTone(const double threshold_) GetPPException; newImage=SepiaToneImage(constImage(),threshold_,exceptionInfo); replaceImage(newImage); - ThrowPPException; + ThrowImageException; } Magick::Quantum *Magick::Image::setPixels(const ssize_t x_,const ssize_t y_, @@ -4134,7 +4173,7 @@ Magick::Quantum *Magick::Image::setPixels(const ssize_t x_,const ssize_t y_, modifyImage(); GetPPException; result=(*QueueAuthenticPixels)(image(),x_,y_,columns_,rows_,exceptionInfo); - ThrowPPException; + ThrowImageException; return(result); } @@ -4148,7 +4187,7 @@ void Magick::Image::shade(const double azimuth_,const double elevation_, newImage=ShadeImage(constImage(),colorShading_ == true ? MagickTrue : MagickFalse,azimuth_,elevation_,exceptionInfo); replaceImage(newImage); - ThrowPPException; + ThrowImageException; } void Magick::Image::shadow(const double percent_opacity_,const double sigma_, @@ -4161,7 +4200,7 @@ void Magick::Image::shadow(const double percent_opacity_,const double sigma_, newImage=ShadowImage(constImage(),percent_opacity_, sigma_,x_, y_, exceptionInfo); replaceImage(newImage); - ThrowPPException; + ThrowImageException; } void Magick::Image::sharpen(const double radius_,const double sigma_) @@ -4172,7 +4211,7 @@ void Magick::Image::sharpen(const double radius_,const double sigma_) GetPPException; newImage=SharpenImage(constImage(),radius_,sigma_,exceptionInfo); replaceImage(newImage); - ThrowPPException; + ThrowImageException; } void Magick::Image::sharpenChannel(const ChannelType channel_, @@ -4186,7 +4225,7 @@ void Magick::Image::sharpenChannel(const ChannelType channel_, newImage=SharpenImage(constImage(),radius_,sigma_,exceptionInfo); RestorePPChannelMask; replaceImage(newImage); - ThrowPPException; + ThrowImageException; } void Magick::Image::shave(const Geometry &geometry_) @@ -4200,7 +4239,7 @@ void Magick::Image::shave(const Geometry &geometry_) GetPPException; newImage=ShaveImage(constImage(),&shaveInfo,exceptionInfo); replaceImage(newImage); - ThrowPPException; + ThrowImageException; } void Magick::Image::shear(const double xShearAngle_,const double yShearAngle_) @@ -4211,7 +4250,7 @@ void Magick::Image::shear(const double xShearAngle_,const double yShearAngle_) GetPPException; newImage=ShearImage(constImage(),xShearAngle_,yShearAngle_,exceptionInfo); replaceImage(newImage); - ThrowPPException; + ThrowImageException; } void Magick::Image::sigmoidalContrast(const size_t sharpen_, @@ -4221,7 +4260,7 @@ void Magick::Image::sigmoidalContrast(const size_t sharpen_, GetPPException; (void) SigmoidalContrastImage(image(),(MagickBooleanType) sharpen_,contrast, midpoint,exceptionInfo); - ThrowPPException; + ThrowImageException; } std::string Magick::Image::signature(const bool force_) const @@ -4238,7 +4277,7 @@ void Magick::Image::sketch(const double radius_,const double sigma_, GetPPException; newImage=SketchImage(constImage(),radius_,sigma_,angle_,exceptionInfo); replaceImage(newImage); - ThrowPPException; + ThrowImageException; } void Magick::Image::solarize(const double factor_) @@ -4246,7 +4285,7 @@ void Magick::Image::solarize(const double factor_) modifyImage(); GetPPException; SolarizeImage(image(),factor_,exceptionInfo); - ThrowPPException; + ThrowImageException; } void Magick::Image::sparseColor(const ChannelType channel_, @@ -4262,7 +4301,7 @@ void Magick::Image::sparseColor(const ChannelType channel_, exceptionInfo); RestorePPChannelMask; replaceImage(newImage); - ThrowPPException; + ThrowImageException; } void Magick::Image::splice(const Geometry &geometry_) @@ -4276,7 +4315,7 @@ void Magick::Image::splice(const Geometry &geometry_) GetPPException; newImage=SpliceImage(constImage(),&spliceInfo,exceptionInfo); replaceImage(newImage); - ThrowPPException; + ThrowImageException; } void Magick::Image::spread(const size_t amount_) @@ -4288,12 +4327,12 @@ void Magick::Image::spread(const size_t amount_) newImage=SpreadImage(constImage(),amount_,image()->interpolate, exceptionInfo); replaceImage(newImage); - ThrowPPException; + ThrowImageException; } Magick::ImageStatistics Magick::Image::statistics() { - return(ImageStatistics(constImage())); + return(ImageStatistics(*this)); } void Magick::Image::stegano(const Image &watermark_) @@ -4304,7 +4343,7 @@ void Magick::Image::stegano(const Image &watermark_) GetPPException; newImage=SteganoImage(constImage(),watermark_.constImage(),exceptionInfo); replaceImage(newImage); - ThrowPPException; + ThrowImageException; } void Magick::Image::stereo(const Image &rightImage_) @@ -4315,7 +4354,7 @@ void Magick::Image::stereo(const Image &rightImage_) GetPPException; newImage=StereoImage(constImage(),rightImage_.constImage(),exceptionInfo); replaceImage(newImage); - ThrowPPException; + ThrowImageException; } void Magick::Image::strip(void) @@ -4323,7 +4362,7 @@ void Magick::Image::strip(void) modifyImage(); GetPPException; StripImage(image(),exceptionInfo); - ThrowPPException; + ThrowImageException; } Magick::Image Magick::Image::subImageSearch(const Image &reference_, @@ -4339,7 +4378,7 @@ Magick::Image Magick::Image::subImageSearch(const Image &reference_, GetPPException; newImage=SimilarityImage(image(),reference_.constImage(),metric_, similarityThreshold,&offset,similarityMetric_,exceptionInfo); - ThrowPPException; + ThrowImageException; if (offset_ != (Geometry *) NULL) *offset_=offset; if (newImage == (MagickCore::Image *) NULL) @@ -4357,14 +4396,14 @@ void Magick::Image::swirl(const double degrees_) newImage=SwirlImage(constImage(),degrees_,image()->interpolate, exceptionInfo); replaceImage(newImage); - ThrowPPException; + ThrowImageException; } void Magick::Image::syncPixels(void) { GetPPException; (void) (*SyncAuthenticPixels)(image(),exceptionInfo); - ThrowPPException; + ThrowImageException; } void Magick::Image::texture(const Image &texture_) @@ -4372,7 +4411,7 @@ void Magick::Image::texture(const Image &texture_) modifyImage(); GetPPException; TextureImage(image(),texture_.constImage(),exceptionInfo); - ThrowPPException; + ThrowImageException; } void Magick::Image::threshold(const double threshold_) @@ -4380,7 +4419,7 @@ void Magick::Image::threshold(const double threshold_) modifyImage(); GetPPException; BilevelImage(image(),threshold_,exceptionInfo); - ThrowPPException; + ThrowImageException; } void Magick::Image::thumbnail(const Geometry &geometry_) @@ -4402,7 +4441,7 @@ void Magick::Image::thumbnail(const Geometry &geometry_) GetPPException; newImage=ThumbnailImage(constImage(),width,height,exceptionInfo); replaceImage(newImage); - ThrowPPException; + ThrowImageException; } void Magick::Image::tint(const std::string opacity_) @@ -4417,7 +4456,7 @@ void Magick::Image::tint(const std::string opacity_) color=static_cast(constOptions()->fillColor()); newImage=TintImage(constImage(),opacity_.c_str(),&color,exceptionInfo); replaceImage(newImage); - ThrowPPException; + ThrowImageException; } void Magick::Image::transform(const Geometry &imageGeometry_) @@ -4426,7 +4465,7 @@ void Magick::Image::transform(const Geometry &imageGeometry_) GetPPException; TransformImage(&(image()),0,std::string(imageGeometry_).c_str(), exceptionInfo); - ThrowPPException; + ThrowImageException; } void Magick::Image::transform(const Geometry &imageGeometry_, @@ -4436,7 +4475,7 @@ void Magick::Image::transform(const Geometry &imageGeometry_, GetPPException; TransformImage(&(image()),std::string(cropGeometry_).c_str(),std::string( imageGeometry_).c_str(), exceptionInfo); - ThrowPPException; + ThrowImageException; } void Magick::Image::transformOrigin(const double x_,const double y_) @@ -4466,7 +4505,8 @@ void Magick::Image::transparent(const Color &color_) color; if (!color_.isValid()) - throwExceptionExplicit(OptionError,"Color argument is invalid"); + throwExceptionExplicit(MagickCore::OptionError, + "Color argument is invalid"); color=color_; GetPPException; @@ -4475,7 +4515,7 @@ void Magick::Image::transparent(const Color &color_) modifyImage(); TransparentPaintImage(image(),&target,TransparentAlpha,MagickFalse, exceptionInfo); - ThrowPPException; + ThrowImageException; } void Magick::Image::transparentChroma(const Color &colorLow_, @@ -4490,7 +4530,8 @@ void Magick::Image::transparentChroma(const Color &colorLow_, targetLow; if (!colorLow_.isValid() || !colorHigh_.isValid()) - throwExceptionExplicit(OptionError,"Color argument is invalid"); + throwExceptionExplicit(MagickCore::OptionError, + "Color argument is invalid"); colorLow=colorLow_; colorHigh=colorHigh_; @@ -4503,7 +4544,7 @@ void Magick::Image::transparentChroma(const Color &colorLow_, modifyImage(); TransparentPaintImageChroma(image(),&targetLow,&targetHigh,TransparentAlpha, MagickFalse,exceptionInfo); - ThrowPPException; + ThrowImageException; } void Magick::Image::transpose(void) @@ -4514,7 +4555,7 @@ void Magick::Image::transpose(void) GetPPException; newImage=TransposeImage(constImage(),exceptionInfo); replaceImage(newImage); - ThrowPPException; + ThrowImageException; } void Magick::Image::transverse(void) @@ -4525,7 +4566,7 @@ void Magick::Image::transverse(void) GetPPException; newImage=TransverseImage(constImage(),exceptionInfo); replaceImage(newImage); - ThrowPPException; + ThrowImageException; } void Magick::Image::trim(void) @@ -4536,7 +4577,7 @@ void Magick::Image::trim(void) GetPPException; newImage=TrimImage(constImage(),exceptionInfo); replaceImage(newImage); - ThrowPPException; + ThrowImageException; } Magick::Image Magick::Image::uniqueColors(void) @@ -4546,7 +4587,7 @@ Magick::Image Magick::Image::uniqueColors(void) GetPPException; image=UniqueImageColors(constImage(),exceptionInfo); - ThrowPPException; + ThrowImageException; if (image == (MagickCore::Image *) NULL) return(Magick::Image()); else @@ -4563,7 +4604,7 @@ void Magick::Image::unsharpmask(const double radius_,const double sigma_, newImage=UnsharpMaskImage(constImage(),radius_,sigma_,amount_,threshold_, exceptionInfo); replaceImage(newImage); - ThrowPPException; + ThrowImageException; } void Magick::Image::unsharpmaskChannel(const ChannelType channel_, @@ -4579,7 +4620,7 @@ void Magick::Image::unsharpmaskChannel(const ChannelType channel_, exceptionInfo); RestorePPChannelMask; replaceImage(newImage); - ThrowPPException; + ThrowImageException; } void Magick::Image::vignette(const double radius_,const double sigma_, @@ -4591,7 +4632,7 @@ void Magick::Image::vignette(const double radius_,const double sigma_, GetPPException; newImage=VignetteImage(constImage(),radius_,sigma_,x_,y_,exceptionInfo); replaceImage(newImage); - ThrowPPException; + ThrowImageException; } void Magick::Image::wave(const double amplitude_,const double wavelength_) @@ -4603,7 +4644,7 @@ void Magick::Image::wave(const double amplitude_,const double wavelength_) newImage=WaveImage(constImage(),amplitude_,wavelength_,image()->interpolate, exceptionInfo); replaceImage(newImage); - ThrowPPException; + ThrowImageException; } void Magick::Image::whiteThreshold(const std::string &threshold_) @@ -4611,7 +4652,7 @@ void Magick::Image::whiteThreshold(const std::string &threshold_) modifyImage(); GetPPException; WhiteThresholdImage(image(),threshold_.c_str(),exceptionInfo); - ThrowPPException; + ThrowImageException; } void Magick::Image::whiteThresholdChannel(const ChannelType channel_, @@ -4622,7 +4663,7 @@ void Magick::Image::whiteThresholdChannel(const ChannelType channel_, SetPPChannelMask(channel_); WhiteThresholdImage(image(),threshold_.c_str(),exceptionInfo); RestorePPChannelMask; - ThrowPPException; + ThrowImageException; } void Magick::Image::write(Blob *blob_) @@ -4638,7 +4679,7 @@ void Magick::Image::write(Blob *blob_) data=ImagesToBlob(constImageInfo(),image(),&length,exceptionInfo); if (length > 0) blob_->updateNoCopy(data,length,Blob::MallocAllocator); - ThrowPPException; + ThrowImageException; } void Magick::Image::write(Blob *blob_,const std::string &magick_) @@ -4655,7 +4696,7 @@ void Magick::Image::write(Blob *blob_,const std::string &magick_) data=ImagesToBlob(constImageInfo(),image(),&length,exceptionInfo); if (length > 0) blob_->updateNoCopy(data,length,Blob::MallocAllocator); - ThrowPPException; + ThrowImageException; } void Magick::Image::write(Blob *blob_,const std::string &magick_, @@ -4674,7 +4715,7 @@ void Magick::Image::write(Blob *blob_,const std::string &magick_, data=ImagesToBlob(constImageInfo(),image(),&length,exceptionInfo); if (length > 0) blob_->updateNoCopy(data,length,Blob::MallocAllocator); - ThrowPPException; + ThrowImageException; } void Magick::Image::write(const ssize_t x_,const ssize_t y_, @@ -4684,7 +4725,7 @@ void Magick::Image::write(const ssize_t x_,const ssize_t y_, GetPPException; ExportImagePixels(image(),x_,y_,columns_,rows_,map_.c_str(),type_,pixels_, exceptionInfo); - ThrowPPException; + ThrowImageException; } void Magick::Image::write(const std::string &imageSpec_) @@ -4693,7 +4734,7 @@ void Magick::Image::write(const std::string &imageSpec_) fileName(imageSpec_); GetPPException; WriteImage(constImageInfo(),image(),exceptionInfo); - ThrowPPException; + ThrowImageException; } void Magick::Image::writePixels(const Magick::QuantumType quantum_, @@ -4707,7 +4748,7 @@ void Magick::Image::writePixels(const Magick::QuantumType quantum_, ExportQuantumPixels(image(),(MagickCore::CacheView *) NULL,quantum_info, quantum_,destination_, exceptionInfo); quantum_info=DestroyQuantumInfo(quantum_info); - ThrowPPException; + ThrowImageException; } void Magick::Image::zoom(const Geometry &geometry_) @@ -4729,11 +4770,12 @@ void Magick::Image::zoom(const Geometry &geometry_) GetPPException; newImage=ResizeImage(constImage(),width,height,image()->filter,exceptionInfo); replaceImage(newImage); - ThrowPPException; + ThrowImageException; } Magick::Image::Image(MagickCore::Image *image_) - : _imgRef(new ImageRef(image_)) + : _imgRef(new ImageRef(image_)), + _quiet(false) { } @@ -4784,7 +4826,7 @@ void Magick::Image::modifyImage(void) GetPPException; replaceImage(CloneImage(image(),0,0,MagickTrue,exceptionInfo)); - ThrowPPException; + ThrowImageException; } MagickCore::Image *Magick::Image::replaceImage(MagickCore::Image *replacement_) @@ -4798,7 +4840,7 @@ MagickCore::Image *Magick::Image::replaceImage(MagickCore::Image *replacement_) { GetPPException; image=AcquireImage(constImageInfo(),exceptionInfo); - ThrowPPException; + ThrowImageException; } // We can replace the image if we own it. @@ -4835,9 +4877,11 @@ void Magick::Image::read(MagickCore::Image *image, image == (MagickCore::Image *) NULL) { (void) MagickCore::DestroyExceptionInfo(exceptionInfo); - throwExceptionExplicit(ImageWarning,"No image was loaded."); + if (!_quiet) + throwExceptionExplicit(MagickCore::ImageWarning, + "No image was loaded."); } - ThrowPPException; + ThrowImageException; } void Magick::Image::floodFill(const ssize_t x_,const ssize_t y_, @@ -4858,7 +4902,7 @@ void Magick::Image::floodFill(const ssize_t x_,const ssize_t y_, GetPPException; fillPattern=CloneImage(options()->fillPattern(),0,0,MagickTrue, exceptionInfo); - ThrowPPException; + ThrowImageException; } if (fillPattern_ == (Magick::Image *)NULL) @@ -4876,5 +4920,5 @@ void Magick::Image::floodFill(const ssize_t x_,const ssize_t y_, options()->fillColor(fillColor); options()->fillPattern(fillPattern); - ThrowPPException; + ThrowImageException; } diff --git a/Magick++/lib/ImageRef.cpp b/Magick++/lib/ImageRef.cpp index b1f6a77a3..c8b7b1936 100644 --- a/Magick++/lib/ImageRef.cpp +++ b/Magick++/lib/ImageRef.cpp @@ -1,7 +1,7 @@ // This may look like C code, but it is really -*- C++ -*- // // Copyright Bob Friesenhahn, 1999, 2000, 2001, 2002 -// Copyright Dirk Lemstra 2014 +// Copyright Dirk Lemstra 2014-2015 // // Implementation of ImageRef // @@ -23,7 +23,7 @@ Magick::ImageRef::ImageRef(void) { GetPPException; _image=AcquireImage(_options->imageInfo(),exceptionInfo); - ThrowPPException; + ThrowPPException(false); } Magick::ImageRef::ImageRef(MagickCore::Image *image_) @@ -63,7 +63,8 @@ size_t Magick::ImageRef::decrease() if (_refCount == 0) { _mutexLock.unlock(); - throwExceptionExplicit(OptionError,"Invalid call to decrease"); + throwExceptionExplicit(MagickCore::OptionError, + "Invalid call to decrease"); } count=--_refCount; _mutexLock.unlock(); @@ -139,7 +140,7 @@ std::string Magick::ImageRef::signature(const bool force_) property=GetImageProperty(_image,"Signature",exceptionInfo); } _mutexLock.unlock(); - ThrowPPException; + ThrowPPException(true); return(std::string(property)); } diff --git a/Magick++/lib/Magick++/Exception.h b/Magick++/lib/Magick++/Exception.h index f3162d407..a059dfb22 100644 --- a/Magick++/lib/Magick++/Exception.h +++ b/Magick++/lib/Magick++/Exception.h @@ -1,7 +1,7 @@ // This may look like C code, but it is really -*- C++ -*- // // Copyright Bob Friesenhahn, 1999, 2000, 2001, 2002, 2003 -// Copyright Dirk Lemstra 2014 +// Copyright Dirk Lemstra 2014-2015 // // Definition of Magick::Exception and derived classes // Magick::Warning* and Magick::Error*. Derived from C++ STD @@ -418,7 +418,7 @@ namespace Magick // Thow exception based on ImageMagick's ExceptionInfo extern MagickPPExport void throwException( - MagickCore::ExceptionInfo *exception_); + MagickCore::ExceptionInfo *exception_,const bool quiet_); } // namespace Magick diff --git a/Magick++/lib/Magick++/Image.h b/Magick++/lib/Magick++/Image.h index 1cc474fc9..c2c835f68 100644 --- a/Magick++/lib/Magick++/Image.h +++ b/Magick++/lib/Magick++/Image.h @@ -1,7 +1,7 @@ // This may look like C code, but it is really -*- C++ -*- // // Copyright Bob Friesenhahn, 1999, 2000, 2001, 2002, 2003 -// Copyright Dirk Lemstra 2013-2014 +// Copyright Dirk Lemstra 2013-2015 // // Definition of Image, the representation of a single image in Magick++ // @@ -370,6 +370,10 @@ namespace Magick void quantizeTreeDepth(const size_t treeDepth_); size_t quantizeTreeDepth(void) const; + // Suppress all warning messages. Error messages are still reported. + void quiet(const bool quiet_); + bool quiet(void) const; + // The type of rendering intent void renderingIntent(const RenderingIntent renderingIntent_); RenderingIntent renderingIntent(void) const; @@ -1475,6 +1479,7 @@ namespace Magick const PixelInfo *target,const bool invert_); ImageRef *_imgRef; + bool _quiet; }; } // end of namespace Magick diff --git a/Magick++/lib/Magick++/Include.h b/Magick++/lib/Magick++/Include.h index 3d7d84198..ec68397cf 100644 --- a/Magick++/lib/Magick++/Include.h +++ b/Magick++/lib/Magick++/Include.h @@ -1,7 +1,7 @@ // This may look like C code, but it is really -*- C++ -*- // // Copyright Bob Friesenhahn, 1999, 2000, 2001, 2002 -// Copyright Dirk Lemstra 2013-2014 +// Copyright Dirk Lemstra 2013-2015 // // Inclusion of ImageMagick headers (with namespace magic) @@ -1076,17 +1076,11 @@ namespace Magick using MagickCore::Base64Encode; using MagickCore::BilevelImage; using MagickCore::BlackThresholdImage; - using MagickCore::BlobError; - using MagickCore::BlobFatalError; using MagickCore::BlobToImage; - using MagickCore::BlobWarning; using MagickCore::BlueShiftImage; using MagickCore::BlurImage; using MagickCore::BrightnessContrastImage; using MagickCore::BorderImage; - using MagickCore::CacheError; - using MagickCore::CacheFatalError; - using MagickCore::CacheWarning; using MagickCore::CharcoalImage; using MagickCore::CannyEdgeImage; using MagickCore::ChopImage; @@ -1098,9 +1092,6 @@ namespace Magick using MagickCore::CloneImageInfo; using MagickCore::CloneQuantizeInfo; using MagickCore::ClutImage; - using MagickCore::CoderError; - using MagickCore::CoderFatalError; - using MagickCore::CoderWarning; using MagickCore::ColorDecisionListImage; using MagickCore::ColorizeImage; using MagickCore::ColorMatrixImage; @@ -1108,9 +1099,6 @@ namespace Magick using MagickCore::CompareImages; using MagickCore::CompareImagesLayers; using MagickCore::CompositeImage; - using MagickCore::ConfigureError; - using MagickCore::ConfigureFatalError; - using MagickCore::ConfigureWarning; using MagickCore::ConnectedComponentsImage; using MagickCore::ConstituteImage; using MagickCore::ContrastImage; @@ -1119,16 +1107,10 @@ namespace Magick using MagickCore::ConvertRGBToHSL; using MagickCore::ConvolveImage; using MagickCore::CopyMagickString; - using MagickCore::CorruptImageError; - using MagickCore::CorruptImageFatalError; - using MagickCore::CorruptImageWarning; using MagickCore::CropImage; using MagickCore::CropImageToTiles; using MagickCore::CycleColormapImage; using MagickCore::DecipherImage; - using MagickCore::DelegateError; - using MagickCore::DelegateFatalError; - using MagickCore::DelegateWarning; using MagickCore::DeleteImageOption; using MagickCore::DeleteImageRegistry; using MagickCore::DeskewImage; @@ -1158,8 +1140,6 @@ namespace Magick using MagickCore::DrawComment; using MagickCore::DrawComposite; using MagickCore::DrawEllipse; - using MagickCore::DrawError; - using MagickCore::DrawFatalError; using MagickCore::DrawImage; using MagickCore::DrawInfo; using MagickCore::DrawingWand; @@ -1235,7 +1215,6 @@ namespace Magick using MagickCore::DrawSkewX; using MagickCore::DrawSkewY; using MagickCore::DrawTranslate; - using MagickCore::DrawWarning; using MagickCore::EdgeImage; using MagickCore::EmbossImage; using MagickCore::EncipherImage; @@ -1243,13 +1222,9 @@ namespace Magick using MagickCore::EqualizeImage; using MagickCore::EvaluateImage; using MagickCore::ExceptionInfo; - using MagickCore::ExceptionType; using MagickCore::ExportImagePixels; using MagickCore::ExportQuantumPixels; using MagickCore::ExtentImage; - using MagickCore::FileOpenError; - using MagickCore::FileOpenFatalError; - using MagickCore::FileOpenWarning; using MagickCore::FlipImage; using MagickCore::FloodfillPaintImage; using MagickCore::FlopImage; @@ -1314,13 +1289,10 @@ namespace Magick using MagickCore::HaldClutImage; using MagickCore::HeightValue; using MagickCore::HoughLineImage; - using MagickCore::ImageError; - using MagickCore::ImageFatalError; using MagickCore::ImageInfo; using MagickCore::ImageRegistryType; using MagickCore::ImageToBlob; using MagickCore::ImagesToBlob; - using MagickCore::ImageWarning; using MagickCore::ImplodeImage; using MagickCore::ImportQuantumPixels; using MagickCore::InterpretImageProperties; @@ -1349,16 +1321,7 @@ namespace Magick using MagickCore::MergeImageLayers; using MagickCore::MinifyImage; using MagickCore::MinimumValue; - using MagickCore::MissingDelegateError; - using MagickCore::MissingDelegateFatalError; - using MagickCore::MissingDelegateWarning; using MagickCore::ModulateImage; - using MagickCore::ModuleError; - using MagickCore::ModuleFatalError; - using MagickCore::ModuleWarning; - using MagickCore::MonitorError; - using MagickCore::MonitorFatalError; - using MagickCore::MonitorWarning; using MagickCore::MontageInfo; using MagickCore::MorphologyImage; using MagickCore::MotionBlurImage; @@ -1371,9 +1334,6 @@ namespace Magick using MagickCore::OilPaintImage; using MagickCore::OpaquePaintImage; using MagickCore::OrderedPosterizeImage; - using MagickCore::OptionError; - using MagickCore::OptionFatalError; - using MagickCore::OptionWarning; using MagickCore::OptimizeImageLayers; using MagickCore::OptimizeImageTransparency; using MagickCore::OptimizePlusImageLayers; @@ -1386,9 +1346,6 @@ namespace Magick using MagickCore::PixelWand; using MagickCore::PointInfo; using MagickCore::PolaroidImage; - using MagickCore::PolicyWarning; - using MagickCore::PolicyError; - using MagickCore::PolicyFatalError; using MagickCore::PopDrawingWand; using MagickCore::PosterizeImage; using MagickCore::ProfileImage; @@ -1404,19 +1361,13 @@ namespace Magick using MagickCore::ReadImage; using MagickCore::RectangleInfo; using MagickCore::RegisterMagickInfo; - using MagickCore::RegistryError; - using MagickCore::RegistryFatalError; using MagickCore::RegistryType; - using MagickCore::RegistryWarning; using MagickCore::RelinquishMagickMemory; using MagickCore::RemapImage; using MagickCore::ResampleImage; using MagickCore::ResetLinkedListIterator; using MagickCore::ResizeImage; using MagickCore::ResizeMagickMemory; - using MagickCore::ResourceLimitError; - using MagickCore::ResourceLimitFatalError; - using MagickCore::ResourceLimitWarning; using MagickCore::RollImage; using MagickCore::RotateImage; using MagickCore::RotationalBlurImage; @@ -1467,9 +1418,6 @@ namespace Magick using MagickCore::StatisticImage; using MagickCore::SteganoImage; using MagickCore::StereoImage; - using MagickCore::StreamError; - using MagickCore::StreamFatalError; - using MagickCore::StreamWarning; using MagickCore::StringInfo; using MagickCore::StripImage; using MagickCore::SwirlImage; @@ -1486,10 +1434,6 @@ namespace Magick using MagickCore::TransposeImage; using MagickCore::TransverseImage; using MagickCore::TrimImage; - using MagickCore::TypeError; - using MagickCore::TypeFatalError; - using MagickCore::TypeWarning; - using MagickCore::UndefinedException; using MagickCore::UndefinedRegistryType; using MagickCore::UniqueImageColors; using MagickCore::UnlockSemaphoreInfo; @@ -1502,9 +1446,6 @@ namespace Magick using MagickCore::WidthValue; using MagickCore::WriteImage; using MagickCore::XNegative; - using MagickCore::XServerError; - using MagickCore::XServerFatalError; - using MagickCore::XServerWarning; using MagickCore::XValue; using MagickCore::YNegative; using MagickCore::YValue; @@ -1532,11 +1473,11 @@ namespace Magick MagickCore::ChannelType \ channel_mask; \ channel_mask=MagickCore::SetImageChannelMask(image(),channel) -#define ThrowPPDrawException \ - throwException(exceptionInfo); \ +#define ThrowPPDrawException(quiet) \ + throwException(exceptionInfo,quiet); \ (void) MagickCore::DestroyExceptionInfo(exceptionInfo) -#define ThrowPPException \ - throwException(exceptionInfo); \ +#define ThrowPPException(quiet) \ + throwException(exceptionInfo,quiet); \ (void) MagickCore::DestroyExceptionInfo(exceptionInfo) #endif // Magick_Include_header diff --git a/Magick++/lib/Magick++/STL.h b/Magick++/lib/Magick++/STL.h index bef88f392..2168bfa36 100644 --- a/Magick++/lib/Magick++/STL.h +++ b/Magick++/lib/Magick++/STL.h @@ -1,7 +1,7 @@ // This may look like C code, but it is really -*- C++ -*- // // Copyright Bob Friesenhahn, 1999, 2000, 2001, 2002, 2003 -// Copyright Dirk Lemstra 2013-2014 +// Copyright Dirk Lemstra 2013-2015 // // Definition and implementation of template functions for using // Magick::Image with STL containers. @@ -877,6 +877,10 @@ namespace Magick void depth(size_t depth_); size_t depth(void) const; + // Suppress all warning messages. Error messages are still reported. + void quiet(const bool quiet_); + bool quiet(void) const; + // Image size (required for raw formats) void size(const Geometry &geometry_); Geometry size(void) const; @@ -893,6 +897,7 @@ namespace Magick ReadOptions& operator=(const ReadOptions&); MagickCore::ImageInfo *_imageInfo; + bool _quiet; }; // Reduce noise in image using a noise peak elimination filter @@ -2011,7 +2016,7 @@ namespace Magick exceptionInfo ); unlinkImages( first_, last_ ); appendedImage_->replaceImage( image ); - ThrowPPException; + ThrowPPException(appendedImage_->quiet()); } // Average a set of images. @@ -2026,7 +2031,7 @@ namespace Magick MagickCore::MeanEvaluateOperator, exceptionInfo ); unlinkImages( first_, last_ ); averagedImage_->replaceImage( image ); - ThrowPPException; + ThrowPPException(averagedImage_->quiet()); } // Merge a sequence of images. @@ -2054,7 +2059,7 @@ namespace Magick insertImages( coalescedImages_, images ); // Report any error - ThrowPPException; + ThrowPPException(first_->quiet()); } // Return format coders matching specified conditions. @@ -2079,7 +2084,7 @@ namespace Magick MagickCore::GetMagickList( "*", &number_formats, exceptionInfo ); if( !coder_list ) { - throwException( exceptionInfo ); + throwException( exceptionInfo, true ); throwExceptionExplicit(MagickCore::MissingDelegateError, "Coder array not returned!", 0 ); } @@ -2129,7 +2134,7 @@ namespace Magick } } coder_list=(char **) MagickCore::RelinquishMagickMemory( coder_list ); - ThrowPPException; + ThrowPPException(true); } // @@ -2181,7 +2186,7 @@ namespace Magick size_t colors; MagickCore::PixelInfo *histogram_array = MagickCore::GetImageHistogram( image.constImage(), &colors, exceptionInfo ); - ThrowPPException; + ThrowPPException(image.quiet()); // Clear out container histogram_->clear(); @@ -2220,7 +2225,7 @@ namespace Magick restoreChannelMaskImages(first_,last_,&channelMask); unlinkImages(first_,last_); combinedImage_->replaceImage(image); - ThrowPPException; + ThrowPPException(combinedImage_->quiet()); } template @@ -2232,7 +2237,7 @@ namespace Magick static_cast(geometry_).c_str(),exceptionInfo); tiledImages_->clear(); insertImages(tiledImages_,images); - ThrowPPException; + ThrowPPException(image_.quiet()); } // Break down an image sequence into constituent parts. This is @@ -2252,7 +2257,7 @@ namespace Magick deconstructedImages_->clear(); insertImages(deconstructedImages_,images); - ThrowPPException; + ThrowPPException(first_->quiet()); } // @@ -2265,7 +2270,7 @@ namespace Magick linkImages( first_, last_ ); MagickCore::DisplayImages( first_->imageInfo(), first_->image() ); unlinkImages( first_, last_ ); - ThrowPPException; + ThrowPPException(first_->quiet()); } // Applies a value to the image with an arithmetic, relational, @@ -2282,7 +2287,7 @@ namespace Magick MagickCore::Image* image = EvaluateImages( first_->image(), operator_, exceptionInfo ); unlinkImages( first_, last_ ); evaluatedImage_->replaceImage( image ); - ThrowPPException; + ThrowPPException(evaluatedImage_->quiet()); } // Merge a sequence of image frames which represent image layers. @@ -2297,7 +2302,7 @@ namespace Magick FlattenLayer,exceptionInfo ); unlinkImages( first_, last_ ); flattendImage_->replaceImage( image ); - ThrowPPException; + ThrowPPException(flattendImage_->quiet()); } // Implements the discrete Fourier transform (DFT) of the image either as a @@ -2318,7 +2323,7 @@ namespace Magick insertImages( fourierImages_, images ); // Report any error - ThrowPPException; + ThrowPPException(image_->quiet()); } template void forwardFourierTransformImage( Container *fourierImages_, @@ -2337,7 +2342,7 @@ namespace Magick insertImages( fourierImages_, images ); // Report any error - ThrowPPException; + ThrowPPException(image_->quiet()); } // Applies a mathematical expression to a sequence of images. @@ -2353,7 +2358,7 @@ namespace Magick image=FxImage(first_->constImage(),expression.c_str(),exceptionInfo); unlinkImages(first_,last_); fxImage_->replaceImage(image); - ThrowPPException; + ThrowPPException(fxImage_->quiet()); } // Replace the colors of a sequence of images with the closest color @@ -2382,7 +2387,7 @@ namespace Magick if (exceptionInfo->severity != MagickCore::UndefinedException) { unlinkImages(first_,last_); - throwException(exceptionInfo); + throwException(exceptionInfo,mapImage_.quiet()); } image=first_->image(); @@ -2395,7 +2400,7 @@ namespace Magick if (exceptionInfo->severity > MagickCore::UndefinedException) { unlinkImages(first_,last_); - throwException(exceptionInfo); + throwException(exceptionInfo,mapImage_.quiet()); } } @@ -2404,7 +2409,7 @@ namespace Magick if (exceptionInfo->severity > MagickCore::UndefinedException) { unlinkImages(first_,last_); - throwException(exceptionInfo); + throwException(exceptionInfo,mapImage_.quiet()); } // Next image @@ -2427,7 +2432,7 @@ namespace Magick MagickCore::Image* image = MergeImageLayers( first_->image(), method_, exceptionInfo ); unlinkImages( first_, last_ ); mergedImage_->replaceImage( image ); - ThrowPPException; + ThrowPPException(mergedImage_->quiet()); } // Create a composite image by combining several separate images. @@ -2472,7 +2477,7 @@ namespace Magick MagickCore::DestroyMontageInfo(montageInfo); // Report any montage error - ThrowPPException; + ThrowPPException(first_->quiet()); // Apply transparency to montage images if (montageImages_->size() > 0 && options_.transparentColor().isValid()) @@ -2502,7 +2507,7 @@ namespace Magick insertImages( morphedImages_, images ); // Report any error - ThrowPPException; + ThrowPPException(first_->quiet()); } // Inlay a number of images to form a single coherent picture. @@ -2516,7 +2521,7 @@ namespace Magick MosaicLayer,exceptionInfo ); unlinkImages( first_, last_ ); mosaicImage_->replaceImage( image ); - ThrowPPException; + ThrowPPException(mosaicImage_->quiet()); } // Compares each image the GIF disposed forms of the previous image in @@ -2538,7 +2543,7 @@ namespace Magick insertImages( optimizedImages_, images ); - ThrowPPException; + ThrowPPException(first_->quiet()); } // optimizeImagePlusLayers is exactly as optimizeImageLayers, but may @@ -2559,7 +2564,7 @@ namespace Magick insertImages( optimizedImages_, images ); - ThrowPPDrawException; + ThrowPPDrawException(first_->quiet()); } // Compares each image the GIF disposed forms of the previous image in the @@ -2574,7 +2579,7 @@ namespace Magick OptimizeImageTransparency(first_->image(),exceptionInfo); unlinkImages(first_,last_ ); - ThrowPPException; + ThrowPPException(first_->quiet()); } @@ -2625,7 +2630,7 @@ namespace Magick } unlinkImages( first_, last_ ); - ThrowPPException; + ThrowPPException(first_->quiet()); } // Read images into existing container (appending to container) @@ -2645,7 +2650,7 @@ namespace Magick GetPPException; images=MagickCore::ReadImage(imageInfo,exceptionInfo); insertImages(sequence_,images); - ThrowPPException; + ThrowPPException(options.quiet()); } template @@ -2665,7 +2670,7 @@ namespace Magick images=MagickCore::BlobToImage(options.imageInfo(),blob_.data(), blob_.length(),exceptionInfo); insertImages(sequence_,images); - ThrowPPException; + ThrowPPException(options.quiet()); } template @@ -2694,7 +2699,7 @@ namespace Magick separatedImages_->clear(); insertImages(separatedImages_,images); - ThrowPPException; + ThrowPPException(image_.quiet()); } // Smush images from list into single image in either horizontal or @@ -2712,7 +2717,7 @@ namespace Magick (MagickBooleanType) stack_,offset_,exceptionInfo); unlinkImages(first_,last_); smushedImage_->replaceImage(newImage); - ThrowPPException; + ThrowPPException(smushedImage_->quiet()); } // Write Images @@ -2739,7 +2744,7 @@ namespace Magick return; } - ThrowPPException; + ThrowPPException(first_->quiet()); } // Write images to BLOB template @@ -2762,7 +2767,7 @@ namespace Magick unlinkImages( first_, last_ ); - ThrowPPException; + ThrowPPException(first_->quiet()); } } // namespace Magick diff --git a/Magick++/lib/Magick++/Statistic.h b/Magick++/lib/Magick++/Statistic.h index cd69070bd..f9d46a616 100644 --- a/Magick++/lib/Magick++/Statistic.h +++ b/Magick++/lib/Magick++/Statistic.h @@ -1,6 +1,6 @@ // This may look like C code, but it is really -*- C++ -*- // -// Copyright Dirk Lemstra 2014 +// Copyright Dirk Lemstra 2014-2015 // // Definition of channel moments. // @@ -13,6 +13,8 @@ namespace Magick { + class Image; + class MagickPPExport ChannelMoments { public: @@ -232,7 +234,7 @@ namespace Magick // // Implemementation methods // - ImageMoments(const MagickCore::Image *image_); + ImageMoments(const Image &image_); private: std::vector _channels; @@ -270,7 +272,7 @@ namespace Magick // // Implemementation methods // - ImagePerceptualHash(const MagickCore::Image *image_); + ImagePerceptualHash(const Image &image_); private: std::vector _channels; @@ -295,7 +297,7 @@ namespace Magick // // Implemementation methods // - ImageStatistics(const MagickCore::Image *image_); + ImageStatistics(const Image &image_); private: std::vector _channels; diff --git a/Magick++/lib/Options.cpp b/Magick++/lib/Options.cpp index af39cda2e..505f33e2c 100644 --- a/Magick++/lib/Options.cpp +++ b/Magick++/lib/Options.cpp @@ -257,7 +257,7 @@ void Magick::Options::fillPattern(const MagickCore::Image *fillPattern_) _drawInfo->fill_pattern=CloneImage(const_cast( fillPattern_),0,0,static_cast(MagickTrue), exceptionInfo); - ThrowPPException; + ThrowPPException(true); } } @@ -317,7 +317,7 @@ std::string Magick::Options::format(void) const GetPPException; if (*_imageInfo->magick != '\0' ) magick_info = GetMagickInfo(_imageInfo->magick,exceptionInfo); - ThrowPPException; + ThrowPPException(true); if ((magick_info != 0) && (*magick_info->description != '\0')) return(std::string( magick_info->description)); @@ -342,9 +342,9 @@ void Magick::Options::magick(const std::string &magick_) GetPPException; SetImageInfo(_imageInfo,1,exceptionInfo); if (*_imageInfo->magick == '\0') - throwExceptionExplicit(OptionWarning, "Unrecognized image format", - magick_.c_str()); - ThrowPPException; + throwExceptionExplicit(MagickCore::OptionError, + "Unrecognized image format",magick_.c_str()); + ThrowPPException(true); } std::string Magick::Options::magick(void) const @@ -589,9 +589,9 @@ void Magick::Options::strokePattern(const MagickCore::Image *strokePattern_) if (strokePattern_) { GetPPException; - _drawInfo->stroke_pattern=CloneImage( const_cast( + _drawInfo->stroke_pattern=CloneImage(const_cast( strokePattern_),0,0,MagickTrue,exceptionInfo); - ThrowPPException; + ThrowPPException(true); } } diff --git a/Magick++/lib/Pixels.cpp b/Magick++/lib/Pixels.cpp index d55a64996..4b9914a5e 100644 --- a/Magick++/lib/Pixels.cpp +++ b/Magick++/lib/Pixels.cpp @@ -1,7 +1,7 @@ // This may look like C code, but it is really -*- C++ -*- // // Copyright Bob Friesenhahn, 1999, 2000, 2001, 2002, 2003 -// Copyright Dirk Lemstra 2013-2014 +// Copyright Dirk Lemstra 2013-2015 // // Pixels Implementation // @@ -25,7 +25,7 @@ Magick::Pixels::Pixels(Magick::Image &image_) { GetPPException; _view=AcquireVirtualCacheView(_image.image(),exceptionInfo), - ThrowPPException; + ThrowPPException(image_.quiet()); } Magick::Pixels::~Pixels(void) @@ -45,7 +45,7 @@ Magick::Quantum* Magick::Pixels::get(const ssize_t x_,const ssize_t y_, GetPPException; Quantum* pixels=GetCacheViewAuthenticPixels(_view,x_,y_,columns_,rows_, exceptionInfo); - ThrowPPException; + ThrowPPException(true); return pixels; } @@ -61,7 +61,7 @@ const Magick::Quantum* Magick::Pixels::getConst(const ssize_t x_, GetPPException; const Quantum* pixels=GetCacheViewVirtualPixels(_view,x_,y_,columns_,rows_, exceptionInfo); - ThrowPPException; + ThrowPPException(true); return pixels; } @@ -84,7 +84,7 @@ Magick::Quantum* Magick::Pixels::set(const ssize_t x_,const ssize_t y_, GetPPException; Quantum* pixels=QueueCacheViewAuthenticPixels(_view,x_,y_,columns_,rows_, exceptionInfo); - ThrowPPException; + ThrowPPException(true); return pixels; } @@ -93,7 +93,7 @@ void Magick::Pixels::sync(void) { GetPPException; SyncCacheViewAuthenticPixels(_view,exceptionInfo); - ThrowPPException; + ThrowPPException(true); } // Return pixel colormap index array @@ -183,7 +183,7 @@ void Magick::PixelData::init(Magick::Image &image_,const ::ssize_t x_, size=sizeof(unsigned short); break; default: - throwExceptionExplicit(OptionError,"Invalid type"); + throwExceptionExplicit(MagickCore::OptionError,"Invalid type"); return; } @@ -194,9 +194,9 @@ void Magick::PixelData::init(Magick::Image &image_,const ::ssize_t x_, GetPPException; MagickCore::ExportImagePixels(image_.image(),x_,y_,width_,height_, map_.c_str(),type_,_data,exceptionInfo); - if (exceptionInfo->severity != UndefinedException) + if (exceptionInfo->severity != MagickCore::UndefinedException) relinquish(); - ThrowPPException; + ThrowPPException(image_.quiet()); } void Magick::PixelData::relinquish(void) throw() diff --git a/Magick++/lib/STL.cpp b/Magick++/lib/STL.cpp index 830b15320..dc1900493 100644 --- a/Magick++/lib/STL.cpp +++ b/Magick++/lib/STL.cpp @@ -1,7 +1,7 @@ // This may look like C code, but it is really -*- C++ -*- // // Copyright Bob Friesenhahn, 1999, 2002 -// Copyright Dirk Lemstra 2013-2014 +// Copyright Dirk Lemstra 2013-2015 // // Implementation of STL classes and functions // @@ -784,13 +784,15 @@ void Magick::raiseImage::operator()( Magick::Image &image_ ) const Magick::ReadOptions::ReadOptions(void) : _imageInfo(static_cast(AcquireMagickMemory( - sizeof(ImageInfo)))) + sizeof(ImageInfo)))), + _quiet(false) { GetImageInfo(_imageInfo); } Magick::ReadOptions::ReadOptions(const Magick::ReadOptions& options_) - : _imageInfo(CloneImageInfo(options_._imageInfo)) + : _imageInfo(CloneImageInfo(options_._imageInfo)), + _quiet(false) { } diff --git a/Magick++/lib/Statistic.cpp b/Magick++/lib/Statistic.cpp index 29d1f8b1c..33f7a746c 100644 --- a/Magick++/lib/Statistic.cpp +++ b/Magick++/lib/Statistic.cpp @@ -1,6 +1,6 @@ // This may look like C code, but it is really -*- C++ -*- // -// Copyright Dirk Lemstra 2014 +// Copyright Dirk Lemstra 2014-2015 // // Implementation of channel moments. // @@ -11,6 +11,7 @@ #include "Magick++/Include.h" #include "Magick++/Exception.h" #include "Magick++/Statistic.h" +#include "Magick++/Image.h" using namespace std; @@ -444,23 +445,23 @@ Magick::ChannelMoments Magick::ImageMoments::channel( return(ChannelMoments()); } -Magick::ImageMoments::ImageMoments(const MagickCore::Image *image) +Magick::ImageMoments::ImageMoments(const Image &image_) : _channels() { MagickCore::ChannelMoments* channel_moments; GetPPException; - channel_moments=GetImageMoments(image,exceptionInfo); + channel_moments=GetImageMoments(image_.constImage(),exceptionInfo); if (channel_moments != (MagickCore::ChannelMoments *) NULL) { register ssize_t i; - for (i=0; i < (ssize_t) GetPixelChannels(image); i++) + for (i=0; i < (ssize_t) GetPixelChannels(image_.constImage()); i++) { - PixelChannel channel=GetPixelChannelChannel(image,i); - PixelTrait traits=GetPixelChannelTraits(image,channel); + PixelChannel channel=GetPixelChannelChannel(image_.constImage(),i); + PixelTrait traits=GetPixelChannelTraits(image_.constImage(),channel); if (traits == UndefinedPixelTrait) continue; if ((traits & UpdatePixelTrait) == 0) @@ -473,7 +474,7 @@ Magick::ImageMoments::ImageMoments(const MagickCore::Image *image) channel_moments=(MagickCore::ChannelMoments *) RelinquishMagickMemory( channel_moments); } - ThrowPPException; + ThrowPPException(image_.quiet()); } Magick::ImagePerceptualHash::ImagePerceptualHash(void) @@ -567,7 +568,7 @@ double Magick::ImagePerceptualHash::sumSquaredDifferences( } Magick::ImagePerceptualHash::ImagePerceptualHash( - const MagickCore::Image *image) + const Image &image_) : _channels() { MagickCore::ChannelPerceptualHash* @@ -577,25 +578,26 @@ Magick::ImagePerceptualHash::ImagePerceptualHash( traits; GetPPException; - channel_perceptual_hash=GetImagePerceptualHash(image,exceptionInfo); + channel_perceptual_hash=GetImagePerceptualHash(image_.constImage(), + exceptionInfo); if (channel_perceptual_hash != (MagickCore::ChannelPerceptualHash *) NULL) { - traits=GetPixelChannelTraits(image,RedPixelChannel); + traits=GetPixelChannelTraits(image_.constImage(),RedPixelChannel); if ((traits & UpdatePixelTrait) != 0) _channels.push_back(Magick::ChannelPerceptualHash(RedPixelChannel, &channel_perceptual_hash[RedPixelChannel])); - traits=GetPixelChannelTraits(image,GreenPixelChannel); + traits=GetPixelChannelTraits(image_.constImage(),GreenPixelChannel); if ((traits & UpdatePixelTrait) != 0) _channels.push_back(Magick::ChannelPerceptualHash(GreenPixelChannel, &channel_perceptual_hash[GreenPixelChannel])); - traits=GetPixelChannelTraits(image,BluePixelChannel); + traits=GetPixelChannelTraits(image_.constImage(),BluePixelChannel); if ((traits & UpdatePixelTrait) != 0) _channels.push_back(Magick::ChannelPerceptualHash(BluePixelChannel, &channel_perceptual_hash[BluePixelChannel])); channel_perceptual_hash=(MagickCore::ChannelPerceptualHash *) RelinquishMagickMemory(channel_perceptual_hash); } - ThrowPPException; + ThrowPPException(image_.quality()); } Magick::ImageStatistics::ImageStatistics(void) @@ -625,23 +627,23 @@ Magick::ChannelStatistics Magick::ImageStatistics::channel( return(ChannelStatistics()); } -Magick::ImageStatistics::ImageStatistics(const MagickCore::Image *image) +Magick::ImageStatistics::ImageStatistics(const Image &image_) : _channels() { MagickCore::ChannelStatistics* channel_statistics; GetPPException; - channel_statistics=GetImageStatistics(image,exceptionInfo); + channel_statistics=GetImageStatistics(image_.constImage(),exceptionInfo); if (channel_statistics != (MagickCore::ChannelStatistics *) NULL) { register ssize_t i; - for (i=0; i < (ssize_t) GetPixelChannels(image); i++) + for (i=0; i < (ssize_t) GetPixelChannels(image_.constImage()); i++) { - PixelChannel channel=GetPixelChannelChannel(image,i); - PixelTrait traits=GetPixelChannelTraits(image,channel); + PixelChannel channel=GetPixelChannelChannel(image_.constImage(),i); + PixelTrait traits=GetPixelChannelTraits(image_.constImage(),channel); if (traits == UndefinedPixelTrait) continue; if ((traits & UpdatePixelTrait) == 0) @@ -654,5 +656,5 @@ Magick::ImageStatistics::ImageStatistics(const MagickCore::Image *image) channel_statistics=(MagickCore::ChannelStatistics *) RelinquishMagickMemory( channel_statistics); } - ThrowPPException; + ThrowPPException(image_.quiet()); } diff --git a/Magick++/lib/Thread.cpp b/Magick++/lib/Thread.cpp index b63268e74..aed0ae578 100644 --- a/Magick++/lib/Thread.cpp +++ b/Magick++/lib/Thread.cpp @@ -1,7 +1,7 @@ // This may look like C code, but it is really -*- C++ -*- // // Copyright Bob Friesenhahn, 1999, 2000, 2001, 2002 -// Copyright Dirk Lemstra 2014 +// Copyright Dirk Lemstra 2014-2015 // // Implementation of thread support // @@ -52,7 +52,8 @@ Magick::MutexLock::MutexLock(void) _mutex=::CreateSemaphore(&security,1,1,(LPCSTR) NULL); if (_mutex != (HANDLE) NULL) return; - throwExceptionExplicit(OptionError,"mutex initialization failed"); + throwExceptionExplicit(MagickCore::OptionError, + "mutex initialization failed"); } #else // Threads not supported @@ -76,7 +77,7 @@ Magick::MutexLock::~MutexLock(void) #if defined(_MT) && defined(_VISUALC_) if (::CloseHandle(_mutex) != 0) return; - throwExceptionExplicit(OptionError,"mutex destruction failed"); + throwExceptionExplicit(MagickCore::OptionError,"mutex destruction failed"); #endif } @@ -95,7 +96,7 @@ void Magick::MutexLock::lock(void) #if defined(_MT) && defined(_VISUALC_) if (WaitForSingleObject(_mutex,INFINITE) != WAIT_FAILED) return; - throwExceptionExplicit(OptionError,"mutex lock failed"); + throwExceptionExplicit(MagickCore::OptionError,"mutex lock failed"); #endif } @@ -114,6 +115,6 @@ void Magick::MutexLock::unlock(void) #if defined(_MT) && defined(_VISUALC_) if (ReleaseSemaphore(_mutex,1,(LPLONG) NULL) == TRUE) return; - throwExceptionExplicit(OptionError,"mutex unlock failed"); + throwExceptionExplicit(MagickCore::OptionError,"mutex unlock failed"); #endif }