This source file includes following definitions.
- ConstrainColormapIndex
- IsValidColormapIndex
#ifndef _MAGICKCORE_COLORMAP_PRIVATE_H
#define _MAGICKCORE_COLORMAP_PRIVATE_H
#include "magick/image.h"
#include "magick/color.h"
#include "magick/exception-private.h"
#if defined(__cplusplus) || defined(c_plusplus)
extern "C" {
#endif
static inline IndexPacket ConstrainColormapIndex(Image *image,
const size_t index)
{
if ((index < image->colors) && ((ssize_t) index >= 0))
return((IndexPacket) index);
(void) ThrowMagickException(&image->exception,GetMagickModule(),
CorruptImageError,"InvalidColormapIndex","`%s'",image->filename);
return((IndexPacket) 0);
}
static inline MagickBooleanType IsValidColormapIndex(Image *image,
const ssize_t index,IndexPacket *target,ExceptionInfo *exception)
{
if ((index < 0) || (index >= (ssize_t) image->colors))
{
(void) ThrowMagickException(exception,GetMagickModule(),CorruptImageError,
"InvalidColormapIndex","`%s'",image->filename);
*target=(IndexPacket) 0;
return(MagickFalse);
}
*target=(IndexPacket) index;
return(MagickTrue);
}
#if defined(__cplusplus) || defined(c_plusplus)
}
#endif
#endif