18 #ifndef MAGICKCORE_COLORMAP_PRIVATE_H
19 #define MAGICKCORE_COLORMAP_PRIVATE_H
21 #include "MagickCore/image.h"
22 #include "MagickCore/color.h"
23 #include "MagickCore/exception-private.h"
25 #if defined(__cplusplus) || defined(c_plusplus)
29 static inline ssize_t ConstrainColormapIndex(
Image *image,
const ssize_t index,
32 if ((index < 0) || (index >= (ssize_t) image->colors))
34 if (exception->severity != CorruptImageError)
35 (void) ThrowMagickException(exception,GetMagickModule(),
36 CorruptImageError,
"InvalidColormapIndex",
"`%s'",image->filename);
39 return((ssize_t) index);
42 static inline void ValidateColormapValue(
Image *image,
const ssize_t index,
45 if ((index < 0) || (index >= (ssize_t) image->colors))
47 if (exception->severity != CorruptImageError)
48 (void) ThrowMagickException(exception,GetMagickModule(),
49 CorruptImageError,
"InvalidColormapIndex",
"`%s'",image->filename);
53 *target=(Quantum) index;
56 #if defined(__cplusplus) || defined(c_plusplus)