1 /**
2  * @file lv_draw_label.h
3  *
4  */
5 
6 #ifndef LV_DRAW_LABEL_H
7 #define LV_DRAW_LABEL_H
8 
9 #ifdef __cplusplus
10 extern "C" {
11 #endif
12 
13 /*********************
14  *      INCLUDES
15  *********************/
16 #include "lv_draw.h"
17 
18 /*********************
19  *      DEFINES
20  *********************/
21 
22 /**********************
23  *      TYPEDEFS
24  **********************/
25 
26 /** Store some info to speed up drawing of very large texts
27  * It takes a lot of time to get the first visible character because
28  * all the previous characters needs to be checked to calculate the positions.
29  * This structure stores an earlier (e.g. at -1000 px) coordinate and the index of that line.
30  * Therefore the calculations can start from here.*/
31 typedef struct {
32     /** Index of the line at `y` coordinate*/
33     int32_t line_start;
34 
35     /** Give the `y` coordinate of the first letter at `line start` index. Relative to the label's coordinates*/
36     int32_t y;
37 
38     /** The 'y1' coordinate of the label when the hint was saved.
39      * Used to invalidate the hint if the label has moved too much. */
40     int32_t coord_y;
41 }lv_draw_label_hint_t;
42 
43 /**********************
44  * GLOBAL PROTOTYPES
45  **********************/
46 
47 /**
48  * Write a text
49  * @param coords coordinates of the label
50  * @param mask the label will be drawn only in this area
51  * @param style pointer to a style
52  * @param opa_scale scale down all opacities by the factor
53  * @param txt 0 terminated text to write
54  * @param flag settings for the text from 'txt_flag_t' enum
55  * @param offset text offset in x and y direction (NULL if unused)
56  * @param sel_start start index of selected area (`LV_LABEL_TXT_SEL_OFF` if none)
57  * @param sel_end end index of selected area (`LV_LABEL_TXT_SEL_OFF` if none)
58  */
59 void lv_draw_label(const lv_area_t * coords, const lv_area_t * mask, const lv_style_t * style, lv_opa_t opa_scale,
60                    const char * txt, lv_txt_flag_t flag, lv_point_t * offset, uint16_t sel_start, uint16_t sel_end,
61                    lv_draw_label_hint_t * hint);
62 
63 /**********************
64  *      MACROS
65  **********************/
66 
67 #ifdef __cplusplus
68 } /* extern "C" */
69 #endif
70 
71 #endif /*LV_DRAW_LABEL_H*/
72