1 #include "../../lv_examples.h"
2 #if LV_USE_LINE && LV_BUILD_EXAMPLES
3
lv_example_line_1(void)4 void lv_example_line_1(void)
5 {
6 /*Create an array for the points of the line*/
7 static lv_point_t line_points[] = { {5, 5}, {70, 70}, {120, 10}, {180, 60}, {240, 10} };
8
9 /*Create style*/
10 static lv_style_t style_line;
11 lv_style_init(&style_line);
12 lv_style_set_line_width(&style_line, 8);
13 lv_style_set_line_color(&style_line, lv_palette_main(LV_PALETTE_BLUE));
14 lv_style_set_line_rounded(&style_line, true);
15
16 /*Create a line and apply the new style*/
17 lv_obj_t * line1;
18 line1 = lv_line_create(lv_scr_act());
19 lv_line_set_points(line1, line_points, 5); /*Set the points*/
20 lv_obj_add_style(line1, &style_line, 0);
21 lv_obj_center(line1);
22 }
23
24 #endif
25