root / proj / libs / graph / include / graph.h @ 331
History | View | Annotate | Download (1.78 KB)
1 |
#ifndef GRAPH_H_INCLUDED
|
---|---|
2 |
#define GRAPH_H_INCLUDED
|
3 |
|
4 |
/**
|
5 |
* @defgroup graph graph
|
6 |
* @brief Graph module.
|
7 |
*
|
8 |
* Provides functions, classes and methods for graphic drawing.
|
9 |
*
|
10 |
* @{
|
11 |
*/
|
12 |
|
13 |
// Graphics modes
|
14 |
#define INDEXED_1024_768 0x105 |
15 |
#define DIRECT_640_480_888 0x110 |
16 |
#define DIRECT_800_600_888 0x115 |
17 |
#define DIRECT_1024_768_888 0x118 |
18 |
#define DIRECT_1280_1024_565 0x11A |
19 |
#define DIRECT_1280_1024_888 0x11B |
20 |
#define LINEAR_FRAME_BUFFER_MD BIT(14) |
21 |
|
22 |
// Colors in RBG (8 bit)
|
23 |
#define GRAPH_BLACK 0x000000 |
24 |
#define GRAPH_WHITE 0xFFFFFF |
25 |
#define GRAPH_TRANSPARENT 0x00 |
26 |
#define GRAPH_RED 0xFF0000 |
27 |
|
28 |
// Alpha
|
29 |
#define ALPHA_THRESHOLD 0x7F |
30 |
|
31 |
// MACROS
|
32 |
#define GET_ALP(n) (0xFF & ((n) >> 24)) |
33 |
#define GET_RED(n) (0xFF & ((n) >> 16)) |
34 |
#define GET_GRE(n) (0xFF & ((n) >> 8)) |
35 |
#define GET_BLU(n) (0xFF & (n )) |
36 |
#define GET_COLOR(n) (0xFFFFFF & (n)) |
37 |
#define SET_ALP(n) (((n)&0xFF) << 24) |
38 |
#define SET_RED(n) (((n)&0xFF) << 16) |
39 |
#define SET_GRE(n) (((n)&0xFF) << 8) |
40 |
#define SET_BLU(n) (((n)&0xFF) ) |
41 |
#define SET_RGB(r,g,b) (SET_RED(r) | SET_GRE(g) | SET_BLU(b))
|
42 |
|
43 |
// PUBLIC GET
|
44 |
uint16_t (graph_get_XRes) (void);
|
45 |
uint16_t (graph_get_YRes) (void);
|
46 |
uint16_t (graph_get_bytes_pixel) (void);
|
47 |
|
48 |
// INIT
|
49 |
int (graph_init)(uint16_t mode);
|
50 |
|
51 |
// CLEANUP
|
52 |
int (graph_cleanup)(void); |
53 |
|
54 |
// PIXEL DRAWING
|
55 |
int (graph_set_pixel) (uint16_t x, uint16_t y, uint32_t color);
|
56 |
void (graph_set_pixel_pos) (unsigned pos , uint32_t color); |
57 |
|
58 |
// SCREEN
|
59 |
int (graph_clear_screen)(void); |
60 |
|
61 |
// DRAW
|
62 |
int (graph_draw)(void); |
63 |
|
64 |
/**
|
65 |
* @}
|
66 |
*/
|
67 |
|
68 |
#endif /* end of include guard: GRAPH_H_INCLUDED */ |