Hello,
I’ve following code, but the line is not drawed, can only see the background of the canvas (red), and a small green rectangle.
Why I can’t see the line?
I’m using lvgl version 8.3.2
Thank you
//static lv_color_t buf_screen_1_canvas_1[100*100*4];
static lv_color_t buf_screen_1_canvas_1[LV_CANVAS_BUF_SIZE_INDEXED_1BIT(100, 100)];
//lv_canvas_set_buffer(ui->screen_1_canvas_1, buf_screen_1_canvas_1, 100, 100, LV_IMG_CF_TRUE_COLOR_ALPHA);
lv_canvas_set_buffer(ui->screen_1_canvas_1, buf_screen_1_canvas_1, 100, 100, LV_IMG_CF_INDEXED_1BIT);
lv_canvas_set_palette(ui->screen_1_canvas_1, 0, LV_COLOR_CHROMA_KEY);
lv_canvas_set_palette(ui->screen_1_canvas_1, 1, lv_palette_main(LV_PALETTE_RED));
/*Create colors with the indices of the palette*/
lv_color_t c0;
lv_color_t c1;
c0.full = 0;
c1.full = 1;
//lv_canvas_fill_bg(ui->screen_1_canvas_1, lv_color_make(0xff, 0xff, 0xff), 255);
lv_canvas_fill_bg(ui->screen_1_canvas_1, c1, LV_OPA_COVER);
/*Create hole on the canvas*/
uint32_t x;
uint32_t y;
for(y = 10; y < 30; y++) {
for(x = 5; x < 20; x++) {
lv_canvas_set_px_color(ui->screen_1_canvas_1, x, y, c0);
}
}
lv_draw_line_dsc_t draw_line_dsc;
lv_draw_line_dsc_init(&draw_line_dsc); // Linienstil initialisieren
draw_line_dsc.color = c0; // Linienfarbe setzen
draw_line_dsc.width = 8;
//lv_point_t points[] = {last_point, current_point};
//lv_point_t points[] = {{10, 20}, {30, 40}};
lv_point_t points[2] = {{20, 50}, {80, 50}};
lv_canvas_draw_line(ui->screen_1_canvas_1, points, 2, &draw_line_dsc); // draw line with style