#define MAGICKCORE_IMPLEMENTATION 1
#define MAGICK_PLUSPLUS_IMPLEMENTATION 1
+#include "Magick++/Include.h"
#include <cstdlib>
#include <string>
#include <string.h>
#include <errno.h>
#include <math.h>
-#include "Magick++/Include.h"
using namespace std;
#define AbsoluteValue(x) ((x) < 0 ? -(x) : (x))
#define DegreesToRadians(x) (MagickPI*(x)/180.0)
-MagickDLLDeclExtern const char *Magick::borderGeometryDefault = "6x6+0+0";
-MagickDLLDeclExtern const char *Magick::frameGeometryDefault = "25x25+6+6";
-MagickDLLDeclExtern const char *Magick::raiseGeometryDefault = "6x6+0+0";
+MagickPPExport const char *Magick::borderGeometryDefault = "6x6+0+0";
+MagickPPExport const char *Magick::frameGeometryDefault = "25x25+6+6";
+MagickPPExport const char *Magick::raiseGeometryDefault = "6x6+0+0";
static bool magick_initialized=false;
// Friend functions to compare Image objects
//
-MagickDLLDecl int Magick::operator == ( const Magick::Image& left_,
+MagickPPExport int Magick::operator == ( const Magick::Image& left_,
const Magick::Image& right_ )
{
// If image pixels and signature are the same, then the image is identical
( left_.signature() == right_.signature() )
);
}
-MagickDLLDecl int Magick::operator != ( const Magick::Image& left_,
+MagickPPExport int Magick::operator != ( const Magick::Image& left_,
const Magick::Image& right_ )
{
return ( ! (left_ == right_) );
}
-MagickDLLDecl int Magick::operator > ( const Magick::Image& left_,
+MagickPPExport int Magick::operator > ( const Magick::Image& left_,
const Magick::Image& right_ )
{
return ( !( left_ < right_ ) && ( left_ != right_ ) );
}
-MagickDLLDecl int Magick::operator < ( const Magick::Image& left_,
+MagickPPExport int Magick::operator < ( const Magick::Image& left_,
const Magick::Image& right_ )
{
// If image pixels are less, then image is smaller
( right_.rows() * right_.columns() )
);
}
-MagickDLLDecl int Magick::operator >= ( const Magick::Image& left_,
+MagickPPExport int Magick::operator >= ( const Magick::Image& left_,
const Magick::Image& right_ )
{
return ( ( left_ > right_ ) || ( left_ == right_ ) );
}
-MagickDLLDecl int Magick::operator <= ( const Magick::Image& left_,
+MagickPPExport int Magick::operator <= ( const Magick::Image& left_,
const Magick::Image& right_ )
{
return ( ( left_ < right_ ) || ( left_ == right_ ) );
GetExceptionInfo( &exceptionInfo );
MagickCore::Image* newImage =
AddNoiseImage ( image(),
- noiseType_,
+ noiseType_, 1.0,
&exceptionInfo );
replaceImage( newImage );
throwException( exceptionInfo );
{
ExceptionInfo exceptionInfo;
GetExceptionInfo( &exceptionInfo );
- ChannelType channel_mask = SetPixelChannelMask( image(), channel_);
+ ChannelType channel_mask = SetImageChannelMask( image(), channel_);
MagickCore::Image* newImage =
AddNoiseImage ( image(),
- noiseType_,
+ noiseType_, 1.0,
&exceptionInfo );
- (void) SetPixelChannelMap( image(), channel_mask );
+ (void) SetPixelChannelMask( image(), channel_mask );
replaceImage( newImage );
throwException( exceptionInfo );
(void) DestroyExceptionInfo( &exceptionInfo );
+current.tx;
}
- AnnotateImage( image(), drawInfo );
+ ExceptionInfo exceptionInfo;
+ GetExceptionInfo( &exceptionInfo );
+ AnnotateImage( image(), drawInfo, &exceptionInfo );
// Restore original values
drawInfo->affine = oaffine;
drawInfo->text = 0;
drawInfo->geometry = 0;
- throwImageException();
+ throwException( exceptionInfo );
+ (void) DestroyExceptionInfo( &exceptionInfo );
}
// Annotate with text (bounding area is entire image) and placement gravity.
void Magick::Image::annotate ( const std::string &text_,
drawInfo->gravity = gravity_;
- AnnotateImage( image(), drawInfo );
+ ExceptionInfo exceptionInfo;
+ GetExceptionInfo( &exceptionInfo );
+ AnnotateImage( image(), drawInfo, &exceptionInfo );
drawInfo->gravity = NorthWestGravity;
drawInfo->text = 0;
- throwImageException();
+ throwException( exceptionInfo );
+ (void) DestroyExceptionInfo( &exceptionInfo );
}
// Blur image
{
ExceptionInfo exceptionInfo;
GetExceptionInfo( &exceptionInfo );
- ChannelType channel_mask = SetPixelChannelMask( image(), channel_ );
+ ChannelType channel_mask = SetImageChannelMask( image(), channel_ );
MagickCore::Image* newImage =
BlurImage( image(), radius_, sigma_, &exceptionInfo);
- (void) SetPixelChannelMap( image(), channel_mask );
+ (void) SetPixelChannelMask( image(), channel_mask );
replaceImage( newImage );
throwException( exceptionInfo );
(void) DestroyExceptionInfo( &exceptionInfo );
ExceptionInfo exceptionInfo;
GetExceptionInfo( &exceptionInfo );
MagickCore::Image* newImage =
- BorderImage( image(), &borderInfo, &exceptionInfo);
+ BorderImage( image(), &borderInfo, image()->compose, &exceptionInfo);
replaceImage( newImage );
throwException( exceptionInfo );
(void) DestroyExceptionInfo( &exceptionInfo );
void Magick::Image::channel ( const ChannelType channel_ )
{
modifyImage();
- ChannelType channel_mask = SetPixelChannelMask( image(), channel_ );
- SeparateImage ( image() );
- (void) SetPixelChannelMap( image(), channel_mask );
- throwImageException();
+ ExceptionInfo exceptionInfo;
+ GetExceptionInfo( &exceptionInfo );
+ MagickCore::Image* newImage =
+ SeparateImage( image(), channel_, &exceptionInfo);
+ replaceImage( newImage );
+ throwException( exceptionInfo );
+ (void) DestroyExceptionInfo( &exceptionInfo );
}
// Set or obtain modulus channel depth
void Magick::Image::channelDepth ( const size_t depth_ )
{
modifyImage();
- SetImageDepth( image(), depth_);
- throwImageException();
+ ExceptionInfo exceptionInfo;
+ GetExceptionInfo( &exceptionInfo );
+ SetImageDepth( image(), depth_, &exceptionInfo);
+ throwException( exceptionInfo );
+ (void) DestroyExceptionInfo( &exceptionInfo );
}
size_t Magick::Image::channelDepth ( )
{
"Pen color argument is invalid");
}
- char alpha[MaxTextExtent];
- FormatLocaleString(alpha,MaxTextExtent,"%u/%u/%u",alphaRed_,alphaGreen_,alphaBlue_);
+ char blend[MaxTextExtent];
+ FormatLocaleString(blend,MaxTextExtent,"%u/%u/%u",alphaRed_,alphaGreen_,alphaBlue_);
ExceptionInfo exceptionInfo;
GetExceptionInfo( &exceptionInfo );
+ PixelInfo target;
+ GetPixelInfo(image(),&target);
+ PixelInfo pixel=static_cast<PixelInfo>(penColor_);
+ target.red=pixel.red;
+ target.green=pixel.green;
+ target.blue=pixel.blue;
+ target.alpha=pixel.alpha;
MagickCore::Image* newImage =
- ColorizeImage ( image(), alpha,
- penColor_, &exceptionInfo );
+ ColorizeImage ( image(), blend, &target, &exceptionInfo );
replaceImage( newImage );
throwException( exceptionInfo );
(void) DestroyExceptionInfo( &exceptionInfo );
kernel_info=AcquireKernelInfo((const char *) NULL);
kernel_info->width=order_;
kernel_info->height=order_;
- kernel_info->values=(double *) color_matrix_;
- MagickCore::Image* newImage =
- ColorMatrixImage( image(), kernel_info, &exceptionInfo );
- kernel_info->values=(double *) NULL;
+ kernel_info->values=(MagickRealType *) AcquireAlignedMemory(order_,
+ order_*sizeof(*kernel_info->values));
+ if (kernel_info->values != (MagickRealType *) NULL)
+ {
+ for (ssize_t i=0; i < (order_*order_); i++)
+ kernel_info->values[i]=color_matrix_[i];
+ MagickCore::Image* newImage =
+ ColorMatrixImage( image(), kernel_info, &exceptionInfo );
+ replaceImage( newImage );
+ }
kernel_info=DestroyKernelInfo(kernel_info);
- replaceImage( newImage );
throwException( exceptionInfo );
(void) DestroyExceptionInfo( &exceptionInfo );
}
// in the current image. False is returned if the images are identical.
bool Magick::Image::compare ( const Image &reference_ )
{
+ ExceptionInfo exceptionInfo;
+ GetExceptionInfo( &exceptionInfo );
modifyImage();
Image ref = reference_;
ref.modifyImage();
- return static_cast<bool>(IsImagesEqual(image(), ref.image()));
+ bool status =
+ static_cast<bool>(IsImagesEqual(image(), ref.image(), &exceptionInfo));
+ throwException( exceptionInfo );
+ (void) DestroyExceptionInfo( &exceptionInfo );
+ return status;
}
// Composite two images
// results in updating current image.
modifyImage();
+ ExceptionInfo exceptionInfo;
+ GetExceptionInfo( &exceptionInfo );
CompositeImage( image(),
- compose_,
compositeImage_.constImage(),
+ compose_, MagickFalse,
xOffset_,
- yOffset_ );
- throwImageException();
+ yOffset_, &exceptionInfo );
+ throwException( exceptionInfo );
+ (void) DestroyExceptionInfo( &exceptionInfo );
}
void Magick::Image::composite ( const Image &compositeImage_,
const Geometry &offset_,
&x, &y,
&width, &height );
+ ExceptionInfo exceptionInfo;
+ GetExceptionInfo( &exceptionInfo );
CompositeImage( image(),
- compose_,
compositeImage_.constImage(),
- x, y );
- throwImageException();
+ compose_, MagickFalse,
+ x, y, &exceptionInfo );
+ throwException( exceptionInfo );
+ (void) DestroyExceptionInfo( &exceptionInfo );
}
void Magick::Image::composite ( const Image &compositeImage_,
const GravityType gravity_,
SetGeometry(compositeImage_.constImage(), &geometry);
GravityAdjustGeometry(columns(), rows(), gravity_, &geometry);
+ ExceptionInfo exceptionInfo;
+ GetExceptionInfo( &exceptionInfo );
CompositeImage( image(),
- compose_,
compositeImage_.constImage(),
- geometry.x, geometry.y );
- throwImageException();
+ compose_, MagickFalse,
+ geometry.x, geometry.y, &exceptionInfo );
+ throwException( exceptionInfo );
+ (void) DestroyExceptionInfo( &exceptionInfo );
}
// Contrast image
kernel_info=AcquireKernelInfo((const char *) NULL);
kernel_info->width=order_;
kernel_info->height=order_;
- kernel_info->values=(double *) kernel_;
- kernel_info->bias=image()->bias;
- MagickCore::Image* newImage =
- ConvolveImage ( image(), kernel_info, &exceptionInfo );
- kernel_info->values=(double *) NULL;
+ kernel_info->values=(MagickRealType *) AcquireAlignedMemory(order_,
+ order_*sizeof(*kernel_info->values));
+ if (kernel_info->values != (MagickRealType *) NULL)
+ {
+ for (ssize_t i=0; i < (order_*order_); i++)
+ kernel_info->values[i]=kernel_[i];
+ MagickCore::Image* newImage =
+ ConvolveImage ( image(), kernel_info, &exceptionInfo );
+ replaceImage( newImage );
+ }
kernel_info=DestroyKernelInfo(kernel_info);
- replaceImage( newImage );
throwException( exceptionInfo );
(void) DestroyExceptionInfo( &exceptionInfo );
}
// Cycle Color Map
void Magick::Image::cycleColormap ( const ssize_t amount_ )
{
+ ExceptionInfo exceptionInfo;
+ GetExceptionInfo( &exceptionInfo );
modifyImage();
- CycleColormapImage( image(), amount_ );
- throwImageException();
+ CycleColormapImage( image(), amount_, &exceptionInfo );
+ throwException( exceptionInfo );
+ (void) DestroyExceptionInfo( &exceptionInfo );
}
// Despeckle
// Display image
void Magick::Image::display( void )
{
- DisplayImages( imageInfo(), image() );
+ ExceptionInfo exceptionInfo;
+ GetExceptionInfo( &exceptionInfo );
+ DisplayImages( imageInfo(), image(), &exceptionInfo );
+ throwException( exceptionInfo );
+ (void) DestroyExceptionInfo( &exceptionInfo );
}
// Distort image. distorts an image using various distortion methods, by
{
drawable_.operator()(wand);
- if( constImage()->exception.severity == UndefinedException)
- DrawRender(wand);
+ DrawRender(wand);
wand=DestroyDrawingWand(wand);
}
p != drawable_.end(); p++ )
{
p->operator()(wand);
- if( constImage()->exception.severity != UndefinedException)
- break;
}
- if( constImage()->exception.severity == UndefinedException)
- DrawRender(wand);
+ DrawRender(wand);
wand=DestroyDrawingWand(wand);
}
}
// Hilight edges in image
-void Magick::Image::edge ( const double radius_ )
+void Magick::Image::edge ( const double radius_, const double sigma_ )
{
ExceptionInfo exceptionInfo;
GetExceptionInfo( &exceptionInfo );
MagickCore::Image* newImage =
- EdgeImage( image(), radius_, &exceptionInfo );
+ EdgeImage( image(), radius_, sigma_, &exceptionInfo );
replaceImage( newImage );
throwException( exceptionInfo );
(void) DestroyExceptionInfo( &exceptionInfo );
modifyImage();
EqualizeImage( image(), &exceptionInfo );
throwException( exceptionInfo );
+ (void) DestroyExceptionInfo( &exceptionInfo );
}
// Erase image to current "background color"
void Magick::Image::erase ( void )
{
modifyImage();
- SetImageBackgroundColor( image() );
- throwImageException();
+ ExceptionInfo exceptionInfo;
+ GetExceptionInfo( &exceptionInfo );
+ SetImageBackgroundColor( image(), &exceptionInfo );
+ throwException( exceptionInfo );
+ (void) DestroyExceptionInfo( &exceptionInfo );
}
// Extends image as defined by the geometry.
//
void Magick::Image::extent ( const Geometry &geometry_ )
{
- RectangleInfo extentInfo = geometry_;
modifyImage();
ExceptionInfo exceptionInfo;
GetExceptionInfo( &exceptionInfo );
+ RectangleInfo extentInfo = geometry_;
+ extentInfo.x = geometry_.xOff();
+ extentInfo.y = geometry_.yOff();
MagickCore::Image* newImage =
ExtentImage ( image(), &extentInfo, &exceptionInfo );
replaceImage( newImage );
}
void Magick::Image::extent ( const Geometry &geometry_, const GravityType gravity_ )
{
- image()->gravity = gravity_;
- extent ( geometry_ );
+ RectangleInfo geometry;
+
+ SetGeometry(image(), &geometry);
+ geometry.width = geometry_.width();
+ geometry.height = geometry_.height();
+ GravityAdjustGeometry(image()->columns, image()->rows, gravity_, &geometry);
+ extent ( geometry );
}
void Magick::Image::extent ( const Geometry &geometry_, const Color &backgroundColor_, const GravityType gravity_ )
{
- image()->gravity = gravity_;
backgroundColor ( backgroundColor_ );
- extent ( geometry_ );
+ extent ( geometry_, gravity_ );
}
// Flip image (reflect each scanline in the vertical direction)
// Floodfill pixels matching color (within fuzz factor) of target
// pixel(x,y) with replacement alpha value using method.
-void Magick::Image::floodFillOpacity( const ssize_t x_,
+void Magick::Image::floodFillAlpha( const ssize_t x_,
const ssize_t y_,
const unsigned int alpha_,
const PaintMethod method_ )
modifyImage();
PixelInfo target;
GetPixelInfo(image(),&target);
- PixelPacket pixel=static_cast<PixelPacket>(pixelColor(x_,y_));
+ PixelInfo pixel=static_cast<PixelInfo>(pixelColor(x_,y_));
target.red=pixel.red;
target.green=pixel.green;
target.blue=pixel.blue;
PixelInfo target;
GetPixelInfo(constImage(),&target);
- target.red=static_cast<PixelPacket>(borderColor_).red;
- target.green=static_cast<PixelPacket>(borderColor_).green;
- target.blue=static_cast<PixelPacket>(borderColor_).blue;
+ target.red=static_cast<PixelInfo>(borderColor_).red;
+ target.green=static_cast<PixelInfo>(borderColor_).green;
+ target.blue=static_cast<PixelInfo>(borderColor_).blue;
ExceptionInfo exceptionInfo;
GetExceptionInfo( &exceptionInfo );
FloodfillPaintImage ( image(),
ExceptionInfo exceptionInfo;
GetExceptionInfo( &exceptionInfo );
MagickCore::Image* newImage =
- FrameImage( image(), &info, &exceptionInfo );
+ FrameImage( image(), &info, image()->compose, &exceptionInfo );
replaceImage( newImage );
throwException( exceptionInfo );
(void) DestroyExceptionInfo( &exceptionInfo );
ExceptionInfo exceptionInfo;
GetExceptionInfo( &exceptionInfo );
MagickCore::Image* newImage =
- FrameImage( image(), &info, &exceptionInfo );
+ FrameImage( image(), &info, image()->compose, &exceptionInfo );
replaceImage( newImage );
throwException( exceptionInfo );
(void) DestroyExceptionInfo( &exceptionInfo );
{
ExceptionInfo exceptionInfo;
GetExceptionInfo( &exceptionInfo );
- ChannelType channel_mask = SetPixelChannelMask( image(), channel );
+ ChannelType channel_mask = SetImageChannelMask( image(), channel );
MagickCore::Image* newImage =
FxImage ( image(), expression.c_str(), &exceptionInfo );
- (void) SetPixelChannelMap( image(), channel_mask );
+ (void) SetPixelChannelMask( image(), channel_mask );
replaceImage( newImage );
throwException( exceptionInfo );
(void) DestroyExceptionInfo( &exceptionInfo );
{
ExceptionInfo exceptionInfo;
GetExceptionInfo( &exceptionInfo );
- ChannelType channel_mask = SetPixelChannelMask( image(), channel_ );
+ ChannelType channel_mask = SetImageChannelMask( image(), channel_ );
MagickCore::Image* newImage =
GaussianBlurImage( image(), width_, sigma_, &exceptionInfo );
- (void) SetPixelChannelMap( image(), channel_mask );
+ (void) SetPixelChannelMask( image(), channel_mask );
replaceImage( newImage );
throwException( exceptionInfo );
(void) DestroyExceptionInfo( &exceptionInfo );
ExceptionInfo exceptionInfo;
GetExceptionInfo( &exceptionInfo );
MagickCore::Image* newImage =
- ImplodeImage( image(), factor_, &exceptionInfo );
+ ImplodeImage( image(), factor_, image()->interpolate, &exceptionInfo );
replaceImage( newImage );
throwException( exceptionInfo );
(void) DestroyExceptionInfo( &exceptionInfo );
// Remap image colors with closest color from reference image
void Magick::Image::map ( const Image &mapImage_ , const bool dither_ )
{
+ ExceptionInfo exceptionInfo;
+ GetExceptionInfo( &exceptionInfo );
modifyImage();
options()->quantizeDither( dither_ );
RemapImage ( options()->quantizeInfo(), image(),
- mapImage_.constImage());
- throwImageException();
+ mapImage_.constImage(), &exceptionInfo);
+ throwException( exceptionInfo );
+ (void) DestroyExceptionInfo( &exceptionInfo );
}
// Floodfill designated area with replacement alpha value
void Magick::Image::matteFloodfill ( const Color &target_ ,
modifyImage();
PixelInfo target;
GetPixelInfo(constImage(),&target);
- target.red=static_cast<PixelPacket>(target_).red;
- target.green=static_cast<PixelPacket>(target_).green;
- target.blue=static_cast<PixelPacket>(target_).blue;
+ target.red=static_cast<PixelInfo>(target_).red;
+ target.green=static_cast<PixelInfo>(target_).green;
+ target.blue=static_cast<PixelInfo>(target_).blue;
target.alpha=alpha_;
- ChannelType channel_mask = SetPixelChannelMask( image(), AlphaChannel );
+ ChannelType channel_mask = SetImageChannelMask( image(), AlphaChannel );
ExceptionInfo exceptionInfo;
GetExceptionInfo( &exceptionInfo );
FloodfillPaintImage ( image(), options()->drawInfo(), &target, x_, y_,
method_ == FloodfillMethod ? MagickFalse : MagickTrue, &exceptionInfo);
- (void) SetPixelChannelMap( image(), channel_mask );
+ (void) SetPixelChannelMask( image(), channel_mask );
throwException( exceptionInfo );
(void) DestroyExceptionInfo( &exceptionInfo );
}
(void) DestroyExceptionInfo( &exceptionInfo );
}
+// Merge layers
+void Magick::Image::mergeLayers( const LayerMethod layerMethod_ )
+{
+ ExceptionInfo exceptionInfo;
+ GetExceptionInfo( &exceptionInfo );
+ MagickCore::Image* newImage =
+ MergeImageLayers ( image(),
+ layerMethod_,
+ &exceptionInfo );
+ replaceImage( newImage );
+ throwException( exceptionInfo );
+ (void) DestroyExceptionInfo( &exceptionInfo );
+}
+
// Reduce image by integral size
void Magick::Image::minify ( void )
{
}
// Oilpaint image
-void Magick::Image::oilPaint ( const double radius_ )
+void Magick::Image::oilPaint ( const double radius_, const double sigma_ )
{
ExceptionInfo exceptionInfo;
GetExceptionInfo( &exceptionInfo );
MagickCore::Image* newImage =
- OilPaintImage( image(), radius_, &exceptionInfo );
+ OilPaintImage( image(), radius_, sigma_, &exceptionInfo );
replaceImage( newImage );
throwException( exceptionInfo );
(void) DestroyExceptionInfo( &exceptionInfo );
void Magick::Image::alpha ( const unsigned int alpha_ )
{
modifyImage();
- SetImageOpacity( image(), alpha_ );
+ ExceptionInfo exceptionInfo;
+ GetExceptionInfo( &exceptionInfo );
+ SetImageAlpha( image(), alpha_, &exceptionInfo );
+ throwException( exceptionInfo );
+ (void) DestroyExceptionInfo( &exceptionInfo );
}
// Change the color of an opaque pixel to the pen color.
PixelInfo pen;
ExceptionInfo exceptionInfo;
GetExceptionInfo( &exceptionInfo );
- (void) QueryMagickColor(std::string(opaqueColor_).c_str(),&opaque, &exceptionInfo);
- (void) QueryMagickColor(std::string(penColor_).c_str(),&pen, &exceptionInfo);
+ (void) QueryColorCompliance(std::string(opaqueColor_).c_str(),
+ AllCompliance, &opaque, &exceptionInfo);
+ (void) QueryColorCompliance(std::string(penColor_).c_str(),
+ AllCompliance, &pen, &exceptionInfo);
OpaquePaintImage ( image(), &opaque, &pen, MagickFalse, &exceptionInfo );
throwException( exceptionInfo );
(void) DestroyExceptionInfo( &exceptionInfo );
{
modifyImage();
+ ExceptionInfo exceptionInfo;
+ GetExceptionInfo( &exceptionInfo );
size_t status =
InvokeDynamicImageFilter( name_.c_str(), &image(), argc, argv,
- &image()->exception );
-
- if (status == false)
- throwException( image()->exception );
+ &exceptionInfo );
+ (void) status;
+ throwException( exceptionInfo );
+ (void) DestroyExceptionInfo( &exceptionInfo );
}
// Quantize colors in image using current quantization settings
else
options()->quantizeInfo()->measure_error=MagickFalse;
- QuantizeImage( options()->quantizeInfo(), image() );
+ ExceptionInfo exceptionInfo;
+ GetExceptionInfo( &exceptionInfo );
+ QuantizeImage( options()->quantizeInfo(), image(), &exceptionInfo );
- throwImageException();
+ throwException( exceptionInfo );
+ (void) DestroyExceptionInfo( &exceptionInfo );
}
// Apply an arithmetic or bitwise operator to the image pixel quantums.
{
ExceptionInfo exceptionInfo;
GetExceptionInfo( &exceptionInfo );
- ChannelType channel_mask = SetPixelChannelMask( image(), channel_ );
+ ChannelType channel_mask = SetImageChannelMask( image(), channel_ );
EvaluateImage( image(), operator_, rvalue_, &exceptionInfo);
- (void) SetPixelChannelMap( image(), channel_mask );
+ (void) SetPixelChannelMask( image(), channel_mask );
throwException( exceptionInfo );
(void) DestroyExceptionInfo( &exceptionInfo );
}
geometry.y = y_;
MagickCore::Image *crop_image = CropImage( image(), &geometry,
&exceptionInfo );
- ChannelType channel_mask = SetPixelChannelMask( image(), channel_);
+ ChannelType channel_mask = SetImageChannelMask( image(), channel_);
EvaluateImage( crop_image, operator_, rvalue_, &exceptionInfo );
- (void) SetPixelChannelMap( image(), channel_mask );
- (void) CompositeImage( image(), image()->matte != MagickFalse ?
- OverCompositeOp : CopyCompositeOp, crop_image, geometry.x, geometry.y );
+ (void) SetPixelChannelMask( image(), channel_mask );
+ (void) CompositeImage( image(), crop_image, image()->alpha_trait == BlendPixelTrait ?
+ OverCompositeOp : CopyCompositeOp, MagickFalse, geometry.x, geometry.y,
+ &exceptionInfo );
crop_image = DestroyImageList(crop_image);
throwException( exceptionInfo );
(void) DestroyExceptionInfo( &exceptionInfo );
void Magick::Image::raise ( const Geometry &geometry_ ,
const bool raisedFlag_ )
{
+ ExceptionInfo exceptionInfo;
+ GetExceptionInfo( &exceptionInfo );
RectangleInfo raiseInfo = geometry_;
modifyImage();
- RaiseImage ( image(), &raiseInfo, raisedFlag_ == true ? MagickTrue : MagickFalse );
- throwImageException();
+ RaiseImage ( image(), &raiseInfo, raisedFlag_ == true ? MagickTrue : MagickFalse, &exceptionInfo );
+ throwException( exceptionInfo );
+ (void) DestroyExceptionInfo( &exceptionInfo );
}
ExceptionInfo exceptionInfo;
GetExceptionInfo( &exceptionInfo );
modifyImage();
- ChannelType channel_mask = SetPixelChannelMask( image(), channel_);
+ ChannelType channel_mask = SetImageChannelMask( image(), channel_);
(void) RandomThresholdImage( image(),
static_cast<std::string>(thresholds_).c_str(),
&exceptionInfo );
- (void) SetPixelChannelMap( image(), channel_mask );
+ (void) SetPixelChannelMask( image(), channel_mask );
throwImageException();
(void) DestroyExceptionInfo( &exceptionInfo );
}
}
replaceImage( image );
throwException( exceptionInfo );
- if ( image )
- throwException( image->exception );
(void) DestroyExceptionInfo( &exceptionInfo );
}
blob_.length(), &exceptionInfo );
replaceImage( image );
throwException( exceptionInfo );
- if ( image )
- throwException( image->exception );
(void) DestroyExceptionInfo( &exceptionInfo );
}
&exceptionInfo );
replaceImage( image );
throwException( exceptionInfo );
- if ( image )
- throwException( image->exception );
(void) DestroyExceptionInfo( &exceptionInfo );
}
width,
height,
image()->filter,
- 1.0,
&exceptionInfo);
replaceImage( newImage );
throwException( exceptionInfo );
void Magick::Image::segment ( const double clusterThreshold_,
const double smoothingThreshold_ )
{
+ ExceptionInfo exceptionInfo;
+ GetExceptionInfo( &exceptionInfo );
modifyImage();
SegmentImage ( image(),
options()->quantizeColorSpace(),
(MagickBooleanType) options()->verbose(),
clusterThreshold_,
- smoothingThreshold_ );
- throwImageException();
- SyncImage( image() );
- throwImageException();
+ smoothingThreshold_, &exceptionInfo );
+ SyncImage( image(), &exceptionInfo );
+ throwException( exceptionInfo );
+ (void) DestroyExceptionInfo( &exceptionInfo );
}
// Shade image using distant light source
(void) DestroyExceptionInfo( &exceptionInfo );
}
+// Simulate an image shadow
+void Magick::Image::shadow( const double percent_opacity_, const double sigma_,
+ const ssize_t x_, const ssize_t y_ )
+{
+ ExceptionInfo exceptionInfo;
+ GetExceptionInfo( &exceptionInfo );
+ MagickCore::Image* newImage = ShadowImage( image(), percent_opacity_, sigma_,
+ x_, y_, &exceptionInfo );
+ replaceImage( newImage );
+ throwException( exceptionInfo );
+ (void) DestroyExceptionInfo( &exceptionInfo );
+}
+
// Sharpen pixels in image
void Magick::Image::sharpen ( const double radius_, const double sigma_ )
{
{
ExceptionInfo exceptionInfo;
GetExceptionInfo( &exceptionInfo );
- ChannelType channel_mask = SetPixelChannelMask( image(), channel_ );
+ ChannelType channel_mask = SetImageChannelMask( image(), channel_ );
MagickCore::Image* newImage =
SharpenImage( image(),
radius_,
sigma_,
&exceptionInfo );
- (void) SetPixelChannelMap( image(), channel_mask );
+ (void) SetPixelChannelMask( image(), channel_mask );
replaceImage( newImage );
throwException( exceptionInfo );
(void) DestroyExceptionInfo( &exceptionInfo );
// film to light during the development process)
void Magick::Image::solarize ( const double factor_ )
{
+ ExceptionInfo exceptionInfo;
+ GetExceptionInfo( &exceptionInfo );
modifyImage();
- SolarizeImage ( image(), factor_ );
- throwImageException();
+ SolarizeImage ( image(), factor_, &exceptionInfo );
+ throwException( exceptionInfo );
+ (void) DestroyExceptionInfo( &exceptionInfo );
}
// Sparse color image, given a set of coordinates, interpolates the colors
ExceptionInfo exceptionInfo;
GetExceptionInfo( &exceptionInfo );
- ChannelType channel_mask = SetPixelChannelMask( image(), channel );
+ ChannelType channel_mask = SetImageChannelMask( image(), channel );
MagickCore::Image* newImage = SparseColorImage ( image(), method,
number_arguments, arguments, &exceptionInfo );
- (void) SetPixelChannelMap( image(), channel_mask );
+ (void) SetPixelChannelMask( image(), channel_mask );
replaceImage( newImage );
throwException( exceptionInfo );
(void) DestroyExceptionInfo( &exceptionInfo );
MagickCore::Image* newImage =
SpreadImage( image(),
amount_,
+ image()->interpolate,
&exceptionInfo );
replaceImage( newImage );
throwException( exceptionInfo );
ExceptionInfo exceptionInfo;
GetExceptionInfo( &exceptionInfo );
MagickCore::Image* newImage =
- SwirlImage( image(), degrees_,
+ SwirlImage( image(), degrees_, image()->interpolate,
&exceptionInfo);
replaceImage( newImage );
throwException( exceptionInfo );
void Magick::Image::texture ( const Image &texture_ )
{
modifyImage();
- TextureImage( image(), texture_.constImage() );
- throwImageException();
+ ExceptionInfo exceptionInfo;
+ GetExceptionInfo( &exceptionInfo );
+ TextureImage( image(), texture_.constImage(), &exceptionInfo );
+ throwException( exceptionInfo );
+ (void) DestroyExceptionInfo( &exceptionInfo );
}
// Threshold image
void Magick::Image::threshold ( const double threshold_ )
{
modifyImage();
- BilevelImage( image(), threshold_ );
- throwImageException();
+ ExceptionInfo exceptionInfo;
+ GetExceptionInfo( &exceptionInfo );
+ BilevelImage( image(), threshold_, &exceptionInfo );
+ throwException( exceptionInfo );
+ (void) DestroyExceptionInfo( &exceptionInfo );
}
// Transform image based on image geometry only
void Magick::Image::transform ( const Geometry &imageGeometry_ )
{
modifyImage();
+ ExceptionInfo exceptionInfo;
+ GetExceptionInfo( &exceptionInfo );
TransformImage ( &(image()), 0,
- std::string(imageGeometry_).c_str() );
- throwImageException();
+ std::string(imageGeometry_).c_str(), &exceptionInfo );
+ throwException( exceptionInfo );
+ (void) DestroyExceptionInfo( &exceptionInfo );
}
// Transform image based on image and crop geometries
void Magick::Image::transform ( const Geometry &imageGeometry_,
const Geometry &cropGeometry_ )
{
modifyImage();
+ ExceptionInfo exceptionInfo;
+ GetExceptionInfo( &exceptionInfo );
TransformImage ( &(image()), std::string(cropGeometry_).c_str(),
- std::string(imageGeometry_).c_str() );
- throwImageException();
+ std::string(imageGeometry_).c_str(), &exceptionInfo );
+ throwException( exceptionInfo );
+ (void) DestroyExceptionInfo( &exceptionInfo );
}
// Add matte image to image, setting pixels matching color to transparent
std::string color = color_;
PixelInfo target;
- (void) QueryMagickColor(std::string(color_).c_str(),&target,&image()->exception);
ExceptionInfo exceptionInfo;
GetExceptionInfo( &exceptionInfo );
+ (void) QueryColorCompliance(std::string(color_).c_str(),AllCompliance,
+ &target,&exceptionInfo);
modifyImage();
TransparentPaintImage ( image(), &target, TransparentAlpha, MagickFalse,
&exceptionInfo );
PixelInfo targetLow;
PixelInfo targetHigh;
- (void) QueryMagickColor(std::string(colorLow_).c_str(),&targetLow,
- &image()->exception);
- (void) QueryMagickColor(std::string(colorHigh_).c_str(),&targetHigh,
- &image()->exception);
ExceptionInfo exceptionInfo;
GetExceptionInfo( &exceptionInfo );
+ (void) QueryColorCompliance(std::string(colorLow_).c_str(),
+ AllCompliance,&targetLow,&exceptionInfo);
+ (void) QueryColorCompliance(std::string(colorHigh_).c_str(),
+ AllCompliance,&targetHigh,&exceptionInfo);
modifyImage();
TransparentPaintImageChroma ( image(), &targetLow, &targetHigh,
TransparentAlpha, MagickFalse, &exceptionInfo );
{
ExceptionInfo exceptionInfo;
GetExceptionInfo( &exceptionInfo );
- ChannelType channel_mask = SetPixelChannelMask( image(), channel_ );
+ ChannelType channel_mask = SetImageChannelMask( image(), channel_ );
MagickCore::Image* newImage =
UnsharpMaskImage( image(),
radius_,
amount_,
threshold_,
&exceptionInfo );
- (void) SetPixelChannelMap( image(), channel_mask );
+ (void) SetPixelChannelMask( image(), channel_mask );
replaceImage( newImage );
throwException( exceptionInfo );
(void) DestroyExceptionInfo( &exceptionInfo );
WaveImage( image(),
amplitude_,
wavelength_,
+ image()->interpolate,
&exceptionInfo);
replaceImage( newImage );
throwException( exceptionInfo );
// Write image to file
void Magick::Image::write( const std::string &imageSpec_ )
{
+ ExceptionInfo exceptionInfo;
+ GetExceptionInfo( &exceptionInfo );
modifyImage();
fileName( imageSpec_ );
- WriteImage( imageInfo(), image() );
- throwImageException();
+ WriteImage( imageInfo(), image(), &exceptionInfo );
+ throwException( exceptionInfo );
+ (void) DestroyExceptionInfo( &exceptionInfo );
}
// Write image to in-memory BLOB
size_t length = 2048; // Efficient size for small images
ExceptionInfo exceptionInfo;
GetExceptionInfo( &exceptionInfo );
- void* data = ImageToBlob( imageInfo(),
+ void* data = ImagesToBlob( imageInfo(),
image(),
&length,
&exceptionInfo);
size_t length = 2048; // Efficient size for small images
ExceptionInfo exceptionInfo;
GetExceptionInfo( &exceptionInfo );
- void* data = ImageToBlob( imageInfo(),
+ void* data = ImagesToBlob( imageInfo(),
image(),
&length,
&exceptionInfo);
size_t length = 2048; // Efficient size for small images
ExceptionInfo exceptionInfo;
GetExceptionInfo( &exceptionInfo );
- void* data = ImageToBlob( imageInfo(),
+ void* data = ImagesToBlob( imageInfo(),
image(),
&length,
&exceptionInfo);
width,
height,
image()->filter,
- image()->blur,
&exceptionInfo);
replaceImage( newImage );
throwException( exceptionInfo );
const std::string value_ )
{
modifyImage();
- SetImageProperty( image(), name_.c_str(), value_.c_str() );
+ ExceptionInfo exceptionInfo;
+ GetExceptionInfo( &exceptionInfo );
+ SetImageProperty( image(), name_.c_str(), value_.c_str(), &exceptionInfo );
+ throwException( exceptionInfo );
+ (void) DestroyExceptionInfo( &exceptionInfo );
}
std::string Magick::Image::attribute ( const std::string name_ )
{
- const char *value = GetImageProperty( constImage(), name_.c_str() );
+ ExceptionInfo exceptionInfo;
+ GetExceptionInfo( &exceptionInfo );
+ const char *value = GetImageProperty( constImage(), name_.c_str(),
+ &exceptionInfo );
+ throwException( exceptionInfo );
+ (void) DestroyExceptionInfo( &exceptionInfo );
if ( value )
return std::string( value );
// Use SyncImage to synchronize the DirectClass pixels with the
// color map and then set to DirectClass type.
modifyImage();
- SyncImage( image() );
- image()->colormap = (PixelPacket *)
+ ExceptionInfo exceptionInfo;
+ GetExceptionInfo( &exceptionInfo );
+ SyncImage( image(), &exceptionInfo );
+ throwException( exceptionInfo );
+ (void) DestroyExceptionInfo( &exceptionInfo );
+ image()->colormap = (PixelInfo *)
RelinquishMagickMemory( image()->colormap );
image()->storage_class = static_cast<MagickCore::ClassType>(DirectClass);
return;
{
modifyImage();
+ ExceptionInfo exceptionInfo;
+ GetExceptionInfo( &exceptionInfo );
if( clipMask_.isValid() )
{
// Set clip mask
- SetImageClipMask( image(), clipMask_.constImage() );
+ SetImageMask( image(), clipMask_.constImage(), &exceptionInfo );
}
else
{
// Unset existing clip mask
- SetImageClipMask( image(), 0 );
+ SetImageMask( image(), 0, &exceptionInfo );
}
+ throwException( exceptionInfo );
+ (void) DestroyExceptionInfo( &exceptionInfo );
}
Magick::Image Magick::Image::clipMask ( void ) const
{
- ExceptionInfo exceptionInfo;
- GetExceptionInfo( &exceptionInfo );
- MagickCore::Image* image =
- GetImageClipMask( constImage(), &exceptionInfo );
- throwException( exceptionInfo );
- (void) DestroyExceptionInfo( &exceptionInfo );
- return Magick::Image( image );
+ ExceptionInfo exceptionInfo;
+ GetExceptionInfo( &exceptionInfo );
+ MagickCore::Image* image = GetImageMask( constImage(), &exceptionInfo );
+ throwException( exceptionInfo );
+ (void) DestroyExceptionInfo( &exceptionInfo );
+ return Magick::Image( image );
}
void Magick::Image::colorFuzz ( const double fuzz_ )
{
// Allocate colormap
imageptr->colormap =
- static_cast<PixelPacket*>(AcquireMagickMemory(entries_*sizeof(PixelPacket)));
+ static_cast<PixelInfo*>(AcquireMagickMemory(entries_*sizeof(PixelInfo)));
imageptr->colors = 0;
}
else if ( entries_ > imageptr->colors )
{
// Re-allocate colormap
- imageptr->colormap=(PixelPacket *)
- ResizeMagickMemory(imageptr->colormap,(entries_)*sizeof(PixelPacket));
+ imageptr->colormap=(PixelInfo *)
+ ResizeMagickMemory(imageptr->colormap,(entries_)*sizeof(PixelInfo));
}
// Initialize any new colormap entries as all black
// Image colorspace
void Magick::Image::colorSpace( const ColorspaceType colorSpace_ )
{
- // Nothing to do?
if ( image()->colorspace == colorSpace_ )
return;
modifyImage();
-
- if ( colorSpace_ != RGBColorspace &&
- colorSpace_ != sRGBColorspace &&
- colorSpace_ != TransparentColorspace &&
- colorSpace_ != GRAYColorspace )
- {
- if (image()->colorspace != RGBColorspace &&
- image()->colorspace != sRGBColorspace &&
- image()->colorspace != TransparentColorspace &&
- image()->colorspace != GRAYColorspace)
- {
- /* Transform to RGB colorspace as intermediate step */
- TransformRGBImage( image(), image()->colorspace );
- throwImageException();
- }
- /* Transform to final non-RGB colorspace */
- RGBTransformImage( image(), colorSpace_ );
- throwImageException();
- return;
- }
-
- if ( colorSpace_ == RGBColorspace ||
- colorSpace_ == sRGBColorspace ||
- colorSpace_ == TransparentColorspace ||
- colorSpace_ == GRAYColorspace )
- {
- /* Transform to a RGB-type colorspace */
- TransformRGBImage( image(), image()->colorspace );
- throwImageException();
- return;
- }
+ ExceptionInfo exceptionInfo;
+ GetExceptionInfo( &exceptionInfo );
+ TransformImageColorspace(image(), colorSpace_, &exceptionInfo);
+ throwException( exceptionInfo );
+ (void) DestroyExceptionInfo( &exceptionInfo );
}
Magick::ColorspaceType Magick::Image::colorSpace ( void ) const
{
void Magick::Image::colorspaceType( const ColorspaceType colorSpace_ )
{
modifyImage();
+ ExceptionInfo exceptionInfo;
+ GetExceptionInfo( &exceptionInfo );
+ SetImageColorspace(image(), colorSpace_, &exceptionInfo);
+ throwException( exceptionInfo );
+ (void) DestroyExceptionInfo( &exceptionInfo );
options()->colorspaceType( colorSpace_ );
}
Magick::ColorspaceType Magick::Image::colorspaceType ( void ) const
void Magick::Image::comment ( const std::string &comment_ )
{
modifyImage();
- SetImageProperty( image(), "Comment", NULL );
+ ExceptionInfo exceptionInfo;
+ GetExceptionInfo( &exceptionInfo );
+ SetImageProperty( image(), "Comment", NULL, &exceptionInfo );
if ( comment_.length() > 0 )
- SetImageProperty( image(), "Comment", comment_.c_str() );
- throwImageException();
+ SetImageProperty( image(), "Comment", comment_.c_str(), &exceptionInfo );
+ throwException( exceptionInfo );
+ (void) DestroyExceptionInfo( &exceptionInfo );
}
std::string Magick::Image::comment ( void ) const
{
- const char *value = GetImageProperty( constImage(), "Comment" );
+ ExceptionInfo exceptionInfo;
+ GetExceptionInfo( &exceptionInfo );
+ const char *value = GetImageProperty( constImage(), "Comment",
+ &exceptionInfo );
+ throwException( exceptionInfo );
+ (void) DestroyExceptionInfo( &exceptionInfo );
if ( value )
return std::string( value );
options()->density( density_ );
if ( density_.isValid() )
{
- image()->x_resolution = density_.width();
+ image()->resolution.x = density_.width();
if ( density_.height() != 0 )
{
- image()->y_resolution = density_.height();
+ image()->resolution.y = density_.height();
}
else
{
- image()->y_resolution = density_.width();
+ image()->resolution.y = density_.width();
}
}
else
{
// Reset to default
- image()->x_resolution = 0;
- image()->y_resolution = 0;
+ image()->resolution.x = 0;
+ image()->resolution.y = 0;
}
}
Magick::Geometry Magick::Image::density ( void ) const
ssize_t x_resolution=72;
ssize_t y_resolution=72;
- if (constImage()->x_resolution > 0.0)
- x_resolution=static_cast<ssize_t>(constImage()->x_resolution + 0.5);
+ if (constImage()->resolution.x > 0.0)
+ x_resolution=static_cast<ssize_t>(constImage()->resolution.x + 0.5);
- if (constImage()->y_resolution > 0.0)
- y_resolution=static_cast<ssize_t>(constImage()->y_resolution + 0.5);
+ if (constImage()->resolution.y > 0.0)
+ y_resolution=static_cast<ssize_t>(constImage()->resolution.y + 0.5);
return Geometry(x_resolution,y_resolution);
}
{
StringInfo * exif_profile = AcquireStringInfo( exifProfile_.length() );
SetStringInfoDatum(exif_profile ,(unsigned char *) exifProfile_.data());
- (void) SetImageProfile( image(), "exif", exif_profile);
+ ExceptionInfo exceptionInfo;
+ GetExceptionInfo( &exceptionInfo );
+ (void) SetImageProfile( image(), "exif", exif_profile, &exceptionInfo);
exif_profile =DestroyStringInfo( exif_profile );
+ throwException( exceptionInfo );
+ (void) DestroyExceptionInfo( &exceptionInfo );
}
}
Magick::Blob Magick::Image::exifProfile( void ) const
&exceptionInfo);
texture.replaceImage( image );
throwException( exceptionInfo );
- (void) DestroyExceptionInfo( &exceptionInfo );
+ (void) DestroyExceptionInfo( &exceptionInfo );
}
return texture;
}
{
DrawInfo *drawInfo = options()->drawInfo();
drawInfo->text = const_cast<char *>(text_.c_str());
- GetTypeMetrics( image(), drawInfo, &(metrics->_typeMetric) );
+ ExceptionInfo exceptionInfo;
+ GetExceptionInfo( &exceptionInfo );
+ GetTypeMetrics( image(), drawInfo, &(metrics->_typeMetric), &exceptionInfo );
drawInfo->text = 0;
+ throwException( exceptionInfo );
+ (void) DestroyExceptionInfo( &exceptionInfo );
}
// Image format string
{
StringInfo * iptc_profile = AcquireStringInfo( iptcProfile_.length() );
SetStringInfoDatum(iptc_profile ,(unsigned char *) iptcProfile_.data());
- (void) SetImageProfile( image(), "iptc", iptc_profile);
- iptc_profile =DestroyStringInfo( iptc_profile );
+ ExceptionInfo exceptionInfo;
+ GetExceptionInfo( &exceptionInfo );
+ (void) SetImageProfile( image(), "iptc", iptc_profile, &exceptionInfo);
+ iptc_profile =DestroyStringInfo( iptc_profile );
+ throwException( exceptionInfo );
+ (void) DestroyExceptionInfo( &exceptionInfo );
}
}
Magick::Blob Magick::Image::iptcProfile( void ) const
void Magick::Image::label ( const std::string &label_ )
{
modifyImage();
- SetImageProperty ( image(), "Label", NULL );
+ ExceptionInfo exceptionInfo;
+ GetExceptionInfo( &exceptionInfo );
+ SetImageProperty ( image(), "Label", NULL, &exceptionInfo );
if ( label_.length() > 0 )
- SetImageProperty ( image(), "Label", label_.c_str() );
- throwImageException();
+ SetImageProperty ( image(), "Label", label_.c_str(), &exceptionInfo );
+ throwException( exceptionInfo );
+ (void) DestroyExceptionInfo( &exceptionInfo );
}
std::string Magick::Image::label ( void ) const
{
- const char *value = GetImageProperty( constImage(), "Label" );
+ ExceptionInfo exceptionInfo;
+ GetExceptionInfo( &exceptionInfo );
+ const char *value = GetImageProperty( constImage(), "Label", &exceptionInfo );
+ throwException( exceptionInfo );
+ (void) DestroyExceptionInfo( &exceptionInfo );
if ( value )
return std::string( value );
// matte channel, then create an opaque matte channel. Likewise, if
// the image already has a matte channel but a matte channel is not
// desired, then set the matte channel to opaque.
- if ((matteFlag_ && !constImage()->matte) ||
- (constImage()->matte && !matteFlag_))
- SetImageOpacity(image(),OpaqueAlpha);
+ ExceptionInfo exceptionInfo;
+ GetExceptionInfo( &exceptionInfo );
+ if ((matteFlag_ && !constImage()->alpha_trait) ||
+ (constImage()->alpha_trait && !matteFlag_))
+ SetImageAlpha(image(),OpaqueAlpha,&exceptionInfo);
+ throwException( exceptionInfo );
+ (void) DestroyExceptionInfo( &exceptionInfo );
- image()->matte = (MagickBooleanType) matteFlag_;
+ image()->alpha_trait = matteFlag_ ? BlendPixelTrait : UndefinedPixelTrait;
}
bool Magick::Image::matte ( void ) const
{
- if ( constImage()->matte )
+ if ( constImage()->alpha_trait == BlendPixelTrait )
return true;
else
return false;
}
Magick::Color Magick::Image::matteColor ( void ) const
{
- return Color( constImage()->matte_color.red,
- constImage()->matte_color.green,
- constImage()->matte_color.blue );
+ return Color( ClampToQuantum( constImage()->matte_color.red ),
+ ClampToQuantum( constImage()->matte_color.green ),
+ ClampToQuantum( constImage()->matte_color.blue ) );
}
double Magick::Image::meanErrorPerPixel ( void ) const
void Magick::Image::modulusDepth ( const size_t depth_ )
{
modifyImage();
- SetImageDepth( image(), depth_ );
+ ExceptionInfo exceptionInfo;
+ GetExceptionInfo( &exceptionInfo );
+ SetImageDepth( image(), depth_, &exceptionInfo );
+ throwException( exceptionInfo );
+ (void) DestroyExceptionInfo( &exceptionInfo );
options()->depth( depth_ );
}
size_t Magick::Image::modulusDepth ( void ) const
Pixels pixels(*this);
// Set pixel value
Quantum *pixel = pixels.get(x_, y_, 1, 1 );
- PixelPacket packet = color_;
- MagickCore::SetPixelPacket(constImage(),&packet,pixel);
+ PixelInfo packet = color_;
+ MagickCore::SetPixelInfoPixel(constImage(),&packet,pixel);
// Tell ImageMagick that pixels have been updated
pixels.sync();
Magick::Color Magick::Image::pixelColor ( const ssize_t x_,
const ssize_t y_ ) const
{
- ClassType storage_class;
- storage_class = classType();
- // DirectClass
const Quantum* pixel = getConstPixels( x_, y_, 1, 1 );
if ( pixel )
{
- PixelPacket packet;
- MagickCore::GetPixelPacket(constImage(),pixel,&packet);
+ PixelInfo packet;
+ MagickCore::GetPixelInfoPixel(constImage(),pixel,&packet);
return Color( packet );
}
const Magick::Blob &profile_ )
{
modifyImage();
+ ExceptionInfo exceptionInfo;
+ GetExceptionInfo( &exceptionInfo );
ssize_t result = ProfileImage( image(), name_.c_str(),
(unsigned char *)profile_.data(),
- profile_.length(), MagickTrue);
+ profile_.length(), &exceptionInfo);
+ (void) result;
+ throwException( exceptionInfo );
+ (void) DestroyExceptionInfo( &exceptionInfo );
- if( !result )
- throwImageException();
}
// Retrieve a named profile from the image.
Lock( &_imgRef->_mutexLock );
// Re-calculate image signature if necessary
+ ExceptionInfo exceptionInfo;
+ GetExceptionInfo( &exceptionInfo );
if ( force_ ||
- !GetImageProperty(constImage(), "Signature") ||
+ !GetImageProperty(constImage(), "Signature", &exceptionInfo) ||
constImage()->taint )
{
- SignatureImage( const_cast<MagickCore::Image *>(constImage()) );
+ SignatureImage( const_cast<MagickCore::Image *>(constImage()), &exceptionInfo );
}
- const char *property = GetImageProperty(constImage(), "Signature");
+ const char *property = GetImageProperty(constImage(), "Signature",
+ &exceptionInfo);
+ throwException( exceptionInfo );
+ (void) DestroyExceptionInfo( &exceptionInfo );
return std::string( property );
}
ExceptionInfo exceptionInfo;
GetExceptionInfo( &exceptionInfo );
- ChannelType channel_mask = SetPixelChannelMask( image(), RedChannel);
+ ChannelType channel_mask = SetImageChannelMask( image(), RedChannel);
(void) GetImageRange( image(),&minimum,&maximum,&exceptionInfo);
statistics->red.minimum=minimum;
statistics->red.maximum=maximum;
&statistics->red.standard_deviation,&exceptionInfo);
(void) GetImageKurtosis( image(),&statistics->red.kurtosis,
&statistics->red.skewness,&exceptionInfo);
- (void) SetPixelChannelMap( image(), channel_mask );
+ (void) SetPixelChannelMask( image(), channel_mask );
- channel_mask = SetPixelChannelMask( image(), GreenChannel);
+ channel_mask = SetImageChannelMask( image(), GreenChannel);
(void) GetImageRange( image(),&minimum,&maximum,&exceptionInfo);
statistics->green.minimum=minimum;
statistics->green.maximum=maximum;
&statistics->green.standard_deviation,&exceptionInfo);
(void) GetImageKurtosis( image(),&statistics->green.kurtosis,
&statistics->green.skewness,&exceptionInfo);
- (void) SetPixelChannelMap( image(), channel_mask );
+ (void) SetPixelChannelMask( image(), channel_mask );
- channel_mask = SetPixelChannelMask( image(), GreenChannel);
+ channel_mask = SetImageChannelMask( image(), GreenChannel);
(void) GetImageRange( image(),&minimum,&maximum,&exceptionInfo);
statistics->blue.minimum=minimum;
statistics->blue.maximum=maximum;
&statistics->blue.standard_deviation,&exceptionInfo);
(void) GetImageKurtosis( image(),&statistics->blue.kurtosis,
&statistics->blue.skewness,&exceptionInfo);
- (void) SetPixelChannelMap( image(), channel_mask );
+ (void) SetPixelChannelMask( image(), channel_mask );
- channel_mask = SetPixelChannelMask( image(), AlphaChannel);
+ channel_mask = SetImageChannelMask( image(), AlphaChannel);
(void) GetImageRange( image(),&minimum,&maximum,&exceptionInfo);
statistics->alpha.minimum=minimum;
statistics->alpha.maximum=maximum;
&statistics->alpha.standard_deviation,&exceptionInfo);
(void) GetImageKurtosis( image(),&statistics->alpha.kurtosis,
&statistics->alpha.skewness,&exceptionInfo);
- (void) SetPixelChannelMap( image(), channel_mask );
+ (void) SetPixelChannelMask( image(), channel_mask );
throwException( exceptionInfo );
(void) DestroyExceptionInfo( &exceptionInfo );
void Magick::Image::strip ( void )
{
modifyImage();
- StripImage( image() );
- throwImageException();
+ ExceptionInfo exceptionInfo;
+ GetExceptionInfo( &exceptionInfo );
+ StripImage( image(), &exceptionInfo );
+ throwException( exceptionInfo );
+ (void) DestroyExceptionInfo( &exceptionInfo );
}
// enabled/disable stroke anti-aliasing
MagickTrue, // orphan
&exceptionInfo);
throwException( exceptionInfo );
- (void) DestroyExceptionInfo( &exceptionInfo );
+ (void) DestroyExceptionInfo( &exceptionInfo );
texture.replaceImage( image );
}
return texture;
}
void Magick::Image::type ( const Magick::ImageType type_)
{
+ ExceptionInfo exceptionInfo;
+ GetExceptionInfo( &exceptionInfo );
modifyImage();
options()->type( type_ );
- SetImageType( image(), type_ );
+ SetImageType( image(), type_, &exceptionInfo );
+ throwException( exceptionInfo );
+ (void) DestroyExceptionInfo( &exceptionInfo );
}
void Magick::Image::verbose ( const bool verboseFlag_ )
void Magick::Image::virtualPixelMethod ( const VirtualPixelMethod virtual_pixel_method_ )
{
modifyImage();
- SetImageVirtualPixelMethod( image(), virtual_pixel_method_ );
- options()->virtualPixelMethod( virtual_pixel_method_ );
+ ExceptionInfo exceptionInfo;
+ GetExceptionInfo( &exceptionInfo );
+ SetImageVirtualPixelMethod( image(), virtual_pixel_method_, &exceptionInfo );
+ throwException( exceptionInfo );
+ (void) DestroyExceptionInfo( &exceptionInfo );
}
Magick::VirtualPixelMethod Magick::Image::virtualPixelMethod ( void ) const
{
double Magick::Image::xResolution ( void ) const
{
- return constImage()->x_resolution;
+ return constImage()->resolution.x;
}
double Magick::Image::yResolution ( void ) const
{
- return constImage()->y_resolution;
+ return constImage()->resolution.y;
}
// Copy Constructor
if( replacement_ )
image = replacement_;
else
- image = AcquireImage(constImageInfo());
+ {
+ ExceptionInfo exceptionInfo;
+ GetExceptionInfo( &exceptionInfo );
+ image = AcquireImage(constImageInfo(), &exceptionInfo);
+ throwException( exceptionInfo );
+ (void) DestroyExceptionInfo( &exceptionInfo );
+ }
{
Lock( &_imgRef->_mutexLock );
void Magick::Image::throwImageException( void ) const
{
// Throw C++ exception while resetting Image exception to default state
- throwException( const_cast<MagickCore::Image*>(constImage())->exception );
}
// Register image with image registry or obtain registration id
}
// C library initialization routine
-void MagickDLLDecl Magick::InitializeMagick(const char *path_)
+void MagickPPExport Magick::InitializeMagick(const char *path_)
{
MagickCore::MagickCoreGenesis(path_,MagickFalse);
if (!magick_initialized)