GrafX2 2.9.3227
The ultimate 256-color painting program
|
24bit RGB to 8bit indexed functions More...
#include "struct.h"
Data Structures | |
struct | CT_Node |
Color Tree node. More... | |
struct | CT_Tree |
Color Tree. More... | |
Functions | |
CT_Tree * | CT_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... | |
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
CT_Tree * CT_new | ( | ) |
Referenced by Optimize_palette().
void CT_delete | ( | CT_Tree * | t | ) |
Referenced by Convert_24b_bitmap_to_256(), and Optimize_palette().
find the leaf that also contains (rgb)
pre condition: node contains (rgb)
References CT_Node::Bmax, CT_Node::Bmin, CT_Node::children, CT_Node::Gmax, CT_Node::Gmin, CT_Tree::nodes, CT_Node::Rmax, and CT_Node::Rmin.
Referenced by Convert_24b_bitmap_to_256_Floyd_Steinberg(), and Convert_24b_bitmap_to_256_nearest_neighbor().
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
References CT_Node::Bmax, CT_Node::Bmin, CT_Node::children, CT_Node::Gmax, CT_Node::Gmin, CT_Tree::nodecount, CT_Tree::nodes, CT_Node::Rmax, and CT_Node::Rmin.
Referenced by CT_set_trad().