#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;
//
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 );
RectangleInfo geometry;
SetGeometry(image(), &geometry);
+ geometry.width = geometry_.width();
+ geometry.height = geometry_.height();
GravityAdjustGeometry(image()->columns, image()->rows, gravity_, &geometry);
- extent ( 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)
(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 )
{
ChannelType channel_mask = SetImageChannelMask( image(), channel_);
EvaluateImage( crop_image, operator_, rvalue_, &exceptionInfo );
(void) SetPixelChannelMask( image(), channel_mask );
- (void) CompositeImage( image(), crop_image, image()->matte != MagickFalse ?
+ (void) CompositeImage( image(), crop_image, image()->alpha_trait == BlendPixelTrait ?
OverCompositeOp : CopyCompositeOp, MagickFalse, geometry.x, geometry.y,
&exceptionInfo );
crop_image = DestroyImageList(crop_image);
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);
// desired, then set the matte channel to opaque.
ExceptionInfo exceptionInfo;
GetExceptionInfo( &exceptionInfo );
- if ((matteFlag_ && !constImage()->matte) ||
- (constImage()->matte && !matteFlag_))
+ 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;