00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 #ifndef MAGICKCORE_COLORMAP_PRIVATE_H
00019 #define MAGICKCORE_COLORMAP_PRIVATE_H
00020
00021 #include "MagickCore/image.h"
00022 #include "MagickCore/color.h"
00023 #include "MagickCore/exception-private.h"
00024
00025 #if defined(__cplusplus) || defined(c_plusplus)
00026 extern "C" {
00027 #endif
00028
00029 static inline ssize_t ConstrainColormapIndex(Image *image,const ssize_t index,
00030 ExceptionInfo *exception)
00031 {
00032 if ((index < 0) || (index >= (ssize_t) image->colors))
00033 {
00034 if (exception->severity != CorruptImageError)
00035 (void) ThrowMagickException(exception,GetMagickModule(),
00036 CorruptImageError,"InvalidColormapIndex","`%s'",image->filename);
00037 return(0);
00038 }
00039 return((ssize_t) index);
00040 }
00041
00042 static inline void ValidateColormapValue(Image *image,
00043 const ssize_t index,Quantum *target,ExceptionInfo *exception)
00044 {
00045 if ((index < 0) || (index >= (ssize_t) image->colors))
00046 {
00047 if (exception->severity != CorruptImageError)
00048 (void) ThrowMagickException(exception,GetMagickModule(),
00049 CorruptImageError,"InvalidColormapIndex","`%s'",image->filename);
00050 *target=(Quantum) 0;
00051 }
00052 else
00053 *target=(Quantum) index;
00054 }
00055
00056 #if defined(__cplusplus) || defined(c_plusplus)
00057 }
00058 #endif
00059
00060 #endif