Project

General

Profile

Statistics
| Revision:

root / proj / include / graph.h @ 190

History | View | Annotate | Download (1.53 KB)

1 168 up20180642
#ifndef GRAPH_H_INCLUDED
2
#define GRAPH_H_INCLUDED
3
4 183 up20180642
#include "graph_macros.h"
5
6 174 up20180642
/// MACROS
7 183 up20180642
#define GET_ALP(n)          (0xFF & ((n) >> 24))
8 168 up20180642
#define GET_RED(n)          (0xFF & ((n) >> 16))
9
#define GET_GRE(n)          (0xFF & ((n) >>  8))
10
#define GET_BLU(n)          (0xFF & (n      ))
11 183 up20180642
#define GET_COLOR(n)        (0xFFFFFF & (n))
12
#define SET_ALP(n)          (((n)&0xFF) << 24)
13 168 up20180642
#define SET_RED(n)          (((n)&0xFF) << 16)
14
#define SET_GRE(n)          (((n)&0xFF) <<  8)
15
#define SET_BLU(n)          (((n)&0xFF)      )
16 174 up20180642
#define SET_RGB(r,g,b)      (SET_RED(r) | SET_GRE(g) | SET_BLU(b))
17 168 up20180642
18 174 up20180642
/// PUBLIC GET
19
uint16_t   (graph_get_XRes)         (void);
20
uint16_t   (graph_get_YRes)         (void);
21 168 up20180642
22 174 up20180642
/// INIT
23
int (graph_init)(uint16_t mode);
24 168 up20180642
25 174 up20180642
/// CLEANUP
26 168 up20180642
int (graph_cleanup)(void);
27
28 174 up20180642
/// PIXEL DRAWING
29 183 up20180642
int (graph_set_pixel)             (uint16_t x, uint16_t y, uint32_t color);
30
int (graph_set_pixel_buffer)      (uint16_t x, uint16_t y, uint32_t color, uint8_t *buf, uint16_t W, uint16_t H);
31
int (graph_set_pixel_alpha_buffer)(uint16_t x, uint16_t y, uint8_t alpha, uint8_t *alp_buf, uint16_t W, uint16_t H);
32
int (graph_set_pixel_alpha)       (uint16_t x, uint16_t y, uint32_t color, uint8_t alpha);
33 168 up20180642
34 174 up20180642
/// SCREEN
35
int (graph_clear_screen)(void);
36 168 up20180642
37 174 up20180642
/// DRAW
38
int (graph_draw)(void);
39 168 up20180642
40
41
42 174 up20180642
/// RECTANGLE
43 168 up20180642
44
45
int (graph_draw_hline)(uint16_t x, uint16_t y, uint16_t len, uint32_t color);
46
int (graph_draw_rectangle)(uint16_t x, uint16_t y,uint16_t width, uint16_t height, uint32_t color);
47
48
#endif /* end of include guard: GRAPH_H_INCLUDED */