Revision 333
more changes, added docs
font.h | ||
---|---|---|
1 | 1 |
#ifndef FONT_H_INCLUDED |
2 | 2 |
#define FONT_H_INCLUDED |
3 | 3 |
|
4 |
struct font; |
|
5 | 4 |
/** |
6 |
* @brief Font. Represents a set of glyphs that can be drawn for showing text. |
|
5 |
* @defgroup font_t font_t |
|
6 |
* @ingroup graph |
|
7 |
* @brief Font module. |
|
8 |
* |
|
9 |
* Represents a set of glyphs that can be drawn for showing text. |
|
10 |
* |
|
11 |
* @{ |
|
7 | 12 |
*/ |
13 |
|
|
14 |
/** |
|
15 |
* @brief Font. |
|
16 |
*/ |
|
8 | 17 |
typedef struct font font_t; |
9 | 18 |
/** |
10 | 19 |
* @brief Construct font. |
... | ... | |
48 | 57 |
void (font_free)(void); |
49 | 58 |
|
50 | 59 |
/** |
51 |
* @brief Enumeration of vertical alignment schemes.
|
|
60 |
* @}
|
|
52 | 61 |
*/ |
53 |
typedef enum{ |
|
54 |
text_valign_top = -1, |
|
55 |
text_valign_center = 0, |
|
56 |
text_valign_bottom = 1 |
|
57 |
} text_valign; |
|
58 |
/** |
|
59 |
* @brief Enumeration of horizontal alignment schemes. |
|
60 |
*/ |
|
61 |
typedef enum{ |
|
62 |
text_halign_left = -1, |
|
63 |
text_halign_center = 0, |
|
64 |
text_halign_right = 1 |
|
65 |
} text_halign; |
|
66 | 62 |
|
67 |
struct text; |
|
68 |
/** |
|
69 |
* @brief Drawable text. |
|
70 |
*/ |
|
71 |
typedef struct text text_t; |
|
72 |
/** |
|
73 |
* @brief Construct text. |
|
74 |
* @param fnt Font to draw the text |
|
75 |
* @param txt String to be drawn |
|
76 |
* @return Pointer to constructed text |
|
77 |
*/ |
|
78 |
text_t* (text_ctor)(const font_t *fnt, const char *txt); |
|
79 |
/** |
|
80 |
* @brief Destruct text. |
|
81 |
* @param p Pointer to text to be destroyed |
|
82 |
*/ |
|
83 |
void (text_dtor)(text_t *p); |
|
84 |
/** |
|
85 |
* @brief Set text string. |
|
86 |
* @param p Pointer to text |
|
87 |
* @param txt String to be set |
|
88 |
*/ |
|
89 |
void (text_set_string)(text_t *p, const char *txt); |
|
90 |
/** |
|
91 |
* @brief Set text position. |
|
92 |
* @param p Pointer to text |
|
93 |
* @param x X-position of the text |
|
94 |
* @param y Y-position of the text |
|
95 |
*/ |
|
96 |
void (text_set_pos) (text_t *p, int16_t x, int16_t y); |
|
97 |
/** |
|
98 |
* @brief Set text size (letter size, in pixels). |
|
99 |
* @param p Pointer to text |
|
100 |
* @param size Letter size of the text |
|
101 |
*/ |
|
102 |
void (text_set_size) (text_t *p, uint16_t size); |
|
103 |
/** |
|
104 |
* @brief Set text color. |
|
105 |
* @param p Pointer to text |
|
106 |
* @param color Text color |
|
107 |
*/ |
|
108 |
void (text_set_color) (text_t *p, uint32_t color); |
|
109 |
/** |
|
110 |
* @brief Set text vertical alignment. |
|
111 |
* @param p Pointer to text |
|
112 |
* @param valign Vertical alignment of the text |
|
113 |
*/ |
|
114 |
void (text_set_valign)(text_t *p, text_valign valign); |
|
115 |
/** |
|
116 |
* @brief Set text horizontal alignment. |
|
117 |
* @param p Pointer to text |
|
118 |
* @param halign Horizontal alignment of the text |
|
119 |
*/ |
|
120 |
void (text_set_halign)(text_t *p, text_halign halign); |
|
121 |
/** |
|
122 |
* @brief Get string of the text. |
|
123 |
* @param p Pointer to text |
|
124 |
* @return Pointer to string |
|
125 |
*/ |
|
126 |
const char* (text_get_string)(const text_t *p); |
|
127 |
/** |
|
128 |
* @brief Get text x-position. |
|
129 |
* @param p Pointer to text |
|
130 |
* @return X-position of text |
|
131 |
*/ |
|
132 |
int16_t (text_get_x) (const text_t *p); |
|
133 |
/** |
|
134 |
* @brief Get text y-position. |
|
135 |
* @param p Pointer to text |
|
136 |
* @return Y-position of text |
|
137 |
*/ |
|
138 |
int16_t (text_get_y) (const text_t *p); |
|
139 |
/** |
|
140 |
* @brief Draw text on the screen buffer. |
|
141 |
* @param p Pointer to text |
|
142 |
* @return SUCCESS if operation was successful, false otherwise |
|
143 |
*/ |
|
144 |
int (text_draw) (const text_t *p); |
|
145 |
|
|
146 | 63 |
#endif //FONT_H_INCLUDED |
Also available in: Unified diff