root / proj / libs / graph / include / graph.h @ 336
History | View | Annotate | Download (2.97 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 |
/// @brief Indexed graphic mode, 1024x768 px
|
15 |
#define INDEXED_1024_768 0x105 |
16 |
/// @brief Direct graphic mode, 640x480 px, RGB = 888 bits
|
17 |
#define DIRECT_640_480_888 0x110 |
18 |
/// @brief Direct graphic mode, 800x600 px, RGB = 888 bits
|
19 |
#define DIRECT_800_600_888 0x115 |
20 |
/// @brief Direct graphic mode, 1024x768 px, RGB = 888 bits
|
21 |
#define DIRECT_1024_768_888 0x118 |
22 |
/// @brief Direct graphic mode, 1280x1024 px, RGB = 565 bits
|
23 |
#define DIRECT_1280_1024_565 0x11A |
24 |
/// @brief Direct graphic mode, 1280x1024 px, RGB = 888 bits
|
25 |
#define DIRECT_1280_1024_888 0x11B |
26 |
|
27 |
// Colors in RBG (8 bit)
|
28 |
/// @brief Black color
|
29 |
#define GRAPH_BLACK 0x000000 |
30 |
/// @brief White color
|
31 |
#define GRAPH_WHITE 0xFFFFFF |
32 |
/// @brief Transparent
|
33 |
#define GRAPH_TRANSPARENT 0x00 |
34 |
/// @brief Red color
|
35 |
#define GRAPH_RED 0xFF0000 |
36 |
|
37 |
/// @brief Alpha threshold, from which it is either considered transparent or opaque
|
38 |
#define ALPHA_THRESHOLD 0x7F |
39 |
|
40 |
/**
|
41 |
* @brief Initialize graphics.
|
42 |
* @param mode Graphics mode to use
|
43 |
* @return SUCCESS if operation was successful, other value otherwise
|
44 |
*/
|
45 |
int (graph_init)(uint16_t mode);
|
46 |
|
47 |
/**
|
48 |
* @brief Cleanup graphics.
|
49 |
* @return SUCCESS if operation was successful, other value otherwise
|
50 |
*/
|
51 |
int (graph_cleanup)(void); |
52 |
|
53 |
/**
|
54 |
* @brief Get screen X-resolution.
|
55 |
* @return Screen X-resolution
|
56 |
*/
|
57 |
uint16_t (graph_get_XRes) (void);
|
58 |
/**
|
59 |
* @brief Get screen Y-resolution.
|
60 |
* @return Screen Y-resolution
|
61 |
*/
|
62 |
uint16_t (graph_get_YRes) (void);
|
63 |
/**
|
64 |
* @brief Get number of bytes per pixel.
|
65 |
*
|
66 |
* That is, the number of bytes needed to encode the color of a pixel.
|
67 |
* @return Number of bytes per pixel
|
68 |
*/
|
69 |
uint16_t (graph_get_bytes_pixel) (void);
|
70 |
|
71 |
/**
|
72 |
* @brief Draw pixel with color.
|
73 |
* @param x X-position of pixel to draw
|
74 |
* @param y Y-position of pixel to draw
|
75 |
* @param color Color that will be used to draw the pixel
|
76 |
* @return SUCCESS if operation was successful, other value otherwise
|
77 |
*/
|
78 |
void (graph_set_pixel) (uint16_t x, uint16_t y, uint32_t color);
|
79 |
/**
|
80 |
* @brief Draw pixel with color using position.
|
81 |
*
|
82 |
* Position is calculated from y*WIDTH+x.
|
83 |
* @param pos Position
|
84 |
* @param color Color that will be used to draw the pixel
|
85 |
*/
|
86 |
void (graph_set_pixel_pos) (unsigned pos , uint32_t color); |
87 |
|
88 |
/**
|
89 |
* @brief Clear screen, painting it black.
|
90 |
* @return SUCCESS if operation was successful, other value otherwise
|
91 |
*/
|
92 |
int (graph_clear_screen)(void); |
93 |
|
94 |
/**
|
95 |
* @brief Draw everything on the buffer to the screen.
|
96 |
* @return SUCCESS if operation was successful, other value otherwise
|
97 |
*/
|
98 |
int (graph_draw)(void); |
99 |
|
100 |
/**
|
101 |
* @}
|
102 |
*/
|
103 |
|
104 |
#endif /* end of include guard: GRAPH_H_INCLUDED */ |