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.4 2005/12/12 13:31:08 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  * In Lua, to create a palette you can call im.PaletteCreate.
00021  * \verbatim im.PaletteCreate([count: number]) -> pal: imPalette [in Lua 5] \endverbatim
00022  * Default count is 256.
00023  * IMLua and CDLua palettes are 100% compatible.
00024  * \par
00025  * See \ref im_palette.h
00026  * \ingroup util */
00027 
00028 
00029 /** Searches for the nearest color on the table and returns the color index if successful. 
00030  * It looks in all palette entries and finds the minimum euclidian square distance. 
00031  * If the color matches the given color it returns immediately.
00032  *
00033  * \verbatim im.PaletteFindNearest(pal: imPalette, color: lightuserdata) -> index: number [in Lua 5] \endverbatim
00034  * \ingroup palette */
00035 int imPaletteFindNearest(const long *palette, int palette_count, long color);
00036 
00037 /** Searches for the color on the table and returns the color index if successful. 
00038  * If the tolerance is 0 search for the exact match in the palette else search for the 
00039  * first color that fits in the tolerance range.
00040  *
00041  * \verbatim im.PaletteFindColor(pal: imPalette, color: lightuserdata, tol: number) -> index: number [in Lua 5] \endverbatim
00042  * \ingroup palette */
00043 int imPaletteFindColor(const long *palette, int palette_count, long color, unsigned char tol);
00044 
00045 /** Creates a palette of gray scale values.
00046  * The colors are arranged from black to white.
00047  *
00048  * \verbatim im.PaletteGray() -> pal: imPalette [in Lua 5] \endverbatim
00049  * \ingroup palette */
00050 long* imPaletteGray(void);
00051 
00052 /** Creates a palette of a gradient of red colors.
00053  * The colors are arranged from black to pure red.
00054  *
00055  * \verbatim im.PaletteRed() -> pal: imPalette [in Lua 5] \endverbatim
00056  * \ingroup palette */
00057 long* imPaletteRed(void);
00058 
00059 /** Creates a palette of a gradient of green colors.
00060  * The colors are arranged from black to pure green.
00061  *
00062  * \verbatim im.PaletteGreen() -> pal: imPalette [in Lua 5] \endverbatim
00063  * \ingroup palette */
00064 long* imPaletteGreen(void);
00065 
00066 /** Creates a palette of a gradient of blue colors.
00067  * The colors are arranged from black to pure blue.
00068  *
00069  * \verbatim im.PaletteBlue() -> pal: imPalette [in Lua 5] \endverbatim
00070  * \ingroup palette */
00071 long* imPaletteBlue(void);
00072 
00073 /** Creates a palette of a gradient of yellow colors.
00074  * The colors are arranged from black to pure yellow.
00075  *
00076  * \verbatim im.PaletteYellow() -> pal: imPalette [in Lua 5] \endverbatim
00077  * \ingroup palette */
00078 long* imPaletteYellow(void);
00079 
00080 /** Creates a palette of a gradient of magenta colors.
00081  * The colors are arranged from black to pure magenta.
00082  *
00083  * \verbatim im.PaletteMagenta() -> pal: imPalette [in Lua 5] \endverbatim
00084  * \ingroup palette */
00085 long* imPaletteMagenta(void);
00086 
00087 /** Creates a palette of a gradient of cian colors.
00088  * The colors are arranged from black to pure cian.
00089  *
00090  * \verbatim im.PaletteCian() -> pal: imPalette [in Lua 5] \endverbatim
00091  * \ingroup palette */
00092 long* imPaletteCian(void);
00093 
00094 /** Creates a palette of rainbow colors.
00095  * The colors are arranged in the light wave length spectrum order (starting from purple).
00096  *
00097  * \verbatim im.PaletteRainbow() -> pal: imPalette [in Lua 5] \endverbatim
00098  * \ingroup palette */
00099 long* imPaletteRainbow(void);
00100 
00101 /** Creates a palette of hues with maximum saturation.
00102  *
00103  * \verbatim im.PaletteHues() -> pal: imPalette [in Lua 5] \endverbatim
00104  * \ingroup palette */
00105 long* imPaletteHues(void);
00106 
00107 /** Creates a palette of a gradient of blue colors.
00108  * The colors are arranged from pure blue to white.
00109  *
00110  * \verbatim im.PaletteBlueIce() -> pal: imPalette [in Lua 5] \endverbatim
00111  * \ingroup palette */
00112 long* imPaletteBlueIce(void);
00113 
00114 /** Creates a palette of a gradient from black to white passing trough red and orange.
00115  *
00116  * \verbatim im.PaletteHotIron() -> pal: imPalette [in Lua 5] \endverbatim
00117  * \ingroup palette */
00118 long* imPaletteHotIron(void);
00119 
00120 /** Creates a palette of a gradient from black to white passing trough red and yellow.
00121  *
00122  * \verbatim im.PaletteBlackBody() -> pal: imPalette [in Lua 5] \endverbatim
00123  * \ingroup palette */
00124 long* imPaletteBlackBody(void);
00125 
00126 /** Creates a palette with high contrast colors.
00127  *
00128  * \verbatim im.PaletteHighContrast() -> pal: imPalette [in Lua 5] \endverbatim
00129  * \ingroup palette */
00130 long* imPaletteHighContrast(void);
00131 
00132 /** Creates a palette of an uniform range of colors from black to white.
00133  *  This is a 2^(2.6) bits per pixel palette.
00134  *
00135  * \verbatim im.PaletteUniform() -> pal: imPalette [in Lua 5] \endverbatim
00136  * \ingroup palette */
00137 long* imPaletteUniform(void);
00138 
00139 /** Returns the index of the correspondent RGB color of an uniform palette.
00140  *
00141  * \verbatim im.PaletteUniformIndex(color: lightuserdata) -> index: number [in Lua 5] \endverbatim
00142  * \ingroup palette */
00143 int imPaletteUniformIndex(long color);
00144 
00145 /** Returns the index of the correspondent RGB color of an uniform palette.
00146  * Uses an 8x8 ordered dither to lookup the index in a halftone matrix.
00147  * The spatial position used by the halftone method.
00148  *
00149  * \verbatim im.PaletteUniformIndexHalftoned(color: lightuserdata, x: number, y: number) -> index: number [in Lua 5] \endverbatim
00150  * \ingroup palette */
00151 int imPaletteUniformIndexHalftoned(long color, int x, int y);
00152 
00153 
00154 #if defined(__cplusplus)
00155 }
00156 #endif
00157 
00158 #endif
00159