GrafX2 2.9.3227
The ultimate 256-color painting program
colorred.h File Reference

24bit RGB to 8bit indexed functions More...

#include "struct.h"
+ Include dependency graph for colorred.h:
+ This graph shows which files directly or indirectly include this file:

Data Structures

struct  CT_Node
 Color Tree node. More...
 
struct  CT_Tree
 Color Tree. More...
 

Functions

CT_TreeCT_new ()
 
void CT_delete (CT_Tree *t)
 
byte CT_get (CT_Tree *t, byte r, byte g, byte b)
 find the leaf that also contains (rgb) More...
 
void CT_set (CT_Tree *colorTree, byte Rmin, byte Gmin, byte Bmin, byte Rmax, byte Gmax, byte Bmax, byte index)
 insert a node in the color tree More...
 

Detailed Description

24bit RGB to 8bit indexed functions

Octree for mapping RGB to color. A bit slower than a plain conversion table in theory, but : Faster than running a search in the palette Takes less memory than the huge conversion table No loss of precision

Function Documentation

◆ CT_new()

CT_Tree * CT_new ( )

Referenced by Optimize_palette().

◆ CT_delete()

void CT_delete ( CT_Tree t)

◆ CT_get()

byte CT_get ( CT_Tree tree,
byte  r,
byte  g,
byte  b 
)

◆ CT_set()

void CT_set ( CT_Tree colorTree,
byte  Rmin,
byte  Gmin,
byte  Bmin,
byte  Rmax,
byte  Gmax,
byte  Bmax,
byte  index 
)