GRASS GIS 8 Programmer's Manual  8.2.2dev(2023)-3d2c704037
rgbpack.h
Go to the documentation of this file.
1 #ifndef _RGBPACK_H
2 #define _RGBPACK_H
3 
4 #define RED_MASK 0x000000FF
5 #define GRN_MASK 0x0000FF00
6 #define BLU_MASK 0x00FF0000
7 
8 #define INT_TO_RED(i, r) (r = (i & RED_MASK))
9 #define INT_TO_GRN(i, g) (g = (i & GRN_MASK) >> 8)
10 #define INT_TO_BLU(i, b) (b = (i & BLU_MASK) >> 16)
11 
12 #define RGB_TO_INT(r,g,b,i) (i = (((r) & RED_MASK) + \
13  ((int)((g) << 8) & GRN_MASK) + \
14  ((int)((b) << 16) & BLU_MASK)))
15 
16 #define CONST_COLS 45
17 #define COLUMNS 9
18 
19 #endif /* _RGBPACK_H */