Project

General

Profile

Statistics
| Revision:

root / proj / libs / graph / include / graph.h @ 331

History | View | Annotate | Download (1.78 KB)

1 168 up20180642
#ifndef GRAPH_H_INCLUDED
2
#define GRAPH_H_INCLUDED
3
4 331 up20180642
/**
5
 * @defgroup    graph   graph
6
 * @brief Graph module.
7
 *
8
 * Provides functions, classes and methods for graphic drawing.
9
 *
10
 * @{
11
 */
12
13 261 up20180642
// 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 253 up20180642
// Colors in RBG (8 bit)
23 307 up20180642
#define GRAPH_BLACK             0x000000
24
#define GRAPH_WHITE             0xFFFFFF
25
#define GRAPH_TRANSPARENT       0x00
26
#define GRAPH_RED               0xFF0000
27 253 up20180642
28
// Alpha
29
#define ALPHA_THRESHOLD     0x7F
30
31 331 up20180642
// MACROS
32 183 up20180642
#define GET_ALP(n)          (0xFF & ((n) >> 24))
33 168 up20180642
#define GET_RED(n)          (0xFF & ((n) >> 16))
34
#define GET_GRE(n)          (0xFF & ((n) >>  8))
35
#define GET_BLU(n)          (0xFF & (n      ))
36 183 up20180642
#define GET_COLOR(n)        (0xFFFFFF & (n))
37
#define SET_ALP(n)          (((n)&0xFF) << 24)
38 168 up20180642
#define SET_RED(n)          (((n)&0xFF) << 16)
39
#define SET_GRE(n)          (((n)&0xFF) <<  8)
40
#define SET_BLU(n)          (((n)&0xFF)      )
41 174 up20180642
#define SET_RGB(r,g,b)      (SET_RED(r) | SET_GRE(g) | SET_BLU(b))
42 168 up20180642
43 331 up20180642
// PUBLIC GET
44 174 up20180642
uint16_t   (graph_get_XRes)         (void);
45
uint16_t   (graph_get_YRes)         (void);
46 208 up20180642
uint16_t   (graph_get_bytes_pixel)  (void);
47 168 up20180642
48 331 up20180642
// INIT
49 174 up20180642
int (graph_init)(uint16_t mode);
50 168 up20180642
51 331 up20180642
// CLEANUP
52 168 up20180642
int (graph_cleanup)(void);
53
54 331 up20180642
// PIXEL DRAWING
55 183 up20180642
int (graph_set_pixel)             (uint16_t x, uint16_t y, uint32_t color);
56 208 up20180642
void (graph_set_pixel_pos)         (unsigned pos          , uint32_t color);
57 168 up20180642
58 331 up20180642
// SCREEN
59 174 up20180642
int (graph_clear_screen)(void);
60 168 up20180642
61 331 up20180642
// DRAW
62 174 up20180642
int (graph_draw)(void);
63 168 up20180642
64 331 up20180642
/**
65
 * @}
66 285 up20180642
 */
67
68 168 up20180642
#endif /* end of include guard: GRAPH_H_INCLUDED */