Make the canvas background transparent

What LVGL version are you using?

V 6.1.2

What do you want to achieve?

I want to make the canvas background transparent

I want to put an image on the canvas and rotate it
At this time, the background should be transparent

please Help!

Code to reproduce



	lv_style_copy(&my_img_style,&lv_style_plain_color);	

	canvas_measure = lv_canvas_create(scr,NULL);
	lv_canvas_set_buffer(canvas_measure,cbuf_measure,CANVAS_WIDTH,CANVAS_HEIGHT,LV_IMG_CF_TRUE_COLOR_CHROMA_KEYED);
	lv_obj_set_pos(canvas_measure,130,146);
	lv_canvas_draw_img(canvas_measure,100,100,"S:/3_r_right.bin",&my_img_style);
	lv_canvas_set_style(canvas_measure,LV_CANVAS_STYLE_MAIN,&my_img_style);

	memcpy(cbuf_measure_temp,cbuf_measure,sizeof(cbuf_measure_temp));
	lv_img_dsc_t img;

	img.data = (void *)cbuf_measure_temp;
	img.header.cf = LV_IMG_CF_TRUE_COLOR;
	img.header.w = CANVAS_WIDTH;
	img.header.h = CANVAS_HEIGHT;

	lv_canvas_rotate(canvas_measure,&img,20,0,0,CANVAS_WIDTH/2,CANVAS_HEIGHT/2);

I’m not sure if making the canvas transparent is possible in v6. If the buffer is chroma keyed, try filling it with LV_COLOR_TRANSP. If that still doesn’t work, you may have to update to v7.

I’m in v7, and using lv_canvas_fill_bg() (if this is what you’re referring to) with LV_OPA_TRANSP did not work; it did work using the standard lv_obj_get_style_bg_opa() call, FWIW.

It didn’t solve the problem, so I drew it myself using “LINE”.
Thank you very much