#endif
#include <math.h>
+#include <MagickCore/cache.h>
#include <MagickCore/cache-view.h>
#include <MagickCore/color.h>
#include <MagickCore/image.h>
const Quantum *restrict pixel)
{
#if !defined(MAGICKCORE_HDRI_SUPPORT)
- if ((pixel[image->channel_map[RedPixelChannel].offset] ==
- pixel[image->channel_map[GreenPixelChannel].offset]) &&
- (pixel[image->channel_map[GreenPixelChannel].offset] ==
- pixel[image->channel_map[BluePixelChannel].offset]))
- return(pixel[image->channel_map[RedPixelChannel].offset]);
+ if (image->colorspace == GRAYColorspace)
+ return(pixel[image->channel_map[GrayPixelChannel].offset]);
return((Quantum) (0.299*pixel[image->channel_map[RedPixelChannel].offset]+
0.587*pixel[image->channel_map[GreenPixelChannel].offset]+0.114*
pixel[image->channel_map[BluePixelChannel].offset]+0.5));
return(image->channel_map[MagentaPixelChannel].traits);
}
+static inline Quantum GetPixelMask(const Image *restrict image,
+ const Quantum *restrict pixel)
+{
+ if (image->channel_map[MaskPixelChannel].traits == UndefinedPixelTrait)
+ return(0);
+ return(pixel[image->channel_map[MaskPixelChannel].offset]);
+}
+
+static inline PixelTrait GetPixelMaskTraits(const Image *restrict image)
+{
+ return(image->channel_map[MaskPixelChannel].traits);
+}
+
static inline size_t GetPixelMetaChannels(const Image *restrict image)
{
return(image->number_meta_channels);
return(image->metacontent_extent);
}
+static inline Quantum GetPixelOpacity(const Image *restrict image,
+ const Quantum *restrict pixel)
+{
+ if (image->channel_map[AlphaPixelChannel].traits == UndefinedPixelTrait)
+ return(QuantumRange-OpaqueAlpha);
+ return(QuantumRange-pixel[image->channel_map[AlphaPixelChannel].offset]);
+}
+
static inline Quantum GetPixelRed(const Image *restrict image,
const Quantum *restrict pixel)
{
static inline void GetPixelInfoPixel(const Image *restrict image,
const Quantum *restrict pixel,PixelInfo *restrict pixel_info)
{
- pixel_info->red=(MagickRealType)
+ pixel_info->red=(double)
pixel[image->channel_map[RedPixelChannel].offset];
- pixel_info->green=(MagickRealType)
+ pixel_info->green=(double)
pixel[image->channel_map[GreenPixelChannel].offset];
- pixel_info->blue=(MagickRealType)
+ pixel_info->blue=(double)
pixel[image->channel_map[BluePixelChannel].offset];
pixel_info->black=0;
if (image->channel_map[BlackPixelChannel].traits != UndefinedPixelTrait)
- pixel_info->black=(MagickRealType)
+ pixel_info->black=(double)
pixel[image->channel_map[BlackPixelChannel].offset];
pixel_info->alpha=OpaqueAlpha;
if (image->channel_map[AlphaPixelChannel].traits != UndefinedPixelTrait)
- pixel_info->alpha=(MagickRealType)
+ pixel_info->alpha=(double)
pixel[image->channel_map[AlphaPixelChannel].offset];
pixel_info->index=0;
if (image->channel_map[IndexPixelChannel].traits != UndefinedPixelTrait)
- pixel_info->index=(MagickRealType)
+ pixel_info->index=(double)
pixel[image->channel_map[IndexPixelChannel].offset];
}
image->channel_map[MagentaPixelChannel].traits=traits;
}
-static inline void SetPixelMetaChannels(Image *image,
- const size_t number_meta_channels)
+static inline void SetPixelMask(const Image *restrict image,
+ const Quantum mask,Quantum *restrict pixel)
{
- image->number_meta_channels=number_meta_channels;
+ if (image->channel_map[MaskPixelChannel].traits != UndefinedPixelTrait)
+ pixel[image->channel_map[MaskPixelChannel].offset]=mask;
}
static inline void SetPixelMetacontentExtent(Image *image,const size_t extent)
image->metacontent_extent=extent;
}
+static inline void SetPixelOpacity(const Image *restrict image,
+ const Quantum alpha,Quantum *restrict pixel)
+{
+ if (image->channel_map[AlphaPixelChannel].traits != UndefinedPixelTrait)
+ pixel[image->channel_map[AlphaPixelChannel].offset]=QuantumRange-alpha;
+}
+
static inline void SetPixelRed(const Image *restrict image,const Quantum red,
Quantum *restrict pixel)
{