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