LVGL - Light and Versatile Graphics Library

Overview

LVGL - Light and Versatile Graphics Library

LVGL provides everything you need to create an embedded GUI with easy-to-use graphical elements, beautiful visual effects and a low memory footprint.

Website · Docs · Forum · Services · Interactive examples


Table of content

Overview

Features

  • Powerful building blocks: buttons, charts, lists, sliders, images, etc.
  • Advanced graphics engine: animations, anti-aliasing, opacity, smooth scrolling, blending modes, etc
  • Supports various input devices: touchscreen, mouse, keyboard, encoder, buttons, etc.
  • Supports multiple displays
  • Hardware independent, can be use with any microcontroller and display
  • Scalable to operate with little memory (64 kB Flash, 16 kB RAM)
  • Multi-language support with UTF-8 handling, CJK, Bidirectional and Arabic script support
  • Fully customizable graphical elements via CSS-like styles
  • Powerful layouts inspired by CSS: Flexbox and Grid
  • OS, External memory and GPU are supported but not required. (built in support for STM32 DMA2D, and NXP PXP and VGLite)
  • Smooth rendering even with a single frame buffer
  • Written in C and compatibile with C++
  • Micropython Binding exposes LVGL API in Micropython
  • Simulator to develop on PC without embedded hardware
  • 100+ simple Examples
  • Documentation and API references online and in PDF

Requirements

Basically, every modern controller (which is able to drive a display) is suitable to run LVGL. The minimal requirements are:

Name Minimal Recommended
Architecture 16, 32 or 64 bit microcontroller or processor
Clock > 16 MHz > 48 MHz
Flash/ROM > 64 kB > 180 kB
Static RAM > 16 kB > 48 kB
Draw buffer > 1 × hor. res. pixels > 1/10 screen size
Compiler C99 or newer

Note that the memory usage might vary depending on the architecture, compiler and build options.

Supported platforms

LVGL is completely platform independent and can be used with any MCU that fulfills the requirements. Just to mention some platforms:

LVGL is also avaiable as:

Get started

This list shows the recommended way of learning the library:

  1. Check the Online demos to see LVGL in action (3 minutes)
  2. Read the Introduction page of the documentation (5 minutes)
  3. Get familiar with the basics on the Quick overview page (15 minutes)
  4. Set up a Simulator (10 minutes)
  5. Try out some Examples
  6. Port LVGL to a board. See the Porting guide or check the ready to use Projects
  7. Read the Overview page to get a better understanding of the library (2-3 hours)
  8. Check the documentation of the Widgets to see their features and usage
  9. If you have questions go to the Forum
  10. Read the Contributing guide to see how you can help to improve LVGL (15 minutes)

Examples

For more examples see the examples folder.

LVGL button with label example

C

lv_obj_t * btn = lv_btn_create(lv_scr_act());                   /*Add a button to the current screen*/
lv_obj_set_pos(btn, 10, 10);                                    /*Set its position*/
lv_obj_set_size(btn, 100, 50);                                  /*Set its size*/
lv_obj_add_event_cb(btn, btn_event_cb, LV_EVENT_CLICKED, NULL); /*Assign a callback to the button*/

lv_obj_t * label = lv_label_create(btn);                        /*Add a label to the button*/
lv_label_set_text(label, "Button");                             /*Set the labels text*/
lv_obj_center(label);                                           /*Align the label to the center*/
...

void btn_event_cb(lv_event_t * e)
{
  printf("Clicked\n");
}

Micropython

Learn more about Micropython.

def btn_event_cb(e):
  print("Clicked")

# Create a Button and a Label
btn = lv.btn(lv.scr_act())
btn.set_pos(10, 10)
btn.set_size(100, 50)
btn.add_event_cb(btn_event_cb, lv.EVENT.CLICKED, None)

label = lv.label(btn)
label.set_text("Button")
label.center()

Services

LVGL Kft was established to provide a solid background for LVGL library. We offer several type of services to help you in UI development:

  • Graphics design
  • UI implementation
  • Consulting/Support

For more information see https://lvgl.io/services Feel free to contact us if you have any questions.

Contributing

LVGL is an open project and contribution is very welcome. There are many ways to contribute from simply speaking about your project, through writing examples, improving the documentation, fixing bugs to hosting your own project under the LVGL organization.

For a detailed description of contribution opportunities visit the Contributing section of the documentation.

Comments
  • Convert Micropython to JavaScript in order to create an online simulator

    Convert Micropython to JavaScript in order to create an online simulator

    In continue of #687

    Discuss how to concert micropython to javascript to have an online simulator where people can easily try LittlevGL in their browser without downloading anything.


    Summarizing what's left before release:

    • [ ] Standard import support for scripts (waiting on micropython/micropython#4929)
    • [ ] Finalize the method(s) for sharing scripts
    • [ ] Potentially improve frame rates
    • [ ] Ability to open files (images, fonts, etc)

    Later (once the initial version is up on https://littlevgl.com):

    • [ ] Ability to resize the canvas (up to a set maximum)
    • Possibly more
    pinned 
    opened by kisvegabor 456
  • [v8] Testing

    [v8] Testing

    Hi,

    Almost every planned feature is implemented for v8. Now what we need the most is a lot of feedback about bugs and possible regressions.

    v8 is available in the master branch of lvgl.
    https://github.com/lvgl/lv_sim_eclipse_sdl/tree/dev is a ready-to-use project with v8. Note that the driver registration part slightly changed. The most important thing is that drivers lv_indev_drv_t, lv_disp_drv_t and lv_fs_drv_t needs to be static.

    I suggest trying the demo widget first. It should work well on small (240x240) and very large (1280x720) screens.

    The followings will be added soon:

    • The copy parameter is not working yet in the create functions
    • the mono theme
    • updating the docs
    • updating the MicroPython binding

    In v8 there is an examples directory where you find a lot of examples for widgets, layouts, etc.

    If you have minor remarks, feel free to comment here. For bigger issues please open a new issue.

    Here is a teaser about the new widgets demo on 800x480:

    https://user-images.githubusercontent.com/7599318/111334210-a60a8380-8673-11eb-9092-72e1afb3549a.mp4

    Thank you very much if you test v8 and tell your experience :slightly_smiling_face:

    opened by kisvegabor 403
  • General discussion for v6.0 (RELEASED)

    General discussion for v6.0 (RELEASED)

    Schedule v6.0 has been released! Official release notes: https://github.com/littlevgl/lvgl/releases/tag/v6.0

    Main new features

    • [x] Generic action handling #316
    • [x] Multi-display support with run time display parameter settings #329 #109
    • [x] Better GPU handling #87
    • [x] Image rotation
    • [x] Context to every callback comment
    • [x] Image caching for faster image decoding

    Migrating from v5.3 to v6.0

    v6.0 won't be fully compatible with v5.3 because some API changes will happen.

    Changes that are either difficult for a compiler to precisely report, or may not be reported by a compiler at all are highlighted in bold. If you are experiencing bugs after migration, check these changes first.

    • You must update lv_conf.h from lv_conf_template.h.
    • lv_obj_set_event_cb(obj, callback) instead of lv_btn_set_action(btn, LV_BTN_ACTION_..., callback). Event callbacks are used to handle all the former actions (i.e. long pressed, released are handled by a single function). This has many advantages, one being that it allows you to detect click events on any object.
    • Objects now automatically detect if they've been deleted, no need for returning LV_RES_OK/LV_RES_INV in your lv_event_cb_t. For this reason, lv_event_cb_t functions return void.
    • Dynamically changeable display config. Instead of hardcoded in lv_conf.h.
    • Need to explicitly initialize your display buffer(s) and add it/them to your display driver.
    • LV_HOR_RES and LV_VER_RES are replaced with LV_HOR_RES_MAX and LV_VER_RES_MAX, which define the maximum horizontal and vertical resolution of your display, respectively. The old macros are still present, but will not work well with more than one display.
    • lv_obj_get_free_ptr and lv_obj_get_free_num are replaced lv_obj_get_user_data. The type of the user data can be changed in lv_conf.h
    • User data is now available for some other structures as well, like driver objects.
    • Driver function signatures now take an initial first parameter, the driver object itself. This allows your driver functions to work with more than one physical device without requiring two separate drivers to be written.
      • (i.e. indev callbacks now take an initial first parameter of lv_indev_t *)
    • disp_flush is now flush_cb. Instead of directly taking x/y coordinates, it takes in an lv_area_t which has fields x1, y1, x2, y2
    • Font system is updated and now supports kerning. You must generate your fonts again with the new converter.
    • Callbacks of lv_task now receive a pointer to the task itself instead of the user data. The user data can be accessed as task->user_data
    • lv_anim_set_...(&a) function are added to replace manual initialization of ```lv_anim_t`
    • Renames in lv_anim_t.
    • The ready_cb now receives the whole lv_anim_t * structure as an argument, not a void *.
    • lv_style_anim_t is removed. Use lv_anim_t a; and lv_style_anim_set_...(&a, ...) intstead.
    • All padding and fits are left, right, top, bottom instead of ver and hor.
    • lv_canvas: use lv_draw_... functions
    • All the macros like USE_LV_BTN now are like LV_USE_BTN.
    • Rename symbols: SYMBOL_HOME --> LV_SYMBOL_HOME
    • Rename LV_GROUP_KEY_... to LV_KEY_...
    • The GPU API has changed. You will need to update any GPU drivers you may have written.
    • minor function API changes...
    need test pinned 
    opened by kisvegabor 332
  • [v8] Review LVGL API for Micropython Binding compatibility

    [v8] Review LVGL API for Micropython Binding compatibility

    For Micropython (or other future) binding to work correctly, certain API naming conventions must be followed. LVGL API in general follows these conventions. However, in certain cases these conventions were missed.

    Examples for such problems:

    Changing the API breaks it, so we cannot fix that for v7 (although there are workarounds)

    Therefore - I suggest reviewing LVGL API before releasing v8, and checking that the following conventions are followed:

    • [ ] A function that returns a pointer to a specific widget should return a pointer to that widget and not to a generic lv_obj_t.
      For example, lv_tabview_add_tab should return lv_page_t instead of lv_obj_t.
    • [x] Widget member function must start with lv_<widgetName>
    • [x] Widget member function must receive lv_obj_t * as its first argument, and this argument must be a pointer to the Widget objects itself.
      For example, lv_page_glue_obj should receive the page object as the first argument, and not the object that should be glued.
    • [ ] Widget constructor must be named lv_<widgetName>_create and receive lv_obj_t * par as its first argument. It can have additional arguments. For example: lv_obj_t * lv_btn_create(lv_obj_t * par, const lv_obj_t * copy);
    • [ ] lv_set_event_cb must be reimplemented and not inherited from lv_obj, if we want the callback to receive the component and not lv_obj as argument. See this post. (Can be implemented as static inline wrapper so no C overhead)
    • [ ] Need to verify these conventions for both core and external widgets, such as lv_lib_qrcode
    • [x] Member functions of structs should follow the Widget conventions. They should receive a pointer to the struct as the first argument, and the prefix of the struct name should be used as the prefix of the function name (for example lv_indev_drv_register(lv_indev_drv_t * driver) )
    • [ ] Avoid ambiguity in between struct members and struct member functions. (For example start in lv_anim_t)
    • [x] Callback conventions must be followed:
      • There's a struct that contains a field called void * user_data.
      • A pointer to that struct is provided as the first argument of a callback registration function.
      • A pointer to that struct is provided as the first argument of the callback itself.
        OR
      • A parameter called void * user_data is provided to the registration function as the last argument.
      • The callback itself recieves void * user_data as the last argument
    • [x] Callbacks that are not available for the Binding must include the string xcb
    • [x] All global pointers to dynamically allocated RAM must be defined as GC roots and accessed with LV_GC_ROOT macro.
    • [x] Functions which are not part of the public API must begin with underscore, to mark them as "private".
    • [ ] Some structs should not be used directly by the user. Instead, LVGL provides many setter/getter functions. For example lv_anim_t has lv_anim_set_path to set the path instead of directly writing to path field of lv_anim_t.
      In order to minimize the API size, it's better to mark such structs as "private" by prefixing them by underscore. This way the binding script would know not to wrap every field in them, and treat them as opaque objects instead.
    • [x] Strings must be passed as const char *
    • [x] Arrays must be passed with square brackets and not as pointers. For example: lv_draw_triangle(const lv_point_t points[]
    • [x] Argument must be named also on H files (For example void lv_style_list_remove_style(lv_style_list_t * list, ... but not void lv_style_list_remove_style(lv_style_list_t *, ...)
    • [x] Constants should be declared as enums instead of macros, when possible. (enums are visible to the bindings, macros are not)
    • [x] C Macros are not available in the binding. Add static inline functions to encapsulate macros for macros that should be part of the API. (For example, lv_color_hex)
    • [x] All function prototypes must have implementation
    • [x] Function prototypes must not be duplicated

    Update

    • [ ] Function arguments that are pointers to struct_type should be declared in the function prototype as struct_type * and not void *.
      For example, callbacks on lv_fs.h should receive lv_fs_file_t * file_p and not void * file_p.
    • [ ] Widget name must not be a prefix of another widget name. For example, we can't have both dropdown and dropdown_list widgets.
    pinned 
    opened by amirgon 286
  • Improve the MicroPython simulator

    Improve the MicroPython simulator

    The MicroPython simulator is online and ready to use, but needs to be polished further.

    Here is a list of improvements compiled by @amirgon:

    • [x] Monaco Editor
    • [x] Allow changing the various pane sizes
    • [x] Try to improve Frame-Rate
    • [ ] Host SnippetBin backend on LittlevGL server instead of Heroku
    • [x] Improve styling of the html, Bootstrap
    • [x] Support loading fonts on runtime on lvgl. This would allow sharing snippets with custom fonts
    enhancement need test pinned 
    opened by embeddedt 240
  • [v7.0] General discussion

    [v7.0] General discussion

    Schedule

    Release candidate: 1 May Release: 18 May

    Docs

    The docs for v7 is available here: https://docs.littlevgl.com/v7/en/html/index.html The most important part which should be checked is the Style section because it's completely rewritten. The documentation is not finished yet. Feedback is very welcome about unclear parts.

    Compatibility notes

    • Some features from 6.x are now disabled by default in 7.0. You may need to re-enable them in lv_conf.h.

    Main new features

    See the dev-7.0 branch of the Eclipse SDL simulator to easily test the latest development version.

    New drawing

    Complete rework of LittlevGL's draw engine to use masks for more advanced and higher quality graphical effects. A possible use-case of this system is to remove the overflowing content from the rounded edges. It also allows drawing perfectly anti-aliased circles, lines, and arcs. Internally, the drawings happen by defining masks (such as rounded rectangle, line, angle). When something is drawn the currently active masks can make some pixels transparent. For example, rectangle borders are drawn by using 2 rectangle masks: one mask removes the inner part and another the outer part.

    • [x] arc anti-aliasing
    • [x] triangle/polygon anti-aliasing
    • [x] more accurate line positions
    • [x] lv_img_set_angle: set image object's angle without using canvas
    • [x] lv_img_set_zoom: set image object's zoom factor

    Rework the style system

    A new CSS-like style system is added which supports cascading styles and local style properties per object. As part of this updates a lot of objects were reworked and the APIs have been changed. Learn more about new features and the changes here.

    New style features

    • [x] better shadows (offset/spread)
    • [x] gradient stop position (to shift the gradient area) and horizontal gradient (main_color_stop, grad_color_stop)
    • [x] LV_BLEND_MODE_NORMAL/ADDITIVE/SUBTRACTIVE blending modes (xxx_blend_mode)
    • [x] corner_mask to crop the content on the rounded corners
    • [x] text_underline/strikethrough
    • [x] dashed vertiecal and horizontal lines dash_gap, dash_width
    • [x] outline_... a border-like part dawn out of the background. can have padding between the background.
    • [x] pattern_... display and image in the middle of the backgroun or repeat it
    • [x] value_... display a text wich is stored in the style. Can be used e.g. as a lighweighted text on buttons too.
    • [x] Add style example

    New object types

    • [x] lv_objmask: masks can be added to it. The children will be masked accordingly.
    • [ ] ~lv_polygon: basic object to draw a polygon (postponed)~

    Object updates

    • [x] Canvas: drawing to true color alpha and alpha only canvas
    • [x] Fix scroll propagation on page-like objects
    • [x] Add LV_DRAG_DIR_ONE
    • [x] lv_canvas_blur_hor/ver
    • [x] lv_canvas_zoom
    • [x] lv_canvas_rotate rename to lv_canvas_transform
    • [x] lv_canvas_rotate and lv_img add option to enable/disable anti-aliasing on transformation (choose speed and quality)
    • [x] lv_gauge: use image as needle
    • [x] lv_slider/lv_sw: use image as knob
    • [x] lv_ddlist_set_symbol(ddlist, LV_SYMBOL_DOWN)
    • [x] If available in the font use bullet (U+2022) character in text area password

    Themes

    • [x] Rework themes system
    • [x] Add dark theme
    • [x] Add light theme
    • [x] Add mono theme
    • [x] Add tepmlate theme
    • [x] Add empty theme

    Others

    • [x] Add ° to the default fonts
    • [x] Add playback_time to animations. LINK
    • [x] Add repeat_count to animations instead of the current "repeat forever".
    • [ ] Add lv_disp_screenshot. LINK
    • [x] Replace LV_LAYOUT_PRETTY with LV_LAYOUT_PRETTY_TOP/MID/BOTTOM
    • [ ] Update docs
    • [x] Add widgets demo
    • [x] Add keypad/encoder demo

    Rework example repos

    Mainly after the release:

    help wanted architecture 
    opened by kisvegabor 237
  • Feature suggestion: Micropython binding

    Feature suggestion: Micropython binding

    Micropython is becoming mainstream on IOT and embedded development in general. It is available for quite a few of embedded architectures (this and this, partial list), and can be ported to new ones. Today there already exist several architecture-specific micropython display modules (for example this and this), but none of them as feature rich and general as littlevgl.
    I think it could be useful to provide micropython API to littlevgl Objects and Styles.
    Main benefits are:

    • Exposure to a larger audience in the embedded development world.
    • Interactive developement. Use the Micropython interpreter to exercise littlevgl over a live embedded board. This would allow rapid GUI development without the build-flash cycle.
    • Some would argue Python code is easier to develop and maintain (not sure I agree about this one...)

    If it turns out there is an agreement about this feature, I might try sending PR if I find the time for it.

    enhancement architecture 
    opened by amirgon 230
  • Need better inheriance support

    Need better inheriance support

    Continue of #1874.

    Currently LVGL has er primitive inheritance support for widgets.

    • Only data inheritance supported
    • No support for methods inheritance
    • No support for constructor/destructor
    • No widget types reflection

    This cause different kinds of direct and indirect issues:

    • Widgets extension is not human-friendly
    • Memory use not optimal (many things can be moved to "class descriptor")
    • Many things could be simplified (lv_obj_allocate_ext_attr, user_data, signals)
    • Future problems with delegated listeners of bubbled events (filter by src type)
    • other...

    So, better inheritance support would be highly appreciated.

    Known solutions for C:

    • https://www.cs.rit.edu/~ats/books/ooc.pdf
    • http://ooc-coding.sourceforge.net/
    • https://developer.gnome.org/gobject/stable/
    • https://github.com/CObjectSystem/COS
    • https://github.com/ShmuelFine/COOP

    Some of above are no for embedded, but could be useful to understand ideas & programming patterns.

    architecture 
    opened by puzrin 200
  • Style optimizations

    Style optimizations

    I was wondering what kind of data structures such as lists. hash tables etc. lvgl already uses in the core? I found the linked list lib in the utils folder. Are there any other ones?

    I saw a bsearch function to match strings with keys and some text functions but everything seems very specialized for it's purpose. Not really an easy way to reuse those without rewriting the whole function.

    I am still working on API improvements and I figure it would be better if I try to reuse what is already there as much as possible to keep the size as small as possible.

    I mainly need some kind of associative array or dictionary structure to bind API functions to lvgl functions. Kinda like a typedef for functions which is what an API really is for. Then changes on the backend don't affect the frontend code.

    PS. lv_area., and lv_obj.c use basically the same code for alignment. If you rename new_x and new_y or res->x and res->y you can trim about 100 lines of code.

    architecture 
    opened by excitedbox 159
  • Unicode Bidirectional Algorithm

    Unicode Bidirectional Algorithm

    Hi there,

    How about include Unicode Bidirectional Algorithm to LittlevGL? Since:

    • It is supossed to be used all over the world.
    • It supports unicode characters.
    • It supports different languages handling.

    It seems hard to implement it, but doing a quick research there is a library that could do it for us --> GNU FriBidi.

    I have never work with Unicode Bidirectional Algorithm, but maybe any of you have and could tell us about the possibility of including it for LittlevGL.

    pinned 
    opened by beibean 147
  • Add lv_cpicker object

    Add lv_cpicker object

    Hi,

    This is a new object proposition : a color wheel for picking a color.

    lv_cpicker

    Test code :

        const uint32_t pickerSize = 200;
        lv_obj_t * scr = lv_scr_act();
    
        static lv_style_t style;
        lv_style_copy(&style, &lv_style_plain);
        style.line.color = lv_color_hsv_to_rgb(0, 100, 100);
        style.line.width = pickerSize/5;
        style.body.padding.inner = 8;
    
        static lv_style_t indicStyle;
        lv_style_copy(&indicStyle, &lv_style_plain);
        indicStyle.body.main_color = LV_COLOR_WHITE;
        indicStyle.body.grad_color = indicStyle.body.main_color;
        indicStyle.body.opa = LV_OPA_80;
    
        lv_obj_t * picker = lv_cpicker_create(scr, NULL);
        lv_cpicker_set_style(picker, LV_CPICKER_STYLE_MAIN, &style);
        lv_cpicker_set_style(picker, LV_CPICKER_STYLE_IND, &indicStyle);
        lv_obj_set_size(picker, pickerSize, pickerSize);
        lv_obj_align(picker, NULL, LV_ALIGN_CENTER, 0, 0);
        lv_scr_load(scr);
    
        lv_anim_t a;
        a.var = picker;
        a.start = 0;
        a.end = 359;
        a.fp = (lv_anim_fp_t)lv_cpicker_set_hue;
        a.path = lv_anim_path_linear;
        a.end_cb = NULL;
        a.act_time = 0;
        a.time = 5000;
        a.playback = 0;
        a.playback_pause = 0;
        a.repeat = 1;
        a.repeat_pause = 1000;
        lv_anim_create(&a);
    

    This is a work in progress. Any comment is welcome. I've not yet added the signal handling.

    enhancement new object type pinned 
    opened by AloyseTech 143
  • fix(Kconfig): Fix wrong type of LV_FS_STDIO_CACHE_SIZE (v8.3)

    fix(Kconfig): Fix wrong type of LV_FS_STDIO_CACHE_SIZE (v8.3)

    Description of the feature or fix

    The type of LV_FS_STDIO_CACHE_SIZE should also be int according to LV_FS_POSIX_CACHE_SIZE/LV_FS_WIN32_CACHE_SIZE/LV_FS_FATFS_CACHE_SIZE.

    Checkpoints

    Be sure the following conventions are followed:

    • [ ] Follow the Styling guide
    • [ ] Prefer enums instead of macros. If inevitable to use defines export them with LV_EXPORT_CONST_INT(defined_value) right after the define.
    • [ ] In function arguments prefer type name[] declaration for array parameters instead of type * name
    • [ ] Use typed pointers instead of void * pointers
    • [ ] Do not malloc into a static or global variables. Instead declare the variable in LV_ITERATE_ROOTS list in lv_gc.h and mark the variable with GC_ROOT(variable) when it's used. See a detaild description here.
    • [ ] Widget constructor must follow the lv_<widget_name>_create(lv_obj_t * parent) pattern.
    • [ ] Widget members function must start with lv_<modul_name> and should receive lv_obj_t * as first argument which is a pointer to widget object itself.
    • [ ] structs should be used via an API and not modified directly via their elements.
    • [ ] struct APIs should follow the widgets' conventions. That is to receive a pointer to the struct as the first argument, and the prefix of the struct name should be used as the prefix of the function name too (e.g. lv_disp_set_default(lv_disp_t * disp))
    • [ ] Functions and structs which are not part of the public API must begin with underscore in order to mark them as "private".
    • [ ] Arguments must be named in H files too.
    • [ ] To register and use callbacks one of the followings needs to be followed (see a detaild description here):
      • For both the registration function and the callback pass a pointer to a struct as the first argument. The struct must contain void * user_data field.
      • The last argument of the registration function must be void * user_data and the same user_data needs to be passed as the last argument of the callback.
      • Callback types not following these conventions should end with xcb_t.
    opened by Mr9You 0
  • LV_IMG_SIZE_MODE_REAL excessive invalidation

    LV_IMG_SIZE_MODE_REAL excessive invalidation

    Perform all steps below and tick them with [x]

    • [x] Read the FAQ
    • [x] Check the related part of the Documentation
    • [x] Update lvgl to the latest version
    • [ ] Reproduce the issue in a Simulator

    Describe the bug

    When a zoomed image widget using LV_IMG_SIZE_MODE_REAL is invalidated, it refreshes too great an area, as it unnecessarily transforms the object size.

    To Reproduce

        #define LV_USE_REFR_DEBUG 1
        
        imageObj = lv_img_create(lv_scr_act());
        imageDesc.data = (const uint8_t *)lvgl_image;
        imageDesc.data_size = sizeof lvgl_image;
        imageDesc.header.always_zero = 0;
        imageDesc.header.reserved = 0;
        imageDesc.header.cf = LV_IMG_CF_TRUE_COLOR;
        imageDesc.header.w = 224;
        imageDesc.header.h = 224;
        lv_obj_align(imageObj, LV_ALIGN_TOP_MID, 0, 16);
        lv_img_set_size_mode(imageObj, LV_IMG_SIZE_MODE_REAL);
        lv_img_set_zoom(imageObj, 2*256);
        lv_img_set_antialias(imageObj, false);
        lv_img_set_src(imageObj, &imageDesc); // object auto-sizes to 452x452, incorporating 2-pixel margin from size transformation
        ...
        while(1) {
            lv_obj_invalidate(imageObj);
            lv_timer_handler();
        }
    

    Expected behavior

    With the above 2x zoomed image, a far greater area of screen can be seen to being refreshed. Only the image should be refreshed.

    The issue appears to be solved by adding an extra test for img->obj_size_mode == LV_IMG_SIZE_MODE_VIRTUAL to the following code:

    https://github.com/lvgl/lvgl/blob/26767e7f64ba1fc7d705ef859ce8a063ff184d3a/src/widgets/img/lv_img.c#L467-L476

    (Without this change, s ends up as 343, so invalidating that much extra around the image - not quite sure how it gets that big, even with the transformation).

    But I'm wondering if any similar changes need to be made elsewhere in the file.

    Screenshots or video

    None at present.

    opened by kjbracey 0
  • stm32 dma2d rework (8.3)

    stm32 dma2d rework (8.3)

    This PR is a major rework of the current LVGL STM32 DMA2D support. It adds more hardware acceleration, especially for bitmap-blended solid colors used (e.g.) to draw anti-aliased fonts. In 32-bit color mode all four types of rectangles are painted with dma2d. In 16-bit color three types are dma2d painted, including the type which is the most performance critical. The feature has been fairly tested using LVGL demos with both 32 and 16 bit colors, but it should still be considered experimental. See https://github.com/lvgl/lvgl/issues/3714 for full discussion, especially this post.

    opened by tdjastrzebski 0
  • Test spinner

    Test spinner

    test spinner widget with screenshots

    #2337

    Checkpoints

    Be sure the following conventions are followed:

    • [x] Follow the Styling guide
    • [x] Prefer enums instead of macros. If inevitable to use defines export them with LV_EXPORT_CONST_INT(defined_value) right after the define.
    • [x] In function arguments prefer type name[] declaration for array parameters instead of type * name
    • [x] Use typed pointers instead of void * pointers
    • [x] Do not malloc into a static or global variables. Instead declare the variable in LV_ITERATE_ROOTS list in lv_gc.h and mark the variable with GC_ROOT(variable) when it's used. See a detaild description here.
    • [x] Widget constructor must follow the lv_<widget_name>_create(lv_obj_t * parent) pattern.
    • [x] Widget members function must start with lv_<modul_name> and should receive lv_obj_t * as first argument which is a pointer to widget object itself.
    • [x] structs should be used via an API and not modified directly via their elements.
    • [x] struct APIs should follow the widgets' conventions. That is to receive a pointer to the struct as the first argument, and the prefix of the struct name should be used as the prefix of the function name too (e.g. lv_disp_set_default(lv_disp_t * disp))
    • [x] Functions and structs which are not part of the public API must begin with underscore in order to mark them as "private".
    • [x] Arguments must be named in H files too.
    • [x] To register and use callbacks one of the followings needs to be followed (see a detaild description here):
      • For both the registration function and the callback pass a pointer to a struct as the first argument. The struct must contain void * user_data field.
      • The last argument of the registration function must be void * user_data and the same user_data needs to be passed as the last argument of the callback.
      • Callback types not following these conventions should end with xcb_t.
    opened by some00 0
  • using about lv_obj_set_ext_click_area

    using about lv_obj_set_ext_click_area

    Introduce the problem

    In V7, void lv_obj_set_ext_click_area(lv_obj_t * obj, lv_coord_t left, lv_coord_t right, lv_coord_t top, lv_coord_t bottom). We can set different value for left, right, top and bottom, which is very flexible. However, in V8, void lv_obj_set_ext_click_area(lv_obj_t * obj, lv_coord_t size). The value of left, right, top and bottom must be same.

    Examples and cases

    Suggested solution

    I think it is useful and flexible that the value of left, right, top and bottom can be different.

    opened by yin2021 0
  • fix(Kconfig): Fix wrong type of LV_FS_STDIO_CACHE_SIZE

    fix(Kconfig): Fix wrong type of LV_FS_STDIO_CACHE_SIZE

    Description of the feature or fix

    The type of LV_FS_STDIO_CACHE_SIZE should also be int according to LV_FS_POSIX_CACHE_SIZE/LV_FS_WIN32_CACHE_SIZE/LV_FS_FATFS_CACHE_SIZE.

    Checkpoints

    Be sure the following conventions are followed:

    • [ ] Follow the Styling guide
    • [ ] Prefer enums instead of macros. If inevitable to use defines export them with LV_EXPORT_CONST_INT(defined_value) right after the define.
    • [ ] In function arguments prefer type name[] declaration for array parameters instead of type * name
    • [ ] Use typed pointers instead of void * pointers
    • [ ] Do not malloc into a static or global variables. Instead declare the variable in LV_ITERATE_ROOTS list in lv_gc.h and mark the variable with GC_ROOT(variable) when it's used. See a detaild description here.
    • [ ] Widget constructor must follow the lv_<widget_name>_create(lv_obj_t * parent) pattern.
    • [ ] Widget members function must start with lv_<modul_name> and should receive lv_obj_t * as first argument which is a pointer to widget object itself.
    • [ ] structs should be used via an API and not modified directly via their elements.
    • [ ] struct APIs should follow the widgets' conventions. That is to receive a pointer to the struct as the first argument, and the prefix of the struct name should be used as the prefix of the function name too (e.g. lv_disp_set_default(lv_disp_t * disp))
    • [ ] Functions and structs which are not part of the public API must begin with underscore in order to mark them as "private".
    • [ ] Arguments must be named in H files too.
    • [ ] To register and use callbacks one of the followings needs to be followed (see a detaild description here):
      • For both the registration function and the callback pass a pointer to a struct as the first argument. The struct must contain void * user_data field.
      • The last argument of the registration function must be void * user_data and the same user_data needs to be passed as the last argument of the callback.
      • Callback types not following these conventions should end with xcb_t.
    opened by Mr9You 0
Releases(v8.3.4)
  • v8.3.4(Dec 15, 2022)

  • v8.3.3(Oct 6, 2022)

  • v8.3.2(Sep 27, 2022)

  • v8.3.1(Jul 25, 2022)

  • v8.3.0(Jul 6, 2022)

  • v8.2.0(Jan 31, 2022)

  • v8.1.0(Nov 10, 2021)

  • v8.0.3-dev(Jul 16, 2021)

  • v8.0.2(Jul 16, 2021)

  • v8.0.1(Jun 14, 2021)

  • v8.0.0(Jun 1, 2021)

  • v7.11.0(Mar 16, 2021)

  • v7.10.1(Feb 16, 2021)

  • v7.10.0(Feb 2, 2021)

  • v7.9.1(Jan 19, 2021)

  • v7.9.0(Jan 5, 2021)

  • v7.8.1(Dec 15, 2020)

  • v7.8.0(Dec 1, 2020)

  • v7.7.2(Nov 17, 2020)

  • v7.7.1(Nov 3, 2020)

  • v7.7.0(Nov 2, 2020)

    New features

    • Add PXP GPU support (for NXP MCUs)
    • Add VG-Lite GPU support (for NXP MCUs)
    • Allow max. 16 cell types for table
    • Add lv_table_set_text_fmt()
    • Use margin on calendar header to set distances and padding to the size of the header
    • Add text_sel_bg style proeprty

    Bugfixes

    • Theme update to support text selection background
    • Fix imgbtn state change
    • Support RTL in a table (draw columns right to left)
    • Support RTL in pretty layout (draw columns right to left)
    • Skip objects in groups if they are in a disabled state
    • Fix dropdown selection with RTL base direction
    • Fix rectangle border drawing with a large width
    • Fix lv_win_clean()
    Source code(tar.gz)
    Source code(zip)
  • v7.6.1(Oct 6, 2020)

    • Fix BIDI support in dropdown list
    • Fix copying base dir in lv_obj_create
    • Handle sub pixel rendering in font loader
    • Fix transitions with style caching
    • Fix click focus
    • Fix imgbtn image switching with empty style
    • Material theme: do not set the text font to allow easy global font change
    Source code(tar.gz)
    Source code(zip)
    docs.zip(8.25 MB)
  • v7.6.0(Sep 22, 2020)

    New features

    • Check whether any style property has changed on a state change to decide if any redraw is required

    Bugfixes

    • Fix selection of options with non-ASCII letters in dropdown list
    • Fix font loader to support LV_FONT_FMT_TXT_LARGE
    Source code(tar.gz)
    Source code(zip)
  • v7.5.0(Sep 17, 2020)

    New fetures

    • Add clean_dcache_cb and lv_disp_clean_dcache to enable users to use their own cache management function
    • Add gpu_wait_cb to wait until the GPU is working. It allows to run CPU a wait only when the rendered data is needed.
    • Add 10px and 8px built in fonts

    Bugfixes

    • Fix unexpected DEFOCUS on lv_page when clicking to bg after the scrollable
    • Fix lv_obj_del and lv_obj_clean if the children list changed during deletion.
    • Adjust button matrix button width to include padding when spanning multiple units.
    • Add rounding to btnmatrix line height calculation
    • Add decmopr_buf to GC roots
    • Fix division by zero in draw_pattern (lv_draw_rect.c) if the image or letter is not found
    • Fix drawing images with 1 px height or width
    • Fix selection of options with non-ASCII letters in dropdown list
    Source code(tar.gz)
    Source code(zip)
  • v7.4.0(Sep 1, 2020)

    The main new features of v7.4.0 are run-time font loading, style caching and arc knob with value setting by click.

    New features

    • Add lv_font_load() function - Loads a lv_font_t object from a binary font file
    • Add lv_font_free() function - Frees the memory allocated by the lv_font_load() function
    • Add style caching to reduce acces time of properties with default value
    • arc: add set value by click feature
    • arc: add LV_ARC_PART_KNOB similarly to slider
    • send gestures even is the the obejct was dragged. User can check dragging with lv_indev_is_dragging(lv_indev_act()) in the event function.

    Bugfixes

    • Fix color bleeding on border drawing
    • Fix using 'LV_SCROLLBAR_UNHIDE' after 'LV_SCROLLBAR_ON'
    • Fix croping of last column/row if an image is zoomed
    • Fix zooming and rotating mosaic images
    • Fix deleting tabview with LEFT/RIGHT tab position
    • Fix btnmatrix to not send event when CLICK_TRIG = true and the cursor slid from a pressed button
    • Fix roller width if selected text is larger than the normal
    Source code(tar.gz)
    Source code(zip)
  • v7.3.1(Aug 18, 2020)

    Bugfixes

    • Fix drawing value string twice
    • Rename lv_chart_clear_serie to lv_chart_clear_series and lv_obj_align_origo to lv_obj_align_mid
    • Add linemeter's mirror feature again
    • Fix text decor (underline strikethrough) with older versions of font converter
    • Fix setting local style property multiple times
    • Add missing background drawing and radius handling to image button
    • Allow adding extra label to list buttons
    • Fix crash if lv_table_set_col_cnt is called before lv_table_set_row_cnt for the first time
    • Fix overflow in large image transformations
    • Limit extra button click area of button matrix's buttons. With large paddings it was counter intuitive. (Gaps are mapped to button when clicked).
    • Fix color picker invalidation in rectangle mode
    • Init disabled days to gray color in calendar
    Source code(tar.gz)
    Source code(zip)
  • v7.3.0(Aug 9, 2020)

    The most interesting yet very simple feature of v7.3.0 are lv_event_send_refresh(obj) and lv_event_send_refresh_recursive(obj). They send an LV_EVENT_REFRESH event to an object or to all its descendants too. lv_event_send_refresh_recursive(NULL) will notify all the existing objects.

    In the refresh event of an object the developer can see the current value of some variables and update the object accordingly. E.g. update the label's text to a measured value, or to the newly selected language, or set the state of a checkbox according to a boolean variable.

    The gist is you don't have to check whether the object exists or not before updating it. Just notify all objects or all children of an object and if an object is there, and its refresh event is implemented it will do its job. Read more here.

    New features

    • Add lv_event_send_refresh, lv_event_send_refresh_recursive to easily send LV_EVENT_REFRESH to object
    • Add LV_MEMCPY_MEMSET_STD to use standard memcpy and memset
    • Add lv_tabview_set_tab_name() function - used to change a tab's name
    • Add LV_THEME_MATERIAL_FLAG_NO_TRANSITION and LV_THEME_MATERIAL_FLAG_NO_FOCUS flags
    • Reduce code size by adding: LV_USE_FONT_COMPRESSED, LV_FONT_USE_SUBPX, LV_USE_OUTLINE, LV_USE_PATTERN, LV_USE_VALUE_STR and applying some optimization
    • Add lv_task_get_next

    Bugfixes

    • Do not print warning for missing glyph if its height OR width is zero.
    • Prevent duplicated sending of LV_EVENT_INSERT from text area
    • Tidy outer edges of cpicker widget.
    • Remove duplicated lines from lv_tabview_add_tab
    • btnmatrix: hadle combined states of buttons (e.g. chacked + disabled)
    • textarea: fix typo in lv_textarea_set_sscrollbar_mode
    • gauge: fix image needle drawing
    • fix using freed memory in _lv_style_list_remove_style

    Arudino library

    The core lvgl repository and lv_examples are now directly available as Arduino libraries:

    • https://www.arduinolibraries.info/libraries/lvgl
    • https://www.arduinolibraries.info/libraries/lv_examples

    See the README for more info.

    New repositories

    lv_lib_lodepng is renamed to lv_lib_png for consitency

    Source code(tar.gz)
    Source code(zip)
  • v7.2.0(Jul 26, 2020)

    New features

    • Add screen transitions with lv_scr_load_anim()
    • Add display background color, wallpaper and opacity. Shown when the screen is transparent. Can be used with lv_disp_set_bg_opa/color/image().
    • Add LV_CALENDAR_WEEK_STARTS_MONDAY
    • Add lv_chart_set_x_start_point() function - Set the index of the x-axis start point in the data array
    • Add lv_chart_set_ext_array() function - Set an external array of data points to use for the chart
    • Add lv_chart_set_point_id() function - Set an individual point value in the chart series directly based on index
    • Add lv_chart_get_x_start_point() function - Get the current index of the x-axis start point in the data array
    • Add lv_chart_get_point_id() function - Get an individual point value in the chart series directly based on index
    • Add ext_buf_assigned bit field to lv_chart_series_t structure - it's true if external buffer is assigned to series
    • Add lv_chart_set_series_axis() to assign series to primary or secondary axis
    • Add lv_chart_set_y_range() to allow setting range of secondary y axis (based on lv_chart_set_range but extended with an axis parameter)
    • Allow setting different font for the selected text in lv_roller
    • Add theme->apply_cb to replace theme->apply_xcb to make it compatible with the MicroPython binding
    • Add lv_theme_set_base() to allow easy extension of built-in (or any) themes
    • Add lv_obj_align_x() and lv_obj_align_y() functions
    • Add lv_obj_align_origo_x() and lv_obj_align_origo_y() functions

    Bugfixes

    • tileview fix navigation when not screen sized
    • Use 14px font by default to for better compatibility with smaller displays
    • linemeter fix conversation of current value to "level"
    • Fix drawing on right border
    • Set the cursor image non clickable by default
    • Improve mono theme when used with keyboard or encoder
    Source code(tar.gz)
    Source code(zip)
  • v7.1.0(Jul 7, 2020)

    New features

    • Add LV_BIG_ENDIAN_SYSTEM flag to lv_conf.h in order to fix displaying images on big endian systems.
    • Add focus_parent attribute to lv_obj
    • Allow using buttons in encoder input device
    • Add lv_btnmatrix_set/get_align capability
    • DMA2D: Remove dependency on ST CubeMX HAL
    • Added max_used propriety to lv_mem_monitor_t struct
    • In lv_init test if the the strings are UTF-8 encoded.
    • Add user_data to themes
    • Add inline function lv_checkbox_get_state(const lv_obj_t * cb) to extend the checkbox functionality.
    • Add inline function lv_checkbox_set_state(const lv_obj_t * cb, lv_btn_state_t state ) to extend the checkbox functionality.

    Bugfixes

    • lv_img fix invalidation area when angle or zoom changes
    • Update the style handling to support Big endian MCUs
    • Change some methods to support big endian hardware.
    • remove use of c++ keyword 'new' in parameter of function lv_theme_set_base().
    • Add LV_BIG_ENDIAN_SYSTEM flag to lv_conf.h in order to fix displaying images on big endian systems.
    • Fix inserting chars in text area in big endian hardware.
    Source code(tar.gz)
    Source code(zip)
  • v7.0.2(Jun 29, 2020)

    Bugfixes

    • lv_textarea fix wrong cursor position when clicked after the last character
    • Change all text related indices from 16-bit to 32-bit integers throughout the whole library. #1545
    • Fix gestures
    • Do not call set_px_cb for transparent pixel
    • Fix list button focus in material theme
    • Fix crash when the text area is cleared with the backspace of a keyboard
    • Add version number to lv_conf_template.h
    • Add log in true double buffering mode with set_px_cb
    • lv_dropdown: fix missing LV_EVENT_VALUE_CHANGED event when used with encoder
    • lv_tileview: fix if not the {0;0} tile is created first
    • lv_debug: restructure to allow asserting in from lv_misc too
    • add assert if _lv_mem_buf_get() fails
    • lv_textarea: fix character delete in password mode
    • Update LV_OPA_MIN and LV_OPA_MAX to widen the opacity processed range
    • lv_btnm fix sending events for hidden buttons
    • lv_gaguge make lv_gauge_set_angle_offset offset the labels and needles too
    • Fix typo in the API scrllable -> scrollable
    • tabview by default allow auto expanding the page only to right and bottom (#1573)
    • fix crash when drawing gradient to the same color
    • chart: fix memory leak
    Source code(tar.gz)
    Source code(zip)
Owner
LVGL
Light and Versatile Embedded Graphics Library
LVGL
FLTK - Fast Light Tool Kit - a cross-platform C++ GUI toolkit for UNIX(r)/Linux(r) (X11)

FLTK - Fast Light Tool Kit - a cross-platform C++ GUI toolkit for UNIX(r)/Linux(r) (X11)

The FLTK Team 1.1k Dec 25, 2022
Notcurses: blingful TUIs and character graphics

blingful character graphics/TUI library. definitely not curses.

nick black 2.5k Jan 9, 2023
Simple and portable (but not inflexible) GUI library in C that uses the native GUI technologies of each platform it supports.

libui: a portable GUI library for C This README is being written. Status It has come to my attention that I have not been particularly clear about how

Pietro Gagliardi 10.4k Jan 2, 2023
Minimalistic C++/Python GUI library for OpenGL, GLES2/3, Metal, and WebAssembly/WebGL

NanoGUI NanoGUI is a minimalistic cross-platform widget library for OpenGL 3+, GLES 2/3, and Metal. It supports automatic layout generation, stateful

Mitsuba Physically Based Renderer 1.2k Dec 28, 2022
A barebones single-header GUI library for Win32 and X11.

luigi A barebones single-header GUI library for Win32 and X11. Building example Windows Update luigi_example.c to #define UI_WINDOWS at the top of the

Nakst 235 Dec 30, 2022
raygui is a simple and easy-to-use immediate-mode-gui library.

raygui is a simple and easy-to-use immediate-mode-gui library.

Ray 2k Dec 30, 2022
A library to create Windows, macOS, and Linux applications.

LAF: The Lost Application Framework A library to create Windows, macOS, and Linux applications. This library is under active development so we don't p

Aseprite 206 Jan 3, 2023
Tiny cross-platform webview library for C/C++/Golang. Uses WebKit (Gtk/Cocoa) and Edge (Windows)

A tiny cross-platform webview library for C/C++/Golang to build modern cross-platform GUIs. Also, there are Rust bindings, Python bindings, Nim bindings, Haskell, C# bindings and Java bindings available.

webview 10.8k Jan 9, 2023
HastyBadger is a branch of the excellent widget and GUI library Turbo Badger.

Branch Notice - HastyBadger Hasty is not Turbo. HastyBadger is a branch of the excellent widget and GUI library Turbo Badger. Notabe additions are c++

Michael Tesch 38 Nov 17, 2022
FlatUI is a immediate mode C++ GUI library for games and graphical applications.

FlatUI is a immediate mode C++ GUI library for games and graphical applications. Go to our landing page to browse our documentation.

Google 610 Dec 23, 2022
A small C library for building user interfaces with C, XML and CSS

LCUI A small C library for building user interfaces with C, XML and CSS. Table of contents Table of contents Introduction Features Screenshots Related

Liu 3.9k Dec 27, 2022
Elements C++ GUI library

Elements C++ GUI library Introduction Elements is a lightweight, fine-grained, resolution independent, modular GUI library. Elements is designed with

Cycfi Research 2.5k Dec 30, 2022
A single-header ANSI C immediate mode cross-platform GUI library

Nuklear This is a minimal-state, immediate-mode graphical user interface toolkit written in ANSI C and licensed under public domain. It was designed a

Immediate Mode UIs, Nuklear, etc. 6.7k Dec 24, 2022
RmlUi - The HTML/CSS User Interface library evolved

RmlUi - The HTML/CSS User Interface Library Evolved RmlUi - now with added boosters taking control of the rocket, targeting your games and application

Michael R. P. Ragazzon 1.6k Jan 7, 2023
A library for creating native cross-platform GUI apps

Yue A library for creating native cross-platform GUI apps. Getting started Documentations FAQ Development Examples Sample apps (with screenshots) Muba

Yue 2.8k Jan 7, 2023
Cross-platform malware development library for anti-analysis techniques

The Anti-Analysis Menagerie Cross-platform malware development library for anti-analysis techniques. Design Goals Provide a rich and convenient interf

Alan 21 Sep 16, 2022
QtLottie is a tiny C++ library that can render Adobe® After Effects™ animations exported as JSON with Bodymovin.

QtLottie QtLottie is a tiny C++ library that can render Adobe® After Effects™ animations exported as JSON with Bodymovin. Features Support many After

Yuhang Zhao 28 Dec 7, 2022
Library for writing text-based user interfaces

Termbox for RT-Thread 中文说明文档 This repository forks from nullgemm/termbox_next Getting started Termbox's interface only consists of 12 functions: tb_in

Meco Jianting Man 5 May 25, 2022
✔️The smallest header-only GUI library(4 KLOC) for all platforms

Welcome to GUI-lite The smallest header-only GUI library (4 KLOC) for all platforms. 中文 Lightweight ✂️ Small: 4,000+ lines of C++ code, zero dependenc

null 6.6k Jan 8, 2023