IM: Palette Generators

IM - An Imaging Tool

Palette Generators
[Utilities]


Detailed Description

Creates several standard palettes
In Lua, to create a palette you can call im.PaletteCreate.
im.PaletteCreate([count: number]) -> pal: imPalette [in Lua 5] 
Default count is 256. IMLua and CDLua palettes are 100% compatible.
See im_palette.h


Functions

int imPaletteFindNearest (const long *palette, int palette_count, long color)
int imPaletteFindColor (const long *palette, int palette_count, long color, unsigned char tol)
long * imPaletteGray (void)
long * imPaletteRed (void)
long * imPaletteGreen (void)
long * imPaletteBlue (void)
long * imPaletteYellow (void)
long * imPaletteMagenta (void)
long * imPaletteCian (void)
long * imPaletteRainbow (void)
long * imPaletteHues (void)
long * imPaletteBlueIce (void)
long * imPaletteHotIron (void)
long * imPaletteBlackBody (void)
long * imPaletteHighContrast (void)
long * imPaletteUniform (void)
int imPaletteUniformIndex (long color)
int imPaletteUniformIndexHalftoned (long color, int x, int y)

Function Documentation

int imPaletteFindNearest const long *  palette,
int  palette_count,
long  color
 

Searches for the nearest color on the table and returns the color index if successful. It looks in all palette entries and finds the minimum euclidian square distance. If the color matches the given color it returns immediately.

im.PaletteFindNearest(pal: imPalette, color: lightuserdata) -> index: number [in Lua 5] 

int imPaletteFindColor const long *  palette,
int  palette_count,
long  color,
unsigned char  tol
 

Searches for the color on the table and returns the color index if successful. If the tolerance is 0 search for the exact match in the palette else search for the first color that fits in the tolerance range.

im.PaletteFindColor(pal: imPalette, color: lightuserdata, tol: number) -> index: number [in Lua 5] 

long* imPaletteGray void   ) 
 

Creates a palette of gray scale values. The colors are arranged from black to white.

im.PaletteGray() -> pal: imPalette [in Lua 5] 

long* imPaletteRed void   ) 
 

Creates a palette of a gradient of red colors. The colors are arranged from black to pure red.

im.PaletteRed() -> pal: imPalette [in Lua 5] 

long* imPaletteGreen void   ) 
 

Creates a palette of a gradient of green colors. The colors are arranged from black to pure green.

im.PaletteGreen() -> pal: imPalette [in Lua 5] 

long* imPaletteBlue void   ) 
 

Creates a palette of a gradient of blue colors. The colors are arranged from black to pure blue.

im.PaletteBlue() -> pal: imPalette [in Lua 5] 

long* imPaletteYellow void   ) 
 

Creates a palette of a gradient of yellow colors. The colors are arranged from black to pure yellow.

im.PaletteYellow() -> pal: imPalette [in Lua 5] 

long* imPaletteMagenta void   ) 
 

Creates a palette of a gradient of magenta colors. The colors are arranged from black to pure magenta.

im.PaletteMagenta() -> pal: imPalette [in Lua 5] 

long* imPaletteCian void   ) 
 

Creates a palette of a gradient of cian colors. The colors are arranged from black to pure cian.

im.PaletteCian() -> pal: imPalette [in Lua 5] 

long* imPaletteRainbow void   ) 
 

Creates a palette of rainbow colors. The colors are arranged in the light wave length spectrum order (starting from purple).

im.PaletteRainbow() -> pal: imPalette [in Lua 5] 

long* imPaletteHues void   ) 
 

Creates a palette of hues with maximum saturation.

im.PaletteHues() -> pal: imPalette [in Lua 5] 

long* imPaletteBlueIce void   ) 
 

Creates a palette of a gradient of blue colors. The colors are arranged from pure blue to white.

im.PaletteBlueIce() -> pal: imPalette [in Lua 5] 

long* imPaletteHotIron void   ) 
 

Creates a palette of a gradient from black to white passing trough red and orange.

im.PaletteHotIron() -> pal: imPalette [in Lua 5] 

long* imPaletteBlackBody void   ) 
 

Creates a palette of a gradient from black to white passing trough red and yellow.

im.PaletteBlackBody() -> pal: imPalette [in Lua 5] 

long* imPaletteHighContrast void   ) 
 

Creates a palette with high contrast colors.

im.PaletteHighContrast() -> pal: imPalette [in Lua 5] 

long* imPaletteUniform void   ) 
 

Creates a palette of an uniform range of colors from black to white. This is a 2^(2.6) bits per pixel palette.

im.PaletteUniform() -> pal: imPalette [in Lua 5] 

int imPaletteUniformIndex long  color  ) 
 

Returns the index of the correspondent RGB color of an uniform palette.

im.PaletteUniformIndex(color: lightuserdata) -> index: number [in Lua 5] 

int imPaletteUniformIndexHalftoned long  color,
int  x,
int  y
 

Returns the index of the correspondent RGB color of an uniform palette. Uses an 8x8 ordered dither to lookup the index in a halftone matrix. The spatial position used by the halftone method.

im.PaletteUniformIndexHalftoned(color: lightuserdata, x: number, y: number) -> index: number [in Lua 5]