root / proj / libs / graph / include / graph.h @ 333
History | View | Annotate | Download (2.46 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 |
|
21 |
// Colors in RBG (8 bit)
|
22 |
#define GRAPH_BLACK 0x000000 |
23 |
#define GRAPH_WHITE 0xFFFFFF |
24 |
#define GRAPH_TRANSPARENT 0x00 |
25 |
#define GRAPH_RED 0xFF0000 |
26 |
|
27 |
// Alpha
|
28 |
#define ALPHA_THRESHOLD 0x7F |
29 |
|
30 |
/**
|
31 |
* @brief Initialize graphics.
|
32 |
* @param mode Graphics mode to use
|
33 |
* @return SUCCESS if operation was successful, other value otherwise
|
34 |
*/
|
35 |
int (graph_init)(uint16_t mode);
|
36 |
|
37 |
/**
|
38 |
* @brief Cleanup graphics.
|
39 |
* @return SUCCESS if operation was successful, other value otherwise
|
40 |
*/
|
41 |
int (graph_cleanup)(void); |
42 |
|
43 |
/**
|
44 |
* @brief Get screen X-resolution.
|
45 |
* @return Screen X-resolution
|
46 |
*/
|
47 |
uint16_t (graph_get_XRes) (void);
|
48 |
/**
|
49 |
* @brief Get screen Y-resolution.
|
50 |
* @return Screen Y-resolution
|
51 |
*/
|
52 |
uint16_t (graph_get_YRes) (void);
|
53 |
/**
|
54 |
* @brief Get number of bytes per pixel.
|
55 |
*
|
56 |
* That is, the number of bytes needed to encode the color of a pixel.
|
57 |
* @return Number of bytes per pixel
|
58 |
*/
|
59 |
uint16_t (graph_get_bytes_pixel) (void);
|
60 |
|
61 |
/**
|
62 |
* @brief Draw pixel with color.
|
63 |
* @param x X-position of pixel to draw
|
64 |
* @param y Y-position of pixel to draw
|
65 |
* @param color Color that will be used to draw the pixel
|
66 |
* @return SUCCESS if operation was successful, other value otherwise
|
67 |
*/
|
68 |
void (graph_set_pixel) (uint16_t x, uint16_t y, uint32_t color);
|
69 |
/**
|
70 |
* @brief Draw pixel with color using position.
|
71 |
*
|
72 |
* Position is calculated from y*WIDTH+x.
|
73 |
* @param pos Position
|
74 |
* @param color Color that will be used to draw the pixel
|
75 |
*/
|
76 |
void (graph_set_pixel_pos) (unsigned pos , uint32_t color); |
77 |
|
78 |
/**
|
79 |
* @brief Clear screen, painting it black.
|
80 |
* @return SUCCESS if operation was successful, other value otherwise
|
81 |
*/
|
82 |
int (graph_clear_screen)(void); |
83 |
|
84 |
/**
|
85 |
* @brief Draw everything on the buffer to the screen.
|
86 |
* @return SUCCESS if operation was successful, other value otherwise
|
87 |
*/
|
88 |
int (graph_draw)(void); |
89 |
|
90 |
/**
|
91 |
* @}
|
92 |
*/
|
93 |
|
94 |
#endif /* end of include guard: GRAPH_H_INCLUDED */ |