Revision 334
added more docs
rectangle.h | ||
---|---|---|
9 | 9 |
* @{ |
10 | 10 |
*/ |
11 | 11 |
|
12 |
/** |
|
13 |
* @brief Rectangle. |
|
14 |
*/ |
|
12 | 15 |
typedef struct rectangle rectangle_t; |
13 |
|
|
16 |
/** |
|
17 |
* @brief Construct rectangle. |
|
18 |
* @param x X-position of upper-left corner |
|
19 |
* @param y Y-position of upper-left corner |
|
20 |
* @param w Width |
|
21 |
* @param h Height |
|
22 |
* @return Pointer to constructed rectangle, or NULL if failed |
|
23 |
*/ |
|
14 | 24 |
rectangle_t* (rectangle_ctor)(int16_t x, int16_t y, uint16_t w, uint16_t h); |
25 |
/** |
|
26 |
* @brief Destruct rectangle. |
|
27 |
* @param p Pointer to rectangle to be destructed |
|
28 |
*/ |
|
15 | 29 |
void (rectangle_dtor)(rectangle_t *p); |
16 |
|
|
30 |
/** |
|
31 |
* @brief Set rectangle position. |
|
32 |
* @param p Pointer to rectangle |
|
33 |
* @param x X-position of the upper-left corner |
|
34 |
* @param y Y-position of the upper-left corner |
|
35 |
*/ |
|
17 | 36 |
void (rectangle_set_pos) (rectangle_t *p, int16_t x, int16_t y); |
37 |
/** |
|
38 |
* @brief Set rectangle size. |
|
39 |
* @param p Pointer to rectangle |
|
40 |
* @param w Width |
|
41 |
* @param h Height |
|
42 |
*/ |
|
18 | 43 |
void (rectangle_set_size) (rectangle_t *p, uint16_t w, uint16_t h); |
44 |
/** |
|
45 |
* @brief Set rectangle fill color. |
|
46 |
* @param p Pointer to rectangle |
|
47 |
* @param color Color to fill rectangle |
|
48 |
*/ |
|
19 | 49 |
void (rectangle_set_fill_color) (rectangle_t *p, uint32_t color); |
50 |
/** |
|
51 |
* @brief Set rectangle fill transparency. |
|
52 |
* @param p Pointer to rectangle |
|
53 |
* @param alpha Value of the alpha-channel |
|
54 |
*/ |
|
20 | 55 |
void (rectangle_set_fill_trans) (rectangle_t *p, uint8_t alpha); |
56 |
/** |
|
57 |
* @brief Set rectangle outline color. |
|
58 |
* @param p Pointer to rectangle |
|
59 |
* @param color Color to outline rectangle |
|
60 |
*/ |
|
21 | 61 |
void (rectangle_set_outline_color)(rectangle_t *p, uint32_t color); |
62 |
/** |
|
63 |
* @brief Set rectangle outline width. |
|
64 |
* @param p Pointer to rectangle |
|
65 |
* @param width Width of the rectangle border/outline |
|
66 |
*/ |
|
22 | 67 |
void (rectangle_set_outline_width)(rectangle_t *p, int16_t width); |
23 |
|
|
68 |
/** |
|
69 |
* @brief Get rectangle x-position. |
|
70 |
* @param p Pointer to rectangle |
|
71 |
* @return Rectangle x-position |
|
72 |
*/ |
|
24 | 73 |
int16_t (rectangle_get_x)(const rectangle_t *p); |
74 |
/** |
|
75 |
* @brief Get rectangle y-position. |
|
76 |
* @param p Pointer to rectangle |
|
77 |
* @return Rectangle y-position |
|
78 |
*/ |
|
25 | 79 |
int16_t (rectangle_get_y)(const rectangle_t *p); |
80 |
/** |
|
81 |
* @brief Get rectangle width. |
|
82 |
* @param p Pointer to rectangle |
|
83 |
* @return Rectangle width |
|
84 |
*/ |
|
26 | 85 |
uint16_t (rectangle_get_w)(const rectangle_t *p); |
86 |
/** |
|
87 |
* @brief Get rectangle height. |
|
88 |
* @param p Pointer to rectangle |
|
89 |
* @return Rectangle height |
|
90 |
*/ |
|
27 | 91 |
uint16_t (rectangle_get_h)(const rectangle_t *p); |
92 |
/** |
|
93 |
* @brief Know if point in screen coordinates lies inside rectangle. |
|
94 |
* @param p Pointer to rectangle |
|
95 |
* @param x X-position of the point |
|
96 |
* @param y Y-position of the point |
|
97 |
* @return True if the point lies inside the rectangle, false otherwise. |
|
98 |
*/ |
|
28 | 99 |
int (rectangle_collide_point)(const rectangle_t *p, int x, int y); |
29 |
|
|
100 |
/** |
|
101 |
* Draw rectangle in screen buffer. |
|
102 |
* @param p Pointer to rectangle to be drawn |
|
103 |
*/ |
|
30 | 104 |
void (rectangle_draw)(const rectangle_t *p); |
31 | 105 |
|
32 | 106 |
/** |
Also available in: Unified diff