GetPPException;
newImage=BlobToImage(imageInfo(),static_cast<const void *>(blob_.data()),
blob_.length(),exceptionInfo);
- replaceImage(newImage);
- ThrowPPException;
+ read(newImage,exceptionInfo);
}
void Magick::Image::read(const Blob &blob_,const Geometry &size_)
GetPPException;
options()->fileName(imageSpec_);
newImage=ReadImage(imageInfo(),exceptionInfo);
-
- // Ensure that multiple image frames were not read.
- if (newImage && newImage->next)
- {
- MagickCore::Image
- *next;
-
- // Destroy any extra image frames
- next=newImage->next;
- newImage->next=0;
- next->previous=0;
- DestroyImageList(next);
- }
- replaceImage(newImage);
- ThrowPPException;
+ read(newImage,exceptionInfo);
}
void Magick::Image::readPixels(const Magick::QuantumType quantum_,
_imgRef->id(-1);
}
+void Magick::Image::read(MagickCore::Image *image,
+ MagickCore::ExceptionInfo *exceptionInfo)
+{
+ // Ensure that multiple image frames were not read.
+ if (image != (MagickCore::Image *) NULL &&
+ image->next != (MagickCore::Image *) NULL)
+ {
+ MagickCore::Image
+ *next;
+
+ // Destroy any extra image frames
+ next=image->next;
+ image->next=(MagickCore::Image *) NULL;
+ next->previous=(MagickCore::Image *) NULL;
+ DestroyImageList(next);
+ }
+ replaceImage(image);
+ if (exceptionInfo->severity == MagickCore::UndefinedException &&
+ image == (MagickCore::Image *) NULL)
+ {
+ (void) MagickCore::DestroyExceptionInfo(exceptionInfo);
+ throwExceptionExplicit(ImageWarning,"No image was loaded.");
+ }
+ ThrowPPException;
+}
+
void Magick::Image::floodFill(const ssize_t x_,const ssize_t y_,
const Magick::Image *fillPattern_,const Magick::Color &fill_,
const MagickCore::PixelInfo *target_,const bool invert_)
private:
+ void read(MagickCore::Image *image,
+ MagickCore::ExceptionInfo *exceptionInfo);
+
void floodFill(const ssize_t x_,const ssize_t y_,
const Magick::Image *fillPattern_,const Color &fill_,
const PixelInfo *target,const bool invert_);