Draw without canvas

Hi All,

I am using LittlevGL on a graphics project using a microcontroller on a custom build board. I found it very useful and easy to use, and was able to do in few hours what it took me days to do with proprietary libraries. The graphics I’m using require to have partial solid colour with/without gradient on parts of the screen which could easily be made using a rectangle draw on a canvas. The issue is that to use a canvas, a dedicated buffer is needed and this consumes memory, especially if the canvas is large (say half of the screen).

I currently went around this by using an inactive button and setting the colour of the inactive style as needed. Although this works, I would like to know if there is a better way of directly drawing a sold colour on the screen without using a canvas or having to create a button object.

P.S. As a secondary question, would it be possible to have different types of gradient (vertical, centre etc…)?

System details;
MCU: PIC32MK1024GPD100
Display: RGB 320 x 240, 16-bit colour depth


For simply drawing a rectangle with a color/gradient, you should create a basic object (lv_obj_create) and then change its style as needed.

Other types of gradients aren’t supported right now, but it wouldn’t be impossible to add in the future.

v7.0 already supports horizontal gradient too. (the current under development version)

Thanks. That fixed it :slight_smile:

Hi Kisvegabor,

Thanks. Will try it as soon as it comes out.

Another question regarding gradient; will v7.0 include centred gradients (main colour at centre and grad colour on both sides)?

I was considering it but probably it will be an other release later.