1 |
– |
/* Copyright 1988 Regents of the University of California */ |
2 |
– |
|
1 |
|
#ifndef lint |
2 |
< |
static char SCCSid[] = "$SunId$ LBL"; |
2 |
> |
static const char RCSid[] = "$Id$"; |
3 |
|
#endif |
6 |
– |
|
4 |
|
/* |
5 |
|
CLOSEST - nearest-color lookup by locally ordered search |
6 |
|
we use distance in rgb space as color metric |
77 |
|
|
78 |
|
if (!sq[0]) for (j= -255; j<256; j++) sq[j+255] = j*j; |
79 |
|
|
80 |
< |
r = k>>1&0xe0|H; /* center of 32x32x32 cubical bucket */ |
81 |
< |
g = k<<2&0xe0|H; |
82 |
< |
b = k<<5&0xe0|H; |
80 |
> |
r = (k>>1&0xe0)|H; /* center of 32x32x32 cubical bucket */ |
81 |
> |
g = (k<<2&0xe0)|H; |
82 |
> |
b = (k<<5&0xe0)|H; |
83 |
|
rsq = sq+255-r; |
84 |
|
gsq = sq+255-g; |
85 |
|
bsq = sq+255-b; |