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 "../../core/lv_obj.h" 17 #if LV_USE_LINE != 0 18 19 /********************* 20 * DEFINES 21 *********************/ 22 23 /********************** 24 * TYPEDEFS 25 **********************/ 26 27 LV_ATTRIBUTE_EXTERN_DATA extern const lv_obj_class_t lv_line_class; 28 29 /********************** 30 * GLOBAL PROTOTYPES 31 **********************/ 32 33 /** 34 * Create a line object 35 * @param parent pointer to an object, it will be the parent of the new line 36 * @return pointer to the created line 37 */ 38 lv_obj_t * lv_line_create(lv_obj_t * parent); 39 40 /*===================== 41 * Setter functions 42 *====================*/ 43 44 /** 45 * Set an array of points. The line object will connect these points. 46 * @param obj pointer to a line object 47 * @param points an array of points. Only the address is saved, so the array needs to be alive while the line exists 48 * @param point_num number of points in 'point_a' 49 */ 50 void lv_line_set_points(lv_obj_t * obj, const lv_point_precise_t points[], uint32_t point_num); 51 52 /** 53 * Set a non-const array of points. Identical to `lv_line_set_points` except the array may be retrieved by `lv_line_get_points_mutable`. 54 * @param obj pointer to a line object 55 * @param points a non-const array of points. Only the address is saved, so the array needs to be alive while the line exists. 56 * @param point_num number of points in 'point_a' 57 */ 58 void lv_line_set_points_mutable(lv_obj_t * obj, lv_point_precise_t points[], uint32_t point_num); 59 60 /** 61 * Enable (or disable) the y coordinate inversion. 62 * If enabled then y will be subtracted from the height of the object, 63 * therefore the y = 0 coordinate will be on the bottom. 64 * @param obj pointer to a line object 65 * @param en true: enable the y inversion, false:disable the y inversion 66 */ 67 void lv_line_set_y_invert(lv_obj_t * obj, bool en); 68 69 /*===================== 70 * Getter functions 71 *====================*/ 72 73 /** 74 * Get the pointer to the array of points. 75 * @param obj pointer to a line object 76 * @return const pointer to the array of points 77 */ 78 const lv_point_precise_t * lv_line_get_points(lv_obj_t * obj); 79 80 /** 81 * Get the number of points in the array of points. 82 * @param obj pointer to a line object 83 * @return number of points in array of points 84 */ 85 uint32_t lv_line_get_point_count(lv_obj_t * obj); 86 87 /** 88 * Check the mutability of the stored point array pointer. 89 * @param obj pointer to a line object 90 * @return true: the point array pointer is mutable, false: constant 91 */ 92 bool lv_line_is_point_array_mutable(lv_obj_t * obj); 93 94 /** 95 * Get a pointer to the mutable array of points or NULL if it is not mutable 96 * @param obj pointer to a line object 97 * @return pointer to the array of points. NULL if not mutable. 98 */ 99 lv_point_precise_t * lv_line_get_points_mutable(lv_obj_t * obj); 100 101 /** 102 * Get the y inversion attribute 103 * @param obj pointer to a line object 104 * @return true: y inversion is enabled, false: disabled 105 */ 106 bool lv_line_get_y_invert(const lv_obj_t * obj); 107 108 /********************** 109 * MACROS 110 **********************/ 111 112 #endif /*LV_USE_LINE*/ 113 114 #ifdef __cplusplus 115 } /*extern "C"*/ 116 #endif 117 118 #endif /*LV_LINE_H*/ 119