From: Dirk Lemstra Date: Mon, 17 Dec 2018 20:49:31 +0000 (+0100) Subject: Added pingImages to STL (#1421). X-Git-Tag: 7.0.8-17~2 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=e27ef5d2d71027ba434c3185ce756785ff178977;p=imagemagick Added pingImages to STL (#1421). --- diff --git a/Magick++/lib/Magick++/STL.h b/Magick++/lib/Magick++/STL.h index e848008bf..8adc6333d 100644 --- a/Magick++/lib/Magick++/STL.h +++ b/Magick++/lib/Magick++/STL.h @@ -873,6 +873,10 @@ namespace Magick void depth(size_t depth_); size_t depth(void) const; + // Ping the image instead of reading it + void ping(const bool flag_); + bool ping(void) const; + // Suppress all warning messages. Error messages are still reported. void quiet(const bool quiet_); bool quiet(void) const; @@ -2644,6 +2648,36 @@ namespace Magick ThrowPPException(first_->quiet()); } + // Ping images into existing container (appending to container) + template + void pingImages(Container *sequence_,const std::string &imageSpec_, + ReadOptions &options) + { + options.ping=true; + readImages(sequence_,imageSpec_,options); + } + + template + void pingImages(Container *sequence_,const std::string &imageSpec_) + { + ReadOptions options; + pingImages(sequence_,imageSpec_,options); + } + + template + void pingImages(Container *sequence_,const Blob &blob_,ReadOptions &options) + { + options.ping=true; + readImages(sequence_,blob_,options); + } + + template + void pingImages(Container *sequence_,const Blob &blob_) + { + ReadOptions options; + pingImages(sequence_,blob_,options); + } + // Adds the names of the profiles of the image to the container. template void profileNames(Container *names_,const Image* image_) diff --git a/Magick++/lib/STL.cpp b/Magick++/lib/STL.cpp index b5b641fd9..b8d408de0 100644 --- a/Magick++/lib/STL.cpp +++ b/Magick++/lib/STL.cpp @@ -830,20 +830,14 @@ size_t Magick::ReadOptions::depth(void) const return(_imageInfo->depth); } -void Magick::ReadOptions::size(const Geometry &geometry_) +void Magick::ReadOptions::ping(const bool flag_) { - _imageInfo->size=(char *) RelinquishMagickMemory(_imageInfo->size); - - if ( geometry_.isValid() ) - Magick::CloneString(&_imageInfo->size,geometry_); + _imageInfo->ping=(MagickBooleanType) flag_; } -Magick::Geometry Magick::ReadOptions::size(void) const +bool Magick::ReadOptions::ping(void) const { - if (_imageInfo->size) - return(Geometry(_imageInfo->size)); - - return(Geometry()); + return(static_cast(_imageInfo->ping)); } void Magick::ReadOptions::quiet(const bool quiet_) @@ -856,6 +850,22 @@ bool Magick::ReadOptions::quiet(void) const return(_quiet); } +void Magick::ReadOptions::size(const Geometry &geometry_) +{ + _imageInfo->size=(char *) RelinquishMagickMemory(_imageInfo->size); + + if ( geometry_.isValid() ) + Magick::CloneString(&_imageInfo->size,geometry_); +} + +Magick::Geometry Magick::ReadOptions::size(void) const +{ + if (_imageInfo->size) + return(Geometry(_imageInfo->size)); + + return(Geometry()); +} + MagickCore::ImageInfo *Magick::ReadOptions::imageInfo(void) { return(_imageInfo);