From: cristy Date: Sat, 3 Apr 2010 01:57:27 +0000 (+0000) Subject: (no commit message) X-Git-Tag: 7.0.1-0~9701 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=c8918bb2b224f642b06140506fa85a3703fa0748;p=imagemagick --- diff --git a/Magick++/lib/Image.cpp b/Magick++/lib/Image.cpp index b1d773b5c..5e3d8b84f 100644 --- a/Magick++/lib/Image.cpp +++ b/Magick++/lib/Image.cpp @@ -612,12 +612,26 @@ void Magick::Image::colorize ( const unsigned int opacity_, // 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 ); diff --git a/Magick++/lib/Magick++/Image.h b/Magick++/lib/Magick++/Image.h index 25c1db0eb..559244d77 100644 --- a/Magick++/lib/Magick++/Image.h +++ b/Magick++/lib/Magick++/Image.h @@ -213,6 +213,11 @@ namespace Magick 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_ ); @@ -861,10 +866,6 @@ namespace Magick 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; diff --git a/Magick++/lib/Magick++/Include.h b/Magick++/lib/Magick++/Include.h index ddd6d13dd..2b7244a89 100644 --- a/Magick++/lib/Magick++/Include.h +++ b/Magick++/lib/Magick++/Include.h @@ -529,6 +529,7 @@ namespace Magick using MagickCore::AcquireImage; using MagickCore::GetVirtualPixels; using MagickCore::AcquireIndexes; + using MagickCore::AcquireKernelInfo; using MagickCore::AcquireMagickMemory; using MagickCore::AcquireQuantumInfo; using MagickCore::AcquireString; @@ -594,6 +595,7 @@ namespace Magick using MagickCore::DestroyExceptionInfo; using MagickCore::DestroyImageInfo; using MagickCore::DestroyImageList; + using MagickCore::DestroyKernelInfo; using MagickCore::DestroyMagickWand; using MagickCore::DestroyPixelWand; using MagickCore::DestroyQuantizeInfo; diff --git a/Magick++/lib/Magick++/STL.h b/Magick++/lib/Magick++/STL.h index 07d9b033f..b526b1693 100644 --- a/Magick++/lib/Magick++/STL.h +++ b/Magick++/lib/Magick++/STL.h @@ -16,7 +16,6 @@ #include #include -#include "Magick++/Image.h" #include "Magick++/CoderInfo.h" #include "Magick++/Drawable.h" #include "Magick++/Exception.h" @@ -240,12 +239,14 @@ namespace Magick class MagickDLLDecl colorMatrixImage : public std::unary_function { 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 diff --git a/Magick++/lib/STL.cpp b/Magick++/lib/STL.cpp index 37e8d8f87..6a7a8a177 100644 --- a/Magick++/lib/STL.cpp +++ b/Magick++/lib/STL.cpp @@ -194,14 +194,16 @@ void Magick::colorizeImage::operator()( Magick::Image &image_ ) const } // 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