IM: im_palette.h Source File

IM - An Imaging Tool

im_palette.h

Go to the documentation of this file.
00001 /** \file
00002  * \brief Palette Generators
00003  *
00004  * See Copyright Notice in im_lib.h
00005  * $Id: im_palette.h,v 1.1 2005/04/02 22:07:00 scuri Exp $
00006  */
00007 
00008 #ifndef __IM_PALETTE_H
00009 #define __IM_PALETTE_H
00010 
00011 #if defined(__cplusplus)
00012 extern "C" {
00013 #endif
00014 
00015 
00016 /** \defgroup palette Palette Generators
00017  * \par
00018  * Creates several standard palettes
00019  * \par
00020  * See \ref im_palette.h
00021  * \ingroup util */
00022 
00023 
00024 /** Searches for the nearest color on the table and returns the color index if successful. 
00025  * It looks in all palette entries and finds the minimum euclidian square distance. 
00026  * If the color matches the given color it returns immediately.
00027  * \ingroup palette */
00028 int imPaletteFindNearest(const long *palette, int palette_count, long color);
00029 
00030 /** Searches for the color on the table and returns the color index if successful. 
00031  * If the tolerance is 0 search for the exact match in the palette else search for the 
00032  * first color that fits in the tolerance range.
00033  * \ingroup palette */
00034 int imPaletteFindColor(const long *palette, int palette_count, long color, unsigned char tol);
00035 
00036 /** Creates a palette of gray scale values.
00037  * The colors are arranged from black to white.
00038  * \ingroup palette */
00039 long* imPaletteGray(void);
00040 
00041 /** Creates a palette of a gradient of red colors.
00042  * The colors are arranged from black to pure red.
00043  * \ingroup palette */
00044 long* imPaletteRed(void);
00045 
00046 /** Creates a palette of a gradient of green colors.
00047  * The colors are arranged from black to pure green.
00048  * \ingroup palette */
00049 long* imPaletteGreen(void);
00050 
00051 /** Creates a palette of a gradient of blue colors.
00052  * The colors are arranged from black to pure blue.
00053  * \ingroup palette */
00054 long* imPaletteBlue(void);
00055 
00056 /** Creates a palette of a gradient of yellow colors.
00057  * The colors are arranged from black to pure yellow.
00058  * \ingroup palette */
00059 long* imPaletteYellow(void);
00060 
00061 /** Creates a palette of a gradient of magenta colors.
00062  * The colors are arranged from black to pure magenta.
00063  * \ingroup palette */
00064 long* imPaletteMagenta(void);
00065 
00066 /** Creates a palette of a gradient of cian colors.
00067  * The colors are arranged from black to pure cian.
00068  * \ingroup palette */
00069 long* imPaletteCian(void);
00070 
00071 /** Creates a palette of rainbow colors.
00072  * The colors are arranged in the light wave length spectrum order (starting from purple).
00073  * \ingroup palette */
00074 long* imPaletteRainbow(void);
00075 
00076 /** Creates a palette of hues with maximum saturation.
00077  * \ingroup palette */
00078 long* imPaletteHues(void);
00079 
00080 /** Creates a palette of a gradient of blue colors.
00081  * The colors are arranged from pure blue to white.
00082  * \ingroup palette */
00083 long* imPaletteBlueIce(void);
00084 
00085 /** Creates a palette of a gradient from black to white passing trough red and orange.
00086  * \ingroup palette */
00087 long* imPaletteHotIron(void);
00088 
00089 /** Creates a palette of a gradient from black to white passing trough red and yellow.
00090  * \ingroup palette */
00091 long* imPaletteBlackBody(void);
00092 
00093 /** Creates a palette with high contrast colors.
00094  * \ingroup palette */
00095 long* imPaletteHighContrast(void);
00096 
00097 /** Creates a palette of an uniform range of colors from black to white.
00098    This is a 2^(2.6) bits per pixel palette.
00099  * \ingroup palette */
00100 long* imPaletteUniform(void);
00101 
00102 /** Returns the index of the correspondent RGB color of an uniform palette.
00103  * \ingroup palette */
00104 int imPaletteUniformIndex(long color);
00105 
00106 /** Returns the index of the correspondent RGB color of an uniform palette.
00107  * Uses an 8x8 ordered dither to lookup the index in a halftone matrix.
00108  * The spatial position used by the halftone method.
00109  * \ingroup palette */
00110 int imPaletteUniformIndexHalftoned(long color, int x, int y);
00111 
00112 
00113 #if defined(__cplusplus)
00114 }
00115 #endif
00116 
00117 #endif
00118