How to fill background of a canvas to transparent?

Hi,

I try to rotate an image on a transparent canvas(cf=TRUE_COLOR_ALPHA).
If I want to change the angle, I need to fill background to transparent to clean the old image first.
But lvgl.canvas.fill_bg() won’t fill the alpha channel.

Currently I use cbuf[:] = bytes(4*w*h) to clean the canvas background to transparent and eventually it will need a gc to collect memory.

Use for loop to assign alpha channel of a buffer will not consume memory but is much slower.

Is there any other way to fill the alpha channel of the background of a canvas?
Thanks.

Using LV_IMG_CF_TRUE_COLOR_CHROMA_KEYED
instead of LV_IMG_CF_TRUE_COLOR_ALPHA,
and set LV_COLOR_TRANSP as fill_bg().

This post was flagged by the community and is temporarily hidden.