Description
I noticed a different resulting colors if I draw a bitmap on a canvas using lv_image_create or lv_canvas_rotate on device with 8 bit depth.
What MCU/Processor/Board and compiler are you using?
PC Simulator
What do you want to achieve?
Create an animation on a transparent layer. The layer is defined as transparent and put on layer_top so I can superimpose objects on all screens. There’s a different resulting color when rotating the bitmap.
What have you tried so far?
I tried a source bitmap with different colors. Results using rotate function are:
- solid green source (RGB 0,255,0), resulting color on screen RGB 0,180,0
- solid white source (RGB 255,255,255), resulting color on screen RGB 180,180,85
(BTW, these numbers seem the ones used in function lv_color_to32)
Am I doing something wrong?
Code to reproduce
// Create clock creen
scrClock = lv_obj_create(NULL, NULL);
// Load clock background
dial = lv_img_create(scrClock, NULL);
lv_img_set_src(dial, &clock);
lv_obj_set_pos(dial, 0, 0);
layerOSD = lv_canvas_create(lv_layer_top(), NULL);
static lv_color_t cbuf[LV_CANVAS_BUF_SIZE_TRUE_COLOR_CHROMA_KEYED(320, 300)];
lv_canvas_set_buffer(layerOSD, cbuf, 320, 300, LV_IMG_CF_TRUE_COLOR_CHROMA_KEYED);
/*Transparent background*/
lv_canvas_fill_bg(layerOSD, LV_COLOR_TRANSP);
lv_obj_set_pos(layerOSD, 0, 0);
dial = lv_img_create(layerOSD, NULL);
// altHand is an image of a white hand with LV_COLOR_TRANSP background
lv_img_set_src(dial, &altHand);
lv_obj_set_pos(dial, 160, 150); // This shows the hand in white
lv_canvas_rotate(layerOSD, &altHand, 0, 147, 22, 13, 132); // This shows the image as yellowish (RGB = 180,180,85)
Screenshot and/or video
If possible, add screenshots and/or videos about the current state.