2
/* these local defines help convert our packed integer format for color to
3
& from the format needed by X */
5
#define RED_MASK 0x000000FF
6
#define GRN_MASK 0x0000FF00
7
#define BLU_MASK 0x00FF0000
9
#define INT_TO_RED(i, r) (r = (i & RED_MASK))
10
#define INT_TO_GRN(i, g) (g = (i & GRN_MASK) >> 8)
11
#define INT_TO_BLU(i, b) (b = (i & BLU_MASK) >> 16)
13
#define RGB_TO_INT(r,g,b,i) (i = (((r) & RED_MASK) + \
14
((int)((g) << 8) & GRN_MASK) + \
15
((int)((b) << 16) & BLU_MASK)))
20
#define MAX_CVAL 65535
21
#define HEXVAL(n) (MAX_CVAL * (n)/15.)
22
#define CHARVAL(n) (MAX_CVAL * (n)/255.)
23
#define TOCHARVAL(n) ((n) * 255./MAX_CVAL)