Important: unclear posts may not receive useful answers.
Description
when i want to draw a red canvas on my project,it does not work as my expect.i set align as LV_ALIGN_IN_TOP_LEFT.when i output first 8 bytes of color_p,it’s FF FF FF FF FF FF FF FF.But red color should be 00 1F 00 1F 001F 00 1F
What MCU/Processor/Board and compiler are you using?
What LVGL version are you using?
What do you want to achieve?
What have you tried so far?
Code to reproduce
The code block(s) should be formatted like:
/*You code here*/
#if LV_USE_CANVAS
#define CANVAS_WIDTH 50
#define CANVAS_HEIGHT 50
void lv_ex_canvas_test(void)
{
static uint8_t cbuf[LV_CANVAS_BUF_SIZE_INDEXED_1BIT(CANVAS_WIDTH, CANVAS_HEIGHT)];
lv_obj_t* canvas = lv_canvas_create(lv_scr_act(), NULL);
lv_canvas_set_buffer(canvas, cbuf, CANVAS_WIDTH, CANVAS_HEIGHT, LV_IMG_CF_TRUE_COLOR);
//lv_canvas_set_palette(canvas, 0, LV_COLOR_TRANSP);
lv_canvas_set_palette(canvas, 1, LV_COLOR_RED);
lv_obj_align(canvas, NULL, LV_ALIGN_IN_TOP_LEFT, 0, 0);
lv_canvas_fill_bg(canvas, LV_COLOR_RED, LV_OPA_TRANSP);
}
#endif
static void LcdDisp_callback(lv_disp_drv_t * disp_drv, const lv_area_t * area, lv_color_t * color_p)
{
TRACE(DBG_TRACE_LVL,"%s--->\r\n",__FUNCTION__);
/* IMPORTANT!!!
* Inform the graphics library that you are ready with the flushing*/
lv_coord_t hres = disp_drv->rotated == 0 ? disp_drv->hor_res : disp_drv->ver_res;
lv_coord_t vres = disp_drv->rotated == 0 ? disp_drv->ver_res : disp_drv->hor_res;
TRACE(DBG_TRACE_LVL,"%s--->area->x2=%d area->x1=%d area->y1=%d area->y2=%d hres=%d vres=%d rotated=%d\r\n",__FUNCTION__,area->x2,area->x1,area->y1,area->y2,hres,vres,disp_drv->rotated);
if(area->x2 < 0 || area->y2 < 0 || area->x1 > hres - 1 || area->y1 > vres - 1)
{
lv_disp_flush_ready(disp_drv);
return;
}
/* int32_t x;*/
/* int32_t y;*/
/* for(y = area->y1; y <= 1; y++)*/
/* {*/
/* for(x = area->x1; x <= area->x2; x++)*/
/* {*/
/* TemppBuffer[y *disp_drv->hor_res + x] = lv_color_to16(*color_p);*/
/* //TRACE(DBG_TRACE_LVL,"%02x",FrameBuffer[(y * disp_drv->hor_res)+x]);*/
/* color_p++;*/
/* }*/
/* }*/
u32 i=0;
for(i=0;i<10;i++)
{
TRACE(DBG_TRACE_LVL,"color_p=%02x\r\n",*color_p);
color_p++;
}
//lark_lcd_display_update(area->x1,area->y1,area->x2,area->y2);
lark_lcd_write(LCD_MODE_COLOR, area->x1,area->y1,area->x2-area->x1+1,area->y2-area->y1+1,(pu8)color_p);
lv_disp_flush_ready(disp_drv);
}
## Screenshot and/or video
If possible, add screenshots and/or videos about the current state.