//
MagickPPExport int Magick::operator == ( const Magick::Image& left_,
- const Magick::Image& right_ )
+ const Magick::Image& right_ )
{
// If image pixels and signature are the same, then the image is identical
return ( ( left_.rows() == right_.rows() ) &&
- ( left_.columns() == right_.columns() ) &&
- ( left_.signature() == right_.signature() )
- );
+ ( left_.columns() == right_.columns() ) &&
+ ( left_.signature() == right_.signature() )
+ );
}
MagickPPExport int Magick::operator != ( const Magick::Image& left_,
- const Magick::Image& right_ )
+ const Magick::Image& right_ )
{
return ( ! (left_ == right_) );
}
MagickPPExport int Magick::operator > ( const Magick::Image& left_,
- const Magick::Image& right_ )
+ const Magick::Image& right_ )
{
return ( !( left_ < right_ ) && ( left_ != right_ ) );
}
MagickPPExport int Magick::operator < ( const Magick::Image& left_,
- const Magick::Image& right_ )
+ const Magick::Image& right_ )
{
// If image pixels are less, then image is smaller
return ( ( left_.rows() * left_.columns() ) <
- ( right_.rows() * right_.columns() )
- );
+ ( right_.rows() * right_.columns() )
+ );
}
MagickPPExport int Magick::operator >= ( const Magick::Image& left_,
- const Magick::Image& right_ )
+ const Magick::Image& right_ )
{
return ( ( left_ > right_ ) || ( left_ == right_ ) );
}
MagickPPExport int Magick::operator <= ( const Magick::Image& left_,
- const Magick::Image& right_ )
+ const Magick::Image& right_ )
{
return ( ( left_ < right_ ) || ( left_ == right_ ) );
}
//
// Construct from image file or image specification
-Magick::Image::Image( const std::string &imageSpec_ )
+Magick::Image::Image ( const std::string &imageSpec_ )
: _imgRef(new ImageRef)
{
try
}
// Construct a blank image canvas of specified size and color
-Magick::Image::Image( const Geometry &size_,
- const Color &color_ )
+Magick::Image::Image ( const Geometry &size_,
+ const Color &color_ )
: _imgRef(new ImageRef)
{
// xc: prefix specifies an X11 color string
// Construct Image of specified size from in-memory BLOB
Magick::Image::Image ( const Blob &blob_,
- const Geometry &size_ )
+ const Geometry &size_ )
: _imgRef(new ImageRef)
{
try
// Construct Image of specified size and depth from in-memory BLOB
Magick::Image::Image ( const Blob &blob_,
- const Geometry &size_,
- const size_t depth_ )
+ const Geometry &size_,
+ const size_t depth_ )
: _imgRef(new ImageRef)
{
try
// Construct Image of specified size, depth, and format from in-memory BLOB
Magick::Image::Image ( const Blob &blob_,
- const Geometry &size_,
- const size_t depth_,
- const std::string &magick_ )
+ const Geometry &size_,
+ const size_t depth_,
+ const std::string &magick_ )
: _imgRef(new ImageRef)
{
try
// Construct Image of specified size, and format from in-memory BLOB
Magick::Image::Image ( const Blob &blob_,
- const Geometry &size_,
- const std::string &magick_ )
+ const Geometry &size_,
+ const std::string &magick_ )
: _imgRef(new ImageRef)
{
try
}
// Default constructor
-Magick::Image::Image( void )
+Magick::Image::Image ( void )
: _imgRef(new ImageRef)
{
}
}
// Adaptive-blur image
-void Magick::Image::adaptiveBlur( const double radius_, const double sigma_ )
+void Magick::Image::adaptiveBlur ( const double radius_, const double sigma_ )
{
ExceptionInfo exceptionInfo;
GetExceptionInfo( &exceptionInfo );
MagickCore::Image* newImage =
- AdaptiveBlurImage( image(), radius_, sigma_, &exceptionInfo);
+ AdaptiveBlurImage( constImage(), radius_, sigma_, &exceptionInfo );
replaceImage( newImage );
throwException( exceptionInfo );
(void) DestroyExceptionInfo( &exceptionInfo );
ExceptionInfo exceptionInfo;
GetExceptionInfo( &exceptionInfo );
MagickCore::Image* newImage =
- AdaptiveThresholdImage( constImage(), width_, height_, offset_, &exceptionInfo );
+ AdaptiveThresholdImage( constImage(), width_, height_, offset_,
+ &exceptionInfo );
replaceImage( newImage );
throwException( exceptionInfo );
(void) DestroyExceptionInfo( &exceptionInfo );
}
// Add noise to image
-void Magick::Image::addNoise( const NoiseType noiseType_ )
+void Magick::Image::addNoise ( const NoiseType noiseType_ )
{
ExceptionInfo exceptionInfo;
GetExceptionInfo( &exceptionInfo );
MagickCore::Image* newImage =
- AddNoiseImage ( image(),
- noiseType_, 1.0,
- &exceptionInfo );
+ AddNoiseImage ( constImage(), noiseType_, 1.0, &exceptionInfo );
replaceImage( newImage );
throwException( exceptionInfo );
(void) DestroyExceptionInfo( &exceptionInfo );
}
-void Magick::Image::addNoiseChannel( const ChannelType channel_,
+void Magick::Image::addNoiseChannel ( const ChannelType channel_,
const NoiseType noiseType_ )
{
ExceptionInfo exceptionInfo;
GetExceptionInfo( &exceptionInfo );
ChannelType channel_mask = SetImageChannelMask( image(), channel_);
MagickCore::Image* newImage =
- AddNoiseImage ( image(),
- noiseType_, 1.0,
- &exceptionInfo );
+ AddNoiseImage ( constImage(), noiseType_, 1.0, &exceptionInfo );
(void) SetPixelChannelMask( image(), channel_mask );
replaceImage( newImage );
throwException( exceptionInfo );
{
ExceptionInfo exceptionInfo;
GetExceptionInfo( &exceptionInfo );
-
+
AffineMatrix _affine;
_affine.sx = affine_.sx();
_affine.sy = affine_.sy();
_affine.rx = affine_.rx();
_affine.ry = affine_.ry();
- _affine.tx = affine_.tx();
+ _affine.tx = affine_.tx();
_affine.ty = affine_.ty();
-
+
MagickCore::Image* newImage =
- AffineTransformImage( image(), &_affine, &exceptionInfo);
+ AffineTransformImage( constImage(), &_affine, &exceptionInfo );
replaceImage( newImage );
throwException( exceptionInfo );
(void) DestroyExceptionInfo( &exceptionInfo );
// Annotate using specified text, and placement location
void Magick::Image::annotate ( const std::string &text_,
- const Geometry &location_ )
+ const Geometry &location_ )
{
annotate ( text_, location_, NorthWestGravity, 0.0 );
}
// Annotate using specified text, bounding area, and placement gravity
void Magick::Image::annotate ( const std::string &text_,
- const Geometry &boundingArea_,
- const GravityType gravity_ )
+ const Geometry &boundingArea_,
+ const GravityType gravity_ )
{
annotate ( text_, boundingArea_, gravity_, 0.0 );
}
// Annotate with text using specified text, bounding area, placement
// gravity, and rotation.
void Magick::Image::annotate ( const std::string &text_,
- const Geometry &boundingArea_,
- const GravityType gravity_,
- const double degrees_ )
+ const Geometry &boundingArea_,
+ const GravityType gravity_,
+ const double degrees_ )
{
modifyImage();
char boundingArea[MaxTextExtent];
drawInfo->geometry = 0;
- if ( boundingArea_.isValid() ){
- if ( boundingArea_.width() == 0 || boundingArea_.height() == 0 )
- {
- FormatLocaleString( boundingArea, MaxTextExtent, "%+.20g%+.20g",
- (double) boundingArea_.xOff(), (double) boundingArea_.yOff() );
- }
- else
- {
- (void) CopyMagickString( boundingArea, string(boundingArea_).c_str(),
- MaxTextExtent);
- }
- drawInfo->geometry = boundingArea;
- }
+ if ( boundingArea_.isValid() )
+ {
+ if ( boundingArea_.width() == 0 || boundingArea_.height() == 0 )
+ {
+ FormatLocaleString( boundingArea, MaxTextExtent, "%+.20g%+.20g",
+ (double) boundingArea_.xOff(), (double) boundingArea_.yOff() );
+ }
+ else
+ {
+ (void) CopyMagickString( boundingArea, string(boundingArea_).c_str(),
+ MaxTextExtent);
+ }
+ drawInfo->geometry = boundingArea;
+ }
drawInfo->gravity = gravity_;
}
// Annotate with text (bounding area is entire image) and placement gravity.
void Magick::Image::annotate ( const std::string &text_,
- const GravityType gravity_ )
+ const GravityType gravity_ )
{
modifyImage();
modifyImage();
ExceptionInfo exceptionInfo;
GetExceptionInfo( &exceptionInfo );
- AutoGammaImage( image(), &exceptionInfo);
+ AutoGammaImage( image(), &exceptionInfo );
throwException( exceptionInfo );
(void) DestroyExceptionInfo( &exceptionInfo );
}
ExceptionInfo exceptionInfo;
GetExceptionInfo( &exceptionInfo );
ChannelType channel_mask = SetImageChannelMask( image(), channel_ );
- AutoGammaImage( image(), &exceptionInfo);
+ AutoGammaImage( image(), &exceptionInfo );
(void) SetPixelChannelMask( image(), channel_mask );
throwException( exceptionInfo );
(void) DestroyExceptionInfo( &exceptionInfo );
ExceptionInfo exceptionInfo;
GetExceptionInfo( &exceptionInfo );
MagickCore::Image* newImage =
- AutoOrientImage( constImage(), image()->orientation, &exceptionInfo);
+ AutoOrientImage( constImage(), image()->orientation, &exceptionInfo );
replaceImage( newImage );
throwException( exceptionInfo );
(void) DestroyExceptionInfo( &exceptionInfo );
}
+void Magick::Image::blackThreshold ( const std::string &threshold_ )
+{
+ modifyImage();
+ ExceptionInfo exceptionInfo;
+ GetExceptionInfo( &exceptionInfo );
+ BlackThresholdImage( image(), threshold_.c_str(), &exceptionInfo );
+ throwException( exceptionInfo );
+ (void) DestroyExceptionInfo( &exceptionInfo );
+}
+
+void Magick::Image::blackThresholdChannel ( const ChannelType channel_,
+ const std::string &threshold_ )
+{
+ modifyImage();
+ ExceptionInfo exceptionInfo;
+ GetExceptionInfo( &exceptionInfo );
+ ChannelType channel_mask = SetImageChannelMask( image(), channel_ );
+ BlackThresholdImage( image(), threshold_.c_str(), &exceptionInfo );
+ (void) SetPixelChannelMask( image(), channel_mask );
+ throwException( exceptionInfo );
+ (void) DestroyExceptionInfo( &exceptionInfo );
+}
+
// Blur image
-void Magick::Image::blur( const double radius_, const double sigma_ )
+void Magick::Image::blur ( const double radius_, const double sigma_ )
{
ExceptionInfo exceptionInfo;
GetExceptionInfo( &exceptionInfo );
MagickCore::Image* newImage =
- BlurImage( image(), radius_, sigma_, &exceptionInfo);
+ BlurImage( constImage(), radius_, sigma_, &exceptionInfo );
replaceImage( newImage );
throwException( exceptionInfo );
(void) DestroyExceptionInfo( &exceptionInfo );
}
-void Magick::Image::blurChannel( const ChannelType channel_,
- const double radius_, const double sigma_ )
+void Magick::Image::blurChannel ( const ChannelType channel_,
+ const double radius_, const double sigma_ )
{
ExceptionInfo exceptionInfo;
GetExceptionInfo( &exceptionInfo );
ChannelType channel_mask = SetImageChannelMask( image(), channel_ );
MagickCore::Image* newImage =
- BlurImage( image(), radius_, sigma_, &exceptionInfo);
+ BlurImage( constImage(), radius_, sigma_, &exceptionInfo );
(void) SetPixelChannelMask( image(), channel_mask );
replaceImage( newImage );
throwException( exceptionInfo );
ExceptionInfo exceptionInfo;
GetExceptionInfo( &exceptionInfo );
MagickCore::Image* newImage =
- WaveImage( image(),
- amplitude_,
- wavelength_,
- image()->interpolate,
- &exceptionInfo);
+ WaveImage( constImage(), amplitude_, wavelength_, image()->interpolate,
+ &exceptionInfo );
replaceImage( newImage );
throwException( exceptionInfo );
(void) DestroyExceptionInfo( &exceptionInfo );
}
+void Magick::Image::whiteThreshold ( const std::string &threshold_ )
+{
+ modifyImage();
+ ExceptionInfo exceptionInfo;
+ GetExceptionInfo( &exceptionInfo );
+ WhiteThresholdImage( image(), threshold_.c_str(), &exceptionInfo );
+ throwException( exceptionInfo );
+ (void) DestroyExceptionInfo( &exceptionInfo );
+}
+
+void Magick::Image::whiteThresholdChannel ( const ChannelType channel_,
+ const std::string &threshold_ )
+{
+ modifyImage();
+ ExceptionInfo exceptionInfo;
+ GetExceptionInfo( &exceptionInfo );
+ ChannelType channel_mask = SetImageChannelMask( image(), channel_ );
+ WhiteThresholdImage( image(), threshold_.c_str(), &exceptionInfo );
+ (void) SetPixelChannelMask( image(), channel_mask );
+ throwException( exceptionInfo );
+ (void) DestroyExceptionInfo( &exceptionInfo );
+}
+
// Write image to file
-void Magick::Image::write( const std::string &imageSpec_ )
+void Magick::Image::write ( const std::string &imageSpec_ )
{
ExceptionInfo exceptionInfo;
GetExceptionInfo( &exceptionInfo );
modifyImage();
fileName( imageSpec_ );
- WriteImage( imageInfo(), image(), &exceptionInfo );
+ WriteImage( constImageInfo(), image(), &exceptionInfo );
throwException( exceptionInfo );
(void) DestroyExceptionInfo( &exceptionInfo );
}
size_t length = 2048; // Efficient size for small images
ExceptionInfo exceptionInfo;
GetExceptionInfo( &exceptionInfo );
- void* data = ImagesToBlob( imageInfo(),
- image(),
- &length,
- &exceptionInfo);
+ void* data = ImagesToBlob( constImageInfo(), image(), &length,
+ &exceptionInfo);
throwException( exceptionInfo );
blob_->updateNoCopy( data, length, Blob::MallocAllocator );
throwImageException();
(void) DestroyExceptionInfo( &exceptionInfo );
}
void Magick::Image::write ( Blob *blob_,
- const std::string &magick_ )
+ const std::string &magick_ )
{
modifyImage();
magick(magick_);
size_t length = 2048; // Efficient size for small images
ExceptionInfo exceptionInfo;
GetExceptionInfo( &exceptionInfo );
- void* data = ImagesToBlob( imageInfo(),
- image(),
- &length,
- &exceptionInfo);
+ void* data = ImagesToBlob( constImageInfo(), image(), &length,
+ &exceptionInfo );
throwException( exceptionInfo );
blob_->updateNoCopy( data, length, Blob::MallocAllocator );
throwImageException();
(void) DestroyExceptionInfo( &exceptionInfo );
}
void Magick::Image::write ( Blob *blob_,
- const std::string &magick_,
- const size_t depth_ )
+ const std::string &magick_,
+ const size_t depth_ )
{
modifyImage();
magick(magick_);
size_t length = 2048; // Efficient size for small images
ExceptionInfo exceptionInfo;
GetExceptionInfo( &exceptionInfo );
- void* data = ImagesToBlob( imageInfo(),
- image(),
- &length,
- &exceptionInfo);
+ void* data = ImagesToBlob( constImageInfo(), image(), &length,
+ &exceptionInfo );
throwException( exceptionInfo );
blob_->updateNoCopy( data, length, Blob::MallocAllocator );
throwImageException();
ExceptionInfo exceptionInfo;
GetExceptionInfo( &exceptionInfo );
ExportImagePixels( image(), x_, y_, columns_, rows_, map_.c_str(), type_,
- pixels_,
+ pixels_,
&exceptionInfo);
throwException( exceptionInfo );
(void) DestroyExceptionInfo( &exceptionInfo );
}
// Zoom image
-void Magick::Image::zoom( const Geometry &geometry_ )
+void Magick::Image::zoom ( const Geometry &geometry_ )
{
// Calculate new size. This code should be supported using binary arguments
// in the ImageMagick library.
ExceptionInfo exceptionInfo;
GetExceptionInfo( &exceptionInfo );
MagickCore::Image* newImage =
- ResizeImage( image(),
- width,
- height,
- image()->filter,
- &exceptionInfo);
+ ResizeImage( constImage(), width, height, image()->filter, &exceptionInfo );
replaceImage( newImage );
throwException( exceptionInfo );
(void) DestroyExceptionInfo( &exceptionInfo );
// Compare two Image objects regardless of LHS/RHS
// Image sizes and signatures are used as basis of comparison
int MagickPPExport operator == ( const Magick::Image& left_,
- const Magick::Image& right_ );
+ const Magick::Image& right_ );
int MagickPPExport operator != ( const Magick::Image& left_,
- const Magick::Image& right_ );
+ const Magick::Image& right_ );
int MagickPPExport operator > ( const Magick::Image& left_,
- const Magick::Image& right_ );
+ const Magick::Image& right_ );
int MagickPPExport operator < ( const Magick::Image& left_,
- const Magick::Image& right_ );
+ const Magick::Image& right_ );
int MagickPPExport operator >= ( const Magick::Image& left_,
- const Magick::Image& right_ );
+ const Magick::Image& right_ );
int MagickPPExport operator <= ( const Magick::Image& left_,
- const Magick::Image& right_ );
+ const Magick::Image& right_ );
// C library initialization routine
- void MagickPPExport InitializeMagick(const char *path_);
+ void MagickPPExport InitializeMagick ( const char *path_ );
//
// Image is the representation of an image. In reality, it actually
{
public:
// Construct from image file or image specification
- Image( const std::string &imageSpec_ );
+ Image ( const std::string &imageSpec_ );
// Construct a blank image canvas of specified size and color
- Image( const Geometry &size_, const Color &color_ );
+ Image ( const Geometry &size_, const Color &color_ );
// Construct Image from in-memory BLOB
Image ( const Blob &blob_ );
const void *pixels_ );
// Default constructor
- Image( void );
-
+ Image ( void );
+
// Destructor
- virtual ~Image();
-
+ virtual ~Image ();
+
/// Copy constructor
Image ( const Image & image_ );
-
+
// Assignment operator
Image& operator= ( const Image &image_ );
// pixels, not counting the center pixel. The sigma_ parameter
// specifies the standard deviation of the Laplacian, in pixels.
void adaptiveBlur ( const double radius_ = 0.0,
- const double sigma_ = 1.0 );
+ const double sigma_ = 1.0 );
// This is shortcut function for a fast interpolative resize using mesh
// interpolation. It works well for small resizes of less than +/- 50%
// Add noise to image with specified noise type
void addNoise ( const NoiseType noiseType_ );
void addNoiseChannel ( const ChannelType channel_,
- const NoiseType noiseType_);
+ const NoiseType noiseType_ );
// Transform image by specified affine (or free transform) matrix.
void affineTransform ( const DrawableAffine &affine );
// Annotate using specified text, and placement location
void annotate ( const std::string &text_,
- const Geometry &location_ );
+ const Geometry &location_ );
// Annotate using specified text, bounding area, and placement
// gravity
void annotate ( const std::string &text_,
- const Geometry &boundingArea_,
- const GravityType gravity_ );
+ const Geometry &boundingArea_,
+ const GravityType gravity_ );
// Annotate with text using specified text, bounding area,
// placement gravity, and rotation.
void annotate ( const std::string &text_,
- const Geometry &boundingArea_,
- const GravityType gravity_,
- const double degrees_ );
+ const Geometry &boundingArea_,
+ const GravityType gravity_,
+ const double degrees_ );
// Annotate with text (bounding area is entire image) and placement
// gravity.
void annotate ( const std::string &text_,
- const GravityType gravity_ );
+ const GravityType gravity_ );
// Inserts the artifact with the specified name and value into
// the artifact tree of the image.
// Adjusts an image so that its orientation is suitable for viewing.
void autoOrient ( void );
+ // Forces all pixels below the threshold into black while leaving all
+ // pixels at or above the threshold unchanged.
+ void blackThreshold ( const std::string &threshold_ );
+ void blackThresholdChannel ( const ChannelType channel_,
+ const std::string &threshold_ );
+
// Blur image with specified blur factor
// The radius_ parameter specifies the radius of the Gaussian, in
// pixels, not counting the center pixel. The sigma_ parameter
const double sigma_ = 1.0 );
void blurChannel ( const ChannelType channel_,
const double radius_ = 0.0,
- const double sigma_ = 1.0 );
-
+ const double sigma_ = 1.0 );
+
// Border image (add border to image)
void border ( const Geometry &geometry_
= borderGeometryDefault );
// Map image pixels to a sine wave
void wave ( const double amplitude_ = 25.0,
const double wavelength_ = 150.0 );
-
+
+ // Forces all pixels below the threshold into black while leaving all
+ // pixels at or below the threshold unchanged.
+ void whiteThreshold ( const std::string &threshold_ );
+ void whiteThresholdChannel ( const ChannelType channel_,
+ const std::string &threshold_ );
+
// Write single image frame to a file
void write ( const std::string &imageSpec_ );
// format and adjoin parameters.
void write ( Blob *blob_ );
void write ( Blob *blob_,
- const std::string &magick_ );
+ const std::string &magick_ );
void write ( Blob *blob_,
- const std::string &magick_,
- const size_t depth_ );
+ const std::string &magick_,
+ const size_t depth_ );
// Write single image frame to an array of pixels with storage
// type specified by user (DispatchImage), e.g.