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 "../core/lv_obj.h" 21 22 /********************* 23 * DEFINES 24 *********************/ 25 26 /********************** 27 * TYPEDEFS 28 **********************/ 29 30 /*Data of line*/ 31 typedef struct { 32 lv_obj_t obj; 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 y_inv : 1; /**< 1: y == 0 will be on the bottom*/ 36 } lv_line_t; 37 38 extern const lv_obj_class_t lv_line_class; 39 40 /********************** 41 * GLOBAL PROTOTYPES 42 **********************/ 43 44 /** 45 * Create a line object 46 * @param parent pointer to an object, it will be the parent of the new line 47 * @return pointer to the created line 48 */ 49 lv_obj_t * lv_line_create(lv_obj_t * parent); 50 51 /*===================== 52 * Setter functions 53 *====================*/ 54 55 /** 56 * Set an array of points. The line object will connect these points. 57 * @param obj pointer to a line object 58 * @param points an array of points. Only the address is saved, so the array needs to be alive while the line exists 59 * @param point_num number of points in 'point_a' 60 */ 61 void lv_line_set_points(lv_obj_t * obj, const lv_point_t points[], uint16_t point_num); 62 63 /** 64 * Enable (or disable) the y coordinate inversion. 65 * If enabled then y will be subtracted from the height of the object, 66 * therefore the y = 0 coordinate will be on the bottom. 67 * @param obj pointer to a line object 68 * @param en true: enable the y inversion, false:disable the y inversion 69 */ 70 void lv_line_set_y_invert(lv_obj_t * obj, bool en); 71 72 /*===================== 73 * Getter functions 74 *====================*/ 75 76 /** 77 * Get the y inversion attribute 78 * @param obj pointer to a line object 79 * @return true: y inversion is enabled, false: disabled 80 */ 81 bool lv_line_get_y_invert(const lv_obj_t * obj); 82 83 /********************** 84 * MACROS 85 **********************/ 86 87 #endif /*LV_USE_LINE*/ 88 89 #ifdef __cplusplus 90 } /*extern "C"*/ 91 #endif 92 93 #endif /*LV_LINE_H*/ 94