blob: 1d78f1d4efaec7fea772bb232181db3afc4ce783 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
|
#ifndef GRAPHIC_H
#define GRAPHIC_H
typedef unsigned int Uint;
typedef struct
{
unsigned short r, v, b;
}
Color;
extern const Color BLACK;
extern const Color WHITE;
extern const Color RED;
extern const Color BLUE;
extern const Color GREEN;
extern const Color YELLOW;
extern const Color ORANGE;
extern const Color VIOLET;
#ifdef COLOR_BGRA
#define B_CHANNEL 0xFF000000
#define G_CHANNEL 0x00FF0000
#define R_CHANNEL 0x0000FF00
#define A_CHANNEL 0x000000FF
typedef union _PIXEL {
struct {
unsigned char b;
unsigned char g;
unsigned char r;
unsigned char a;
} channels;
unsigned int val;
unsigned char cop[4];
} Pixel;
#else
#define A_CHANNEL 0xFF000000
#define R_CHANNEL 0x00FF0000
#define G_CHANNEL 0x0000FF00
#define B_CHANNEL 0x000000FF
typedef union _PIXEL {
struct {
unsigned char a;
unsigned char r;
unsigned char g;
unsigned char b;
} channels;
unsigned int val;
unsigned char cop[4];
} Pixel;
#endif /* COLOR_BGRA */
/*
inline void setPixelRGB (Pixel * buffer, Uint x, Uint y, Color c);
inline void getPixelRGB (Pixel * buffer, Uint x, Uint y, Color * c);
*/
#endif /* GRAPHIC_H */
|