Nxna2
 All Classes Namespaces Functions Enumerations Enumerator Pages
Color.h
1 #ifndef NXNA_COLOR_H
2 #define NXNA_COLOR_H
3 
4 namespace Nxna
5 {
6  struct Color
7  {
8  Color()
9  {
10  R = G = B = A = 0;
11  }
12 
13  Color(int r, int g, int b)
14  {
15  R = (unsigned char)r; G = (unsigned char)g; B = (unsigned char)b; A = 255;
16  }
17 
18  Color(int r, int g, int b, int a)
19  {
20  R = (unsigned char)r; G = (unsigned char)g; B = (unsigned char)b; A = (unsigned char)a;
21  }
22 
23  unsigned char R;
24  unsigned char G;
25  unsigned char B;
26  unsigned char A;
27  };
28 
29  typedef unsigned int PackedColor;
30 
31 #define NXNA_GET_PACKED_COLOR(c) (PackedColor)((unsigned int)c.A << 24 | (unsigned int)c.B << 16 | (unsigned int)c.G << 8 | c.R)
32 #define NXNA_GET_PACKED_COLOR_RGB_BYTES(r,g,b) (Nxna::PackedColor)((unsigned int)255 << 24 | (unsigned int)(b & 0xff) << 16 | (unsigned int)(g & 0xff) << 8 | (r & 0xff))
33 #define NXNA_GET_UNPACKED_COLOR(c, r, g, b, a) { r == c & 0xff; g = (c >> 8) & 0xff; b = (c >> 16) & 0xff; a = (c >> 24) & 0xff; }
34 }
35 
36 #endif // NXNA_COLOR_H
Definition: Color.h:6