Project

General

Profile

Statistics
| Revision:

root / proj / include / graph.h @ 253

History | View | Annotate | Download (1.29 KB)

1 168 up20180642
#ifndef GRAPH_H_INCLUDED
2
#define GRAPH_H_INCLUDED
3
4 183 up20180642
#include "graph_macros.h"
5
6 253 up20180642
// Colors in RBG (8 bit)
7
#define GRAPH_BLACK               0x000000
8
#define GRAPH_WHITE               0xFFFFFF
9
10
// Alpha
11
#define ALPHA_THRESHOLD     0x7F
12
13 174 up20180642
/// MACROS
14 183 up20180642
#define GET_ALP(n)          (0xFF & ((n) >> 24))
15 168 up20180642
#define GET_RED(n)          (0xFF & ((n) >> 16))
16
#define GET_GRE(n)          (0xFF & ((n) >>  8))
17
#define GET_BLU(n)          (0xFF & (n      ))
18 183 up20180642
#define GET_COLOR(n)        (0xFFFFFF & (n))
19
#define SET_ALP(n)          (((n)&0xFF) << 24)
20 168 up20180642
#define SET_RED(n)          (((n)&0xFF) << 16)
21
#define SET_GRE(n)          (((n)&0xFF) <<  8)
22
#define SET_BLU(n)          (((n)&0xFF)      )
23 174 up20180642
#define SET_RGB(r,g,b)      (SET_RED(r) | SET_GRE(g) | SET_BLU(b))
24 168 up20180642
25 174 up20180642
/// PUBLIC GET
26
uint16_t   (graph_get_XRes)         (void);
27
uint16_t   (graph_get_YRes)         (void);
28 208 up20180642
uint16_t   (graph_get_bytes_pixel)  (void);
29 168 up20180642
30 174 up20180642
/// INIT
31
int (graph_init)(uint16_t mode);
32 168 up20180642
33 174 up20180642
/// CLEANUP
34 168 up20180642
int (graph_cleanup)(void);
35
36 174 up20180642
/// PIXEL DRAWING
37 183 up20180642
int (graph_set_pixel)             (uint16_t x, uint16_t y, uint32_t color);
38 208 up20180642
void (graph_set_pixel_pos)         (unsigned pos          , uint32_t color);
39 168 up20180642
40 174 up20180642
/// SCREEN
41
int (graph_clear_screen)(void);
42 168 up20180642
43 174 up20180642
/// DRAW
44
int (graph_draw)(void);
45 168 up20180642
46
#endif /* end of include guard: GRAPH_H_INCLUDED */