From: cristy Date: Tue, 12 Mar 2013 16:31:13 +0000 (+0000) Subject: (no commit message) X-Git-Tag: 7.0.1-0~4112 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=9731df786aef53bf0482896bcdf9af7011880042;p=imagemagick --- diff --git a/MagickCore/pixel-accessor.h b/MagickCore/pixel-accessor.h index f54e055df..b8311a624 100644 --- a/MagickCore/pixel-accessor.h +++ b/MagickCore/pixel-accessor.h @@ -233,29 +233,6 @@ static inline MagickRealType GetPixelInfoLuminance( return(0.21267f*red+0.71516f*green+0.07217f*blue); } -static inline MagickRealType GetPixelIntensity(const Image *restrict image, - const Quantum *restrict pixel) -{ - MagickRealType - blue, - green, - red; - - if (image->colorspace == GRAYColorspace) - return((MagickRealType) pixel[image->channel_map[GrayPixelChannel].offset]); - if (image->colorspace != sRGBColorspace) - return(0.298839f*pixel[image->channel_map[RedPixelChannel].offset]+ - 0.586811f*pixel[image->channel_map[GreenPixelChannel].offset]+ - 0.114350f*pixel[image->channel_map[BluePixelChannel].offset]); - red=DecodePixelGamma((MagickRealType) - pixel[image->channel_map[RedPixelChannel].offset]); - green=DecodePixelGamma((MagickRealType) - pixel[image->channel_map[GreenPixelChannel].offset]); - blue=DecodePixelGamma((MagickRealType) - pixel[image->channel_map[BluePixelChannel].offset]); - return(0.298839f*red+0.586811f*green+0.114350f*blue); -} - static inline Quantum GetPixelL(const Image *restrict image, const Quantum *restrict pixel) { diff --git a/MagickCore/pixel.c b/MagickCore/pixel.c index 5e97f880b..dfbbf3628 100644 --- a/MagickCore/pixel.c +++ b/MagickCore/pixel.c @@ -2083,6 +2083,55 @@ MagickExport void GetPixelInfo(const Image *image,PixelInfo *pixel) pixel->depth=image->depth; pixel->fuzz=image->fuzz; } + +/* +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% % +% % +% % +% G e t P i x e l I n t e n s i t y % +% % +% % +% % +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +% GePixelIntensity() returns a single sample intensity value from the +% red, green, and blue components of a pixel. +% +% The format of the GetPixelIntensity method is: +% +% GetPixelIntensity(const Image *image,const Quantum *pixel) +% +% A description of each parameter follows: +% +% o image: the image. +% +% o pixel: Specifies a pointer to a Quantum structure. +% +*/ +MagickExport MagickRealType GetPixelIntensity(const Image *restrict image, + const Quantum *restrict pixel) +{ + MagickRealType + blue, + green, + red; + + if (image->colorspace == GRAYColorspace) + return((MagickRealType) pixel[image->channel_map[GrayPixelChannel].offset]); + if (image->colorspace != sRGBColorspace) + return(0.298839f*pixel[image->channel_map[RedPixelChannel].offset]+ + 0.586811f*pixel[image->channel_map[GreenPixelChannel].offset]+ + 0.114350f*pixel[image->channel_map[BluePixelChannel].offset]); + red=DecodePixelGamma((MagickRealType) + pixel[image->channel_map[RedPixelChannel].offset]); + green=DecodePixelGamma((MagickRealType) + pixel[image->channel_map[GreenPixelChannel].offset]); + blue=DecodePixelGamma((MagickRealType) + pixel[image->channel_map[BluePixelChannel].offset]); + return(0.298839f*red+0.586811f*green+0.114350f*blue); +} + /* %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% diff --git a/MagickCore/pixel.h b/MagickCore/pixel.h index 966d8dd56..474ed59ee 100644 --- a/MagickCore/pixel.h +++ b/MagickCore/pixel.h @@ -205,6 +205,10 @@ extern MagickExport MagickBooleanType IsFuzzyEquivalencePixelInfo(const PixelInfo *,const PixelInfo *), SetPixelMetaChannels(Image *,const size_t,ExceptionInfo *); +extern MagickExport MagickRealType + GetPixelIntensity(const Image *restrict,const Quantum *restrict) + magick_hot_spot; + extern MagickExport PixelChannelMap *AcquirePixelChannelMap(void), *ClonePixelChannelMap(PixelChannelMap *),