1 /** 2 * @file lv_line.h 3 * 4 */ 5 6 #ifndef LV_LINE_H 7 #define LV_LINE_H 8 9 #ifdef __cplusplus 10 extern "C" { 11 #endif 12 13 /********************* 14 * INCLUDES 15 *********************/ 16 #include "../lv_conf_internal.h" 17 18 #if LV_USE_LINE != 0 19 20 #include "../lv_core/lv_obj.h" 21 22 /********************* 23 * DEFINES 24 *********************/ 25 26 /********************** 27 * TYPEDEFS 28 **********************/ 29 30 /*Data of line*/ 31 typedef struct { 32 /*Inherited from 'base_obj' so no inherited ext.*/ /*Ext. of ancestor*/ 33 const lv_point_t * point_array; /*Pointer to an array with the points of the line*/ 34 uint16_t point_num; /*Number of points in 'point_array' */ 35 uint8_t auto_size : 1; /*1: set obj. width to x max and obj. height to y max */ 36 uint8_t y_inv : 1; /*1: y == 0 will be on the bottom*/ 37 } lv_line_ext_t; 38 39 /*Styles*/ 40 enum { 41 LV_LINE_PART_MAIN, 42 }; 43 typedef uint8_t lv_line_style_t; 44 45 /********************** 46 * GLOBAL PROTOTYPES 47 **********************/ 48 49 /** 50 * Create a line objects 51 * @param par pointer to an object, it will be the parent of the new line 52 * @return pointer to the created line 53 */ 54 lv_obj_t * lv_line_create(lv_obj_t * par, const lv_obj_t * copy); 55 56 /*===================== 57 * Setter functions 58 *====================*/ 59 60 /** 61 * Set an array of points. The line object will connect these points. 62 * @param line pointer to a line object 63 * @param point_a an array of points. Only the address is saved, 64 * so the array can NOT be a local variable which will be destroyed 65 * @param point_num number of points in 'point_a' 66 */ 67 void lv_line_set_points(lv_obj_t * line, const lv_point_t point_a[], uint16_t point_num); 68 69 /** 70 * Enable (or disable) the auto-size option. The size of the object will fit to its points. 71 * (set width to x max and height to y max) 72 * @param line pointer to a line object 73 * @param en true: auto size is enabled, false: auto size is disabled 74 */ 75 void lv_line_set_auto_size(lv_obj_t * line, bool en); 76 77 /** 78 * Enable (or disable) the y coordinate inversion. 79 * If enabled then y will be subtracted from the height of the object, 80 * therefore the y=0 coordinate will be on the bottom. 81 * @param line pointer to a line object 82 * @param en true: enable the y inversion, false:disable the y inversion 83 */ 84 void lv_line_set_y_invert(lv_obj_t * line, bool en); 85 86 #define lv_line_set_y_inv \ 87 lv_line_set_y_invert /*The name was inconsistent. In v.6.0 only `lv_line_set_y_invert`will \ 88 work */ 89 90 91 /*===================== 92 * Getter functions 93 *====================*/ 94 95 /** 96 * Get the auto size attribute 97 * @param line pointer to a line object 98 * @return true: auto size is enabled, false: disabled 99 */ 100 bool lv_line_get_auto_size(const lv_obj_t * line); 101 102 /** 103 * Get the y inversion attribute 104 * @param line pointer to a line object 105 * @return true: y inversion is enabled, false: disabled 106 */ 107 bool lv_line_get_y_invert(const lv_obj_t * line); 108 109 /********************** 110 * MACROS 111 **********************/ 112 113 #endif /*LV_USE_LINE*/ 114 115 #ifdef __cplusplus 116 } /* extern "C" */ 117 #endif 118 119 #endif /*LV_LINE_H*/ 120