// Apply a color matrix to the image channels. The user supplied
// matrix may be of order 1 to 6 (1x1 through 6x6).
-void Magick::Image::colorMatrix (const KernelInfo *color_matrix_)
+void Magick::Image::colorMatrix (const unsigned int order_,
+ const double *color_matrix_)
{
+ double
+ *values;
+
+ KernelInfo
+ *kernel_info;
+
ExceptionInfo exceptionInfo;
GetExceptionInfo( &exceptionInfo );
+ kernel_info=AcquireKernelInfo("1");
+ kernel_info->width=order_;
+ kernel_info->height=order_;
+ values=kernel_info->values;
+ kernel_info->values=(double *) color_matrix_;
MagickCore::Image* newImage =
- ColorMatrixImage( image(), color_matrix_, &exceptionInfo );
+ ColorMatrixImage( image(), kernel_info, &exceptionInfo );
+ kernel_info->values=values;
+ kernel_info=DestroyKernelInfo(kernel_info);
replaceImage( newImage );
throwException( exceptionInfo );
(void) DestroyExceptionInfo( &exceptionInfo );
void colorize ( const unsigned int opacity_,
const Color &penColor_ );
+ // Apply a color matrix to the image channels. The user supplied
+ // matrix may be of order 1 to 5 (1x1 through 5x5).
+ void colorMatrix (const unsigned int order_,
+ const double *color_matrix_);
+
// Comment image (add comment string to image)
void comment ( const std::string &comment_ );
void colorMapSize ( const unsigned int entries_ );
unsigned int colorMapSize ( void );
- // Apply a color matrix to the image channels. The user supplied
- // matrix may be of order 1 to 5 (1x1 through 5x5).
- void colorMatrix (const KernelInfo *color_matrix_);
-
// Image Color Space
void colorSpace ( const ColorspaceType colorSpace_ );
ColorspaceType colorSpace ( void ) const;
using MagickCore::AcquireImage;
using MagickCore::GetVirtualPixels;
using MagickCore::AcquireIndexes;
+ using MagickCore::AcquireKernelInfo;
using MagickCore::AcquireMagickMemory;
using MagickCore::AcquireQuantumInfo;
using MagickCore::AcquireString;
using MagickCore::DestroyExceptionInfo;
using MagickCore::DestroyImageInfo;
using MagickCore::DestroyImageList;
+ using MagickCore::DestroyKernelInfo;
using MagickCore::DestroyMagickWand;
using MagickCore::DestroyPixelWand;
using MagickCore::DestroyQuantizeInfo;
#include <map>
#include <utility>
-#include "Magick++/Image.h"
#include "Magick++/CoderInfo.h"
#include "Magick++/Drawable.h"
#include "Magick++/Exception.h"
class MagickDLLDecl colorMatrixImage : public std::unary_function<Image&,void>
{
public:
- colorMatrixImage( const KernelInfo *color_matrix_ );
+ colorMatrixImage( const unsigned int order_,
+ const double *color_matrix_ );
void operator()( Image &image_ ) const;
private:
- const KernelInfo *_color_matrix;
+ unsigned int _order;
+ const double *_color_matrix;
};
// Convert the image colorspace representation
}
// Apply a color matrix to the image channels. The user supplied
-// matrix may be of order 1 to 6 (1x1 through 6x6).
-Magick::colorMatrixImage::colorMatrixImage( const KernelInfo *color_matrix_ )
- : _color_matrix( color_matrix_ )
+// matrix may be of order 1 to 5 (1x1 through 5x5).
+Magick::colorMatrixImage::colorMatrixImage( const unsigned int order_,
+ const double *color_matrix_ )
+ : _order( order_ ),
+ _color_matrix( color_matrix_ )
{
}
void Magick::colorMatrixImage::operator()( Image &image_ ) const
{
- image_.colorMatrix( _color_matrix );
+ image_.colorMatrix( _order, _color_matrix );
}
// Convert the image colorspace representation