Hi all,
Can anyone give me some help about how to set pixels in a white canvas on lvgl 8.3. I want to draw two graphs with two different colors (red and blue) on a white canvas. If someone can post a sample code i will be thankeful. I tried this code but it do not plot points :
//Write codes Gui_InsGraphScreen_canvas_1
ui->Gui_InsGraphScreen_canvas_1 = lv_canvas_create(ui->Gui_InsGraphScreen_GuiContainer);
static lv_color_t buf_Gui_InsGraphScreen_canvas_1[200*200*4];
lv_obj_set_pos(ui->Gui_InsGraphScreen_canvas_1, 10, 10);
lv_obj_set_size(ui->Gui_InsGraphScreen_canvas_1, 200, 200);
lv_obj_set_scrollbar_mode(ui->Gui_InsGraphScreen_canvas_1, LV_SCROLLBAR_MODE_OFF);
lv_canvas_fill_bg(ui->Gui_InsGraphScreen_canvas_1, lv_color_white(), LV_OPA_COVER);
// Draw a red diagonal line
int i;
for (i = 0; i < 200; i++)
{
lv_canvas_set_px(ui->Gui_InsGraphScreen_canvas_1, i, i, lv_color_make(255, 0, 0));
}
// Draw a blue diagonal line
for (i = 0; i < 200; i++)
{
lv_canvas_set_px(ui->Gui_InsGraphScreen_canvas_1, i, 199 - i, lv_color_make(0, 0, 255));
}
Thanks.