https://github.com/embeddedt/lv_style_compat
Compatibility module for using LittlevGL 6.x styles in 7.0
https://github.com/embeddedt/lv_style_compat
graphics littlevgl lvgl
Last synced: 4 months ago
JSON representation
Compatibility module for using LittlevGL 6.x styles in 7.0
- Host: GitHub
- URL: https://github.com/embeddedt/lv_style_compat
- Owner: embeddedt
- License: mit
- Created: 2020-04-30T17:53:07.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2020-10-26T18:18:31.000Z (almost 5 years ago)
- Last Synced: 2025-02-17T01:41:21.085Z (8 months ago)
- Topics: graphics, littlevgl, lvgl
- Language: C
- Size: 9.77 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# lv_style_compat
`lv_style_compat` is a simple external module for LittlevGL 7, designed to help users of 6.x migrate to the new style system.
Note that:
* There may be certain style combinations which don't work like they did in 6.x.
* Using `lv_style_compat` will hinder your ability to make use of the new style optimizations that LittlevGL 7 has. What this means in practical terms is that using a "legacy" style with this module will likely consume more memory than rewriting the code in question to use v7 styles.## Example
```c
lv_obj_t * btn = lv_btn_create(lv_scr_act(), NULL);static lv_style_t style;
lv_style_init(&style);static lv_legacy_style_t v6_style;
lv_legacy_style_init();
lv_legacy_style_convert(&style, LV_STATE_DEFAULT, &v6_style);
lv_legacy_style_convert(&style, LV_STATE_DEFAULT, &lv_style_btn_rel);
lv_legacy_style_convert(&style, LV_STATE_PRESSED, &lv_style_btn_pr);
lv_legacy_style_convert(&style, LV_STATE_CHECKED, &lv_style_btn_tgl_rel);
lv_legacy_style_convert(&style, LV_STATE_CHECKED | LV_STATE_PRESSED, &lv_style_btn_tgl_pr);lv_obj_add_style(btn, LV_BTN_PART_MAIN, &style);
lv_btn_set_checkable(btn, true);lv_obj_t * label = lv_label_create(btn, NULL);
lv_label_set_text(label, "Button");lv_obj_align(btn, NULL, LV_ALIGN_CENTER, 0, 0);
```## API description
Because LittlevGL 7 has reused the type name `lv_style_t` for the new style system, the classic styles now use the type name
`lv_legacy_style_t`.The APIs have also been updated to match. For example, `lv_legacy_style_copy` can be used to copy one legacy style to another.
`lv_legacy_style_convert` can be used to convert a legacy style into a new one.
## Bug reporting
Please open an issue on this repository if a legacy style doesn't convert the way you expected.