ESP32 LVGL library from v9.1.0 to v9.2.0 (#22031)

This commit is contained in:
s-hadinger 2024-08-27 23:36:38 +02:00 committed by GitHub
parent a44443f184
commit e8cdeaba6b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
711 changed files with 90476 additions and 14405 deletions

View File

@ -11,6 +11,7 @@ All notable changes to this project will be documented in this file.
### Changed
- ESP32 platform update from 2024.08.10 to 2024.08.11 (#22021)
- ESP32 LVGL library from v9.1.0 to v9.2.0
### Fixed
- Matter fixed UI bug when no endpoints configured (#22008)

View File

@ -3,11 +3,14 @@
*
*/
#include <stdlib.h>
/*********************
* INCLUDES
*********************/
#include "../lvgl.h" /*To see all the widgets*/
#include "themes/lv_theme_private.h"
#include "lv_theme_haspmota.h"
// #include "misc/lv_gc.h" TODO
@ -633,7 +636,7 @@ lv_theme_t * lv_theme_haspmota_init(lv_display_t * disp, lv_color_t color_primar
*In a general case styles could be in simple `static lv_style_t my_style...` variables*/
if(!inited) {
// LV_GC_ROOT(_lv_theme_default_styles) = lv_mem_alloc(sizeof(my_theme_styles_t));
styles = (my_theme_styles_t *)malloc(sizeof(my_theme_styles_t)); // TODO LVGL
styles = (my_theme_styles_t *) malloc(sizeof(my_theme_styles_t)); // TODO LVGL
}
if(LV_HOR_RES <= 320) disp_size = DISP_SMALL;

View File

@ -17,6 +17,7 @@ anim_get_timer||lv.timer|[lv_anim_get_timer](https://docs.lvgl.io/9.0/search.htm
anim_refr_now|||[lv_anim_refr_now](https://docs.lvgl.io/9.0/search.html?q=lv_anim_refr_now)
anim_speed|int|int|[lv_anim_speed](https://docs.lvgl.io/9.0/search.html?q=lv_anim_speed)
anim_speed_clamped|int, int, int|int|[lv_anim_speed_clamped](https://docs.lvgl.io/9.0/search.html?q=lv_anim_speed_clamped)
anim_speed_to_time|int, int, int|int|[lv_anim_speed_to_time](https://docs.lvgl.io/9.0/search.html?q=lv_anim_speed_to_time)
area_align|lv.area, lv.area, int, int, int||[lv_area_align](https://docs.lvgl.io/9.0/search.html?q=lv_area_align)
area_copy|lv.area, lv.area||[lv_area_copy](https://docs.lvgl.io/9.0/search.html?q=lv_area_copy)
area_get_height|lv.area|int|[lv_area_get_height](https://docs.lvgl.io/9.0/search.html?q=lv_area_get_height)
@ -31,6 +32,7 @@ canvas_buf_size|int, int, int, int|int|[lv_canvas_buf_size](https://docs.lvgl.io
clamp_height|int, int, int, int|int|[lv_clamp_height](https://docs.lvgl.io/9.0/search.html?q=lv_clamp_height)
clamp_width|int, int, int, int|int|[lv_clamp_width](https://docs.lvgl.io/9.0/search.html?q=lv_clamp_width)
color32_eq|int, int|bool|[lv_color32_eq](https://docs.lvgl.io/9.0/search.html?q=lv_color32_eq)
color32_luminance|int|int|[lv_color32_luminance](https://docs.lvgl.io/9.0/search.html?q=lv_color32_luminance)
color32_make|int, int, int, int|int|[lv_color32_make](https://docs.lvgl.io/9.0/search.html?q=lv_color32_make)
color_16_16_mix|int, int, int|int|[lv_color_16_16_mix](https://docs.lvgl.io/9.0/search.html?q=lv_color_16_16_mix)
color_black||lv.color|[lv_color_black](https://docs.lvgl.io/9.0/search.html?q=lv_color_black)
@ -44,6 +46,7 @@ color_hex|int|lv.color|[lv_color_hex](https://docs.lvgl.io/9.0/search.html?q=lv_
color_hex3|int|lv.color|[lv_color_hex3](https://docs.lvgl.io/9.0/search.html?q=lv_color_hex3)
color_hsv_to_rgb|int, int, int|lv.color|[lv_color_hsv_to_rgb](https://docs.lvgl.io/9.0/search.html?q=lv_color_hsv_to_rgb)
color_lighten|lv.color, int|lv.color|[lv_color_lighten](https://docs.lvgl.io/9.0/search.html?q=lv_color_lighten)
color_luminance|lv.color|int|[lv_color_luminance](https://docs.lvgl.io/9.0/search.html?q=lv_color_luminance)
color_make|int, int, int|lv.color|[lv_color_make](https://docs.lvgl.io/9.0/search.html?q=lv_color_make)
color_mix|lv.color, lv.color, int|lv.color|[lv_color_mix](https://docs.lvgl.io/9.0/search.html?q=lv_color_mix)
color_mix32|int, int|int|[lv_color_mix32](https://docs.lvgl.io/9.0/search.html?q=lv_color_mix32)
@ -67,6 +70,7 @@ draw_dispatch|||[lv_draw_dispatch](https://docs.lvgl.io/9.0/search.html?q=lv_dra
draw_dispatch_layer|lv.display, lv.layer|bool|[lv_draw_dispatch_layer](https://docs.lvgl.io/9.0/search.html?q=lv_draw_dispatch_layer)
draw_dispatch_request|||[lv_draw_dispatch_request](https://docs.lvgl.io/9.0/search.html?q=lv_draw_dispatch_request)
draw_dispatch_wait_for_request|||[lv_draw_dispatch_wait_for_request](https://docs.lvgl.io/9.0/search.html?q=lv_draw_dispatch_wait_for_request)
draw_get_unit_count||int|[lv_draw_get_unit_count](https://docs.lvgl.io/9.0/search.html?q=lv_draw_get_unit_count)
draw_init|||[lv_draw_init](https://docs.lvgl.io/9.0/search.html?q=lv_draw_init)
draw_label|lv.layer, lv.draw_label_dsc, lv.area||[lv_draw_label](https://docs.lvgl.io/9.0/search.html?q=lv_draw_label)
draw_label_dsc_init|lv.draw_label_dsc||[lv_draw_label_dsc_init](https://docs.lvgl.io/9.0/search.html?q=lv_draw_label_dsc_init)
@ -77,6 +81,7 @@ draw_line|lv.layer, lv.draw_line_dsc||[lv_draw_line](https://docs.lvgl.io/9.0/se
draw_line_dsc_init|lv.draw_line_dsc||[lv_draw_line_dsc_init](https://docs.lvgl.io/9.0/search.html?q=lv_draw_line_dsc_init)
draw_rect|lv.layer, lv.draw_rect_dsc, lv.area||[lv_draw_rect](https://docs.lvgl.io/9.0/search.html?q=lv_draw_rect)
draw_rect_dsc_init|lv.draw_rect_dsc||[lv_draw_rect_dsc_init](https://docs.lvgl.io/9.0/search.html?q=lv_draw_rect_dsc_init)
draw_wait_for_finish|||[lv_draw_wait_for_finish](https://docs.lvgl.io/9.0/search.html?q=lv_draw_wait_for_finish)
event_dsc_get_cb|lv.event_dsc|lv.event_cb|[lv_event_dsc_get_cb](https://docs.lvgl.io/9.0/search.html?q=lv_event_dsc_get_cb)
event_dsc_get_user_data|lv.event_dsc|comptr|[lv_event_dsc_get_user_data](https://docs.lvgl.io/9.0/search.html?q=lv_event_dsc_get_user_data)
event_register_id||int|[lv_event_register_id](https://docs.lvgl.io/9.0/search.html?q=lv_event_register_id)
@ -104,6 +109,7 @@ obj_class_create_obj|lv.obj_class, lv.obj|lv.obj|[lv_obj_class_create_obj](https
obj_delete_anim_completed_cb|lv.anim||[lv_obj_delete_anim_completed_cb](https://docs.lvgl.io/9.0/search.html?q=lv_obj_delete_anim_completed_cb)
obj_enable_style_refresh|bool||[lv_obj_enable_style_refresh](https://docs.lvgl.io/9.0/search.html?q=lv_obj_enable_style_refresh)
obj_event_base|lv.obj_class, lv.event|int|[lv_obj_event_base](https://docs.lvgl.io/9.0/search.html?q=lv_obj_event_base)
obj_id_compare|\<any\>, \<any\>|int|[lv_obj_id_compare](https://docs.lvgl.io/9.0/search.html?q=lv_obj_id_compare)
obj_redraw|lv.layer, lv.obj||[lv_obj_redraw](https://docs.lvgl.io/9.0/search.html?q=lv_obj_redraw)
obj_report_style_change|lv.style||[lv_obj_report_style_change](https://docs.lvgl.io/9.0/search.html?q=lv_obj_report_style_change)
obj_style_get_selector_part|int|int|[lv_obj_style_get_selector_part](https://docs.lvgl.io/9.0/search.html?q=lv_obj_style_get_selector_part)
@ -131,8 +137,10 @@ screen_load_anim|lv.obj, int, int, int, bool||[lv_screen_load_anim](https://docs
span_stack_deinit|||[lv_span_stack_deinit](https://docs.lvgl.io/9.0/search.html?q=lv_span_stack_deinit)
span_stack_init|||[lv_span_stack_init](https://docs.lvgl.io/9.0/search.html?q=lv_span_stack_init)
style_get_num_custom_props||int|[lv_style_get_num_custom_props](https://docs.lvgl.io/9.0/search.html?q=lv_style_get_num_custom_props)
style_get_prop_group|int|int|[lv_style_get_prop_group](https://docs.lvgl.io/9.0/search.html?q=lv_style_get_prop_group)
style_prop_get_default|int|int|[lv_style_prop_get_default](https://docs.lvgl.io/9.0/search.html?q=lv_style_prop_get_default)
style_prop_has_flag|int, int|bool|[lv_style_prop_has_flag](https://docs.lvgl.io/9.0/search.html?q=lv_style_prop_has_flag)
style_prop_lookup_flags|int|int|[lv_style_prop_lookup_flags](https://docs.lvgl.io/9.0/search.html?q=lv_style_prop_lookup_flags)
style_register_prop|int|int|[lv_style_register_prop](https://docs.lvgl.io/9.0/search.html?q=lv_style_register_prop)
task_handler||int|[lv_task_handler](https://docs.lvgl.io/9.0/search.html?q=lv_task_handler)
text_get_size|comptr, string, lv.font, int, int, int, int||[lv_text_get_size](https://docs.lvgl.io/9.0/search.html?q=lv_text_get_size)
@ -253,6 +261,7 @@ is_invalidation_enabled||bool|[lv_display_is_invalidation_enabled](https://docs.
is_invalidation_enabled||bool|[lv_display_is_invalidation_enabled](https://docs.lvgl.io/9.0/search.html?q=lv_display_is_invalidation_enabled)
remove|||[lv_display_delete](https://docs.lvgl.io/9.0/search.html?q=lv_display_delete)
remove_event_cb_with_user_data|\<any\>, \<any\>|int|[lv_display_remove_event_cb_with_user_data](https://docs.lvgl.io/9.0/search.html?q=lv_display_remove_event_cb_with_user_data)
rotate_area|lv.area||[lv_display_rotate_area](https://docs.lvgl.io/9.0/search.html?q=lv_display_rotate_area)
send_event|int, \<any\>|int|[lv_display_send_event](https://docs.lvgl.io/9.0/search.html?q=lv_display_send_event)
send_event|int, \<any\>|int|[lv_display_send_event](https://docs.lvgl.io/9.0/search.html?q=lv_display_send_event)
set_angle|int||[lv_display_set_rotation](https://docs.lvgl.io/9.0/search.html?q=lv_display_set_rotation)
@ -315,6 +324,7 @@ get_edge_cb||callback|[lv_group_get_edge_cb](https://docs.lvgl.io/9.0/search.htm
get_editing||bool|[lv_group_get_editing](https://docs.lvgl.io/9.0/search.html?q=lv_group_get_editing)
get_focus_cb||lv.group_focus_cb|[lv_group_get_focus_cb](https://docs.lvgl.io/9.0/search.html?q=lv_group_get_focus_cb)
get_focused||lv.obj|[lv_group_get_focused](https://docs.lvgl.io/9.0/search.html?q=lv_group_get_focused)
get_obj_by_index|int|lv.obj|[lv_group_get_obj_by_index](https://docs.lvgl.io/9.0/search.html?q=lv_group_get_obj_by_index)
get_obj_count||int|[lv_group_get_obj_count](https://docs.lvgl.io/9.0/search.html?q=lv_group_get_obj_count)
get_wrap||bool|[lv_group_get_wrap](https://docs.lvgl.io/9.0/search.html?q=lv_group_get_wrap)
remove|||[lv_group_delete](https://docs.lvgl.io/9.0/search.html?q=lv_group_delete)
@ -349,6 +359,7 @@ get_mode||int|[lv_indev_get_mode](https://docs.lvgl.io/9.0/search.html?q=lv_inde
get_next||lv.indev|[lv_indev_get_next](https://docs.lvgl.io/9.0/search.html?q=lv_indev_get_next)
get_next||lv.indev|[lv_indev_get_next](https://docs.lvgl.io/9.0/search.html?q=lv_indev_get_next)
get_point|comptr||[lv_indev_get_point](https://docs.lvgl.io/9.0/search.html?q=lv_indev_get_point)
get_press_moved||bool|[lv_indev_get_press_moved](https://docs.lvgl.io/9.0/search.html?q=lv_indev_get_press_moved)
get_read_timer||lv.timer|[lv_indev_get_read_timer](https://docs.lvgl.io/9.0/search.html?q=lv_indev_get_read_timer)
get_scroll_dir||int|[lv_indev_get_scroll_dir](https://docs.lvgl.io/9.0/search.html?q=lv_indev_get_scroll_dir)
get_scroll_obj||lv.obj|[lv_indev_get_scroll_obj](https://docs.lvgl.io/9.0/search.html?q=lv_indev_get_scroll_obj)
@ -371,9 +382,13 @@ set_disp|lv.display||[lv_indev_set_display](https://docs.lvgl.io/9.0/search.html
set_display|lv.display||[lv_indev_set_display](https://docs.lvgl.io/9.0/search.html?q=lv_indev_set_display)
set_driver_data|\<any\>||[lv_indev_set_driver_data](https://docs.lvgl.io/9.0/search.html?q=lv_indev_set_driver_data)
set_group|lv.group||[lv_indev_set_group](https://docs.lvgl.io/9.0/search.html?q=lv_indev_set_group)
set_long_press_time|int||[lv_indev_set_long_press_time](https://docs.lvgl.io/9.0/search.html?q=lv_indev_set_long_press_time)
set_mode|int||[lv_indev_set_mode](https://docs.lvgl.io/9.0/search.html?q=lv_indev_set_mode)
set_scroll_limit|int||[lv_indev_set_scroll_limit](https://docs.lvgl.io/9.0/search.html?q=lv_indev_set_scroll_limit)
set_scroll_throw|int||[lv_indev_set_scroll_throw](https://docs.lvgl.io/9.0/search.html?q=lv_indev_set_scroll_throw)
set_type|int||[lv_indev_set_type](https://docs.lvgl.io/9.0/search.html?q=lv_indev_set_type)
set_user_data|\<any\>||[lv_indev_set_user_data](https://docs.lvgl.io/9.0/search.html?q=lv_indev_set_user_data)
stop_processing|||[lv_indev_stop_processing](https://docs.lvgl.io/9.0/search.html?q=lv_indev_stop_processing)
wait_release|||[lv_indev_wait_release](https://docs.lvgl.io/9.0/search.html?q=lv_indev_wait_release)
### class `lv.style`
@ -413,7 +428,7 @@ set_bg_img_tiled|bool||[lv_style_set_bg_image_tiled](https://docs.lvgl.io/9.0/se
set_bg_main_opa|int||[lv_style_set_bg_main_opa](https://docs.lvgl.io/9.0/search.html?q=lv_style_set_bg_main_opa)
set_bg_main_stop|int||[lv_style_set_bg_main_stop](https://docs.lvgl.io/9.0/search.html?q=lv_style_set_bg_main_stop)
set_bg_opa|int||[lv_style_set_bg_opa](https://docs.lvgl.io/9.0/search.html?q=lv_style_set_bg_opa)
set_bitmap_mask_src|lv.image_dsc||[lv_style_set_bitmap_mask_src](https://docs.lvgl.io/9.0/search.html?q=lv_style_set_bitmap_mask_src)
set_bitmap_mask_src|\<any\>||[lv_style_set_bitmap_mask_src](https://docs.lvgl.io/9.0/search.html?q=lv_style_set_bitmap_mask_src)
set_blend_mode|int||[lv_style_set_blend_mode](https://docs.lvgl.io/9.0/search.html?q=lv_style_set_blend_mode)
set_border_color|lv.color||[lv_style_set_border_color](https://docs.lvgl.io/9.0/search.html?q=lv_style_set_border_color)
set_border_opa|int||[lv_style_set_border_opa](https://docs.lvgl.io/9.0/search.html?q=lv_style_set_border_opa)
@ -568,6 +583,7 @@ fade_in|int, int||[lv_obj_fade_in](https://docs.lvgl.io/9.0/search.html?q=lv_obj
fade_out|int, int||[lv_obj_fade_out](https://docs.lvgl.io/9.0/search.html?q=lv_obj_fade_out)
free_id|||[lv_obj_free_id](https://docs.lvgl.io/9.0/search.html?q=lv_obj_free_id)
get_child|int|lv.obj|[lv_obj_get_child](https://docs.lvgl.io/9.0/search.html?q=lv_obj_get_child)
get_child_by_id|\<any\>|lv.obj|[lv_obj_get_child_by_id](https://docs.lvgl.io/9.0/search.html?q=lv_obj_get_child_by_id)
get_child_by_type|int, lv.obj_class|lv.obj|[lv_obj_get_child_by_type](https://docs.lvgl.io/9.0/search.html?q=lv_obj_get_child_by_type)
get_child_cnt||int|[lv_obj_get_child_count](https://docs.lvgl.io/9.0/search.html?q=lv_obj_get_child_count)
get_child_count||int|[lv_obj_get_child_count](https://docs.lvgl.io/9.0/search.html?q=lv_obj_get_child_count)
@ -584,6 +600,7 @@ get_event_count||int|[lv_obj_get_event_count](https://docs.lvgl.io/9.0/search.ht
get_event_dsc|int|lv.event_dsc|[lv_obj_get_event_dsc](https://docs.lvgl.io/9.0/search.html?q=lv_obj_get_event_dsc)
get_group||lv.group|[lv_obj_get_group](https://docs.lvgl.io/9.0/search.html?q=lv_obj_get_group)
get_height||int|[lv_obj_get_height](https://docs.lvgl.io/9.0/search.html?q=lv_obj_get_height)
get_id||comptr|[lv_obj_get_id](https://docs.lvgl.io/9.0/search.html?q=lv_obj_get_id)
get_index||int|[lv_obj_get_index](https://docs.lvgl.io/9.0/search.html?q=lv_obj_get_index)
get_index_by_type|lv.obj_class|int|[lv_obj_get_index_by_type](https://docs.lvgl.io/9.0/search.html?q=lv_obj_get_index_by_type)
get_parent||lv.obj|[lv_obj_get_parent](https://docs.lvgl.io/9.0/search.html?q=lv_obj_get_parent)
@ -633,7 +650,7 @@ get_style_bg_image_tiled|int|bool|[lv_obj_get_style_bg_image_tiled](https://docs
get_style_bg_main_opa|int|int|[lv_obj_get_style_bg_main_opa](https://docs.lvgl.io/9.0/search.html?q=lv_obj_get_style_bg_main_opa)
get_style_bg_main_stop|int|int|[lv_obj_get_style_bg_main_stop](https://docs.lvgl.io/9.0/search.html?q=lv_obj_get_style_bg_main_stop)
get_style_bg_opa|int|int|[lv_obj_get_style_bg_opa](https://docs.lvgl.io/9.0/search.html?q=lv_obj_get_style_bg_opa)
get_style_bitmap_mask_src|int|lv.image_dsc|[lv_obj_get_style_bitmap_mask_src](https://docs.lvgl.io/9.0/search.html?q=lv_obj_get_style_bitmap_mask_src)
get_style_bitmap_mask_src|int|comptr|[lv_obj_get_style_bitmap_mask_src](https://docs.lvgl.io/9.0/search.html?q=lv_obj_get_style_bitmap_mask_src)
get_style_blend_mode|int|int|[lv_obj_get_style_blend_mode](https://docs.lvgl.io/9.0/search.html?q=lv_obj_get_style_blend_mode)
get_style_border_color|int|lv.color|[lv_obj_get_style_border_color](https://docs.lvgl.io/9.0/search.html?q=lv_obj_get_style_border_color)
get_style_border_color_filtered|int|lv.color|[lv_obj_get_style_border_color_filtered](https://docs.lvgl.io/9.0/search.html?q=lv_obj_get_style_border_color_filtered)
@ -814,6 +831,7 @@ set_grid_align|int, int||[lv_obj_set_grid_align](https://docs.lvgl.io/9.0/search
set_grid_cell|int, int, int, int, int, int||[lv_obj_set_grid_cell](https://docs.lvgl.io/9.0/search.html?q=lv_obj_set_grid_cell)
set_grid_dsc_array|lv.int_arr, lv.int_arr||[lv_obj_set_grid_dsc_array](https://docs.lvgl.io/9.0/search.html?q=lv_obj_set_grid_dsc_array)
set_height|int||[lv_obj_set_height](https://docs.lvgl.io/9.0/search.html?q=lv_obj_set_height)
set_id|\<any\>||[lv_obj_set_id](https://docs.lvgl.io/9.0/search.html?q=lv_obj_set_id)
set_layout|int||[lv_obj_set_layout](https://docs.lvgl.io/9.0/search.html?q=lv_obj_set_layout)
set_local_style_prop|int, int, int||[lv_obj_set_local_style_prop](https://docs.lvgl.io/9.0/search.html?q=lv_obj_set_local_style_prop)
set_parent|lv.obj||[lv_obj_set_parent](https://docs.lvgl.io/9.0/search.html?q=lv_obj_set_parent)
@ -848,7 +866,7 @@ set_style_bg_image_tiled|bool, int||[lv_obj_set_style_bg_image_tiled](https://do
set_style_bg_main_opa|int, int||[lv_obj_set_style_bg_main_opa](https://docs.lvgl.io/9.0/search.html?q=lv_obj_set_style_bg_main_opa)
set_style_bg_main_stop|int, int||[lv_obj_set_style_bg_main_stop](https://docs.lvgl.io/9.0/search.html?q=lv_obj_set_style_bg_main_stop)
set_style_bg_opa|int, int||[lv_obj_set_style_bg_opa](https://docs.lvgl.io/9.0/search.html?q=lv_obj_set_style_bg_opa)
set_style_bitmap_mask_src|lv.image_dsc, int||[lv_obj_set_style_bitmap_mask_src](https://docs.lvgl.io/9.0/search.html?q=lv_obj_set_style_bitmap_mask_src)
set_style_bitmap_mask_src|\<any\>, int||[lv_obj_set_style_bitmap_mask_src](https://docs.lvgl.io/9.0/search.html?q=lv_obj_set_style_bitmap_mask_src)
set_style_blend_mode|int, int||[lv_obj_set_style_blend_mode](https://docs.lvgl.io/9.0/search.html?q=lv_obj_set_style_blend_mode)
set_style_border_color|lv.color, int||[lv_obj_set_style_border_color](https://docs.lvgl.io/9.0/search.html?q=lv_obj_set_style_border_color)
set_style_border_opa|int, int||[lv_obj_set_style_border_opa](https://docs.lvgl.io/9.0/search.html?q=lv_obj_set_style_border_opa)
@ -956,6 +974,7 @@ set_width|int||[lv_obj_set_width](https://docs.lvgl.io/9.0/search.html?q=lv_obj_
set_x|int||[lv_obj_set_x](https://docs.lvgl.io/9.0/search.html?q=lv_obj_set_x)
set_y|int||[lv_obj_set_y](https://docs.lvgl.io/9.0/search.html?q=lv_obj_set_y)
stringify_id|comptr, int|string|[lv_obj_stringify_id](https://docs.lvgl.io/9.0/search.html?q=lv_obj_stringify_id)
style_apply_color_filter|int, int|int|[lv_obj_style_apply_color_filter](https://docs.lvgl.io/9.0/search.html?q=lv_obj_style_apply_color_filter)
swap|lv.obj||[lv_obj_swap](https://docs.lvgl.io/9.0/search.html?q=lv_obj_swap)
transform_point|comptr, int||[lv_obj_transform_point](https://docs.lvgl.io/9.0/search.html?q=lv_obj_transform_point)
transform_point_array|lv.point_arr, int, int||[lv_obj_transform_point_array](https://docs.lvgl.io/9.0/search.html?q=lv_obj_transform_point_array)
@ -1004,10 +1023,12 @@ get_indic_area||lv.area|[lv_bar_get_indic_area](https://docs.lvgl.io/9.0/search.
get_max_value||int|[lv_bar_get_max_value](https://docs.lvgl.io/9.0/search.html?q=lv_bar_get_max_value)
get_min_value||int|[lv_bar_get_min_value](https://docs.lvgl.io/9.0/search.html?q=lv_bar_get_min_value)
get_mode||int|[lv_bar_get_mode](https://docs.lvgl.io/9.0/search.html?q=lv_bar_get_mode)
get_orientation||int|[lv_bar_get_orientation](https://docs.lvgl.io/9.0/search.html?q=lv_bar_get_orientation)
get_start_value||int|[lv_bar_get_start_value](https://docs.lvgl.io/9.0/search.html?q=lv_bar_get_start_value)
get_value||int|[lv_bar_get_value](https://docs.lvgl.io/9.0/search.html?q=lv_bar_get_value)
is_symmetrical||bool|[lv_bar_is_symmetrical](https://docs.lvgl.io/9.0/search.html?q=lv_bar_is_symmetrical)
set_mode|int||[lv_bar_set_mode](https://docs.lvgl.io/9.0/search.html?q=lv_bar_set_mode)
set_orientation|int||[lv_bar_set_orientation](https://docs.lvgl.io/9.0/search.html?q=lv_bar_set_orientation)
set_range|int, int||[lv_bar_set_range](https://docs.lvgl.io/9.0/search.html?q=lv_bar_set_range)
set_start_value|int, int||[lv_bar_set_start_value](https://docs.lvgl.io/9.0/search.html?q=lv_bar_set_start_value)
set_value|int, int||[lv_bar_set_value](https://docs.lvgl.io/9.0/search.html?q=lv_bar_set_value)
@ -1027,7 +1048,6 @@ clear_button_ctrl_all|int||[lv_buttonmatrix_clear_button_ctrl_all](https://docs.
get_button_text|int|string|[lv_buttonmatrix_get_button_text](https://docs.lvgl.io/9.0/search.html?q=lv_buttonmatrix_get_button_text)
get_map||comptr|[lv_buttonmatrix_get_map](https://docs.lvgl.io/9.0/search.html?q=lv_buttonmatrix_get_map)
get_one_checked||bool|[lv_buttonmatrix_get_one_checked](https://docs.lvgl.io/9.0/search.html?q=lv_buttonmatrix_get_one_checked)
get_popovers||bool|[lv_buttonmatrix_get_popovers](https://docs.lvgl.io/9.0/search.html?q=lv_buttonmatrix_get_popovers)
get_selected_button||int|[lv_buttonmatrix_get_selected_button](https://docs.lvgl.io/9.0/search.html?q=lv_buttonmatrix_get_selected_button)
has_button_ctrl|int, int|bool|[lv_buttonmatrix_has_button_ctrl](https://docs.lvgl.io/9.0/search.html?q=lv_buttonmatrix_has_button_ctrl)
set_button_ctrl|int, int||[lv_buttonmatrix_set_button_ctrl](https://docs.lvgl.io/9.0/search.html?q=lv_buttonmatrix_set_button_ctrl)
@ -1149,10 +1169,13 @@ set_text_static|string||[lv_label_set_text_static](https://docs.lvgl.io/9.0/sear
Method|Arguments|Return type|LVGL equivalent
:---|:---|:---|:---
get_points||comptr|[lv_line_get_points](https://docs.lvgl.io/9.0/search.html?q=lv_line_get_points)
get_points_num||int|[lv_line_get_points_num](https://docs.lvgl.io/9.0/search.html?q=lv_line_get_points_num)
get_point_count||int|[lv_line_get_point_count](https://docs.lvgl.io/9.0/search.html?q=lv_line_get_point_count)
get_points||lv.point_precise|[lv_line_get_points](https://docs.lvgl.io/9.0/search.html?q=lv_line_get_points)
get_points_mutable||lv.point_precise|[lv_line_get_points_mutable](https://docs.lvgl.io/9.0/search.html?q=lv_line_get_points_mutable)
get_y_invert||bool|[lv_line_get_y_invert](https://docs.lvgl.io/9.0/search.html?q=lv_line_get_y_invert)
is_point_array_mutable||bool|[lv_line_is_point_array_mutable](https://docs.lvgl.io/9.0/search.html?q=lv_line_is_point_array_mutable)
set_points|lv.point_arr, int||[lv_line_set_points](https://docs.lvgl.io/9.0/search.html?q=lv_line_set_points)
set_points_mutable|lv.point_arr, int||[lv_line_set_points_mutable](https://docs.lvgl.io/9.0/search.html?q=lv_line_set_points_mutable)
set_y_invert|bool||[lv_line_set_y_invert](https://docs.lvgl.io/9.0/search.html?q=lv_line_set_y_invert)
### widget `lv.roller`
@ -1215,6 +1238,7 @@ set_column_count|int||[lv_table_set_column_count](https://docs.lvgl.io/9.0/searc
set_column_width|int, int||[lv_table_set_column_width](https://docs.lvgl.io/9.0/search.html?q=lv_table_set_column_width)
set_row_cnt|int||[lv_table_set_row_count](https://docs.lvgl.io/9.0/search.html?q=lv_table_set_row_count)
set_row_count|int||[lv_table_set_row_count](https://docs.lvgl.io/9.0/search.html?q=lv_table_set_row_count)
set_selected_cell|int, int||[lv_table_set_selected_cell](https://docs.lvgl.io/9.0/search.html?q=lv_table_set_selected_cell)
### widget `lv.textarea`
@ -1309,6 +1333,7 @@ get_range_min_value||int|[lv_scale_get_range_min_value](https://docs.lvgl.io/9.0
get_total_tick_count||int|[lv_scale_get_total_tick_count](https://docs.lvgl.io/9.0/search.html?q=lv_scale_get_total_tick_count)
set_angle|int||[lv_scale_set_rotation](https://docs.lvgl.io/9.0/search.html?q=lv_scale_set_rotation)
set_angle_range|int||[lv_scale_set_angle_range](https://docs.lvgl.io/9.0/search.html?q=lv_scale_set_angle_range)
set_draw_ticks_on_top|bool||[lv_scale_set_draw_ticks_on_top](https://docs.lvgl.io/9.0/search.html?q=lv_scale_set_draw_ticks_on_top)
set_image_needle_value|lv.obj, int||[lv_scale_set_image_needle_value](https://docs.lvgl.io/9.0/search.html?q=lv_scale_set_image_needle_value)
set_label_show|bool||[lv_scale_set_label_show](https://docs.lvgl.io/9.0/search.html?q=lv_scale_set_label_show)
set_line_needle_value|lv.obj, int, int||[lv_scale_set_line_needle_value](https://docs.lvgl.io/9.0/search.html?q=lv_scale_set_line_needle_value)
@ -1332,6 +1357,7 @@ get_first_point_center_offset||int|[lv_chart_get_first_point_center_offset](http
get_point_count||int|[lv_chart_get_point_count](https://docs.lvgl.io/9.0/search.html?q=lv_chart_get_point_count)
get_point_pos_by_id|lv.chart_series, int, comptr||[lv_chart_get_point_pos_by_id](https://docs.lvgl.io/9.0/search.html?q=lv_chart_get_point_pos_by_id)
get_pressed_point||int|[lv_chart_get_pressed_point](https://docs.lvgl.io/9.0/search.html?q=lv_chart_get_pressed_point)
get_series_color|lv.chart_series|lv.color|[lv_chart_get_series_color](https://docs.lvgl.io/9.0/search.html?q=lv_chart_get_series_color)
get_series_next|lv.chart_series|lv.chart_series|[lv_chart_get_series_next](https://docs.lvgl.io/9.0/search.html?q=lv_chart_get_series_next)
get_type||int|[lv_chart_get_type](https://docs.lvgl.io/9.0/search.html?q=lv_chart_get_type)
get_x_array|lv.chart_series|lv.int_arr|[lv_chart_get_x_array](https://docs.lvgl.io/9.0/search.html?q=lv_chart_get_x_array)
@ -1424,6 +1450,7 @@ _btn_text|int|string|[lv_keyboard_get_button_text](https://docs.lvgl.io/9.0/sear
get_button_text|int|string|[lv_keyboard_get_button_text](https://docs.lvgl.io/9.0/search.html?q=lv_keyboard_get_button_text)
get_map_array||comptr|[lv_keyboard_get_map_array](https://docs.lvgl.io/9.0/search.html?q=lv_keyboard_get_map_array)
get_mode||int|[lv_keyboard_get_mode](https://docs.lvgl.io/9.0/search.html?q=lv_keyboard_get_mode)
get_popovers||bool|[lv_keyboard_get_popovers](https://docs.lvgl.io/9.0/search.html?q=lv_keyboard_get_popovers)
get_selected_button||int|[lv_keyboard_get_selected_button](https://docs.lvgl.io/9.0/search.html?q=lv_keyboard_get_selected_button)
get_textarea||lv.obj|[lv_keyboard_get_textarea](https://docs.lvgl.io/9.0/search.html?q=lv_keyboard_get_textarea)
set_mode|int||[lv_keyboard_set_mode](https://docs.lvgl.io/9.0/search.html?q=lv_keyboard_set_mode)
@ -1489,6 +1516,7 @@ Method|Arguments|Return type|LVGL equivalent
get_btnmatrix||lv.obj|[lv_calendar_get_btnmatrix](https://docs.lvgl.io/9.0/search.html?q=lv_calendar_get_btnmatrix)
get_highlighted_dates_num||int|[lv_calendar_get_highlighted_dates_num](https://docs.lvgl.io/9.0/search.html?q=lv_calendar_get_highlighted_dates_num)
header_dropdown_set_year_list|string||[lv_calendar_header_dropdown_set_year_list](https://docs.lvgl.io/9.0/search.html?q=lv_calendar_header_dropdown_set_year_list)
set_chinese_mode|bool||[lv_calendar_set_chinese_mode](https://docs.lvgl.io/9.0/search.html?q=lv_calendar_set_chinese_mode)
set_day_names|comptr||[lv_calendar_set_day_names](https://docs.lvgl.io/9.0/search.html?q=lv_calendar_set_day_names)
set_showed_date|int, int||[lv_calendar_set_showed_date](https://docs.lvgl.io/9.0/search.html?q=lv_calendar_set_showed_date)
set_today_date|int, int, int||[lv_calendar_set_today_date](https://docs.lvgl.io/9.0/search.html?q=lv_calendar_set_today_date)

View File

@ -45,7 +45,7 @@ const be_ntv_func_def_t lv_style_func[] = {
{ "set_bg_main_opa", { (const void*) &lv_style_set_bg_main_opa, "", "(lv.style)i" } },
{ "set_bg_main_stop", { (const void*) &lv_style_set_bg_main_stop, "", "(lv.style)i" } },
{ "set_bg_opa", { (const void*) &lv_style_set_bg_opa, "", "(lv.style)i" } },
{ "set_bitmap_mask_src", { (const void*) &lv_style_set_bitmap_mask_src, "", "(lv.style)(lv.image_dsc)" } },
{ "set_bitmap_mask_src", { (const void*) &lv_style_set_bitmap_mask_src, "", "(lv.style)." } },
{ "set_blend_mode", { (const void*) &lv_style_set_blend_mode, "", "(lv.style)i" } },
{ "set_border_color", { (const void*) &lv_style_set_border_color, "", "(lv.style)(lv.color)" } },
{ "set_border_opa", { (const void*) &lv_style_set_border_opa, "", "(lv.style)i" } },
@ -173,6 +173,7 @@ const be_ntv_func_def_t lv_group_func[] = {
{ "get_editing", { (const void*) &lv_group_get_editing, "b", "(lv.group)" } },
{ "get_focus_cb", { (const void*) &lv_group_get_focus_cb, "lv.group_focus_cb", "(lv.group)" } },
{ "get_focused", { (const void*) &lv_group_get_focused, "lv.obj", "(lv.group)" } },
{ "get_obj_by_index", { (const void*) &lv_group_get_obj_by_index, "lv.obj", "(lv.group)i" } },
{ "get_obj_count", { (const void*) &lv_group_get_obj_count, "i", "(lv.group)" } },
{ "get_wrap", { (const void*) &lv_group_get_wrap, "b", "(lv.group)" } },
{ "remove", { (const void*) &lv_group_delete, "", "(lv.group)" } },
@ -216,6 +217,7 @@ const be_ntv_func_def_t lv_obj_func[] = {
{ "fade_out", { (const void*) &lv_obj_fade_out, "", "(lv.obj)ii" } },
{ "free_id", { (const void*) &lv_obj_free_id, "", "(lv.obj)" } },
{ "get_child", { (const void*) &lv_obj_get_child, "lv.obj", "(lv.obj)i" } },
{ "get_child_by_id", { (const void*) &lv_obj_get_child_by_id, "lv.obj", "(lv.obj)." } },
{ "get_child_by_type", { (const void*) &lv_obj_get_child_by_type, "lv.obj", "(lv.obj)i(lv.obj_class)" } },
{ "get_child_cnt", { (const void*) &lv_obj_get_child_count, "i", "(lv.obj)" } },
{ "get_child_count", { (const void*) &lv_obj_get_child_count, "i", "(lv.obj)" } },
@ -232,6 +234,7 @@ const be_ntv_func_def_t lv_obj_func[] = {
{ "get_event_dsc", { (const void*) &lv_obj_get_event_dsc, "lv.event_dsc", "(lv.obj)i" } },
{ "get_group", { (const void*) &lv_obj_get_group, "lv.group", "(lv.obj)" } },
{ "get_height", { (const void*) &lv_obj_get_height, "i", "(lv.obj)" } },
{ "get_id", { (const void*) &lv_obj_get_id, "c", "(lv.obj)" } },
{ "get_index", { (const void*) &lv_obj_get_index, "i", "(lv.obj)" } },
{ "get_index_by_type", { (const void*) &lv_obj_get_index_by_type, "i", "(lv.obj)(lv.obj_class)" } },
{ "get_parent", { (const void*) &lv_obj_get_parent, "lv.obj", "(lv.obj)" } },
@ -281,7 +284,7 @@ const be_ntv_func_def_t lv_obj_func[] = {
{ "get_style_bg_main_opa", { (const void*) &lv_obj_get_style_bg_main_opa, "i", "(lv.obj)i" } },
{ "get_style_bg_main_stop", { (const void*) &lv_obj_get_style_bg_main_stop, "i", "(lv.obj)i" } },
{ "get_style_bg_opa", { (const void*) &lv_obj_get_style_bg_opa, "i", "(lv.obj)i" } },
{ "get_style_bitmap_mask_src", { (const void*) &lv_obj_get_style_bitmap_mask_src, "lv.image_dsc", "(lv.obj)i" } },
{ "get_style_bitmap_mask_src", { (const void*) &lv_obj_get_style_bitmap_mask_src, "c", "(lv.obj)i" } },
{ "get_style_blend_mode", { (const void*) &lv_obj_get_style_blend_mode, "i", "(lv.obj)i" } },
{ "get_style_border_color", { (const void*) &lv_obj_get_style_border_color, "lv.color", "(lv.obj)i" } },
{ "get_style_border_color_filtered", { (const void*) &lv_obj_get_style_border_color_filtered, "lv.color", "(lv.obj)i" } },
@ -460,6 +463,7 @@ const be_ntv_func_def_t lv_obj_func[] = {
{ "set_grid_cell", { (const void*) &lv_obj_set_grid_cell, "", "(lv.obj)iiiiii" } },
{ "set_grid_dsc_array", { (const void*) &lv_obj_set_grid_dsc_array, "", "(lv.obj)(lv.int_arr)(lv.int_arr)" } },
{ "set_height", { (const void*) &lv_obj_set_height, "", "(lv.obj)i" } },
{ "set_id", { (const void*) &lv_obj_set_id, "", "(lv.obj)." } },
{ "set_layout", { (const void*) &lv_obj_set_layout, "", "(lv.obj)i" } },
{ "set_local_style_prop", { (const void*) &lv_obj_set_local_style_prop, "", "(lv.obj)iii" } },
{ "set_parent", { (const void*) &lv_obj_set_parent, "", "(lv.obj)(lv.obj)" } },
@ -494,7 +498,7 @@ const be_ntv_func_def_t lv_obj_func[] = {
{ "set_style_bg_main_opa", { (const void*) &lv_obj_set_style_bg_main_opa, "", "(lv.obj)ii" } },
{ "set_style_bg_main_stop", { (const void*) &lv_obj_set_style_bg_main_stop, "", "(lv.obj)ii" } },
{ "set_style_bg_opa", { (const void*) &lv_obj_set_style_bg_opa, "", "(lv.obj)ii" } },
{ "set_style_bitmap_mask_src", { (const void*) &lv_obj_set_style_bitmap_mask_src, "", "(lv.obj)(lv.image_dsc)i" } },
{ "set_style_bitmap_mask_src", { (const void*) &lv_obj_set_style_bitmap_mask_src, "", "(lv.obj).i" } },
{ "set_style_blend_mode", { (const void*) &lv_obj_set_style_blend_mode, "", "(lv.obj)ii" } },
{ "set_style_border_color", { (const void*) &lv_obj_set_style_border_color, "", "(lv.obj)(lv.color)i" } },
{ "set_style_border_opa", { (const void*) &lv_obj_set_style_border_opa, "", "(lv.obj)ii" } },
@ -602,6 +606,7 @@ const be_ntv_func_def_t lv_obj_func[] = {
{ "set_x", { (const void*) &lv_obj_set_x, "", "(lv.obj)i" } },
{ "set_y", { (const void*) &lv_obj_set_y, "", "(lv.obj)i" } },
{ "stringify_id", { (const void*) &lv_obj_stringify_id, "s", "(lv.obj)ci" } },
{ "style_apply_color_filter", { (const void*) &lv_obj_style_apply_color_filter, "i", "(lv.obj)ii" } },
{ "swap", { (const void*) &lv_obj_swap, "", "(lv.obj)(lv.obj)" } },
{ "transform_point", { (const void*) &lv_obj_transform_point, "", "(lv.obj)ci" } },
{ "transform_point_array", { (const void*) &lv_obj_transform_point_array, "", "(lv.obj)(lv.point_arr)ii" } },
@ -678,6 +683,7 @@ const be_ntv_func_def_t lv_display_func[] = {
{ "is_invalidation_enabled", { (const void*) &lv_display_is_invalidation_enabled, "b", "(lv.display)" } },
{ "remove", { (const void*) &lv_display_delete, "", "(lv.display)" } },
{ "remove_event_cb_with_user_data", { (const void*) &lv_display_remove_event_cb_with_user_data, "i", "(lv.display).." } },
{ "rotate_area", { (const void*) &lv_display_rotate_area, "", "(lv.display)(lv.area)" } },
{ "send_event", { (const void*) &lv_display_send_event, "i", "(lv.display)i." } },
{ "set_angle", { (const void*) &lv_display_set_rotation, "", "(lv.display)i" } },
{ "set_antialiasing", { (const void*) &lv_display_set_antialiasing, "", "(lv.display)b" } },
@ -714,6 +720,7 @@ const be_ntv_func_def_t lv_indev_func[] = {
{ "get_mode", { (const void*) &lv_indev_get_mode, "i", "(lv.indev)" } },
{ "get_next", { (const void*) &lv_indev_get_next, "lv.indev", "(lv.indev)" } },
{ "get_point", { (const void*) &lv_indev_get_point, "", "(lv.indev)c" } },
{ "get_press_moved", { (const void*) &lv_indev_get_press_moved, "b", "(lv.indev)" } },
{ "get_read_timer", { (const void*) &lv_indev_get_read_timer, "lv.timer", "(lv.indev)" } },
{ "get_scroll_dir", { (const void*) &lv_indev_get_scroll_dir, "i", "(lv.indev)" } },
{ "get_scroll_obj", { (const void*) &lv_indev_get_scroll_obj, "lv.obj", "(lv.indev)" } },
@ -735,9 +742,13 @@ const be_ntv_func_def_t lv_indev_func[] = {
{ "set_display", { (const void*) &lv_indev_set_display, "", "(lv.indev)(lv.display)" } },
{ "set_driver_data", { (const void*) &lv_indev_set_driver_data, "", "(lv.indev)." } },
{ "set_group", { (const void*) &lv_indev_set_group, "", "(lv.indev)(lv.group)" } },
{ "set_long_press_time", { (const void*) &lv_indev_set_long_press_time, "", "(lv.indev)i" } },
{ "set_mode", { (const void*) &lv_indev_set_mode, "", "(lv.indev)i" } },
{ "set_scroll_limit", { (const void*) &lv_indev_set_scroll_limit, "", "(lv.indev)i" } },
{ "set_scroll_throw", { (const void*) &lv_indev_set_scroll_throw, "", "(lv.indev)i" } },
{ "set_type", { (const void*) &lv_indev_set_type, "", "(lv.indev)i" } },
{ "set_user_data", { (const void*) &lv_indev_set_user_data, "", "(lv.indev)." } },
{ "stop_processing", { (const void*) &lv_indev_stop_processing, "", "(lv.indev)" } },
{ "wait_release", { (const void*) &lv_indev_wait_release, "", "(lv.indev)" } },
};
@ -855,10 +866,12 @@ const be_ntv_func_def_t lv_bar_func[] = {
{ "get_max_value", { (const void*) &lv_bar_get_max_value, "i", "(lv.obj)" } },
{ "get_min_value", { (const void*) &lv_bar_get_min_value, "i", "(lv.obj)" } },
{ "get_mode", { (const void*) &lv_bar_get_mode, "i", "(lv.obj)" } },
{ "get_orientation", { (const void*) &lv_bar_get_orientation, "i", "(lv.obj)" } },
{ "get_start_value", { (const void*) &lv_bar_get_start_value, "i", "(lv.obj)" } },
{ "get_value", { (const void*) &lv_bar_get_value, "i", "(lv.obj)" } },
{ "is_symmetrical", { (const void*) &lv_bar_is_symmetrical, "b", "(lv.obj)" } },
{ "set_mode", { (const void*) &lv_bar_set_mode, "", "(lv.obj)i" } },
{ "set_orientation", { (const void*) &lv_bar_set_orientation, "", "(lv.obj)i" } },
{ "set_range", { (const void*) &lv_bar_set_range, "", "(lv.obj)ii" } },
{ "set_start_value", { (const void*) &lv_bar_set_start_value, "", "(lv.obj)ii" } },
{ "set_value", { (const void*) &lv_bar_set_value, "", "(lv.obj)ii" } },
@ -880,7 +893,6 @@ const be_ntv_func_def_t lv_buttonmatrix_func[] = {
{ "get_button_text", { (const void*) &lv_buttonmatrix_get_button_text, "s", "(lv.obj)i" } },
{ "get_map", { (const void*) &lv_buttonmatrix_get_map, "c", "(lv.obj)" } },
{ "get_one_checked", { (const void*) &lv_buttonmatrix_get_one_checked, "b", "(lv.obj)" } },
{ "get_popovers", { (const void*) &lv_buttonmatrix_get_popovers, "b", "(lv.obj)" } },
{ "get_selected_button", { (const void*) &lv_buttonmatrix_get_selected_button, "i", "(lv.obj)" } },
{ "has_button_ctrl", { (const void*) &lv_buttonmatrix_has_button_ctrl, "b", "(lv.obj)ii" } },
{ "set_button_ctrl", { (const void*) &lv_buttonmatrix_set_button_ctrl, "", "(lv.obj)ii" } },
@ -898,6 +910,7 @@ const be_ntv_func_def_t lv_calendar_func[] = {
{ "get_btnmatrix", { (const void*) &lv_calendar_get_btnmatrix, "lv.obj", "(lv.obj)" } },
{ "get_highlighted_dates_num", { (const void*) &lv_calendar_get_highlighted_dates_num, "i", "(lv.obj)" } },
{ "header_dropdown_set_year_list", { (const void*) &lv_calendar_header_dropdown_set_year_list, "", "(lv.obj)s" } },
{ "set_chinese_mode", { (const void*) &lv_calendar_set_chinese_mode, "", "(lv.obj)b" } },
{ "set_day_names", { (const void*) &lv_calendar_set_day_names, "", "(lv.obj)c" } },
{ "set_showed_date", { (const void*) &lv_calendar_set_showed_date, "", "(lv.obj)ii" } },
{ "set_today_date", { (const void*) &lv_calendar_set_today_date, "", "(lv.obj)iii" } },
@ -929,6 +942,7 @@ const be_ntv_func_def_t lv_chart_func[] = {
{ "get_point_count", { (const void*) &lv_chart_get_point_count, "i", "(lv.obj)" } },
{ "get_point_pos_by_id", { (const void*) &lv_chart_get_point_pos_by_id, "", "(lv.obj)(lv.chart_series)ic" } },
{ "get_pressed_point", { (const void*) &lv_chart_get_pressed_point, "i", "(lv.obj)" } },
{ "get_series_color", { (const void*) &lv_chart_get_series_color, "lv.color", "(lv.obj)(lv.chart_series)" } },
{ "get_series_next", { (const void*) &lv_chart_get_series_next, "lv.chart_series", "(lv.obj)(lv.chart_series)" } },
{ "get_type", { (const void*) &lv_chart_get_type, "i", "(lv.obj)" } },
{ "get_x_array", { (const void*) &lv_chart_get_x_array, "lv.int_arr", "(lv.obj)(lv.chart_series)" } },
@ -1044,6 +1058,7 @@ const be_ntv_func_def_t lv_keyboard_func[] = {
{ "get_button_text", { (const void*) &lv_keyboard_get_button_text, "s", "(lv.obj)i" } },
{ "get_map_array", { (const void*) &lv_keyboard_get_map_array, "c", "(lv.obj)" } },
{ "get_mode", { (const void*) &lv_keyboard_get_mode, "i", "(lv.obj)" } },
{ "get_popovers", { (const void*) &lv_keyboard_get_popovers, "b", "(lv.obj)" } },
{ "get_selected_button", { (const void*) &lv_keyboard_get_selected_button, "i", "(lv.obj)" } },
{ "get_textarea", { (const void*) &lv_keyboard_get_textarea, "lv.obj", "(lv.obj)" } },
{ "set_mode", { (const void*) &lv_keyboard_set_mode, "", "(lv.obj)i" } },
@ -1088,10 +1103,13 @@ const be_ntv_func_def_t lv_led_func[] = {
/* `lv_line` methods */
#ifdef BE_LV_WIDGET_LINE
const be_ntv_func_def_t lv_line_func[] = {
{ "get_points", { (const void*) &lv_line_get_points, "c", "(lv.obj)" } },
{ "get_points_num", { (const void*) &lv_line_get_points_num, "i", "(lv.obj)" } },
{ "get_point_count", { (const void*) &lv_line_get_point_count, "i", "(lv.obj)" } },
{ "get_points", { (const void*) &lv_line_get_points, "lv.point_precise", "(lv.obj)" } },
{ "get_points_mutable", { (const void*) &lv_line_get_points_mutable, "lv.point_precise", "(lv.obj)" } },
{ "get_y_invert", { (const void*) &lv_line_get_y_invert, "b", "(lv.obj)" } },
{ "is_point_array_mutable", { (const void*) &lv_line_is_point_array_mutable, "b", "(lv.obj)" } },
{ "set_points", { (const void*) &lv_line_set_points, "", "(lv.obj)(lv.point_arr)i" } },
{ "set_points_mutable", { (const void*) &lv_line_set_points_mutable, "", "(lv.obj)(lv.point_arr)i" } },
{ "set_y_invert", { (const void*) &lv_line_set_y_invert, "", "(lv.obj)b" } },
};
#endif // BE_LV_WIDGET_LINE
@ -1175,6 +1193,7 @@ const be_ntv_func_def_t lv_scale_func[] = {
{ "get_total_tick_count", { (const void*) &lv_scale_get_total_tick_count, "i", "(lv.obj)" } },
{ "set_angle", { (const void*) &lv_scale_set_rotation, "", "(lv.obj)i" } },
{ "set_angle_range", { (const void*) &lv_scale_set_angle_range, "", "(lv.obj)i" } },
{ "set_draw_ticks_on_top", { (const void*) &lv_scale_set_draw_ticks_on_top, "", "(lv.obj)b" } },
{ "set_image_needle_value", { (const void*) &lv_scale_set_image_needle_value, "", "(lv.obj)(lv.obj)i" } },
{ "set_label_show", { (const void*) &lv_scale_set_label_show, "", "(lv.obj)b" } },
{ "set_line_needle_value", { (const void*) &lv_scale_set_line_needle_value, "", "(lv.obj)(lv.obj)ii" } },
@ -1303,6 +1322,7 @@ const be_ntv_func_def_t lv_table_func[] = {
{ "set_column_width", { (const void*) &lv_table_set_column_width, "", "(lv.obj)ii" } },
{ "set_row_cnt", { (const void*) &lv_table_set_row_count, "", "(lv.obj)i" } },
{ "set_row_count", { (const void*) &lv_table_set_row_count, "", "(lv.obj)i" } },
{ "set_selected_cell", { (const void*) &lv_table_set_selected_cell, "", "(lv.obj)ii" } },
};
#endif // BE_LV_WIDGET_TABLE

View File

@ -39,6 +39,7 @@ const be_ntv_func_def_t lv_func[] = {
{ "anim_refr_now", { (const void*) &lv_anim_refr_now, "", "" } },
{ "anim_speed", { (const void*) &lv_anim_speed, "i", "i" } },
{ "anim_speed_clamped", { (const void*) &lv_anim_speed_clamped, "i", "iii" } },
{ "anim_speed_to_time", { (const void*) &lv_anim_speed_to_time, "i", "iii" } },
{ "area_align", { (const void*) &lv_area_align, "", "(lv.area)(lv.area)iii" } },
{ "area_copy", { (const void*) &lv_area_copy, "", "(lv.area)(lv.area)" } },
{ "area_get_height", { (const void*) &lv_area_get_height, "i", "(lv.area)" } },
@ -53,6 +54,7 @@ const be_ntv_func_def_t lv_func[] = {
{ "clamp_height", { (const void*) &lv_clamp_height, "i", "iiii" } },
{ "clamp_width", { (const void*) &lv_clamp_width, "i", "iiii" } },
{ "color32_eq", { (const void*) &lv_color32_eq, "b", "ii" } },
{ "color32_luminance", { (const void*) &lv_color32_luminance, "i", "i" } },
{ "color32_make", { (const void*) &lv_color32_make, "i", "iiii" } },
{ "color_16_16_mix", { (const void*) &lv_color_16_16_mix, "i", "iii" } },
{ "color_black", { (const void*) &lv_color_black, "lv.color", "" } },
@ -66,6 +68,7 @@ const be_ntv_func_def_t lv_func[] = {
{ "color_hex3", { (const void*) &lv_color_hex3, "lv.color", "i" } },
{ "color_hsv_to_rgb", { (const void*) &lv_color_hsv_to_rgb, "lv.color", "iii" } },
{ "color_lighten", { (const void*) &lv_color_lighten, "lv.color", "(lv.color)i" } },
{ "color_luminance", { (const void*) &lv_color_luminance, "i", "(lv.color)" } },
{ "color_make", { (const void*) &lv_color_make, "lv.color", "iii" } },
{ "color_mix", { (const void*) &lv_color_mix, "lv.color", "(lv.color)(lv.color)i" } },
{ "color_mix32", { (const void*) &lv_color_mix32, "i", "ii" } },
@ -89,6 +92,7 @@ const be_ntv_func_def_t lv_func[] = {
{ "draw_dispatch_layer", { (const void*) &lv_draw_dispatch_layer, "b", "(lv.display)(lv.layer)" } },
{ "draw_dispatch_request", { (const void*) &lv_draw_dispatch_request, "", "" } },
{ "draw_dispatch_wait_for_request", { (const void*) &lv_draw_dispatch_wait_for_request, "", "" } },
{ "draw_get_unit_count", { (const void*) &lv_draw_get_unit_count, "i", "" } },
{ "draw_init", { (const void*) &lv_draw_init, "", "" } },
{ "draw_label", { (const void*) &lv_draw_label, "", "(lv.layer)(lv.draw_label_dsc)(lv.area)" } },
{ "draw_label_dsc_init", { (const void*) &lv_draw_label_dsc_init, "", "(lv.draw_label_dsc)" } },
@ -99,6 +103,7 @@ const be_ntv_func_def_t lv_func[] = {
{ "draw_line_dsc_init", { (const void*) &lv_draw_line_dsc_init, "", "(lv.draw_line_dsc)" } },
{ "draw_rect", { (const void*) &lv_draw_rect, "", "(lv.layer)(lv.draw_rect_dsc)(lv.area)" } },
{ "draw_rect_dsc_init", { (const void*) &lv_draw_rect_dsc_init, "", "(lv.draw_rect_dsc)" } },
{ "draw_wait_for_finish", { (const void*) &lv_draw_wait_for_finish, "", "" } },
{ "event_dsc_get_cb", { (const void*) &lv_event_dsc_get_cb, "lv.event_cb", "(lv.event_dsc)" } },
{ "event_dsc_get_user_data", { (const void*) &lv_event_dsc_get_user_data, "c", "(lv.event_dsc)" } },
{ "event_register_id", { (const void*) &lv_event_register_id, "i", "" } },
@ -126,6 +131,7 @@ const be_ntv_func_def_t lv_func[] = {
{ "obj_delete_anim_completed_cb", { (const void*) &lv_obj_delete_anim_completed_cb, "", "(lv.anim)" } },
{ "obj_enable_style_refresh", { (const void*) &lv_obj_enable_style_refresh, "", "b" } },
{ "obj_event_base", { (const void*) &lv_obj_event_base, "i", "(lv.obj_class)(lv.event)" } },
{ "obj_id_compare", { (const void*) &lv_obj_id_compare, "i", ".." } },
{ "obj_redraw", { (const void*) &lv_obj_redraw, "", "(lv.layer)(lv.obj)" } },
{ "obj_report_style_change", { (const void*) &lv_obj_report_style_change, "", "(lv.style)" } },
{ "obj_style_get_selector_part", { (const void*) &lv_obj_style_get_selector_part, "i", "i" } },
@ -153,8 +159,10 @@ const be_ntv_func_def_t lv_func[] = {
{ "span_stack_deinit", { (const void*) &lv_span_stack_deinit, "", "" } },
{ "span_stack_init", { (const void*) &lv_span_stack_init, "", "" } },
{ "style_get_num_custom_props", { (const void*) &lv_style_get_num_custom_props, "i", "" } },
{ "style_get_prop_group", { (const void*) &lv_style_get_prop_group, "i", "i" } },
{ "style_prop_get_default", { (const void*) &lv_style_prop_get_default, "i", "i" } },
{ "style_prop_has_flag", { (const void*) &lv_style_prop_has_flag, "b", "ii" } },
{ "style_prop_lookup_flags", { (const void*) &lv_style_prop_lookup_flags, "i", "i" } },
{ "style_register_prop", { (const void*) &lv_style_register_prop, "i", "i" } },
{ "task_handler", { (const void*) &lv_task_handler, "i", "" } },
{ "text_get_size", { (const void*) &lv_text_get_size, "", "cs(lv.font)iiii" } },
@ -223,6 +231,9 @@ const be_const_member_t lv0_constants[] = {
{ "BAR_MODE_NORMAL", be_cconst_int(LV_BAR_MODE_NORMAL) },
{ "BAR_MODE_RANGE", be_cconst_int(LV_BAR_MODE_RANGE) },
{ "BAR_MODE_SYMMETRICAL", be_cconst_int(LV_BAR_MODE_SYMMETRICAL) },
{ "BAR_ORIENTATION_AUTO", be_cconst_int(LV_BAR_ORIENTATION_AUTO) },
{ "BAR_ORIENTATION_HORIZONTAL", be_cconst_int(LV_BAR_ORIENTATION_HORIZONTAL) },
{ "BAR_ORIENTATION_VERTICAL", be_cconst_int(LV_BAR_ORIENTATION_VERTICAL) },
{ "BASE_DIR_AUTO", be_cconst_int(LV_BASE_DIR_AUTO) },
{ "BASE_DIR_LTR", be_cconst_int(LV_BASE_DIR_LTR) },
{ "BASE_DIR_NEUTRAL", be_cconst_int(LV_BASE_DIR_NEUTRAL) },
@ -259,6 +270,10 @@ const be_const_member_t lv0_constants[] = {
{ "BUTTONMATRIX_CTRL_HIDDEN", be_cconst_int(LV_BUTTONMATRIX_CTRL_HIDDEN) },
{ "BUTTONMATRIX_CTRL_NO_REPEAT", be_cconst_int(LV_BUTTONMATRIX_CTRL_NO_REPEAT) },
{ "BUTTONMATRIX_CTRL_POPOVER", be_cconst_int(LV_BUTTONMATRIX_CTRL_POPOVER) },
{ "BUTTONMATRIX_CTRL_RESERVED_1", be_cconst_int(LV_BUTTONMATRIX_CTRL_RESERVED_1) },
{ "BUTTONMATRIX_CTRL_RESERVED_2", be_cconst_int(LV_BUTTONMATRIX_CTRL_RESERVED_2) },
{ "BUTTONMATRIX_CTRL_RESERVED_3", be_cconst_int(LV_BUTTONMATRIX_CTRL_RESERVED_3) },
{ "CHART_AXIS_LAST", be_cconst_int(LV_CHART_AXIS_LAST) },
{ "CHART_AXIS_PRIMARY_X", be_cconst_int(LV_CHART_AXIS_PRIMARY_X) },
{ "CHART_AXIS_PRIMARY_Y", be_cconst_int(LV_CHART_AXIS_PRIMARY_Y) },
{ "CHART_AXIS_SECONDARY_X", be_cconst_int(LV_CHART_AXIS_SECONDARY_X) },
@ -279,6 +294,7 @@ const be_const_member_t lv0_constants[] = {
{ "COLOR_FORMAT_A2", be_cconst_int(LV_COLOR_FORMAT_A2) },
{ "COLOR_FORMAT_A4", be_cconst_int(LV_COLOR_FORMAT_A4) },
{ "COLOR_FORMAT_A8", be_cconst_int(LV_COLOR_FORMAT_A8) },
{ "COLOR_FORMAT_AL88", be_cconst_int(LV_COLOR_FORMAT_AL88) },
{ "COLOR_FORMAT_ARGB8565", be_cconst_int(LV_COLOR_FORMAT_ARGB8565) },
{ "COLOR_FORMAT_ARGB8888", be_cconst_int(LV_COLOR_FORMAT_ARGB8888) },
{ "COLOR_FORMAT_I1", be_cconst_int(LV_COLOR_FORMAT_I1) },
@ -360,6 +376,7 @@ const be_const_member_t lv0_constants[] = {
{ "DRAW_TASK_TYPE_LINE", be_cconst_int(LV_DRAW_TASK_TYPE_LINE) },
{ "DRAW_TASK_TYPE_MASK_BITMAP", be_cconst_int(LV_DRAW_TASK_TYPE_MASK_BITMAP) },
{ "DRAW_TASK_TYPE_MASK_RECTANGLE", be_cconst_int(LV_DRAW_TASK_TYPE_MASK_RECTANGLE) },
{ "DRAW_TASK_TYPE_NONE", be_cconst_int(LV_DRAW_TASK_TYPE_NONE) },
{ "DRAW_TASK_TYPE_TRIANGLE", be_cconst_int(LV_DRAW_TASK_TYPE_TRIANGLE) },
{ "DRAW_TASK_TYPE_VECTOR", be_cconst_int(LV_DRAW_TASK_TYPE_VECTOR) },
{ "DROPDOWN_POS_LAST", be_cconst_int(LV_DROPDOWN_POS_LAST) },
@ -389,10 +406,13 @@ const be_const_member_t lv0_constants[] = {
{ "EVENT_GESTURE", be_cconst_int(LV_EVENT_GESTURE) },
{ "EVENT_GET_SELF_SIZE", be_cconst_int(LV_EVENT_GET_SELF_SIZE) },
{ "EVENT_HIT_TEST", be_cconst_int(LV_EVENT_HIT_TEST) },
{ "EVENT_HOVER_LEAVE", be_cconst_int(LV_EVENT_HOVER_LEAVE) },
{ "EVENT_HOVER_OVER", be_cconst_int(LV_EVENT_HOVER_OVER) },
{ "EVENT_INDEV_RESET", be_cconst_int(LV_EVENT_INDEV_RESET) },
{ "EVENT_INSERT", be_cconst_int(LV_EVENT_INSERT) },
{ "EVENT_INVALIDATE_AREA", be_cconst_int(LV_EVENT_INVALIDATE_AREA) },
{ "EVENT_KEY", be_cconst_int(LV_EVENT_KEY) },
{ "EVENT_LAST", be_cconst_int(LV_EVENT_LAST) },
{ "EVENT_LAYOUT_CHANGED", be_cconst_int(LV_EVENT_LAYOUT_CHANGED) },
{ "EVENT_LEAVE", be_cconst_int(LV_EVENT_LEAVE) },
{ "EVENT_LONG_PRESSED", be_cconst_int(LV_EVENT_LONG_PRESSED) },
@ -460,9 +480,15 @@ const be_const_member_t lv0_constants[] = {
{ "FT_FONT_STYLE_BOLD", be_cconst_int(FT_FONT_STYLE_BOLD) },
{ "FT_FONT_STYLE_ITALIC", be_cconst_int(FT_FONT_STYLE_ITALIC) },
{ "FT_FONT_STYLE_NORMAL", be_cconst_int(FT_FONT_STYLE_NORMAL) },
{ "GRAD_DIR_CONICAL", be_cconst_int(LV_GRAD_DIR_CONICAL) },
{ "GRAD_DIR_HOR", be_cconst_int(LV_GRAD_DIR_HOR) },
{ "GRAD_DIR_LINEAR", be_cconst_int(LV_GRAD_DIR_LINEAR) },
{ "GRAD_DIR_NONE", be_cconst_int(LV_GRAD_DIR_NONE) },
{ "GRAD_DIR_RADIAL", be_cconst_int(LV_GRAD_DIR_RADIAL) },
{ "GRAD_DIR_VER", be_cconst_int(LV_GRAD_DIR_VER) },
{ "GRAD_EXTEND_PAD", be_cconst_int(LV_GRAD_EXTEND_PAD) },
{ "GRAD_EXTEND_REFLECT", be_cconst_int(LV_GRAD_EXTEND_REFLECT) },
{ "GRAD_EXTEND_REPEAT", be_cconst_int(LV_GRAD_EXTEND_REPEAT) },
{ "GRID_ALIGN_CENTER", be_cconst_int(LV_GRID_ALIGN_CENTER) },
{ "GRID_ALIGN_END", be_cconst_int(LV_GRID_ALIGN_END) },
{ "GRID_ALIGN_SPACE_AROUND", be_cconst_int(LV_GRID_ALIGN_SPACE_AROUND) },
@ -479,8 +505,10 @@ const be_const_member_t lv0_constants[] = {
{ "IMAGEBUTTON_STATE_CHECKED_PRESSED", be_cconst_int(LV_IMAGEBUTTON_STATE_CHECKED_PRESSED) },
{ "IMAGEBUTTON_STATE_CHECKED_RELEASED", be_cconst_int(LV_IMAGEBUTTON_STATE_CHECKED_RELEASED) },
{ "IMAGEBUTTON_STATE_DISABLED", be_cconst_int(LV_IMAGEBUTTON_STATE_DISABLED) },
{ "IMAGEBUTTON_STATE_NUM", be_cconst_int(LV_IMAGEBUTTON_STATE_NUM) },
{ "IMAGEBUTTON_STATE_PRESSED", be_cconst_int(LV_IMAGEBUTTON_STATE_PRESSED) },
{ "IMAGEBUTTON_STATE_RELEASED", be_cconst_int(LV_IMAGEBUTTON_STATE_RELEASED) },
{ "IMAGE_ALIGN_AUTO_TRANSFORM", be_cconst_int(LV_IMAGE_ALIGN_AUTO_TRANSFORM) },
{ "IMAGE_ALIGN_BOTTOM_LEFT", be_cconst_int(LV_IMAGE_ALIGN_BOTTOM_LEFT) },
{ "IMAGE_ALIGN_BOTTOM_MID", be_cconst_int(LV_IMAGE_ALIGN_BOTTOM_MID) },
{ "IMAGE_ALIGN_BOTTOM_RIGHT", be_cconst_int(LV_IMAGE_ALIGN_BOTTOM_RIGHT) },
@ -548,6 +576,7 @@ const be_const_member_t lv0_constants[] = {
{ "LAYER_TYPE_TRANSFORM", be_cconst_int(LV_LAYER_TYPE_TRANSFORM) },
{ "LAYOUT_FLEX", be_cconst_int(LV_LAYOUT_FLEX) },
{ "LAYOUT_GRID", be_cconst_int(LV_LAYOUT_GRID) },
{ "LAYOUT_LAST", be_cconst_int(LV_LAYOUT_LAST) },
{ "LAYOUT_NONE", be_cconst_int(LV_LAYOUT_NONE) },
{ "LOG_LEVEL_ERROR", be_cconst_int(LV_LOG_LEVEL_ERROR) },
{ "LOG_LEVEL_INFO", be_cconst_int(LV_LOG_LEVEL_INFO) },
@ -629,6 +658,7 @@ const be_const_member_t lv0_constants[] = {
{ "PALETTE_GREEN", be_cconst_int(LV_PALETTE_GREEN) },
{ "PALETTE_GREY", be_cconst_int(LV_PALETTE_GREY) },
{ "PALETTE_INDIGO", be_cconst_int(LV_PALETTE_INDIGO) },
{ "PALETTE_LAST", be_cconst_int(LV_PALETTE_LAST) },
{ "PALETTE_LIGHT_BLUE", be_cconst_int(LV_PALETTE_LIGHT_BLUE) },
{ "PALETTE_LIGHT_GREEN", be_cconst_int(LV_PALETTE_LIGHT_GREEN) },
{ "PALETTE_LIME", be_cconst_int(LV_PALETTE_LIME) },
@ -662,6 +692,7 @@ const be_const_member_t lv0_constants[] = {
{ "SCALE_MAJOR_TICK_EVERY_DEFAULT", be_cconst_int(LV_SCALE_MAJOR_TICK_EVERY_DEFAULT) },
{ "SCALE_MODE_HORIZONTAL_BOTTOM", be_cconst_int(LV_SCALE_MODE_HORIZONTAL_BOTTOM) },
{ "SCALE_MODE_HORIZONTAL_TOP", be_cconst_int(LV_SCALE_MODE_HORIZONTAL_TOP) },
{ "SCALE_MODE_LAST", be_cconst_int(LV_SCALE_MODE_LAST) },
{ "SCALE_MODE_ROUND_INNER", be_cconst_int(LV_SCALE_MODE_ROUND_INNER) },
{ "SCALE_MODE_ROUND_OUTER", be_cconst_int(LV_SCALE_MODE_ROUND_OUTER) },
{ "SCALE_MODE_VERTICAL_LEFT", be_cconst_int(LV_SCALE_MODE_VERTICAL_LEFT) },
@ -699,8 +730,10 @@ const be_const_member_t lv0_constants[] = {
{ "SPAN_MODE_BREAK", be_cconst_int(LV_SPAN_MODE_BREAK) },
{ "SPAN_MODE_EXPAND", be_cconst_int(LV_SPAN_MODE_EXPAND) },
{ "SPAN_MODE_FIXED", be_cconst_int(LV_SPAN_MODE_FIXED) },
{ "SPAN_MODE_LAST", be_cconst_int(LV_SPAN_MODE_LAST) },
{ "SPAN_OVERFLOW_CLIP", be_cconst_int(LV_SPAN_OVERFLOW_CLIP) },
{ "SPAN_OVERFLOW_ELLIPSIS", be_cconst_int(LV_SPAN_OVERFLOW_ELLIPSIS) },
{ "SPAN_OVERFLOW_LAST", be_cconst_int(LV_SPAN_OVERFLOW_LAST) },
{ "STATE_ANY", be_cconst_int(LV_STATE_ANY) },
{ "STATE_CHECKED", be_cconst_int(LV_STATE_CHECKED) },
{ "STATE_DEFAULT", be_cconst_int(LV_STATE_DEFAULT) },
@ -772,6 +805,7 @@ const be_const_member_t lv0_constants[] = {
{ "STYLE_IMG_OPA", be_cconst_int(LV_STYLE_IMAGE_OPA) },
{ "STYLE_IMG_RECOLOR", be_cconst_int(LV_STYLE_IMAGE_RECOLOR) },
{ "STYLE_IMG_RECOLOR_OPA", be_cconst_int(LV_STYLE_IMAGE_RECOLOR_OPA) },
{ "STYLE_LAST_BUILT_IN_PROP", be_cconst_int(LV_STYLE_LAST_BUILT_IN_PROP) },
{ "STYLE_LAYOUT", be_cconst_int(LV_STYLE_LAYOUT) },
{ "STYLE_LENGTH", be_cconst_int(LV_STYLE_LENGTH) },
{ "STYLE_LINE_COLOR", be_cconst_int(LV_STYLE_LINE_COLOR) },
@ -788,6 +822,7 @@ const be_const_member_t lv0_constants[] = {
{ "STYLE_MAX_WIDTH", be_cconst_int(LV_STYLE_MAX_WIDTH) },
{ "STYLE_MIN_HEIGHT", be_cconst_int(LV_STYLE_MIN_HEIGHT) },
{ "STYLE_MIN_WIDTH", be_cconst_int(LV_STYLE_MIN_WIDTH) },
{ "STYLE_NUM_BUILT_IN_PROPS", be_cconst_int(LV_STYLE_NUM_BUILT_IN_PROPS) },
{ "STYLE_OPA", be_cconst_int(LV_STYLE_OPA) },
{ "STYLE_OPA_LAYERED", be_cconst_int(LV_STYLE_OPA_LAYERED) },
{ "STYLE_OUTLINE_COLOR", be_cconst_int(LV_STYLE_OUTLINE_COLOR) },
@ -801,6 +836,7 @@ const be_const_member_t lv0_constants[] = {
{ "STYLE_PAD_ROW", be_cconst_int(LV_STYLE_PAD_ROW) },
{ "STYLE_PAD_TOP", be_cconst_int(LV_STYLE_PAD_TOP) },
{ "STYLE_PROP_ANY", be_cconst_int(LV_STYLE_PROP_ANY) },
{ "STYLE_PROP_CONST", be_cconst_int(LV_STYLE_PROP_CONST) },
{ "STYLE_PROP_INV", be_cconst_int(LV_STYLE_PROP_INV) },
{ "STYLE_RADIUS", be_cconst_int(LV_STYLE_RADIUS) },
{ "STYLE_RES_FOUND", be_cconst_int(LV_STYLE_RES_FOUND) },
@ -814,6 +850,10 @@ const be_const_member_t lv0_constants[] = {
{ "STYLE_SHADOW_OPA", be_cconst_int(LV_STYLE_SHADOW_OPA) },
{ "STYLE_SHADOW_SPREAD", be_cconst_int(LV_STYLE_SHADOW_SPREAD) },
{ "STYLE_SHADOW_WIDTH", be_cconst_int(LV_STYLE_SHADOW_WIDTH) },
{ "STYLE_STATE_CMP_DIFF_DRAW_PAD", be_cconst_int(LV_STYLE_STATE_CMP_DIFF_DRAW_PAD) },
{ "STYLE_STATE_CMP_DIFF_LAYOUT", be_cconst_int(LV_STYLE_STATE_CMP_DIFF_LAYOUT) },
{ "STYLE_STATE_CMP_DIFF_REDRAW", be_cconst_int(LV_STYLE_STATE_CMP_DIFF_REDRAW) },
{ "STYLE_STATE_CMP_SAME", be_cconst_int(LV_STYLE_STATE_CMP_SAME) },
{ "STYLE_TEXT_ALIGN", be_cconst_int(LV_STYLE_TEXT_ALIGN) },
{ "STYLE_TEXT_COLOR", be_cconst_int(LV_STYLE_TEXT_COLOR) },
{ "STYLE_TEXT_DECOR", be_cconst_int(LV_STYLE_TEXT_DECOR) },
@ -911,6 +951,7 @@ const be_const_member_t lv0_constants[] = {
{ "TEXT_DECOR_NONE", be_cconst_int(LV_TEXT_DECOR_NONE) },
{ "TEXT_DECOR_STRIKETHROUGH", be_cconst_int(LV_TEXT_DECOR_STRIKETHROUGH) },
{ "TEXT_DECOR_UNDERLINE", be_cconst_int(LV_TEXT_DECOR_UNDERLINE) },
{ "TEXT_FLAG_BREAK_ALL", be_cconst_int(LV_TEXT_FLAG_BREAK_ALL) },
{ "TEXT_FLAG_EXPAND", be_cconst_int(LV_TEXT_FLAG_EXPAND) },
{ "TEXT_FLAG_FIT", be_cconst_int(LV_TEXT_FLAG_FIT) },
{ "TEXT_FLAG_NONE", be_cconst_int(LV_TEXT_FLAG_NONE) },

View File

@ -259,7 +259,6 @@ LV_OBJ_POINT_TRANSFORM_FLAG_RECURSIVE
LV_OBJ_POINT_TRANSFORM_FLAG_INVERSE
LV_OBJ_POINT_TRANSFORM_FLAG_INVERSE_RECURSIVE
// File: ../../lvgl/src/core/lv_obj_property.h
// File: ../../lvgl/src/core/lv_obj_scroll.h
LV_SCROLLBAR_MODE_OFF
LV_SCROLLBAR_MODE_ON
@ -271,6 +270,10 @@ LV_SCROLL_SNAP_START
LV_SCROLL_SNAP_END
LV_SCROLL_SNAP_CENTER
// File: ../../lvgl/src/core/lv_obj_style.h
LV_STYLE_STATE_CMP_SAME
LV_STYLE_STATE_CMP_DIFF_REDRAW
LV_STYLE_STATE_CMP_DIFF_DRAW_PAD
LV_STYLE_STATE_CMP_DIFF_LAYOUT
// File: ../../lvgl/src/core/lv_obj_style_gen.h
// File: ../../lvgl/src/core/lv_obj_tree.h
@ -306,6 +309,7 @@ LV_SCR_LOAD_ANIM_OUT_TOP
LV_SCR_LOAD_ANIM_OUT_BOTTOM
// File: ../../lvgl/src/draw/lv_draw.h
LV_DRAW_TASK_TYPE_NONE
LV_DRAW_TASK_TYPE_FILL
LV_DRAW_TASK_TYPE_BORDER
LV_DRAW_TASK_TYPE_BOX_SHADOW
@ -401,6 +405,7 @@ LV_GRID_TEMPLATE_LAST
LV_LAYOUT_NONE
LV_LAYOUT_FLEX
LV_LAYOUT_GRID
LV_LAYOUT_LAST
// File: ../../lvgl/src/misc/lv_anim.h
LV_ANIM_OFF
LV_ANIM_ON
@ -441,9 +446,9 @@ LV_DIR_HOR
LV_DIR_VER
LV_DIR_ALL
LV_SIZE_CONTENT
LV_COORD_MAX
LV_COORD_MIN
LV_SIZE_CONTENT
// File: ../../lvgl/src/misc/lv_array.h
// File: ../../lvgl/src/misc/lv_assert.h
// File: ../../lvgl/src/misc/lv_async.h
@ -481,6 +486,7 @@ LV_COLOR_FORMAT_A8
LV_COLOR_FORMAT_RGB565
LV_COLOR_FORMAT_ARGB8565
LV_COLOR_FORMAT_RGB565A8
LV_COLOR_FORMAT_AL88
LV_COLOR_FORMAT_RGB888
LV_COLOR_FORMAT_ARGB8888
LV_COLOR_FORMAT_XRGB8888
@ -498,6 +504,9 @@ LV_COLOR_FORMAT_YUY2
LV_COLOR_FORMAT_UYVY
LV_COLOR_FORMAT_YUV_END
LV_COLOR_FORMAT_NATIVE
LV_COLOR_FORMAT_NATIVE_WITH_ALPHA
LV_COLOR_FORMAT_NATIVE
LV_COLOR_FORMAT_NATIVE_WITH_ALPHA
LV_COLOR_FORMAT_NATIVE
LV_COLOR_FORMAT_NATIVE_WITH_ALPHA
LV_COLOR_FORMAT_NATIVE
@ -529,6 +538,8 @@ LV_EVENT_DEFOCUSED
LV_EVENT_LEAVE
LV_EVENT_HIT_TEST
LV_EVENT_INDEV_RESET
LV_EVENT_HOVER_OVER
LV_EVENT_HOVER_LEAVE
LV_EVENT_COVER_CHECK
LV_EVENT_REFR_EXT_DRAW_SIZE
LV_EVENT_DRAW_MAIN_BEGIN
@ -569,6 +580,7 @@ LV_EVENT_FLUSH_FINISH
LV_EVENT_FLUSH_WAIT_START
LV_EVENT_FLUSH_WAIT_FINISH
LV_EVENT_VSYNC
LV_EVENT_LAST
LV_EVENT_PREPROCESS
// File: ../../lvgl/src/misc/lv_fs.h
@ -603,6 +615,7 @@ LV_LOG_LEVEL_USER
LV_LOG_LEVEL_NONE
// File: ../../lvgl/src/misc/lv_lru.h
// File: ../../lvgl/src/misc/lv_math.h
// File: ../../lvgl/src/misc/lv_matrix.h
// File: ../../lvgl/src/misc/lv_palette.h
LV_PALETTE_RED
LV_PALETTE_PINK
@ -623,6 +636,7 @@ LV_PALETTE_DEEP_ORANGE
LV_PALETTE_BROWN
LV_PALETTE_BLUE_GREY
LV_PALETTE_GREY
LV_PALETTE_LAST
LV_PALETTE_NONE
// File: ../../lvgl/src/misc/lv_profiler.h
@ -651,6 +665,13 @@ LV_BORDER_SIDE_INTERNAL
LV_GRAD_DIR_NONE
LV_GRAD_DIR_VER
LV_GRAD_DIR_HOR
LV_GRAD_DIR_LINEAR
LV_GRAD_DIR_RADIAL
LV_GRAD_DIR_CONICAL
LV_GRAD_EXTEND_PAD
LV_GRAD_EXTEND_REPEAT
LV_GRAD_EXTEND_REFLECT
LV_STYLE_PROP_INV
LV_STYLE_WIDTH
@ -763,7 +784,10 @@ LV_STYLE_GRID_CELL_X_ALIGN
LV_STYLE_GRID_CELL_ROW_POS
LV_STYLE_GRID_CELL_ROW_SPAN
LV_STYLE_GRID_CELL_Y_ALIGN
LV_STYLE_LAST_BUILT_IN_PROP
LV_STYLE_NUM_BUILT_IN_PROPS
LV_STYLE_PROP_ANY
LV_STYLE_PROP_CONST
LV_STYLE_RES_NOT_FOUND
LV_STYLE_RES_FOUND
@ -774,6 +798,7 @@ LV_SCALE_NONE
LV_TEXT_FLAG_NONE
LV_TEXT_FLAG_EXPAND
LV_TEXT_FLAG_FIT
LV_TEXT_FLAG_BREAK_ALL
LV_TEXT_ALIGN_AUTO
LV_TEXT_ALIGN_LEFT
@ -798,6 +823,9 @@ LV_ARC_MODE_REVERSE
LV_BAR_MODE_NORMAL
LV_BAR_MODE_SYMMETRICAL
LV_BAR_MODE_RANGE
LV_BAR_ORIENTATION_AUTO
LV_BAR_ORIENTATION_HORIZONTAL
LV_BAR_ORIENTATION_VERTICAL
// File: ../../lvgl/src/widgets/button/lv_button.h
// File: ../../lvgl/src/widgets/buttonmatrix/lv_buttonmatrix.h
LV_BUTTONMATRIX_CTRL_HIDDEN
@ -807,11 +835,15 @@ LV_BUTTONMATRIX_CTRL_CHECKABLE
LV_BUTTONMATRIX_CTRL_CHECKED
LV_BUTTONMATRIX_CTRL_CLICK_TRIG
LV_BUTTONMATRIX_CTRL_POPOVER
LV_BUTTONMATRIX_CTRL_RESERVED_1
LV_BUTTONMATRIX_CTRL_RESERVED_2
LV_BUTTONMATRIX_CTRL_RESERVED_3
LV_BUTTONMATRIX_CTRL_CUSTOM_1
LV_BUTTONMATRIX_CTRL_CUSTOM_2
LV_BUTTONMATRIX_BUTTON_NONE
// File: ../../lvgl/src/widgets/calendar/lv_calendar.h
// File: ../../lvgl/src/widgets/calendar/lv_calendar_chinese.h
// File: ../../lvgl/src/widgets/calendar/lv_calendar_header_arrow.h
// File: ../../lvgl/src/widgets/calendar/lv_calendar_header_dropdown.h
// File: ../../lvgl/src/widgets/canvas/lv_canvas.h
@ -828,6 +860,7 @@ LV_CHART_AXIS_PRIMARY_Y
LV_CHART_AXIS_SECONDARY_Y
LV_CHART_AXIS_PRIMARY_X
LV_CHART_AXIS_SECONDARY_X
LV_CHART_AXIS_LAST
LV_CHART_POINT_NONE
// File: ../../lvgl/src/widgets/checkbox/lv_checkbox.h
// File: ../../lvgl/src/widgets/dropdown/lv_dropdown.h
@ -843,6 +876,7 @@ LV_IMAGE_ALIGN_BOTTOM_RIGHT
LV_IMAGE_ALIGN_LEFT_MID
LV_IMAGE_ALIGN_RIGHT_MID
LV_IMAGE_ALIGN_CENTER
LV_IMAGE_ALIGN_AUTO_TRANSFORM
LV_IMAGE_ALIGN_STRETCH
LV_IMAGE_ALIGN_TILE
@ -853,6 +887,7 @@ LV_IMAGEBUTTON_STATE_DISABLED
LV_IMAGEBUTTON_STATE_CHECKED_RELEASED
LV_IMAGEBUTTON_STATE_CHECKED_PRESSED
LV_IMAGEBUTTON_STATE_CHECKED_DISABLED
LV_IMAGEBUTTON_STATE_NUM
// File: ../../lvgl/src/widgets/keyboard/lv_keyboard.h
LV_KEYBOARD_MODE_TEXT_LOWER
@ -895,6 +930,7 @@ LV_SCALE_MODE_VERTICAL_LEFT
LV_SCALE_MODE_VERTICAL_RIGHT
LV_SCALE_MODE_ROUND_INNER
LV_SCALE_MODE_ROUND_OUTER
LV_SCALE_MODE_LAST
LV_SCALE_TOTAL_TICK_COUNT_DEFAULT
LV_SCALE_MAJOR_TICK_EVERY_DEFAULT
LV_SCALE_LABEL_ENABLED_DEFAULT
@ -905,10 +941,12 @@ LV_SLIDER_MODE_RANGE
// File: ../../lvgl/src/widgets/span/lv_span.h
LV_SPAN_OVERFLOW_CLIP
LV_SPAN_OVERFLOW_ELLIPSIS
LV_SPAN_OVERFLOW_LAST
LV_SPAN_MODE_FIXED
LV_SPAN_MODE_EXPAND
LV_SPAN_MODE_BREAK
LV_SPAN_MODE_LAST
// File: ../../lvgl/src/widgets/spinbox/lv_spinbox.h
// File: ../../lvgl/src/widgets/spinner/lv_spinner.h
// File: ../../lvgl/src/widgets/switch/lv_switch.h

View File

@ -52,6 +52,7 @@ lv_group_edge_cb_t lv_group_get_edge_cb(const lv_group_t * group)
bool lv_group_get_editing(const lv_group_t * group)
bool lv_group_get_wrap(lv_group_t * group)
uint32_t lv_group_get_obj_count(lv_group_t * group)
lv_obj_t * lv_group_get_obj_by_index(lv_group_t * group, uint32_t index)
uint32_t lv_group_get_count(void)
lv_group_t * lv_group_by_index(uint32_t index)
@ -63,20 +64,25 @@ void lv_obj_update_flag(lv_obj_t * obj, lv_obj_flag_t f, bool v)
void lv_obj_add_state(lv_obj_t * obj, lv_state_t state)
void lv_obj_remove_state(lv_obj_t * obj, lv_state_t state)
void lv_obj_set_state(lv_obj_t * obj, lv_state_t state, bool v)
static inline void lv_obj_set_user_data(lv_obj_t * obj, void * user_data)
void lv_obj_set_user_data(lv_obj_t * obj, void * user_data)
bool lv_obj_has_flag(const lv_obj_t * obj, lv_obj_flag_t f)
bool lv_obj_has_flag_any(const lv_obj_t * obj, lv_obj_flag_t f)
lv_state_t lv_obj_get_state(const lv_obj_t * obj)
bool lv_obj_has_state(const lv_obj_t * obj, lv_state_t state)
lv_group_t * lv_obj_get_group(const lv_obj_t * obj)
static inline void * lv_obj_get_user_data(lv_obj_t * obj)
void * lv_obj_get_user_data(lv_obj_t * obj)
void lv_obj_allocate_spec_attr(lv_obj_t * obj)
bool lv_obj_check_type(const lv_obj_t * obj, const lv_obj_class_t * class_p)
bool lv_obj_has_class(const lv_obj_t * obj, const lv_obj_class_t * class_p)
const lv_obj_class_t * lv_obj_get_class(const lv_obj_t * obj)
bool lv_obj_is_valid(const lv_obj_t * obj)
void lv_obj_null_on_delete(lv_obj_t ** obj_ptr)
void lv_obj_set_id(lv_obj_t * obj, void * id)
void * lv_obj_get_id(const lv_obj_t * obj)
lv_obj_t * lv_obj_get_child_by_id(const lv_obj_t * obj, const void * id)
void lv_obj_assign_id(const lv_obj_class_t * class_p, lv_obj_t * obj)
void lv_obj_free_id(lv_obj_t * obj)
int lv_obj_id_compare(const void * id1, const void * id2)
const char * lv_obj_stringify_id(lv_obj_t * obj, char * buf, uint32_t len)
void lv_objid_builtin_destroy(void)
@ -87,12 +93,12 @@ bool lv_obj_is_editable(lv_obj_t * obj)
bool lv_obj_is_group_def(lv_obj_t * obj)
// ../../lvgl/src/core/lv_obj_draw.h
void lv_obj_init_draw_rect_dsc(lv_obj_t * obj, uint32_t part, lv_draw_rect_dsc_t * draw_dsc)
void lv_obj_init_draw_label_dsc(lv_obj_t * obj, uint32_t part, lv_draw_label_dsc_t * draw_dsc)
void lv_obj_init_draw_image_dsc(lv_obj_t * obj, uint32_t part, lv_draw_image_dsc_t * draw_dsc)
void lv_obj_init_draw_line_dsc(lv_obj_t * obj, uint32_t part, lv_draw_line_dsc_t * draw_dsc)
void lv_obj_init_draw_arc_dsc(lv_obj_t * obj, uint32_t part, lv_draw_arc_dsc_t * draw_dsc)
int32_t lv_obj_calculate_ext_draw_size(lv_obj_t * obj, uint32_t part)
void lv_obj_init_draw_rect_dsc(lv_obj_t * obj, lv_part_t part, lv_draw_rect_dsc_t * draw_dsc)
void lv_obj_init_draw_label_dsc(lv_obj_t * obj, lv_part_t part, lv_draw_label_dsc_t * draw_dsc)
void lv_obj_init_draw_image_dsc(lv_obj_t * obj, lv_part_t part, lv_draw_image_dsc_t * draw_dsc)
void lv_obj_init_draw_line_dsc(lv_obj_t * obj, lv_part_t part, lv_draw_line_dsc_t * draw_dsc)
void lv_obj_init_draw_arc_dsc(lv_obj_t * obj, lv_part_t part, lv_draw_arc_dsc_t * draw_dsc)
int32_t lv_obj_calculate_ext_draw_size(lv_obj_t * obj, lv_part_t part)
void lv_obj_refresh_ext_draw_size(lv_obj_t * obj)
// ../../lvgl/src/core/lv_obj_event.h
@ -137,7 +143,7 @@ void lv_obj_update_layout(const lv_obj_t * obj)
void lv_obj_set_align(lv_obj_t * obj, lv_align_t align)
void lv_obj_align(lv_obj_t * obj, lv_align_t align, int32_t x_ofs, int32_t y_ofs)
void lv_obj_align_to(lv_obj_t * obj, const lv_obj_t * base, lv_align_t align, int32_t x_ofs, int32_t y_ofs)
static inline void lv_obj_center(lv_obj_t * obj)
void lv_obj_center(lv_obj_t * obj)
void lv_obj_get_coords(const lv_obj_t * obj, lv_area_t * coords)
int32_t lv_obj_get_x(const lv_obj_t * obj)
int32_t lv_obj_get_x2(const lv_obj_t * obj)
@ -169,8 +175,6 @@ bool lv_obj_hit_test(lv_obj_t * obj, const lv_point_t * point)
int32_t lv_clamp_width(int32_t width, int32_t min_width, int32_t max_width, int32_t ref_width)
int32_t lv_clamp_height(int32_t height, int32_t min_height, int32_t max_height, int32_t ref_height)
// ../../lvgl/src/core/lv_obj_property.h
// ../../lvgl/src/core/lv_obj_scroll.h
void lv_obj_set_scrollbar_mode(lv_obj_t * obj, lv_scrollbar_mode_t mode)
void lv_obj_set_scroll_dir(lv_obj_t * obj, lv_dir_t dir)
@ -213,6 +217,7 @@ bool lv_obj_has_style_prop(const lv_obj_t * obj, lv_style_selector_t selector, l
void lv_obj_set_local_style_prop(lv_obj_t * obj, lv_style_prop_t prop, lv_style_value_t value, lv_style_selector_t selector)
lv_style_res_t lv_obj_get_local_style_prop(lv_obj_t * obj, lv_style_prop_t prop, lv_style_value_t * value, lv_style_selector_t selector)
bool lv_obj_remove_local_style_prop(lv_obj_t * obj, lv_style_prop_t prop, lv_style_selector_t selector)
lv_style_value_t lv_obj_style_apply_color_filter(const lv_obj_t * obj, lv_part_t part, lv_style_value_t v)
void lv_obj_fade_in(lv_obj_t * obj, uint32_t time, uint32_t delay)
void lv_obj_fade_out(lv_obj_t * obj, uint32_t time, uint32_t delay)
static inline lv_state_t lv_obj_style_get_selector_state(lv_style_selector_t selector)
@ -226,136 +231,136 @@ static inline void lv_obj_set_style_margin_ver(lv_obj_t * obj, int32_t value, lv
static inline void lv_obj_set_style_pad_gap(lv_obj_t * obj, int32_t value, lv_style_selector_t selector)
static inline void lv_obj_set_style_size(lv_obj_t * obj, int32_t width, int32_t height, lv_style_selector_t selector)
static inline void lv_obj_set_style_transform_scale(lv_obj_t * obj, int32_t value, lv_style_selector_t selector)
static inline int32_t lv_obj_get_style_space_left(const lv_obj_t * obj, uint32_t part)
static inline int32_t lv_obj_get_style_space_right(const lv_obj_t * obj, uint32_t part)
static inline int32_t lv_obj_get_style_space_top(const lv_obj_t * obj, uint32_t part)
static inline int32_t lv_obj_get_style_space_bottom(const lv_obj_t * obj, uint32_t part)
static inline int32_t lv_obj_get_style_space_left(const lv_obj_t * obj, lv_part_t part)
static inline int32_t lv_obj_get_style_space_right(const lv_obj_t * obj, lv_part_t part)
static inline int32_t lv_obj_get_style_space_top(const lv_obj_t * obj, lv_part_t part)
static inline int32_t lv_obj_get_style_space_bottom(const lv_obj_t * obj, lv_part_t part)
lv_text_align_t lv_obj_calculate_style_text_align(const lv_obj_t * obj, lv_part_t part, const char * txt)
static inline int32_t lv_obj_get_style_transform_scale_x_safe(const lv_obj_t * obj, uint32_t part)
static inline int32_t lv_obj_get_style_transform_scale_y_safe(const lv_obj_t * obj, uint32_t part)
static inline int32_t lv_obj_get_style_transform_scale_x_safe(const lv_obj_t * obj, lv_part_t part)
static inline int32_t lv_obj_get_style_transform_scale_y_safe(const lv_obj_t * obj, lv_part_t part)
lv_opa_t lv_obj_get_style_opa_recursive(const lv_obj_t * obj, lv_part_t part)
// ../../lvgl/src/core/lv_obj_style_gen.h
static inline int32_t lv_obj_get_style_width(const lv_obj_t * obj, uint32_t part)
static inline int32_t lv_obj_get_style_min_width(const lv_obj_t * obj, uint32_t part)
static inline int32_t lv_obj_get_style_max_width(const lv_obj_t * obj, uint32_t part)
static inline int32_t lv_obj_get_style_height(const lv_obj_t * obj, uint32_t part)
static inline int32_t lv_obj_get_style_min_height(const lv_obj_t * obj, uint32_t part)
static inline int32_t lv_obj_get_style_max_height(const lv_obj_t * obj, uint32_t part)
static inline int32_t lv_obj_get_style_length(const lv_obj_t * obj, uint32_t part)
static inline int32_t lv_obj_get_style_x(const lv_obj_t * obj, uint32_t part)
static inline int32_t lv_obj_get_style_y(const lv_obj_t * obj, uint32_t part)
static inline lv_align_t lv_obj_get_style_align(const lv_obj_t * obj, uint32_t part)
static inline int32_t lv_obj_get_style_transform_width(const lv_obj_t * obj, uint32_t part)
static inline int32_t lv_obj_get_style_transform_height(const lv_obj_t * obj, uint32_t part)
static inline int32_t lv_obj_get_style_translate_x(const lv_obj_t * obj, uint32_t part)
static inline int32_t lv_obj_get_style_translate_y(const lv_obj_t * obj, uint32_t part)
static inline int32_t lv_obj_get_style_transform_scale_x(const lv_obj_t * obj, uint32_t part)
static inline int32_t lv_obj_get_style_transform_scale_y(const lv_obj_t * obj, uint32_t part)
static inline int32_t lv_obj_get_style_transform_rotation(const lv_obj_t * obj, uint32_t part)
static inline int32_t lv_obj_get_style_transform_pivot_x(const lv_obj_t * obj, uint32_t part)
static inline int32_t lv_obj_get_style_transform_pivot_y(const lv_obj_t * obj, uint32_t part)
static inline int32_t lv_obj_get_style_transform_skew_x(const lv_obj_t * obj, uint32_t part)
static inline int32_t lv_obj_get_style_transform_skew_y(const lv_obj_t * obj, uint32_t part)
static inline int32_t lv_obj_get_style_pad_top(const lv_obj_t * obj, uint32_t part)
static inline int32_t lv_obj_get_style_pad_bottom(const lv_obj_t * obj, uint32_t part)
static inline int32_t lv_obj_get_style_pad_left(const lv_obj_t * obj, uint32_t part)
static inline int32_t lv_obj_get_style_pad_right(const lv_obj_t * obj, uint32_t part)
static inline int32_t lv_obj_get_style_pad_row(const lv_obj_t * obj, uint32_t part)
static inline int32_t lv_obj_get_style_pad_column(const lv_obj_t * obj, uint32_t part)
static inline int32_t lv_obj_get_style_margin_top(const lv_obj_t * obj, uint32_t part)
static inline int32_t lv_obj_get_style_margin_bottom(const lv_obj_t * obj, uint32_t part)
static inline int32_t lv_obj_get_style_margin_left(const lv_obj_t * obj, uint32_t part)
static inline int32_t lv_obj_get_style_margin_right(const lv_obj_t * obj, uint32_t part)
static inline lv_color_t lv_obj_get_style_bg_color(const lv_obj_t * obj, uint32_t part)
static inline lv_color_t lv_obj_get_style_bg_color_filtered(const lv_obj_t * obj, uint32_t part)
static inline lv_opa_t lv_obj_get_style_bg_opa(const lv_obj_t * obj, uint32_t part)
static inline lv_color_t lv_obj_get_style_bg_grad_color(const lv_obj_t * obj, uint32_t part)
static inline lv_color_t lv_obj_get_style_bg_grad_color_filtered(const lv_obj_t * obj, uint32_t part)
static inline lv_grad_dir_t lv_obj_get_style_bg_grad_dir(const lv_obj_t * obj, uint32_t part)
static inline int32_t lv_obj_get_style_bg_main_stop(const lv_obj_t * obj, uint32_t part)
static inline int32_t lv_obj_get_style_bg_grad_stop(const lv_obj_t * obj, uint32_t part)
static inline lv_opa_t lv_obj_get_style_bg_main_opa(const lv_obj_t * obj, uint32_t part)
static inline lv_opa_t lv_obj_get_style_bg_grad_opa(const lv_obj_t * obj, uint32_t part)
static inline const lv_grad_dsc_t * lv_obj_get_style_bg_grad(const lv_obj_t * obj, uint32_t part)
static inline const void * lv_obj_get_style_bg_image_src(const lv_obj_t * obj, uint32_t part)
static inline lv_opa_t lv_obj_get_style_bg_image_opa(const lv_obj_t * obj, uint32_t part)
static inline lv_color_t lv_obj_get_style_bg_image_recolor(const lv_obj_t * obj, uint32_t part)
static inline lv_color_t lv_obj_get_style_bg_image_recolor_filtered(const lv_obj_t * obj, uint32_t part)
static inline lv_opa_t lv_obj_get_style_bg_image_recolor_opa(const lv_obj_t * obj, uint32_t part)
static inline bool lv_obj_get_style_bg_image_tiled(const lv_obj_t * obj, uint32_t part)
static inline lv_color_t lv_obj_get_style_border_color(const lv_obj_t * obj, uint32_t part)
static inline lv_color_t lv_obj_get_style_border_color_filtered(const lv_obj_t * obj, uint32_t part)
static inline lv_opa_t lv_obj_get_style_border_opa(const lv_obj_t * obj, uint32_t part)
static inline int32_t lv_obj_get_style_border_width(const lv_obj_t * obj, uint32_t part)
static inline lv_border_side_t lv_obj_get_style_border_side(const lv_obj_t * obj, uint32_t part)
static inline bool lv_obj_get_style_border_post(const lv_obj_t * obj, uint32_t part)
static inline int32_t lv_obj_get_style_outline_width(const lv_obj_t * obj, uint32_t part)
static inline lv_color_t lv_obj_get_style_outline_color(const lv_obj_t * obj, uint32_t part)
static inline lv_color_t lv_obj_get_style_outline_color_filtered(const lv_obj_t * obj, uint32_t part)
static inline lv_opa_t lv_obj_get_style_outline_opa(const lv_obj_t * obj, uint32_t part)
static inline int32_t lv_obj_get_style_outline_pad(const lv_obj_t * obj, uint32_t part)
static inline int32_t lv_obj_get_style_shadow_width(const lv_obj_t * obj, uint32_t part)
static inline int32_t lv_obj_get_style_shadow_offset_x(const lv_obj_t * obj, uint32_t part)
static inline int32_t lv_obj_get_style_shadow_offset_y(const lv_obj_t * obj, uint32_t part)
static inline int32_t lv_obj_get_style_shadow_spread(const lv_obj_t * obj, uint32_t part)
static inline lv_color_t lv_obj_get_style_shadow_color(const lv_obj_t * obj, uint32_t part)
static inline lv_color_t lv_obj_get_style_shadow_color_filtered(const lv_obj_t * obj, uint32_t part)
static inline lv_opa_t lv_obj_get_style_shadow_opa(const lv_obj_t * obj, uint32_t part)
static inline lv_opa_t lv_obj_get_style_image_opa(const lv_obj_t * obj, uint32_t part)
static inline lv_color_t lv_obj_get_style_image_recolor(const lv_obj_t * obj, uint32_t part)
static inline lv_color_t lv_obj_get_style_image_recolor_filtered(const lv_obj_t * obj, uint32_t part)
static inline lv_opa_t lv_obj_get_style_image_recolor_opa(const lv_obj_t * obj, uint32_t part)
static inline int32_t lv_obj_get_style_line_width(const lv_obj_t * obj, uint32_t part)
static inline int32_t lv_obj_get_style_line_dash_width(const lv_obj_t * obj, uint32_t part)
static inline int32_t lv_obj_get_style_line_dash_gap(const lv_obj_t * obj, uint32_t part)
static inline bool lv_obj_get_style_line_rounded(const lv_obj_t * obj, uint32_t part)
static inline lv_color_t lv_obj_get_style_line_color(const lv_obj_t * obj, uint32_t part)
static inline lv_color_t lv_obj_get_style_line_color_filtered(const lv_obj_t * obj, uint32_t part)
static inline lv_opa_t lv_obj_get_style_line_opa(const lv_obj_t * obj, uint32_t part)
static inline int32_t lv_obj_get_style_arc_width(const lv_obj_t * obj, uint32_t part)
static inline bool lv_obj_get_style_arc_rounded(const lv_obj_t * obj, uint32_t part)
static inline lv_color_t lv_obj_get_style_arc_color(const lv_obj_t * obj, uint32_t part)
static inline lv_color_t lv_obj_get_style_arc_color_filtered(const lv_obj_t * obj, uint32_t part)
static inline lv_opa_t lv_obj_get_style_arc_opa(const lv_obj_t * obj, uint32_t part)
static inline const void * lv_obj_get_style_arc_image_src(const lv_obj_t * obj, uint32_t part)
static inline lv_color_t lv_obj_get_style_text_color(const lv_obj_t * obj, uint32_t part)
static inline lv_color_t lv_obj_get_style_text_color_filtered(const lv_obj_t * obj, uint32_t part)
static inline lv_opa_t lv_obj_get_style_text_opa(const lv_obj_t * obj, uint32_t part)
static inline const lv_font_t * lv_obj_get_style_text_font(const lv_obj_t * obj, uint32_t part)
static inline int32_t lv_obj_get_style_text_letter_space(const lv_obj_t * obj, uint32_t part)
static inline int32_t lv_obj_get_style_text_line_space(const lv_obj_t * obj, uint32_t part)
static inline lv_text_decor_t lv_obj_get_style_text_decor(const lv_obj_t * obj, uint32_t part)
static inline lv_text_align_t lv_obj_get_style_text_align(const lv_obj_t * obj, uint32_t part)
static inline int32_t lv_obj_get_style_radius(const lv_obj_t * obj, uint32_t part)
static inline bool lv_obj_get_style_clip_corner(const lv_obj_t * obj, uint32_t part)
static inline lv_opa_t lv_obj_get_style_opa(const lv_obj_t * obj, uint32_t part)
static inline lv_opa_t lv_obj_get_style_opa_layered(const lv_obj_t * obj, uint32_t part)
static inline const lv_color_filter_dsc_t * lv_obj_get_style_color_filter_dsc(const lv_obj_t * obj, uint32_t part)
static inline lv_opa_t lv_obj_get_style_color_filter_opa(const lv_obj_t * obj, uint32_t part)
static inline const lv_anim_t * lv_obj_get_style_anim(const lv_obj_t * obj, uint32_t part)
static inline uint32_t lv_obj_get_style_anim_duration(const lv_obj_t * obj, uint32_t part)
static inline const lv_style_transition_dsc_t * lv_obj_get_style_transition(const lv_obj_t * obj, uint32_t part)
static inline lv_blend_mode_t lv_obj_get_style_blend_mode(const lv_obj_t * obj, uint32_t part)
static inline uint16_t lv_obj_get_style_layout(const lv_obj_t * obj, uint32_t part)
static inline lv_base_dir_t lv_obj_get_style_base_dir(const lv_obj_t * obj, uint32_t part)
static inline const lv_image_dsc_t * lv_obj_get_style_bitmap_mask_src(const lv_obj_t * obj, uint32_t part)
static inline uint32_t lv_obj_get_style_rotary_sensitivity(const lv_obj_t * obj, uint32_t part)
static inline lv_flex_flow_t lv_obj_get_style_flex_flow(const lv_obj_t * obj, uint32_t part)
static inline lv_flex_align_t lv_obj_get_style_flex_main_place(const lv_obj_t * obj, uint32_t part)
static inline lv_flex_align_t lv_obj_get_style_flex_cross_place(const lv_obj_t * obj, uint32_t part)
static inline lv_flex_align_t lv_obj_get_style_flex_track_place(const lv_obj_t * obj, uint32_t part)
static inline uint8_t lv_obj_get_style_flex_grow(const lv_obj_t * obj, uint32_t part)
static inline const int32_t * lv_obj_get_style_grid_column_dsc_array(const lv_obj_t * obj, uint32_t part)
static inline lv_grid_align_t lv_obj_get_style_grid_column_align(const lv_obj_t * obj, uint32_t part)
static inline const int32_t * lv_obj_get_style_grid_row_dsc_array(const lv_obj_t * obj, uint32_t part)
static inline lv_grid_align_t lv_obj_get_style_grid_row_align(const lv_obj_t * obj, uint32_t part)
static inline int32_t lv_obj_get_style_grid_cell_column_pos(const lv_obj_t * obj, uint32_t part)
static inline lv_grid_align_t lv_obj_get_style_grid_cell_x_align(const lv_obj_t * obj, uint32_t part)
static inline int32_t lv_obj_get_style_grid_cell_column_span(const lv_obj_t * obj, uint32_t part)
static inline int32_t lv_obj_get_style_grid_cell_row_pos(const lv_obj_t * obj, uint32_t part)
static inline lv_grid_align_t lv_obj_get_style_grid_cell_y_align(const lv_obj_t * obj, uint32_t part)
static inline int32_t lv_obj_get_style_grid_cell_row_span(const lv_obj_t * obj, uint32_t part)
static inline int32_t lv_obj_get_style_width(const lv_obj_t * obj, lv_part_t part)
static inline int32_t lv_obj_get_style_min_width(const lv_obj_t * obj, lv_part_t part)
static inline int32_t lv_obj_get_style_max_width(const lv_obj_t * obj, lv_part_t part)
static inline int32_t lv_obj_get_style_height(const lv_obj_t * obj, lv_part_t part)
static inline int32_t lv_obj_get_style_min_height(const lv_obj_t * obj, lv_part_t part)
static inline int32_t lv_obj_get_style_max_height(const lv_obj_t * obj, lv_part_t part)
static inline int32_t lv_obj_get_style_length(const lv_obj_t * obj, lv_part_t part)
static inline int32_t lv_obj_get_style_x(const lv_obj_t * obj, lv_part_t part)
static inline int32_t lv_obj_get_style_y(const lv_obj_t * obj, lv_part_t part)
static inline lv_align_t lv_obj_get_style_align(const lv_obj_t * obj, lv_part_t part)
static inline int32_t lv_obj_get_style_transform_width(const lv_obj_t * obj, lv_part_t part)
static inline int32_t lv_obj_get_style_transform_height(const lv_obj_t * obj, lv_part_t part)
static inline int32_t lv_obj_get_style_translate_x(const lv_obj_t * obj, lv_part_t part)
static inline int32_t lv_obj_get_style_translate_y(const lv_obj_t * obj, lv_part_t part)
static inline int32_t lv_obj_get_style_transform_scale_x(const lv_obj_t * obj, lv_part_t part)
static inline int32_t lv_obj_get_style_transform_scale_y(const lv_obj_t * obj, lv_part_t part)
static inline int32_t lv_obj_get_style_transform_rotation(const lv_obj_t * obj, lv_part_t part)
static inline int32_t lv_obj_get_style_transform_pivot_x(const lv_obj_t * obj, lv_part_t part)
static inline int32_t lv_obj_get_style_transform_pivot_y(const lv_obj_t * obj, lv_part_t part)
static inline int32_t lv_obj_get_style_transform_skew_x(const lv_obj_t * obj, lv_part_t part)
static inline int32_t lv_obj_get_style_transform_skew_y(const lv_obj_t * obj, lv_part_t part)
static inline int32_t lv_obj_get_style_pad_top(const lv_obj_t * obj, lv_part_t part)
static inline int32_t lv_obj_get_style_pad_bottom(const lv_obj_t * obj, lv_part_t part)
static inline int32_t lv_obj_get_style_pad_left(const lv_obj_t * obj, lv_part_t part)
static inline int32_t lv_obj_get_style_pad_right(const lv_obj_t * obj, lv_part_t part)
static inline int32_t lv_obj_get_style_pad_row(const lv_obj_t * obj, lv_part_t part)
static inline int32_t lv_obj_get_style_pad_column(const lv_obj_t * obj, lv_part_t part)
static inline int32_t lv_obj_get_style_margin_top(const lv_obj_t * obj, lv_part_t part)
static inline int32_t lv_obj_get_style_margin_bottom(const lv_obj_t * obj, lv_part_t part)
static inline int32_t lv_obj_get_style_margin_left(const lv_obj_t * obj, lv_part_t part)
static inline int32_t lv_obj_get_style_margin_right(const lv_obj_t * obj, lv_part_t part)
static inline lv_color_t lv_obj_get_style_bg_color(const lv_obj_t * obj, lv_part_t part)
static inline lv_color_t lv_obj_get_style_bg_color_filtered(const lv_obj_t * obj, lv_part_t part)
static inline lv_opa_t lv_obj_get_style_bg_opa(const lv_obj_t * obj, lv_part_t part)
static inline lv_color_t lv_obj_get_style_bg_grad_color(const lv_obj_t * obj, lv_part_t part)
static inline lv_color_t lv_obj_get_style_bg_grad_color_filtered(const lv_obj_t * obj, lv_part_t part)
static inline lv_grad_dir_t lv_obj_get_style_bg_grad_dir(const lv_obj_t * obj, lv_part_t part)
static inline int32_t lv_obj_get_style_bg_main_stop(const lv_obj_t * obj, lv_part_t part)
static inline int32_t lv_obj_get_style_bg_grad_stop(const lv_obj_t * obj, lv_part_t part)
static inline lv_opa_t lv_obj_get_style_bg_main_opa(const lv_obj_t * obj, lv_part_t part)
static inline lv_opa_t lv_obj_get_style_bg_grad_opa(const lv_obj_t * obj, lv_part_t part)
static inline const lv_grad_dsc_t * lv_obj_get_style_bg_grad(const lv_obj_t * obj, lv_part_t part)
static inline const void * lv_obj_get_style_bg_image_src(const lv_obj_t * obj, lv_part_t part)
static inline lv_opa_t lv_obj_get_style_bg_image_opa(const lv_obj_t * obj, lv_part_t part)
static inline lv_color_t lv_obj_get_style_bg_image_recolor(const lv_obj_t * obj, lv_part_t part)
static inline lv_color_t lv_obj_get_style_bg_image_recolor_filtered(const lv_obj_t * obj, lv_part_t part)
static inline lv_opa_t lv_obj_get_style_bg_image_recolor_opa(const lv_obj_t * obj, lv_part_t part)
static inline bool lv_obj_get_style_bg_image_tiled(const lv_obj_t * obj, lv_part_t part)
static inline lv_color_t lv_obj_get_style_border_color(const lv_obj_t * obj, lv_part_t part)
static inline lv_color_t lv_obj_get_style_border_color_filtered(const lv_obj_t * obj, lv_part_t part)
static inline lv_opa_t lv_obj_get_style_border_opa(const lv_obj_t * obj, lv_part_t part)
static inline int32_t lv_obj_get_style_border_width(const lv_obj_t * obj, lv_part_t part)
static inline lv_border_side_t lv_obj_get_style_border_side(const lv_obj_t * obj, lv_part_t part)
static inline bool lv_obj_get_style_border_post(const lv_obj_t * obj, lv_part_t part)
static inline int32_t lv_obj_get_style_outline_width(const lv_obj_t * obj, lv_part_t part)
static inline lv_color_t lv_obj_get_style_outline_color(const lv_obj_t * obj, lv_part_t part)
static inline lv_color_t lv_obj_get_style_outline_color_filtered(const lv_obj_t * obj, lv_part_t part)
static inline lv_opa_t lv_obj_get_style_outline_opa(const lv_obj_t * obj, lv_part_t part)
static inline int32_t lv_obj_get_style_outline_pad(const lv_obj_t * obj, lv_part_t part)
static inline int32_t lv_obj_get_style_shadow_width(const lv_obj_t * obj, lv_part_t part)
static inline int32_t lv_obj_get_style_shadow_offset_x(const lv_obj_t * obj, lv_part_t part)
static inline int32_t lv_obj_get_style_shadow_offset_y(const lv_obj_t * obj, lv_part_t part)
static inline int32_t lv_obj_get_style_shadow_spread(const lv_obj_t * obj, lv_part_t part)
static inline lv_color_t lv_obj_get_style_shadow_color(const lv_obj_t * obj, lv_part_t part)
static inline lv_color_t lv_obj_get_style_shadow_color_filtered(const lv_obj_t * obj, lv_part_t part)
static inline lv_opa_t lv_obj_get_style_shadow_opa(const lv_obj_t * obj, lv_part_t part)
static inline lv_opa_t lv_obj_get_style_image_opa(const lv_obj_t * obj, lv_part_t part)
static inline lv_color_t lv_obj_get_style_image_recolor(const lv_obj_t * obj, lv_part_t part)
static inline lv_color_t lv_obj_get_style_image_recolor_filtered(const lv_obj_t * obj, lv_part_t part)
static inline lv_opa_t lv_obj_get_style_image_recolor_opa(const lv_obj_t * obj, lv_part_t part)
static inline int32_t lv_obj_get_style_line_width(const lv_obj_t * obj, lv_part_t part)
static inline int32_t lv_obj_get_style_line_dash_width(const lv_obj_t * obj, lv_part_t part)
static inline int32_t lv_obj_get_style_line_dash_gap(const lv_obj_t * obj, lv_part_t part)
static inline bool lv_obj_get_style_line_rounded(const lv_obj_t * obj, lv_part_t part)
static inline lv_color_t lv_obj_get_style_line_color(const lv_obj_t * obj, lv_part_t part)
static inline lv_color_t lv_obj_get_style_line_color_filtered(const lv_obj_t * obj, lv_part_t part)
static inline lv_opa_t lv_obj_get_style_line_opa(const lv_obj_t * obj, lv_part_t part)
static inline int32_t lv_obj_get_style_arc_width(const lv_obj_t * obj, lv_part_t part)
static inline bool lv_obj_get_style_arc_rounded(const lv_obj_t * obj, lv_part_t part)
static inline lv_color_t lv_obj_get_style_arc_color(const lv_obj_t * obj, lv_part_t part)
static inline lv_color_t lv_obj_get_style_arc_color_filtered(const lv_obj_t * obj, lv_part_t part)
static inline lv_opa_t lv_obj_get_style_arc_opa(const lv_obj_t * obj, lv_part_t part)
static inline const void * lv_obj_get_style_arc_image_src(const lv_obj_t * obj, lv_part_t part)
static inline lv_color_t lv_obj_get_style_text_color(const lv_obj_t * obj, lv_part_t part)
static inline lv_color_t lv_obj_get_style_text_color_filtered(const lv_obj_t * obj, lv_part_t part)
static inline lv_opa_t lv_obj_get_style_text_opa(const lv_obj_t * obj, lv_part_t part)
static inline const lv_font_t * lv_obj_get_style_text_font(const lv_obj_t * obj, lv_part_t part)
static inline int32_t lv_obj_get_style_text_letter_space(const lv_obj_t * obj, lv_part_t part)
static inline int32_t lv_obj_get_style_text_line_space(const lv_obj_t * obj, lv_part_t part)
static inline lv_text_decor_t lv_obj_get_style_text_decor(const lv_obj_t * obj, lv_part_t part)
static inline lv_text_align_t lv_obj_get_style_text_align(const lv_obj_t * obj, lv_part_t part)
static inline int32_t lv_obj_get_style_radius(const lv_obj_t * obj, lv_part_t part)
static inline bool lv_obj_get_style_clip_corner(const lv_obj_t * obj, lv_part_t part)
static inline lv_opa_t lv_obj_get_style_opa(const lv_obj_t * obj, lv_part_t part)
static inline lv_opa_t lv_obj_get_style_opa_layered(const lv_obj_t * obj, lv_part_t part)
static inline const lv_color_filter_dsc_t * lv_obj_get_style_color_filter_dsc(const lv_obj_t * obj, lv_part_t part)
static inline lv_opa_t lv_obj_get_style_color_filter_opa(const lv_obj_t * obj, lv_part_t part)
static inline const lv_anim_t * lv_obj_get_style_anim(const lv_obj_t * obj, lv_part_t part)
static inline uint32_t lv_obj_get_style_anim_duration(const lv_obj_t * obj, lv_part_t part)
static inline const lv_style_transition_dsc_t * lv_obj_get_style_transition(const lv_obj_t * obj, lv_part_t part)
static inline lv_blend_mode_t lv_obj_get_style_blend_mode(const lv_obj_t * obj, lv_part_t part)
static inline uint16_t lv_obj_get_style_layout(const lv_obj_t * obj, lv_part_t part)
static inline lv_base_dir_t lv_obj_get_style_base_dir(const lv_obj_t * obj, lv_part_t part)
static inline const void * lv_obj_get_style_bitmap_mask_src(const lv_obj_t * obj, lv_part_t part)
static inline uint32_t lv_obj_get_style_rotary_sensitivity(const lv_obj_t * obj, lv_part_t part)
static inline lv_flex_flow_t lv_obj_get_style_flex_flow(const lv_obj_t * obj, lv_part_t part)
static inline lv_flex_align_t lv_obj_get_style_flex_main_place(const lv_obj_t * obj, lv_part_t part)
static inline lv_flex_align_t lv_obj_get_style_flex_cross_place(const lv_obj_t * obj, lv_part_t part)
static inline lv_flex_align_t lv_obj_get_style_flex_track_place(const lv_obj_t * obj, lv_part_t part)
static inline uint8_t lv_obj_get_style_flex_grow(const lv_obj_t * obj, lv_part_t part)
static inline const int32_t * lv_obj_get_style_grid_column_dsc_array(const lv_obj_t * obj, lv_part_t part)
static inline lv_grid_align_t lv_obj_get_style_grid_column_align(const lv_obj_t * obj, lv_part_t part)
static inline const int32_t * lv_obj_get_style_grid_row_dsc_array(const lv_obj_t * obj, lv_part_t part)
static inline lv_grid_align_t lv_obj_get_style_grid_row_align(const lv_obj_t * obj, lv_part_t part)
static inline int32_t lv_obj_get_style_grid_cell_column_pos(const lv_obj_t * obj, lv_part_t part)
static inline lv_grid_align_t lv_obj_get_style_grid_cell_x_align(const lv_obj_t * obj, lv_part_t part)
static inline int32_t lv_obj_get_style_grid_cell_column_span(const lv_obj_t * obj, lv_part_t part)
static inline int32_t lv_obj_get_style_grid_cell_row_pos(const lv_obj_t * obj, lv_part_t part)
static inline lv_grid_align_t lv_obj_get_style_grid_cell_y_align(const lv_obj_t * obj, lv_part_t part)
static inline int32_t lv_obj_get_style_grid_cell_row_span(const lv_obj_t * obj, lv_part_t part)
void lv_obj_set_style_width(lv_obj_t * obj, int32_t value, lv_style_selector_t selector)
void lv_obj_set_style_min_width(lv_obj_t * obj, int32_t value, lv_style_selector_t selector)
void lv_obj_set_style_max_width(lv_obj_t * obj, int32_t value, lv_style_selector_t selector)
@ -449,7 +454,7 @@ void lv_obj_set_style_transition(lv_obj_t * obj, const lv_style_transition_dsc_t
void lv_obj_set_style_blend_mode(lv_obj_t * obj, lv_blend_mode_t value, lv_style_selector_t selector)
void lv_obj_set_style_layout(lv_obj_t * obj, uint16_t value, lv_style_selector_t selector)
void lv_obj_set_style_base_dir(lv_obj_t * obj, lv_base_dir_t value, lv_style_selector_t selector)
void lv_obj_set_style_bitmap_mask_src(lv_obj_t * obj, const lv_image_dsc_t * value, lv_style_selector_t selector)
void lv_obj_set_style_bitmap_mask_src(lv_obj_t * obj, const void * value, lv_style_selector_t selector)
void lv_obj_set_style_rotary_sensitivity(lv_obj_t * obj, uint32_t value, lv_style_selector_t selector)
void lv_obj_set_style_flex_flow(lv_obj_t * obj, lv_flex_flow_t value, lv_style_selector_t selector)
void lv_obj_set_style_flex_main_place(lv_obj_t * obj, lv_flex_align_t value, lv_style_selector_t selector)
@ -488,7 +493,7 @@ uint32_t lv_obj_get_child_count_by_type(const lv_obj_t * obj, const lv_obj_class
int32_t lv_obj_get_index(const lv_obj_t * obj)
int32_t lv_obj_get_index_by_type(const lv_obj_t * obj, const lv_obj_class_t * class_p)
void lv_obj_tree_walk(lv_obj_t * start_obj, lv_obj_tree_walk_cb_t cb, void * user_data)
void lv_obj_dump_tree(lv_obj_t * start_ob)
void lv_obj_dump_tree(lv_obj_t * start_obj)
// ../../lvgl/src/core/lv_refr.h
void lv_refr_now(lv_display_t * disp)
@ -528,12 +533,12 @@ lv_obj_t * lv_display_get_screen_prev(lv_display_t * disp)
lv_obj_t * lv_display_get_layer_top(lv_display_t * disp)
lv_obj_t * lv_display_get_layer_sys(lv_display_t * disp)
lv_obj_t * lv_display_get_layer_bottom(lv_display_t * disp)
void lv_screen_load(struct _lv_obj_t * scr)
void lv_screen_load(struct lv_obj_t * scr)
void lv_screen_load_anim(lv_obj_t * scr, lv_screen_load_anim_t anim_type, uint32_t time, uint32_t delay, bool auto_del)
static inline lv_obj_t * lv_screen_active(void)
static inline lv_obj_t * lv_layer_top(void)
static inline lv_obj_t * lv_layer_sys(void)
static inline lv_obj_t * lv_layer_bottom(void)
lv_obj_t * lv_screen_active(void)
lv_obj_t * lv_layer_top(void)
lv_obj_t * lv_layer_sys(void)
lv_obj_t * lv_layer_bottom(void)
void lv_display_add_event_cb(lv_display_t * disp, lv_event_cb_t event_cb, lv_event_code_t filter, void * user_data)
uint32_t lv_display_get_event_count(lv_display_t * disp)
lv_event_dsc_t * lv_display_get_event_dsc(lv_display_t * disp, uint32_t index)
@ -553,10 +558,9 @@ void lv_display_set_driver_data(lv_display_t * disp, void * driver_data)
void * lv_display_get_user_data(lv_display_t * disp)
void * lv_display_get_driver_data(lv_display_t * disp)
lv_draw_buf_t * lv_display_get_buf_active(lv_display_t * disp)
static inline int32_t lv_dpx(int32_t n)
static inline int32_t lv_display_dpx(const lv_display_t * disp, int32_t n)
// ../../lvgl/src/display/lv_display_private.h
void lv_display_rotate_area(lv_display_t * disp, lv_area_t * area)
int32_t lv_dpx(int32_t n)
int32_t lv_display_dpx(const lv_display_t * disp, int32_t n)
// ../../lvgl/src/draw/lv_draw.h
void lv_draw_init(void)
@ -567,12 +571,17 @@ void lv_draw_finalize_task_creation(lv_layer_t * layer, lv_draw_task_t * t)
void lv_draw_dispatch(void)
bool lv_draw_dispatch_layer(lv_display_t * disp, lv_layer_t * layer)
void lv_draw_dispatch_wait_for_request(void)
void lv_draw_wait_for_finish(void)
void lv_draw_dispatch_request(void)
uint32_t lv_draw_get_unit_count(void)
lv_draw_task_t * lv_draw_get_next_available_task(lv_layer_t * layer, lv_draw_task_t * t_prev, uint8_t draw_unit_id)
uint32_t lv_draw_get_dependent_count(lv_draw_task_t * t_check)
lv_layer_t * lv_draw_layer_create(lv_layer_t * parent_layer, lv_color_format_t color_format, const lv_area_t * area)
void * lv_draw_layer_alloc_buf(lv_layer_t * layer)
void * lv_draw_layer_go_to_xy(lv_layer_t * layer, int32_t x, int32_t y)
lv_draw_task_type_t lv_draw_task_get_type(const lv_draw_task_t * t)
void * lv_draw_task_get_draw_dsc(const lv_draw_task_t * t)
void lv_draw_task_get_area(const lv_draw_task_t * t, lv_area_t * area)
// ../../lvgl/src/draw/lv_draw_arc.h
void lv_draw_arc_dsc_init(lv_draw_arc_dsc_t * dsc)
@ -614,10 +623,11 @@ lv_draw_triangle_dsc_t * lv_draw_task_get_triangle_dsc(lv_draw_task_t * task)
void lv_draw_triangle(lv_layer_t * layer, const lv_draw_triangle_dsc_t * draw_dsc)
// ../../lvgl/src/font/lv_font.h
const void * lv_font_get_glyph_bitmap(lv_font_glyph_dsc_t * g_dsc, uint32_t letter, lv_draw_buf_t * draw_buf)
const void * lv_font_get_glyph_bitmap(lv_font_glyph_dsc_t * g_dsc, lv_draw_buf_t * draw_buf)
bool lv_font_get_glyph_dsc(const lv_font_t * font, lv_font_glyph_dsc_t * dsc_out, uint32_t letter, uint32_t letter_next)
void lv_font_glyph_release_draw_data(lv_font_glyph_dsc_t * g_dsc)
uint16_t lv_font_get_glyph_width(const lv_font_t * font, uint32_t letter, uint32_t letter_next)
static inline int32_t lv_font_get_line_height(const lv_font_t * font)
int32_t lv_font_get_line_height(const lv_font_t * font)
void lv_font_set_kerning(lv_font_t * font, lv_font_kerning_t kerning)
// ../../lvgl/src/indev/lv_indev.h
@ -632,7 +642,10 @@ void lv_indev_set_type(lv_indev_t * indev, lv_indev_type_t indev_type)
void lv_indev_set_read_cb(lv_indev_t * indev, lv_indev_read_cb_t read_cb)
void lv_indev_set_user_data(lv_indev_t * indev, void * user_data)
void lv_indev_set_driver_data(lv_indev_t * indev, void * driver_data)
void lv_indev_set_display(lv_indev_t * indev, struct _lv_display_t * disp)
void lv_indev_set_display(lv_indev_t * indev, struct lv_display_t * disp)
void lv_indev_set_long_press_time(lv_indev_t * indev, uint16_t long_press_time)
void lv_indev_set_scroll_limit(lv_indev_t * indev, uint8_t scroll_limit)
void lv_indev_set_scroll_throw(lv_indev_t * indev, uint8_t scroll_throw)
lv_indev_type_t lv_indev_get_type(const lv_indev_t * indev)
lv_indev_read_cb_t lv_indev_get_read_cb(lv_indev_t * indev)
lv_indev_state_t lv_indev_get_state(const lv_indev_t * indev)
@ -640,7 +653,9 @@ lv_group_t * lv_indev_get_group(const lv_indev_t * indev)
lv_display_t * lv_indev_get_display(const lv_indev_t * indev)
void * lv_indev_get_user_data(const lv_indev_t * indev)
void * lv_indev_get_driver_data(const lv_indev_t * indev)
bool lv_indev_get_press_moved(const lv_indev_t * indev)
void lv_indev_reset(lv_indev_t * indev, lv_obj_t * obj)
void lv_indev_stop_processing(lv_indev_t * indev)
void lv_indev_reset_long_press(lv_indev_t * indev)
void lv_indev_set_cursor(lv_indev_t * indev, lv_obj_t * cur_obj)
void lv_indev_set_group(lv_indev_t * indev, lv_group_t * group)
@ -675,7 +690,7 @@ void lv_grid_init(void)
void lv_obj_set_grid_dsc_array(lv_obj_t * obj, const int32_t col_dsc[], const int32_t row_dsc[])
void lv_obj_set_grid_align(lv_obj_t * obj, lv_grid_align_t column_align, lv_grid_align_t row_align)
void lv_obj_set_grid_cell(lv_obj_t * obj, lv_grid_align_t column_align, int32_t col_pos, int32_t col_span, lv_grid_align_t row_align, int32_t row_pos, int32_t row_span)
static inline int32_t lv_grid_fr(uint8_t x)
int32_t lv_grid_fr(uint8_t x)
// ../../lvgl/src/libs/qrcode/lv_qrcode.h
lv_obj_t * lv_qrcode_create(lv_obj_t * parent)
@ -691,50 +706,53 @@ static inline void lv_obj_move_background(lv_obj_t * obj)
// ../../lvgl/src/lv_api_map_v9_0.h
// ../../lvgl/src/lv_api_map_v9_1.h
// ../../lvgl/src/misc/lv_anim.h
void lv_anim_init(lv_anim_t * a)
static inline void lv_anim_set_var(lv_anim_t * a, void * var)
static inline void lv_anim_set_exec_cb(lv_anim_t * a, lv_anim_exec_xcb_t exec_cb)
static inline void lv_anim_set_duration(lv_anim_t * a, uint32_t duration)
static inline void lv_anim_set_time(lv_anim_t * a, uint32_t duration)
static inline void lv_anim_set_delay(lv_anim_t * a, uint32_t delay)
static inline void lv_anim_set_values(lv_anim_t * a, int32_t start, int32_t end)
static inline void lv_anim_set_custom_exec_cb(lv_anim_t * a, lv_anim_custom_exec_cb_t exec_cb)
static inline void lv_anim_set_path_cb(lv_anim_t * a, lv_anim_path_cb_t path_cb)
static inline void lv_anim_set_start_cb(lv_anim_t * a, lv_anim_start_cb_t start_cb)
static inline void lv_anim_set_get_value_cb(lv_anim_t * a, lv_anim_get_value_cb_t get_value_cb)
static inline void lv_anim_set_completed_cb(lv_anim_t * a, lv_anim_completed_cb_t completed_cb)
static inline void lv_anim_set_deleted_cb(lv_anim_t * a, lv_anim_deleted_cb_t deleted_cb)
static inline void lv_anim_set_playback_duration(lv_anim_t * a, uint32_t duration)
static inline void lv_anim_set_playback_time(lv_anim_t * a, uint32_t duration)
static inline void lv_anim_set_playback_delay(lv_anim_t * a, uint32_t delay)
static inline void lv_anim_set_repeat_count(lv_anim_t * a, uint16_t cnt)
static inline void lv_anim_set_repeat_delay(lv_anim_t * a, uint32_t delay)
static inline void lv_anim_set_early_apply(lv_anim_t * a, bool en)
static inline void lv_anim_set_user_data(lv_anim_t * a, void * user_data)
static inline void lv_anim_set_bezier3_param(lv_anim_t * a, int16_t x1, int16_t y1, int16_t x2, int16_t y2)
void lv_anim_set_var(lv_anim_t * a, void * var)
void lv_anim_set_exec_cb(lv_anim_t * a, lv_anim_exec_xcb_t exec_cb)
void lv_anim_set_duration(lv_anim_t * a, uint32_t duration)
void lv_anim_set_time(lv_anim_t * a, uint32_t duration)
void lv_anim_set_delay(lv_anim_t * a, uint32_t delay)
void lv_anim_set_values(lv_anim_t * a, int32_t start, int32_t end)
void lv_anim_set_custom_exec_cb(lv_anim_t * a, lv_anim_custom_exec_cb_t exec_cb)
void lv_anim_set_path_cb(lv_anim_t * a, lv_anim_path_cb_t path_cb)
void lv_anim_set_start_cb(lv_anim_t * a, lv_anim_start_cb_t start_cb)
void lv_anim_set_get_value_cb(lv_anim_t * a, lv_anim_get_value_cb_t get_value_cb)
void lv_anim_set_completed_cb(lv_anim_t * a, lv_anim_completed_cb_t completed_cb)
void lv_anim_set_deleted_cb(lv_anim_t * a, lv_anim_deleted_cb_t deleted_cb)
void lv_anim_set_playback_duration(lv_anim_t * a, uint32_t duration)
void lv_anim_set_playback_time(lv_anim_t * a, uint32_t duration)
void lv_anim_set_playback_delay(lv_anim_t * a, uint32_t delay)
void lv_anim_set_repeat_count(lv_anim_t * a, uint32_t cnt)
void lv_anim_set_repeat_delay(lv_anim_t * a, uint32_t delay)
void lv_anim_set_early_apply(lv_anim_t * a, bool en)
void lv_anim_set_user_data(lv_anim_t * a, void * user_data)
void lv_anim_set_bezier3_param(lv_anim_t * a, int16_t x1, int16_t y1, int16_t x2, int16_t y2)
lv_anim_t * lv_anim_start(const lv_anim_t * a)
static inline uint32_t lv_anim_get_delay(const lv_anim_t * a)
uint32_t lv_anim_get_delay(const lv_anim_t * a)
uint32_t lv_anim_get_playtime(const lv_anim_t * a)
static inline uint32_t lv_anim_get_time(const lv_anim_t * a)
static inline uint16_t lv_anim_get_repeat_count(const lv_anim_t * a)
static inline void * lv_anim_get_user_data(const lv_anim_t * a)
uint32_t lv_anim_get_time(const lv_anim_t * a)
uint32_t lv_anim_get_repeat_count(const lv_anim_t * a)
void * lv_anim_get_user_data(const lv_anim_t * a)
bool lv_anim_delete(void * var, lv_anim_exec_xcb_t exec_cb)
void lv_anim_delete_all(void)
lv_anim_t * lv_anim_get(void * var, lv_anim_exec_xcb_t exec_cb)
lv_timer_t * lv_anim_get_timer(void)
static inline bool lv_anim_custom_delete(lv_anim_t * a, lv_anim_custom_exec_cb_t exec_cb)
static inline lv_anim_t * lv_anim_custom_get(lv_anim_t * a, lv_anim_custom_exec_cb_t exec_cb)
bool lv_anim_custom_delete(lv_anim_t * a, lv_anim_custom_exec_cb_t exec_cb)
lv_anim_t * lv_anim_custom_get(lv_anim_t * a, lv_anim_custom_exec_cb_t exec_cb)
uint16_t lv_anim_count_running(void)
uint32_t lv_anim_speed(uint32_t speed)
uint32_t lv_anim_speed_clamped(uint32_t speed, uint32_t min_time, uint32_t max_time)
uint32_t lv_anim_speed_to_time(uint32_t speed, int32_t start, int32_t end)
void lv_anim_refr_now(void)
// ../../lvgl/src/misc/lv_area.h
void lv_area_set(lv_area_t * area_p, int32_t x1, int32_t y1, int32_t x2, int32_t y2)
inline static void lv_area_copy(lv_area_t * dest, const lv_area_t * src)
static inline int32_t lv_area_get_width(const lv_area_t * area_p)
static inline int32_t lv_area_get_height(const lv_area_t * area_p)
int32_t lv_area_get_width(const lv_area_t * area_p)
int32_t lv_area_get_height(const lv_area_t * area_p)
void lv_area_set_width(lv_area_t * area_p, int32_t w)
void lv_area_set_height(lv_area_t * area_p, int32_t h)
uint32_t lv_area_get_size(const lv_area_t * area_p)
@ -743,45 +761,49 @@ void lv_area_move(lv_area_t * area, int32_t x_ofs, int32_t y_ofs)
void lv_area_align(const lv_area_t * base, lv_area_t * to_align, lv_align_t align, int32_t ofs_x, int32_t ofs_y)
void lv_point_transform(lv_point_t * point, int32_t angle, int32_t scale_x, int32_t scale_y, const lv_point_t * pivot, bool zoom_first)
void lv_point_array_transform(lv_point_t * points, size_t count, int32_t angle, int32_t scale_x, int32_t scale_y, const lv_point_t * pivot, bool zoom_first)
static inline lv_point_t lv_point_from_precise(const lv_point_precise_t * p)
static inline lv_point_precise_t lv_point_to_precise(const lv_point_t * p)
static inline void lv_point_set(lv_point_t * p, int32_t x, int32_t y)
static inline void lv_point_precise_set(lv_point_precise_t * p, lv_value_precise_t x, lv_value_precise_t y)
static inline void lv_point_swap(lv_point_t * p1, lv_point_t * p2)
static inline void lv_point_precise_swap(lv_point_precise_t * p1, lv_point_precise_t * p2)
static inline int32_t lv_pct(int32_t x)
static inline int32_t lv_pct_to_px(int32_t v, int32_t base)
lv_point_t lv_point_from_precise(const lv_point_precise_t * p)
lv_point_precise_t lv_point_to_precise(const lv_point_t * p)
void lv_point_set(lv_point_t * p, int32_t x, int32_t y)
void lv_point_precise_set(lv_point_precise_t * p, lv_value_precise_t x, lv_value_precise_t y)
void lv_point_swap(lv_point_t * p1, lv_point_t * p2)
void lv_point_precise_swap(lv_point_precise_t * p1, lv_point_precise_t * p2)
int32_t lv_pct(int32_t x)
int32_t lv_pct_to_px(int32_t v, int32_t base)
// ../../lvgl/src/misc/lv_color.h
uint8_t lv_color_format_get_bpp(lv_color_format_t cf)
static inline uint8_t lv_color_format_get_size(lv_color_format_t cf)
uint8_t lv_color_format_get_size(lv_color_format_t cf)
bool lv_color_format_has_alpha(lv_color_format_t src_cf)
lv_color32_t lv_color_to_32(lv_color_t color, lv_opa_t opa)
static inline uint32_t lv_color_to_int(lv_color_t c)
static inline bool lv_color_eq(lv_color_t c1, lv_color_t c2)
static inline bool lv_color32_eq(lv_color32_t c1, lv_color32_t c2)
static inline lv_color_t lv_color_hex(uint32_t c)
static inline lv_color_t lv_color_make(uint8_t r, uint8_t g, uint8_t b)
static inline lv_color32_t lv_color32_make(uint8_t r, uint8_t g, uint8_t b, uint8_t a)
static inline lv_color_t lv_color_hex3(uint32_t c)
uint32_t lv_color_to_int(lv_color_t c)
bool lv_color_eq(lv_color_t c1, lv_color_t c2)
bool lv_color32_eq(lv_color32_t c1, lv_color32_t c2)
lv_color_t lv_color_hex(uint32_t c)
lv_color_t lv_color_make(uint8_t r, uint8_t g, uint8_t b)
lv_color32_t lv_color32_make(uint8_t r, uint8_t g, uint8_t b, uint8_t a)
lv_color_t lv_color_hex3(uint32_t c)
uint16_t lv_color_to_u16(lv_color_t color)
uint32_t lv_color_to_u32(lv_color_t color)
static inline uint16_t lv_color_16_16_mix(uint16_t c1, uint16_t c2, uint8_t mix)
uint16_t lv_color_16_16_mix(uint16_t c1, uint16_t c2, uint8_t mix)
lv_color_t lv_color_lighten(lv_color_t c, lv_opa_t lvl)
lv_color_t lv_color_darken(lv_color_t c, lv_opa_t lvl)
lv_color_t lv_color_hsv_to_rgb(uint16_t h, uint8_t s, uint8_t v)
lv_color_hsv_t lv_color_rgb_to_hsv(uint8_t r8, uint8_t g8, uint8_t b8)
lv_color_hsv_t lv_color_to_hsv(lv_color_t color)
static inline lv_color_t lv_color_white(void)
static inline lv_color_t lv_color_black(void)
static inline void lv_color_premultiply(lv_color32_t * c)
static inline void lv_color16_premultiply(lv_color16_t * c, lv_opa_t a)
lv_color_t lv_color_white(void)
lv_color_t lv_color_black(void)
void lv_color_premultiply(lv_color32_t * c)
void lv_color16_premultiply(lv_color16_t * c, lv_opa_t a)
uint8_t lv_color_luminance(lv_color_t c)
uint8_t lv_color16_luminance(const lv_color16_t c)
uint8_t lv_color24_luminance(const uint8_t * c)
uint8_t lv_color32_luminance(lv_color32_t c)
// ../../lvgl/src/misc/lv_color_op.h
static inline lv_color_t lv_color_mix(lv_color_t c1, lv_color_t c2, uint8_t mix)
static inline lv_color32_t lv_color_mix32(lv_color32_t fg, lv_color32_t bg)
static inline uint8_t lv_color_brightness(lv_color_t c)
static inline void lv_color_filter_dsc_init(lv_color_filter_dsc_t * dsc, lv_color_filter_cb_t cb)
lv_color_t lv_color_mix(lv_color_t c1, lv_color_t c2, uint8_t mix)
lv_color32_t lv_color_mix32(lv_color32_t fg, lv_color32_t bg)
uint8_t lv_color_brightness(lv_color_t c)
void lv_color_filter_dsc_init(lv_color_filter_dsc_t * dsc, lv_color_filter_cb_t cb)
// ../../lvgl/src/misc/lv_event.h
lv_result_t lv_event_send(lv_event_list_t * list, lv_event_t * e, bool preprocess)
@ -820,6 +842,8 @@ void lv_style_transition_dsc_init(lv_style_transition_dsc_t * tr, const lv_style
lv_style_value_t lv_style_prop_get_default(lv_style_prop_t prop)
static inline lv_style_res_t lv_style_get_prop_inlined(const lv_style_t * style, lv_style_prop_t prop, lv_style_value_t * value)
bool lv_style_is_empty(const lv_style_t * style)
static inline uint32_t lv_style_get_prop_group(lv_style_prop_t prop)
uint8_t lv_style_prop_lookup_flags(lv_style_prop_t prop)
static inline void lv_style_set_size(lv_style_t * style, int32_t width, int32_t height)
static inline void lv_style_set_pad_all(lv_style_t * style, int32_t value)
static inline void lv_style_set_pad_hor(lv_style_t * style, int32_t value)
@ -922,7 +946,7 @@ void lv_style_set_transition(lv_style_t * style, const lv_style_transition_dsc_t
void lv_style_set_blend_mode(lv_style_t * style, lv_blend_mode_t value)
void lv_style_set_layout(lv_style_t * style, uint16_t value)
void lv_style_set_base_dir(lv_style_t * style, lv_base_dir_t value)
void lv_style_set_bitmap_mask_src(lv_style_t * style, const lv_image_dsc_t * value)
void lv_style_set_bitmap_mask_src(lv_style_t * style, const void * value)
void lv_style_set_rotary_sensitivity(lv_style_t * style, uint32_t value)
void lv_style_set_flex_flow(lv_style_t * style, lv_flex_flow_t value)
void lv_style_set_flex_main_place(lv_style_t * style, lv_flex_align_t value)
@ -943,19 +967,10 @@ void lv_style_set_grid_cell_row_span(lv_style_t * style, int32_t value)
// ../../lvgl/src/misc/lv_text.h
void lv_text_get_size(lv_point_t * size_res, const char * text, const lv_font_t * font, int32_t letter_space, int32_t line_space, int32_t max_width, lv_text_flag_t flag)
int32_t lv_text_get_width(const char * txt, uint32_t length, const lv_font_t * font, int32_t letter_space)
char * _lv_text_set_text_vfmt(const char * fmt, va_list ap) LV_FORMAT_ATTRIBUTE(1, 0)
uint8_t (*_lv_text_encoded_size)(const char *)
uint32_t (*_lv_text_unicode_to_encoded)(uint32_t)
uint32_t (*_lv_text_encoded_conv_wc)(uint32_t c)
uint32_t (*_lv_text_encoded_next)(const char *, uint32_t *)
uint32_t (*_lv_text_encoded_prev)(const char *, uint32_t *)
uint32_t (*_lv_text_encoded_get_byte_id)(const char *, uint32_t)
uint32_t (*_lv_text_encoded_get_char_id)(const char *, uint32_t)
uint32_t (*_lv_text_get_encoded_length)(const char *)
// ../../lvgl/src/misc/lv_timer.h
uint32_t lv_timer_handler(void)
static inline uint32_t lv_timer_handler_run_in_period(uint32_t period)
uint32_t lv_timer_handler_run_in_period(uint32_t period)
void lv_timer_periodic_handler(void)
void lv_timer_handler_set_resume_cb(lv_timer_handler_resume_cb_t cb, void * data)
lv_timer_t * lv_timer_create_basic(void)
@ -974,8 +989,8 @@ void lv_timer_enable(bool en)
uint32_t lv_timer_get_idle(void)
uint32_t lv_timer_get_time_until_next(void)
lv_timer_t * lv_timer_get_next(lv_timer_t * timer)
static inline void * lv_timer_get_user_data(lv_timer_t * timer)
static inline bool lv_timer_get_paused(lv_timer_t * timer)
void * lv_timer_get_user_data(lv_timer_t * timer)
bool lv_timer_get_paused(lv_timer_t * timer)
// ../../lvgl/src/themes/lv_theme.h
lv_theme_t * lv_theme_get_from_obj(lv_obj_t * obj)
@ -1032,11 +1047,13 @@ void lv_bar_set_value(lv_obj_t * obj, int32_t value, lv_anim_enable_t anim)
void lv_bar_set_start_value(lv_obj_t * obj, int32_t start_value, lv_anim_enable_t anim)
void lv_bar_set_range(lv_obj_t * obj, int32_t min, int32_t max)
void lv_bar_set_mode(lv_obj_t * obj, lv_bar_mode_t mode)
void lv_bar_set_orientation(lv_obj_t * obj, lv_bar_orientation_t orientation)
int32_t lv_bar_get_value(const lv_obj_t * obj)
int32_t lv_bar_get_start_value(const lv_obj_t * obj)
int32_t lv_bar_get_min_value(const lv_obj_t * obj)
int32_t lv_bar_get_max_value(const lv_obj_t * obj)
lv_bar_mode_t lv_bar_get_mode(lv_obj_t * obj)
lv_bar_orientation_t lv_bar_get_orientation(lv_obj_t * obj)
bool lv_bar_is_symmetrical(lv_obj_t * obj)
// ../../lvgl/src/widgets/button/lv_button.h
@ -1072,6 +1089,11 @@ lv_calendar_date_t * lv_calendar_get_highlighted_dates(const lv_obj_t * calendar
size_t lv_calendar_get_highlighted_dates_num(const lv_obj_t * calendar)
lv_result_t lv_calendar_get_pressed_date(const lv_obj_t * calendar, lv_calendar_date_t * date)
// ../../lvgl/src/widgets/calendar/lv_calendar_chinese.h
void lv_calendar_set_chinese_mode(lv_obj_t * obj, bool en)
const char * lv_calendar_get_day_name(lv_calendar_date_t * gregorian)
lv_calendar_chinese_t lv_calendar_gregorian_to_chinese(lv_calendar_date_t * gregorian)
// ../../lvgl/src/widgets/calendar/lv_calendar_header_arrow.h
lv_obj_t * lv_calendar_header_arrow_create(lv_obj_t * parent)
@ -1093,7 +1115,7 @@ void lv_canvas_copy_buf(lv_obj_t * obj, const lv_area_t * canvas_area, lv_draw_b
void lv_canvas_fill_bg(lv_obj_t * obj, lv_color_t color, lv_opa_t opa)
void lv_canvas_init_layer(lv_obj_t * canvas, lv_layer_t * layer)
void lv_canvas_finish_layer(lv_obj_t * canvas, lv_layer_t * layer)
static inline uint32_t lv_canvas_buf_size(int32_t w, int32_t h, uint8_t bpp, uint8_t stride)
uint32_t lv_canvas_buf_size(int32_t w, int32_t h, uint8_t bpp, uint8_t stride)
// ../../lvgl/src/widgets/chart/lv_chart.h
lv_obj_t * lv_chart_create(lv_obj_t * parent)
@ -1111,6 +1133,7 @@ lv_chart_series_t * lv_chart_add_series(lv_obj_t * obj, lv_color_t color, lv_cha
void lv_chart_remove_series(lv_obj_t * obj, lv_chart_series_t * series)
void lv_chart_hide_series(lv_obj_t * chart, lv_chart_series_t * series, bool hide)
void lv_chart_set_series_color(lv_obj_t * chart, lv_chart_series_t * series, lv_color_t color)
lv_color_t lv_chart_get_series_color(lv_obj_t * chart, const lv_chart_series_t * series)
void lv_chart_set_x_start_point(lv_obj_t * obj, lv_chart_series_t * ser, uint32_t id)
lv_chart_series_t * lv_chart_get_series_next(const lv_obj_t * chart, const lv_chart_series_t * ser)
lv_chart_cursor_t * lv_chart_add_cursor(lv_obj_t * obj, lv_color_t color, lv_dir_t dir)
@ -1200,10 +1223,10 @@ void lv_keyboard_set_popovers(lv_obj_t * kb, bool en)
void lv_keyboard_set_map(lv_obj_t * kb, lv_keyboard_mode_t mode, const char * map[], const lv_buttonmatrix_ctrl_t ctrl_map[])
lv_obj_t * lv_keyboard_get_textarea(const lv_obj_t * kb)
lv_keyboard_mode_t lv_keyboard_get_mode(const lv_obj_t * kb)
bool lv_buttonmatrix_get_popovers(const lv_obj_t * obj)
static inline const char ** lv_keyboard_get_map_array(const lv_obj_t * kb)
static inline uint32_t lv_keyboard_get_selected_button(const lv_obj_t * obj)
static inline const char * lv_keyboard_get_button_text(const lv_obj_t * obj, uint32_t btn_id)
bool lv_keyboard_get_popovers(const lv_obj_t * obj)
const char ** lv_keyboard_get_map_array(const lv_obj_t * kb)
uint32_t lv_keyboard_get_selected_button(const lv_obj_t * obj)
const char * lv_keyboard_get_button_text(const lv_obj_t * obj, uint32_t btn_id)
// ../../lvgl/src/widgets/label/lv_label.h
lv_obj_t * lv_label_create(lv_obj_t * parent)
@ -1235,7 +1258,12 @@ uint8_t lv_led_get_brightness(const lv_obj_t * obj)
// ../../lvgl/src/widgets/line/lv_line.h
lv_obj_t * lv_line_create(lv_obj_t * parent)
void lv_line_set_points(lv_obj_t * obj, const lv_point_precise_t points[], uint32_t point_num)
void lv_line_set_points_mutable(lv_obj_t * obj, lv_point_precise_t points[], uint32_t point_num)
void lv_line_set_y_invert(lv_obj_t * obj, bool en)
const lv_point_precise_t * lv_line_get_points(lv_obj_t * obj)
uint32_t lv_line_get_point_count(lv_obj_t * obj)
bool lv_line_is_point_array_mutable(lv_obj_t * obj)
lv_point_precise_t * lv_line_get_points_mutable(lv_obj_t * obj)
bool lv_line_get_y_invert(const lv_obj_t * obj)
// ../../lvgl/src/widgets/list/lv_list.h
@ -1306,9 +1334,10 @@ void lv_scale_set_line_needle_value(lv_obj_t * obj, lv_obj_t * needle_line, int3
void lv_scale_set_image_needle_value(lv_obj_t * obj, lv_obj_t * needle_img, int32_t value)
void lv_scale_set_text_src(lv_obj_t * obj, const char * txt_src[])
void lv_scale_set_post_draw(lv_obj_t * obj, bool en)
void lv_scale_set_draw_ticks_on_top(lv_obj_t * obj, bool en)
lv_scale_section_t * lv_scale_add_section(lv_obj_t * obj)
void lv_scale_section_set_range(lv_scale_section_t * section, int32_t minor_range, int32_t major_range)
void lv_scale_section_set_style(lv_scale_section_t * section, uint32_t part, lv_style_t * section_part_style)
void lv_scale_section_set_style(lv_scale_section_t * section, lv_part_t part, lv_style_t * section_part_style)
lv_scale_mode_t lv_scale_get_mode(lv_obj_t * obj)
int32_t lv_scale_get_total_tick_count(lv_obj_t * obj)
int32_t lv_scale_get_major_tick_every(lv_obj_t * obj)
@ -1319,17 +1348,17 @@ int32_t lv_scale_get_range_max_value(lv_obj_t * obj)
// ../../lvgl/src/widgets/slider/lv_slider.h
lv_obj_t * lv_slider_create(lv_obj_t * parent)
static inline void lv_slider_set_value(lv_obj_t * obj, int32_t value, lv_anim_enable_t anim)
static inline void lv_slider_set_left_value(lv_obj_t * obj, int32_t value, lv_anim_enable_t anim)
static inline void lv_slider_set_range(lv_obj_t * obj, int32_t min, int32_t max)
static inline void lv_slider_set_mode(lv_obj_t * obj, lv_slider_mode_t mode)
static inline int32_t lv_slider_get_value(const lv_obj_t * obj)
static inline int32_t lv_slider_get_left_value(const lv_obj_t * obj)
static inline int32_t lv_slider_get_min_value(const lv_obj_t * obj)
static inline int32_t lv_slider_get_max_value(const lv_obj_t * obj)
void lv_slider_set_value(lv_obj_t * obj, int32_t value, lv_anim_enable_t anim)
void lv_slider_set_left_value(lv_obj_t * obj, int32_t value, lv_anim_enable_t anim)
void lv_slider_set_range(lv_obj_t * obj, int32_t min, int32_t max)
void lv_slider_set_mode(lv_obj_t * obj, lv_slider_mode_t mode)
int32_t lv_slider_get_value(const lv_obj_t * obj)
int32_t lv_slider_get_left_value(const lv_obj_t * obj)
int32_t lv_slider_get_min_value(const lv_obj_t * obj)
int32_t lv_slider_get_max_value(const lv_obj_t * obj)
bool lv_slider_is_dragged(const lv_obj_t * obj)
static inline lv_slider_mode_t lv_slider_get_mode(lv_obj_t * slider)
static inline bool lv_slider_is_symmetrical(lv_obj_t * obj)
lv_slider_mode_t lv_slider_get_mode(lv_obj_t * slider)
bool lv_slider_is_symmetrical(lv_obj_t * obj)
// ../../lvgl/src/widgets/span/lv_span.h
void lv_span_stack_init(void)
@ -1344,6 +1373,7 @@ void lv_spangroup_set_overflow(lv_obj_t * obj, lv_span_overflow_t overflow)
void lv_spangroup_set_indent(lv_obj_t * obj, int32_t indent)
void lv_spangroup_set_mode(lv_obj_t * obj, lv_span_mode_t mode)
void lv_spangroup_set_max_lines(lv_obj_t * obj, int32_t lines)
lv_style_t * lv_span_get_style(lv_span_t * span)
lv_span_t * lv_spangroup_get_child(const lv_obj_t * obj, int32_t id)
uint32_t lv_spangroup_get_span_count(const lv_obj_t * obj)
lv_text_align_t lv_spangroup_get_align(lv_obj_t * obj)
@ -1390,6 +1420,7 @@ void lv_table_set_column_width(lv_obj_t * obj, uint32_t col_id, int32_t w)
void lv_table_add_cell_ctrl(lv_obj_t * obj, uint32_t row, uint32_t col, lv_table_cell_ctrl_t ctrl)
void lv_table_clear_cell_ctrl(lv_obj_t * obj, uint32_t row, uint32_t col, lv_table_cell_ctrl_t ctrl)
void lv_table_set_cell_user_data(lv_obj_t * obj, uint16_t row, uint16_t col, void * user_data)
void lv_table_set_selected_cell(lv_obj_t * obj, uint16_t row, uint16_t col)
const char * lv_table_get_cell_value(lv_obj_t * obj, uint32_t row, uint32_t col)
uint32_t lv_table_get_row_count(lv_obj_t * obj)
uint32_t lv_table_get_column_count(lv_obj_t * obj)
@ -1465,8 +1496,5 @@ bool lv_theme_haspmota_is_inited(void)
// ../src/lv_berry.h
void be_load_lvgl_classes(bvm *vm)
void lv_image_set_tasmota_logo(lv_obj_t * img)
lv_style_t * lv_span_get_style(lv_span_t * span)
lv_area_t * lv_bar_get_indic_area(lv_obj_t * bar)
lv_point_t * lv_line_get_points(lv_obj_t * line)
int lv_line_get_points_num(lv_obj_t * line)

View File

@ -53,10 +53,11 @@ const be_ctypes_structure_t be_lv_gradient_stop = {
const be_ctypes_structure_t be_lv_grad_dsc = {
12, /* size in bytes */
8, /* number of elements */
9, /* number of elements */
be_ctypes_instance_mappings,
(const be_ctypes_structure_item_t[8]) {
(const be_ctypes_structure_item_t[9]) {
{ "dir", 11, 0, 3, ctypes_bf, 0 },
{ "extend", 11, 3, 2, ctypes_bf, 0 },
{ "stops_0_color", 0, 0, 0, ctypes_u24, 1 },
{ "stops_0_frac", 4, 0, 0, ctypes_u8, 0 },
{ "stops_0_opa", 3, 0, 0, ctypes_u8, 0 },
@ -82,9 +83,9 @@ const be_ctypes_structure_t be_lv_draw_dsc_base = {
const be_ctypes_structure_t be_lv_draw_rect_dsc = {
112, /* size in bytes */
39, /* number of elements */
40, /* number of elements */
be_ctypes_instance_mappings,
(const be_ctypes_structure_item_t[39]) {
(const be_ctypes_structure_item_t[40]) {
{ "base_dsc_size", 20, 0, 0, ctypes_u32, 0 },
{ "base_id1", 8, 0, 0, ctypes_u32, 0 },
{ "base_id2", 12, 0, 0, ctypes_u32, 0 },
@ -94,6 +95,7 @@ const be_ctypes_structure_t be_lv_draw_rect_dsc = {
{ "base_user_data", 24, 0, 0, ctypes_ptr32, 0 },
{ "bg_color", 33, 0, 0, ctypes_u24, 1 },
{ "bg_grad_dir", 47, 0, 3, ctypes_bf, 0 },
{ "bg_grad_extend", 47, 3, 2, ctypes_bf, 0 },
{ "bg_grad_stops_0_color", 36, 0, 0, ctypes_u24, 1 },
{ "bg_grad_stops_0_frac", 40, 0, 0, ctypes_u8, 0 },
{ "bg_grad_stops_0_opa", 39, 0, 0, ctypes_u8, 0 },
@ -110,8 +112,8 @@ const be_ctypes_structure_t be_lv_draw_rect_dsc = {
{ "bg_opa", 32, 0, 0, ctypes_u8, 0 },
{ "border_color", 62, 0, 0, ctypes_u24, 1 },
{ "border_opa", 72, 0, 0, ctypes_u8, 0 },
{ "border_post", 73, 0, 1, ctypes_bf, 0 },
{ "border_side", 73, 1, 5, ctypes_bf, 0 },
{ "border_post", 73, 5, 1, ctypes_bf, 0 },
{ "border_side", 73, 0, 5, ctypes_bf, 0 },
{ "border_width", 68, 0, 0, ctypes_i32, 0 },
{ "outline_color", 74, 0, 0, ctypes_u24, 1 },
{ "outline_opa", 88, 0, 0, ctypes_u8, 0 },
@ -192,10 +194,10 @@ const be_ctypes_structure_t be_lv_image_header = {
}};
const be_ctypes_structure_t be_lv_draw_image_dsc = {
100, /* size in bytes */
33, /* number of elements */
108, /* size in bytes */
35, /* number of elements */
be_ctypes_instance_mappings,
(const be_ctypes_structure_item_t[33]) {
(const be_ctypes_structure_item_t[35]) {
{ "antialias", 77, 4, 1, ctypes_bf, 0 },
{ "base_dsc_size", 20, 0, 0, ctypes_u32, 0 },
{ "base_id1", 8, 0, 0, ctypes_u32, 0 },
@ -204,7 +206,9 @@ const be_ctypes_structure_t be_lv_draw_image_dsc = {
{ "base_obj", 0, 0, 0, ctypes_ptr32, 0 },
{ "base_part", 4, 0, 0, ctypes_u32, 0 },
{ "base_user_data", 24, 0, 0, ctypes_ptr32, 0 },
{ "bitmap_mask_src", 104, 0, 0, ctypes_ptr32, 0 },
{ "blend_mode", 77, 0, 4, ctypes_bf, 0 },
{ "clip_radius", 100, 0, 0, ctypes_i32, 0 },
{ "header_cf", 33, 0, 0, ctypes_u8, 0 },
{ "header_flags", 34, 0, 0, ctypes_u16, 0 },
{ "header_h", 38, 0, 0, ctypes_u16, 0 },
@ -212,11 +216,11 @@ const be_ctypes_structure_t be_lv_draw_image_dsc = {
{ "header_reserved_2", 42, 0, 0, ctypes_u16, 0 },
{ "header_stride", 40, 0, 0, ctypes_u16, 0 },
{ "header_w", 36, 0, 0, ctypes_u16, 0 },
{ "image_area_x1", 84, 0, 0, ctypes_i32, 0 },
{ "image_area_x2", 92, 0, 0, ctypes_i32, 0 },
{ "image_area_y1", 88, 0, 0, ctypes_i32, 0 },
{ "image_area_y2", 96, 0, 0, ctypes_i32, 0 },
{ "opa", 76, 0, 0, ctypes_u8, 0 },
{ "original_area_x1", 80, 0, 0, ctypes_i32, 0 },
{ "original_area_x2", 88, 0, 0, ctypes_i32, 0 },
{ "original_area_y1", 84, 0, 0, ctypes_i32, 0 },
{ "original_area_y2", 92, 0, 0, ctypes_i32, 0 },
{ "pivot_x", 64, 0, 0, ctypes_i32, 0 },
{ "pivot_y", 68, 0, 0, ctypes_i32, 0 },
{ "recolor", 72, 0, 0, ctypes_u24, 1 },
@ -227,7 +231,7 @@ const be_ctypes_structure_t be_lv_draw_image_dsc = {
{ "skew_x", 56, 0, 0, ctypes_i32, 0 },
{ "skew_y", 60, 0, 0, ctypes_i32, 0 },
{ "src", 28, 0, 0, ctypes_ptr32, 0 },
{ "sup", 96, 0, 0, ctypes_ptr32, 0 },
{ "sup", 80, 0, 0, ctypes_ptr32, 0 },
{ "tile", 77, 5, 1, ctypes_bf, 0 },
}};
@ -319,13 +323,13 @@ const be_ctypes_structure_t be_lv_event = {
be_ctypes_instance_mappings,
(const be_ctypes_structure_item_t[9]) {
{ "code", 8, 0, 0, ctypes_i32, 0 },
{ "current_target", 4, 0, 0, ctypes_ptr32, 0 },
{ "current_target", 0, 0, 0, ctypes_ptr32, 0 },
{ "deleted", 24, 0, 1, ctypes_bf, 0 },
{ "original_target", 4, 0, 0, ctypes_ptr32, 0 },
{ "param", 16, 0, 0, ctypes_ptr32, 0 },
{ "prev", 20, 0, 0, ctypes_ptr32, 0 },
{ "stop_bubbling", 24, 2, 1, ctypes_bf, 0 },
{ "stop_processing", 24, 1, 1, ctypes_bf, 0 },
{ "target", 0, 0, 0, ctypes_ptr32, 0 },
{ "user_data", 12, 0, 0, ctypes_ptr32, 0 },
}};
@ -359,10 +363,10 @@ const be_ctypes_structure_t be_lv_style_transition_dsc = {
}};
const be_ctypes_structure_t be_lv_layer = {
56, /* size in bytes */
14, /* number of elements */
72, /* size in bytes */
18, /* number of elements */
be_ctypes_instance_mappings,
(const be_ctypes_structure_item_t[14]) {
(const be_ctypes_structure_item_t[18]) {
{ "_clip_area_x1", 24, 0, 0, ctypes_i32, 0 },
{ "_clip_area_x2", 32, 0, 0, ctypes_i32, 0 },
{ "_clip_area_y1", 28, 0, 0, ctypes_i32, 0 },
@ -371,12 +375,16 @@ const be_ctypes_structure_t be_lv_layer = {
{ "buf_area_x2", 12, 0, 0, ctypes_i32, 0 },
{ "buf_area_y1", 8, 0, 0, ctypes_i32, 0 },
{ "buf_area_y2", 16, 0, 0, ctypes_i32, 0 },
{ "color_format", 20, 0, 0, ctypes_u8, 0 },
{ "color_format", 20, 0, 0, ctypes_u32, 0 },
{ "draw_buf", 0, 0, 0, ctypes_ptr32, 0 },
{ "draw_task_head", 40, 0, 0, ctypes_ptr32, 0 },
{ "next", 48, 0, 0, ctypes_ptr32, 0 },
{ "parent", 44, 0, 0, ctypes_ptr32, 0 },
{ "user_data", 52, 0, 0, ctypes_ptr32, 0 },
{ "draw_task_head", 56, 0, 0, ctypes_ptr32, 0 },
{ "next", 64, 0, 0, ctypes_ptr32, 0 },
{ "parent", 60, 0, 0, ctypes_ptr32, 0 },
{ "phy_clip_area_x1", 40, 0, 0, ctypes_i32, 0 },
{ "phy_clip_area_x2", 48, 0, 0, ctypes_i32, 0 },
{ "phy_clip_area_y1", 44, 0, 0, ctypes_i32, 0 },
{ "phy_clip_area_y2", 52, 0, 0, ctypes_i32, 0 },
{ "user_data", 68, 0, 0, ctypes_ptr32, 0 },
}};
const be_ctypes_structure_t be_lv_color_filter_dsc = {

View File

@ -51,7 +51,7 @@ int32_t = ct.i32
size_t = ct.u32
ptr = ct.ptr32
lv_point = [ # valid LVGL9
lv_point = [ # valid LVGL92
[int32_t, "x"],
[int32_t, "y"],
]
@ -61,13 +61,13 @@ lv_point = ct.structure(lv_point, "lv_point")
# lv_value_precise_t x;
# lv_value_precise_t y;
# } lv_point_precise_t;
lv_point_precise = [ # valid LVGL9
lv_point_precise = [ # valid LVGL92
[lv_value_precise, "x"],
[lv_value_precise, "y"],
]
lv_point_precise = ct.structure(lv_point_precise, "lv_point_precise")
lv_area = [ # valid LVGL9
lv_area = [ # valid LVGL92
[int32_t, "x1"],
[int32_t, "y1"],
[int32_t, "x2"],
@ -82,7 +82,7 @@ lv_area = ct.structure(lv_area, "lv_area")
# lv_opa_t opa; /**< The opacity of the color*/
# uint8_t frac; /**< The stop position in 1/255 unit */
# } lv_gradient_stop_t;
lv_gradient_stop = [ # valid LVGL91
lv_gradient_stop = [ # valid LVGL92
[lv_color, "color"],
[lv_opa, "opa"],
[uint8_t, "frac"],
@ -90,12 +90,15 @@ lv_gradient_stop = [ # valid LVGL91
lv_gradient_stop = ct.structure(lv_gradient_stop, "lv_gradient_stop")
# typedef struct {
# lv_gradient_stop_t stops[LV_GRADIENT_MAX_STOPS]; /**< A gradient stop array */
# uint8_t stops_count; /**< The number of used stops in the array */
# lv_grad_dir_t dir : 3; /**< The gradient direction.
# lv_gradient_stop_t stops[LV_GRADIENT_MAX_STOPS]; /**< A gradient stop array */
# uint8_t stops_count; /**< The number of used stops in the array */
# lv_grad_dir_t dir : 3; /**< The gradient direction.
# * Any of LV_GRAD_DIR_NONE, LV_GRAD_DIR_VER, LV_GRAD_DIR_HOR,
# * LV_GRAD_TYPE_LINEAR, LV_GRAD_TYPE_RADIAL, LV_GRAD_TYPE_CONICAL */
# lv_grad_extend_t extend : 2; /**< Behaviour outside the defined range.
# * Any of LV_GRAD_DIR_HOR, LV_GRAD_DIR_VER, LV_GRAD_DIR_NONE */
# } lv_grad_dsc_t;
lv_grad_dsc = [ # valid LVGL91
lv_grad_dsc = [ # valid LVGL92
# since it's an array and not two structures, we need to explicitly unroll it here or the alignment is wrong
# [lv_gradient_stop, "stops_0"],
[lv_color, "stops_0_color"],
@ -108,6 +111,7 @@ lv_grad_dsc = [ # valid LVGL91
[uint8_t, "stops_count"],
[uint8_t_3, "dir"],
[uint8_t_2, "extend"],
]
lv_grad_dsc = ct.structure(lv_grad_dsc, "lv_grad_dsc")
@ -121,7 +125,7 @@ lv_grad_dsc = ct.structure(lv_grad_dsc, "lv_grad_dsc")
# size_t dsc_size;
# void * user_data;
# } lv_draw_dsc_base_t;
lv_draw_dsc_base = [ # valid LVGL91
lv_draw_dsc_base = [ # valid LVGL92
[ptr, "obj"],
[uint32_t, "part"],
[uint32_t, "id1"],
@ -171,7 +175,7 @@ lv_draw_dsc_base = ct.structure(lv_draw_dsc_base, "lv_draw_dsc_base")
# int32_t shadow_spread;
# lv_opa_t shadow_opa;
# } lv_draw_rect_dsc_t;
lv_draw_rect_dsc = [ # valid LVGL91
lv_draw_rect_dsc = [ # valid LVGL92
[lv_draw_dsc_base, "base"],
[int32_t, "radius"],
@ -193,8 +197,8 @@ lv_draw_rect_dsc = [ # valid LVGL91
[lv_color, "border_color"],
[int32_t, "border_width"],
[lv_opa, "border_opa"],
[uint8_t_1, "border_post"],
[uint8_t_5, "border_side"],
[uint8_t_1, "border_post"],
#/*Outline*/
[lv_color, "outline_color"],
@ -227,7 +231,7 @@ lv_draw_rect_dsc = ct.structure(lv_draw_rect_dsc, "lv_draw_rect_dsc")
# uint8_t round_end : 1;
# uint8_t raw_end : 1; /*Do not bother with perpendicular line ending if it's not visible for any reason*/
# } lv_draw_line_dsc_t;
lv_draw_line_dsc = [ # valid LVGL91
lv_draw_line_dsc = [ # valid LVGL92
[lv_draw_dsc_base, "base"],
[lv_point_precise, "p1"],
@ -257,7 +261,7 @@ lv_draw_line_dsc = ct.structure(lv_draw_line_dsc, "lv_draw_line_dsc")
# lv_opa_t opa;
# uint8_t rounded : 1;
# } lv_draw_arc_dsc_t;
lv_draw_arc_dsc = [ # valid LVGL91
lv_draw_arc_dsc = [ # valid LVGL92
[lv_draw_dsc_base, "base"],
[lv_color, "color"],
@ -283,7 +287,7 @@ lv_draw_arc_dsc = ct.structure(lv_draw_arc_dsc, "lv_draw_arc_dsc")
# uint32_t stride: 16; /*Number of bytes in a row*/
# uint32_t reserved_2: 16; /*Reserved to be used later*/
# } lv_image_header_t;
lv_image_header = [ # valid LVGL91
lv_image_header = [ # valid LVGL92
[uint8_t, "magic"],
[uint8_t, "cf"],
[uint16_t, "flags"],
@ -323,7 +327,7 @@ lv_image_header = ct.structure(lv_image_header, "lv_image_header")
# lv_area_t original_area;
# const lv_image_dsc_t * bitmap_mask_src;
# } lv_draw_image_dsc_t;
lv_draw_image_dsc = [ # valid LVGL91
lv_draw_image_dsc = [ # valid LVGL92
[lv_draw_dsc_base, "base"],
[ptr, "src"],
@ -343,8 +347,11 @@ lv_draw_image_dsc = [ # valid LVGL91
[uint8_t_4, "blend_mode"],
[uint8_t_1, "antialias"],
[uint8_t_1, "tile"],
[lv_area, "original_area"],
[ptr, "sup"],
[lv_area, "image_area"],
[int32_t, "clip_radius"],
[ptr, "bitmap_mask_src"],
]
lv_draw_image_dsc = ct.structure(lv_draw_image_dsc, "lv_draw_image_dsc")
@ -374,7 +381,7 @@ lv_draw_image_dsc = ct.structure(lv_draw_image_dsc, "lv_draw_image_dsc")
# uint8_t text_local : 1;
# lv_draw_label_hint_t * hint;
# } lv_draw_label_dsc_t;
lv_draw_label_dsc = [ # valid LVGL91
lv_draw_label_dsc = [ # valid LVGL92
[lv_draw_dsc_base, "base"],
[ptr, "text"],
[ptr, "font"],
@ -409,7 +416,7 @@ lv_draw_label_dsc = ct.structure(lv_draw_label_dsc, "lv_draw_label_dsc")
# uint32_t x_axis_sec : 1;
# uint32_t y_axis_sec : 1;
# } lv_chart_series_t;
lv_chart_series = [ # valid LVGL91
lv_chart_series = [ # valid LVGL92
[ptr, "x_points"],
[ptr, "y_points"],
[lv_color, "color"],
@ -430,7 +437,7 @@ lv_chart_series = ct.structure(lv_chart_series, "lv_chart_series")
# lv_dir_t dir;
# uint32_t pos_set: 1; /*1: pos is set; 0: point_id is set*/
# } lv_chart_cursor_t;
lv_chart_cursor = [ # valid LVGL91
lv_chart_cursor = [ # valid LVGL92
[lv_point, "pos"],
[int32_t, "point_id"],
[lv_color, "color"],
@ -449,22 +456,16 @@ destructor_cb = ptr # callback
event_cb = ptr # callback
lv_event_code = ct.i32
# struct _lv_obj_class_t {
# struct lv_obj_class_t {
# const lv_obj_class_t * base_class;
# /*class_p is the final class while obj->class_p is the class currently being [de]constructed.*/
# /** class_p is the final class while obj->class_p is the class currently being [de]constructed. */
# void (*constructor_cb)(const lv_obj_class_t * class_p, lv_obj_t * obj);
# void (*destructor_cb)(const lv_obj_class_t * class_p, lv_obj_t * obj);
# /*class_p is the class in which event is being processed.*/
#
# /** class_p is the class in which event is being processed. */
# void (*event_cb)(const lv_obj_class_t * class_p, lv_event_t * e); /**< Widget type specific event function*/
# #if LV_USE_OBJ_PROPERTY
# uint32_t prop_index_start;
# uint32_t prop_index_end;
# const lv_property_ops_t * properties;
# uint32_t properties_count;
# #endif
#
# void * user_data;
# const char * name;
# int32_t width_def;
@ -474,7 +475,7 @@ lv_event_code = ct.i32
# uint32_t instance_size : 16;
# uint32_t theme_inheritable : 1; /**< Value from ::lv_obj_class_theme_inheritable_t*/
# };
lv_obj_class = [ # valid LVGL91
lv_obj_class = [ # valid LVGL92
[lv_obj_class_ptr, "base_class"],
[constructor_cb, "constructor_cb"],
[destructor_cb, "destructor_cb"],
@ -490,7 +491,7 @@ lv_obj_class = [ # valid LVGL91
]
lv_obj_class = ct.structure(lv_obj_class, "lv_obj_class")
# struct _lv_event_t {
# struct lv_event_t {
# void * current_target;
# void * original_target;
# lv_event_code_t code;
@ -501,9 +502,9 @@ lv_obj_class = ct.structure(lv_obj_class, "lv_obj_class")
# uint8_t stop_processing : 1;
# uint8_t stop_bubbling : 1;
# };
lv_event = [ # valid LVGL91
[lv_obj_ptr, "target"],
lv_event = [ # valid LVGL92
[lv_obj_ptr, "current_target"],
[lv_obj_ptr, "original_target"],
[lv_event_code, "code"],
[ptr, "user_data"],
[ptr, "param"],
@ -523,7 +524,7 @@ lv_event = ct.structure(lv_event, "lv_event")
# const uint8_t * data; /**< Pointer to the data of the image*/
# const void * reserved; /**< A reserved field to make it has same size as lv_draw_buf_t*/
# } lv_image_dsc_t;
lv_image_dsc = [ # valid LVGL91
lv_image_dsc = [ # valid LVGL92
[lv_image_header, "header"],
[uint32_t, "data_size"],
[ptr, "data"],
@ -541,7 +542,7 @@ lv_image_dsc = ct.structure(lv_image_dsc, "lv_image_dsc")
# uint32_t time; /**< Duration of the transition in [ms]*/
# uint32_t delay; /**< Delay before the transition in [ms]*/
# } lv_style_transition_dsc_t;
lv_style_transition_dsc = [ # valid LVGL91
lv_style_transition_dsc = [ # valid LVGL92
[ptr, "props"],
[ptr, "user_data"],
[ptr, "path_xcb"],
@ -550,22 +551,52 @@ lv_style_transition_dsc = [ # valid LVGL91
]
lv_style_transition_dsc = ct.structure(lv_style_transition_dsc, "lv_style_transition_dsc")
# typedef struct {
# struct lv_layer_t {
#
# /** Target draw buffer of the layer*/
# lv_draw_buf_t * draw_buf;
#
# /** The absolute coordinates of the buffer */
# lv_area_t buf_area;
#
# /** The color format of the layer. LV_COLOR_FORMAT_... */
# lv_color_format_t color_format;
#
# /**
# * NEVER USE IT DRAW UNITS. USED INTERNALLY DURING DRAW TASK CREATION.
# * The current clip area with absolute coordinates, always the same or smaller than `buf_area`
# * Can be set before new draw tasks are added to indicate the clip area of the draw tasks.
# * Therefore `lv_draw_add_task()` always saves it in the new draw task to know the clip area when the draw task was added.
# * During drawing the draw units also sees the saved clip_area and should use it during drawing.
# * During drawing the layer's clip area shouldn't be used as it might be already changed for other draw tasks.
# */
# lv_area_t _clip_area;
#
# /**
# * The physical clipping area relative to the display.
# */
# lv_area_t phy_clip_area;
#
# #if LV_DRAW_TRANSFORM_USE_MATRIX
# /** Transform matrix to be applied when rendering the layer */
# lv_matrix_t matrix;
# #endif
#
# /** Linked list of draw tasks */
# lv_draw_task_t * draw_task_head;
#
# lv_layer_t * parent;
# lv_layer_t * next;
# bool all_tasks_added;
# void * user_data;
# } lv_layer_t;
lv_layer = [ # valid LVGL9
# };
lv_layer = [ # valid LVGL92
[ptr, "draw_buf"],
[lv_area, "buf_area"],
[uint8_t, "color_format"],
[uint32_t, "color_format"],
[lv_area, "_clip_area"],
[lv_area, "phy_clip_area"],
[ptr, "draw_task_head"],
[ptr, "parent"],
[ptr, "next"],
@ -581,7 +612,7 @@ lv_layer = ct.structure(lv_layer, "lv_layer")
# lv_color_filter_cb_t filter_cb;
# void * user_data;
# } lv_color_filter_dsc_t;
lv_color_filter_dsc = [ # valid LVGL91
lv_color_filter_dsc = [ # valid LVGL92
[ptr, "filter_cb"],
[ptr, "user_data"],
]
@ -590,16 +621,16 @@ lv_color_filter_dsc = ct.structure(lv_color_filter_dsc, "lv_color_filter_dsc")
#######################################################################
# lv_timer native, superseded by lv_timer
# struct _lv_timer_t {
# uint32_t period; /**< How often the timer should run*/
# uint32_t last_run; /**< Last time the timer ran*/
# lv_timer_cb_t timer_cb; /**< Timer function*/
# void * user_data; /**< Custom user data*/
# int32_t repeat_count; /**< 1: One time; -1 : infinity; n>0: residual times*/
# struct lv_timer_t {
# uint32_t period; /**< How often the timer should run */
# uint32_t last_run; /**< Last time the timer ran */
# lv_timer_cb_t timer_cb; /**< Timer function */
# void * user_data; /**< Custom user data */
# int32_t repeat_count; /**< 1: One time; -1 : infinity; n>0: residual times */
# uint32_t paused : 1;
# uint32_t auto_delete : 1;
# };
lv_timer_ntv = [ # valid LVGL91
lv_timer_ntv = [ # valid LVGL92
[uint32_t, "period"],
[uint32_t, "last_run"],
[ptr, "timer_cb"],
@ -618,7 +649,7 @@ lv_timer_ntv = ct.structure(lv_timer_ntv, "lv_timer_ntv")
# void * user_data;
# uint32_t filter;
# } lv_event_dsc_t;
lv_event_dsc = [ # valid LVGL91
lv_event_dsc = [ # valid LVGL92
[ptr, "cb"],
[ptr, "user_data"],
[uint32_t, "filter"],

View File

@ -6,6 +6,7 @@
#include "be_mem.h"
#include <stdio.h>
#include <string.h>
// Backport configuration from LVGL 8 to LVGL 9
#ifdef BE_LV_WIDGET_BTN
@ -391,16 +392,7 @@ int lv0_constants_as_hash(bvm *vm) {
/*********************************************************************************************\
* temporarily fix lv_span_get_style()
\*********************************************************************************************/
lv_style_t * lv_span_get_style(lv_span_t * span) {
return &span->style;
}
#include "widgets/bar/lv_bar_private.h"
lv_area_t * lv_bar_get_indic_area(lv_obj_t * bar) {
return &((lv_bar_t*)bar)->indic_area;
}
// add accessor for lv_line points array
lv_point_t * lv_line_get_points(lv_obj_t * line) {
return &((lv_line_t*)line)->point_array[0];
}
int lv_line_get_points_num(lv_obj_t * line) {
return ((lv_line_t*)line)->point_num;
}

View File

@ -25,16 +25,9 @@ typedef struct lv_ts_calibration_t {
} lv_ts_calibration_t;
extern lv_ts_calibration_t lv_ts_calibration;
// temporarily fix lv_span_get_style()
extern lv_style_t * lv_span_get_style(lv_span_t * span);
// add accessor for lv_bar->indic_area
extern lv_area_t * lv_bar_get_indic_area(lv_obj_t * bar);
// add accessor for lv_line points array
extern lv_point_t * lv_line_get_points(lv_obj_t * line);
extern int lv_line_get_points_num(lv_obj_t * line);
#ifdef __cplusplus
}
#endif

View File

@ -280,6 +280,9 @@ class type_mapper_class:
"lv_indev_read_cb_t",
"lv_vector_path_t *",
"lv_vector_path_quality_t",
"lv_color16_t",
"uint8_t *",
"lv_obj_t **",
]
return_types = {
@ -329,6 +332,7 @@ class type_mapper_class:
"lv_text_align_t": "i",
"lv_arc_mode_t": "i",
"lv_bar_mode_t": "i",
"lv_bar_orientation_t": "i",
"lv_event_code_t": "i",
"lv_obj_flag_t": "i",
"lv_slider_mode_t": "i",
@ -356,6 +360,7 @@ class type_mapper_class:
"lv_hit_test_info_t *": "c", # treat as opaque pointer
"lv_screen_load_anim_t": "i",
"lv_display_render_mode_t": "i",
"lv_draw_task_type_t": "i",
# "lv_vector_gradient_spread_t": "i",
"lv_cover_res_t": "i",
# "lv_vector_path_quality_t": "i",
@ -397,6 +402,8 @@ class type_mapper_class:
"lv_roller_mode_t": "i",
"lv_table_cell_ctrl_t": "i",
"lv_calendar_chinese_t": "c",
# arrays
"constchar * []": "str_arr",
# "char * []": "str_arr",
@ -416,7 +423,7 @@ class type_mapper_class:
"lv_draw_image_dsc_t *": "lv_draw_image_dsc",
"lv_event_dsc_t *": "lv_event_dsc",
"_lv_obj_t *": "lv_obj",
# "_lv_obj_t *": "lv_obj", // no more used in LVGL 9.2
"lv_obj_t *": "lv_obj",
"lv_event_t *": "lv_event",
"lv_color_t": "lv_color",
@ -425,7 +432,7 @@ class type_mapper_class:
"lv_font_t *": "lv_font",
"lv_theme_t *": "lv_theme",
"lv_display_t *": "lv_display",
'_lv_display_t *': "lv_display",
# '_lv_display_t *': "lv_display", // no more used in LVGL 9.2
"lv_indev_t *": "lv_indev",
"lv_point_t []": "lv_point_arr",
"lv_span_t *": "lv_span",

View File

@ -81,10 +81,21 @@ lv_fun_globs = [
# add version information
"../lvgl.h",
]
headers_exlude_suffix = [
"_private.h",
"lv_lottie.h",
"lv_obj_property.h",
"lv_obj_property_names.h",
"lv_style_properties.h",
]
headers_names = list_files(lv_src_prefix, lv_fun_globs)
headers_names += list_files("../../LVGL_assets/src/", ["lv_theme_haspmota.h"])
headers_names += list_files("../src/", ["lv_berry.h"])
# filter out from headers_exlude_suffix
headers_names = [x for x in headers_names if not any(x.endswith(suffix) for suffix in headers_exlude_suffix)]
output_filename = "../mapping/lv_funcs.h"
sys.stdout = open(output_filename, 'w', encoding='utf-8')
@ -110,7 +121,7 @@ lv_coord_t lv_get_ver_res(void);
""")
for header_name in headers_names:
with open(header_name, encoding='utf-8') as f:
with open(header_name, encoding='utf-8-sig') as f:
print("// " + header_name)
raw = clean_source(f.read())
@ -191,8 +202,19 @@ lv_fun_globs = [
"display/lv_display.h",
"layouts/**/*.h",
]
headers_exlude_suffix = [
"_private.h",
"lv_lottie.h",
"lv_obj_property.h",
"lv_obj_property_names.h",
"lv_style_properties.h",
]
headers_names = list_files(lv_src_prefix, lv_fun_globs)
# filter out from headers_exlude_suffix
headers_names = [x for x in headers_names if not any(x.endswith(suffix) for suffix in headers_exlude_suffix)]
output_filename = "../mapping/lv_enum.h"
sys.stdout = open(output_filename, 'w', encoding='utf-8')
print("""// ======================================================================

View File

@ -1578,7 +1578,7 @@ class lvh_line : lvh_obj
end
var pt_arr = lv.point_arr(pts)
self._lv_points = pt_arr
self._lv_obj.set_points(pt_arr, size(pts))
self._lv_obj.set_points_mutable(pt_arr, size(pts))
else
print(f"HSP: 'line' wrong format for 'points' {t}")
end
@ -1792,11 +1792,11 @@ class lvh_scale_line : lvh_line
super(self).set_val(t)
self._parent_lvh._lv_obj.set_line_needle_value(self._lv_obj, self._needle_length, self._val)
# work-around for points being global static
if (self._lv_obj.get_points_num() == 2) # check that there are only 2 points
if (self._lv_obj.get_point_count() == 2) # check that there are only 2 points
# read back the computed points
var p_arr = bytes(self._lv_obj.get_points(), size(self._lv_points))
self._lv_points.setbytes(0, p_arr)
self._lv_obj.set_points(self._lv_points, 2)
self._lv_obj.set_points_mutable(self._lv_points, 2)
end
end
end

View File

@ -7067,7 +7067,7 @@ be_local_closure(class_lvh_line_set_points, /* name */
/* K9 */ be_nested_str_weak(point_arr),
/* K10 */ be_nested_str_weak(_lv_points),
/* K11 */ be_nested_str_weak(_lv_obj),
/* K12 */ be_nested_str_weak(set_points),
/* K12 */ be_nested_str_weak(set_points_mutable),
/* K13 */ be_nested_str_weak(HSP_X3A_X20_X27line_X27_X20wrong_X20format_X20for_X20_X27points_X27_X20_X25s),
}),
be_str_weak(set_points),
@ -7857,13 +7857,13 @@ static const bvalue be_ktab_class_lvh_scale_line[21] = {
/* K3 */ be_nested_str_weak(set_line_needle_value),
/* K4 */ be_nested_str_weak(_needle_length),
/* K5 */ be_nested_str_weak(_val),
/* K6 */ be_nested_str_weak(get_points_num),
/* K6 */ be_nested_str_weak(get_point_count),
/* K7 */ be_const_int(2),
/* K8 */ be_nested_str_weak(get_points),
/* K9 */ be_nested_str_weak(_lv_points),
/* K10 */ be_nested_str_weak(setbytes),
/* K11 */ be_const_int(0),
/* K12 */ be_nested_str_weak(set_points),
/* K12 */ be_nested_str_weak(set_points_mutable),
/* K13 */ be_nested_str_weak(_page),
/* K14 */ be_nested_str_weak(_oh),
/* K15 */ be_nested_str_weak(lvh_scale),

View File

@ -1,5 +1,5 @@
<a href="https://github.com/sponsors/lvgl" target="_blank"><img align="left" src="https://lvgl.io/assets/images/sponsor.png" height="32px"></a>
<a href="https://github.com/sponsors/lvgl" target="_blank"><img align="left" src="https://lvgl.io/github-assets/sponsor.png" height="32px"></a>
<p align="right">
<b>English</b> | <a href="./docs/README_zh.rst">中文</a> | <a href="./docs/README_pt_BR.rst">Português do Brasil</a> | <a href="./docs/README_jp.rst">日本語</a>
@ -8,15 +8,15 @@
<br>
<p align="center">
  <img src="https://lvgl.io/assets/images/logo_lvgl.png">
  <img src="https://lvgl.io/github-assets/logo-colored.png" width=300px>
</p>
  <h1 align="center">Light and Versatile Graphics Library</h1>
  <br>
<div align="center">
<img src="https://github.com/kisvegabor/test/raw/master/smartwatch_demo.gif">
<img src="https://lvgl.io/github-assets/smartwatch-demo.gif">
&nbsp;
  <img border="1px" src="https://lvgl.io/assets/images/lvgl_widgets_demo.gif">
  <img border="1px" src="https://lvgl.io/github-assets/widgets-demo.gif">
</div>
<br>
<p align="center">
@ -24,7 +24,7 @@
<a href="https://docs.lvgl.io/" title="Detailed documentation with 100+ examples">Docs</a> |
<a href="https://forum.lvgl.io" title="Get help and help others">Forum</a> |
<a href="https://lvgl.io/demos" title="Demos running in your browser">Demos</a> |
<a href="https://lvgl.io/services" title="Graphics design, UI implementation and consulting">Services</a>
<a href="https://lvgl.io/services" title="Graphics design, UI implementation and consulting">Services</a>
</p>
<br>
@ -57,14 +57,14 @@ Our team is ready to help you with graphics design, UI implementation and consul
- Word wrapping, kerning, text scrolling, sub-pixel rendering, Pinyin-IME Chinese input, Emojis in texts.
- Rendering engine supporting animations, anti-aliasing, opacity, smooth scrolling, shadows, image transformation, etc  
- Supports Mouse, Touchpad, Keypad, Keyboard, External buttons, Encoder [Input devices](https://docs.lvgl.io/master/porting/indev.html).
- [Multiple display](https://docs.lvgl.io/master/overview/disp.html#multiple-display-support) support.
- [Multiple display](https://docs.lvgl.io/master/overview/display.html#multiple-display-support) support.
**Binding and Build Support**
- [Micropython Binding](https://blog.lvgl.io/2019-02-20/micropython-bindings) exposes LVGL API
- [MicroPython Binding](https://blog.lvgl.io/2019-02-20/micropython-bindings) exposes LVGL API
- [PikaScript Binding](https://blog.lvgl.io/2022-08-24/pikascript-and-lvgl) python on MCU lighter and easier.
- No custom build system is used. You can build LVGL as you build the other files of your project.
- Support for Make and [CMake](https://docs.lvgl.io/master/get-started/platforms/cmake.html) is included out of the box.
- [Develop on PC](https://docs.lvgl.io/master/get-started/platforms/pc-simulator.html) and use the same UI code on embedded hardware.
- Support for Make and [CMake](https://docs.lvgl.io/master/integration/building/cmake.html) is included out of the box.
- [Develop on PC](https://docs.lvgl.io/master/integration/ide/pc-simulator.html) and use the same UI code on embedded hardware.
- Convert the C UI code to HTML file with our [Emscripten port](https://github.com/lvgl/lv_web_emscripten).
**Docs, Tools, and Services**
@ -124,7 +124,7 @@ lv_obj_set_style_bg_color(lv_screen_active(), lv_color_hex(0x003a57), LV_PART_MA
/*Create a white label, set its text and align it to the center*/
lv_obj_t * label = lv_label_create(lv_screen_active());
lv_label_set_text(label, "Hello world");
lv_obj_set_style_text_color(lv_screen_active(), lv_color_hex(0xffffff), LV_PART_MAIN);
lv_obj_set_style_text_color(label, lv_color_hex(0xffffff), LV_PART_MAIN);
lv_obj_align(label, LV_ALIGN_CENTER, 0, 0);
```
</details>

View File

@ -1,28 +0,0 @@
# Tasmota patches
Following patches need to be applied when updating LVGL:
`src/extra/libs/lv_extra.c`
Comment the `lv_freetype_init()` portion. The actual initializatio is done in Tasmota code
because parameters depend on Tasmota defines and presence of PSRAM.
``` C
// TASMOTA Specific, the initialization is done in Tasmota code to adjust with PSRAM
// #if LV_USE_FREETYPE
// /*Init freetype library*/
// # if LV_FREETYPE_CACHE_SIZE >= 0
// lv_freetype_init(LV_FREETYPE_CACHE_FT_FACES, LV_FREETYPE_CACHE_FT_SIZES, LV_FREETYPE_CACHE_SIZE);
// # else
// lv_freetype_init(0, 0, 0);
// # endif
// #endif
```
## lv_spinner
Both function `arc_anim_start_angle()` and `arc_anim_end_angle()` are made non-static. This allows to search for `lv_anim` object based on their `exec_cb` callbacks and change properties on-the-fly.
## LVGL 9
Temporarily rename `lv_image_set_inner_align` to `lv_image_set_inner_align` until solved in LVGL repo.

View File

@ -1,6 +1,6 @@
{
"name": "lvgl",
"version": "9.1.0",
"version": "9.2.0",
"keywords": "graphics, gui, embedded, tft, lvgl",
"description": "Graphics library to create embedded GUI with easy-to-use graphical elements, beautiful visual effects and low memory footprint. It offers anti-aliasing, opacity, and animations using only one frame buffer.",
"repository": {

View File

@ -1,5 +1,5 @@
name=lvgl
version=9.1.0
version=9.2.0
author=kisvegabor
maintainer=kisvegabor,embeddedt,pete-pjb
sentence=Full-featured Graphics Library for Embedded Systems

View File

@ -1,6 +1,6 @@
/**
/**
* @file lv_conf.h
* Configuration file for v9.1.0
* Configuration file for v9.2.0
*/
/*
@ -26,7 +26,7 @@
COLOR SETTINGS
*====================*/
/*Color depth: 8 (A8), 16 (RGB565), 24 (RGB888), 32 (XRGB8888)*/
/*Color depth: 1 (I1), 8 (L8), 16 (RGB565), 24 (RGB888), 32 (XRGB8888)*/
#define LV_COLOR_DEPTH 16
/*=========================
@ -44,6 +44,12 @@
#define LV_USE_STDLIB_STRING LV_STDLIB_BUILTIN
#define LV_USE_STDLIB_SPRINTF LV_STDLIB_BUILTIN
#define LV_STDINT_INCLUDE <stdint.h>
#define LV_STDDEF_INCLUDE <stddef.h>
#define LV_STDBOOL_INCLUDE <stdbool.h>
#define LV_INTTYPES_INCLUDE <inttypes.h>
#define LV_LIMITS_INCLUDE <limits.h>
#define LV_STDARG_INCLUDE <stdarg.h>
#if LV_USE_STDLIB_MALLOC == LV_STDLIB_BUILTIN
/*Size of the memory available for `lv_malloc()` in bytes (>= 2kB)*/
@ -82,6 +88,7 @@
* - LV_OS_CMSIS_RTOS2
* - LV_OS_RTTHREAD
* - LV_OS_WINDOWS
* - LV_OS_MQX
* - LV_OS_CUSTOM */
#define LV_USE_OS LV_OS_NONE
@ -99,6 +106,12 @@
/*Align the start address of draw_buf addresses to this bytes*/
#define LV_DRAW_BUF_ALIGN 4
/*Using matrix for transformations.
*Requirements:
`LV_USE_MATRIX = 1`.
The rendering engine needs to support 3x3 matrix transformations.*/
#define LV_DRAW_TRANSFORM_USE_MATRIX 0
/* If a widget has `style_opa < 255` (not `bg_opa`, `text_opa` etc) or not NORMAL blend mode
* it is buffered into a "simple" layer before rendering. The widget can be buffered in smaller chunks.
* "Transformed layers" (if `transform_angle/zoom` are set) use larger buffers
@ -107,11 +120,34 @@
/*The target buffer size for simple layer chunks.*/
#define LV_DRAW_LAYER_SIMPLE_BUF_SIZE (24 * 1024) /*[bytes]*/
/* The stack size of the drawing thread.
* NOTE: If FreeType or ThorVG is enabled, it is recommended to set it to 32KB or more.
*/
#define LV_DRAW_THREAD_STACK_SIZE (8 * 1024) /*[bytes]*/
#define LV_USE_DRAW_SW 1
#if LV_USE_DRAW_SW == 1
/* Set the number of draw unit.
/*
* Selectively disable color format support in order to reduce code size.
* NOTE: some features use certain color formats internally, e.g.
* - gradients use RGB888
* - bitmaps with transparency may use ARGB8888
*/
#define LV_DRAW_SW_SUPPORT_RGB565 1
#define LV_DRAW_SW_SUPPORT_RGB565A8 1
#define LV_DRAW_SW_SUPPORT_RGB888 1
#define LV_DRAW_SW_SUPPORT_XRGB8888 1
#define LV_DRAW_SW_SUPPORT_ARGB8888 1
#define LV_DRAW_SW_SUPPORT_L8 1
#define LV_DRAW_SW_SUPPORT_AL88 1
#define LV_DRAW_SW_SUPPORT_A8 1
#define LV_DRAW_SW_SUPPORT_I1 1
/* Set the number of draw unit.
* > 1 requires an operating system enabled in `LV_USE_OS`
* > 1 means multiply threads will render the screen in parallel */
* > 1 means multiple threads will render the screen in parallel */
#define LV_DRAW_SW_DRAW_UNIT_CNT 1
/* Use Arm-2D to accelerate the sw render */
@ -119,7 +155,7 @@
/* Enable native helium assembly to be compiled */
#define LV_USE_NATIVE_HELIUM_ASM 0
/* 0: use a simple renderer capable of drawing only simple rectangles with gradient, images, texts, and straight lines only
* 1: use a complex renderer capable of drawing rounded corners, shadow, skew lines, and arcs too */
#define LV_DRAW_SW_COMPLEX 1
@ -142,6 +178,9 @@
#if LV_USE_DRAW_SW_ASM == LV_DRAW_SW_ASM_CUSTOM
#define LV_DRAW_SW_ASM_CUSTOM_INCLUDE ""
#endif
/* Enable drawing complex gradients in software: linear at an angle, radial or conical */
#define LV_USE_DRAW_SW_COMPLEX_GRADIENTS 0
#endif
/* Use NXP's VG-Lite GPU on iMX RTxxx platforms. */
@ -152,8 +191,13 @@
#define LV_USE_VGLITE_BLIT_SPLIT 0
#if LV_USE_OS
/* Enable VGLite draw async. Queue multiple tasks and flash them once to the GPU. */
#define LV_USE_VGLITE_DRAW_ASYNC 1
/* Use additional draw thread for VG-Lite processing.*/
#define LV_USE_VGLITE_DRAW_THREAD 1
#if LV_USE_VGLITE_DRAW_THREAD
/* Enable VGLite draw async. Queue multiple tasks and flash them once to the GPU. */
#define LV_USE_VGLITE_DRAW_ASYNC 1
#endif
#endif
/* Enable VGLite asserts. */
@ -164,6 +208,11 @@
#define LV_USE_DRAW_PXP 0
#if LV_USE_DRAW_PXP
#if LV_USE_OS
/* Use additional draw thread for PXP processing.*/
#define LV_USE_PXP_DRAW_THREAD 1
#endif
/* Enable PXP asserts. */
#define LV_USE_PXP_ASSERT 0
#endif
@ -178,24 +227,28 @@
#define LV_USE_DRAW_VG_LITE 0
#if LV_USE_DRAW_VG_LITE
/* Enable VG-Lite custom external 'gpu_init()' function */
#define LV_VG_LITE_USE_GPU_INIT 0
/* Enable VG-Lite custom external 'gpu_init()' function */
#define LV_VG_LITE_USE_GPU_INIT 0
/* Enable VG-Lite assert. */
#define LV_VG_LITE_USE_ASSERT 0
/* Enable VG-Lite assert. */
#define LV_VG_LITE_USE_ASSERT 0
/* VG-Lite flush commit trigger threshold. GPU will try to batch these many draw tasks. */
#define LV_VG_LITE_FLUSH_MAX_COUNT 8
/* VG-Lite flush commit trigger threshold. GPU will try to batch these many draw tasks. */
#define LV_VG_LITE_FLUSH_MAX_COUNT 8
/* Enable border to simulate shadow
* NOTE: which usually improves performance,
* but does not guarantee the same rendering quality as the software. */
#define LV_VG_LITE_USE_BOX_SHADOW 0
/* Enable border to simulate shadow
* NOTE: which usually improves performance,
* but does not guarantee the same rendering quality as the software. */
#define LV_VG_LITE_USE_BOX_SHADOW 0
/* VG-Lite gradient image maximum cache number.
* NOTE: The memory usage of a single gradient image is 4K bytes.
*/
#define LV_VG_LITE_GRAD_CACHE_SIZE 32
/* VG-Lite gradient maximum cache number.
* NOTE: The memory usage of a single gradient image is 4K bytes.
*/
#define LV_VG_LITE_GRAD_CACHE_CNT 32
/* VG-Lite stroke maximum cache number.
*/
#define LV_VG_LITE_STROKE_CACHE_CNT 32
#endif
@ -224,6 +277,11 @@
*0: User need to register a callback with `lv_log_register_print_cb()`*/
#define LV_LOG_PRINTF 0
/*Set callback to print the logs.
*E.g `my_print`. The prototype should be `void my_print(lv_log_level_t level, const char * buf)`
*Can be overwritten by `lv_log_register_print_cb`*/
//#define LV_LOG_PRINT_CB
/*1: Enable print timestamp;
*0: Disable print timestamp*/
#define LV_LOG_USE_TIMESTAMP 1
@ -232,6 +290,7 @@
*0: Do not print file and line number of the log*/
#define LV_LOG_USE_FILE_LINE 1
/*Enable/disable LV_LOG_TRACE in modules that produces a huge number of logs*/
#define LV_LOG_TRACE_MEM 1
#define LV_LOG_TRACE_TIMER 1
@ -310,12 +369,23 @@
/* Add `id` field to `lv_obj_t` */
#define LV_USE_OBJ_ID 0
/* Use lvgl builtin method for obj ID */
#define LV_USE_OBJ_ID_BUILTIN 0
/* Automatically assign an ID when obj is created */
#define LV_OBJ_ID_AUTO_ASSIGN LV_USE_OBJ_ID
/*Use the builtin obj ID handler functions:
* - lv_obj_assign_id: Called when a widget is created. Use a separate counter for each widget class as an ID.
* - lv_obj_id_compare: Compare the ID to decide if it matches with a requested value.
* - lv_obj_stringify_id: Return e.g. "button3"
* - lv_obj_free_id: Does nothing, as there is no memory allocation for the ID.
* When disabled these functions needs to be implemented by the user.*/
#define LV_USE_OBJ_ID_BUILTIN 1
/*Use obj property set/get API*/
#define LV_USE_OBJ_PROPERTY 0
/*Enable property name support*/
#define LV_USE_OBJ_PROPERTY_NAME 1
/* VG-Lite Simulator */
/*Requires: LV_USE_THORVG_INTERNAL or LV_USE_THORVG_EXTERNAL */
#define LV_USE_VG_LITE_THORVG 0
@ -328,6 +398,9 @@
/*Enable YUV color format support*/
#define LV_VG_LITE_THORVG_YUV_SUPPORT 0
/*Enable Linear gradient extension support*/
#define LV_VG_LITE_THORVG_LINEAR_GRADIENT_EXT_SUPPORT 0
/*Enable 16 pixels alignment*/
#define LV_VG_LITE_THORVG_16PIXELS_ALIGN 1
@ -372,7 +445,7 @@
#define LV_ATTRIBUTE_FAST_MEM
/*Export integer constant to binding. This macro is used with constants in the form of LV_<CONST> that
*should also appear on LVGL binding API such as Micropython.*/
*should also appear on LVGL binding API such as MicroPython.*/
#define LV_EXPORT_CONST_INT(int_value) struct _silence_gcc_warning /*The default value just prevents GCC warning*/
/*Prefix all global extern data with this*/
@ -381,6 +454,13 @@
/* Use `float` as `lv_value_precise_t` */
#define LV_USE_FLOAT 0
/*Enable matrix support
*Requires `LV_USE_FLOAT = 1`*/
#define LV_USE_MATRIX 0
/*Include `lvgl_private.h` in `lvgl.h` to access internal data and functions by default*/
#define LV_USE_PRIVATE_API 0
/*==================
* FONT USAGE
*===================*/
@ -412,6 +492,7 @@
/*Demonstrate special features*/
#define LV_FONT_MONTSERRAT_28_COMPRESSED 0 /*bpp = 3*/
#define LV_FONT_DEJAVU_16_PERSIAN_HEBREW 0 /*Hebrew, Arabic, Persian letters and all their forms*/
#define LV_FONT_SIMSUN_14_CJK 0 /*1000 most common CJK radicals*/
#define LV_FONT_SIMSUN_16_CJK 0 /*1000 most common CJK radicals*/
/*Pixel perfect monospace fonts*/
@ -477,7 +558,7 @@
#endif
/*Enable Arabic/Persian processing
*In these languages characters should be replaced with an other form based on their position in the text*/
*In these languages characters should be replaced with another form based on their position in the text*/
#define LV_USE_ARABIC_PERSIAN_CHARS 0
/*==================
@ -510,6 +591,7 @@
#define LV_CALENDAR_DEFAULT_MONTH_NAMES {"January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"}
#define LV_USE_CALENDAR_HEADER_ARROW 1
#define LV_USE_CALENDAR_HEADER_DROPDOWN 1
#define LV_USE_CALENDAR_CHINESE 0
#endif /*LV_USE_CALENDAR*/
#define LV_USE_CANVAS 1
@ -539,6 +621,8 @@
#define LV_USE_LIST 1
#define LV_USE_LOTTIE 0 /*Requires: lv_canvas, thorvg */
#define LV_USE_MENU 1
#define LV_USE_MSGBOX 1
@ -614,6 +698,9 @@
/*File system interfaces for common APIs */
/*Setting a default driver letter allows skipping the driver prefix in filepaths*/
#define LV_FS_DEFAULT_DRIVE_LETTER '\0'
/*API for fopen, fread, etc*/
#define LV_USE_FS_STDIO 0
#if LV_USE_FS_STDIO
@ -657,6 +744,18 @@
#define LV_FS_LITTLEFS_LETTER '\0' /*Set an upper cased letter on which the drive will accessible (e.g. 'A')*/
#endif
/*API for Arduino LittleFs. */
#define LV_USE_FS_ARDUINO_ESP_LITTLEFS 0
#if LV_USE_FS_ARDUINO_ESP_LITTLEFS
#define LV_FS_ARDUINO_ESP_LITTLEFS_LETTER '\0' /*Set an upper cased letter on which the drive will accessible (e.g. 'A')*/
#endif
/*API for Arduino Sd. */
#define LV_USE_FS_ARDUINO_SD 0
#if LV_USE_FS_ARDUINO_SD
#define LV_FS_ARDUINO_SD_LETTER '\0' /*Set an upper cased letter on which the drive will accessible (e.g. 'A')*/
#endif
/*LODEPNG decoder library*/
#define LV_USE_LODEPNG 0
@ -677,8 +776,8 @@
/*GIF decoder library*/
#define LV_USE_GIF 0
#if LV_USE_GIF
/*GIF decoder accelerate*/
#define LV_GIF_CACHE_DECODE_DATA 0
/*GIF decoder accelerate*/
#define LV_GIF_CACHE_DECODE_DATA 0
#endif
@ -710,12 +809,14 @@
#if LV_USE_TINY_TTF
/* Enable loading TTF data from files */
#define LV_TINY_TTF_FILE_SUPPORT 0
#define LV_TINY_TTF_CACHE_GLYPH_CNT 256
#endif
/*Rlottie library*/
#define LV_USE_RLOTTIE 0
/*Enable Vector Graphic APIs*/
/*Enable Vector Graphic APIs
*Requires `LV_USE_MATRIX = 1`*/
#define LV_USE_VECTOR_GRAPHIC 0
/* Enable ThorVG (vector graphics library) from the src/libs folder */
@ -817,7 +918,7 @@
#define LV_USE_IME_PINYIN 0
#if LV_USE_IME_PINYIN
/*1: Use default thesaurus*/
/*If you do not use the default thesaurus, be sure to use `lv_ime_pinyin` after setting the thesauruss*/
/*If you do not use the default thesaurus, be sure to use `lv_ime_pinyin` after setting the thesaurus*/
#define LV_IME_PINYIN_USE_DEFAULT_DICT 1
/*Set the maximum number of candidate panels that can be displayed*/
/*This needs to be adjusted according to the size of the screen*/
@ -851,6 +952,7 @@
#define LV_SDL_INCLUDE_PATH <SDL2/SDL.h>
#define LV_SDL_RENDER_MODE LV_DISPLAY_RENDER_MODE_DIRECT /*LV_DISPLAY_RENDER_MODE_DIRECT is recommended for best performance*/
#define LV_SDL_BUF_COUNT 1 /*1 or 2*/
#define LV_SDL_ACCELERATED 1 /*1: Use hardware acceleration*/
#define LV_SDL_FULLSCREEN 0 /*1: Make the window full screen by default*/
#define LV_SDL_DIRECT_EXIT 1 /*1: Exit the application when all SDL windows are closed*/
#define LV_SDL_MOUSEWHEEL_MODE LV_SDL_MOUSEWHEEL_MODE_ENCODER /*LV_SDL_MOUSEWHEEL_MODE_ENCODER/CROWN*/
@ -860,13 +962,20 @@
#define LV_USE_X11 0
#if LV_USE_X11
#define LV_X11_DIRECT_EXIT 1 /*Exit the application when all X11 windows have been closed*/
#define LV_X11_DOUBLE_BUFFER 1 /*Use double buffers for endering*/
#define LV_X11_DOUBLE_BUFFER 1 /*Use double buffers for rendering*/
/*select only 1 of the following render modes (LV_X11_RENDER_MODE_PARTIAL preferred!)*/
#define LV_X11_RENDER_MODE_PARTIAL 1 /*Partial render mode (preferred)*/
#define LV_X11_RENDER_MODE_DIRECT 0 /*direct render mode*/
#define LV_X11_RENDER_MODE_FULL 0 /*Full render mode*/
#endif
/*Use Wayland to open a window and handle input on Linux or BSD desktops */
#define LV_USE_WAYLAND 0
#if LV_USE_WAYLAND
#define LV_WAYLAND_WINDOW_DECORATIONS 0 /*Draw client side window decorations only necessary on Mutter/GNOME*/
#define LV_WAYLAND_WL_SHELL 0 /*Use the legacy wl_shell protocol instead of the default XDG shell*/
#endif
/*Driver for /dev/fb*/
#define LV_USE_LINUX_FBDEV 0
#if LV_USE_LINUX_FBDEV
@ -921,16 +1030,31 @@
#endif
/*Drivers for LCD devices connected via SPI/parallel port*/
#define LV_USE_ST7735 0
#define LV_USE_ST7789 0
#define LV_USE_ST7796 0
#define LV_USE_ILI9341 0
#define LV_USE_ST7735 0
#define LV_USE_ST7789 0
#define LV_USE_ST7796 0
#define LV_USE_ILI9341 0
#define LV_USE_GENERIC_MIPI (LV_USE_ST7735 | LV_USE_ST7789 | LV_USE_ST7796 | LV_USE_ILI9341)
/*Driver for Renesas GLCD*/
#define LV_USE_RENESAS_GLCDC 0
/* LVGL Windows backend */
#define LV_USE_WINDOWS 0
/* Use OpenGL to open window on PC and handle mouse and keyboard */
#define LV_USE_OPENGLES 0
#if LV_USE_OPENGLES
#define LV_USE_OPENGLES_DEBUG 1 /* Enable or disable debug for opengles */
#endif
/* QNX Screen display and input drivers */
#define LV_USE_QNX 0
#if LV_USE_QNX
#define LV_QNX_BUF_COUNT 1 /*1 or 2*/
#endif
/*==================
* EXAMPLES
*==================*/
@ -981,6 +1105,7 @@
/*Vector graphic demo*/
#define LV_USE_DEMO_VECTOR_GRAPHIC 0
/*--END OF LV_CONF_H--*/
#endif /*LV_CONF_H*/

View File

@ -0,0 +1,14 @@
/**
* @file lv_version.h
* The current version of LVGL
*/
#ifndef LVGL_VERSION_H
#define LVGL_VERSION_H
#define LVGL_VERSION_MAJOR 9
#define LVGL_VERSION_MINOR 2
#define LVGL_VERSION_PATCH 0
#define LVGL_VERSION_INFO ""
#endif /* LVGL_VERSION_H */

View File

@ -13,10 +13,7 @@ extern "C" {
/***************************
* CURRENT VERSION OF LVGL
***************************/
#define LVGL_VERSION_MAJOR 9
#define LVGL_VERSION_MINOR 1
#define LVGL_VERSION_PATCH 0
#define LVGL_VERSION_INFO ""
#include "lv_version.h"
/*********************
* INCLUDES
@ -35,6 +32,7 @@ extern "C" {
#include "src/misc/lv_anim_timeline.h"
#include "src/misc/lv_profiler_builtin.h"
#include "src/misc/lv_rb.h"
#include "src/misc/lv_utils.h"
#include "src/tick/lv_tick.h"
@ -65,6 +63,7 @@ extern "C" {
#include "src/widgets/led/lv_led.h"
#include "src/widgets/line/lv_line.h"
#include "src/widgets/list/lv_list.h"
#include "src/widgets/lottie/lv_lottie.h"
#include "src/widgets/menu/lv_menu.h"
#include "src/widgets/msgbox/lv_msgbox.h"
#include "src/widgets/roller/lv_roller.h"
@ -111,6 +110,7 @@ extern "C" {
#include "src/draw/lv_draw.h"
#include "src/draw/lv_draw_buf.h"
#include "src/draw/lv_draw_vector.h"
#include "src/draw/sw/lv_draw_sw.h"
#include "src/themes/lv_theme.h"
@ -118,8 +118,12 @@ extern "C" {
#include "src/lv_api_map_v8.h"
#include "src/lv_api_map_v9_0.h"
#include "src/lv_api_map_v9_1.h"
#if LV_USE_PRIVATE_API
#include "src/lvgl_private.h"
#endif
#include "src/core/lv_global.h"
/*********************
* DEFINES
*********************/

View File

@ -15,8 +15,6 @@ extern "C" {
*********************/
#include "../lv_conf_internal.h"
#include <stdbool.h>
#include "../misc/lv_types.h"
#include "../draw/lv_draw.h"
#if LV_USE_DRAW_SW
@ -29,16 +27,30 @@ extern "C" {
#include "../misc/lv_log.h"
#include "../misc/lv_style.h"
#include "../misc/lv_timer.h"
#include "../osal/lv_os.h"
#include "../others/sysmon/lv_sysmon.h"
#include "../stdlib/builtin/lv_tlsf.h"
#if LV_USE_FONT_COMPRESSED
#include "../font/lv_font_fmt_txt.h"
#include "../font/lv_font_fmt_txt_private.h"
#endif
#include "../tick/lv_tick.h"
#include "../layouts/lv_layout.h"
#include "../misc/lv_types.h"
#include "../misc/lv_timer_private.h"
#include "../misc/lv_anim_private.h"
#include "../tick/lv_tick_private.h"
#include "../draw/lv_draw_buf_private.h"
#include "../draw/lv_draw_private.h"
#include "../draw/sw/lv_draw_sw_private.h"
#include "../draw/sw/lv_draw_sw_mask_private.h"
#include "../stdlib/builtin/lv_tlsf_private.h"
#include "../others/sysmon/lv_sysmon_private.h"
#include "../layouts/lv_layout_private.h"
/*********************
* DEFINES
*********************/
@ -53,18 +65,18 @@ struct _snippet_stack;
#endif
#if LV_USE_FREETYPE
struct _lv_freetype_context_t;
struct lv_freetype_context_t;
#endif
#if LV_USE_PROFILER && LV_USE_PROFILER_BUILTIN
struct _lv_profiler_builtin_ctx_t;
struct lv_profiler_builtin_ctx_t;
#endif
#if LV_USE_NUTTX
struct _lv_nuttx_ctx_t;
struct lv_nuttx_ctx_t;
#endif
typedef struct _lv_global_t {
typedef struct lv_global_t {
bool inited;
bool deinit_in_progress; /**< Can be used e.g. in the LV_EVENT_DELETE to deinit the drivers too */
@ -100,23 +112,21 @@ typedef struct _lv_global_t {
lv_tick_state_t tick_state;
lv_draw_buf_handlers_t draw_buf_handlers;
lv_draw_buf_handlers_t font_draw_buf_handlers;
lv_draw_buf_handlers_t image_cache_draw_buf_handlers; /**< Ensure that all assigned draw buffers
* can be managed by image cache. */
lv_ll_t img_decoder_ll;
#if LV_CACHE_DEF_SIZE > 0
lv_cache_t * img_cache;
#endif
#if LV_IMAGE_HEADER_CACHE_DEF_CNT > 0
lv_cache_t * img_header_cache;
#endif
lv_draw_global_info_t draw_info;
#if defined(LV_DRAW_SW_SHADOW_CACHE_SIZE) && LV_DRAW_SW_SHADOW_CACHE_SIZE > 0
lv_draw_sw_shadow_cache_t sw_shadow_cache;
#endif
#if LV_DRAW_SW_COMPLEX
_lv_draw_sw_mask_radius_circle_dsc_arr_t sw_circle_cache;
lv_draw_sw_mask_radius_circle_dsc_arr_t sw_circle_cache;
#endif
#if LV_USE_LOG
@ -163,12 +173,16 @@ typedef struct _lv_global_t {
lv_fs_drv_t littlefs_fs_drv;
#endif
#if LV_USE_FREETYPE
struct _lv_freetype_context_t * ft_context;
#if LV_USE_FS_ARDUINO_ESP_LITTLEFS
lv_fs_drv_t arduino_esp_littlefs_fs_drv;
#endif
#if LV_USE_TINY_TTF
lv_cache_t * tiny_ttf_cache;
#if LV_USE_FS_ARDUINO_SD
lv_fs_drv_t arduino_sd_fs_drv;
#endif
#if LV_USE_FREETYPE
struct lv_freetype_context_t * ft_context;
#endif
#if LV_USE_FONT_COMPRESSED
@ -180,18 +194,14 @@ typedef struct _lv_global_t {
#endif
#if LV_USE_PROFILER && LV_USE_PROFILER_BUILTIN
struct _lv_profiler_builtin_ctx_t * profiler_context;
struct lv_profiler_builtin_ctx_t * profiler_context;
#endif
#if LV_USE_FILE_EXPLORER != 0
lv_style_t fe_list_button_style;
#endif
#if LV_USE_SYSMON && LV_USE_PERF_MONITOR
lv_sysmon_backend_data_t sysmon_perf;
#endif
#if LV_USE_SYSMON && LV_USE_MEM_MONITOR
#if LV_USE_MEM_MONITOR
lv_sysmon_backend_data_t sysmon_mem;
#endif
@ -205,9 +215,21 @@ typedef struct _lv_global_t {
#endif
#if LV_USE_NUTTX
struct _lv_nuttx_ctx_t * nuttx_ctx;
struct lv_nuttx_ctx_t * nuttx_ctx;
#endif
#if LV_USE_OS != LV_OS_NONE
lv_mutex_t lv_general_mutex;
#endif
#if LV_USE_OS == LV_OS_FREERTOS
uint32_t freertos_idle_time_sum;
uint32_t freertos_non_idle_time_sum;
uint32_t freertos_task_switch_timestamp;
bool freertos_idle_task_running;
#endif
void * user_data;
} lv_global_t;

View File

@ -6,12 +6,11 @@
/*********************
* INCLUDES
*********************/
#include <stddef.h>
#include "lv_group.h"
#include "../core/lv_obj.h"
#include "lv_group_private.h"
#include "../core/lv_obj_private.h"
#include "../core/lv_global.h"
#include "../indev/lv_indev.h"
#include "../misc/lv_types.h"
/*********************
* DEFINES
@ -43,22 +42,22 @@ static lv_indev_t * get_indev(const lv_group_t * g);
* GLOBAL FUNCTIONS
**********************/
void _lv_group_init(void)
void lv_group_init(void)
{
_lv_ll_init(group_ll_p, sizeof(lv_group_t));
lv_ll_init(group_ll_p, sizeof(lv_group_t));
}
void _lv_group_deinit(void)
void lv_group_deinit(void)
{
_lv_ll_clear(group_ll_p);
lv_ll_clear(group_ll_p);
}
lv_group_t * lv_group_create(void)
{
lv_group_t * group = _lv_ll_ins_head(group_ll_p);
lv_group_t * group = lv_ll_ins_head(group_ll_p);
LV_ASSERT_MALLOC(group);
if(group == NULL) return NULL;
_lv_ll_init(&group->obj_ll, sizeof(lv_obj_t *));
lv_ll_init(&group->obj_ll, sizeof(lv_obj_t *));
group->obj_focus = NULL;
group->frozen = 0;
@ -83,7 +82,7 @@ void lv_group_delete(lv_group_t * group)
/*Remove the objects from the group*/
lv_obj_t ** obj;
_LV_LL_READ(&group->obj_ll, obj) {
LV_LL_READ(&group->obj_ll, obj) {
if((*obj)->spec_attr)(*obj)->spec_attr->group_p = NULL;
}
@ -99,8 +98,8 @@ void lv_group_delete(lv_group_t * group)
/*If the group is the default group, set the default group as NULL*/
if(group == lv_group_get_default()) lv_group_set_default(NULL);
_lv_ll_clear(&(group->obj_ll));
_lv_ll_remove(group_ll_p, group);
lv_ll_clear(&(group->obj_ll));
lv_ll_remove(group_ll_p, group);
lv_free(group);
}
@ -123,36 +122,17 @@ void lv_group_add_obj(lv_group_t * group, lv_obj_t * obj)
/*Be sure the object is removed from its current group*/
lv_group_remove_obj(obj);
/*Do not add the object twice*/
lv_obj_t ** obj_i;
_LV_LL_READ(&group->obj_ll, obj_i) {
if((*obj_i) == obj) {
LV_LOG_INFO("the object is already added to this group");
return;
}
}
/*If the object is already in a group and focused then refocus it*/
lv_group_t * group_cur = lv_obj_get_group(obj);
if(group_cur) {
if(obj->spec_attr->group_p && *(obj->spec_attr->group_p->obj_focus) == obj) {
lv_group_refocus(group_cur);
LV_LOG_INFO("changing object's group");
}
}
if(obj->spec_attr == NULL) lv_obj_allocate_spec_attr(obj);
obj->spec_attr->group_p = group;
lv_obj_t ** next = _lv_ll_ins_tail(&group->obj_ll);
lv_obj_t ** next = lv_ll_ins_tail(&group->obj_ll);
LV_ASSERT_MALLOC(next);
if(next == NULL) return;
*next = obj;
/*If the head and the tail is equal then there is only one object in the linked list.
*In this case automatically activate it*/
if(_lv_ll_get_head(&group->obj_ll) == next) {
if(lv_ll_get_head(&group->obj_ll) == next) {
lv_group_refocus(group);
}
@ -168,7 +148,7 @@ void lv_group_swap_obj(lv_obj_t * obj1, lv_obj_t * obj2)
/*Do not add the object twice*/
lv_obj_t ** obj_i;
_LV_LL_READ(&g1->obj_ll, obj_i) {
LV_LL_READ(&g1->obj_ll, obj_i) {
if((*obj_i) == obj1)(*obj_i) = obj2;
else if((*obj_i) == obj2)(*obj_i) = obj1;
}
@ -191,7 +171,7 @@ void lv_group_remove_obj(lv_obj_t * obj)
if(g->frozen) g->frozen = 0;
/*If this is the only object in the group then focus to nothing.*/
if(_lv_ll_get_head(&g->obj_ll) == g->obj_focus && _lv_ll_get_tail(&g->obj_ll) == g->obj_focus) {
if(lv_ll_get_head(&g->obj_ll) == g->obj_focus && lv_ll_get_tail(&g->obj_ll) == g->obj_focus) {
lv_obj_send_event(*g->obj_focus, LV_EVENT_DEFOCUSED, get_indev(g));
}
/*If there more objects in the group then focus to the next/prev object*/
@ -209,9 +189,9 @@ void lv_group_remove_obj(lv_obj_t * obj)
/*Search the object and remove it from its group*/
lv_obj_t ** i;
_LV_LL_READ(&g->obj_ll, i) {
LV_LL_READ(&g->obj_ll, i) {
if(*i == obj) {
_lv_ll_remove(&g->obj_ll, i);
lv_ll_remove(&g->obj_ll, i);
lv_free(i);
if(obj->spec_attr) obj->spec_attr->group_p = NULL;
break;
@ -233,11 +213,11 @@ void lv_group_remove_all_objs(lv_group_t * group)
/*Remove the objects from the group*/
lv_obj_t ** obj;
_LV_LL_READ(&group->obj_ll, obj) {
LV_LL_READ(&group->obj_ll, obj) {
if((*obj)->spec_attr)(*obj)->spec_attr->group_p = NULL;
}
_lv_ll_clear(&(group->obj_ll));
lv_ll_clear(&(group->obj_ll));
}
void lv_group_focus_obj(lv_obj_t * obj)
@ -252,7 +232,7 @@ void lv_group_focus_obj(lv_obj_t * obj)
lv_group_set_editing(g, false);
lv_obj_t ** i;
_LV_LL_READ(&g->obj_ll, i) {
LV_LL_READ(&g->obj_ll, i) {
if(*i == obj) {
if(g->obj_focus != NULL && obj != *g->obj_focus) { /*Do not defocus if the same object needs to be focused again*/
lv_result_t res = lv_obj_send_event(*g->obj_focus, LV_EVENT_DEFOCUSED, get_indev(g));
@ -277,7 +257,7 @@ void lv_group_focus_next(lv_group_t * group)
{
LV_ASSERT_NULL(group);
bool focus_changed = focus_next_core(group, _lv_ll_get_head, _lv_ll_get_next);
bool focus_changed = focus_next_core(group, lv_ll_get_head, lv_ll_get_next);
if(group->edge_cb) {
if(!focus_changed)
group->edge_cb(group, true);
@ -288,7 +268,7 @@ void lv_group_focus_prev(lv_group_t * group)
{
LV_ASSERT_NULL(group);
bool focus_changed = focus_next_core(group, _lv_ll_get_tail, _lv_ll_get_prev);
bool focus_changed = focus_next_core(group, lv_ll_get_tail, lv_ll_get_prev);
if(group->edge_cb) {
if(!focus_changed)
group->edge_cb(group, false);
@ -394,22 +374,36 @@ bool lv_group_get_wrap(lv_group_t * group)
uint32_t lv_group_get_obj_count(lv_group_t * group)
{
LV_ASSERT_NULL(group);
return _lv_ll_get_len(&group->obj_ll);
return lv_ll_get_len(&group->obj_ll);
}
lv_obj_t * lv_group_get_obj_by_index(lv_group_t * group, uint32_t index)
{
uint32_t len = 0;
lv_obj_t ** obj;
LV_LL_READ(&group->obj_ll, obj) {
if(len == index) {
return *obj;
}
len++;
}
return NULL;
}
uint32_t lv_group_get_count(void)
{
return _lv_ll_get_len(group_ll_p);
return lv_ll_get_len(group_ll_p);
}
lv_group_t * lv_group_by_index(uint32_t index)
{
uint32_t len = 0;
void * node;
lv_group_t * group;
for(node = _lv_ll_get_tail(group_ll_p); node != NULL; node = _lv_ll_get_prev(group_ll_p, node)) {
LV_LL_READ_BACK(group_ll_p, group) {
if(len == index) {
return (lv_group_t *) node;
return group;
}
len++;
}

View File

@ -13,19 +13,16 @@ extern "C" {
/*********************
* INCLUDES
*********************/
#include "../lv_conf_internal.h"
#include <stdint.h>
#include <stdbool.h>
#include "../misc/lv_types.h"
#include "../misc/lv_ll.h"
/*********************
* DEFINES
*********************/
/*Predefined keys to control the focused object via lv_group_send(group, c)*/
enum _lv_key_t {
/** Predefined keys to control focused object via lv_group_send(group, c) */
typedef enum {
LV_KEY_UP = 17, /*0x11*/
LV_KEY_DOWN = 18, /*0x12*/
LV_KEY_RIGHT = 19, /*0x13*/
@ -38,7 +35,7 @@ enum _lv_key_t {
LV_KEY_PREV = 11, /*0x0B, '*/
LV_KEY_HOME = 2, /*0x02, STX*/
LV_KEY_END = 3, /*0x03, ETX*/
};
} lv_key_t;
/**********************
* TYPEDEFS
@ -47,29 +44,6 @@ enum _lv_key_t {
typedef void (*lv_group_focus_cb_t)(lv_group_t *);
typedef void (*lv_group_edge_cb_t)(lv_group_t *, bool);
/**
* Groups can be used to logically hold objects so that they can be individually focused.
* They are NOT for laying out objects on a screen (try layouts for that).
*/
struct _lv_group_t {
lv_ll_t obj_ll; /**< Linked list to store the objects in the group*/
lv_obj_t ** obj_focus; /**< The object in focus*/
lv_group_focus_cb_t focus_cb; /**< A function to call when a new object is focused (optional)*/
lv_group_edge_cb_t edge_cb; /**< A function to call when an edge is reached, no more focus
targets are available in this direction (to allow edge feedback
like a sound or a scroll bounce) */
void * user_data;
uint8_t frozen : 1; /**< 1: can't focus to new object*/
uint8_t editing : 1; /**< 1: Edit mode, 0: Navigate mode*/
uint8_t refocus_policy : 1; /**< 1: Focus prev if focused on deletion. 0: Focus next if focused on
deletion.*/
uint8_t wrap : 1; /**< 1: Focus next/prev can wrap at end of list. 0: Focus next/prev stops at end
of list.*/
};
typedef enum {
LV_GROUP_REFOCUS_POLICY_NEXT = 0,
LV_GROUP_REFOCUS_POLICY_PREV = 1
@ -79,18 +53,6 @@ typedef enum {
* GLOBAL PROTOTYPES
**********************/
/**
* Init the group module
* @remarks Internal function, do not call directly.
*/
void _lv_group_init(void);
/**
* Deinit the group module
* @remarks Internal function, do not call directly.
*/
void _lv_group_deinit(void);
/**
* Create a new object group
* @return pointer to the new object group
@ -125,7 +87,7 @@ void lv_group_add_obj(lv_group_t * group, lv_obj_t * obj);
/**
* Swap 2 object in a group. The object must be in the same group
* @param obj1 pointer to an object
* @param obj2 pointer to an other object
* @param obj2 pointer to another object
*/
void lv_group_swap_obj(lv_obj_t * obj1, lv_obj_t * obj2);
@ -241,7 +203,6 @@ bool lv_group_get_editing(const lv_group_t * group);
/**
* Get whether focus next/prev will allow wrapping from first->last or last->first object.
* @param group pointer to group
* @param en true: wrapping enabled; false: wrapping disabled
*/
bool lv_group_get_wrap(lv_group_t * group);
@ -252,6 +213,14 @@ bool lv_group_get_wrap(lv_group_t * group);
*/
uint32_t lv_group_get_obj_count(lv_group_t * group);
/**
* Get the nth object within a group
* @param group pointer to a group
* @param index index of object within the group
* @return pointer to the object
*/
lv_obj_t * lv_group_get_obj_by_index(lv_group_t * group, uint32_t index);
/**
* Get the number of groups
* @return number of groups
@ -260,6 +229,7 @@ uint32_t lv_group_get_count(void);
/**
* Get a group by its index
* @param index index of the group
* @return pointer to the group
*/
lv_group_t * lv_group_by_index(uint32_t index);

View File

@ -0,0 +1,75 @@
/**
* @file lv_group_private.h
*
*/
#ifndef LV_GROUP_PRIVATE_H
#define LV_GROUP_PRIVATE_H
#ifdef __cplusplus
extern "C" {
#endif
/*********************
* INCLUDES
*********************/
#include "lv_group.h"
/*********************
* DEFINES
*********************/
/**********************
* TYPEDEFS
**********************/
/**
* Groups can be used to logically hold objects so that they can be individually focused.
* They are NOT for laying out objects on a screen (try layouts for that).
*/
struct lv_group_t {
lv_ll_t obj_ll; /**< Linked list to store the objects in the group*/
lv_obj_t ** obj_focus; /**< The object in focus*/
lv_group_focus_cb_t focus_cb; /**< A function to call when a new object is focused (optional)*/
lv_group_edge_cb_t edge_cb; /**< A function to call when an edge is reached, no more focus
targets are available in this direction (to allow edge feedback
like a sound or a scroll bounce) */
void * user_data;
uint8_t frozen : 1; /**< 1: can't focus to new object*/
uint8_t editing : 1; /**< 1: Edit mode, 0: Navigate mode*/
uint8_t refocus_policy : 1; /**< 1: Focus prev if focused on deletion. 0: Focus next if focused on
deletion.*/
uint8_t wrap : 1; /**< 1: Focus next/prev can wrap at end of list. 0: Focus next/prev stops at end
of list.*/
};
/**********************
* GLOBAL PROTOTYPES
**********************/
/**
* Init the group module
* @remarks Internal function, do not call directly.
*/
void lv_group_init(void);
/**
* Deinit the group module
* @remarks Internal function, do not call directly.
*/
void lv_group_deinit(void);
/**********************
* MACROS
**********************/
#ifdef __cplusplus
} /*extern "C"*/
#endif
#endif /*LV_GROUP_PRIVATE_H*/

View File

@ -6,7 +6,12 @@
/*********************
* INCLUDES
*********************/
#include "lv_obj.h"
#include "lv_obj_private.h"
#include "../misc/lv_event_private.h"
#include "../misc/lv_area_private.h"
#include "lv_obj_style_private.h"
#include "lv_obj_event_private.h"
#include "lv_obj_class_private.h"
#include "../indev/lv_indev.h"
#include "../indev/lv_indev_private.h"
#include "lv_refr.h"
@ -17,10 +22,10 @@
#include "../misc/lv_assert.h"
#include "../misc/lv_math.h"
#include "../misc/lv_log.h"
#include "../misc/lv_types.h"
#include "../tick/lv_tick.h"
#include "../stdlib/lv_string.h"
#include <stdint.h>
#include <string.h>
#include "lv_obj_draw_private.h"
/*********************
* DEFINES
@ -45,6 +50,8 @@ static void draw_scrollbar(lv_obj_t * obj, lv_layer_t * layer);
static lv_result_t scrollbar_init_draw_dsc(lv_obj_t * obj, lv_draw_rect_dsc_t * dsc);
static bool obj_valid_child(const lv_obj_t * parent, const lv_obj_t * obj_to_find);
static void update_obj_state(lv_obj_t * obj, lv_state_t new_state);
static void null_on_delete_cb(lv_event_t * e);
#if LV_USE_OBJ_PROPERTY
static lv_result_t lv_obj_set_any(lv_obj_t *, lv_prop_id_t, const lv_property_t *);
static lv_result_t lv_obj_get_any(const lv_obj_t *, lv_prop_id_t, lv_property_t *);
@ -60,6 +67,108 @@ static const lv_property_ops_t properties[] = {
.setter = lv_obj_set_parent,
.getter = lv_obj_get_parent,
},
{
.id = LV_PROPERTY_OBJ_X,
.setter = lv_obj_set_x,
.getter = lv_obj_get_x,
},
{
.id = LV_PROPERTY_OBJ_Y,
.setter = lv_obj_set_y,
.getter = lv_obj_get_y,
},
{
.id = LV_PROPERTY_OBJ_W,
.setter = lv_obj_set_width,
.getter = lv_obj_get_width,
},
{
.id = LV_PROPERTY_OBJ_H,
.setter = lv_obj_set_height,
.getter = lv_obj_get_height,
},
{
.id = LV_PROPERTY_OBJ_CONTENT_WIDTH,
.setter = lv_obj_set_content_width,
.getter = lv_obj_get_content_width,
},
{
.id = LV_PROPERTY_OBJ_CONTENT_HEIGHT,
.setter = lv_obj_set_content_height,
.getter = lv_obj_get_content_height,
},
{
.id = LV_PROPERTY_OBJ_LAYOUT,
.setter = lv_obj_set_layout,
},
{
.id = LV_PROPERTY_OBJ_ALIGN,
.setter = lv_obj_set_align,
},
{
.id = LV_PROPERTY_OBJ_SCROLLBAR_MODE,
.setter = lv_obj_set_scrollbar_mode,
.getter = lv_obj_get_scrollbar_mode,
},
{
.id = LV_PROPERTY_OBJ_SCROLL_DIR,
.setter = lv_obj_set_scroll_dir,
.getter = lv_obj_get_scroll_dir,
},
{
.id = LV_PROPERTY_OBJ_SCROLL_SNAP_X,
.setter = lv_obj_set_scroll_snap_x,
.getter = lv_obj_get_scroll_snap_x,
},
{
.id = LV_PROPERTY_OBJ_SCROLL_SNAP_Y,
.setter = lv_obj_set_scroll_snap_y,
.getter = lv_obj_get_scroll_snap_y,
},
{
.id = LV_PROPERTY_OBJ_SCROLL_TOP,
.getter = lv_obj_get_scroll_top,
},
{
.id = LV_PROPERTY_OBJ_SCROLL_BOTTOM,
.getter = lv_obj_get_scroll_bottom,
},
{
.id = LV_PROPERTY_OBJ_SCROLL_LEFT,
.getter = lv_obj_get_scroll_left,
},
{
.id = LV_PROPERTY_OBJ_SCROLL_RIGHT,
.getter = lv_obj_get_scroll_right,
},
{
.id = LV_PROPERTY_OBJ_SCROLL_END,
.getter = lv_obj_get_scroll_end,
},
{
.id = LV_PROPERTY_OBJ_EXT_DRAW_SIZE,
.getter = lv_obj_get_ext_draw_size,
},
{
.id = LV_PROPERTY_OBJ_EVENT_COUNT,
.getter = lv_obj_get_event_count,
},
{
.id = LV_PROPERTY_OBJ_SCREEN,
.getter = lv_obj_get_screen,
},
{
.id = LV_PROPERTY_OBJ_DISPLAY,
.getter = lv_obj_get_display,
},
{
.id = LV_PROPERTY_OBJ_CHILD_COUNT,
.getter = lv_obj_get_child_count,
},
{
.id = LV_PROPERTY_OBJ_INDEX,
.getter = lv_obj_get_index,
},
{
.id = LV_PROPERTY_ID_ANY,
.setter = lv_obj_set_any,
@ -84,6 +193,12 @@ const lv_obj_class_t lv_obj_class = {
.prop_index_end = LV_PROPERTY_OBJ_END,
.properties = properties,
.properties_count = sizeof(properties) / sizeof(properties[0]),
#if LV_USE_OBJ_PROPERTY_NAME
.property_names = lv_obj_property_names,
.names_count = sizeof(lv_obj_property_names) / sizeof(lv_property_name_t),
#endif
#endif
};
@ -99,6 +214,8 @@ lv_obj_t * lv_obj_create(lv_obj_t * parent)
{
LV_LOG_INFO("begin");
lv_obj_t * obj = lv_obj_class_create_obj(MY_CLASS, parent);
LV_ASSERT_NULL(obj);
if(obj == NULL) return NULL;
lv_obj_class_init_obj(obj);
return obj;
}
@ -262,7 +379,7 @@ void lv_obj_allocate_spec_attr(lv_obj_t * obj)
LV_ASSERT_OBJ(obj, MY_CLASS);
if(obj->spec_attr == NULL) {
obj->spec_attr = lv_malloc_zeroed(sizeof(_lv_obj_spec_attr_t));
obj->spec_attr = lv_malloc_zeroed(sizeof(lv_obj_spec_attr_t));
LV_ASSERT_MALLOC(obj->spec_attr);
if(obj->spec_attr == NULL) return;
@ -310,6 +427,51 @@ bool lv_obj_is_valid(const lv_obj_t * obj)
return false;
}
void lv_obj_null_on_delete(lv_obj_t ** obj_ptr)
{
lv_obj_add_event_cb(*obj_ptr, null_on_delete_cb, LV_EVENT_DELETE, obj_ptr);
}
#if LV_USE_OBJ_ID
void * lv_obj_get_id(const lv_obj_t * obj)
{
LV_ASSERT_NULL(obj);
return obj->id;
}
lv_obj_t * lv_obj_get_child_by_id(const lv_obj_t * obj, const void * id)
{
if(obj == NULL) obj = lv_display_get_screen_active(NULL);
if(obj == NULL) return NULL;
uint32_t i;
uint32_t child_cnt = lv_obj_get_child_count(obj);
for(i = 0; i < child_cnt; i++) {
lv_obj_t * child = obj->spec_attr->children[i];
if(lv_obj_id_compare(child->id, id) == 0) return child;
}
/*Search children*/
for(i = 0; i < child_cnt; i++) {
lv_obj_t * child = obj->spec_attr->children[i];
lv_obj_t * found = lv_obj_get_child_by_id(child, id);
if(found != NULL) return found;
}
return NULL;
}
#endif
void lv_obj_set_user_data(lv_obj_t * obj, void * user_data)
{
obj->user_data = user_data;
}
void * lv_obj_get_user_data(lv_obj_t * obj)
{
return obj->user_data;
}
/**********************
* STATIC FUNCTIONS
**********************/
@ -342,7 +504,7 @@ static void lv_obj_constructor(const lv_obj_class_t * class_p, lv_obj_t * obj)
obj->flags |= LV_OBJ_FLAG_SCROLL_WITH_ARROW;
if(parent) obj->flags |= LV_OBJ_FLAG_GESTURE_BUBBLE;
#if LV_USE_OBJ_ID
#if LV_OBJ_ID_AUTO_ASSIGN
lv_obj_assign_id(class_p, obj);
#endif
@ -353,7 +515,7 @@ static void lv_obj_destructor(const lv_obj_class_t * class_p, lv_obj_t * obj)
{
LV_UNUSED(class_p);
_lv_event_mark_deleted(obj);
lv_event_mark_deleted(obj);
/*Remove all style*/
lv_obj_enable_style_refresh(false); /*No need to refresh the style because the object will be deleted*/
@ -379,7 +541,7 @@ static void lv_obj_destructor(const lv_obj_class_t * class_p, lv_obj_t * obj)
obj->spec_attr = NULL;
}
#if LV_USE_OBJ_ID
#if LV_OBJ_ID_AUTO_ASSIGN
lv_obj_free_id(obj);
#endif
}
@ -404,7 +566,7 @@ static void lv_obj_draw(lv_event_t * e)
lv_area_copy(&coords, &obj->coords);
lv_area_increase(&coords, w, h);
if(_lv_area_is_in(info->area, &coords, r) == false) {
if(lv_area_is_in(info->area, &coords, r) == false) {
info->res = LV_COVER_RES_NOT_COVER;
return;
}
@ -713,6 +875,12 @@ static void lv_obj_event(const lv_obj_class_t * class_p, lv_event_t * e)
lv_obj_remove_state(obj, LV_STATE_PRESSED);
lv_obj_remove_state(obj, LV_STATE_SCROLLED);
}
else if(code == LV_EVENT_HOVER_OVER) {
lv_obj_add_state(obj, LV_STATE_HOVERED);
}
else if(code == LV_EVENT_HOVER_LEAVE) {
lv_obj_remove_state(obj, LV_STATE_HOVERED);
}
}
/**
@ -729,9 +897,9 @@ static void update_obj_state(lv_obj_t * obj, lv_state_t new_state)
lv_state_t prev_state = obj->state;
_lv_style_state_cmp_t cmp_res = _lv_obj_style_state_compare(obj, prev_state, new_state);
lv_style_state_cmp_t cmp_res = lv_obj_style_state_compare(obj, prev_state, new_state);
/*If there is no difference in styles there is nothing else to do*/
if(cmp_res == _LV_STYLE_STATE_CMP_SAME) {
if(cmp_res == LV_STYLE_STATE_CMP_SAME) {
obj->state = new_state;
return;
}
@ -740,12 +908,12 @@ static void update_obj_state(lv_obj_t * obj, lv_state_t new_state)
lv_obj_invalidate(obj);
obj->state = new_state;
_lv_obj_update_layer_type(obj);
_lv_obj_style_transition_dsc_t * ts = lv_malloc_zeroed(sizeof(_lv_obj_style_transition_dsc_t) * STYLE_TRANSITION_MAX);
lv_obj_update_layer_type(obj);
lv_obj_style_transition_dsc_t * ts = lv_malloc_zeroed(sizeof(lv_obj_style_transition_dsc_t) * STYLE_TRANSITION_MAX);
uint32_t tsi = 0;
uint32_t i;
for(i = 0; i < obj->style_cnt && tsi < STYLE_TRANSITION_MAX; i++) {
_lv_obj_style_t * obj_style = &obj->styles[i];
lv_obj_style_t * obj_style = &obj->styles[i];
lv_state_t state_act = lv_obj_style_get_selector_state(obj->styles[i].selector);
lv_part_t part_act = lv_obj_style_get_selector_part(obj->styles[i].selector);
if(state_act & (~new_state)) continue; /*Skip unrelated styles*/
@ -781,19 +949,19 @@ static void update_obj_state(lv_obj_t * obj, lv_state_t new_state)
for(i = 0; i < tsi; i++) {
lv_part_t part_act = lv_obj_style_get_selector_part(ts[i].selector);
_lv_obj_style_create_transition(obj, part_act, prev_state, new_state, &ts[i]);
lv_obj_style_create_transition(obj, part_act, prev_state, new_state, &ts[i]);
}
lv_free(ts);
if(cmp_res == _LV_STYLE_STATE_CMP_DIFF_REDRAW) {
if(cmp_res == LV_STYLE_STATE_CMP_DIFF_REDRAW) {
/*Invalidation is not enough, e.g. layer type needs to be updated too*/
lv_obj_refresh_style(obj, LV_PART_ANY, LV_STYLE_PROP_ANY);
}
else if(cmp_res == _LV_STYLE_STATE_CMP_DIFF_LAYOUT) {
else if(cmp_res == LV_STYLE_STATE_CMP_DIFF_LAYOUT) {
lv_obj_refresh_style(obj, LV_PART_ANY, LV_STYLE_PROP_ANY);
}
else if(cmp_res == _LV_STYLE_STATE_CMP_DIFF_DRAW_PAD) {
else if(cmp_res == LV_STYLE_STATE_CMP_DIFF_DRAW_PAD) {
lv_obj_invalidate(obj);
lv_obj_refresh_ext_draw_size(obj);
}
@ -820,6 +988,12 @@ static bool obj_valid_child(const lv_obj_t * parent, const lv_obj_t * obj_to_fin
return false;
}
static void null_on_delete_cb(lv_event_t * e)
{
lv_obj_t ** obj_ptr = lv_event_get_user_data(e);
*obj_ptr = NULL;
}
#if LV_USE_OBJ_PROPERTY
static lv_result_t lv_obj_set_any(lv_obj_t * obj, lv_prop_id_t id, const lv_property_t * prop)
{

View File

@ -15,8 +15,6 @@ extern "C" {
*********************/
#include "../lv_conf_internal.h"
#include <stddef.h>
#include <stdbool.h>
#include "../misc/lv_types.h"
#include "../misc/lv_style.h"
#include "../misc/lv_area.h"
@ -45,7 +43,7 @@ extern "C" {
* Possible states of a widget.
* OR-ed values are possible
*/
enum _lv_state_t {
enum {
LV_STATE_DEFAULT = 0x0000,
LV_STATE_CHECKED = 0x0001,
LV_STATE_FOCUSED = 0x0002,
@ -70,7 +68,7 @@ enum _lv_state_t {
* Not all parts are used by every widget
*/
enum _lv_part_t {
enum {
LV_PART_MAIN = 0x000000, /**< A background like rectangle*/
LV_PART_SCROLLBAR = 0x010000, /**< The scrollbar(s)*/
LV_PART_INDICATOR = 0x020000, /**< Indicator, e.g. for slider, bar, switch, or the tick box of the checkbox*/
@ -110,7 +108,7 @@ typedef enum {
LV_OBJ_FLAG_EVENT_BUBBLE = (1L << 14), /**< Propagate the events to the parent too*/
LV_OBJ_FLAG_GESTURE_BUBBLE = (1L << 15), /**< Propagate the gestures to the parent*/
LV_OBJ_FLAG_ADV_HITTEST = (1L << 16), /**< Allow performing more accurate hit (click) test. E.g. consider rounded corners.*/
LV_OBJ_FLAG_IGNORE_LAYOUT = (1L << 17), /**< Make the object position-able by the layouts*/
LV_OBJ_FLAG_IGNORE_LAYOUT = (1L << 17), /**< Make the object not positioned by the layouts*/
LV_OBJ_FLAG_FLOATING = (1L << 18), /**< Do not scroll the object when the parent scrolls and ignore layout*/
LV_OBJ_FLAG_SEND_DRAW_TASK_EVENTS = (1L << 19), /**< Send `LV_EVENT_DRAW_TASK_ADDED` events*/
LV_OBJ_FLAG_OVERFLOW_VISIBLE = (1L << 20),/**< Do not clip the children to the parent's ext draw size*/
@ -127,7 +125,7 @@ typedef enum {
LV_OBJ_FLAG_USER_2 = (1L << 28), /**< Custom flag, free to use by user*/
LV_OBJ_FLAG_USER_3 = (1L << 29), /**< Custom flag, free to use by user*/
LV_OBJ_FLAG_USER_4 = (1L << 30), /**< Custom flag, free to use by user*/
} _lv_obj_flag_t;
} lv_obj_flag_t;
#if LV_USE_OBJ_PROPERTY
enum {
@ -183,7 +181,32 @@ enum {
LV_PROPERTY_ID(OBJ, STATE_END, LV_PROPERTY_TYPE_INT, 47),
/*OBJ normal properties*/
LV_PROPERTY_ID(OBJ, PARENT, LV_PROPERTY_TYPE_POINTER, 31),
LV_PROPERTY_ID(OBJ, PARENT, LV_PROPERTY_TYPE_OBJ, 48),
LV_PROPERTY_ID(OBJ, X, LV_PROPERTY_TYPE_INT, 49),
LV_PROPERTY_ID(OBJ, Y, LV_PROPERTY_TYPE_INT, 50),
LV_PROPERTY_ID(OBJ, W, LV_PROPERTY_TYPE_INT, 51),
LV_PROPERTY_ID(OBJ, H, LV_PROPERTY_TYPE_INT, 52),
LV_PROPERTY_ID(OBJ, CONTENT_WIDTH, LV_PROPERTY_TYPE_INT, 53),
LV_PROPERTY_ID(OBJ, CONTENT_HEIGHT, LV_PROPERTY_TYPE_INT, 54),
LV_PROPERTY_ID(OBJ, LAYOUT, LV_PROPERTY_TYPE_INT, 55),
LV_PROPERTY_ID(OBJ, ALIGN, LV_PROPERTY_TYPE_INT, 56),
LV_PROPERTY_ID(OBJ, SCROLLBAR_MODE, LV_PROPERTY_TYPE_INT, 57),
LV_PROPERTY_ID(OBJ, SCROLL_DIR, LV_PROPERTY_TYPE_INT, 58),
LV_PROPERTY_ID(OBJ, SCROLL_SNAP_X, LV_PROPERTY_TYPE_INT, 59),
LV_PROPERTY_ID(OBJ, SCROLL_SNAP_Y, LV_PROPERTY_TYPE_INT, 60),
LV_PROPERTY_ID(OBJ, SCROLL_X, LV_PROPERTY_TYPE_INT, 61),
LV_PROPERTY_ID(OBJ, SCROLL_Y, LV_PROPERTY_TYPE_INT, 62),
LV_PROPERTY_ID(OBJ, SCROLL_TOP, LV_PROPERTY_TYPE_INT, 63),
LV_PROPERTY_ID(OBJ, SCROLL_BOTTOM, LV_PROPERTY_TYPE_INT, 64),
LV_PROPERTY_ID(OBJ, SCROLL_LEFT, LV_PROPERTY_TYPE_INT, 65),
LV_PROPERTY_ID(OBJ, SCROLL_RIGHT, LV_PROPERTY_TYPE_INT, 66),
LV_PROPERTY_ID(OBJ, SCROLL_END, LV_PROPERTY_TYPE_INT, 67),
LV_PROPERTY_ID(OBJ, EXT_DRAW_SIZE, LV_PROPERTY_TYPE_INT, 68),
LV_PROPERTY_ID(OBJ, EVENT_COUNT, LV_PROPERTY_TYPE_INT, 69),
LV_PROPERTY_ID(OBJ, SCREEN, LV_PROPERTY_TYPE_OBJ, 70),
LV_PROPERTY_ID(OBJ, DISPLAY, LV_PROPERTY_TYPE_POINTER, 71),
LV_PROPERTY_ID(OBJ, CHILD_COUNT, LV_PROPERTY_TYPE_INT, 72),
LV_PROPERTY_ID(OBJ, INDEX, LV_PROPERTY_TYPE_INT, 73),
LV_PROPERTY_OBJ_END,
};
@ -194,54 +217,6 @@ enum {
*/
LV_ATTRIBUTE_EXTERN_DATA extern const lv_obj_class_t lv_obj_class;
/**
* Special, rarely used attributes.
* They are allocated automatically if any elements is set.
*/
typedef struct {
lv_obj_t ** children; /**< Store the pointer of the children in an array.*/
lv_group_t * group_p;
lv_event_list_t event_list;
lv_point_t scroll; /**< The current X/Y scroll offset*/
int32_t ext_click_pad; /**< Extra click padding in all direction*/
int32_t ext_draw_size; /**< EXTend the size in every direction for drawing.*/
uint16_t child_cnt; /**< Number of children*/
uint16_t scrollbar_mode : 2; /**< How to display scrollbars, see `lv_scrollbar_mode_t`*/
uint16_t scroll_snap_x : 2; /**< Where to align the snappable children horizontally, see `lv_scroll_snap_t`*/
uint16_t scroll_snap_y : 2; /**< Where to align the snappable children vertically*/
uint16_t scroll_dir : 4; /**< The allowed scroll direction(s), see `lv_dir_t`*/
uint16_t layer_type : 2; /**< Cache the layer type here. Element of @lv_intermediate_layer_type_t */
} _lv_obj_spec_attr_t;
struct _lv_obj_t {
const lv_obj_class_t * class_p;
lv_obj_t * parent;
_lv_obj_spec_attr_t * spec_attr;
_lv_obj_style_t * styles;
#if LV_OBJ_STYLE_CACHE
uint32_t style_main_prop_is_set;
uint32_t style_other_prop_is_set;
#endif
void * user_data;
#if LV_USE_OBJ_ID
void * id;
#endif
lv_area_t coords;
lv_obj_flag_t flags;
lv_state_t state;
uint16_t layout_inv : 1;
uint16_t readjust_scroll_after_layout : 1;
uint16_t scr_layout_inv : 1;
uint16_t skip_trans : 1;
uint16_t style_cnt : 6;
uint16_t h_layout : 1;
uint16_t w_layout : 1;
uint16_t is_deleting : 1;
};
/**********************
* GLOBAL PROTOTYPES
**********************/
@ -260,14 +235,14 @@ lv_obj_t * lv_obj_create(lv_obj_t * parent);
/**
* Set one or more flags
* @param obj pointer to an object
* @param f R-ed values from `lv_obj_flag_t` to set.
* @param f OR-ed values from `lv_obj_flag_t` to set.
*/
void lv_obj_add_flag(lv_obj_t * obj, lv_obj_flag_t f);
/**
* Remove one or more flags
* @param obj pointer to an object
* @param f OR-ed values from `lv_obj_flag_t` to set.
* @param f OR-ed values from `lv_obj_flag_t` to clear.
*/
void lv_obj_remove_flag(lv_obj_t * obj, lv_obj_flag_t f);
@ -308,10 +283,7 @@ void lv_obj_set_state(lv_obj_t * obj, lv_state_t state, bool v);
* @param obj pointer to an object
* @param user_data pointer to the new user_data.
*/
static inline void lv_obj_set_user_data(lv_obj_t * obj, void * user_data)
{
obj->user_data = user_data;
}
void lv_obj_set_user_data(lv_obj_t * obj, void * user_data);
/*=======================
* Getter functions
@ -329,7 +301,7 @@ bool lv_obj_has_flag(const lv_obj_t * obj, lv_obj_flag_t f);
* Check if a given flag or any of the flags are set on an object.
* @param obj pointer to an object
* @param f the flag(s) to check (OR-ed values can be used)
* @return true: at lest one flag flag is set; false: none of the flags are set
* @return true: at least one flag is set; false: none of the flags are set
*/
bool lv_obj_has_flag_any(const lv_obj_t * obj, lv_obj_flag_t f);
@ -360,10 +332,7 @@ lv_group_t * lv_obj_get_group(const lv_obj_t * obj);
* @param obj pointer to an object
* @return the pointer to the user_data of the object
*/
static inline void * lv_obj_get_user_data(lv_obj_t * obj)
{
return obj->user_data;
}
void * lv_obj_get_user_data(lv_obj_t * obj);
/*=======================
* Other functions
@ -406,12 +375,47 @@ const lv_obj_class_t * lv_obj_get_class(const lv_obj_t * obj);
*/
bool lv_obj_is_valid(const lv_obj_t * obj);
/**
* Utility to set an object reference to NULL when it gets deleted.
* The reference should be in a location that will not become invalid
* during the object's lifetime, i.e. static or allocated.
* @param obj_ptr a pointer to a pointer to an object
*/
void lv_obj_null_on_delete(lv_obj_t ** obj_ptr);
#if LV_USE_OBJ_ID
/**
* Set an id for an object.
* @param obj pointer to an object
* @param id the id of the object
*/
void lv_obj_set_id(lv_obj_t * obj, void * id);
/**
* Assign an id to an object if not previously assigned
* Set `LV_USE_OBJ_ID_BUILTIN` to 1 to use builtin method to generate object ID.
* Otherwise, these functions including `lv_obj_[assign|free|stringify]_id` should be implemented externally.
* Get the id of an object.
* @param obj pointer to an object
* @return the id of the object
*/
void * lv_obj_get_id(const lv_obj_t * obj);
/**
* Get the child object by its id.
* It will check children and grandchildren recursively.
* Function `lv_obj_id_compare` is used to matched obj id with given id.
*
* @param obj pointer to an object
* @param id the id of the child object
* @return pointer to the child object or NULL if not found
*/
lv_obj_t * lv_obj_get_child_by_id(const lv_obj_t * obj, const void * id);
/**
* Assign id to object if not previously assigned.
* This function gets called automatically when LV_OBJ_ID_AUTO_ASSIGN is enabled.
*
* Set `LV_USE_OBJ_ID_BUILTIN` to use the builtin method to generate object ID.
* Otherwise, these functions including `lv_obj_[set|assign|free|stringify]_id` and
* `lv_obj_id_compare`should be implemented externally.
*
* @param class_p the class this obj belongs to. Note obj->class_p is the class currently being constructed.
* @param obj pointer to an object
@ -419,11 +423,24 @@ bool lv_obj_is_valid(const lv_obj_t * obj);
void lv_obj_assign_id(const lv_obj_class_t * class_p, lv_obj_t * obj);
/**
* Free resources allocated by `lv_obj_assign_id`
* Free resources allocated by `lv_obj_assign_id` or `lv_obj_set_id`.
* This function is also called automatically when object is deleted.
* @param obj pointer to an object
*/
void lv_obj_free_id(lv_obj_t * obj);
/**
* Compare two obj id, return 0 if they are equal.
*
* Set `LV_USE_OBJ_ID_BUILTIN` to use the builtin method for compare.
* Otherwise, it must be implemented externally.
*
* @param id1: the first id
* @param id2: the second id
* @return 0 if they are equal, non-zero otherwise.
*/
int lv_obj_id_compare(const void * id1, const void * id2);
/**
* Format an object's id into a string.
* @param obj pointer to an object
@ -437,7 +454,6 @@ const char * lv_obj_stringify_id(lv_obj_t * obj, char * buf, uint32_t len);
* Free resources used by builtin ID generator.
*/
void lv_objid_builtin_destroy(void);
#endif
#endif /*LV_USE_OBJ_ID*/

View File

@ -6,7 +6,8 @@
/*********************
* INCLUDES
*********************/
#include "lv_obj.h"
#include "lv_obj_class_private.h"
#include "lv_obj_private.h"
#include "../themes/lv_theme.h"
#include "../display/lv_display.h"
#include "../display/lv_display_private.h"
@ -66,8 +67,15 @@ lv_obj_t * lv_obj_class_create_obj(const lv_obj_class_t * class_p, lv_obj_t * pa
disp->screen_cnt = 0;
}
lv_obj_t ** screens = lv_realloc(disp->screens, sizeof(lv_obj_t *) * (disp->screen_cnt + 1));
LV_ASSERT_MALLOC(screens);
if(screens == NULL) {
lv_free(obj);
return NULL;
}
disp->screen_cnt++;
disp->screens = lv_realloc(disp->screens, sizeof(lv_obj_t *) * disp->screen_cnt);
disp->screens = screens;
disp->screens[disp->screen_cnt - 1] = obj;
/*Set coordinates to full screen size*/
@ -95,6 +103,8 @@ lv_obj_t * lv_obj_class_create_obj(const lv_obj_class_t * class_p, lv_obj_t * pa
void lv_obj_class_init_obj(lv_obj_t * obj)
{
if(obj == NULL) return;
lv_obj_mark_layout_as_dirty(obj);
lv_obj_enable_style_refresh(false);
@ -123,7 +133,7 @@ void lv_obj_class_init_obj(lv_obj_t * obj)
}
}
void _lv_obj_destruct(lv_obj_t * obj)
void lv_obj_destruct(lv_obj_t * obj)
{
if(obj->class_p->destructor_cb) obj->class_p->destructor_cb(obj->class_p, obj);
@ -132,7 +142,7 @@ void _lv_obj_destruct(lv_obj_t * obj)
obj->class_p = obj->class_p->base_class;
/*Call the base class's destructor too*/
_lv_obj_destruct(obj);
lv_obj_destruct(obj);
}
}

View File

@ -13,8 +13,6 @@ extern "C" {
/*********************
* INCLUDES
*********************/
#include <stdint.h>
#include <stdbool.h>
#include "../misc/lv_types.h"
#include "../misc/lv_area.h"
#include "lv_obj_property.h"
@ -45,36 +43,6 @@ typedef enum {
} lv_obj_class_theme_inheritable_t;
typedef void (*lv_obj_class_event_cb_t)(lv_obj_class_t * class_p, lv_event_t * e);
/**
* Describe the common methods of every object.
* Similar to a C++ class.
*/
struct _lv_obj_class_t {
const lv_obj_class_t * base_class;
/*class_p is the final class while obj->class_p is the class currently being [de]constructed.*/
void (*constructor_cb)(const lv_obj_class_t * class_p, lv_obj_t * obj);
void (*destructor_cb)(const lv_obj_class_t * class_p, lv_obj_t * obj);
/*class_p is the class in which event is being processed.*/
void (*event_cb)(const lv_obj_class_t * class_p, lv_event_t * e); /**< Widget type specific event function*/
#if LV_USE_OBJ_PROPERTY
uint32_t prop_index_start;
uint32_t prop_index_end;
const lv_property_ops_t * properties;
uint32_t properties_count;
#endif
void * user_data;
const char * name;
int32_t width_def;
int32_t height_def;
uint32_t editable : 2; /**< Value from ::lv_obj_class_editable_t*/
uint32_t group_def : 2; /**< Value from ::lv_obj_class_group_def_t*/
uint32_t instance_size : 16;
uint32_t theme_inheritable : 1; /**< Value from ::lv_obj_class_theme_inheritable_t*/
};
/**********************
* GLOBAL PROTOTYPES
**********************/
@ -89,8 +57,6 @@ lv_obj_t * lv_obj_class_create_obj(const lv_obj_class_t * class_p, lv_obj_t * pa
void lv_obj_class_init_obj(lv_obj_t * obj);
void _lv_obj_destruct(lv_obj_t * obj);
bool lv_obj_is_editable(lv_obj_t * obj);
bool lv_obj_is_group_def(lv_obj_t * obj);

View File

@ -0,0 +1,78 @@
/**
* @file lv_obj_class_private.h
*
*/
#ifndef LV_OBJ_CLASS_PRIVATE_H
#define LV_OBJ_CLASS_PRIVATE_H
#ifdef __cplusplus
extern "C" {
#endif
/*********************
* INCLUDES
*********************/
#include "lv_obj_class.h"
/*********************
* DEFINES
*********************/
/**********************
* TYPEDEFS
**********************/
/**
* Describe the common methods of every object.
* Similar to a C++ class.
*/
struct lv_obj_class_t {
const lv_obj_class_t * base_class;
/** class_p is the final class while obj->class_p is the class currently being [de]constructed. */
void (*constructor_cb)(const lv_obj_class_t * class_p, lv_obj_t * obj);
void (*destructor_cb)(const lv_obj_class_t * class_p, lv_obj_t * obj);
/** class_p is the class in which event is being processed. */
void (*event_cb)(const lv_obj_class_t * class_p, lv_event_t * e); /**< Widget type specific event function*/
#if LV_USE_OBJ_PROPERTY
uint32_t prop_index_start;
uint32_t prop_index_end;
const lv_property_ops_t * properties;
uint32_t properties_count;
#if LV_USE_OBJ_PROPERTY_NAME
/* An array of property ID and name */
const lv_property_name_t * property_names;
uint32_t names_count;
#endif
#endif
void * user_data;
const char * name;
int32_t width_def;
int32_t height_def;
uint32_t editable : 2; /**< Value from ::lv_obj_class_editable_t*/
uint32_t group_def : 2; /**< Value from ::lv_obj_class_group_def_t*/
uint32_t instance_size : 16;
uint32_t theme_inheritable : 1; /**< Value from ::lv_obj_class_theme_inheritable_t*/
};
/**********************
* GLOBAL PROTOTYPES
**********************/
void lv_obj_destruct(lv_obj_t * obj);
/**********************
* MACROS
**********************/
#ifdef __cplusplus
} /*extern "C"*/
#endif
#endif /*LV_OBJ_CLASS_PRIVATE_H*/

View File

@ -6,11 +6,13 @@
/*********************
* INCLUDES
*********************/
#include "lv_obj_draw.h"
#include "lv_obj.h"
#include "lv_obj_draw_private.h"
#include "lv_obj_private.h"
#include "lv_obj_style.h"
#include "../display/lv_display.h"
#include "../indev/lv_indev.h"
#include "../stdlib/lv_string.h"
#include "../draw/lv_draw_arc.h"
/*********************
* DEFINES
@ -37,7 +39,7 @@
* GLOBAL FUNCTIONS
**********************/
void lv_obj_init_draw_rect_dsc(lv_obj_t * obj, uint32_t part, lv_draw_rect_dsc_t * draw_dsc)
void lv_obj_init_draw_rect_dsc(lv_obj_t * obj, lv_part_t part, lv_draw_rect_dsc_t * draw_dsc)
{
draw_dsc->base.obj = obj;
draw_dsc->base.part = part;
@ -142,7 +144,7 @@ void lv_obj_init_draw_rect_dsc(lv_obj_t * obj, uint32_t part, lv_draw_rect_dsc_t
}
}
void lv_obj_init_draw_label_dsc(lv_obj_t * obj, uint32_t part, lv_draw_label_dsc_t * draw_dsc)
void lv_obj_init_draw_label_dsc(lv_obj_t * obj, lv_part_t part, lv_draw_label_dsc_t * draw_dsc)
{
draw_dsc->base.obj = obj;
draw_dsc->base.part = part;
@ -171,7 +173,7 @@ void lv_obj_init_draw_label_dsc(lv_obj_t * obj, uint32_t part, lv_draw_label_dsc
draw_dsc->align = lv_obj_get_style_text_align(obj, part);
}
void lv_obj_init_draw_image_dsc(lv_obj_t * obj, uint32_t part, lv_draw_image_dsc_t * draw_dsc)
void lv_obj_init_draw_image_dsc(lv_obj_t * obj, lv_part_t part, lv_draw_image_dsc_t * draw_dsc)
{
draw_dsc->base.obj = obj;
draw_dsc->base.part = part;
@ -197,7 +199,7 @@ void lv_obj_init_draw_image_dsc(lv_obj_t * obj, uint32_t part, lv_draw_image_dsc
if(part != LV_PART_MAIN) draw_dsc->blend_mode = lv_obj_get_style_blend_mode(obj, part);
}
void lv_obj_init_draw_line_dsc(lv_obj_t * obj, uint32_t part, lv_draw_line_dsc_t * draw_dsc)
void lv_obj_init_draw_line_dsc(lv_obj_t * obj, lv_part_t part, lv_draw_line_dsc_t * draw_dsc)
{
draw_dsc->base.obj = obj;
draw_dsc->base.part = part;
@ -227,7 +229,7 @@ void lv_obj_init_draw_line_dsc(lv_obj_t * obj, uint32_t part, lv_draw_line_dsc_t
if(part != LV_PART_MAIN) draw_dsc->blend_mode = lv_obj_get_style_blend_mode(obj, part);
}
void lv_obj_init_draw_arc_dsc(lv_obj_t * obj, uint32_t part, lv_draw_arc_dsc_t * draw_dsc)
void lv_obj_init_draw_arc_dsc(lv_obj_t * obj, lv_part_t part, lv_draw_arc_dsc_t * draw_dsc)
{
draw_dsc->base.obj = obj;
draw_dsc->base.part = part;
@ -250,7 +252,7 @@ void lv_obj_init_draw_arc_dsc(lv_obj_t * obj, uint32_t part, lv_draw_arc_dsc_t *
draw_dsc->rounded = lv_obj_get_style_arc_rounded(obj, part);
}
int32_t lv_obj_calculate_ext_draw_size(lv_obj_t * obj, uint32_t part)
int32_t lv_obj_calculate_ext_draw_size(lv_obj_t * obj, lv_part_t part)
{
int32_t s = 0;
@ -288,7 +290,7 @@ void lv_obj_refresh_ext_draw_size(lv_obj_t * obj)
{
LV_ASSERT_OBJ(obj, MY_CLASS);
int32_t s_old = _lv_obj_get_ext_draw_size(obj);
int32_t s_old = lv_obj_get_ext_draw_size(obj);
int32_t s_new = 0;
lv_obj_send_event(obj, LV_EVENT_REFR_EXT_DRAW_SIZE, &s_new);
@ -306,13 +308,13 @@ void lv_obj_refresh_ext_draw_size(lv_obj_t * obj)
if(s_new != s_old) lv_obj_invalidate(obj);
}
int32_t _lv_obj_get_ext_draw_size(const lv_obj_t * obj)
int32_t lv_obj_get_ext_draw_size(const lv_obj_t * obj)
{
if(obj->spec_attr) return obj->spec_attr->ext_draw_size;
else return 0;
}
lv_layer_type_t _lv_obj_get_layer_type(const lv_obj_t * obj)
lv_layer_type_t lv_obj_get_layer_type(const lv_obj_t * obj)
{
if(obj->spec_attr) return (lv_layer_type_t)obj->spec_attr->layer_type;

View File

@ -14,7 +14,11 @@ extern "C" {
* INCLUDES
*********************/
#include "../misc/lv_types.h"
#include "../draw/lv_draw.h"
#include "../draw/lv_draw_rect.h"
#include "../draw/lv_draw_label.h"
#include "../draw/lv_draw_image.h"
#include "../draw/lv_draw_line.h"
#include "../draw/lv_draw_arc.h"
/*********************
* DEFINES
@ -44,7 +48,7 @@ typedef enum {
* @note Only the relevant fields will be set.
* E.g. if `border width == 0` the other border properties won't be evaluated.
*/
void lv_obj_init_draw_rect_dsc(lv_obj_t * obj, uint32_t part, lv_draw_rect_dsc_t * draw_dsc);
void lv_obj_init_draw_rect_dsc(lv_obj_t * obj, lv_part_t part, lv_draw_rect_dsc_t * draw_dsc);
/**
* Initialize a label draw descriptor from an object's styles in its current state
@ -54,7 +58,7 @@ void lv_obj_init_draw_rect_dsc(lv_obj_t * obj, uint32_t part, lv_draw_rect_dsc_t
* If the `opa` field is set to or the property is equal to `LV_OPA_TRANSP` the rest won't be initialized.
* Should be initialized with `lv_draw_label_dsc_init(draw_dsc)`.
*/
void lv_obj_init_draw_label_dsc(lv_obj_t * obj, uint32_t part, lv_draw_label_dsc_t * draw_dsc);
void lv_obj_init_draw_label_dsc(lv_obj_t * obj, lv_part_t part, lv_draw_label_dsc_t * draw_dsc);
/**
* Initialize an image draw descriptor from an object's styles in its current state
@ -63,7 +67,7 @@ void lv_obj_init_draw_label_dsc(lv_obj_t * obj, uint32_t part, lv_draw_label_dsc
* @param draw_dsc the descriptor to initialize.
* Should be initialized with `lv_draw_image_dsc_init(draw_dsc)`.
*/
void lv_obj_init_draw_image_dsc(lv_obj_t * obj, uint32_t part, lv_draw_image_dsc_t * draw_dsc);
void lv_obj_init_draw_image_dsc(lv_obj_t * obj, lv_part_t part, lv_draw_image_dsc_t * draw_dsc);
/**
* Initialize a line draw descriptor from an object's styles in its current state
@ -72,7 +76,7 @@ void lv_obj_init_draw_image_dsc(lv_obj_t * obj, uint32_t part, lv_draw_image_dsc
* @param draw_dsc the descriptor to initialize.
* Should be initialized with `lv_draw_line_dsc_init(draw_dsc)`.
*/
void lv_obj_init_draw_line_dsc(lv_obj_t * obj, uint32_t part, lv_draw_line_dsc_t * draw_dsc);
void lv_obj_init_draw_line_dsc(lv_obj_t * obj, lv_part_t part, lv_draw_line_dsc_t * draw_dsc);
/**
* Initialize an arc draw descriptor from an object's styles in its current state
@ -81,7 +85,7 @@ void lv_obj_init_draw_line_dsc(lv_obj_t * obj, uint32_t part, lv_draw_line_dsc_t
* @param draw_dsc the descriptor to initialize.
* Should be initialized with `lv_draw_arc_dsc_init(draw_dsc)`.
*/
void lv_obj_init_draw_arc_dsc(lv_obj_t * obj, uint32_t part, lv_draw_arc_dsc_t * draw_dsc);
void lv_obj_init_draw_arc_dsc(lv_obj_t * obj, lv_part_t part, lv_draw_arc_dsc_t * draw_dsc);
/**
* Get the required extra size (around the object's part) to draw shadow, outline, value etc.
@ -89,7 +93,7 @@ void lv_obj_init_draw_arc_dsc(lv_obj_t * obj, uint32_t part, lv_draw_arc_dsc_t *
* @param part part of the object
* @return the extra size required around the object
*/
int32_t lv_obj_calculate_ext_draw_size(lv_obj_t * obj, uint32_t part);
int32_t lv_obj_calculate_ext_draw_size(lv_obj_t * obj, lv_part_t part);
/**
* Send a 'LV_EVENT_REFR_EXT_DRAW_SIZE' Call the ancestor's event handler to the object to refresh the value of the extended draw size.
@ -98,15 +102,6 @@ int32_t lv_obj_calculate_ext_draw_size(lv_obj_t * obj, uint32_t part);
*/
void lv_obj_refresh_ext_draw_size(lv_obj_t * obj);
/**
* Get the extended draw area of an object.
* @param obj pointer to an object
* @return the size extended draw area around the real coordinates
*/
int32_t _lv_obj_get_ext_draw_size(const lv_obj_t * obj);
lv_layer_type_t _lv_obj_get_layer_type(const lv_obj_t * obj);
/**********************
* MACROS
**********************/

View File

@ -0,0 +1,48 @@
/**
* @file lv_obj_draw_private.h
*
*/
#ifndef LV_OBJ_DRAW_PRIVATE_H
#define LV_OBJ_DRAW_PRIVATE_H
#ifdef __cplusplus
extern "C" {
#endif
/*********************
* INCLUDES
*********************/
#include "lv_obj_draw.h"
/*********************
* DEFINES
*********************/
/**********************
* TYPEDEFS
**********************/
/**********************
* GLOBAL PROTOTYPES
**********************/
/**
* Get the extended draw area of an object.
* @param obj pointer to an object
* @return the size extended draw area around the real coordinates
*/
int32_t lv_obj_get_ext_draw_size(const lv_obj_t * obj);
lv_layer_type_t lv_obj_get_layer_type(const lv_obj_t * obj);
/**********************
* MACROS
**********************/
#ifdef __cplusplus
} /*extern "C"*/
#endif
#endif /*LV_OBJ_DRAW_PRIVATE_H*/

View File

@ -6,7 +6,10 @@
/*********************
* INCLUDES
*********************/
#include "lv_obj.h"
#include "../misc/lv_event_private.h"
#include "lv_obj_event_private.h"
#include "lv_obj_class_private.h"
#include "lv_obj_private.h"
#include "../indev/lv_indev.h"
#include "../indev/lv_indev_private.h"
@ -58,13 +61,13 @@ lv_result_t lv_obj_send_event(lv_obj_t * obj, lv_event_code_t event_code, void *
e.stop_bubbling = 0;
e.stop_processing = 0;
_lv_event_push(&e);
lv_event_push(&e);
/*Send the event*/
lv_result_t res = event_send_core(&e);
/*Remove this element from the list*/
_lv_event_pop(&e);
lv_event_pop(&e);
return res;
}
@ -193,7 +196,9 @@ lv_indev_t * lv_event_get_indev(lv_event_t * e)
e->code == LV_EVENT_KEY ||
e->code == LV_EVENT_FOCUSED ||
e->code == LV_EVENT_DEFOCUSED ||
e->code == LV_EVENT_LEAVE) {
e->code == LV_EVENT_LEAVE ||
e->code == LV_EVENT_HOVER_OVER ||
e->code == LV_EVENT_HOVER_LEAVE) {
return lv_event_get_param(e);
}
else {
@ -354,19 +359,19 @@ static lv_result_t event_send_core(lv_event_t * e)
lv_event_list_t * list = target->spec_attr ? &target->spec_attr->event_list : NULL;
res = lv_event_send(list, e, true);
if(res != LV_RESULT_OK) return res;
if(res != LV_RESULT_OK || e->stop_processing) return res;
res = lv_obj_event_base(NULL, e);
if(res != LV_RESULT_OK) return res;
if(res != LV_RESULT_OK || e->stop_processing) return res;
res = lv_event_send(list, e, false);
if(res != LV_RESULT_OK) return res;
if(res != LV_RESULT_OK || e->stop_processing) return res;
lv_obj_t * parent = lv_obj_get_parent(e->current_target);
if(parent && event_is_bubbled(e)) {
e->current_target = parent;
res = event_send_core(e);
if(res != LV_RESULT_OK) return res;
if(res != LV_RESULT_OK || e->stop_processing || e->stop_bubbling) return res;
}
return res;

View File

@ -13,7 +13,6 @@ extern "C" {
/*********************
* INCLUDES
*********************/
#include <stdbool.h>
#include "../misc/lv_types.h"
#include "../misc/lv_event.h"
#include "../indev/lv_indev.h"
@ -26,18 +25,6 @@ extern "C" {
* TYPEDEFS
**********************/
/**
* Used as the event parameter of ::LV_EVENT_HIT_TEST to check if an `point` can click the object or not.
* `res` should be set like this:
* - If already set to `false` an other event wants that point non clickable. If you want to respect it leave it as `false` or set `true` to overwrite it.
* - If already set `true` and `point` shouldn't be clickable set to `false`
* - If already set to `true` you agree that `point` can click the object leave it as `true`
*/
typedef struct {
const lv_point_t * point; /**< A point relative to screen to check if it can click the object or not*/
bool res; /**< true: `point` can click the object; false: it cannot*/
} lv_hit_test_info_t;
/** Cover check results.*/
typedef enum {
LV_COVER_RES_COVER = 0,
@ -45,16 +32,6 @@ typedef enum {
LV_COVER_RES_MASKED = 2,
} lv_cover_res_t;
/**
* Used as the event parameter of ::LV_EVENT_COVER_CHECK to check if an area is covered by the object or not.
* In the event use `const lv_area_t * area = lv_event_get_cover_area(e)` to get the area to check
* and `lv_event_set_cover_res(e, res)` to set the result.
*/
typedef struct {
lv_cover_res_t res;
const lv_area_t * area;
} lv_cover_check_info_t;
/**********************
* GLOBAL PROTOTYPES
**********************/
@ -98,7 +75,7 @@ lv_obj_t * lv_event_get_target_obj(lv_event_t * e);
* @param obj pointer to an object
* @param filter an event code (e.g. `LV_EVENT_CLICKED`) on which the event should be called. `LV_EVENT_ALL` can be used to receive all the events.
* @param event_cb the new event function
* @param user_data custom data data will be available in `event_cb`
* @param user_data custom data will be available in `event_cb`
* @return handler to the event. It can be used in `lv_obj_remove_event_dsc`.
*/
lv_event_dsc_t * lv_obj_add_event_cb(lv_obj_t * obj, lv_event_cb_t event_cb, lv_event_code_t filter, void * user_data);

View File

@ -0,0 +1,62 @@
/**
* @file lv_obj_event_private.h
*
*/
#ifndef LV_OBJ_EVENT_PRIVATE_H
#define LV_OBJ_EVENT_PRIVATE_H
#ifdef __cplusplus
extern "C" {
#endif
/*********************
* INCLUDES
*********************/
#include "lv_obj_event.h"
/*********************
* DEFINES
*********************/
/**********************
* TYPEDEFS
**********************/
/**
* Used as the event parameter of ::LV_EVENT_HIT_TEST to check if an `point` can click the object or not.
* `res` should be set like this:
* - If already set to `false` another event wants that point non clickable. If you want to respect it leave it as `false` or set `true` to overwrite it.
* - If already set `true` and `point` shouldn't be clickable set to `false`
* - If already set to `true` you agree that `point` can click the object leave it as `true`
*/
struct lv_hit_test_info_t {
const lv_point_t * point; /**< A point relative to screen to check if it can click the object or not*/
bool res; /**< true: `point` can click the object; false: it cannot*/
};
/**
* Used as the event parameter of ::LV_EVENT_COVER_CHECK to check if an area is covered by the object or not.
* In the event use `const lv_area_t * area = lv_event_get_cover_area(e)` to get the area to check
* and `lv_event_set_cover_res(e, res)` to set the result.
*/
struct lv_cover_check_info_t {
lv_cover_res_t res;
const lv_area_t * area;
};
/**********************
* GLOBAL PROTOTYPES
**********************/
/**********************
* MACROS
**********************/
#ifdef __cplusplus
} /*extern "C"*/
#endif
#endif /*LV_OBJ_EVENT_PRIVATE_H*/

View File

@ -6,7 +6,8 @@
/*********************
* INCLUDES
*********************/
#include "lv_obj.h"
#include "lv_obj_class_private.h"
#include "lv_obj_private.h"
#include "lv_global.h"
#include "../osal/lv_os.h"
#include "../stdlib/lv_sprintf.h"
@ -40,7 +41,7 @@ typedef struct _class_info_t {
* GLOBAL FUNCTIONS
**********************/
#if LV_USE_OBJ_ID_BUILTIN
#if LV_USE_OBJ_ID && LV_USE_OBJ_ID_BUILTIN
void lv_obj_assign_id(const lv_obj_class_t * class_p, lv_obj_t * obj)
{
@ -78,9 +79,17 @@ void lv_obj_assign_id(const lv_obj_class_t * class_p, lv_obj_t * obj)
obj->id = (void *)(lv_uintptr_t)id;
}
void lv_obj_set_id(lv_obj_t * obj, void * id)
{
LV_ASSERT_NULL(obj);
if(obj->id) lv_obj_free_id(obj);
obj->id = id;
}
void lv_obj_free_id(lv_obj_t * obj)
{
LV_UNUSED(obj);
obj->id = NULL;
}
const char * lv_obj_stringify_id(lv_obj_t * obj, char * buf, uint32_t len)
@ -92,7 +101,7 @@ const char * lv_obj_stringify_id(lv_obj_t * obj, char * buf, uint32_t len)
name = obj->class_p->name;
if(name == NULL) name = "nameless";
lv_snprintf(buf, len, "%s%" LV_PRId32 "", name, (uint32_t)(lv_uintptr_t)obj->id);
lv_snprintf(buf, len, "%s%" LV_PRIu32 "", name, (uint32_t)(lv_uintptr_t)obj->id);
return buf;
}
@ -105,4 +114,9 @@ void lv_objid_builtin_destroy(void)
global->objid_count = 0;
}
int lv_obj_id_compare(const void * id1, const void * id2)
{
return id1 == id2 ? 0 : 1;
}
#endif /*LV_USE_OBJ_ID_BUILTIN*/

View File

@ -6,10 +6,14 @@
/*********************
* INCLUDES
*********************/
#include "lv_obj.h"
#include "../misc/lv_area_private.h"
#include "../layouts/lv_layout_private.h"
#include "lv_obj_event_private.h"
#include "lv_obj_draw_private.h"
#include "lv_obj_private.h"
#include "../display/lv_display.h"
#include "../display/lv_display_private.h"
#include "lv_refr.h"
#include "lv_refr_private.h"
#include "../core/lv_global.h"
/*********************
@ -54,12 +58,12 @@ void lv_obj_set_x(lv_obj_t * obj, int32_t x)
{
LV_ASSERT_OBJ(obj, MY_CLASS);
lv_result_t res_x;
lv_style_res_t res_x;
lv_style_value_t v_x;
res_x = lv_obj_get_local_style_prop(obj, LV_STYLE_X, &v_x, 0);
if((res_x == LV_RESULT_OK && v_x.num != x) || res_x == LV_RESULT_INVALID) {
if((res_x == LV_STYLE_RES_FOUND && v_x.num != x) || res_x == LV_STYLE_RES_NOT_FOUND) {
lv_obj_set_style_x(obj, x, 0);
}
}
@ -68,12 +72,12 @@ void lv_obj_set_y(lv_obj_t * obj, int32_t y)
{
LV_ASSERT_OBJ(obj, MY_CLASS);
lv_result_t res_y;
lv_style_res_t res_y;
lv_style_value_t v_y;
res_y = lv_obj_get_local_style_prop(obj, LV_STYLE_Y, &v_y, 0);
if((res_y == LV_RESULT_OK && v_y.num != y) || res_y == LV_RESULT_INVALID) {
if((res_y == LV_STYLE_RES_FOUND && v_y.num != y) || res_y == LV_STYLE_RES_NOT_FOUND) {
lv_obj_set_style_y(obj, y, 0);
}
}
@ -170,7 +174,7 @@ bool lv_obj_refr_size(lv_obj_t * obj)
/*If the object is already out of the parent and its position is changes
*surely the scrollbars also changes so invalidate them*/
bool on1 = _lv_area_is_in(&ori, &parent_fit_area, 0);
bool on1 = lv_area_is_in(&ori, &parent_fit_area, 0);
if(!on1) lv_obj_scrollbar_invalidate(parent);
/*Set the length and height
@ -196,7 +200,7 @@ bool lv_obj_refr_size(lv_obj_t * obj)
/*If the object was out of the parent invalidate the new scrollbar area too.
*If it wasn't out of the parent but out now, also invalidate the scrollbars*/
bool on2 = _lv_area_is_in(&obj->coords, &parent_fit_area, 0);
bool on2 = lv_area_is_in(&obj->coords, &parent_fit_area, 0);
if(on1 || (!on1 && on2)) lv_obj_scrollbar_invalidate(parent);
lv_obj_refresh_ext_draw_size(obj);
@ -215,12 +219,12 @@ void lv_obj_set_size(lv_obj_t * obj, int32_t w, int32_t h)
void lv_obj_set_width(lv_obj_t * obj, int32_t w)
{
LV_ASSERT_OBJ(obj, MY_CLASS);
lv_result_t res_w;
lv_style_res_t res_w;
lv_style_value_t v_w;
res_w = lv_obj_get_local_style_prop(obj, LV_STYLE_WIDTH, &v_w, 0);
if((res_w == LV_RESULT_OK && v_w.num != w) || res_w == LV_RESULT_INVALID) {
if((res_w == LV_STYLE_RES_FOUND && v_w.num != w) || res_w == LV_STYLE_RES_NOT_FOUND) {
lv_obj_set_style_width(obj, w, 0);
}
}
@ -228,12 +232,12 @@ void lv_obj_set_width(lv_obj_t * obj, int32_t w)
void lv_obj_set_height(lv_obj_t * obj, int32_t h)
{
LV_ASSERT_OBJ(obj, MY_CLASS);
lv_result_t res_h;
lv_style_res_t res_h;
lv_style_value_t v_h;
res_h = lv_obj_get_local_style_prop(obj, LV_STYLE_HEIGHT, &v_h, 0);
if((res_h == LV_RESULT_OK && v_h.num != h) || res_h == LV_RESULT_INVALID) {
if((res_h == LV_STYLE_RES_FOUND && v_h.num != h) || res_h == LV_STYLE_RES_NOT_FOUND) {
lv_obj_set_style_height(obj, h, 0);
}
}
@ -450,6 +454,9 @@ void lv_obj_align_to(lv_obj_t * obj, const lv_obj_t * base, lv_align_t align, in
x = lv_obj_get_width(base);
y = lv_obj_get_height(base) - lv_obj_get_height(obj);
break;
case LV_ALIGN_DEFAULT:
break;
}
if(LV_COORD_IS_PCT(x_ofs)) x_ofs = (lv_obj_get_width(base) * LV_COORD_GET_PCT(x_ofs)) / 100;
@ -721,7 +728,7 @@ void lv_obj_move_to(lv_obj_t * obj, int32_t x, int32_t y)
/*If the object is already out of the parent and its position is changes
*surely the scrollbars also changes so invalidate them*/
on1 = _lv_area_is_in(&ori, &parent_fit_area, 0);
on1 = lv_area_is_in(&ori, &parent_fit_area, 0);
if(!on1) lv_obj_scrollbar_invalidate(parent);
}
@ -741,7 +748,7 @@ void lv_obj_move_to(lv_obj_t * obj, int32_t x, int32_t y)
/*If the object was out of the parent invalidate the new scrollbar area too.
*If it wasn't out of the parent but out now, also invalidate the scrollbars*/
if(parent) {
bool on2 = _lv_area_is_in(&obj->coords, &parent_fit_area, 0);
bool on2 = lv_area_is_in(&obj->coords, &parent_fit_area, 0);
if(on1 || (!on1 && on2)) lv_obj_scrollbar_invalidate(parent);
}
}
@ -771,7 +778,7 @@ void lv_obj_transform_point_array(const lv_obj_t * obj, lv_point_t points[], siz
lv_obj_point_transform_flag_t flags)
{
if(obj) {
lv_layer_type_t layer_type = _lv_obj_get_layer_type(obj);
lv_layer_type_t layer_type = lv_obj_get_layer_type(obj);
bool do_tranf = layer_type == LV_LAYER_TYPE_TRANSFORM;
bool recursive = flags & LV_OBJ_POINT_TRANSFORM_FLAG_RECURSIVE;
bool inverse = flags & LV_OBJ_POINT_TRANSFORM_FLAG_INVERSE;
@ -814,13 +821,21 @@ void lv_obj_invalidate_area(const lv_obj_t * obj, const lv_area_t * area)
lv_area_copy(&area_tmp, area);
if(!lv_obj_area_is_visible(obj, &area_tmp)) return;
#if LV_DRAW_TRANSFORM_USE_MATRIX
/**
* When using the global matrix, the vertex coordinates of clip_area lose precision after transformation,
* which can be solved by expanding the redrawing area.
*/
lv_area_increase(&area_tmp, 5, 5);
#else
if(obj->spec_attr && obj->spec_attr->layer_type == LV_LAYER_TYPE_TRANSFORM) {
/*Make the area slightly larger to avoid rounding errors.
*5 is an empirical value*/
lv_area_increase(&area_tmp, 5, 5);
}
#endif
_lv_inv_area(lv_obj_get_display(obj), &area_tmp);
lv_inv_area(lv_obj_get_display(obj), &area_tmp);
}
void lv_obj_invalidate(const lv_obj_t * obj)
@ -829,7 +844,7 @@ void lv_obj_invalidate(const lv_obj_t * obj)
/*Truncate the area to the object*/
lv_area_t obj_coords;
int32_t ext_size = _lv_obj_get_ext_draw_size(obj);
int32_t ext_size = lv_obj_get_ext_draw_size(obj);
lv_area_copy(&obj_coords, &obj->coords);
obj_coords.x1 -= ext_size;
obj_coords.y1 -= ext_size;
@ -856,12 +871,12 @@ bool lv_obj_area_is_visible(const lv_obj_t * obj, lv_area_t * area)
/*Truncate the area to the object*/
lv_area_t obj_coords;
int32_t ext_size = _lv_obj_get_ext_draw_size(obj);
int32_t ext_size = lv_obj_get_ext_draw_size(obj);
lv_area_copy(&obj_coords, &obj->coords);
lv_area_increase(&obj_coords, ext_size, ext_size);
/*The area is not on the object*/
if(!_lv_area_intersect(area, area, &obj_coords)) return false;
if(!lv_area_intersect(area, area, &obj_coords)) return false;
lv_obj_get_transformed_area(obj, area, LV_OBJ_POINT_TRANSFORM_FLAG_RECURSIVE);
@ -874,12 +889,12 @@ bool lv_obj_area_is_visible(const lv_obj_t * obj, lv_area_t * area)
/*Truncate to the parent and if no common parts break*/
lv_area_t parent_coords = parent->coords;
if(lv_obj_has_flag(parent, LV_OBJ_FLAG_OVERFLOW_VISIBLE)) {
int32_t parent_ext_size = _lv_obj_get_ext_draw_size(parent);
int32_t parent_ext_size = lv_obj_get_ext_draw_size(parent);
lv_area_increase(&parent_coords, parent_ext_size, parent_ext_size);
}
lv_obj_get_transformed_area(parent, &parent_coords, LV_OBJ_POINT_TRANSFORM_FLAG_RECURSIVE);
if(!_lv_area_intersect(area, area, &parent_coords)) return false;
if(!lv_area_intersect(area, area, &parent_coords)) return false;
parent = lv_obj_get_parent(parent);
}
@ -892,7 +907,7 @@ bool lv_obj_is_visible(const lv_obj_t * obj)
LV_ASSERT_OBJ(obj, MY_CLASS);
lv_area_t obj_coords;
int32_t ext_size = _lv_obj_get_ext_draw_size(obj);
int32_t ext_size = lv_obj_get_ext_draw_size(obj);
lv_area_copy(&obj_coords, &obj->coords);
obj_coords.x1 -= ext_size;
obj_coords.y1 -= ext_size;
@ -924,7 +939,7 @@ bool lv_obj_hit_test(lv_obj_t * obj, const lv_point_t * point)
lv_area_t a;
lv_obj_get_click_area(obj, &a);
bool res = _lv_area_is_point_on(&a, point, 0);
bool res = lv_area_is_point_on(&a, point, 0);
if(res == false) return false;
if(lv_obj_has_flag(obj, LV_OBJ_FLAG_ADV_HITTEST)) {
@ -952,6 +967,11 @@ int32_t lv_clamp_height(int32_t height, int32_t min_height, int32_t max_height,
return LV_CLAMP(min_height, height, max_height);
}
void lv_obj_center(lv_obj_t * obj)
{
lv_obj_align(obj, LV_ALIGN_CENTER, 0, 0);
}
/**********************
* STATIC FUNCTIONS
**********************/
@ -1118,7 +1138,7 @@ static void layout_update_core(lv_obj_t * obj)
lv_obj_refr_pos(obj);
if(child_cnt > 0) {
_lv_layout_apply(obj);
lv_layout_apply(obj);
}
}

View File

@ -179,9 +179,9 @@ void lv_obj_set_align(lv_obj_t * obj, lv_align_t align);
void lv_obj_align(lv_obj_t * obj, lv_align_t align, int32_t x_ofs, int32_t y_ofs);
/**
* Align an object to an other object.
* Align an object to another object.
* @param obj pointer to an object to align
* @param base pointer to an other object (if NULL `obj`s parent is used). 'obj' will be aligned to it.
* @param base pointer to another object (if NULL `obj`s parent is used). 'obj' will be aligned to it.
* @param align type of alignment (see 'lv_align_t' enum)
* @param x_ofs x coordinate offset after alignment
* @param y_ofs y coordinate offset after alignment
@ -195,10 +195,7 @@ void lv_obj_align_to(lv_obj_t * obj, const lv_obj_t * base, lv_align_t align, in
* @param obj pointer to an object to align
* @note if the parent size changes `obj` needs to be aligned manually again
*/
static inline void lv_obj_center(lv_obj_t * obj)
{
lv_obj_align(obj, LV_ALIGN_CENTER, 0, 0);
}
void lv_obj_center(lv_obj_t * obj);
/**
* Copy the coordinates of an object to an area
@ -256,14 +253,14 @@ int32_t lv_obj_get_y(const lv_obj_t * obj);
int32_t lv_obj_get_y2(const lv_obj_t * obj);
/**
* Get the actually set x coordinate of object, i.e. the offset form the set alignment
* Get the actually set x coordinate of object, i.e. the offset from the set alignment
* @param obj pointer to an object
* @return the set x coordinate
*/
int32_t lv_obj_get_x_aligned(const lv_obj_t * obj);
/**
* Get the actually set y coordinate of object, i.e. the offset form the set alignment
* Get the actually set y coordinate of object, i.e. the offset from the set alignment
* @param obj pointer to an object
* @return the set y coordinate
*/

View File

@ -0,0 +1,88 @@
/**
* @file lv_obj_private.h
*
*/
#ifndef LV_OBJ_PRIVATE_H
#define LV_OBJ_PRIVATE_H
#ifdef __cplusplus
extern "C" {
#endif
/*********************
* INCLUDES
*********************/
#include "lv_obj.h"
/*********************
* DEFINES
*********************/
/**********************
* TYPEDEFS
**********************/
/**
* Special, rarely used attributes.
* They are allocated automatically if any elements is set.
*/
struct lv_obj_spec_attr_t {
lv_obj_t ** children; /**< Store the pointer of the children in an array.*/
lv_group_t * group_p;
lv_event_list_t event_list;
lv_point_t scroll; /**< The current X/Y scroll offset*/
int32_t ext_click_pad; /**< Extra click padding in all direction*/
int32_t ext_draw_size; /**< EXTend the size in every direction for drawing.*/
uint16_t child_cnt; /**< Number of children*/
uint16_t scrollbar_mode : 2; /**< How to display scrollbars, see `lv_scrollbar_mode_t`*/
uint16_t scroll_snap_x : 2; /**< Where to align the snappable children horizontally, see `lv_scroll_snap_t`*/
uint16_t scroll_snap_y : 2; /**< Where to align the snappable children vertically*/
uint16_t scroll_dir : 4; /**< The allowed scroll direction(s), see `lv_dir_t`*/
uint16_t layer_type : 2; /**< Cache the layer type here. Element of lv_intermediate_layer_type_t */
};
struct lv_obj_t {
const lv_obj_class_t * class_p;
lv_obj_t * parent;
lv_obj_spec_attr_t * spec_attr;
lv_obj_style_t * styles;
#if LV_OBJ_STYLE_CACHE
uint32_t style_main_prop_is_set;
uint32_t style_other_prop_is_set;
#endif
void * user_data;
#if LV_USE_OBJ_ID
void * id;
#endif
lv_area_t coords;
lv_obj_flag_t flags;
lv_state_t state;
uint16_t layout_inv : 1;
uint16_t readjust_scroll_after_layout : 1;
uint16_t scr_layout_inv : 1;
uint16_t skip_trans : 1;
uint16_t style_cnt : 6;
uint16_t h_layout : 1;
uint16_t w_layout : 1;
uint16_t is_deleting : 1;
};
/**********************
* GLOBAL PROTOTYPES
**********************/
/**********************
* MACROS
**********************/
#ifdef __cplusplus
} /*extern "C"*/
#endif
#endif /*LV_OBJ_PRIVATE_H*/

View File

@ -6,9 +6,12 @@
/*********************
* INCLUDES
*********************/
#include "lv_obj_private.h"
#include "../core/lv_obj.h"
#include "../stdlib/lv_string.h"
#include "../misc/lv_utils.h"
#include "lv_obj_property.h"
#include "lv_obj_class_private.h"
#if LV_USE_OBJ_PROPERTY
@ -21,13 +24,19 @@
**********************/
typedef void (*lv_property_set_int_t)(lv_obj_t *, int32_t);
typedef void (*lv_property_set_pointer_t)(lv_obj_t *, const void *);
typedef void (*lv_property_set_bool_t)(lv_obj_t *, bool);
typedef void (*lv_property_set_precise_t)(lv_obj_t *, lv_value_precise_t);
typedef void (*lv_property_set_color_t)(lv_obj_t *, lv_color_t);
typedef void (*lv_property_set_point_t)(lv_obj_t *, lv_point_t *);
typedef void (*lv_property_set_pointer_t)(lv_obj_t *, const void *);
typedef lv_result_t (*lv_property_setter_t)(lv_obj_t *, lv_prop_id_t, const lv_property_t *);
typedef int32_t (*lv_property_get_int_t)(const lv_obj_t *);
typedef void * (*lv_property_get_pointer_t)(const lv_obj_t *);
typedef bool (*lv_property_get_bool_t)(const lv_obj_t *);
typedef lv_value_precise_t (*lv_property_get_precise_t)(const lv_obj_t *);
typedef lv_color_t (*lv_property_get_color_t)(const lv_obj_t *);
typedef lv_point_t (*lv_property_get_point_t)(lv_obj_t *);
typedef void * (*lv_property_get_pointer_t)(const lv_obj_t *);
typedef lv_result_t (*lv_property_getter_t)(const lv_obj_t *, lv_prop_id_t, lv_property_t *);
/**********************
@ -35,6 +44,7 @@ typedef lv_result_t (*lv_property_getter_t)(const lv_obj_t *, lv_prop_id_t, lv_p
**********************/
static lv_result_t obj_property(lv_obj_t * obj, lv_prop_id_t id, lv_property_t * value, bool set);
static int32_t property_name_compare(const void * ref, const void * element);
/**********************
* STATIC VARIABLES
@ -52,13 +62,14 @@ lv_result_t lv_obj_set_property(lv_obj_t * obj, const lv_property_t * value)
{
LV_ASSERT(obj && value);
if(value->id == LV_PROPERTY_ID_INVALID) {
LV_LOG_WARN("invalid property id set to %p\n", obj);
uint32_t index = LV_PROPERTY_ID_INDEX(value->id);
if(value->id == LV_PROPERTY_ID_INVALID || index > LV_PROPERTY_ID_ANY) {
LV_LOG_WARN("Invalid property id set to %p", obj);
return LV_RESULT_INVALID;
}
if(value->id < LV_PROPERTY_ID_START) {
lv_obj_set_local_style_prop(obj, value->id, value->_style, 0);
if(index < LV_PROPERTY_ID_START) {
lv_obj_set_local_style_prop(obj, index, value->style, value->selector);
return LV_RESULT_OK;
}
@ -80,28 +91,110 @@ lv_result_t lv_obj_set_properties(lv_obj_t * obj, const lv_property_t * value, u
lv_property_t lv_obj_get_property(lv_obj_t * obj, lv_prop_id_t id)
{
lv_result_t result;
lv_property_t value;
lv_property_t value = { 0 };
if(id == LV_PROPERTY_ID_INVALID) {
LV_LOG_WARN("invalid property id to get from %p\n", obj);
value.id = 0;
uint32_t index = LV_PROPERTY_ID_INDEX(id);
if(id == LV_PROPERTY_ID_INVALID || index > LV_PROPERTY_ID_ANY) {
LV_LOG_WARN("Invalid property id to get from %p", obj);
value.id = LV_PROPERTY_ID_INVALID;
value.num = 0;
return value;
}
if(id < LV_PROPERTY_ID_START) {
lv_obj_get_local_style_prop(obj, id, &value._style, 0);
if(index < LV_PROPERTY_ID_START) {
lv_obj_get_local_style_prop(obj, index, &value.style, 0);
value.id = id;
value.selector = 0;
return value;
}
result = obj_property(obj, id, &value, false);
if(result != LV_RESULT_OK)
value.id = 0;
value.id = LV_PROPERTY_ID_INVALID;
return value;
}
lv_property_t lv_obj_get_style_property(lv_obj_t * obj, lv_prop_id_t id, uint32_t selector)
{
lv_property_t value;
uint32_t index = LV_PROPERTY_ID_INDEX(id);
if(index == LV_PROPERTY_ID_INVALID || index >= LV_PROPERTY_ID_START) {
LV_LOG_WARN("invalid style property id %d", id);
value.id = LV_PROPERTY_ID_INVALID;
value.num = 0;
return value;
}
lv_obj_get_local_style_prop(obj, id, &value.style, selector);
value.id = id;
value.selector = selector;
return value;
}
lv_prop_id_t lv_style_property_get_id(const char * name)
{
#if LV_USE_OBJ_PROPERTY_NAME
lv_property_name_t * found;
/*Check style property*/
found = lv_utils_bsearch(name, lv_style_property_names, sizeof(lv_style_property_names) / sizeof(lv_property_name_t),
sizeof(lv_property_name_t), property_name_compare);
if(found) return found->id;
#else
LV_UNUSED(name);
#endif
return LV_PROPERTY_ID_INVALID;
}
lv_prop_id_t lv_obj_class_property_get_id(const lv_obj_class_t * clz, const char * name)
{
#if LV_USE_OBJ_PROPERTY_NAME
const lv_property_name_t * names;
lv_property_name_t * found;
names = clz->property_names;
if(names == NULL) {
/* try base class*/
return LV_PROPERTY_ID_INVALID;
}
found = lv_utils_bsearch(name, names, clz->names_count, sizeof(lv_property_name_t), property_name_compare);
if(found) return found->id;
#else
LV_UNUSED(obj);
LV_UNUSED(name);
LV_UNUSED(property_name_compare);
#endif
return LV_PROPERTY_ID_INVALID;
}
lv_prop_id_t lv_obj_property_get_id(const lv_obj_t * obj, const char * name)
{
#if LV_USE_OBJ_PROPERTY_NAME
const lv_obj_class_t * clz;
lv_prop_id_t id;
for(clz = obj->class_p; clz; clz = clz->base_class) {
id = lv_obj_class_property_get_id(clz, name);
if(id != LV_PROPERTY_ID_INVALID) return id;
}
/*Check style property*/
id = lv_style_property_get_id(name);
if(id != LV_PROPERTY_ID_INVALID) return id;
#else
LV_UNUSED(obj);
LV_UNUSED(name);
LV_UNUSED(property_name_compare);
#endif
return LV_PROPERTY_ID_INVALID;
}
/**********************
* STATIC FUNCTIONS
**********************/
static lv_result_t obj_property(lv_obj_t * obj, lv_prop_id_t id, lv_property_t * value, bool set)
{
const lv_property_ops_t * properties;
@ -139,7 +232,7 @@ static lv_result_t obj_property(lv_obj_t * obj, lv_prop_id_t id, lv_property_t *
/*id matched but we got null pointer to functions*/
if(set ? prop->setter == NULL : prop->getter == NULL) {
LV_LOG_WARN("null %s provided, id: %d\n", set ? "setter" : "getter", id);
LV_LOG_WARN("NULL %s provided, id: %d", set ? "setter" : "getter", id);
return LV_RESULT_INVALID;
}
@ -147,23 +240,47 @@ static lv_result_t obj_property(lv_obj_t * obj, lv_prop_id_t id, lv_property_t *
if(!set) value->id = prop->id;
switch(LV_PROPERTY_ID_TYPE(prop->id)) {
case LV_PROPERTY_TYPE_INT:
if(set)((lv_property_set_int_t)(prop->setter))(obj, value->num);
else value->num = ((lv_property_get_int_t)(prop->getter))(obj);
break;
case LV_PROPERTY_TYPE_INT: {
if(set)((lv_property_set_int_t)(prop->setter))(obj, value->num);
else value->num = ((lv_property_get_int_t)(prop->getter))(obj);
break;
}
case LV_PROPERTY_TYPE_BOOL: {
if(set)((lv_property_set_bool_t)(prop->setter))(obj, value->enable);
else value->enable = ((lv_property_get_bool_t)(prop->getter))(obj);
break;
}
case LV_PROPERTY_TYPE_PRECISE: {
if(set)((lv_property_set_precise_t)(prop->setter))(obj, value->precise);
else value->precise = ((lv_property_get_precise_t)(prop->getter))(obj);
break;
}
case LV_PROPERTY_TYPE_COLOR: {
if(set)((lv_property_set_color_t)prop->setter)(obj, value->color);
else value->color = ((lv_property_get_color_t)(prop->getter))(obj);
break;
}
case LV_PROPERTY_TYPE_POINT: {
lv_point_t * point = &value->point;
if(set)((lv_property_set_point_t)(prop->setter))(obj, point);
else *point = ((lv_property_get_point_t)(prop->getter))(obj);
break;
}
case LV_PROPERTY_TYPE_POINTER:
case LV_PROPERTY_TYPE_IMGSRC:
if(set)((lv_property_set_pointer_t)(prop->setter))(obj, value->ptr);
else value->ptr = ((lv_property_get_pointer_t)(prop->getter))(obj);
break;
case LV_PROPERTY_TYPE_COLOR:
if(set)((lv_property_set_color_t)prop->setter)(obj, value->color);
else value->color = ((lv_property_get_color_t)(prop->getter))(obj);
break;
default:
LV_LOG_WARN("unknown property id: 0x%08x\n", prop->id);
return LV_RESULT_INVALID;
break;
case LV_PROPERTY_TYPE_TEXT:
case LV_PROPERTY_TYPE_OBJ:
case LV_PROPERTY_TYPE_DISPLAY:
case LV_PROPERTY_TYPE_FONT: {
if(set)((lv_property_set_pointer_t)(prop->setter))(obj, value->ptr);
else value->ptr = ((lv_property_get_pointer_t)(prop->getter))(obj);
break;
}
default: {
LV_LOG_WARN("Unknown property id: 0x%08x", prop->id);
return LV_RESULT_INVALID;
}
}
return LV_RESULT_OK;
@ -172,8 +289,14 @@ static lv_result_t obj_property(lv_obj_t * obj, lv_prop_id_t id, lv_property_t *
/*If no setter found, try base class then*/
}
LV_LOG_WARN("unknown property id: 0x%08x\n", id);
LV_LOG_WARN("Unknown property id: 0x%08x", id);
return LV_RESULT_INVALID;
}
static int property_name_compare(const void * ref, const void * element)
{
const lv_property_name_t * prop = element;
return lv_strcmp(ref, prop->name);
}
#endif /*LV_USE_OBJ_PROPERTY*/

View File

@ -27,60 +27,100 @@ extern "C" {
#define LV_PROPERTY_TYPE_INT 1 /*int32_t type*/
#define LV_PROPERTY_TYPE_PRECISE 2 /*lv_value_precise_t, int32_t or float depending on LV_USE_FLOAT*/
#define LV_PROPERTY_TYPE_COLOR 3 /*ARGB8888 type*/
#define LV_PROPERTY_TYPE_POINTER 4 /*void * pointer*/
#define LV_PROPERTY_TYPE_IMGSRC 5 /*Special pointer for image*/
#define LV_PROPERTY_TYPE_POINT 4 /*lv_point_t */
#define LV_PROPERTY_TYPE_POINTER 5 /*void * pointer*/
#define LV_PROPERTY_TYPE_IMGSRC 6 /*Special pointer for image*/
#define LV_PROPERTY_TYPE_TEXT 7 /*Special pointer of char* */
#define LV_PROPERTY_TYPE_OBJ 8 /*Special pointer of lv_obj_t* */
#define LV_PROPERTY_TYPE_DISPLAY 9 /*Special pointer of lv_display_t* */
#define LV_PROPERTY_TYPE_FONT 10 /*Special pointer of lv_font_t* */
#define LV_PROPERTY_TYPE_BOOL 11 /*int32_t type*/
/**********************
* TYPEDEFS
**********************/
#define LV_PROPERTY_TYPE_SHIFT 28
#define LV_PROPERTY_ID(clz, name, type, index) LV_PROPERTY_## clz ##_##name = (LV_PROPERTY_## clz ##_START + (index)) | ((type) << LV_PROPERTY_TYPE_SHIFT)
#define LV_PROPERTY_ID(clz, name, type, index) LV_PROPERTY_## clz ##_##name = (LV_PROPERTY_## clz ##_START + (index)) | ((type) << 28)
#define LV_PROPERTY_ID_TYPE(id) ((id) >> 28)
#define LV_PROPERTY_ID_TYPE(id) ((id) >> LV_PROPERTY_TYPE_SHIFT)
#define LV_PROPERTY_ID_INDEX(id) ((id) & 0xfffffff)
/*Set properties from an array of lv_property_t*/
#define LV_OBJ_SET_PROPERTY_ARRAY(obj, array) lv_obj_set_properties(obj, array, sizeof(array)/sizeof(array[0]))
/**********************
* TYPEDEFS
**********************/
/**
* Group of predefined widget ID start value.
*/
enum {
LV_PROPERTY_ID_INVALID = 0,
LV_PROPERTY_ID_INVALID = 0,
/*ID 0 to 0xff are style ID, check lv_style_prop_t*/
LV_PROPERTY_ID_START = 0x100, /*ID little than 0xff is style ID*/
/*ID 0x01 to 0xff are style ID, check lv_style_prop_t*/
LV_PROPERTY_STYLE_START = 0x00,
/* lv_obj.c */
LV_PROPERTY_OBJ_START = 1000,
LV_PROPERTY_ID_START = 0x0100, /*ID smaller than 0xff is style ID*/
/*Define the property ID for every widget here. */
LV_PROPERTY_OBJ_START = 0x0100, /* lv_obj.c */
LV_PROPERTY_IMAGE_START = 0x0200, /* lv_image.c */
LV_PROPERTY_LABEL_START = 0x0300, /* lv_label.c */
LV_PROPERTY_KEYBOARD_START = 0x0400, /* lv_keyboard.c */
LV_PROPERTY_TEXTAREA_START = 0x0500, /* lv_textarea.c */
LV_PROPERTY_ROLLER_START = 0x0600, /* lv_roller.c */
LV_PROPERTY_DROPDOWN_START = 0x0700, /* lv_dropdown.c */
/* lv_image.c */
LV_PROPERTY_IMAGE_START = 1100,
/*Special ID, use it to extend ID and make sure it's unique and compile time determinant*/
LV_PROPERTY_ID_BUILTIN_LAST = 0xffff, /*ID of 0x10000 ~ 0xfffffff is reserved for user*/
/*Special ID*/
LV_PROPERTY_ID_BUILTIN_LAST, /*Use it to extend ID and make sure it's unique and compile time determinant*/
LV_PROPERTY_ID_ANY = 0x7ffffffe, /*Special ID used by lvgl to intercept all setter/getter call.*/
LV_PROPERTY_ID_ANY = 0x7ffffffe, /*Special ID used by lvgl to intercept all setter/getter call.*/
};
typedef uint32_t lv_prop_id_t;
struct lv_property_name_t {
const char * name;
lv_prop_id_t id;
};
typedef struct {
lv_prop_id_t id;
union {
int32_t num; /**< Number integer number (opacity, enums, booleans or "normal" numbers)*/
bool enable; /**< booleans*/
const void * ptr; /**< Constant pointers (font, cone text, etc)*/
lv_color_t color; /**< Colors*/
lv_value_precise_t precise; /**< float or int for precise value*/
lv_style_value_t _style; /**< A place holder for style value which is same as property value.*/
lv_point_t point; /**< Point*/
struct {
/**
* Note that place struct member `style` at first place is intended.
* `style` shares same memory with `num`, `ptr`, `color`.
* So we set the style value directly without using `prop.style.num`.
*
* E.g.
*
* static const lv_property_t obj_pos_x = {
* .id = LV_PROPERTY_STYLE_X,
* .num = 123,
* .selector = LV_STATE_PRESSED,
* }
*
* instead of:
* static const lv_property_t obj_pos_x = {
* .id = LV_PROPERTY_STYLE_X,
* .style.num = 123, // note this line.
* .selector = LV_STATE_PRESSED,
* }
*/
lv_style_value_t style; /**< Make sure it's the first element in struct. */
uint32_t selector; /**< Style selector, lv_part_t | lv_state_t */
};
};
} lv_property_t;
typedef struct {
lv_prop_id_t id;
void * setter;
void * getter;
void * setter; /**< Callback used to set property. */
void * getter; /**< Callback used to get property. */
} lv_property_ops_t;
/**********************
@ -92,14 +132,20 @@ typedef struct {
*====================*/
/**
* Set widget property value.
* Set widget property.
* @param obj pointer to an object
* @param id ID of which property
* @param value The property value to set
* @return return LV_RESULT_OK if success
*/
lv_result_t lv_obj_set_property(lv_obj_t * obj, const lv_property_t * value);
/**
* Set multiple widget properties. Helper `LV_OBJ_SET_PROPERTY_ARRAY` can be used for constant property array.
* @param obj pointer to an object
* @param value The property value array to set
* @param count The count of the property value array
* @return return LV_RESULT_OK if success
*/
lv_result_t lv_obj_set_properties(lv_obj_t * obj, const lv_property_t * value, uint32_t count);
/*=====================
@ -107,18 +153,53 @@ lv_result_t lv_obj_set_properties(lv_obj_t * obj, const lv_property_t * value, u
*====================*/
/**
* Read property value from object
* Read property value from object.
* If id is a style property, the style selector is default to 0.
* @param obj pointer to an object
* @param id ID of which property
* @param value pointer to a buffer to store the value
* @return ? to be discussed, LV_RESULT_OK or LV_RESULT_INVALID
* @param id ID of which property to read
* @return return the property value read. The returned property ID is set to `LV_PROPERTY_ID_INVALID` if failed.
*/
lv_property_t lv_obj_get_property(lv_obj_t * obj, lv_prop_id_t id);
/**
* Read a style property value from object
* @param obj pointer to an object
* @param id ID of style property
* @param selector selector for the style property.
* @return return the property value read. The returned property ID is set to `LV_PROPERTY_ID_INVALID` if failed.
*/
lv_property_t lv_obj_get_style_property(lv_obj_t * obj, lv_prop_id_t id, uint32_t selector);
/**
* Get the property ID by name recursively to base classes. Requires to enable `LV_USE_OBJ_PROPERTY_NAME`.
* @param obj pointer to an object that has specified property or base class has.
* @param name property name
* @return property ID found or `LV_PROPERTY_ID_INVALID` if not found.
*/
lv_prop_id_t lv_obj_property_get_id(const lv_obj_t * obj, const char * name);
/**
* Get the property ID by name without check base class recursively. Requires to enable `LV_USE_OBJ_PROPERTY_NAME`.
* @param clz pointer to an object class that has specified property or base class has.
* @param name property name
* @return property ID found or `LV_PROPERTY_ID_INVALID` if not found.
*/
lv_prop_id_t lv_obj_class_property_get_id(const lv_obj_class_t * clz, const char * name);
/**
* Get the style property ID by name. Requires to enable `LV_USE_OBJ_PROPERTY_NAME`.
* @param name property name
* @return property ID found or `LV_PROPERTY_ID_INVALID` if not found.
*/
lv_prop_id_t lv_style_property_get_id(const char * name);
/**********************
* MACROS
**********************/
#include "../widgets/property/lv_obj_property_names.h"
#include "../widgets/property/lv_style_properties.h"
#endif /*LV_USE_OBJ_PROPERTY*/
#ifdef __cplusplus

View File

@ -6,11 +6,13 @@
/*********************
* INCLUDES
*********************/
#include "lv_obj_scroll.h"
#include "lv_obj.h"
#include "lv_obj_scroll_private.h"
#include "../misc/lv_anim_private.h"
#include "lv_obj_private.h"
#include "../indev/lv_indev.h"
#include "../indev/lv_indev_scroll.h"
#include "../display/lv_display.h"
#include "../misc/lv_area.h"
/*********************
* DEFINES
@ -33,7 +35,7 @@
**********************/
static void scroll_x_anim(void * obj, int32_t v);
static void scroll_y_anim(void * obj, int32_t v);
static void scroll_completed_completed_cb(lv_anim_t * a);
static void scroll_end_cb(lv_anim_t * a);
static void scroll_area_into_view(const lv_area_t * area, lv_obj_t * child, lv_point_t * scroll_value,
lv_anim_enable_t anim_en);
@ -309,7 +311,7 @@ void lv_obj_scroll_by(lv_obj_t * obj, int32_t dx, int32_t dy, lv_anim_enable_t a
lv_anim_t a;
lv_anim_init(&a);
lv_anim_set_var(&a, obj);
lv_anim_set_completed_cb(&a, scroll_completed_completed_cb);
lv_anim_set_deleted_cb(&a, scroll_end_cb);
if(dx) {
uint32_t t = lv_anim_speed_clamped((lv_display_get_horizontal_resolution(d)) >> 1, SCROLL_ANIM_TIME_MIN,
@ -350,7 +352,7 @@ void lv_obj_scroll_by(lv_obj_t * obj, int32_t dx, int32_t dy, lv_anim_enable_t a
res = lv_obj_send_event(obj, LV_EVENT_SCROLL_BEGIN, NULL);
if(res != LV_RESULT_OK) return;
res = _lv_obj_scroll_by_raw(obj, dx, dy);
res = lv_obj_scroll_by_raw(obj, dx, dy);
if(res != LV_RESULT_OK) return;
res = lv_obj_send_event(obj, LV_EVENT_SCROLL_END, NULL);
@ -408,7 +410,7 @@ void lv_obj_scroll_to_view_recursive(lv_obj_t * obj, lv_anim_enable_t anim_en)
}
}
lv_result_t _lv_obj_scroll_by_raw(lv_obj_t * obj, int32_t x, int32_t y)
lv_result_t lv_obj_scroll_by_raw(lv_obj_t * obj, int32_t x, int32_t y)
{
if(x == 0 && y == 0) return LV_RESULT_OK;
@ -440,6 +442,8 @@ void lv_obj_update_snap(lv_obj_t * obj, lv_anim_enable_t anim_en)
lv_obj_update_layout(obj);
lv_point_t p;
lv_indev_scroll_get_snap_dist(obj, &p);
if(p.x == LV_COORD_MAX || p.x == LV_COORD_MIN) p.x = 0;
if(p.y == LV_COORD_MAX || p.y == LV_COORD_MIN) p.y = 0;
lv_obj_scroll_by(obj, p.x, p.y, anim_en);
}
@ -450,7 +454,7 @@ void lv_obj_get_scrollbar_area(lv_obj_t * obj, lv_area_t * hor_area, lv_area_t *
if(lv_obj_has_flag(obj, LV_OBJ_FLAG_SCROLLABLE) == false) return;
lv_dir_t sm = lv_obj_get_scrollbar_mode(obj);
lv_scrollbar_mode_t sm = lv_obj_get_scrollbar_mode(obj);
if(sm == LV_SCROLLBAR_MODE_OFF) return;
/*If there is no indev scrolling this object but `mode==active` return*/
@ -667,17 +671,18 @@ void lv_obj_readjust_scroll(lv_obj_t * obj, lv_anim_enable_t anim_en)
static void scroll_x_anim(void * obj, int32_t v)
{
_lv_obj_scroll_by_raw(obj, v + lv_obj_get_scroll_x(obj), 0);
lv_obj_scroll_by_raw(obj, v + lv_obj_get_scroll_x(obj), 0);
}
static void scroll_y_anim(void * obj, int32_t v)
{
_lv_obj_scroll_by_raw(obj, 0, v + lv_obj_get_scroll_y(obj));
lv_obj_scroll_by_raw(obj, 0, v + lv_obj_get_scroll_y(obj));
}
static void scroll_completed_completed_cb(lv_anim_t * a)
static void scroll_end_cb(lv_anim_t * a)
{
lv_obj_send_event(a->var, LV_EVENT_SCROLL_END, NULL);
/*Do not sent END event if there wasn't a BEGIN*/
if(a->start_cb_called) lv_obj_send_event(a->var, LV_EVENT_SCROLL_END, NULL);
}
static void scroll_area_into_view(const lv_area_t * area, lv_obj_t * child, lv_point_t * scroll_value,
@ -731,6 +736,8 @@ static void scroll_area_into_view(const lv_area_t * area, lv_obj_t * child, lv_p
act = lv_area_get_height(area_tmp) / 2 + area_tmp->y1 + y_scroll;
y_scroll += snap_goal - act;
break;
case LV_SCROLL_SNAP_NONE:
break;
}
int32_t x_scroll = 0;
@ -773,16 +780,13 @@ static void scroll_area_into_view(const lv_area_t * area, lv_obj_t * child, lv_p
act = lv_area_get_width(area_tmp) / 2 + area_tmp->x1 + x_scroll;
x_scroll += snap_goal - act;
break;
case LV_SCROLL_SNAP_NONE:
break;
}
/*Remove any pending scroll animations.*/
bool y_del = lv_anim_delete(parent, scroll_y_anim);
bool x_del = lv_anim_delete(parent, scroll_x_anim);
if(y_del || x_del) {
lv_result_t res;
res = lv_obj_send_event(parent, LV_EVENT_SCROLL_END, NULL);
if(res != LV_RESULT_OK) return;
}
lv_anim_delete(parent, scroll_y_anim);
lv_anim_delete(parent, scroll_x_anim);
if((scroll_dir & LV_DIR_LEFT) == 0 && x_scroll < 0) x_scroll = 0;
if((scroll_dir & LV_DIR_RIGHT) == 0 && x_scroll > 0) x_scroll = 0;

View File

@ -28,32 +28,20 @@ extern "C" {
/*Can't include lv_obj.h because it includes this header file*/
/** Scrollbar modes: shows when should the scrollbars be visible*/
enum _lv_scrollbar_mode_t {
typedef enum {
LV_SCROLLBAR_MODE_OFF, /**< Never show scrollbars*/
LV_SCROLLBAR_MODE_ON, /**< Always show scrollbars*/
LV_SCROLLBAR_MODE_ACTIVE, /**< Show scroll bars when object is being scrolled*/
LV_SCROLLBAR_MODE_AUTO, /**< Show scroll bars when the content is large enough to be scrolled*/
};
#ifdef DOXYGEN
typedef _lv_scrollbar_mode_t lv_scrollbar_mode_t;
#else
typedef uint8_t lv_scrollbar_mode_t;
#endif /*DOXYGEN*/
} lv_scrollbar_mode_t;
/** Scroll span align options. Tells where to align the snappable children when scroll stops.*/
enum _lv_scroll_snap_t {
typedef enum {
LV_SCROLL_SNAP_NONE, /**< Do not align, leave where it is*/
LV_SCROLL_SNAP_START, /**< Align to the left/top*/
LV_SCROLL_SNAP_END, /**< Align to the right/bottom*/
LV_SCROLL_SNAP_CENTER /**< Align to the center*/
};
#ifdef DOXYGEN
typedef _lv_scroll_snap_t lv_scroll_snap_t;
#else
typedef uint8_t lv_scroll_snap_t;
#endif /*DOXYGEN*/
} lv_scroll_snap_t;
/**********************
* GLOBAL PROTOTYPES
@ -105,7 +93,6 @@ lv_scrollbar_mode_t lv_obj_get_scrollbar_mode(const lv_obj_t * obj);
/**
* Get the object in which directions can be scrolled
* @param obj pointer to an object
* @param dir the allow scroll directions. An element or OR-ed values of `lv_dir_t`
*/
lv_dir_t lv_obj_get_scroll_dir(const lv_obj_t * obj);
@ -257,17 +244,6 @@ void lv_obj_scroll_to_view(lv_obj_t * obj, lv_anim_enable_t anim_en);
*/
void lv_obj_scroll_to_view_recursive(lv_obj_t * obj, lv_anim_enable_t anim_en);
/**
* Low level function to scroll by given x and y coordinates.
* `LV_EVENT_SCROLL` is sent.
* @param obj pointer to an object to scroll
* @param x pixels to scroll horizontally
* @param y pixels to scroll vertically
* @return `LV_RESULT_INVALID`: to object was deleted in `LV_EVENT_SCROLL`;
* `LV_RESULT_OK`: if the object is still valid
*/
lv_result_t _lv_obj_scroll_by_raw(lv_obj_t * obj, int32_t x, int32_t y);
/**
* Tell whether an object is being scrolled or not at this moment
* @param obj pointer to an object

View File

@ -0,0 +1,50 @@
/**
* @file lv_obj_scroll_private.h
*
*/
#ifndef LV_OBJ_SCROLL_PRIVATE_H
#define LV_OBJ_SCROLL_PRIVATE_H
#ifdef __cplusplus
extern "C" {
#endif
/*********************
* INCLUDES
*********************/
#include "lv_obj_scroll.h"
/*********************
* DEFINES
*********************/
/**********************
* TYPEDEFS
**********************/
/**********************
* GLOBAL PROTOTYPES
**********************/
/**
* Low level function to scroll by given x and y coordinates.
* `LV_EVENT_SCROLL` is sent.
* @param obj pointer to an object to scroll
* @param x pixels to scroll horizontally
* @param y pixels to scroll vertically
* @return `LV_RESULT_INVALID`: to object was deleted in `LV_EVENT_SCROLL`;
* `LV_RESULT_OK`: if the object is still valid
*/
lv_result_t lv_obj_scroll_by_raw(lv_obj_t * obj, int32_t x, int32_t y);
/**********************
* MACROS
**********************/
#ifdef __cplusplus
} /*extern "C"*/
#endif
#endif /*LV_OBJ_SCROLL_PRIVATE_H*/

View File

@ -6,7 +6,10 @@
/*********************
* INCLUDES
*********************/
#include "lv_obj.h"
#include "lv_obj_private.h"
#include "../misc/lv_anim_private.h"
#include "lv_obj_style_private.h"
#include "lv_obj_class_private.h"
#include "../display/lv_display.h"
#include "../display/lv_display_private.h"
#include "../misc/lv_color.h"
@ -49,7 +52,7 @@ typedef enum {
* STATIC PROTOTYPES
**********************/
static lv_style_t * get_local_style(lv_obj_t * obj, lv_style_selector_t selector);
static _lv_obj_style_t * get_trans_style(lv_obj_t * obj, uint32_t part);
static lv_obj_style_t * get_trans_style(lv_obj_t * obj, lv_part_t part);
static lv_style_res_t get_prop_core(const lv_obj_t * obj, lv_style_selector_t selector, lv_style_prop_t prop,
lv_style_value_t * v);
static void report_style_change_core(void * style, lv_obj_t * obj);
@ -78,14 +81,14 @@ static lv_style_res_t get_selector_style_prop(const lv_obj_t * obj, lv_style_sel
* GLOBAL FUNCTIONS
**********************/
void _lv_obj_style_init(void)
void lv_obj_style_init(void)
{
_lv_ll_init(style_trans_ll_p, sizeof(trans_t));
lv_ll_init(style_trans_ll_p, sizeof(trans_t));
}
void _lv_obj_style_deinit(void)
void lv_obj_style_deinit(void)
{
_lv_ll_clear(style_trans_ll_p);
lv_ll_clear(style_trans_ll_p);
if(_style_custom_prop_flag_lookup_table != NULL) {
lv_free(_style_custom_prop_flag_lookup_table);
_style_custom_prop_flag_lookup_table = NULL;
@ -120,7 +123,7 @@ void lv_obj_add_style(lv_obj_t * obj, const lv_style_t * style, lv_style_selecto
/*Allocate space for the new style and shift the rest of the style to the end*/
obj->style_cnt++;
LV_ASSERT(obj->style_cnt != 0);
obj->styles = lv_realloc(obj->styles, obj->style_cnt * sizeof(_lv_obj_style_t));
obj->styles = lv_realloc(obj->styles, obj->style_cnt * sizeof(lv_obj_style_t));
LV_ASSERT_MALLOC(obj->styles);
uint32_t j;
@ -128,7 +131,7 @@ void lv_obj_add_style(lv_obj_t * obj, const lv_style_t * style, lv_style_selecto
obj->styles[j] = obj->styles[j - 1];
}
lv_memzero(&obj->styles[i], sizeof(_lv_obj_style_t));
lv_memzero(&obj->styles[i], sizeof(lv_obj_style_t));
obj->styles[i].style = style;
obj->styles[i].selector = selector;
@ -136,8 +139,8 @@ void lv_obj_add_style(lv_obj_t * obj, const lv_style_t * style, lv_style_selecto
uint32_t * prop_is_set = part == LV_PART_MAIN ? &obj->style_main_prop_is_set : &obj->style_other_prop_is_set;
if(lv_style_is_const(style)) {
lv_style_const_prop_t * props = style->values_and_props;
for(i = 0; props[i].prop_ptr; i++) {
(*prop_is_set) |= STYLE_PROP_SHIFTED(*props[i].prop_ptr);
for(i = 0; props[i].prop != LV_STYLE_PROP_INV; i++) {
(*prop_is_set) |= STYLE_PROP_SHIFTED(props[i].prop);
}
}
else {
@ -183,7 +186,7 @@ bool lv_obj_replace_style(lv_obj_t * obj, const lv_style_t * old_style, const lv
continue;
}
lv_memzero(&obj->styles[i], sizeof(_lv_obj_style_t));
lv_memzero(&obj->styles[i], sizeof(lv_obj_style_t));
obj->styles[i].style = new_style;
obj->styles[i].selector = selector;
@ -237,7 +240,7 @@ void lv_obj_remove_style(lv_obj_t * obj, const lv_style_t * style, lv_style_sele
}
obj->style_cnt--;
obj->styles = lv_realloc(obj->styles, obj->style_cnt * sizeof(_lv_obj_style_t));
obj->styles = lv_realloc(obj->styles, obj->style_cnt * sizeof(lv_obj_style_t));
deleted = true;
/*The style from the current `i` index is removed, so `i` points to the next style.
@ -300,7 +303,7 @@ void lv_obj_refresh_style(lv_obj_t * obj, lv_style_selector_t selector, lv_style
/*Cache the layer type*/
if((part == LV_PART_ANY || part == LV_PART_MAIN) && is_layer_refr) {
_lv_obj_update_layer_type(obj);
lv_obj_update_layer_type(obj);
}
if(prop == LV_STYLE_PROP_ANY || is_ext_draw) {
@ -409,8 +412,8 @@ bool lv_obj_remove_local_style_prop(lv_obj_t * obj, lv_style_prop_t prop, lv_sty
return res;
}
void _lv_obj_style_create_transition(lv_obj_t * obj, lv_part_t part, lv_state_t prev_state, lv_state_t new_state,
const _lv_obj_style_transition_dsc_t * tr_dsc)
void lv_obj_style_create_transition(lv_obj_t * obj, lv_part_t part, lv_state_t prev_state, lv_state_t new_state,
const lv_obj_style_transition_dsc_t * tr_dsc)
{
trans_t * tr;
@ -427,8 +430,9 @@ void _lv_obj_style_create_transition(lv_obj_t * obj, lv_part_t part, lv_state_t
v1 = lv_obj_get_style_prop(obj, part, tr_dsc->prop);
obj->state = new_state;
_lv_obj_style_t * style_trans = get_trans_style(obj, part);
lv_obj_style_t * style_trans = get_trans_style(obj, part);
lv_style_set_prop((lv_style_t *)style_trans->style, tr_dsc->prop, v1); /*Be sure `trans_style` has a valid value*/
lv_obj_refresh_style(obj, tr_dsc->selector, tr_dsc->prop);
if(tr_dsc->prop == LV_STYLE_RADIUS) {
if(v1.num == LV_RADIUS_CIRCLE || v2.num == LV_RADIUS_CIRCLE) {
@ -439,7 +443,7 @@ void _lv_obj_style_create_transition(lv_obj_t * obj, lv_part_t part, lv_state_t
}
}
tr = _lv_ll_ins_head(style_trans_ll_p);
tr = lv_ll_ins_head(style_trans_ll_p);
LV_ASSERT_MALLOC(tr);
if(tr == NULL) return;
tr->start_value = v1;
@ -463,7 +467,7 @@ void _lv_obj_style_create_transition(lv_obj_t * obj, lv_part_t part, lv_state_t
lv_anim_start(&a);
}
lv_style_value_t _lv_obj_style_apply_color_filter(const lv_obj_t * obj, uint32_t part, lv_style_value_t v)
lv_style_value_t lv_obj_style_apply_color_filter(const lv_obj_t * obj, lv_part_t part, lv_style_value_t v)
{
if(obj == NULL) return v;
const lv_color_filter_dsc_t * f = lv_obj_get_style_color_filter_dsc(obj, part);
@ -474,9 +478,9 @@ lv_style_value_t _lv_obj_style_apply_color_filter(const lv_obj_t * obj, uint32_t
return v;
}
_lv_style_state_cmp_t _lv_obj_style_state_compare(lv_obj_t * obj, lv_state_t state1, lv_state_t state2)
lv_style_state_cmp_t lv_obj_style_state_compare(lv_obj_t * obj, lv_state_t state1, lv_state_t state2)
{
_lv_style_state_cmp_t res = _LV_STYLE_STATE_CMP_SAME;
lv_style_state_cmp_t res = LV_STYLE_STATE_CMP_SAME;
/*Are there any new styles for the new state?*/
uint32_t i;
@ -510,25 +514,25 @@ _lv_style_state_cmp_t _lv_obj_style_state_compare(lv_obj_t * obj, lv_state_t sta
else if(lv_style_get_prop(style, LV_STYLE_BORDER_WIDTH, &v)) layout_diff = true;
if(layout_diff) {
return _LV_STYLE_STATE_CMP_DIFF_LAYOUT;
return LV_STYLE_STATE_CMP_DIFF_LAYOUT;
}
/*Check for draw pad changes*/
if(lv_style_get_prop(style, LV_STYLE_TRANSFORM_WIDTH, &v)) res = _LV_STYLE_STATE_CMP_DIFF_DRAW_PAD;
else if(lv_style_get_prop(style, LV_STYLE_TRANSFORM_HEIGHT, &v)) res = _LV_STYLE_STATE_CMP_DIFF_DRAW_PAD;
else if(lv_style_get_prop(style, LV_STYLE_TRANSFORM_ROTATION, &v)) res = _LV_STYLE_STATE_CMP_DIFF_DRAW_PAD;
else if(lv_style_get_prop(style, LV_STYLE_TRANSFORM_SCALE_X, &v)) res = _LV_STYLE_STATE_CMP_DIFF_DRAW_PAD;
else if(lv_style_get_prop(style, LV_STYLE_TRANSFORM_SCALE_Y, &v)) res = _LV_STYLE_STATE_CMP_DIFF_DRAW_PAD;
else if(lv_style_get_prop(style, LV_STYLE_OUTLINE_OPA, &v)) res = _LV_STYLE_STATE_CMP_DIFF_DRAW_PAD;
else if(lv_style_get_prop(style, LV_STYLE_OUTLINE_PAD, &v)) res = _LV_STYLE_STATE_CMP_DIFF_DRAW_PAD;
else if(lv_style_get_prop(style, LV_STYLE_OUTLINE_WIDTH, &v)) res = _LV_STYLE_STATE_CMP_DIFF_DRAW_PAD;
else if(lv_style_get_prop(style, LV_STYLE_SHADOW_WIDTH, &v)) res = _LV_STYLE_STATE_CMP_DIFF_DRAW_PAD;
else if(lv_style_get_prop(style, LV_STYLE_SHADOW_OPA, &v)) res = _LV_STYLE_STATE_CMP_DIFF_DRAW_PAD;
else if(lv_style_get_prop(style, LV_STYLE_SHADOW_OFFSET_X, &v)) res = _LV_STYLE_STATE_CMP_DIFF_DRAW_PAD;
else if(lv_style_get_prop(style, LV_STYLE_SHADOW_OFFSET_Y, &v)) res = _LV_STYLE_STATE_CMP_DIFF_DRAW_PAD;
else if(lv_style_get_prop(style, LV_STYLE_SHADOW_SPREAD, &v)) res = _LV_STYLE_STATE_CMP_DIFF_DRAW_PAD;
else if(lv_style_get_prop(style, LV_STYLE_LINE_WIDTH, &v)) res = _LV_STYLE_STATE_CMP_DIFF_DRAW_PAD;
else if(res == _LV_STYLE_STATE_CMP_SAME) res = _LV_STYLE_STATE_CMP_DIFF_REDRAW;
if(lv_style_get_prop(style, LV_STYLE_TRANSFORM_WIDTH, &v)) res = LV_STYLE_STATE_CMP_DIFF_DRAW_PAD;
else if(lv_style_get_prop(style, LV_STYLE_TRANSFORM_HEIGHT, &v)) res = LV_STYLE_STATE_CMP_DIFF_DRAW_PAD;
else if(lv_style_get_prop(style, LV_STYLE_TRANSFORM_ROTATION, &v)) res = LV_STYLE_STATE_CMP_DIFF_DRAW_PAD;
else if(lv_style_get_prop(style, LV_STYLE_TRANSFORM_SCALE_X, &v)) res = LV_STYLE_STATE_CMP_DIFF_DRAW_PAD;
else if(lv_style_get_prop(style, LV_STYLE_TRANSFORM_SCALE_Y, &v)) res = LV_STYLE_STATE_CMP_DIFF_DRAW_PAD;
else if(lv_style_get_prop(style, LV_STYLE_OUTLINE_OPA, &v)) res = LV_STYLE_STATE_CMP_DIFF_DRAW_PAD;
else if(lv_style_get_prop(style, LV_STYLE_OUTLINE_PAD, &v)) res = LV_STYLE_STATE_CMP_DIFF_DRAW_PAD;
else if(lv_style_get_prop(style, LV_STYLE_OUTLINE_WIDTH, &v)) res = LV_STYLE_STATE_CMP_DIFF_DRAW_PAD;
else if(lv_style_get_prop(style, LV_STYLE_SHADOW_WIDTH, &v)) res = LV_STYLE_STATE_CMP_DIFF_DRAW_PAD;
else if(lv_style_get_prop(style, LV_STYLE_SHADOW_OPA, &v)) res = LV_STYLE_STATE_CMP_DIFF_DRAW_PAD;
else if(lv_style_get_prop(style, LV_STYLE_SHADOW_OFFSET_X, &v)) res = LV_STYLE_STATE_CMP_DIFF_DRAW_PAD;
else if(lv_style_get_prop(style, LV_STYLE_SHADOW_OFFSET_Y, &v)) res = LV_STYLE_STATE_CMP_DIFF_DRAW_PAD;
else if(lv_style_get_prop(style, LV_STYLE_SHADOW_SPREAD, &v)) res = LV_STYLE_STATE_CMP_DIFF_DRAW_PAD;
else if(lv_style_get_prop(style, LV_STYLE_LINE_WIDTH, &v)) res = LV_STYLE_STATE_CMP_DIFF_DRAW_PAD;
else if(res == LV_STYLE_STATE_CMP_SAME) res = LV_STYLE_STATE_CMP_DIFF_REDRAW;
}
}
@ -601,7 +605,7 @@ lv_opa_t lv_obj_get_style_opa_recursive(const lv_obj_t * obj, lv_part_t part)
return opa_final;
}
void _lv_obj_update_layer_type(lv_obj_t * obj)
void lv_obj_update_layer_type(lv_obj_t * obj)
{
lv_layer_type_t layer_type = calculate_layer_type(obj);
if(obj->spec_attr) obj->spec_attr->layer_type = layer_type;
@ -634,7 +638,7 @@ static lv_style_t * get_local_style(lv_obj_t * obj, lv_style_selector_t selector
obj->style_cnt++;
LV_ASSERT(obj->style_cnt != 0);
obj->styles = lv_realloc(obj->styles, obj->style_cnt * sizeof(_lv_obj_style_t));
obj->styles = lv_realloc(obj->styles, obj->style_cnt * sizeof(lv_obj_style_t));
LV_ASSERT_MALLOC(obj->styles);
for(i = obj->style_cnt - 1; i > 0 ; i--) {
@ -644,7 +648,7 @@ static lv_style_t * get_local_style(lv_obj_t * obj, lv_style_selector_t selector
obj->styles[i] = obj->styles[i - 1];
}
lv_memzero(&obj->styles[i], sizeof(_lv_obj_style_t));
lv_memzero(&obj->styles[i], sizeof(lv_obj_style_t));
obj->styles[i].style = lv_malloc(sizeof(lv_style_t));
lv_style_init((lv_style_t *)obj->styles[i].style);
@ -660,7 +664,7 @@ static lv_style_t * get_local_style(lv_obj_t * obj, lv_style_selector_t selector
* @param selector OR-ed value of parts and state for which the style should be get
* @return pointer to the transition style
*/
static _lv_obj_style_t * get_trans_style(lv_obj_t * obj, lv_style_selector_t selector)
static lv_obj_style_t * get_trans_style(lv_obj_t * obj, lv_style_selector_t selector)
{
uint32_t i;
for(i = 0; i < obj->style_cnt; i++) {
@ -672,13 +676,13 @@ static _lv_obj_style_t * get_trans_style(lv_obj_t * obj, lv_style_selector_t se
obj->style_cnt++;
LV_ASSERT(obj->style_cnt != 0);
obj->styles = lv_realloc(obj->styles, obj->style_cnt * sizeof(_lv_obj_style_t));
obj->styles = lv_realloc(obj->styles, obj->style_cnt * sizeof(lv_obj_style_t));
for(i = obj->style_cnt - 1; i > 0 ; i--) {
obj->styles[i] = obj->styles[i - 1];
}
lv_memzero(&obj->styles[0], sizeof(_lv_obj_style_t));
lv_memzero(&obj->styles[0], sizeof(lv_obj_style_t));
obj->styles[0].style = lv_malloc(sizeof(lv_style_t));
lv_style_init((lv_style_t *)obj->styles[0].style);
@ -691,7 +695,7 @@ static lv_style_res_t get_prop_core(const lv_obj_t * obj, lv_style_selector_t se
lv_style_value_t * v)
{
const uint32_t group = (uint32_t)1 << _lv_style_get_prop_group(prop);
const uint32_t group = (uint32_t)1 << lv_style_get_prop_group(prop);
const lv_part_t part = lv_obj_style_get_selector_part(selector);
const lv_state_t state = lv_obj_style_get_selector_state(selector);
const lv_state_t state_inv = ~state;
@ -700,7 +704,7 @@ static lv_style_res_t get_prop_core(const lv_obj_t * obj, lv_style_selector_t se
lv_style_res_t found;
uint32_t i;
for(i = 0; i < obj->style_cnt; i++) {
_lv_obj_style_t * obj_style = &obj->styles[i];
lv_obj_style_t * obj_style = &obj->styles[i];
if(obj_style->is_trans == false) break;
if(skip_trans) continue;
@ -716,7 +720,7 @@ static lv_style_res_t get_prop_core(const lv_obj_t * obj, lv_style_selector_t se
for(; i < obj->style_cnt; i++) {
if((obj->styles[i].style->has_group & group) == 0) continue;
_lv_obj_style_t * obj_style = &obj->styles[i];
lv_obj_style_t * obj_style = &obj->styles[i];
lv_part_t part_act = lv_obj_style_get_selector_part(obj->styles[i].selector);
if(part_act != part) continue;
@ -784,7 +788,7 @@ static void refresh_children_style(lv_obj_t * obj)
/**
* Remove the transition from object's part's property.
* - Remove the transition from `_lv_obj_style_trans_ll` and free it
* - Remove the transition from `lv_obj_style_trans_ll` and free it
* - Delete pending transitions
* @param obj pointer to an object which transition(s) should be removed
* @param part a part of object or 0xFF to remove from all parts
@ -796,12 +800,12 @@ static bool trans_delete(lv_obj_t * obj, lv_part_t part, lv_style_prop_t prop, t
trans_t * tr;
trans_t * tr_prev;
bool removed = false;
tr = _lv_ll_get_tail(style_trans_ll_p);
tr = lv_ll_get_tail(style_trans_ll_p);
while(tr != NULL) {
if(tr == tr_limit) break;
/*'tr' might be deleted, so get the next object while 'tr' is valid*/
tr_prev = _lv_ll_get_prev(style_trans_ll_p, tr);
tr_prev = lv_ll_get_prev(style_trans_ll_p, tr);
if(tr->obj == obj && (part == tr->selector || part == LV_PART_ANY) && (prop == tr->prop || prop == LV_STYLE_PROP_ANY)) {
/*Remove any transitioned properties from the trans. style
@ -815,7 +819,7 @@ static bool trans_delete(lv_obj_t * obj, lv_part_t part, lv_style_prop_t prop, t
/*Free the transition descriptor too*/
lv_anim_delete(tr, NULL);
_lv_ll_remove(style_trans_ll_p, tr);
lv_ll_remove(style_trans_ll_p, tr);
lv_free(tr);
removed = true;
@ -905,9 +909,10 @@ static void trans_anim_start_cb(lv_anim_t * a)
tr->prop = prop_tmp;
_lv_obj_style_t * style_trans = get_trans_style(tr->obj, tr->selector);
lv_style_set_prop((lv_style_t *)style_trans->style, tr->prop,
tr->start_value); /*Be sure `trans_style` has a valid value*/
lv_obj_style_t * style_trans = get_trans_style(tr->obj, tr->selector);
/*Be sure `trans_style` has a valid value*/
lv_style_set_prop((lv_style_t *)style_trans->style, tr->prop, tr->start_value);
lv_obj_refresh_style(tr->obj, tr->selector, tr->prop);
}
@ -922,7 +927,7 @@ static void trans_anim_completed_cb(lv_anim_t * a)
*It allows changing it by normal styles*/
bool running = false;
trans_t * tr_i;
_LV_LL_READ(style_trans_ll_p, tr_i) {
LV_LL_READ(style_trans_ll_p, tr_i) {
if(tr_i != tr && tr_i->obj == tr->obj && tr_i->selector == tr->selector && tr_i->prop == tr->prop) {
running = true;
break;
@ -933,10 +938,10 @@ static void trans_anim_completed_cb(lv_anim_t * a)
uint32_t i;
for(i = 0; i < obj->style_cnt; i++) {
if(obj->styles[i].is_trans && obj->styles[i].selector == tr->selector) {
_lv_ll_remove(style_trans_ll_p, tr);
lv_ll_remove(style_trans_ll_p, tr);
lv_free(tr);
_lv_obj_style_t * obj_style = &obj->styles[i];
lv_obj_style_t * obj_style = &obj->styles[i];
lv_style_remove_prop((lv_style_t *)obj_style->style, prop);
if(lv_style_is_empty(obj->styles[i].style)) {
@ -974,8 +979,8 @@ static void full_cache_refresh(lv_obj_t * obj, lv_part_t part)
uint32_t j;
if(lv_style_is_const(style)) {
lv_style_const_prop_t * props = style->values_and_props;
for(j = 0; props[j].prop_ptr; j++) {
obj->style_main_prop_is_set |= STYLE_PROP_SHIFTED(*props[j].prop_ptr);
for(j = 0; props[j].prop != LV_STYLE_PROP_INV; j++) {
obj->style_main_prop_is_set |= STYLE_PROP_SHIFTED(props[j].prop);
}
}
else {
@ -994,8 +999,8 @@ static void full_cache_refresh(lv_obj_t * obj, lv_part_t part)
uint32_t j;
if(lv_style_is_const(style)) {
lv_style_const_prop_t * props = style->values_and_props;
for(j = 0; props[j].prop_ptr; j++) {
obj->style_other_prop_is_set |= STYLE_PROP_SHIFTED(*props[j].prop_ptr);
for(j = 0; props[j].prop != LV_STYLE_PROP_INV; j++) {
obj->style_other_prop_is_set |= STYLE_PROP_SHIFTED(props[j].prop);
}
}
else {
@ -1027,8 +1032,8 @@ static bool style_has_flag(const lv_style_t * style, uint32_t flag)
if(lv_style_is_const(style)) {
lv_style_const_prop_t * props = style->values_and_props;
uint32_t i;
for(i = 0; props[i].prop_ptr; i++) {
if(lv_style_prop_has_flag(*props[i].prop_ptr, flag)) {
for(i = 0; props[i].prop != LV_STYLE_PROP_INV; i++) {
if(lv_style_prop_has_flag(props[i].prop, flag)) {
return true;
}
}
@ -1061,14 +1066,14 @@ static lv_style_res_t get_selector_style_prop(const lv_obj_t * obj, lv_style_sel
if(found == LV_STYLE_RES_FOUND) return LV_STYLE_RES_FOUND;
}
extern const uint8_t _lv_style_builtin_prop_flag_lookup_table[];
extern const uint8_t lv_style_builtin_prop_flag_lookup_table[];
bool inheritable = false;
if(prop < _LV_STYLE_NUM_BUILT_IN_PROPS) {
inheritable = _lv_style_builtin_prop_flag_lookup_table[prop] & LV_STYLE_PROP_FLAG_INHERITABLE;
if(prop < LV_STYLE_NUM_BUILT_IN_PROPS) {
inheritable = lv_style_builtin_prop_flag_lookup_table[prop] & LV_STYLE_PROP_FLAG_INHERITABLE;
}
else {
if(_style_custom_prop_flag_lookup_table != NULL) {
inheritable = _style_custom_prop_flag_lookup_table[prop - _LV_STYLE_NUM_BUILT_IN_PROPS] &
inheritable = _style_custom_prop_flag_lookup_table[prop - LV_STYLE_NUM_BUILT_IN_PROPS] &
LV_STYLE_PROP_FLAG_INHERITABLE;
}
}

View File

@ -13,10 +13,9 @@ extern "C" {
/*********************
* INCLUDES
*********************/
#include <stdint.h>
#include <stdbool.h>
#include "../misc/lv_bidi.h"
#include "../misc/lv_style.h"
#include "../misc/lv_types.h"
/*********************
* DEFINES
@ -25,67 +24,32 @@ extern "C" {
/**********************
* TYPEDEFS
**********************/
/*Can't include lv_obj.h because it includes this header file*/
#ifndef LV_OBJ_H
/// @cond
/**
* Tells Doxygen to ignore a duplicate declaration
*/
typedef uint32_t lv_part_t;
typedef uint16_t lv_state_t;
/// @endcond
#endif
typedef enum {
_LV_STYLE_STATE_CMP_SAME, /*The style properties in the 2 states are identical*/
_LV_STYLE_STATE_CMP_DIFF_REDRAW, /*The differences can be shown with a simple redraw*/
_LV_STYLE_STATE_CMP_DIFF_DRAW_PAD, /*The differences can be shown with a simple redraw*/
_LV_STYLE_STATE_CMP_DIFF_LAYOUT, /*The differences can be shown with a simple redraw*/
} _lv_style_state_cmp_t;
LV_STYLE_STATE_CMP_SAME, /**< The style properties in the 2 states are identical */
LV_STYLE_STATE_CMP_DIFF_REDRAW, /**< The differences can be shown with a simple redraw */
LV_STYLE_STATE_CMP_DIFF_DRAW_PAD, /**< The differences can be shown with a simple redraw */
LV_STYLE_STATE_CMP_DIFF_LAYOUT, /**< The differences can be shown with a simple redraw */
} lv_style_state_cmp_t;
typedef uint32_t lv_style_selector_t;
typedef struct {
const lv_style_t * style;
uint32_t selector : 24;
uint32_t is_local : 1;
uint32_t is_trans : 1;
} _lv_obj_style_t;
typedef struct {
uint16_t time;
uint16_t delay;
lv_style_selector_t selector;
lv_style_prop_t prop;
lv_anim_path_cb_t path_cb;
void * user_data;
} _lv_obj_style_transition_dsc_t;
/**********************
* GLOBAL PROTOTYPES
**********************/
/**
* Initialize the object related style manager module.
* Called by LVGL in `lv_init()`
*/
void _lv_obj_style_init(void);
/**
* Deinitialize the object related style manager module.
* Called by LVGL in `lv_deinit()`
*/
void _lv_obj_style_deinit(void);
/**
* Add a style to an object.
* @param obj pointer to an object
* @param style pointer to a style to add
* @param selector OR-ed value of parts and state to which the style should be added
* @example lv_obj_add_style(btn, &style_btn, 0); //Default button style
* @example lv_obj_add_style(btn, &btn_red, LV_STATE_PRESSED); //Overwrite only some colors to red when pressed
*
* Examples:
* @code
* lv_obj_add_style(btn, &style_btn, 0); //Default button style
*
* lv_obj_add_style(btn, &btn_red, LV_STATE_PRESSED); //Overwrite only some colors to red when pressed
* @endcode
*/
void lv_obj_add_style(lv_obj_t * obj, const lv_style_t * style, lv_style_selector_t selector);
@ -95,8 +59,13 @@ void lv_obj_add_style(lv_obj_t * obj, const lv_style_t * style, lv_style_selecto
* @param old_style pointer to a style to replace.
* @param new_style pointer to a style to replace the old style with.
* @param selector OR-ed values of states and a part to replace only styles with matching selectors. LV_STATE_ANY and LV_PART_ANY can be used
* @example lv_obj_replace_style(obj, &yellow_style, &blue_style, LV_PART_ANY | LV_STATE_ANY); //Replace a specific style
* @example lv_obj_replace_style(obj, &yellow_style, &blue_style, LV_PART_MAIN | LV_STATE_PRESSED); //Replace a specific style assigned to the main part when it is pressed
*
* Examples:
* @code
* lv_obj_replace_style(obj, &yellow_style, &blue_style, LV_PART_ANY | LV_STATE_ANY); //Replace a specific style
*
* lv_obj_replace_style(obj, &yellow_style, &blue_style, LV_PART_MAIN | LV_STATE_PRESSED); //Replace a specific style assigned to the main part when it is pressed
* @endcode
*/
bool lv_obj_replace_style(lv_obj_t * obj, const lv_style_t * old_style, const lv_style_t * new_style,
lv_style_selector_t selector);
@ -106,9 +75,15 @@ bool lv_obj_replace_style(lv_obj_t * obj, const lv_style_t * old_style, const lv
* @param obj pointer to an object
* @param style pointer to a style to remove. Can be NULL to check only the selector
* @param selector OR-ed values of states and a part to remove only styles with matching selectors. LV_STATE_ANY and LV_PART_ANY can be used
* @example lv_obj_remove_style(obj, &style, LV_PART_ANY | LV_STATE_ANY); //Remove a specific style
* @example lv_obj_remove_style(obj, NULL, LV_PART_MAIN | LV_STATE_ANY); //Remove all styles from the main part
* @example lv_obj_remove_style(obj, NULL, LV_PART_ANY | LV_STATE_ANY); //Remove all styles
*
* Examples:
* @code
* lv_obj_remove_style(obj, &style, LV_PART_ANY | LV_STATE_ANY); //Remove a specific style
*
* lv_obj_remove_style(obj, NULL, LV_PART_MAIN | LV_STATE_ANY); //Remove all styles from the main part
*
* lv_obj_remove_style(obj, NULL, LV_PART_ANY | LV_STATE_ANY); //Remove all styles
* @endcode
*/
void lv_obj_remove_style(lv_obj_t * obj, const lv_style_t * style, lv_style_selector_t selector);
@ -188,27 +163,7 @@ bool lv_obj_remove_local_style_prop(lv_obj_t * obj, lv_style_prop_t prop, lv_sty
/**
* Used internally for color filtering
*/
lv_style_value_t _lv_obj_style_apply_color_filter(const lv_obj_t * obj, uint32_t part, lv_style_value_t v);
/**
* Used internally to create a style transition
* @param obj
* @param part
* @param prev_state
* @param new_state
* @param tr
*/
void _lv_obj_style_create_transition(lv_obj_t * obj, lv_part_t part, lv_state_t prev_state,
lv_state_t new_state, const _lv_obj_style_transition_dsc_t * tr);
/**
* Used internally to compare the appearance of an object in 2 states
* @param obj
* @param state1
* @param state2
* @return
*/
_lv_style_state_cmp_t _lv_obj_style_state_compare(lv_obj_t * obj, lv_state_t state1, lv_state_t state2);
lv_style_value_t lv_obj_style_apply_color_filter(const lv_obj_t * obj, lv_part_t part, lv_style_value_t v);
/**
* Fade in an an object and all its children.
@ -298,7 +253,7 @@ static inline void lv_obj_set_style_transform_scale(lv_obj_t * obj, int32_t valu
lv_obj_set_style_transform_scale_y(obj, value, selector);
}
static inline int32_t lv_obj_get_style_space_left(const lv_obj_t * obj, uint32_t part)
static inline int32_t lv_obj_get_style_space_left(const lv_obj_t * obj, lv_part_t part)
{
int32_t padding = lv_obj_get_style_pad_left(obj, part);
int32_t border_width = lv_obj_get_style_border_width(obj, part);
@ -306,7 +261,7 @@ static inline int32_t lv_obj_get_style_space_left(const lv_obj_t * obj, uint32_t
return (border_side & LV_BORDER_SIDE_LEFT) ? padding + border_width : padding;
}
static inline int32_t lv_obj_get_style_space_right(const lv_obj_t * obj, uint32_t part)
static inline int32_t lv_obj_get_style_space_right(const lv_obj_t * obj, lv_part_t part)
{
int32_t padding = lv_obj_get_style_pad_right(obj, part);
int32_t border_width = lv_obj_get_style_border_width(obj, part);
@ -314,7 +269,7 @@ static inline int32_t lv_obj_get_style_space_right(const lv_obj_t * obj, uint32_
return (border_side & LV_BORDER_SIDE_RIGHT) ? padding + border_width : padding;
}
static inline int32_t lv_obj_get_style_space_top(const lv_obj_t * obj, uint32_t part)
static inline int32_t lv_obj_get_style_space_top(const lv_obj_t * obj, lv_part_t part)
{
int32_t padding = lv_obj_get_style_pad_top(obj, part);
int32_t border_width = lv_obj_get_style_border_width(obj, part);
@ -322,7 +277,7 @@ static inline int32_t lv_obj_get_style_space_top(const lv_obj_t * obj, uint32_t
return (border_side & LV_BORDER_SIDE_TOP) ? padding + border_width : padding;
}
static inline int32_t lv_obj_get_style_space_bottom(const lv_obj_t * obj, uint32_t part)
static inline int32_t lv_obj_get_style_space_bottom(const lv_obj_t * obj, lv_part_t part)
{
int32_t padding = lv_obj_get_style_pad_bottom(obj, part);
int32_t border_width = lv_obj_get_style_border_width(obj, part);
@ -332,16 +287,16 @@ static inline int32_t lv_obj_get_style_space_bottom(const lv_obj_t * obj, uint32
lv_text_align_t lv_obj_calculate_style_text_align(const lv_obj_t * obj, lv_part_t part, const char * txt);
static inline int32_t lv_obj_get_style_transform_scale_x_safe(const lv_obj_t * obj, uint32_t part)
static inline int32_t lv_obj_get_style_transform_scale_x_safe(const lv_obj_t * obj, lv_part_t part)
{
int16_t zoom = lv_obj_get_style_transform_scale_x(obj, part);
return zoom != 0 ? zoom : 1;
int32_t scale = lv_obj_get_style_transform_scale_x(obj, part);
return scale > 0 ? scale : 1;
}
static inline int32_t lv_obj_get_style_transform_scale_y_safe(const lv_obj_t * obj, uint32_t part)
static inline int32_t lv_obj_get_style_transform_scale_y_safe(const lv_obj_t * obj, lv_part_t part)
{
int16_t zoom = lv_obj_get_style_transform_scale_y(obj, part);
return zoom != 0 ? zoom : 1;
int32_t scale = lv_obj_get_style_transform_scale_y(obj, part);
return scale > 0 ? scale : 1;
}
/**
@ -352,13 +307,6 @@ static inline int32_t lv_obj_get_style_transform_scale_y_safe(const lv_obj_t * o
*/
lv_opa_t lv_obj_get_style_opa_recursive(const lv_obj_t * obj, lv_part_t part);
/**
* Update the layer type of a widget bayed on its current styles.
* The result will be stored in `obj->spec_attr->layer_type`
* @param obj the object whose layer should be updated
*/
void _lv_obj_update_layer_type(lv_obj_t * obj);
/**********************
* MACROS
**********************/

View File

@ -754,7 +754,7 @@ void lv_obj_set_style_base_dir(lv_obj_t * obj, lv_base_dir_t value, lv_style_sel
lv_obj_set_local_style_prop(obj, LV_STYLE_BASE_DIR, v, selector);
}
void lv_obj_set_style_bitmap_mask_src(lv_obj_t * obj, const lv_image_dsc_t * value, lv_style_selector_t selector)
void lv_obj_set_style_bitmap_mask_src(lv_obj_t * obj, const void * value, lv_style_selector_t selector)
{
lv_style_value_t v = {
.ptr = value

View File

@ -17,663 +17,670 @@ extern "C" {
#include "../misc/lv_area.h"
#include "../misc/lv_style.h"
#include "../core/lv_obj_style.h"
#include "../misc/lv_types.h"
static inline int32_t lv_obj_get_style_width(const lv_obj_t * obj, uint32_t part)
static inline int32_t lv_obj_get_style_width(const lv_obj_t * obj, lv_part_t part)
{
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_WIDTH);
return (int32_t)v.num;
}
static inline int32_t lv_obj_get_style_min_width(const lv_obj_t * obj, uint32_t part)
static inline int32_t lv_obj_get_style_min_width(const lv_obj_t * obj, lv_part_t part)
{
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_MIN_WIDTH);
return (int32_t)v.num;
}
static inline int32_t lv_obj_get_style_max_width(const lv_obj_t * obj, uint32_t part)
static inline int32_t lv_obj_get_style_max_width(const lv_obj_t * obj, lv_part_t part)
{
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_MAX_WIDTH);
return (int32_t)v.num;
}
static inline int32_t lv_obj_get_style_height(const lv_obj_t * obj, uint32_t part)
static inline int32_t lv_obj_get_style_height(const lv_obj_t * obj, lv_part_t part)
{
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_HEIGHT);
return (int32_t)v.num;
}
static inline int32_t lv_obj_get_style_min_height(const lv_obj_t * obj, uint32_t part)
static inline int32_t lv_obj_get_style_min_height(const lv_obj_t * obj, lv_part_t part)
{
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_MIN_HEIGHT);
return (int32_t)v.num;
}
static inline int32_t lv_obj_get_style_max_height(const lv_obj_t * obj, uint32_t part)
static inline int32_t lv_obj_get_style_max_height(const lv_obj_t * obj, lv_part_t part)
{
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_MAX_HEIGHT);
return (int32_t)v.num;
}
static inline int32_t lv_obj_get_style_length(const lv_obj_t * obj, uint32_t part)
static inline int32_t lv_obj_get_style_length(const lv_obj_t * obj, lv_part_t part)
{
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_LENGTH);
return (int32_t)v.num;
}
static inline int32_t lv_obj_get_style_x(const lv_obj_t * obj, uint32_t part)
static inline int32_t lv_obj_get_style_x(const lv_obj_t * obj, lv_part_t part)
{
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_X);
return (int32_t)v.num;
}
static inline int32_t lv_obj_get_style_y(const lv_obj_t * obj, uint32_t part)
static inline int32_t lv_obj_get_style_y(const lv_obj_t * obj, lv_part_t part)
{
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_Y);
return (int32_t)v.num;
}
static inline lv_align_t lv_obj_get_style_align(const lv_obj_t * obj, uint32_t part)
static inline lv_align_t lv_obj_get_style_align(const lv_obj_t * obj, lv_part_t part)
{
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_ALIGN);
return (lv_align_t)v.num;
}
static inline int32_t lv_obj_get_style_transform_width(const lv_obj_t * obj, uint32_t part)
static inline int32_t lv_obj_get_style_transform_width(const lv_obj_t * obj, lv_part_t part)
{
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_TRANSFORM_WIDTH);
return (int32_t)v.num;
}
static inline int32_t lv_obj_get_style_transform_height(const lv_obj_t * obj, uint32_t part)
static inline int32_t lv_obj_get_style_transform_height(const lv_obj_t * obj, lv_part_t part)
{
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_TRANSFORM_HEIGHT);
return (int32_t)v.num;
}
static inline int32_t lv_obj_get_style_translate_x(const lv_obj_t * obj, uint32_t part)
static inline int32_t lv_obj_get_style_translate_x(const lv_obj_t * obj, lv_part_t part)
{
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_TRANSLATE_X);
return (int32_t)v.num;
}
static inline int32_t lv_obj_get_style_translate_y(const lv_obj_t * obj, uint32_t part)
static inline int32_t lv_obj_get_style_translate_y(const lv_obj_t * obj, lv_part_t part)
{
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_TRANSLATE_Y);
return (int32_t)v.num;
}
static inline int32_t lv_obj_get_style_transform_scale_x(const lv_obj_t * obj, uint32_t part)
static inline int32_t lv_obj_get_style_transform_scale_x(const lv_obj_t * obj, lv_part_t part)
{
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_TRANSFORM_SCALE_X);
return (int32_t)v.num;
}
static inline int32_t lv_obj_get_style_transform_scale_y(const lv_obj_t * obj, uint32_t part)
static inline int32_t lv_obj_get_style_transform_scale_y(const lv_obj_t * obj, lv_part_t part)
{
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_TRANSFORM_SCALE_Y);
return (int32_t)v.num;
}
static inline int32_t lv_obj_get_style_transform_rotation(const lv_obj_t * obj, uint32_t part)
static inline int32_t lv_obj_get_style_transform_rotation(const lv_obj_t * obj, lv_part_t part)
{
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_TRANSFORM_ROTATION);
return (int32_t)v.num;
}
static inline int32_t lv_obj_get_style_transform_pivot_x(const lv_obj_t * obj, uint32_t part)
static inline int32_t lv_obj_get_style_transform_pivot_x(const lv_obj_t * obj, lv_part_t part)
{
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_TRANSFORM_PIVOT_X);
return (int32_t)v.num;
}
static inline int32_t lv_obj_get_style_transform_pivot_y(const lv_obj_t * obj, uint32_t part)
static inline int32_t lv_obj_get_style_transform_pivot_y(const lv_obj_t * obj, lv_part_t part)
{
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_TRANSFORM_PIVOT_Y);
return (int32_t)v.num;
}
static inline int32_t lv_obj_get_style_transform_skew_x(const lv_obj_t * obj, uint32_t part)
static inline int32_t lv_obj_get_style_transform_skew_x(const lv_obj_t * obj, lv_part_t part)
{
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_TRANSFORM_SKEW_X);
return (int32_t)v.num;
}
static inline int32_t lv_obj_get_style_transform_skew_y(const lv_obj_t * obj, uint32_t part)
static inline int32_t lv_obj_get_style_transform_skew_y(const lv_obj_t * obj, lv_part_t part)
{
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_TRANSFORM_SKEW_Y);
return (int32_t)v.num;
}
static inline int32_t lv_obj_get_style_pad_top(const lv_obj_t * obj, uint32_t part)
static inline int32_t lv_obj_get_style_pad_top(const lv_obj_t * obj, lv_part_t part)
{
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_PAD_TOP);
return (int32_t)v.num;
}
static inline int32_t lv_obj_get_style_pad_bottom(const lv_obj_t * obj, uint32_t part)
static inline int32_t lv_obj_get_style_pad_bottom(const lv_obj_t * obj, lv_part_t part)
{
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_PAD_BOTTOM);
return (int32_t)v.num;
}
static inline int32_t lv_obj_get_style_pad_left(const lv_obj_t * obj, uint32_t part)
static inline int32_t lv_obj_get_style_pad_left(const lv_obj_t * obj, lv_part_t part)
{
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_PAD_LEFT);
return (int32_t)v.num;
}
static inline int32_t lv_obj_get_style_pad_right(const lv_obj_t * obj, uint32_t part)
static inline int32_t lv_obj_get_style_pad_right(const lv_obj_t * obj, lv_part_t part)
{
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_PAD_RIGHT);
return (int32_t)v.num;
}
static inline int32_t lv_obj_get_style_pad_row(const lv_obj_t * obj, uint32_t part)
static inline int32_t lv_obj_get_style_pad_row(const lv_obj_t * obj, lv_part_t part)
{
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_PAD_ROW);
return (int32_t)v.num;
}
static inline int32_t lv_obj_get_style_pad_column(const lv_obj_t * obj, uint32_t part)
static inline int32_t lv_obj_get_style_pad_column(const lv_obj_t * obj, lv_part_t part)
{
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_PAD_COLUMN);
return (int32_t)v.num;
}
static inline int32_t lv_obj_get_style_margin_top(const lv_obj_t * obj, uint32_t part)
static inline int32_t lv_obj_get_style_margin_top(const lv_obj_t * obj, lv_part_t part)
{
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_MARGIN_TOP);
return (int32_t)v.num;
}
static inline int32_t lv_obj_get_style_margin_bottom(const lv_obj_t * obj, uint32_t part)
static inline int32_t lv_obj_get_style_margin_bottom(const lv_obj_t * obj, lv_part_t part)
{
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_MARGIN_BOTTOM);
return (int32_t)v.num;
}
static inline int32_t lv_obj_get_style_margin_left(const lv_obj_t * obj, uint32_t part)
static inline int32_t lv_obj_get_style_margin_left(const lv_obj_t * obj, lv_part_t part)
{
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_MARGIN_LEFT);
return (int32_t)v.num;
}
static inline int32_t lv_obj_get_style_margin_right(const lv_obj_t * obj, uint32_t part)
static inline int32_t lv_obj_get_style_margin_right(const lv_obj_t * obj, lv_part_t part)
{
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_MARGIN_RIGHT);
return (int32_t)v.num;
}
static inline lv_color_t lv_obj_get_style_bg_color(const lv_obj_t * obj, uint32_t part)
static inline lv_color_t lv_obj_get_style_bg_color(const lv_obj_t * obj, lv_part_t part)
{
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_BG_COLOR);
return v.color;
}
static inline lv_color_t lv_obj_get_style_bg_color_filtered(const lv_obj_t * obj, uint32_t part)
static inline lv_color_t lv_obj_get_style_bg_color_filtered(const lv_obj_t * obj, lv_part_t part)
{
lv_style_value_t v = _lv_obj_style_apply_color_filter(obj, part, lv_obj_get_style_prop(obj, part, LV_STYLE_BG_COLOR));
lv_style_value_t v = lv_obj_style_apply_color_filter(obj, part, lv_obj_get_style_prop(obj, part, LV_STYLE_BG_COLOR));
return v.color;
}
static inline lv_opa_t lv_obj_get_style_bg_opa(const lv_obj_t * obj, uint32_t part)
static inline lv_opa_t lv_obj_get_style_bg_opa(const lv_obj_t * obj, lv_part_t part)
{
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_BG_OPA);
return (lv_opa_t)v.num;
}
static inline lv_color_t lv_obj_get_style_bg_grad_color(const lv_obj_t * obj, uint32_t part)
static inline lv_color_t lv_obj_get_style_bg_grad_color(const lv_obj_t * obj, lv_part_t part)
{
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_BG_GRAD_COLOR);
return v.color;
}
static inline lv_color_t lv_obj_get_style_bg_grad_color_filtered(const lv_obj_t * obj, uint32_t part)
static inline lv_color_t lv_obj_get_style_bg_grad_color_filtered(const lv_obj_t * obj, lv_part_t part)
{
lv_style_value_t v = _lv_obj_style_apply_color_filter(obj, part, lv_obj_get_style_prop(obj, part, LV_STYLE_BG_GRAD_COLOR));
lv_style_value_t v = lv_obj_style_apply_color_filter(obj, part, lv_obj_get_style_prop(obj, part,
LV_STYLE_BG_GRAD_COLOR));
return v.color;
}
static inline lv_grad_dir_t lv_obj_get_style_bg_grad_dir(const lv_obj_t * obj, uint32_t part)
static inline lv_grad_dir_t lv_obj_get_style_bg_grad_dir(const lv_obj_t * obj, lv_part_t part)
{
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_BG_GRAD_DIR);
return (lv_grad_dir_t)v.num;
}
static inline int32_t lv_obj_get_style_bg_main_stop(const lv_obj_t * obj, uint32_t part)
static inline int32_t lv_obj_get_style_bg_main_stop(const lv_obj_t * obj, lv_part_t part)
{
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_BG_MAIN_STOP);
return (int32_t)v.num;
}
static inline int32_t lv_obj_get_style_bg_grad_stop(const lv_obj_t * obj, uint32_t part)
static inline int32_t lv_obj_get_style_bg_grad_stop(const lv_obj_t * obj, lv_part_t part)
{
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_BG_GRAD_STOP);
return (int32_t)v.num;
}
static inline lv_opa_t lv_obj_get_style_bg_main_opa(const lv_obj_t * obj, uint32_t part)
static inline lv_opa_t lv_obj_get_style_bg_main_opa(const lv_obj_t * obj, lv_part_t part)
{
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_BG_MAIN_OPA);
return (lv_opa_t)v.num;
}
static inline lv_opa_t lv_obj_get_style_bg_grad_opa(const lv_obj_t * obj, uint32_t part)
static inline lv_opa_t lv_obj_get_style_bg_grad_opa(const lv_obj_t * obj, lv_part_t part)
{
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_BG_GRAD_OPA);
return (lv_opa_t)v.num;
}
static inline const lv_grad_dsc_t * lv_obj_get_style_bg_grad(const lv_obj_t * obj, uint32_t part)
static inline const lv_grad_dsc_t * lv_obj_get_style_bg_grad(const lv_obj_t * obj, lv_part_t part)
{
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_BG_GRAD);
return (const lv_grad_dsc_t *)v.ptr;
}
static inline const void * lv_obj_get_style_bg_image_src(const lv_obj_t * obj, uint32_t part)
static inline const void * lv_obj_get_style_bg_image_src(const lv_obj_t * obj, lv_part_t part)
{
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_BG_IMAGE_SRC);
return (const void *)v.ptr;
}
static inline lv_opa_t lv_obj_get_style_bg_image_opa(const lv_obj_t * obj, uint32_t part)
static inline lv_opa_t lv_obj_get_style_bg_image_opa(const lv_obj_t * obj, lv_part_t part)
{
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_BG_IMAGE_OPA);
return (lv_opa_t)v.num;
}
static inline lv_color_t lv_obj_get_style_bg_image_recolor(const lv_obj_t * obj, uint32_t part)
static inline lv_color_t lv_obj_get_style_bg_image_recolor(const lv_obj_t * obj, lv_part_t part)
{
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_BG_IMAGE_RECOLOR);
return v.color;
}
static inline lv_color_t lv_obj_get_style_bg_image_recolor_filtered(const lv_obj_t * obj, uint32_t part)
static inline lv_color_t lv_obj_get_style_bg_image_recolor_filtered(const lv_obj_t * obj, lv_part_t part)
{
lv_style_value_t v = _lv_obj_style_apply_color_filter(obj, part, lv_obj_get_style_prop(obj, part, LV_STYLE_BG_IMAGE_RECOLOR));
lv_style_value_t v = lv_obj_style_apply_color_filter(obj, part, lv_obj_get_style_prop(obj, part,
LV_STYLE_BG_IMAGE_RECOLOR));
return v.color;
}
static inline lv_opa_t lv_obj_get_style_bg_image_recolor_opa(const lv_obj_t * obj, uint32_t part)
static inline lv_opa_t lv_obj_get_style_bg_image_recolor_opa(const lv_obj_t * obj, lv_part_t part)
{
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_BG_IMAGE_RECOLOR_OPA);
return (lv_opa_t)v.num;
}
static inline bool lv_obj_get_style_bg_image_tiled(const lv_obj_t * obj, uint32_t part)
static inline bool lv_obj_get_style_bg_image_tiled(const lv_obj_t * obj, lv_part_t part)
{
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_BG_IMAGE_TILED);
return (bool)v.num;
}
static inline lv_color_t lv_obj_get_style_border_color(const lv_obj_t * obj, uint32_t part)
static inline lv_color_t lv_obj_get_style_border_color(const lv_obj_t * obj, lv_part_t part)
{
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_BORDER_COLOR);
return v.color;
}
static inline lv_color_t lv_obj_get_style_border_color_filtered(const lv_obj_t * obj, uint32_t part)
static inline lv_color_t lv_obj_get_style_border_color_filtered(const lv_obj_t * obj, lv_part_t part)
{
lv_style_value_t v = _lv_obj_style_apply_color_filter(obj, part, lv_obj_get_style_prop(obj, part, LV_STYLE_BORDER_COLOR));
lv_style_value_t v = lv_obj_style_apply_color_filter(obj, part, lv_obj_get_style_prop(obj, part,
LV_STYLE_BORDER_COLOR));
return v.color;
}
static inline lv_opa_t lv_obj_get_style_border_opa(const lv_obj_t * obj, uint32_t part)
static inline lv_opa_t lv_obj_get_style_border_opa(const lv_obj_t * obj, lv_part_t part)
{
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_BORDER_OPA);
return (lv_opa_t)v.num;
}
static inline int32_t lv_obj_get_style_border_width(const lv_obj_t * obj, uint32_t part)
static inline int32_t lv_obj_get_style_border_width(const lv_obj_t * obj, lv_part_t part)
{
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_BORDER_WIDTH);
return (int32_t)v.num;
}
static inline lv_border_side_t lv_obj_get_style_border_side(const lv_obj_t * obj, uint32_t part)
static inline lv_border_side_t lv_obj_get_style_border_side(const lv_obj_t * obj, lv_part_t part)
{
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_BORDER_SIDE);
return (lv_border_side_t)v.num;
}
static inline bool lv_obj_get_style_border_post(const lv_obj_t * obj, uint32_t part)
static inline bool lv_obj_get_style_border_post(const lv_obj_t * obj, lv_part_t part)
{
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_BORDER_POST);
return (bool)v.num;
}
static inline int32_t lv_obj_get_style_outline_width(const lv_obj_t * obj, uint32_t part)
static inline int32_t lv_obj_get_style_outline_width(const lv_obj_t * obj, lv_part_t part)
{
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_OUTLINE_WIDTH);
return (int32_t)v.num;
}
static inline lv_color_t lv_obj_get_style_outline_color(const lv_obj_t * obj, uint32_t part)
static inline lv_color_t lv_obj_get_style_outline_color(const lv_obj_t * obj, lv_part_t part)
{
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_OUTLINE_COLOR);
return v.color;
}
static inline lv_color_t lv_obj_get_style_outline_color_filtered(const lv_obj_t * obj, uint32_t part)
static inline lv_color_t lv_obj_get_style_outline_color_filtered(const lv_obj_t * obj, lv_part_t part)
{
lv_style_value_t v = _lv_obj_style_apply_color_filter(obj, part, lv_obj_get_style_prop(obj, part, LV_STYLE_OUTLINE_COLOR));
lv_style_value_t v = lv_obj_style_apply_color_filter(obj, part, lv_obj_get_style_prop(obj, part,
LV_STYLE_OUTLINE_COLOR));
return v.color;
}
static inline lv_opa_t lv_obj_get_style_outline_opa(const lv_obj_t * obj, uint32_t part)
static inline lv_opa_t lv_obj_get_style_outline_opa(const lv_obj_t * obj, lv_part_t part)
{
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_OUTLINE_OPA);
return (lv_opa_t)v.num;
}
static inline int32_t lv_obj_get_style_outline_pad(const lv_obj_t * obj, uint32_t part)
static inline int32_t lv_obj_get_style_outline_pad(const lv_obj_t * obj, lv_part_t part)
{
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_OUTLINE_PAD);
return (int32_t)v.num;
}
static inline int32_t lv_obj_get_style_shadow_width(const lv_obj_t * obj, uint32_t part)
static inline int32_t lv_obj_get_style_shadow_width(const lv_obj_t * obj, lv_part_t part)
{
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_SHADOW_WIDTH);
return (int32_t)v.num;
}
static inline int32_t lv_obj_get_style_shadow_offset_x(const lv_obj_t * obj, uint32_t part)
static inline int32_t lv_obj_get_style_shadow_offset_x(const lv_obj_t * obj, lv_part_t part)
{
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_SHADOW_OFFSET_X);
return (int32_t)v.num;
}
static inline int32_t lv_obj_get_style_shadow_offset_y(const lv_obj_t * obj, uint32_t part)
static inline int32_t lv_obj_get_style_shadow_offset_y(const lv_obj_t * obj, lv_part_t part)
{
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_SHADOW_OFFSET_Y);
return (int32_t)v.num;
}
static inline int32_t lv_obj_get_style_shadow_spread(const lv_obj_t * obj, uint32_t part)
static inline int32_t lv_obj_get_style_shadow_spread(const lv_obj_t * obj, lv_part_t part)
{
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_SHADOW_SPREAD);
return (int32_t)v.num;
}
static inline lv_color_t lv_obj_get_style_shadow_color(const lv_obj_t * obj, uint32_t part)
static inline lv_color_t lv_obj_get_style_shadow_color(const lv_obj_t * obj, lv_part_t part)
{
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_SHADOW_COLOR);
return v.color;
}
static inline lv_color_t lv_obj_get_style_shadow_color_filtered(const lv_obj_t * obj, uint32_t part)
static inline lv_color_t lv_obj_get_style_shadow_color_filtered(const lv_obj_t * obj, lv_part_t part)
{
lv_style_value_t v = _lv_obj_style_apply_color_filter(obj, part, lv_obj_get_style_prop(obj, part, LV_STYLE_SHADOW_COLOR));
lv_style_value_t v = lv_obj_style_apply_color_filter(obj, part, lv_obj_get_style_prop(obj, part,
LV_STYLE_SHADOW_COLOR));
return v.color;
}
static inline lv_opa_t lv_obj_get_style_shadow_opa(const lv_obj_t * obj, uint32_t part)
static inline lv_opa_t lv_obj_get_style_shadow_opa(const lv_obj_t * obj, lv_part_t part)
{
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_SHADOW_OPA);
return (lv_opa_t)v.num;
}
static inline lv_opa_t lv_obj_get_style_image_opa(const lv_obj_t * obj, uint32_t part)
static inline lv_opa_t lv_obj_get_style_image_opa(const lv_obj_t * obj, lv_part_t part)
{
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_IMAGE_OPA);
return (lv_opa_t)v.num;
}
static inline lv_color_t lv_obj_get_style_image_recolor(const lv_obj_t * obj, uint32_t part)
static inline lv_color_t lv_obj_get_style_image_recolor(const lv_obj_t * obj, lv_part_t part)
{
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_IMAGE_RECOLOR);
return v.color;
}
static inline lv_color_t lv_obj_get_style_image_recolor_filtered(const lv_obj_t * obj, uint32_t part)
static inline lv_color_t lv_obj_get_style_image_recolor_filtered(const lv_obj_t * obj, lv_part_t part)
{
lv_style_value_t v = _lv_obj_style_apply_color_filter(obj, part, lv_obj_get_style_prop(obj, part, LV_STYLE_IMAGE_RECOLOR));
lv_style_value_t v = lv_obj_style_apply_color_filter(obj, part, lv_obj_get_style_prop(obj, part,
LV_STYLE_IMAGE_RECOLOR));
return v.color;
}
static inline lv_opa_t lv_obj_get_style_image_recolor_opa(const lv_obj_t * obj, uint32_t part)
static inline lv_opa_t lv_obj_get_style_image_recolor_opa(const lv_obj_t * obj, lv_part_t part)
{
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_IMAGE_RECOLOR_OPA);
return (lv_opa_t)v.num;
}
static inline int32_t lv_obj_get_style_line_width(const lv_obj_t * obj, uint32_t part)
static inline int32_t lv_obj_get_style_line_width(const lv_obj_t * obj, lv_part_t part)
{
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_LINE_WIDTH);
return (int32_t)v.num;
}
static inline int32_t lv_obj_get_style_line_dash_width(const lv_obj_t * obj, uint32_t part)
static inline int32_t lv_obj_get_style_line_dash_width(const lv_obj_t * obj, lv_part_t part)
{
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_LINE_DASH_WIDTH);
return (int32_t)v.num;
}
static inline int32_t lv_obj_get_style_line_dash_gap(const lv_obj_t * obj, uint32_t part)
static inline int32_t lv_obj_get_style_line_dash_gap(const lv_obj_t * obj, lv_part_t part)
{
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_LINE_DASH_GAP);
return (int32_t)v.num;
}
static inline bool lv_obj_get_style_line_rounded(const lv_obj_t * obj, uint32_t part)
static inline bool lv_obj_get_style_line_rounded(const lv_obj_t * obj, lv_part_t part)
{
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_LINE_ROUNDED);
return (bool)v.num;
}
static inline lv_color_t lv_obj_get_style_line_color(const lv_obj_t * obj, uint32_t part)
static inline lv_color_t lv_obj_get_style_line_color(const lv_obj_t * obj, lv_part_t part)
{
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_LINE_COLOR);
return v.color;
}
static inline lv_color_t lv_obj_get_style_line_color_filtered(const lv_obj_t * obj, uint32_t part)
static inline lv_color_t lv_obj_get_style_line_color_filtered(const lv_obj_t * obj, lv_part_t part)
{
lv_style_value_t v = _lv_obj_style_apply_color_filter(obj, part, lv_obj_get_style_prop(obj, part, LV_STYLE_LINE_COLOR));
lv_style_value_t v = lv_obj_style_apply_color_filter(obj, part, lv_obj_get_style_prop(obj, part, LV_STYLE_LINE_COLOR));
return v.color;
}
static inline lv_opa_t lv_obj_get_style_line_opa(const lv_obj_t * obj, uint32_t part)
static inline lv_opa_t lv_obj_get_style_line_opa(const lv_obj_t * obj, lv_part_t part)
{
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_LINE_OPA);
return (lv_opa_t)v.num;
}
static inline int32_t lv_obj_get_style_arc_width(const lv_obj_t * obj, uint32_t part)
static inline int32_t lv_obj_get_style_arc_width(const lv_obj_t * obj, lv_part_t part)
{
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_ARC_WIDTH);
return (int32_t)v.num;
}
static inline bool lv_obj_get_style_arc_rounded(const lv_obj_t * obj, uint32_t part)
static inline bool lv_obj_get_style_arc_rounded(const lv_obj_t * obj, lv_part_t part)
{
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_ARC_ROUNDED);
return (bool)v.num;
}
static inline lv_color_t lv_obj_get_style_arc_color(const lv_obj_t * obj, uint32_t part)
static inline lv_color_t lv_obj_get_style_arc_color(const lv_obj_t * obj, lv_part_t part)
{
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_ARC_COLOR);
return v.color;
}
static inline lv_color_t lv_obj_get_style_arc_color_filtered(const lv_obj_t * obj, uint32_t part)
static inline lv_color_t lv_obj_get_style_arc_color_filtered(const lv_obj_t * obj, lv_part_t part)
{
lv_style_value_t v = _lv_obj_style_apply_color_filter(obj, part, lv_obj_get_style_prop(obj, part, LV_STYLE_ARC_COLOR));
lv_style_value_t v = lv_obj_style_apply_color_filter(obj, part, lv_obj_get_style_prop(obj, part, LV_STYLE_ARC_COLOR));
return v.color;
}
static inline lv_opa_t lv_obj_get_style_arc_opa(const lv_obj_t * obj, uint32_t part)
static inline lv_opa_t lv_obj_get_style_arc_opa(const lv_obj_t * obj, lv_part_t part)
{
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_ARC_OPA);
return (lv_opa_t)v.num;
}
static inline const void * lv_obj_get_style_arc_image_src(const lv_obj_t * obj, uint32_t part)
static inline const void * lv_obj_get_style_arc_image_src(const lv_obj_t * obj, lv_part_t part)
{
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_ARC_IMAGE_SRC);
return (const void *)v.ptr;
}
static inline lv_color_t lv_obj_get_style_text_color(const lv_obj_t * obj, uint32_t part)
static inline lv_color_t lv_obj_get_style_text_color(const lv_obj_t * obj, lv_part_t part)
{
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_TEXT_COLOR);
return v.color;
}
static inline lv_color_t lv_obj_get_style_text_color_filtered(const lv_obj_t * obj, uint32_t part)
static inline lv_color_t lv_obj_get_style_text_color_filtered(const lv_obj_t * obj, lv_part_t part)
{
lv_style_value_t v = _lv_obj_style_apply_color_filter(obj, part, lv_obj_get_style_prop(obj, part, LV_STYLE_TEXT_COLOR));
lv_style_value_t v = lv_obj_style_apply_color_filter(obj, part, lv_obj_get_style_prop(obj, part, LV_STYLE_TEXT_COLOR));
return v.color;
}
static inline lv_opa_t lv_obj_get_style_text_opa(const lv_obj_t * obj, uint32_t part)
static inline lv_opa_t lv_obj_get_style_text_opa(const lv_obj_t * obj, lv_part_t part)
{
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_TEXT_OPA);
return (lv_opa_t)v.num;
}
static inline const lv_font_t * lv_obj_get_style_text_font(const lv_obj_t * obj, uint32_t part)
static inline const lv_font_t * lv_obj_get_style_text_font(const lv_obj_t * obj, lv_part_t part)
{
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_TEXT_FONT);
return (const lv_font_t *)v.ptr;
}
static inline int32_t lv_obj_get_style_text_letter_space(const lv_obj_t * obj, uint32_t part)
static inline int32_t lv_obj_get_style_text_letter_space(const lv_obj_t * obj, lv_part_t part)
{
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_TEXT_LETTER_SPACE);
return (int32_t)v.num;
}
static inline int32_t lv_obj_get_style_text_line_space(const lv_obj_t * obj, uint32_t part)
static inline int32_t lv_obj_get_style_text_line_space(const lv_obj_t * obj, lv_part_t part)
{
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_TEXT_LINE_SPACE);
return (int32_t)v.num;
}
static inline lv_text_decor_t lv_obj_get_style_text_decor(const lv_obj_t * obj, uint32_t part)
static inline lv_text_decor_t lv_obj_get_style_text_decor(const lv_obj_t * obj, lv_part_t part)
{
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_TEXT_DECOR);
return (lv_text_decor_t)v.num;
}
static inline lv_text_align_t lv_obj_get_style_text_align(const lv_obj_t * obj, uint32_t part)
static inline lv_text_align_t lv_obj_get_style_text_align(const lv_obj_t * obj, lv_part_t part)
{
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_TEXT_ALIGN);
return (lv_text_align_t)v.num;
}
static inline int32_t lv_obj_get_style_radius(const lv_obj_t * obj, uint32_t part)
static inline int32_t lv_obj_get_style_radius(const lv_obj_t * obj, lv_part_t part)
{
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_RADIUS);
return (int32_t)v.num;
}
static inline bool lv_obj_get_style_clip_corner(const lv_obj_t * obj, uint32_t part)
static inline bool lv_obj_get_style_clip_corner(const lv_obj_t * obj, lv_part_t part)
{
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_CLIP_CORNER);
return (bool)v.num;
}
static inline lv_opa_t lv_obj_get_style_opa(const lv_obj_t * obj, uint32_t part)
static inline lv_opa_t lv_obj_get_style_opa(const lv_obj_t * obj, lv_part_t part)
{
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_OPA);
return (lv_opa_t)v.num;
}
static inline lv_opa_t lv_obj_get_style_opa_layered(const lv_obj_t * obj, uint32_t part)
static inline lv_opa_t lv_obj_get_style_opa_layered(const lv_obj_t * obj, lv_part_t part)
{
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_OPA_LAYERED);
return (lv_opa_t)v.num;
}
static inline const lv_color_filter_dsc_t * lv_obj_get_style_color_filter_dsc(const lv_obj_t * obj, uint32_t part)
static inline const lv_color_filter_dsc_t * lv_obj_get_style_color_filter_dsc(const lv_obj_t * obj, lv_part_t part)
{
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_COLOR_FILTER_DSC);
return (const lv_color_filter_dsc_t *)v.ptr;
}
static inline lv_opa_t lv_obj_get_style_color_filter_opa(const lv_obj_t * obj, uint32_t part)
static inline lv_opa_t lv_obj_get_style_color_filter_opa(const lv_obj_t * obj, lv_part_t part)
{
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_COLOR_FILTER_OPA);
return (lv_opa_t)v.num;
}
static inline const lv_anim_t * lv_obj_get_style_anim(const lv_obj_t * obj, uint32_t part)
static inline const lv_anim_t * lv_obj_get_style_anim(const lv_obj_t * obj, lv_part_t part)
{
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_ANIM);
return (const lv_anim_t *)v.ptr;
}
static inline uint32_t lv_obj_get_style_anim_duration(const lv_obj_t * obj, uint32_t part)
static inline uint32_t lv_obj_get_style_anim_duration(const lv_obj_t * obj, lv_part_t part)
{
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_ANIM_DURATION);
return (uint32_t)v.num;
}
static inline const lv_style_transition_dsc_t * lv_obj_get_style_transition(const lv_obj_t * obj, uint32_t part)
static inline const lv_style_transition_dsc_t * lv_obj_get_style_transition(const lv_obj_t * obj, lv_part_t part)
{
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_TRANSITION);
return (const lv_style_transition_dsc_t *)v.ptr;
}
static inline lv_blend_mode_t lv_obj_get_style_blend_mode(const lv_obj_t * obj, uint32_t part)
static inline lv_blend_mode_t lv_obj_get_style_blend_mode(const lv_obj_t * obj, lv_part_t part)
{
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_BLEND_MODE);
return (lv_blend_mode_t)v.num;
}
static inline uint16_t lv_obj_get_style_layout(const lv_obj_t * obj, uint32_t part)
static inline uint16_t lv_obj_get_style_layout(const lv_obj_t * obj, lv_part_t part)
{
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_LAYOUT);
return (uint16_t)v.num;
}
static inline lv_base_dir_t lv_obj_get_style_base_dir(const lv_obj_t * obj, uint32_t part)
static inline lv_base_dir_t lv_obj_get_style_base_dir(const lv_obj_t * obj, lv_part_t part)
{
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_BASE_DIR);
return (lv_base_dir_t)v.num;
}
static inline const lv_image_dsc_t * lv_obj_get_style_bitmap_mask_src(const lv_obj_t * obj, uint32_t part)
static inline const void * lv_obj_get_style_bitmap_mask_src(const lv_obj_t * obj, lv_part_t part)
{
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_BITMAP_MASK_SRC);
return (const lv_image_dsc_t *)v.ptr;
return (const void *)v.ptr;
}
static inline uint32_t lv_obj_get_style_rotary_sensitivity(const lv_obj_t * obj, uint32_t part)
static inline uint32_t lv_obj_get_style_rotary_sensitivity(const lv_obj_t * obj, lv_part_t part)
{
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_ROTARY_SENSITIVITY);
return (uint32_t)v.num;
}
#if LV_USE_FLEX
static inline lv_flex_flow_t lv_obj_get_style_flex_flow(const lv_obj_t * obj, uint32_t part)
static inline lv_flex_flow_t lv_obj_get_style_flex_flow(const lv_obj_t * obj, lv_part_t part)
{
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_FLEX_FLOW);
return (lv_flex_flow_t)v.num;
}
static inline lv_flex_align_t lv_obj_get_style_flex_main_place(const lv_obj_t * obj, uint32_t part)
static inline lv_flex_align_t lv_obj_get_style_flex_main_place(const lv_obj_t * obj, lv_part_t part)
{
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_FLEX_MAIN_PLACE);
return (lv_flex_align_t)v.num;
}
static inline lv_flex_align_t lv_obj_get_style_flex_cross_place(const lv_obj_t * obj, uint32_t part)
static inline lv_flex_align_t lv_obj_get_style_flex_cross_place(const lv_obj_t * obj, lv_part_t part)
{
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_FLEX_CROSS_PLACE);
return (lv_flex_align_t)v.num;
}
static inline lv_flex_align_t lv_obj_get_style_flex_track_place(const lv_obj_t * obj, uint32_t part)
static inline lv_flex_align_t lv_obj_get_style_flex_track_place(const lv_obj_t * obj, lv_part_t part)
{
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_FLEX_TRACK_PLACE);
return (lv_flex_align_t)v.num;
}
static inline uint8_t lv_obj_get_style_flex_grow(const lv_obj_t * obj, uint32_t part)
static inline uint8_t lv_obj_get_style_flex_grow(const lv_obj_t * obj, lv_part_t part)
{
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_FLEX_GROW);
return (uint8_t)v.num;
@ -682,61 +689,61 @@ static inline uint8_t lv_obj_get_style_flex_grow(const lv_obj_t * obj, uint32_t
#endif /*LV_USE_FLEX*/
#if LV_USE_GRID
static inline const int32_t * lv_obj_get_style_grid_column_dsc_array(const lv_obj_t * obj, uint32_t part)
static inline const int32_t * lv_obj_get_style_grid_column_dsc_array(const lv_obj_t * obj, lv_part_t part)
{
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_GRID_COLUMN_DSC_ARRAY);
return (const int32_t *)v.ptr;
}
static inline lv_grid_align_t lv_obj_get_style_grid_column_align(const lv_obj_t * obj, uint32_t part)
static inline lv_grid_align_t lv_obj_get_style_grid_column_align(const lv_obj_t * obj, lv_part_t part)
{
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_GRID_COLUMN_ALIGN);
return (lv_grid_align_t)v.num;
}
static inline const int32_t * lv_obj_get_style_grid_row_dsc_array(const lv_obj_t * obj, uint32_t part)
static inline const int32_t * lv_obj_get_style_grid_row_dsc_array(const lv_obj_t * obj, lv_part_t part)
{
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_GRID_ROW_DSC_ARRAY);
return (const int32_t *)v.ptr;
}
static inline lv_grid_align_t lv_obj_get_style_grid_row_align(const lv_obj_t * obj, uint32_t part)
static inline lv_grid_align_t lv_obj_get_style_grid_row_align(const lv_obj_t * obj, lv_part_t part)
{
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_GRID_ROW_ALIGN);
return (lv_grid_align_t)v.num;
}
static inline int32_t lv_obj_get_style_grid_cell_column_pos(const lv_obj_t * obj, uint32_t part)
static inline int32_t lv_obj_get_style_grid_cell_column_pos(const lv_obj_t * obj, lv_part_t part)
{
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_GRID_CELL_COLUMN_POS);
return (int32_t)v.num;
}
static inline lv_grid_align_t lv_obj_get_style_grid_cell_x_align(const lv_obj_t * obj, uint32_t part)
static inline lv_grid_align_t lv_obj_get_style_grid_cell_x_align(const lv_obj_t * obj, lv_part_t part)
{
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_GRID_CELL_X_ALIGN);
return (lv_grid_align_t)v.num;
}
static inline int32_t lv_obj_get_style_grid_cell_column_span(const lv_obj_t * obj, uint32_t part)
static inline int32_t lv_obj_get_style_grid_cell_column_span(const lv_obj_t * obj, lv_part_t part)
{
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_GRID_CELL_COLUMN_SPAN);
return (int32_t)v.num;
}
static inline int32_t lv_obj_get_style_grid_cell_row_pos(const lv_obj_t * obj, uint32_t part)
static inline int32_t lv_obj_get_style_grid_cell_row_pos(const lv_obj_t * obj, lv_part_t part)
{
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_GRID_CELL_ROW_POS);
return (int32_t)v.num;
}
static inline lv_grid_align_t lv_obj_get_style_grid_cell_y_align(const lv_obj_t * obj, uint32_t part)
static inline lv_grid_align_t lv_obj_get_style_grid_cell_y_align(const lv_obj_t * obj, lv_part_t part)
{
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_GRID_CELL_Y_ALIGN);
return (lv_grid_align_t)v.num;
}
static inline int32_t lv_obj_get_style_grid_cell_row_span(const lv_obj_t * obj, uint32_t part)
static inline int32_t lv_obj_get_style_grid_cell_row_span(const lv_obj_t * obj, lv_part_t part)
{
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_GRID_CELL_ROW_SPAN);
return (int32_t)v.num;
@ -837,7 +844,7 @@ void lv_obj_set_style_transition(lv_obj_t * obj, const lv_style_transition_dsc_t
void lv_obj_set_style_blend_mode(lv_obj_t * obj, lv_blend_mode_t value, lv_style_selector_t selector);
void lv_obj_set_style_layout(lv_obj_t * obj, uint16_t value, lv_style_selector_t selector);
void lv_obj_set_style_base_dir(lv_obj_t * obj, lv_base_dir_t value, lv_style_selector_t selector);
void lv_obj_set_style_bitmap_mask_src(lv_obj_t * obj, const lv_image_dsc_t * value, lv_style_selector_t selector);
void lv_obj_set_style_bitmap_mask_src(lv_obj_t * obj, const void * value, lv_style_selector_t selector);
void lv_obj_set_style_rotary_sensitivity(lv_obj_t * obj, uint32_t value, lv_style_selector_t selector);
#if LV_USE_FLEX
void lv_obj_set_style_flex_flow(lv_obj_t * obj, lv_flex_flow_t value, lv_style_selector_t selector);

View File

@ -0,0 +1,95 @@
/**
* @file lv_obj_style_private.h
*
*/
#ifndef LV_OBJ_STYLE_PRIVATE_H
#define LV_OBJ_STYLE_PRIVATE_H
#ifdef __cplusplus
extern "C" {
#endif
/*********************
* INCLUDES
*********************/
#include "lv_obj_style.h"
/*********************
* DEFINES
*********************/
/**********************
* TYPEDEFS
**********************/
struct lv_obj_style_t {
const lv_style_t * style;
uint32_t selector : 24;
uint32_t is_local : 1;
uint32_t is_trans : 1;
};
struct lv_obj_style_transition_dsc_t {
uint16_t time;
uint16_t delay;
lv_style_selector_t selector;
lv_style_prop_t prop;
lv_anim_path_cb_t path_cb;
void * user_data;
};
/**********************
* GLOBAL PROTOTYPES
**********************/
/**
* Initialize the object related style manager module.
* Called by LVGL in `lv_init()`
*/
void lv_obj_style_init(void);
/**
* Deinitialize the object related style manager module.
* Called by LVGL in `lv_deinit()`
*/
void lv_obj_style_deinit(void);
/**
* Used internally to create a style transition
* @param obj
* @param part
* @param prev_state
* @param new_state
* @param tr
*/
void lv_obj_style_create_transition(lv_obj_t * obj, lv_part_t part, lv_state_t prev_state,
lv_state_t new_state, const lv_obj_style_transition_dsc_t * tr);
/**
* Used internally to compare the appearance of an object in 2 states
* @param obj
* @param state1
* @param state2
* @return
*/
lv_style_state_cmp_t lv_obj_style_state_compare(lv_obj_t * obj, lv_state_t state1, lv_state_t state2);
/**
* Update the layer type of a widget bayed on its current styles.
* The result will be stored in `obj->spec_attr->layer_type`
* @param obj the object whose layer should be updated
*/
void lv_obj_update_layer_type(lv_obj_t * obj);
/**********************
* MACROS
**********************/
#ifdef __cplusplus
} /*extern "C"*/
#endif
#endif /*LV_OBJ_STYLE_PRIVATE_H*/

View File

@ -6,14 +6,13 @@
/*********************
* INCLUDES
*********************/
#include <stdlib.h>
#include "lv_obj.h"
#include "lv_obj_private.h"
#include "lv_obj_class_private.h"
#include "../indev/lv_indev.h"
#include "../indev/lv_indev_private.h"
#include "../display/lv_display.h"
#include "../display/lv_display_private.h"
#include "../misc/lv_anim.h"
#include "../misc/lv_anim_private.h"
#include "../misc/lv_async.h"
#include "../core/lv_global.h"
@ -35,7 +34,7 @@
static void lv_obj_delete_async_cb(void * obj);
static void obj_delete_core(lv_obj_t * obj);
static lv_obj_tree_walk_res_t walk_core(lv_obj_t * obj, lv_obj_tree_walk_cb_t cb, void * user_data);
static lv_obj_tree_walk_res_t dump_tree_core(lv_obj_t * obj, int32_t depth);
static void dump_tree_core(lv_obj_t * obj, int32_t depth);
static lv_obj_t * lv_obj_get_first_not_deleting_child(lv_obj_t * obj);
/**********************
@ -156,6 +155,10 @@ void lv_obj_set_parent(lv_obj_t * obj, lv_obj_t * parent)
return;
}
if(parent == obj->parent) {
return;
}
lv_obj_invalidate(obj);
lv_obj_allocate_spec_attr(parent);
@ -210,7 +213,7 @@ void lv_obj_move_to_index(lv_obj_t * obj, int32_t index)
}
const uint32_t parent_child_count = lv_obj_get_child_count(parent);
/* old_index only can be 0 or greater, this point can not be reached if the parent is not null */
/* old_index only can be 0 or greater, this point cannot be reached if the parent is not null */
const int32_t old_index = lv_obj_get_index(obj);
LV_ASSERT(0 <= old_index);
@ -306,7 +309,7 @@ lv_display_t * lv_obj_get_display(const lv_obj_t * obj)
lv_display_t * d;
lv_ll_t * disp_head = disp_ll_p;
_LV_LL_READ(disp_head, d) {
LV_LL_READ(disp_head, d) {
uint32_t i;
for(i = 0; i < d->screen_cnt; i++) {
if(d->screens[i] == scr) return d;
@ -390,7 +393,7 @@ lv_obj_t * lv_obj_get_sibling_by_type(const lv_obj_t * obj, int32_t idx, const l
int32_t sibling_idx = (int32_t)lv_obj_get_index_by_type(obj, class_p) + idx;
if(sibling_idx < 0) return NULL;
return lv_obj_get_child(parent, sibling_idx);
return lv_obj_get_child_by_type(parent, sibling_idx, class_p);
}
uint32_t lv_obj_get_child_count(const lv_obj_t * obj)
@ -486,8 +489,13 @@ static void lv_obj_delete_async_cb(void * obj)
static void obj_indev_reset(lv_indev_t * indev, lv_obj_t * obj)
{
/*Wait for release to avoid accidentally triggering other obj to be clicked*/
lv_indev_wait_release(indev);
/* If the input device is already in the release state,
* there is no need to wait for the input device to be released
*/
if(lv_indev_get_state(indev) != LV_INDEV_STATE_RELEASED) {
/*Wait for release to avoid accidentally triggering other obj to be clicked*/
lv_indev_wait_release(indev);
}
/*Reset the input device*/
lv_indev_reset(indev, obj);
@ -530,6 +538,9 @@ static void obj_delete_core(lv_obj_t * obj)
if(indev->pointer.last_pressed == obj) {
indev->pointer.last_pressed = NULL;
}
if(indev->pointer.last_hovered == obj) {
indev->pointer.last_hovered = NULL;
}
}
if(indev->group == group && obj == lv_indev_get_active_obj()) {
@ -545,7 +556,7 @@ static void obj_delete_core(lv_obj_t * obj)
}
/*All children deleted. Now clean up the object specific data*/
_lv_obj_destruct(obj);
lv_obj_destruct(obj);
/*Remove the screen for the screen list*/
if(obj->parent == NULL) {
@ -609,10 +620,8 @@ static lv_obj_tree_walk_res_t walk_core(lv_obj_t * obj, lv_obj_tree_walk_cb_t cb
return LV_OBJ_TREE_WALK_NEXT;
}
static lv_obj_tree_walk_res_t dump_tree_core(lv_obj_t * obj, int32_t depth)
static void dump_tree_core(lv_obj_t * obj, int32_t depth)
{
lv_obj_tree_walk_res_t res;
#if LV_USE_LOG
const char * id;
@ -630,14 +639,8 @@ static lv_obj_tree_walk_res_t dump_tree_core(lv_obj_t * obj, int32_t depth)
if(obj && obj->spec_attr && obj->spec_attr->child_cnt) {
for(uint32_t i = 0; i < obj->spec_attr->child_cnt; i++) {
res = dump_tree_core(lv_obj_get_child(obj, i), depth + 1);
if(res == LV_OBJ_TREE_WALK_END)
break;
dump_tree_core(lv_obj_get_child(obj, i), depth + 1);
}
return LV_OBJ_TREE_WALK_NEXT;
}
else {
return LV_OBJ_TREE_WALK_END;
}
}

View File

@ -1,5 +1,5 @@
/**
* @file struct _lv_obj_tree.h
* @file lv_obj_tree.h
*
*/
@ -13,8 +13,6 @@ extern "C" {
/*********************
* INCLUDES
*********************/
#include <stddef.h>
#include <stdbool.h>
#include "../misc/lv_types.h"
#include "../misc/lv_anim.h"
#include "../display/lv_display.h"
@ -226,7 +224,7 @@ void lv_obj_tree_walk(lv_obj_t * start_obj, lv_obj_tree_walk_cb_t cb, void * use
* Iterate through all children of any object and print their ID.
* @param start_obj start integrating from this object
*/
void lv_obj_dump_tree(lv_obj_t * start_ob);
void lv_obj_dump_tree(lv_obj_t * start_obj);
/**********************
* MACROS

View File

@ -6,15 +6,21 @@
/*********************
* INCLUDES
*********************/
#include <stddef.h>
#include "lv_refr.h"
#include "lv_refr_private.h"
#include "lv_obj_draw_private.h"
#include "../misc/lv_area_private.h"
#include "../draw/sw/lv_draw_sw_mask_private.h"
#include "../draw/lv_draw_mask_private.h"
#include "lv_obj_private.h"
#include "lv_obj_event_private.h"
#include "../display/lv_display.h"
#include "../display/lv_display_private.h"
#include "../tick/lv_tick.h"
#include "../misc/lv_timer.h"
#include "../misc/lv_timer_private.h"
#include "../misc/lv_math.h"
#include "../misc/lv_profiler.h"
#include "../draw/lv_draw.h"
#include "../misc/lv_types.h"
#include "../draw/lv_draw_private.h"
#include "../font/lv_font_fmt_txt.h"
#include "../stdlib/lv_string.h"
#include "lv_global.h"
@ -66,11 +72,11 @@ static void wait_for_flushing(lv_display_t * disp);
/**
* Initialize the screen refresh subsystem
*/
void _lv_refr_init(void)
void lv_refr_init(void)
{
}
void _lv_refr_deinit(void)
void lv_refr_deinit(void)
{
}
@ -79,13 +85,13 @@ void lv_refr_now(lv_display_t * disp)
lv_anim_refr_now();
if(disp) {
if(disp->refr_timer) _lv_display_refr_timer(disp->refr_timer);
if(disp->refr_timer) lv_display_refr_timer(disp->refr_timer);
}
else {
lv_display_t * d;
d = lv_display_get_next(NULL);
while(d) {
if(d->refr_timer) _lv_display_refr_timer(d->refr_timer);
if(d->refr_timer) lv_display_refr_timer(d->refr_timer);
d = lv_display_get_next(d);
}
}
@ -99,10 +105,10 @@ void lv_obj_redraw(lv_layer_t * layer, lv_obj_t * obj)
/*Truncate the clip area to `obj size + ext size` area*/
lv_area_t obj_coords_ext;
lv_obj_get_coords(obj, &obj_coords_ext);
int32_t ext_draw_size = _lv_obj_get_ext_draw_size(obj);
int32_t ext_draw_size = lv_obj_get_ext_draw_size(obj);
lv_area_increase(&obj_coords_ext, ext_draw_size, ext_draw_size);
if(!_lv_area_intersect(&clip_coords_for_obj, &clip_area_ori, &obj_coords_ext)) return;
if(!lv_area_intersect(&clip_coords_for_obj, &clip_area_ori, &obj_coords_ext)) return;
/*If the object is visible on the current clip area*/
layer->_clip_area = clip_coords_for_obj;
@ -130,7 +136,7 @@ void lv_obj_redraw(lv_layer_t * layer, lv_obj_t * obj)
}
lv_area_t clip_coords_for_children;
bool refr_children = true;
if(!_lv_area_intersect(&clip_coords_for_children, &clip_area_ori, obj_coords)) {
if(!lv_area_intersect(&clip_coords_for_children, &clip_area_ori, obj_coords)) {
refr_children = false;
}
@ -183,7 +189,7 @@ void lv_obj_redraw(lv_layer_t * layer, lv_obj_t * obj)
lv_area_t bottom = obj->coords;
bottom.y1 = bottom.y2 - rout + 1;
if(_lv_area_intersect(&bottom, &bottom, &clip_area_ori)) {
if(lv_area_intersect(&bottom, &bottom, &clip_area_ori)) {
layer_children = lv_draw_layer_create(layer, LV_COLOR_FORMAT_ARGB8888, &bottom);
for(i = 0; i < child_cnt; i++) {
@ -204,7 +210,7 @@ void lv_obj_redraw(lv_layer_t * layer, lv_obj_t * obj)
lv_area_t top = obj->coords;
top.y2 = top.y1 + rout - 1;
if(_lv_area_intersect(&top, &top, &clip_area_ori)) {
if(lv_area_intersect(&top, &top, &clip_area_ori)) {
layer_children = lv_draw_layer_create(layer, LV_COLOR_FORMAT_ARGB8888, &top);
for(i = 0; i < child_cnt; i++) {
@ -227,7 +233,7 @@ void lv_obj_redraw(lv_layer_t * layer, lv_obj_t * obj)
lv_area_t mid = obj->coords;
mid.y1 += rout;
mid.y2 -= rout;
if(_lv_area_intersect(&mid, &mid, &clip_area_ori)) {
if(lv_area_intersect(&mid, &mid, &clip_area_ori)) {
layer->_clip_area = mid;
for(i = 0; i < child_cnt; i++) {
lv_obj_t * child = obj->spec_attr->children[i];
@ -248,12 +254,23 @@ void lv_obj_redraw(lv_layer_t * layer, lv_obj_t * obj)
layer->_clip_area = clip_area_ori;
}
void _lv_inv_area(lv_display_t * disp, const lv_area_t * area_p)
void lv_inv_area(lv_display_t * disp, const lv_area_t * area_p)
{
if(!disp) disp = lv_display_get_default();
if(!disp) return;
if(!lv_display_is_invalidation_enabled(disp)) return;
/**
* There are two reasons for this issue:
* 1.LVGL API is being used across threads, such as modifying widget properties in another thread
* or within an interrupt handler during the main thread rendering process.
* 2.User-customized widget modify widget properties/styles again within the DRAW event.
*
* Therefore, ensure that LVGL is used in a single-threaded manner, or refer to
* documentation: https://docs.lvgl.io/master/porting/os.html for proper locking mechanisms.
* Additionally, ensure that only drawing-related tasks are performed within the DRAW event,
* and move widget property/style modifications to other events.
*/
LV_ASSERT_MSG(!disp->rendering_in_progress, "Invalidate area is not allowed during rendering.");
/*Clear the invalidate buffer if the parameter is NULL*/
@ -271,9 +288,16 @@ void _lv_inv_area(lv_display_t * disp, const lv_area_t * area_p)
lv_area_t com_area;
bool suc;
suc = _lv_area_intersect(&com_area, area_p, &scr_area);
suc = lv_area_intersect(&com_area, area_p, &scr_area);
if(suc == false) return; /*Out of the screen*/
if(disp->color_format == LV_COLOR_FORMAT_I1) {
/*Make sure that the X coordinates start and end on byte boundary.
*E.g. convert 11;27 to 8;31*/
com_area.x1 &= ~0x7; /*Round down: Nx8*/
com_area.x2 |= 0x7; /*Round up: Nx8 - 1*/
}
/*If there were at least 1 invalid area in full refresh mode, redraw the whole screen*/
if(disp->render_mode == LV_DISPLAY_RENDER_MODE_FULL) {
disp->inv_areas[0] = scr_area;
@ -288,7 +312,7 @@ void _lv_inv_area(lv_display_t * disp, const lv_area_t * area_p)
/*Save only if this area is not in one of the saved areas*/
uint16_t i;
for(i = 0; i < disp->inv_p; i++) {
if(_lv_area_is_in(&com_area, &disp->inv_areas[i], 0) != false) return;
if(lv_area_is_in(&com_area, &disp->inv_areas[i], 0) != false) return;
}
/*Save the area*/
@ -307,7 +331,7 @@ void _lv_inv_area(lv_display_t * disp, const lv_area_t * area_p)
* Get the display which is being refreshed
* @return the display being refreshed
*/
lv_display_t * _lv_refr_get_disp_refreshing(void)
lv_display_t * lv_refr_get_disp_refreshing(void)
{
return disp_refr;
}
@ -316,12 +340,12 @@ lv_display_t * _lv_refr_get_disp_refreshing(void)
* Get the display which is being refreshed
* @return the display being refreshed
*/
void _lv_refr_set_disp_refreshing(lv_display_t * disp)
void lv_refr_set_disp_refreshing(lv_display_t * disp)
{
disp_refr = disp;
}
void _lv_display_refr_timer(lv_timer_t * tmr)
void lv_display_refr_timer(lv_timer_t * tmr)
{
LV_PROFILER_BEGIN;
LV_TRACE_REFR("begin");
@ -331,7 +355,7 @@ void _lv_display_refr_timer(lv_timer_t * tmr)
/* Ensure the timer does not run again automatically.
* This is done before refreshing in case refreshing invalidates something else.
* However if the performance monitor is enabled keep the timer running to count the FPS.*/
#if !(defined(LV_USE_PERF_MONITOR) && LV_USE_PERF_MONITOR)
#if LV_USE_PERF_MONITOR
lv_timer_pause(tmr);
#endif
}
@ -378,23 +402,19 @@ void _lv_display_refr_timer(lv_timer_t * tmr)
/*If refresh happened ...*/
lv_display_send_event(disp_refr, LV_EVENT_RENDER_READY, NULL);
if(!lv_display_is_double_buffered(disp_refr) ||
disp_refr->render_mode != LV_DISPLAY_RENDER_MODE_DIRECT) goto refr_clean_up;
/*In double buffered direct mode save the updated areas.
*They will be used on the next call to synchronize the buffers.*/
if(lv_display_is_double_buffered(disp_refr) && disp_refr->render_mode == LV_DISPLAY_RENDER_MODE_DIRECT) {
uint32_t i;
for(i = 0; i < disp_refr->inv_p; i++) {
if(disp_refr->inv_area_joined[i])
continue;
/*With double buffered direct mode synchronize the rendered areas to the other buffer*/
/*We need to wait for ready here to not mess up the active screen*/
wait_for_flushing(disp_refr);
uint32_t i;
for(i = 0; i < disp_refr->inv_p; i++) {
if(disp_refr->inv_area_joined[i])
continue;
lv_area_t * sync_area = _lv_ll_ins_tail(&disp_refr->sync_areas);
*sync_area = disp_refr->inv_areas[i];
lv_area_t * sync_area = lv_ll_ins_tail(&disp_refr->sync_areas);
*sync_area = disp_refr->inv_areas[i];
}
}
refr_clean_up:
lv_memzero(disp_refr->inv_areas, sizeof(disp_refr->inv_areas));
lv_memzero(disp_refr->inv_area_joined, sizeof(disp_refr->inv_area_joined));
disp_refr->inv_p = 0;
@ -402,7 +422,7 @@ refr_clean_up:
refr_finish:
#if LV_DRAW_SW_COMPLEX == 1
_lv_draw_sw_mask_cleanup();
lv_draw_sw_mask_cleanup();
#endif
lv_display_send_event(disp_refr, LV_EVENT_REFR_READY, NULL);
@ -435,11 +455,11 @@ static void lv_refr_join_area(void)
}
/*Check if the areas are on each other*/
if(_lv_area_is_on(&disp_refr->inv_areas[join_in], &disp_refr->inv_areas[join_from]) == false) {
if(lv_area_is_on(&disp_refr->inv_areas[join_in], &disp_refr->inv_areas[join_from]) == false) {
continue;
}
_lv_area_join(&joined_area, &disp_refr->inv_areas[join_in], &disp_refr->inv_areas[join_from]);
lv_area_join(&joined_area, &disp_refr->inv_areas[join_in], &disp_refr->inv_areas[join_from]);
/*Join two area only if the joined area size is smaller*/
if(lv_area_get_size(&joined_area) < (lv_area_get_size(&disp_refr->inv_areas[join_in]) +
@ -466,7 +486,7 @@ static void refr_sync_areas(void)
if(!lv_display_is_double_buffered(disp_refr)) return;
/*Do not sync if no sync areas*/
if(_lv_ll_is_empty(&disp_refr->sync_areas)) return;
if(lv_ll_is_empty(&disp_refr->sync_areas)) return;
LV_PROFILER_BEGIN;
/*With double buffered direct mode synchronize the rendered areas to the other buffer*/
@ -492,22 +512,22 @@ static void refr_sync_areas(void)
if(disp_refr->inv_area_joined[i]) continue;
/*Iterate over sync areas*/
sync_area = _lv_ll_get_head(&disp_refr->sync_areas);
sync_area = lv_ll_get_head(&disp_refr->sync_areas);
while(sync_area != NULL) {
/*Get next sync area*/
next_area = _lv_ll_get_next(&disp_refr->sync_areas, sync_area);
next_area = lv_ll_get_next(&disp_refr->sync_areas, sync_area);
/*Remove intersect of redraw area from sync area and get remaining areas*/
res_c = _lv_area_diff(res, sync_area, &disp_refr->inv_areas[i]);
res_c = lv_area_diff(res, sync_area, &disp_refr->inv_areas[i]);
/*New sub areas created after removing intersect*/
if(res_c != -1) {
/*Replace old sync area with new areas*/
for(j = 0; j < res_c; j++) {
new_area = _lv_ll_ins_prev(&disp_refr->sync_areas, sync_area);
new_area = lv_ll_ins_prev(&disp_refr->sync_areas, sync_area);
*new_area = res[j];
}
_lv_ll_remove(&disp_refr->sync_areas, sync_area);
lv_ll_remove(&disp_refr->sync_areas, sync_area);
lv_free(sync_area);
}
@ -518,17 +538,17 @@ static void refr_sync_areas(void)
lv_area_t disp_area = {0, 0, (int32_t)hor_res - 1, (int32_t)ver_res - 1};
/*Copy sync areas (if any remaining)*/
for(sync_area = _lv_ll_get_head(&disp_refr->sync_areas); sync_area != NULL;
sync_area = _lv_ll_get_next(&disp_refr->sync_areas, sync_area)) {
for(sync_area = lv_ll_get_head(&disp_refr->sync_areas); sync_area != NULL;
sync_area = lv_ll_get_next(&disp_refr->sync_areas, sync_area)) {
/**
* @todo Resize SDL window will trigger crash because of sync_area is larger than disp_area
*/
_lv_area_intersect(sync_area, sync_area, &disp_area);
lv_area_intersect(sync_area, sync_area, &disp_area);
lv_draw_buf_copy(off_screen, sync_area, on_screen, sync_area);
}
/*Clear sync areas*/
_lv_ll_clear(&disp_refr->sync_areas);
lv_ll_clear(&disp_refr->sync_areas);
LV_PROFILER_END;
}
@ -575,15 +595,16 @@ static void refr_invalid_areas(void)
* Reshape the draw buffer if required
* @param layer pointer to a layer which will be drawn
*/
static void layer_reshape_draw_buf(lv_layer_t * layer)
static void layer_reshape_draw_buf(lv_layer_t * layer, uint32_t stride)
{
LV_ASSERT(lv_draw_buf_reshape(
layer->draw_buf,
layer->color_format,
lv_area_get_width(&layer->buf_area),
lv_area_get_height(&layer->buf_area),
0)
!= NULL);
lv_draw_buf_t * ret = lv_draw_buf_reshape(
layer->draw_buf,
layer->color_format,
lv_area_get_width(&layer->buf_area),
lv_area_get_height(&layer->buf_area),
stride);
LV_UNUSED(ret);
LV_ASSERT_NULL(ret);
}
/**
@ -596,6 +617,10 @@ static void refr_area(const lv_area_t * area_p)
lv_layer_t * layer = disp_refr->layer_head;
layer->draw_buf = disp_refr->buf_act;
#if LV_DRAW_TRANSFORM_USE_MATRIX
lv_matrix_identity(&layer->matrix);
#endif
/*With full refresh just redraw directly into the buffer*/
/*In direct mode draw directly on the absolute coordinates of the buffer*/
if(disp_refr->render_mode != LV_DISPLAY_RENDER_MODE_PARTIAL) {
@ -603,19 +628,22 @@ static void refr_area(const lv_area_t * area_p)
layer->buf_area.y1 = 0;
layer->buf_area.x2 = lv_display_get_horizontal_resolution(disp_refr) - 1;
layer->buf_area.y2 = lv_display_get_vertical_resolution(disp_refr) - 1;
layer_reshape_draw_buf(layer);
lv_area_t disp_area;
lv_area_set(&disp_area, 0, 0, lv_display_get_horizontal_resolution(disp_refr) - 1,
lv_display_get_vertical_resolution(disp_refr) - 1);
if(disp_refr->render_mode == LV_DISPLAY_RENDER_MODE_FULL) {
disp_refr->last_part = 1;
layer_reshape_draw_buf(layer, layer->draw_buf->header.stride);
layer->_clip_area = disp_area;
layer->phy_clip_area = disp_area;
refr_area_part(layer);
}
else if(disp_refr->render_mode == LV_DISPLAY_RENDER_MODE_DIRECT) {
disp_refr->last_part = disp_refr->last_area;
layer_reshape_draw_buf(layer, layer->draw_buf->header.stride);
layer->_clip_area = *area_p;
layer->phy_clip_area = *area_p;
refr_area_part(layer);
}
LV_PROFILER_END;
@ -643,7 +671,8 @@ static void refr_area(const lv_area_t * area_p)
layer->draw_buf = disp_refr->buf_act;
layer->buf_area = sub_area;
layer->_clip_area = sub_area;
layer_reshape_draw_buf(layer);
layer->phy_clip_area = sub_area;
layer_reshape_draw_buf(layer, LV_STRIDE_AUTO);
if(sub_area.y2 > y2) sub_area.y2 = y2;
row_last = sub_area.y2;
if(y2 == row_last) disp_refr->last_part = 1;
@ -660,7 +689,8 @@ static void refr_area(const lv_area_t * area_p)
layer->draw_buf = disp_refr->buf_act;
layer->buf_area = sub_area;
layer->_clip_area = sub_area;
layer_reshape_draw_buf(layer);
layer->phy_clip_area = sub_area;
layer_reshape_draw_buf(layer, LV_STRIDE_AUTO);
disp_refr->last_part = 1;
refr_area_part(layer);
}
@ -741,9 +771,9 @@ static lv_obj_t * lv_refr_get_top_obj(const lv_area_t * area_p, lv_obj_t * obj)
{
lv_obj_t * found_p = NULL;
if(_lv_area_is_in(area_p, &obj->coords, 0) == false) return NULL;
if(lv_area_is_in(area_p, &obj->coords, 0) == false) return NULL;
if(lv_obj_has_flag(obj, LV_OBJ_FLAG_HIDDEN)) return NULL;
if(_lv_obj_get_layer_type(obj) != LV_LAYER_TYPE_NONE) return NULL;
if(lv_obj_get_layer_type(obj) != LV_LAYER_TYPE_NONE) return NULL;
/*If this object is fully cover the draw area then check the children too*/
lv_cover_check_info_t info;
@ -811,7 +841,7 @@ static void refr_obj_and_children(lv_layer_t * layer, lv_obj_t * top_obj)
}
}
/*Call the post draw draw function of the parents of the to object*/
/*Call the post draw function of the parents of the to object*/
lv_obj_send_event(parent, LV_EVENT_DRAW_POST_BEGIN, (void *)layer);
lv_obj_send_event(parent, LV_EVENT_DRAW_POST, (void *)layer);
lv_obj_send_event(parent, LV_EVENT_DRAW_POST_END, (void *)layer);
@ -828,7 +858,7 @@ static void refr_obj_and_children(lv_layer_t * layer, lv_obj_t * top_obj)
static lv_result_t layer_get_area(lv_layer_t * layer, lv_obj_t * obj, lv_layer_type_t layer_type,
lv_area_t * layer_area_out, lv_area_t * obj_draw_size_out)
{
int32_t ext_draw_size = _lv_obj_get_ext_draw_size(obj);
int32_t ext_draw_size = lv_obj_get_ext_draw_size(obj);
lv_obj_get_coords(obj, obj_draw_size_out);
lv_area_increase(obj_draw_size_out, ext_draw_size, ext_draw_size);
@ -838,7 +868,7 @@ static lv_result_t layer_get_area(lv_layer_t * layer, lv_obj_t * obj, lv_layer_t
lv_area_t clip_coords_for_obj;
lv_area_t tranf_coords = *obj_draw_size_out;
lv_obj_get_transformed_area(obj, &tranf_coords, LV_OBJ_POINT_TRANSFORM_FLAG_NONE);
if(!_lv_area_intersect(&clip_coords_for_obj, &layer->_clip_area, &tranf_coords)) {
if(!lv_area_intersect(&clip_coords_for_obj, &layer->_clip_area, &tranf_coords)) {
return LV_RESULT_INVALID;
}
@ -847,7 +877,7 @@ static lv_result_t layer_get_area(lv_layer_t * layer, lv_obj_t * obj, lv_layer_t
*in order to cover transformed area after transformation.*/
lv_area_t inverse_clip_coords_for_obj = clip_coords_for_obj;
lv_obj_get_transformed_area(obj, &inverse_clip_coords_for_obj, LV_OBJ_POINT_TRANSFORM_FLAG_INVERSE);
if(!_lv_area_intersect(&inverse_clip_coords_for_obj, &inverse_clip_coords_for_obj, obj_draw_size_out)) {
if(!lv_area_intersect(&inverse_clip_coords_for_obj, &inverse_clip_coords_for_obj, obj_draw_size_out)) {
return LV_RESULT_INVALID;
}
@ -856,7 +886,7 @@ static lv_result_t layer_get_area(lv_layer_t * layer, lv_obj_t * obj, lv_layer_t
}
else if(layer_type == LV_LAYER_TYPE_SIMPLE) {
lv_area_t clip_coords_for_obj;
if(!_lv_area_intersect(&clip_coords_for_obj, &layer->_clip_area, obj_draw_size_out)) {
if(!lv_area_intersect(&clip_coords_for_obj, &layer->_clip_area, obj_draw_size_out)) {
return LV_RESULT_INVALID;
}
*layer_area_out = clip_coords_for_obj;
@ -873,7 +903,7 @@ static bool alpha_test_area_on_obj(lv_obj_t * obj, const lv_area_t * area)
{
/*Test for alpha by assuming there is no alpha. If it fails, fall back to rendering with alpha*/
/*If the layer area is not fully on the object, it can't fully cover it*/
if(!_lv_area_is_on(area, &obj->coords)) return true;
if(!lv_area_is_on(area, &obj->coords)) return true;
lv_cover_check_info_t info;
info.res = LV_COVER_RES_COVER;
@ -883,24 +913,131 @@ static bool alpha_test_area_on_obj(lv_obj_t * obj, const lv_area_t * area)
else return true;
}
void refr_obj(lv_layer_t * layer, lv_obj_t * obj)
#if LV_DRAW_TRANSFORM_USE_MATRIX
static void refr_obj_matrix(lv_layer_t * layer, lv_obj_t * obj)
{
lv_matrix_t ori_matrix = layer->matrix;
lv_matrix_t obj_matrix;
lv_matrix_identity(&obj_matrix);
lv_point_t pivot = {
.x = lv_obj_get_style_transform_pivot_x(obj, 0),
.y = lv_obj_get_style_transform_pivot_y(obj, 0)
};
pivot.x = obj->coords.x1 + lv_pct_to_px(pivot.x, lv_area_get_width(&obj->coords));
pivot.y = obj->coords.y1 + lv_pct_to_px(pivot.y, lv_area_get_height(&obj->coords));
int32_t rotation = lv_obj_get_style_transform_rotation(obj, 0);
int32_t scale_x = lv_obj_get_style_transform_scale_x(obj, 0);
int32_t scale_y = lv_obj_get_style_transform_scale_y(obj, 0);
int32_t skew_x = lv_obj_get_style_transform_skew_x(obj, 0);
int32_t skew_y = lv_obj_get_style_transform_skew_y(obj, 0);
if(scale_x <= 0 || scale_y <= 0) {
/* NOT draw if scale is negative or zero */
return;
}
/* generate the obj matrix */
lv_matrix_translate(&obj_matrix, pivot.x, pivot.y);
if(rotation != 0) {
lv_matrix_rotate(&obj_matrix, rotation * 0.1f);
}
if(scale_x != LV_SCALE_NONE || scale_y != LV_SCALE_NONE) {
lv_matrix_scale(
&obj_matrix,
(float)scale_x / LV_SCALE_NONE,
(float)scale_y / LV_SCALE_NONE
);
}
if(skew_x != 0 || skew_y != 0) {
lv_matrix_skew(&obj_matrix, skew_x, skew_y);
}
lv_matrix_translate(&obj_matrix, -pivot.x, -pivot.y);
/* apply the obj matrix */
lv_matrix_multiply(&layer->matrix, &obj_matrix);
/* calculate clip area without transform */
lv_matrix_t matrix_reverse;
lv_matrix_inverse(&matrix_reverse, &obj_matrix);
lv_area_t clip_area = layer->_clip_area;
lv_area_t clip_area_ori = layer->_clip_area;
clip_area = lv_matrix_transform_area(&matrix_reverse, &clip_area);
/* increase the clip area by 1 pixel to avoid rounding errors */
if(!lv_matrix_is_identity_or_translation(&obj_matrix)) {
lv_area_increase(&clip_area, 1, 1);
}
layer->_clip_area = clip_area;
/* redraw obj */
lv_obj_redraw(layer, obj);
/* restore original matrix */
layer->matrix = ori_matrix;
/* restore clip area */
layer->_clip_area = clip_area_ori;
}
static bool refr_check_obj_clip_overflow(lv_layer_t * layer, lv_obj_t * obj)
{
if(lv_obj_get_style_transform_rotation(obj, 0) == 0) {
return false;
}
/*Truncate the area to the object*/
lv_area_t obj_coords;
int32_t ext_size = lv_obj_get_ext_draw_size(obj);
lv_area_copy(&obj_coords, &obj->coords);
lv_area_increase(&obj_coords, ext_size, ext_size);
lv_obj_get_transformed_area(obj, &obj_coords, LV_OBJ_POINT_TRANSFORM_FLAG_RECURSIVE);
lv_area_t clip_coords_for_obj;
if(!lv_area_intersect(&clip_coords_for_obj, &layer->_clip_area, &obj_coords)) {
return false;
}
bool has_clip = lv_memcmp(&clip_coords_for_obj, &obj_coords, sizeof(lv_area_t)) != 0;
return has_clip;
}
#endif /* LV_DRAW_TRANSFORM_USE_MATRIX */
static void refr_obj(lv_layer_t * layer, lv_obj_t * obj)
{
if(lv_obj_has_flag(obj, LV_OBJ_FLAG_HIDDEN)) return;
lv_layer_type_t layer_type = _lv_obj_get_layer_type(obj);
lv_opa_t opa = lv_obj_get_style_opa_layered(obj, 0);
if(opa < LV_OPA_MIN) return;
#if LV_DRAW_TRANSFORM_USE_MATRIX
/*If the layer opa is full then use the matrix transform*/
if(opa >= LV_OPA_MAX && !refr_check_obj_clip_overflow(layer, obj)) {
refr_obj_matrix(layer, obj);
return;
}
#endif /* LV_DRAW_TRANSFORM_USE_MATRIX */
lv_layer_type_t layer_type = lv_obj_get_layer_type(obj);
if(layer_type == LV_LAYER_TYPE_NONE) {
lv_obj_redraw(layer, obj);
}
else {
lv_opa_t opa = lv_obj_get_style_opa_layered(obj, 0);
if(opa < LV_OPA_MIN) return;
lv_area_t layer_area_full;
lv_area_t obj_draw_size;
lv_result_t res = layer_get_area(layer, obj, layer_type, &layer_area_full, &obj_draw_size);
if(res != LV_RESULT_OK) return;
/*Simple layers can be subdivied into smaller layers*/
/*Simple layers can be subdivided into smaller layers*/
uint32_t max_rgb_row_height = lv_area_get_height(&layer_area_full);
uint32_t max_argb_row_height = lv_area_get_height(&layer_area_full);
if(layer_type == LV_LAYER_TYPE_SIMPLE) {
@ -959,7 +1096,7 @@ void refr_obj(lv_layer_t * layer, lv_obj_t * obj)
layer_draw_dsc.blend_mode = lv_obj_get_style_blend_mode(obj, 0);
layer_draw_dsc.antialias = disp_refr->antialiasing;
layer_draw_dsc.bitmap_mask_src = lv_obj_get_style_bitmap_mask_src(obj, 0);
layer_draw_dsc.original_area = obj_draw_size;
layer_draw_dsc.image_area = obj_draw_size;
layer_draw_dsc.src = new_layer;
lv_draw_layer(layer, &layer_draw_dsc, &layer_area_act);
@ -971,10 +1108,11 @@ void refr_obj(lv_layer_t * layer, lv_obj_t * obj)
static uint32_t get_max_row(lv_display_t * disp, int32_t area_w, int32_t area_h)
{
bool has_alpha = lv_color_format_has_alpha(disp->color_format);
lv_color_format_t cf = has_alpha ? LV_COLOR_FORMAT_ARGB8888 : disp->color_format;
lv_color_format_t cf = disp->color_format;
uint32_t stride = lv_draw_buf_width_to_stride(area_w, cf);
int32_t max_row = (uint32_t)disp->buf_act->data_size / stride;
uint32_t overhead = LV_COLOR_INDEXED_PALETTE_SIZE(cf) * sizeof(lv_color32_t);
int32_t max_row = (uint32_t)(disp->buf_act->data_size - overhead) / stride;
if(max_row > area_h) max_row = area_h;
@ -1064,6 +1202,12 @@ static void call_flush_cb(lv_display_t * disp, const lv_area_t * area, uint8_t *
};
lv_display_send_event(disp, LV_EVENT_FLUSH_START, &offset_area);
/*For backward compatibility support LV_COLOR_16_SWAP (from v8)*/
#if defined(LV_COLOR_16_SWAP) && LV_COLOR_16_SWAP
lv_draw_sw_rgb565_swap(px_map, lv_area_get_size(&offset_area));
#endif
disp->flush_cb(disp, &offset_area, px_map);
lv_display_send_event(disp, LV_EVENT_FLUSH_FINISH, &offset_area);
@ -1078,7 +1222,10 @@ static void wait_for_flushing(lv_display_t * disp)
lv_display_send_event(disp, LV_EVENT_FLUSH_WAIT_START, NULL);
if(disp->flush_wait_cb) {
disp->flush_wait_cb(disp);
if(disp->flushing) {
disp->flush_wait_cb(disp);
}
disp->flushing = 0;
}
else {
while(disp->flushing);

View File

@ -15,7 +15,7 @@ extern "C" {
*********************/
#include "lv_obj.h"
#include "../display/lv_display.h"
#include <stdbool.h>
#include "../misc/lv_types.h"
/*********************
* DEFINES
@ -41,16 +41,6 @@ extern "C" {
* GLOBAL FUNCTIONS
**********************/
/**
* Initialize the screen refresh subsystem
*/
void _lv_refr_init(void);
/**
* Deinitialize the screen refresh subsystem
*/
void _lv_refr_deinit(void);
/**
* Redraw the invalidated areas now.
* Normally the redrawing is periodically executed in `lv_timer_handler` but a long blocking process
@ -67,32 +57,6 @@ void lv_refr_now(lv_display_t * disp);
*/
void lv_obj_redraw(lv_layer_t * layer, lv_obj_t * obj);
/**
* Invalidate an area on display to redraw it
* @param area_p pointer to area which should be invalidated (NULL: delete the invalidated areas)
* @param disp pointer to display where the area should be invalidated (NULL can be used if there is
* only one display)
*/
void _lv_inv_area(lv_display_t * disp, const lv_area_t * area_p);
/**
* Get the display which is being refreshed
* @return the display being refreshed
*/
lv_display_t * _lv_refr_get_disp_refreshing(void);
/**
* Set the display which is being refreshed
* @param disp the display being refreshed
*/
void _lv_refr_set_disp_refreshing(lv_display_t * disp);
/**
* Called periodically to handle the refreshing
* @param timer pointer to the timer itself
*/
void _lv_display_refr_timer(lv_timer_t * timer);
/**********************
* STATIC FUNCTIONS
**********************/

View File

@ -0,0 +1,75 @@
/**
* @file lv_refr_private.h
*
*/
#ifndef LV_REFR_PRIVATE_H
#define LV_REFR_PRIVATE_H
#ifdef __cplusplus
extern "C" {
#endif
/*********************
* INCLUDES
*********************/
#include "lv_refr.h"
/*********************
* DEFINES
*********************/
/**********************
* TYPEDEFS
**********************/
/**********************
* GLOBAL PROTOTYPES
**********************/
/**
* Initialize the screen refresh subsystem
*/
void lv_refr_init(void);
/**
* Deinitialize the screen refresh subsystem
*/
void lv_refr_deinit(void);
/**
* Invalidate an area on display to redraw it
* @param area_p pointer to area which should be invalidated (NULL: delete the invalidated areas)
* @param disp pointer to display where the area should be invalidated (NULL can be used if there is
* only one display)
*/
void lv_inv_area(lv_display_t * disp, const lv_area_t * area_p);
/**
* Get the display which is being refreshed
* @return the display being refreshed
*/
lv_display_t * lv_refr_get_disp_refreshing(void);
/**
* Set the display which is being refreshed
* @param disp the display being refreshed
*/
void lv_refr_set_disp_refreshing(lv_display_t * disp);
/**
* Called periodically to handle the refreshing
* @param timer pointer to the timer itself
*/
void lv_display_refr_timer(lv_timer_t * timer);
/**********************
* MACROS
**********************/
#ifdef __cplusplus
} /*extern "C"*/
#endif
#endif /*LV_REFR_PRIVATE_H*/

View File

@ -6,13 +6,18 @@
/*********************
* INCLUDES
*********************/
#include "../display/lv_display_private.h"
#include "../misc/lv_event_private.h"
#include "../misc/lv_anim_private.h"
#include "../draw/lv_draw_private.h"
#include "../core/lv_obj_private.h"
#include "lv_display.h"
#include "../misc/lv_math.h"
#include "../core/lv_refr.h"
#include "../display/lv_display_private.h"
#include "../core/lv_refr_private.h"
#include "../stdlib/lv_string.h"
#include "../themes/lv_theme.h"
#include "../core/lv_global.h"
#include "../others/sysmon/lv_sysmon.h"
#if LV_USE_DRAW_SW
#include "../draw/sw/lv_draw_sw.h"
@ -56,7 +61,7 @@ static void disp_event_cb(lv_event_t * e);
lv_display_t * lv_display_create(int32_t hor_res, int32_t ver_res)
{
lv_display_t * disp = _lv_ll_ins_head(disp_ll_p);
lv_display_t * disp = lv_ll_ins_head(disp_ll_p);
LV_ASSERT_MALLOC(disp);
if(!disp) return NULL;
@ -86,13 +91,13 @@ lv_display_t * lv_display_create(int32_t hor_res, int32_t ver_res)
disp->inv_en_cnt = 1;
disp->last_activity_time = lv_tick_get();
_lv_ll_init(&disp->sync_areas, sizeof(lv_area_t));
lv_ll_init(&disp->sync_areas, sizeof(lv_area_t));
lv_display_t * disp_def_tmp = disp_def;
disp_def = disp; /*Temporarily change the default screen to create the default screens on the
new display*/
/*Create a refresh timer*/
disp->refr_timer = lv_timer_create(_lv_display_refr_timer, LV_DEF_REFR_PERIOD, disp);
disp->refr_timer = lv_timer_create(lv_display_refr_timer, LV_DEF_REFR_PERIOD, disp);
LV_ASSERT_MALLOC(disp->refr_timer);
if(disp->refr_timer == NULL) {
lv_free(disp);
@ -139,13 +144,23 @@ lv_display_t * lv_display_create(int32_t hor_res, int32_t ver_res)
lv_timer_ready(disp->refr_timer); /*Be sure the screen will be refreshed immediately on start up*/
#if LV_USE_PERF_MONITOR
lv_sysmon_show_performance(disp);
#endif
#if LV_USE_MEM_MONITOR
lv_sysmon_show_memory(disp);
#endif
return disp;
}
void lv_display_delete(lv_display_t * disp)
{
bool was_default = false;
bool was_refr = false;
if(disp == lv_display_get_default()) was_default = true;
if(disp == lv_refr_get_disp_refreshing()) was_refr = true;
lv_display_send_event(disp, LV_EVENT_DELETE, NULL);
lv_event_remove_all(&(disp->event_list));
@ -178,12 +193,12 @@ void lv_display_delete(lv_display_t * disp)
disp->act_scr = NULL;
while(disp->screen_cnt != 0) {
/*Delete the screenst*/
/*Delete the screens*/
lv_obj_delete(disp->screens[0]);
}
_lv_ll_clear(&disp->sync_areas);
_lv_ll_remove(disp_ll_p, disp);
lv_ll_clear(&disp->sync_areas);
lv_ll_remove(disp_ll_p, disp);
if(disp->refr_timer) lv_timer_delete(disp->refr_timer);
if(disp->layer_deinit) disp->layer_deinit(disp, disp->layer_head);
@ -191,7 +206,9 @@ void lv_display_delete(lv_display_t * disp)
lv_free(disp);
if(was_default) lv_display_set_default(_lv_ll_get_head(disp_ll_p));
if(was_default) lv_display_set_default(lv_ll_get_head(disp_ll_p));
if(was_refr) lv_refr_set_disp_refreshing(NULL);
}
void lv_display_set_default(lv_display_t * disp)
@ -207,9 +224,9 @@ lv_display_t * lv_display_get_default(void)
lv_display_t * lv_display_get_next(lv_display_t * disp)
{
if(disp == NULL)
return _lv_ll_get_head(disp_ll_p);
return lv_ll_get_head(disp_ll_p);
else
return _lv_ll_get_next(disp_ll_p, disp);
return lv_ll_get_next(disp_ll_p, disp);
}
/*---------------------
@ -457,6 +474,8 @@ void lv_display_set_color_format(lv_display_t * disp, lv_color_format_t color_fo
disp->color_format = color_format;
disp->layer_head->color_format = color_format;
if(disp->buf_1) disp->buf_1->header.cf = color_format;
if(disp->buf_2) disp->buf_2->header.cf = color_format;
lv_display_send_event(disp, LV_EVENT_COLOR_FORMAT_CHANGED, NULL);
}
@ -559,7 +578,7 @@ lv_obj_t * lv_display_get_layer_bottom(lv_display_t * disp)
return disp->bottom_layer;
}
void lv_screen_load(struct _lv_obj_t * scr)
void lv_screen_load(struct lv_obj_t * scr)
{
lv_screen_load_anim(scr, LV_SCR_LOAD_ANIM_NONE, 0, 0, false);
}
@ -568,7 +587,7 @@ void lv_screen_load_anim(lv_obj_t * new_scr, lv_screen_load_anim_t anim_type, ui
bool auto_del)
{
lv_display_t * d = lv_obj_get_display(new_scr);
lv_obj_t * act_scr = lv_screen_active();
lv_obj_t * act_scr = d->act_scr;
if(act_scr == new_scr || d->scr_to_load == new_scr) {
return;
@ -581,20 +600,16 @@ void lv_screen_load_anim(lv_obj_t * new_scr, lv_screen_load_anim_t anim_type, ui
lv_obj_set_pos(d->scr_to_load, 0, 0);
lv_obj_remove_local_style_prop(d->scr_to_load, LV_STYLE_OPA, 0);
if(d->del_prev) {
lv_obj_delete(act_scr);
}
act_scr = lv_screen_active(); /*Active screen changed.*/
d->prev_scr = d->act_scr;
act_scr = d->scr_to_load; /*Active screen changed.*/
scr_load_internal(d->scr_to_load);
}
d->scr_to_load = new_scr;
if(d->prev_scr && d->del_prev) {
lv_obj_delete(d->prev_scr);
d->prev_scr = NULL;
}
if(d->prev_scr && d->del_prev) lv_obj_delete(d->prev_scr);
d->prev_scr = NULL;
d->draw_prev_over_act = is_out_anim(anim_type);
d->del_prev = auto_del;
@ -924,6 +939,67 @@ lv_draw_buf_t * lv_display_get_buf_active(lv_display_t * disp)
return disp->buf_act;
}
void lv_display_rotate_area(lv_display_t * disp, lv_area_t * area)
{
lv_display_rotation_t rotation = lv_display_get_rotation(disp);
int32_t w = lv_area_get_width(area);
int32_t h = lv_area_get_height(area);
switch(rotation) {
case LV_DISPLAY_ROTATION_0:
return;
case LV_DISPLAY_ROTATION_90:
area->y2 = disp->ver_res - area->x1 - 1;
area->x1 = area->y1;
area->x2 = area->x1 + h - 1;
area->y1 = area->y2 - w + 1;
break;
case LV_DISPLAY_ROTATION_180:
area->y2 = disp->ver_res - area->y1 - 1;
area->y1 = area->y2 - h + 1;
area->x2 = disp->hor_res - area->x1 - 1;
area->x1 = area->x2 - w + 1;
break;
case LV_DISPLAY_ROTATION_270:
area->x1 = disp->hor_res - area->y2 - 1;
area->y2 = area->x2;
area->x2 = area->x1 + h - 1;
area->y1 = area->y2 - w + 1;
break;
}
}
lv_obj_t * lv_screen_active(void)
{
return lv_display_get_screen_active(lv_display_get_default());
}
lv_obj_t * lv_layer_top(void)
{
return lv_display_get_layer_top(lv_display_get_default());
}
lv_obj_t * lv_layer_sys(void)
{
return lv_display_get_layer_sys(lv_display_get_default());
}
lv_obj_t * lv_layer_bottom(void)
{
return lv_display_get_layer_bottom(lv_display_get_default());
}
int32_t lv_dpx(int32_t n)
{
return LV_DPX(n);
}
int32_t lv_display_dpx(const lv_display_t * disp, int32_t n)
{
return LV_DPX_CALC(lv_display_get_dpi(disp), n);
}
/**********************
* STATIC FUNCTIONS
**********************/
@ -998,7 +1074,7 @@ static void scr_load_anim_start(lv_anim_t * a)
{
lv_display_t * d = lv_obj_get_display(a->var);
d->prev_scr = lv_screen_active();
d->prev_scr = d->act_scr;
d->act_scr = a->var;
lv_obj_send_event(d->act_scr, LV_EVENT_SCREEN_LOAD_START, NULL);

View File

@ -1,5 +1,5 @@
/**
* @file lv_disp.h
* @file lv_display.h
*
*/
@ -228,6 +228,8 @@ int32_t lv_display_get_dpi(const lv_display_t * disp);
/**
* Set the buffers for a display, similarly to `lv_display_set_draw_buffers`, but accept the raw buffer pointers.
* For DIRECT/FULL rending modes, the buffer size must be at least
* `hor_res * ver_res * lv_color_format_get_size(lv_display_get_color_format(disp))`
* @param disp pointer to a display
* @param buf1 first buffer
* @param buf2 second buffer (can be `NULL`)
@ -362,7 +364,7 @@ lv_obj_t * lv_display_get_layer_sys(lv_display_t * disp);
/**
* Return the bottom layer. The bottom layer is the same on all screen and it is under the normal screen layer.
* It's visible only if the the screen is transparent.
* It's visible only if the screen is transparent.
* @param disp pointer to display (NULL to use the default screen)
* @return pointer to the bottom layer object
*/
@ -372,7 +374,7 @@ lv_obj_t * lv_display_get_layer_bottom(lv_display_t * disp);
* Load a screen on the default display
* @param scr pointer to a screen
*/
void lv_screen_load(struct _lv_obj_t * scr);
void lv_screen_load(struct lv_obj_t * scr);
/**
* Switch screen with animation
@ -389,37 +391,25 @@ void lv_screen_load_anim(lv_obj_t * scr, lv_screen_load_anim_t anim_type, uint32
* Get the active screen of the default display
* @return pointer to the active screen
*/
static inline lv_obj_t * lv_screen_active(void)
{
return lv_display_get_screen_active(lv_display_get_default());
}
lv_obj_t * lv_screen_active(void);
/**
* Get the top layer of the default display
* @return pointer to the top layer
*/
static inline lv_obj_t * lv_layer_top(void)
{
return lv_display_get_layer_top(lv_display_get_default());
}
lv_obj_t * lv_layer_top(void);
/**
* Get the system layer of the default display
* @return pointer to the sys layer
*/
static inline lv_obj_t * lv_layer_sys(void)
{
return lv_display_get_layer_sys(lv_display_get_default());
}
lv_obj_t * lv_layer_sys(void);
/**
* Get the bottom layer of the default display
* @return pointer to the bottom layer
*/
static inline lv_obj_t * lv_layer_bottom(void)
{
return lv_display_get_layer_bottom(lv_display_get_default());
}
lv_obj_t * lv_layer_bottom(void);
/*---------------------
* OTHERS
@ -536,6 +526,13 @@ void * lv_display_get_user_data(lv_display_t * disp);
void * lv_display_get_driver_data(lv_display_t * disp);
lv_draw_buf_t * lv_display_get_buf_active(lv_display_t * disp);
/**
* Rotate an area in-place according to the display's rotation
* @param disp pointer to a display
* @param area pointer to an area to rotate
*/
void lv_display_rotate_area(lv_display_t * disp, lv_area_t * area);
/**********************
* MACROS
**********************/
@ -565,8 +562,8 @@ lv_draw_buf_t * lv_display_get_buf_active(lv_display_t * disp);
* 1 dip is 2 px on a 320 DPI screen
* https://stackoverflow.com/questions/2025282/what-is-the-difference-between-px-dip-dp-and-sp
*/
#define _LV_DPX_CALC(dpi, n) ((n) == 0 ? 0 :LV_MAX((( (dpi) * (n) + 80) / 160), 1)) /*+80 for rounding*/
#define LV_DPX(n) _LV_DPX_CALC(lv_display_get_dpi(NULL), n)
#define LV_DPX_CALC(dpi, n) ((n) == 0 ? 0 :LV_MAX((( (dpi) * (n) + 80) / 160), 1)) /*+80 for rounding*/
#define LV_DPX(n) LV_DPX_CALC(lv_display_get_dpi(NULL), n)
/**
* Scale the given number of pixels (a distance or size) relative to a 160 DPI display
@ -576,10 +573,7 @@ lv_draw_buf_t * lv_display_get_buf_active(lv_display_t * disp);
* @param n the number of pixels to scale
* @return `n x current_dpi/160`
*/
static inline int32_t lv_dpx(int32_t n)
{
return LV_DPX(n);
}
int32_t lv_dpx(int32_t n);
/**
* Scale the given number of pixels (a distance or size) relative to a 160 DPI display
@ -590,10 +584,7 @@ static inline int32_t lv_dpx(int32_t n)
* @param n the number of pixels to scale
* @return `n x current_dpi/160`
*/
static inline int32_t lv_display_dpx(const lv_display_t * disp, int32_t n)
{
return _LV_DPX_CALC(lv_display_get_dpi(disp), n);
}
int32_t lv_display_dpx(const lv_display_t * disp, int32_t n);
#ifdef __cplusplus
} /*extern "C"*/

View File

@ -18,18 +18,22 @@ extern "C" {
#include "../draw/lv_draw.h"
#include "lv_display.h"
#if LV_USE_SYSMON
#include "../others/sysmon/lv_sysmon_private.h"
#endif
/*********************
* DEFINES
*********************/
#ifndef LV_INV_BUF_SIZE
#define LV_INV_BUF_SIZE 32 /*Buffer size for invalid areas*/
#define LV_INV_BUF_SIZE 32 /**< Buffer size for invalid areas */
#endif
/**********************
* TYPEDEFS
**********************/
struct _lv_display_t {
struct lv_display_t {
/*---------------------
* Resolution
@ -53,7 +57,8 @@ struct _lv_display_t {
/** Vertical offset from the full / physical display. Set to 0 for fullscreen mode.*/
int32_t offset_y;
uint32_t dpi; /** DPI (dot per inch) of the display. Default value is `LV_DPI_DEF`.*/
/** DPI (dot per inch) of the display. Default value is `LV_DPI_DEF`.*/
uint32_t dpi;
/*---------------------
* Buffering
@ -71,16 +76,18 @@ struct _lv_display_t {
/**
* Used to wait while flushing is ready.
* It can do any complex logic to wait, including semaphores, mutexes, polling flags, etc.
* If not set `flushing` flag is used which can be cleared with `lv_display_flush_ready()`*/
* If not set `flushing` flag is used which can be cleared with `lv_display_flush_ready()` */
lv_display_flush_wait_cb_t flush_wait_cb;
/*1: flushing is in progress. (It can't be a bit field because when it's cleared from IRQ Read-Modify-Write issue might occur)*/
/** 1: flushing is in progress. (It can't be a bit field because when it's cleared from IRQ
* Read-Modify-Write issue might occur) */
volatile int flushing;
/*1: It was the last chunk to flush. (It can't be a bit field because when it's cleared from IRQ Read-Modify-Write issue might occur)*/
/** 1: It was the last chunk to flush. (It can't be a bit field because when it's cleared
* from IRQ Read-Modify-Write issue might occur) */
volatile int flushing_last;
volatile uint32_t last_area : 1; /*1: the last area is being rendered*/
volatile uint32_t last_part : 1; /*1: the last part of the current area is being rendered*/
volatile uint32_t last_area : 1; /**< 1: last area is being rendered */
volatile uint32_t last_part : 1; /**< 1: last part of the current area is being rendered */
lv_display_render_mode_t render_mode;
uint32_t antialiasing : 1; /**< 1: anti-aliasing is enabled on this display.*/
@ -99,7 +106,7 @@ struct _lv_display_t {
/** Double buffer sync areas (redrawn during last refresh) */
lv_ll_t sync_areas;
lv_draw_buf_t _static_buf1; /*Used when user pass in a raw buffer as display draw buffer*/
lv_draw_buf_t _static_buf1; /**< Used when user pass in a raw buffer as display draw buffer */
lv_draw_buf_t _static_buf2;
/*---------------------
* Layer
@ -114,15 +121,15 @@ struct _lv_display_t {
/** Screens of the display*/
lv_obj_t ** screens; /**< Array of screen objects.*/
lv_obj_t * sys_layer; /**< @see lv_display_get_layer_sys*/
lv_obj_t * top_layer; /**< @see lv_display_get_layer_top*/
lv_obj_t * act_scr; /**< Currently active screen on this display*/
lv_obj_t * bottom_layer;/**< @see lv_display_get_layer_bottom*/
lv_obj_t * prev_scr; /**< Previous screen. Used during screen animations*/
lv_obj_t * scr_to_load; /**< The screen prepared to load in lv_screen_load_anim*/
lv_obj_t * bottom_layer; /**< @see lv_display_get_layer_bottom*/
lv_obj_t * top_layer; /**< @see lv_display_get_layer_top*/
lv_obj_t * sys_layer; /**< @see lv_display_get_layer_sys*/
uint32_t screen_cnt;
uint8_t draw_prev_over_act : 1;/** 1: Draw previous screen over active screen*/
uint8_t del_prev : 1; /** 1: Automatically delete the previous screen when the screen load animation is ready*/
uint8_t del_prev : 1; /** 1: Automatically delete the previous screen when the screen load animation is ready*/
/*---------------------
* Others
@ -135,10 +142,9 @@ struct _lv_display_t {
lv_event_list_t event_list;
uint32_t sw_rotate : 1; /**< 1: use software rotation (slower)*/
uint32_t rotation : 2; /**< Element of @lv_display_rotation_t*/
uint32_t rotation : 2; /**< Element of lv_display_rotation_t*/
/**< The theme assigned to the screen*/
lv_theme_t * theme;
lv_theme_t * theme; /**< The theme assigned to the screen*/
/** A timer which periodically checks the dirty areas and refreshes them*/
lv_timer_t * refr_timer;
@ -148,6 +154,17 @@ struct _lv_display_t {
/** The area being refreshed*/
lv_area_t refreshed_area;
#if LV_USE_PERF_MONITOR
lv_obj_t * perf_label;
lv_sysmon_backend_data_t perf_sysmon_backend;
lv_sysmon_perf_info_t perf_sysmon_info;
#endif
#if LV_USE_MEM_MONITOR
lv_obj_t * mem_label;
#endif
};
/**********************

View File

@ -3,14 +3,19 @@
*
*/
/**
* Modified by NXP in 2024
*/
/*********************
* INCLUDES
*********************/
#include "lv_draw.h"
#include "../misc/lv_area_private.h"
#include "lv_draw_private.h"
#include "sw/lv_draw_sw.h"
#include "../display/lv_display_private.h"
#include "../core/lv_global.h"
#include "../core/lv_refr.h"
#include "../core/lv_refr_private.h"
#include "../stdlib/lv_string.h"
/*********************
@ -77,6 +82,7 @@ void * lv_draw_create_unit(size_t size)
new_unit->next = _draw_info.unit_head;
_draw_info.unit_head = new_unit;
_draw_info.unit_cnt++;
return new_unit;
}
@ -89,6 +95,9 @@ lv_draw_task_t * lv_draw_add_task(lv_layer_t * layer, const lv_area_t * coords)
new_task->area = *coords;
new_task->_real_area = *coords;
new_task->clip_area = layer->_clip_area;
#if LV_DRAW_TRANSFORM_USE_MATRIX
new_task->matrix = layer->matrix;
#endif
new_task->state = LV_DRAW_TASK_STATE_QUEUED;
/*Find the tail*/
@ -150,19 +159,33 @@ void lv_draw_finalize_task_creation(lv_layer_t * layer, lv_draw_task_t * t)
LV_PROFILER_END;
}
void lv_draw_wait_for_finish(void)
{
#if LV_USE_OS
lv_draw_unit_t * u = _draw_info.unit_head;
while(u) {
if(u->wait_for_finish_cb)
u->wait_for_finish_cb(u);
u = u->next;
}
#endif
}
void lv_draw_dispatch(void)
{
LV_PROFILER_BEGIN;
bool render_running = false;
bool task_dispatched = false;
lv_display_t * disp = lv_display_get_next(NULL);
while(disp) {
lv_layer_t * layer = disp->layer_head;
while(layer) {
if(lv_draw_dispatch_layer(disp, layer))
render_running = true;
/* If there are no tasks in the layer, skip it */
if(layer->draw_task_head && lv_draw_dispatch_layer(disp, layer))
task_dispatched = true;
layer = layer->next;
}
if(!render_running) {
if(!task_dispatched) {
lv_draw_wait_for_finish();
lv_draw_dispatch_request();
}
disp = lv_display_get_next(disp);
@ -179,7 +202,7 @@ bool lv_draw_dispatch_layer(lv_display_t * disp, lv_layer_t * layer)
while(t) {
lv_draw_task_t * t_next = t->next;
if(t->state == LV_DRAW_TASK_STATE_READY) {
if(t_prev) t_prev->next = t->next; /*Remove by it by assigning the next task to the previous*/
if(t_prev) t_prev->next = t->next; /*Remove it by assigning the next task to the previous*/
else layer->draw_task_head = t_next; /*If it was the head, set the next as head*/
/*If it was layer drawing free the layer too*/
@ -189,8 +212,7 @@ bool lv_draw_dispatch_layer(lv_display_t * disp, lv_layer_t * layer)
if(layer_drawn->draw_buf) {
int32_t h = lv_area_get_height(&layer_drawn->buf_area);
int32_t w = lv_area_get_width(&layer_drawn->buf_area);
uint32_t layer_size_byte = h * lv_draw_buf_width_to_stride(w, layer_drawn->color_format);
uint32_t layer_size_byte = h * layer_drawn->draw_buf->header.stride;
_draw_info.used_memory_for_layers_kb -= get_layer_size_kb(layer_size_byte);
LV_LOG_INFO("Layer memory used: %" LV_PRIu32 " kB\n", _draw_info.used_memory_for_layers_kb);
@ -228,7 +250,7 @@ bool lv_draw_dispatch_layer(lv_display_t * disp, lv_layer_t * layer)
t = t_next;
}
bool render_running = false;
bool task_dispatched = false;
/*This layer is ready, enable blending its buffer*/
if(layer->parent && layer->all_tasks_added && layer->draw_task_head == NULL) {
@ -253,13 +275,13 @@ bool lv_draw_dispatch_layer(lv_display_t * disp, lv_layer_t * layer)
lv_draw_unit_t * u = _draw_info.unit_head;
while(u) {
int32_t taken_cnt = u->dispatch_cb(u, layer);
if(taken_cnt >= 0) render_running = true;
if(taken_cnt != LV_DRAW_UNIT_IDLE) task_dispatched = true;
u = u->next;
}
}
LV_PROFILER_END;
return render_running;
return task_dispatched;
}
void lv_draw_dispatch_wait_for_request(void)
@ -281,13 +303,18 @@ void lv_draw_dispatch_request(void)
#endif
}
uint32_t lv_draw_get_unit_count(void)
{
return _draw_info.unit_cnt;
}
lv_draw_task_t * lv_draw_get_next_available_task(lv_layer_t * layer, lv_draw_task_t * t_prev, uint8_t draw_unit_id)
{
LV_PROFILER_BEGIN;
/*If the first task is screen sized, there cannot be independent areas*/
if(layer->draw_task_head) {
int32_t hor_res = lv_display_get_horizontal_resolution(_lv_refr_get_disp_refreshing());
int32_t ver_res = lv_display_get_vertical_resolution(_lv_refr_get_disp_refreshing());
int32_t hor_res = lv_display_get_horizontal_resolution(lv_refr_get_disp_refreshing());
int32_t ver_res = lv_display_get_vertical_resolution(lv_refr_get_disp_refreshing());
lv_draw_task_t * t = layer->draw_task_head;
if(t->state != LV_DRAW_TASK_STATE_QUEUED &&
t->area.x1 <= 0 && t->area.x2 >= hor_res - 1 &&
@ -301,7 +328,7 @@ lv_draw_task_t * lv_draw_get_next_available_task(lv_layer_t * layer, lv_draw_tas
while(t) {
/*Find a queued and independent task*/
if(t->state == LV_DRAW_TASK_STATE_QUEUED &&
(t->preferred_draw_unit_id == LV_DRAW_UNIT_ID_ANY || t->preferred_draw_unit_id == draw_unit_id) &&
(t->preferred_draw_unit_id == LV_DRAW_UNIT_NONE || t->preferred_draw_unit_id == draw_unit_id) &&
is_independent(layer, t)) {
LV_PROFILER_END;
return t;
@ -324,7 +351,7 @@ uint32_t lv_draw_get_dependent_count(lv_draw_task_t * t_check)
lv_draw_task_t * t = t_check->next;
while(t) {
if((t->state == LV_DRAW_TASK_STATE_QUEUED || t->state == LV_DRAW_TASK_STATE_WAITING) &&
_lv_area_is_on(&t_check->area, &t->area)) {
lv_area_is_on(&t_check->area, &t->area)) {
cnt++;
}
@ -336,7 +363,7 @@ uint32_t lv_draw_get_dependent_count(lv_draw_task_t * t_check)
lv_layer_t * lv_draw_layer_create(lv_layer_t * parent_layer, lv_color_format_t color_format, const lv_area_t * area)
{
lv_display_t * disp = _lv_refr_get_disp_refreshing();
lv_display_t * disp = lv_refr_get_disp_refreshing();
lv_layer_t * new_layer = lv_malloc_zeroed(sizeof(lv_layer_t));
LV_ASSERT_MALLOC(new_layer);
if(new_layer == NULL) return NULL;
@ -344,8 +371,13 @@ lv_layer_t * lv_draw_layer_create(lv_layer_t * parent_layer, lv_color_format_t c
new_layer->parent = parent_layer;
new_layer->_clip_area = *area;
new_layer->buf_area = *area;
new_layer->phy_clip_area = *area;
new_layer->color_format = color_format;
#if LV_DRAW_TRANSFORM_USE_MATRIX
lv_matrix_identity(&new_layer->matrix);
#endif
if(disp->layer_head) {
lv_layer_t * tail = disp->layer_head;
while(tail->next) tail = tail->next;
@ -392,6 +424,21 @@ void * lv_draw_layer_go_to_xy(lv_layer_t * layer, int32_t x, int32_t y)
return lv_draw_buf_goto_xy(layer->draw_buf, x, y);
}
lv_draw_task_type_t lv_draw_task_get_type(const lv_draw_task_t * t)
{
return t->type;
}
void * lv_draw_task_get_draw_dsc(const lv_draw_task_t * t)
{
return t->draw_dsc;
}
void lv_draw_task_get_area(const lv_draw_task_t * t, lv_area_t * area)
{
*area = t->area;
}
/**********************
* STATIC FUNCTIONS
**********************/
@ -411,7 +458,7 @@ static bool is_independent(lv_layer_t * layer, lv_draw_task_t * t_check)
while(t && t != t_check) {
if(t->state != LV_DRAW_TASK_STATE_READY) {
lv_area_t a;
if(_lv_area_intersect(&a, &t->_real_area, &t_check->_real_area)) {
if(lv_area_intersect(&a, &t->_real_area, &t_check->_real_area)) {
LV_PROFILER_END;
return false;
}

View File

@ -3,6 +3,10 @@
*
*/
/**
* Modified by NXP in 2024
*/
#ifndef LV_DRAW_H
#define LV_DRAW_H
@ -19,6 +23,7 @@ extern "C" {
#include "../misc/lv_style.h"
#include "../misc/lv_text.h"
#include "../misc/lv_profiler.h"
#include "../misc/lv_matrix.h"
#include "lv_image_decoder.h"
#include "../osal/lv_os.h"
#include "lv_draw_buf.h"
@ -26,13 +31,21 @@ extern "C" {
/*********************
* DEFINES
*********************/
#define LV_DRAW_UNIT_ID_ANY 0
#define LV_DRAW_UNIT_NONE 0
#define LV_DRAW_UNIT_IDLE -1 /**< The draw unit is idle, new dispatching might be requested to try again */
#if LV_DRAW_TRANSFORM_USE_MATRIX
#if !LV_USE_MATRIX
#error "LV_DRAW_TRANSFORM_USE_MATRIX requires LV_USE_MATRIX = 1"
#endif
#endif
/**********************
* TYPEDEFS
**********************/
typedef enum {
LV_DRAW_TASK_TYPE_NONE = 0,
LV_DRAW_TASK_TYPE_FILL,
LV_DRAW_TASK_TYPE_BORDER,
LV_DRAW_TASK_TYPE_BOX_SHADOW,
@ -54,97 +67,7 @@ typedef enum {
LV_DRAW_TASK_STATE_READY,
} lv_draw_task_state_t;
struct _lv_draw_task_t {
lv_draw_task_t * next;
lv_draw_task_type_t type;
/**
* The area where to draw
*/
lv_area_t area;
/**
* The real draw area. E.g. for shadow, outline, or transformed images it's different from `area`
*/
lv_area_t _real_area;
/** The original area which is updated*/
lv_area_t clip_area_original;
/**
* The clip area of the layer is saved here when the draw task is created.
* As the clip area of the layer can be changed as new draw tasks are added its current value needs to be saved.
* Therefore during drawing the layer's clip area shouldn't be used as it might be already changed for other draw tasks.
*/
lv_area_t clip_area;
volatile int state; /*int instead of lv_draw_task_state_t to be sure its atomic*/
void * draw_dsc;
/**
* The ID of the draw_unit which should take this task
*/
uint8_t preferred_draw_unit_id;
/**
* Set to which extent `preferred_draw_unit_id` is good at this task.
* 80: means 20% better (faster) than software rendering
* 100: the default value
* 110: means 10% worse (slower) than software rendering
*/
uint8_t preference_score;
};
typedef struct {
void * user_data;
} lv_draw_mask_t;
struct _lv_draw_unit_t {
lv_draw_unit_t * next;
/**
* The target_layer on which drawing should happen
*/
lv_layer_t * target_layer;
const lv_area_t * clip_area;
/**
* Called to try to assign a draw task to itself.
* `lv_draw_get_next_available_task` can be used to get an independent draw task.
* A draw task should be assign only if the draw unit can draw it too
* @param draw_unit pointer to the draw unit
* @param layer pointer to a layer on which the draw task should be drawn
* @return >=0: The number of taken draw task:
* 0 means the task has not yet been completed.
* 1 means a new task has been accepted.
* -1: The draw unit wanted to work on a task but couldn't do that
* due to some errors (e.g. out of memory).
* It signals that LVGL should call the dispatcher later again
* to let draw unit try to start the rendering again.
*/
int32_t (*dispatch_cb)(lv_draw_unit_t * draw_unit, lv_layer_t * layer);
/**
*
* @param draw_unit
* @param task
* @return
*/
int32_t (*evaluate_cb)(lv_draw_unit_t * draw_unit, lv_draw_task_t * task);
/**
* Called to delete draw unit.
* @param draw_unit
* @return
*/
int32_t (*delete_cb)(lv_draw_unit_t * draw_unit);
};
struct _lv_layer_t {
struct lv_layer_t {
/** Target draw buffer of the layer*/
lv_draw_buf_t * draw_buf;
@ -165,6 +88,16 @@ struct _lv_layer_t {
*/
lv_area_t _clip_area;
/**
* The physical clipping area relative to the display.
*/
lv_area_t phy_clip_area;
#if LV_DRAW_TRANSFORM_USE_MATRIX
/** Transform matrix to be applied when rendering the layer */
lv_matrix_t matrix;
#endif
/** Linked list of draw tasks */
lv_draw_task_t * draw_task_head;
@ -176,7 +109,7 @@ struct _lv_layer_t {
typedef struct {
lv_obj_t * obj;
uint32_t part;
lv_part_t part;
uint32_t id1;
uint32_t id2;
lv_layer_t * layer;
@ -184,18 +117,6 @@ typedef struct {
void * user_data;
} lv_draw_dsc_base_t;
typedef struct {
lv_draw_unit_t * unit_head;
uint32_t used_memory_for_layers_kb;
#if LV_USE_OS
lv_thread_sync_t sync;
#else
int dispatch_req;
#endif
lv_mutex_t circle_cache_mutex;
bool task_running;
} lv_draw_global_info_t;
/**********************
* GLOBAL PROTOTYPES
**********************/
@ -231,7 +152,7 @@ lv_draw_task_t * lv_draw_add_task(lv_layer_t * layer, const lv_area_t * coords);
* It will send an event about the new draw task to the widget
* and assign it to a draw unit.
* @param layer pointer to a layer
* @param t poinr to a draw task
* @param t pointer to a draw task
*/
void lv_draw_finalize_task_creation(lv_layer_t * layer, lv_draw_task_t * t);
@ -254,24 +175,35 @@ bool lv_draw_dispatch_layer(lv_display_t * disp, lv_layer_t * layer);
*/
void lv_draw_dispatch_wait_for_request(void);
/**
* Wait for draw finish in case of asynchronous task execution.
* If `LV_USE_OS == 0` it just return.
*/
void lv_draw_wait_for_finish(void);
/**
* When a draw unit finished a draw task it needs to request dispatching
* to let LVGL assign a new draw task to it
*/
void lv_draw_dispatch_request(void);
/**
* Get the total number of draw units.
*/
uint32_t lv_draw_get_unit_count(void);
/**
* Find and available draw task
* @param layer the draw ctx to search in
* @param t_prev continue searching from this task
* @param draw_unit_id check the task where `preferred_draw_unit_id` equals this value or `LV_DRAW_UNIT_ID_ANY`
* @param draw_unit_id check the task where `preferred_draw_unit_id` equals this value or `LV_DRAW_UNIT_NONE`
* @return tan available draw task or NULL if there is no any
*/
lv_draw_task_t * lv_draw_get_next_available_task(lv_layer_t * layer, lv_draw_task_t * t_prev, uint8_t draw_unit_id);
/**
* Tell how many draw task are waiting to be drawn on the area of `t_check`.
* It can be used to determine if a GPU shall combine many draw tasks in to one or not.
* It can be used to determine if a GPU shall combine many draw tasks into one or not.
* If a lot of tasks are waiting for the current ones it makes sense to draw them one-by-one
* to not block the dependent tasks' rendering
* @param t_check the task whose dependent tasks shall be counted
@ -304,6 +236,27 @@ void * lv_draw_layer_alloc_buf(lv_layer_t * layer);
*/
void * lv_draw_layer_go_to_xy(lv_layer_t * layer, int32_t x, int32_t y);
/**
* Get the type of a draw task
* @param t the draw task to get the type of
* @return the draw task type
*/
lv_draw_task_type_t lv_draw_task_get_type(const lv_draw_task_t * t);
/**
* Get the draw descriptor of a draw task
* @param t the draw task to get the draw descriptor of
* @return a void pointer to the draw descriptor
*/
void * lv_draw_task_get_draw_dsc(const lv_draw_task_t * t);
/**
* Get the draw area of a draw task
* @param t the draw task to get the draw area of
* @param area the destination where the draw area will be stored
*/
void lv_draw_task_get_area(const lv_draw_task_t * t, lv_area_t * area);
/**********************
* GLOBAL VARIABLES
**********************/
@ -312,17 +265,6 @@ void * lv_draw_layer_go_to_xy(lv_layer_t * layer, int32_t x, int32_t y);
* MACROS
**********************/
/**********************
* POST INCLUDES
*********************/
#include "lv_draw_rect.h"
#include "lv_draw_label.h"
#include "lv_draw_image.h"
#include "lv_draw_arc.h"
#include "lv_draw_line.h"
#include "lv_draw_triangle.h"
#include "lv_draw_mask.h"
#ifdef __cplusplus
} /*extern "C"*/
#endif

View File

@ -6,6 +6,7 @@
/*********************
* INCLUDES
*********************/
#include "lv_draw_private.h"
#include "../core/lv_obj.h"
#include "lv_draw_arc.h"
#include "../core/lv_obj_event.h"
@ -41,6 +42,7 @@ void lv_draw_arc_dsc_init(lv_draw_arc_dsc_t * dsc)
dsc->width = 1;
dsc->opa = LV_OPA_COVER;
dsc->color = lv_color_black();
dsc->base.dsc_size = sizeof(lv_draw_arc_dsc_t);
}
lv_draw_arc_dsc_t * lv_draw_task_get_arc_dsc(lv_draw_task_t * task)

View File

@ -6,15 +6,19 @@
/*********************
* INCLUDES
*********************/
#include "lv_draw_buf_private.h"
#include "../misc/lv_types.h"
#include "lv_draw_buf.h"
#include "../stdlib/lv_string.h"
#include "../core/lv_global.h"
#include "../misc/lv_math.h"
#include "../misc/lv_area_private.h"
/*********************
* DEFINES
*********************/
#define handlers LV_GLOBAL_DEFAULT()->draw_buf_handlers
#define default_handlers LV_GLOBAL_DEFAULT()->draw_buf_handlers
#define font_draw_buf_handlers LV_GLOBAL_DEFAULT()->font_draw_buf_handlers
#define image_cache_draw_buf_handlers LV_GLOBAL_DEFAULT()->image_cache_draw_buf_handlers
/**********************
* TYPEDEFS
@ -26,10 +30,12 @@
static void * buf_malloc(size_t size, lv_color_format_t color_format);
static void buf_free(void * buf);
static void * buf_align(void * buf, lv_color_format_t color_format);
static void * draw_buf_malloc(size_t size_bytes, lv_color_format_t color_format);
static void draw_buf_free(void * buf);
static void * draw_buf_malloc(const lv_draw_buf_handlers_t * handler, size_t size_bytes,
lv_color_format_t color_format);
static void draw_buf_free(const lv_draw_buf_handlers_t * handler, void * buf);
static uint32_t width_to_stride(uint32_t w, lv_color_format_t color_format);
static uint32_t _calculate_draw_buf_size(uint32_t w, uint32_t h, lv_color_format_t cf, uint32_t stride);
static void draw_buf_get_full_area(const lv_draw_buf_t * draw_buf, lv_area_t * full_area);
/**********************
* STATIC VARIABLES
@ -43,74 +49,132 @@ static uint32_t _calculate_draw_buf_size(uint32_t w, uint32_t h, lv_color_format
* GLOBAL FUNCTIONS
**********************/
void _lv_draw_buf_init_handlers(void)
void lv_draw_buf_init_handlers(void)
{
lv_memzero(&handlers, sizeof(lv_draw_buf_handlers_t));
handlers.buf_malloc_cb = buf_malloc;
handlers.buf_free_cb = buf_free;
handlers.align_pointer_cb = buf_align;
handlers.invalidate_cache_cb = NULL;
handlers.width_to_stride_cb = width_to_stride;
lv_draw_buf_init_with_default_handlers(&default_handlers);
lv_draw_buf_init_with_default_handlers(&font_draw_buf_handlers);
lv_draw_buf_init_with_default_handlers(&image_cache_draw_buf_handlers);
}
void lv_draw_buf_init_with_default_handlers(lv_draw_buf_handlers_t * handlers)
{
lv_draw_buf_handlers_init(handlers, buf_malloc, buf_free, buf_align, NULL, NULL, width_to_stride);
}
void lv_draw_buf_handlers_init(lv_draw_buf_handlers_t * handlers,
lv_draw_buf_malloc_cb buf_malloc_cb,
lv_draw_buf_free_cb buf_free_cb,
lv_draw_buf_align_cb align_pointer_cb,
lv_draw_buf_cache_operation_cb invalidate_cache_cb,
lv_draw_buf_cache_operation_cb flush_cache_cb,
lv_draw_buf_width_to_stride_cb width_to_stride_cb)
{
lv_memzero(handlers, sizeof(lv_draw_buf_handlers_t));
handlers->buf_malloc_cb = buf_malloc_cb;
handlers->buf_free_cb = buf_free_cb;
handlers->align_pointer_cb = align_pointer_cb;
handlers->invalidate_cache_cb = invalidate_cache_cb;
handlers->flush_cache_cb = flush_cache_cb;
handlers->width_to_stride_cb = width_to_stride_cb;
}
lv_draw_buf_handlers_t * lv_draw_buf_get_handlers(void)
{
return &handlers;
return &default_handlers;
}
uint32_t lv_draw_buf_width_to_stride(uint32_t w, lv_color_format_t color_format)
{
if(handlers.width_to_stride_cb) return handlers.width_to_stride_cb(w, color_format);
return lv_draw_buf_width_to_stride_ex(&default_handlers, w, color_format);
}
uint32_t lv_draw_buf_width_to_stride_ex(const lv_draw_buf_handlers_t * handlers, uint32_t w,
lv_color_format_t color_format)
{
if(handlers->width_to_stride_cb) return handlers->width_to_stride_cb(w, color_format);
else return 0;
}
void * lv_draw_buf_align(void * data, lv_color_format_t color_format)
{
if(handlers.align_pointer_cb) return handlers.align_pointer_cb(data, color_format);
return lv_draw_buf_align_ex(&default_handlers, data, color_format);
}
void * lv_draw_buf_align_ex(const lv_draw_buf_handlers_t * handlers, void * data, lv_color_format_t color_format)
{
if(handlers->align_pointer_cb) return handlers->align_pointer_cb(data, color_format);
else return NULL;
}
void lv_draw_buf_invalidate_cache(const lv_draw_buf_t * draw_buf, const lv_area_t * area)
{
if(handlers.invalidate_cache_cb) {
LV_ASSERT_NULL(draw_buf);
const lv_image_header_t * header = &draw_buf->header;
lv_area_t full;
if(area == NULL) {
full = (lv_area_t) {
0, 0, header->w - 1, header->h - 1
};
area = &full;
}
handlers.invalidate_cache_cb(draw_buf, area);
LV_ASSERT_NULL(draw_buf);
LV_ASSERT_NULL(draw_buf->handlers);
const lv_draw_buf_handlers_t * handlers = draw_buf->handlers;
if(!handlers->invalidate_cache_cb) {
return;
}
lv_area_t full;
if(area == NULL) {
draw_buf_get_full_area(draw_buf, &full);
area = &full;
}
handlers->invalidate_cache_cb(draw_buf, area);
}
void lv_draw_buf_flush_cache(const lv_draw_buf_t * draw_buf, const lv_area_t * area)
{
LV_ASSERT_NULL(draw_buf);
LV_ASSERT_NULL(draw_buf->handlers);
const lv_draw_buf_handlers_t * handlers = draw_buf->handlers;
if(!handlers->flush_cache_cb) {
return;
}
lv_area_t full;
if(area == NULL) {
draw_buf_get_full_area(draw_buf, &full);
area = &full;
}
handlers->flush_cache_cb(draw_buf, area);
}
void lv_draw_buf_clear(lv_draw_buf_t * draw_buf, const lv_area_t * a)
{
LV_ASSERT_NULL(draw_buf);
if(a && lv_area_get_width(a) < 0) return;
if(a && lv_area_get_height(a) < 0) return;
const lv_image_header_t * header = &draw_buf->header;
uint32_t stride = header->stride;
if(a == NULL) {
lv_memzero(draw_buf->data, header->h * stride);
uint8_t * buf = lv_draw_buf_goto_xy(draw_buf, 0, 0);
lv_memzero(buf, header->h * stride);
return;
}
else {
uint8_t * bufc;
uint32_t line_length;
int32_t start_y, end_y;
uint8_t px_size = lv_color_format_get_size(header->cf);
bufc = lv_draw_buf_goto_xy(draw_buf, a->x1, a->y1);
line_length = lv_area_get_width(a) * px_size;
start_y = a->y1;
end_y = a->y2;
for(; start_y <= end_y; start_y++) {
lv_memzero(bufc, line_length);
bufc += stride;
}
lv_area_t a_draw_buf;
a_draw_buf.x1 = 0;
a_draw_buf.y1 = 0;
a_draw_buf.x2 = draw_buf->header.w - 1;
a_draw_buf.y2 = draw_buf->header.h - 1;
lv_area_t a_clipped;
if(!lv_area_intersect(&a_clipped, a, &a_draw_buf)) return;
if(lv_area_get_width(&a_clipped) <= 0) return;
if(lv_area_get_height(&a_clipped) <= 0) return;
uint8_t * buf = lv_draw_buf_goto_xy(draw_buf, a_clipped.x1, a_clipped.y1);
uint8_t bpp = lv_color_format_get_bpp(header->cf);
uint32_t line_length = (lv_area_get_width(&a_clipped) * bpp + 7) >> 3;
int32_t y;
for(y = a_clipped.y1; y <= a_clipped.y2; y++) {
lv_memzero(buf, line_length);
buf += stride;
}
}
@ -191,16 +255,23 @@ lv_result_t lv_draw_buf_init(lv_draw_buf_t * draw_buf, uint32_t w, uint32_t h, l
header->flags = 0;
header->magic = LV_IMAGE_HEADER_MAGIC;
draw_buf->data = lv_draw_buf_align(data, cf);
draw_buf->data = data;
draw_buf->unaligned_data = data;
draw_buf->handlers = &default_handlers;
draw_buf->data_size = data_size;
if(draw_buf->data != draw_buf->unaligned_data) {
if(lv_draw_buf_align(data, cf) != draw_buf->unaligned_data) {
LV_LOG_WARN("Data is not aligned, ignored");
}
return LV_RESULT_OK;
}
lv_draw_buf_t * lv_draw_buf_create(uint32_t w, uint32_t h, lv_color_format_t cf, uint32_t stride)
{
return lv_draw_buf_create_ex(&default_handlers, w, h, cf, stride);
}
lv_draw_buf_t * lv_draw_buf_create_ex(const lv_draw_buf_handlers_t * handlers, uint32_t w, uint32_t h,
lv_color_format_t cf, uint32_t stride)
{
lv_draw_buf_t * draw_buf = lv_malloc_zeroed(sizeof(lv_draw_buf_t));
LV_ASSERT_MALLOC(draw_buf);
@ -209,7 +280,7 @@ lv_draw_buf_t * lv_draw_buf_create(uint32_t w, uint32_t h, lv_color_format_t cf,
uint32_t size = _calculate_draw_buf_size(w, h, cf, stride);
void * buf = draw_buf_malloc(size, cf);
void * buf = draw_buf_malloc(handlers, size, cf);
/*Do not assert here as LVGL or the app might just want to try creating a draw_buf*/
if(buf == NULL) {
LV_LOG_WARN("No memory: %"LV_PRIu32"x%"LV_PRIu32", cf: %d, stride: %"LV_PRIu32", %"LV_PRIu32"Byte, ",
@ -227,13 +298,19 @@ lv_draw_buf_t * lv_draw_buf_create(uint32_t w, uint32_t h, lv_color_format_t cf,
draw_buf->data = lv_draw_buf_align(buf, cf);
draw_buf->unaligned_data = buf;
draw_buf->data_size = size;
draw_buf->handlers = handlers;
return draw_buf;
}
lv_draw_buf_t * lv_draw_buf_dup(const lv_draw_buf_t * draw_buf)
{
return lv_draw_buf_dup_ex(&default_handlers, draw_buf);
}
lv_draw_buf_t * lv_draw_buf_dup_ex(const lv_draw_buf_handlers_t * handlers, const lv_draw_buf_t * draw_buf)
{
const lv_image_header_t * header = &draw_buf->header;
lv_draw_buf_t * new_buf = lv_draw_buf_create(header->w, header->h, header->cf, header->stride);
lv_draw_buf_t * new_buf = lv_draw_buf_create_ex(handlers, header->w, header->h, header->cf, header->stride);
if(new_buf == NULL) return NULL;
new_buf->header.flags = draw_buf->header.flags;
@ -271,14 +348,17 @@ lv_draw_buf_t * lv_draw_buf_reshape(lv_draw_buf_t * draw_buf, lv_color_format_t
return draw_buf;
}
void lv_draw_buf_destroy(lv_draw_buf_t * buf)
void lv_draw_buf_destroy(lv_draw_buf_t * draw_buf)
{
LV_ASSERT_NULL(buf);
if(buf == NULL) return;
LV_ASSERT_NULL(draw_buf);
if(draw_buf == NULL) return;
if(buf->header.flags & LV_IMAGE_FLAGS_ALLOCATED) {
draw_buf_free(buf->unaligned_data);
lv_free(buf);
if(draw_buf->header.flags & LV_IMAGE_FLAGS_ALLOCATED) {
LV_ASSERT_NULL(draw_buf->handlers);
const lv_draw_buf_handlers_t * handlers = draw_buf->handlers;
draw_buf_free(handlers, draw_buf->unaligned_data);
lv_free(draw_buf);
}
else {
LV_LOG_ERROR("draw buffer is not allocated, ignored");
@ -298,7 +378,7 @@ void * lv_draw_buf_goto_xy(const lv_draw_buf_t * buf, uint32_t x, uint32_t y)
if(x == 0) return data;
return data + x * lv_color_format_get_size(buf->header.cf);
return data + x * lv_color_format_get_bpp(buf->header.cf) / 8;
}
lv_result_t lv_draw_buf_adjust_stride(lv_draw_buf_t * src, uint32_t stride)
@ -312,6 +392,10 @@ lv_result_t lv_draw_buf_adjust_stride(lv_draw_buf_t * src, uint32_t stride)
uint32_t w = header->w;
uint32_t h = header->h;
if(!lv_draw_buf_has_flag(src, LV_IMAGE_FLAGS_MODIFIABLE)) {
return LV_RESULT_INVALID;
}
/*Use global stride*/
if(stride == 0) stride = lv_draw_buf_width_to_stride(w, header->cf);
@ -448,8 +532,52 @@ void lv_draw_buf_set_palette(lv_draw_buf_t * draw_buf, uint8_t index, lv_color32
return;
}
uint8_t * buf = (uint8_t *)draw_buf->data;
lv_memcpy(&buf[index * sizeof(color)], &color, sizeof(color));
lv_color32_t * palette = (lv_color32_t *)draw_buf->data;
palette[index] = color;
}
bool lv_draw_buf_has_flag(lv_draw_buf_t * draw_buf, lv_image_flags_t flag)
{
return draw_buf->header.flags & flag;
}
void lv_draw_buf_set_flag(lv_draw_buf_t * draw_buf, lv_image_flags_t flag)
{
draw_buf->header.flags |= flag;
}
void lv_draw_buf_clear_flag(lv_draw_buf_t * draw_buf, lv_image_flags_t flag)
{
draw_buf->header.flags &= ~flag;
}
void lv_draw_buf_from_image(lv_draw_buf_t * buf, const lv_image_dsc_t * img)
{
lv_draw_buf_init(buf, img->header.w, img->header.h, img->header.cf, img->header.stride,
(void *)img->data, img->data_size);
buf->header.flags = img->header.flags;
}
void lv_draw_buf_to_image(const lv_draw_buf_t * buf, lv_image_dsc_t * img)
{
lv_memcpy((void *)img, buf, sizeof(lv_image_dsc_t));
}
void lv_image_buf_set_palette(lv_image_dsc_t * dsc, uint8_t id, lv_color32_t c)
{
LV_LOG_WARN("Deprecated API, use lv_draw_buf_set_palette instead.");
lv_draw_buf_set_palette((lv_draw_buf_t *)dsc, id, c);
}
void lv_image_buf_free(lv_image_dsc_t * dsc)
{
LV_LOG_WARN("Deprecated API, use lv_draw_buf_destroy instead.");
if(dsc != NULL) {
if(dsc->data != NULL)
lv_free((void *)dsc->data);
lv_free((void *)dsc);
}
}
/**********************
@ -476,8 +604,7 @@ static void * buf_align(void * buf, lv_color_format_t color_format)
uint8_t * buf_u8 = buf;
if(buf_u8) {
buf_u8 += LV_DRAW_BUF_ALIGN - 1;
buf_u8 = (uint8_t *)((lv_uintptr_t) buf_u8 & ~(LV_DRAW_BUF_ALIGN - 1));
buf_u8 = (uint8_t *)LV_ROUND_UP((lv_uintptr_t)buf_u8, LV_DRAW_BUF_ALIGN);
}
return buf_u8;
}
@ -487,18 +614,21 @@ static uint32_t width_to_stride(uint32_t w, lv_color_format_t color_format)
uint32_t width_byte;
width_byte = w * lv_color_format_get_bpp(color_format);
width_byte = (width_byte + 7) >> 3; /*Round up*/
return (width_byte + LV_DRAW_BUF_STRIDE_ALIGN - 1) & ~(LV_DRAW_BUF_STRIDE_ALIGN - 1);
return LV_ROUND_UP(width_byte, LV_DRAW_BUF_STRIDE_ALIGN);
}
static void * draw_buf_malloc(size_t size_bytes, lv_color_format_t color_format)
static void * draw_buf_malloc(const lv_draw_buf_handlers_t * handlers, size_t size_bytes,
lv_color_format_t color_format)
{
if(handlers.buf_malloc_cb) return handlers.buf_malloc_cb(size_bytes, color_format);
if(handlers->buf_malloc_cb) return handlers->buf_malloc_cb(size_bytes, color_format);
else return NULL;
}
static void draw_buf_free(void * buf)
static void draw_buf_free(const lv_draw_buf_handlers_t * handlers, void * buf)
{
if(handlers.buf_free_cb) handlers.buf_free_cb(buf);
if(handlers->buf_free_cb)
handlers->buf_free_cb(buf);
}
/**
@ -521,3 +651,9 @@ static uint32_t _calculate_draw_buf_size(uint32_t w, uint32_t h, lv_color_format
return size;
}
static void draw_buf_get_full_area(const lv_draw_buf_t * draw_buf, lv_area_t * full_area)
{
const lv_image_header_t * header = &draw_buf->header;
lv_area_set(full_area, 0, 0, header->w - 1, header->h - 1);
}

View File

@ -13,6 +13,7 @@ extern "C" {
/*********************
* INCLUDES
*********************/
#include "../misc/lv_types.h"
#include "../misc/lv_area.h"
#include "../misc/lv_color.h"
#include "../stdlib/lv_string.h"
@ -22,39 +23,32 @@ extern "C" {
* DEFINES
*********************/
/*Use this value to let LVGL calculate stride automatically*/
/** Use this value to let LVGL calculate stride automatically */
#define LV_STRIDE_AUTO 0
LV_EXPORT_CONST_INT(LV_STRIDE_AUTO);
/**********************
* TYPEDEFS
**********************/
typedef struct {
lv_image_header_t header;
uint32_t data_size; /*Total buf size in bytes*/
uint8_t * data;
void * unaligned_data; /*Unaligned address of `data`, used internally by lvgl*/
} lv_draw_buf_t;
/**
* Stride alignment for draw buffers.
* It may vary between different color formats and hardware.
* Refine it to suit your needs.
*/
#define _LV_DRAW_BUF_STRIDE(w, cf) \
((((w) * LV_COLOR_FORMAT_GET_BPP(cf) + 7) / 8 + (LV_DRAW_BUF_STRIDE_ALIGN) - 1) & ~((LV_DRAW_BUF_STRIDE_ALIGN) - 1))
#define LV_DRAW_BUF_STRIDE(w, cf) \
LV_ROUND_UP(((w) * LV_COLOR_FORMAT_GET_BPP(cf) + 7) / 8, LV_DRAW_BUF_STRIDE_ALIGN)
#define _LV_DRAW_BUF_SIZE(w, h, cf) \
(_LV_DRAW_BUF_STRIDE(w, cf) * (h))
/** Allocate a slightly larger buffer, so we can adjust the start address to meet alignment */
#define LV_DRAW_BUF_SIZE(w, h, cf) \
(LV_DRAW_BUF_STRIDE(w, cf) * (h) + LV_DRAW_BUF_ALIGN + \
LV_COLOR_INDEXED_PALETTE_SIZE(cf) * sizeof(lv_color32_t))
/**
* Define a static draw buffer with the given width, height, and color format.
* Stride alignment is set to LV_DRAW_BUF_STRIDE_ALIGN.
*
* For platform that needs special buffer alignment, call LV_DRAW_BUF_INIT_STATIC.
*/
#define LV_DRAW_BUF_DEFINE(name, _w, _h, _cf) \
static uint8_t buf_##name[_LV_DRAW_BUF_SIZE(_w, _h, _cf)]; \
#define LV_DRAW_BUF_DEFINE_STATIC(name, _w, _h, _cf) \
static uint8_t buf_##name[LV_DRAW_BUF_SIZE(_w, _h, _cf)]; \
static lv_draw_buf_t name = { \
.header = { \
.magic = LV_IMAGE_HEADER_MAGIC, \
@ -62,7 +56,7 @@ typedef struct {
.flags = LV_IMAGE_FLAGS_MODIFIABLE, \
.w = (_w), \
.h = (_h), \
.stride = _LV_DRAW_BUF_STRIDE(_w, _cf), \
.stride = LV_DRAW_BUF_STRIDE(_w, _cf), \
.reserved_2 = 0, \
}, \
.data_size = sizeof(buf_##name), \
@ -70,32 +64,64 @@ typedef struct {
.unaligned_data = buf_##name, \
}
#define LV_DRAW_BUF_INIT_STATIC(name) \
do { \
lv_image_header_t * header = &name.header; \
lv_draw_buf_init(&name, header->w, header->h, header->cf, header->stride, buf_##name, sizeof(buf_##name)); \
lv_draw_buf_set_flag(&name, LV_IMAGE_FLAGS_MODIFIABLE); \
} while(0)
/**********************
* TYPEDEFS
**********************/
typedef void * (*lv_draw_buf_malloc_cb)(size_t size, lv_color_format_t color_format);
typedef void (*lv_draw_buf_free_cb)(void * draw_buf);
typedef void * (*lv_draw_buf_align_cb)(void * buf, lv_color_format_t color_format);
typedef void (*lv_draw_buf_invalidate_cache_cb)(const lv_draw_buf_t * draw_buf, const lv_area_t * area);
typedef void (*lv_draw_buf_cache_operation_cb)(const lv_draw_buf_t * draw_buf, const lv_area_t * area);
typedef uint32_t (*lv_draw_buf_width_to_stride_cb)(uint32_t w, lv_color_format_t color_format);
typedef struct {
lv_draw_buf_malloc_cb buf_malloc_cb;
lv_draw_buf_free_cb buf_free_cb;
lv_draw_buf_align_cb align_pointer_cb;
lv_draw_buf_invalidate_cache_cb invalidate_cache_cb;
lv_draw_buf_width_to_stride_cb width_to_stride_cb;
} lv_draw_buf_handlers_t;
struct lv_draw_buf_t {
lv_image_header_t header;
uint32_t data_size; /**< Total buf size in bytes */
uint8_t * data;
void * unaligned_data; /**< Unaligned address of `data`, used internally by lvgl */
const lv_draw_buf_handlers_t * handlers; /**< draw buffer alloc/free ops. */
};
/**********************
* GLOBAL PROTOTYPES
**********************/
/**
* Called internally to initialize the draw_buf_handlers in lv_global
* Initialize the draw buffer with the default handlers.
*
* @param handlers the draw buffer handlers to set
*/
void _lv_draw_buf_init_handlers(void);
void lv_draw_buf_init_with_default_handlers(lv_draw_buf_handlers_t * handlers);
/**
* Initialize the draw buffer with given handlers.
*
* @param handlers the draw buffer handlers to set
* @param buf_malloc_cb the callback to allocate memory for the buffer
* @param buf_free_cb the callback to free memory of the buffer
* @param align_pointer_cb the callback to align the buffer
* @param invalidate_cache_cb the callback to invalidate the cache of the buffer
* @param flush_cache_cb the callback to flush buffer
* @param width_to_stride_cb the callback to calculate the stride based on the width and color format
*/
void lv_draw_buf_handlers_init(lv_draw_buf_handlers_t * handlers,
lv_draw_buf_malloc_cb buf_malloc_cb,
lv_draw_buf_free_cb buf_free_cb,
lv_draw_buf_align_cb align_pointer_cb,
lv_draw_buf_cache_operation_cb invalidate_cache_cb,
lv_draw_buf_cache_operation_cb flush_cache_cb,
lv_draw_buf_width_to_stride_cb width_to_stride_cb);
/**
* Get the struct which holds the callbacks for draw buf management.
@ -112,6 +138,16 @@ lv_draw_buf_handlers_t * lv_draw_buf_get_handlers(void);
*/
void * lv_draw_buf_align(void * buf, lv_color_format_t color_format);
/**
* Align the address of a buffer with custom draw buffer handlers.
* The buffer needs to be large enough for the real data after alignment
* @param handlers the draw buffer handlers
* @param buf the data to align
* @param color_format the color format of the buffer
* @return the aligned buffer
*/
void * lv_draw_buf_align_ex(const lv_draw_buf_handlers_t * handlers, void * buf, lv_color_format_t color_format);
/**
* Invalidate the cache of the buffer
* @param draw_buf the draw buffer needs to be invalidated
@ -120,6 +156,14 @@ void * lv_draw_buf_align(void * buf, lv_color_format_t color_format);
*/
void lv_draw_buf_invalidate_cache(const lv_draw_buf_t * draw_buf, const lv_area_t * area);
/**
* Flush the cache of the buffer
* @param draw_buf the draw buffer needs to be flushed
* @param area the area to flush in the buffer,
* use NULL to flush the whole draw buffer address range
*/
void lv_draw_buf_flush_cache(const lv_draw_buf_t * draw_buf, const lv_area_t * area);
/**
* Calculate the stride in bytes based on a width and color format
* @param w the width in pixels
@ -128,6 +172,16 @@ void lv_draw_buf_invalidate_cache(const lv_draw_buf_t * draw_buf, const lv_area_
*/
uint32_t lv_draw_buf_width_to_stride(uint32_t w, lv_color_format_t color_format);
/**
* Calculate the stride in bytes based on a width and color format
* @param handlers the draw buffer handlers
* @param w the width in pixels
* @param color_format the color format
* @return the stride in bytes
*/
uint32_t lv_draw_buf_width_to_stride_ex(const lv_draw_buf_handlers_t * handlers, uint32_t w,
lv_color_format_t color_format);
/**
* Clear an area on the buffer
* @param draw_buf pointer to draw buffer
@ -136,7 +190,7 @@ uint32_t lv_draw_buf_width_to_stride(uint32_t w, lv_color_format_t color_format)
void lv_draw_buf_clear(lv_draw_buf_t * draw_buf, const lv_area_t * a);
/**
* Copy an area from a buffer to an other
* Copy an area from a buffer to another
* @param dest pointer to the destination draw buffer
* @param dest_area the area to copy from the destination buffer, if NULL, use the whole buffer
* @param src pointer to the source draw buffer
@ -163,7 +217,39 @@ void lv_draw_buf_copy(lv_draw_buf_t * dest, const lv_area_t * dest_area,
lv_draw_buf_t * lv_draw_buf_create(uint32_t w, uint32_t h, lv_color_format_t cf, uint32_t stride);
/**
* Initialize a draw buf with the given buffer and parameters.
* Note: Eventually, lv_draw_buf_malloc/free will be kept as private.
* For now, we use `create` to distinguish with malloc.
*
* Create an draw buf by allocating struct for `lv_draw_buf_t` and allocating a buffer for it
* that meets specified requirements.
*
* @param handlers the draw buffer handlers
* @param w the buffer width in pixels
* @param h the buffer height in pixels
* @param cf the color format for image
* @param stride the stride in bytes for image. Use 0 for automatic calculation based on
* w, cf, and global stride alignment configuration.
*/
lv_draw_buf_t * lv_draw_buf_create_ex(const lv_draw_buf_handlers_t * handlers, uint32_t w, uint32_t h,
lv_color_format_t cf, uint32_t stride);
/**
* Duplicate a draw buf with same image size, stride and color format. Copy the image data too.
* @param draw_buf the draw buf to duplicate
* @return the duplicated draw buf on success, NULL if failed
*/
lv_draw_buf_t * lv_draw_buf_dup(const lv_draw_buf_t * draw_buf);
/**
* Duplicate a draw buf with same image size, stride and color format. Copy the image data too.
* @param handlers the draw buffer handlers
* @param draw_buf the draw buf to duplicate
* @return the duplicated draw buf on success, NULL if failed
*/
lv_draw_buf_t * lv_draw_buf_dup_ex(const lv_draw_buf_handlers_t * handlers, const lv_draw_buf_t * draw_buf);
/**
* Initialize a draw buf with the given buffer and parameters. Clear draw buffer flag to zero.
* @param draw_buf the draw buf to initialize
* @param w the buffer width in pixels
* @param h the buffer height in pixels
@ -176,13 +262,6 @@ lv_draw_buf_t * lv_draw_buf_create(uint32_t w, uint32_t h, lv_color_format_t cf,
lv_result_t lv_draw_buf_init(lv_draw_buf_t * draw_buf, uint32_t w, uint32_t h, lv_color_format_t cf, uint32_t stride,
void * data, uint32_t data_size);
/**
* Duplicate a draw buf with same image size, stride and color format. Copy the image data too.
* @param draw_buf the draw buf to duplicate
* @return the duplicated draw buf on success, NULL if failed
*/
lv_draw_buf_t * lv_draw_buf_dup(const lv_draw_buf_t * draw_buf);
/**
* Keep using the existing memory, reshape the draw buffer to the given width and height.
* Return NULL if data_size is smaller than the required size.
@ -196,10 +275,12 @@ lv_draw_buf_t * lv_draw_buf_reshape(lv_draw_buf_t * draw_buf, lv_color_format_t
uint32_t stride);
/**
* Destroy a draw buf by free the actual buffer if it's marked as LV_IMAGE_FLAGS_ALLOCATED in header.
* Destroy a draw buf by freeing the actual buffer if it's marked as LV_IMAGE_FLAGS_ALLOCATED in header.
* Then free the lv_draw_buf_t struct.
*
* @param draw_buf the draw buffer to destroy
*/
void lv_draw_buf_destroy(lv_draw_buf_t * buf);
void lv_draw_buf_destroy(lv_draw_buf_t * draw_buf);
/**
* Return pointer to the buffer at the given coordinates
@ -223,36 +304,20 @@ lv_result_t lv_draw_buf_adjust_stride(lv_draw_buf_t * src, uint32_t stride);
*/
lv_result_t lv_draw_buf_premultiply(lv_draw_buf_t * draw_buf);
static inline bool lv_draw_buf_has_flag(lv_draw_buf_t * draw_buf, lv_image_flags_t flag)
{
return draw_buf->header.flags & flag;
}
bool lv_draw_buf_has_flag(lv_draw_buf_t * draw_buf, lv_image_flags_t flag);
static inline void lv_draw_buf_set_flag(lv_draw_buf_t * draw_buf, lv_image_flags_t flag)
{
draw_buf->header.flags |= flag;
}
void lv_draw_buf_set_flag(lv_draw_buf_t * draw_buf, lv_image_flags_t flag);
static inline void lv_draw_buf_clear_flag(lv_draw_buf_t * draw_buf, lv_image_flags_t flag)
{
draw_buf->header.flags &= ~flag;
}
void lv_draw_buf_clear_flag(lv_draw_buf_t * draw_buf, lv_image_flags_t flag);
/**
* As of now, draw buf share same definition as `lv_image_dsc_t`.
* And is interchangeable with `lv_image_dsc_t`.
*/
static inline void lv_draw_buf_from_image(lv_draw_buf_t * buf, const lv_image_dsc_t * img)
{
lv_memcpy(buf, img, sizeof(lv_image_dsc_t));
buf->unaligned_data = buf->data;
}
void lv_draw_buf_from_image(lv_draw_buf_t * buf, const lv_image_dsc_t * img);
static inline void lv_draw_buf_to_image(const lv_draw_buf_t * buf, lv_image_dsc_t * img)
{
lv_memcpy((void *)img, buf, sizeof(lv_image_dsc_t));
}
void lv_draw_buf_to_image(const lv_draw_buf_t * buf, lv_image_dsc_t * img);
/**
* Set the palette color of an indexed image. Valid only for `LV_COLOR_FORMAT_I1/2/4/8`
@ -269,26 +334,13 @@ void lv_draw_buf_set_palette(lv_draw_buf_t * draw_buf, uint8_t index, lv_color32
/**
* @deprecated Use lv_draw_buf_set_palette instead.
*/
static inline void lv_image_buf_set_palette(lv_image_dsc_t * dsc, uint8_t id, lv_color32_t c)
{
LV_LOG_WARN("Deprecated API, use lv_draw_buf_set_palette instead.");
lv_draw_buf_set_palette((lv_draw_buf_t *)dsc, id, c);
}
void lv_image_buf_set_palette(lv_image_dsc_t * dsc, uint8_t id, lv_color32_t c);
/**
* @deprecated Use lv_draw_buffer_create/destroy instead.
* Free the data pointer and dsc struct of an image.
*/
static inline void lv_image_buf_free(lv_image_dsc_t * dsc)
{
LV_LOG_WARN("Deprecated API, use lv_draw_buf_destroy instead.");
if(dsc != NULL) {
if(dsc->data != NULL)
lv_free((void *)dsc->data);
lv_free((void *)dsc);
}
}
void lv_image_buf_free(lv_image_dsc_t * dsc);
/**********************
* MACROS

View File

@ -0,0 +1,53 @@
/**
* @file lv_draw_buf_private.h
*
*/
#ifndef LV_DRAW_BUF_PRIVATE_H
#define LV_DRAW_BUF_PRIVATE_H
#ifdef __cplusplus
extern "C" {
#endif
/*********************
* INCLUDES
*********************/
#include "lv_draw_buf.h"
/*********************
* DEFINES
*********************/
/**********************
* TYPEDEFS
**********************/
struct lv_draw_buf_handlers_t {
lv_draw_buf_malloc_cb buf_malloc_cb;
lv_draw_buf_free_cb buf_free_cb;
lv_draw_buf_align_cb align_pointer_cb;
lv_draw_buf_cache_operation_cb invalidate_cache_cb;
lv_draw_buf_cache_operation_cb flush_cache_cb;
lv_draw_buf_width_to_stride_cb width_to_stride_cb;
};
/**********************
* GLOBAL PROTOTYPES
**********************/
/**
* Called internally to initialize the draw_buf_handlers in lv_global
*/
void lv_draw_buf_init_handlers(void);
/**********************
* MACROS
**********************/
#ifdef __cplusplus
} /*extern "C"*/
#endif
#endif /*LV_DRAW_BUF_PRIVATE_H*/

View File

@ -6,7 +6,10 @@
/*********************
* INCLUDES
*********************/
#include "lv_draw_image.h"
#include "lv_draw_image_private.h"
#include "../misc/lv_area_private.h"
#include "lv_image_decoder_private.h"
#include "lv_draw_private.h"
#include "../display/lv_display.h"
#include "../misc/lv_log.h"
#include "../misc/lv_math.h"
@ -51,7 +54,7 @@ void lv_draw_image_dsc_init(lv_draw_image_dsc_t * dsc)
dsc->scale_x = LV_SCALE_NONE;
dsc->scale_y = LV_SCALE_NONE;
dsc->antialias = LV_COLOR_DEPTH > 8 ? 1 : 0;
dsc->original_area.x2 = LV_COORD_MIN; /*Indicate invalid area by default by setting a negative size*/
dsc->image_area.x2 = LV_COORD_MIN; /*Indicate invalid area by default by setting a negative size*/
dsc->base.dsc_size = sizeof(lv_draw_image_dsc_t);
}
@ -62,6 +65,11 @@ lv_draw_image_dsc_t * lv_draw_task_get_image_dsc(lv_draw_task_t * task)
void lv_draw_layer(lv_layer_t * layer, const lv_draw_image_dsc_t * dsc, const lv_area_t * coords)
{
if(dsc->scale_x <= 0 || dsc->scale_y <= 0) {
/* NOT draw if scale is negative or zero */
return;
}
lv_draw_task_t * t = lv_draw_add_task(layer, coords);
t->draw_dsc = lv_malloc(sizeof(*dsc));
@ -69,8 +77,8 @@ void lv_draw_layer(lv_layer_t * layer, const lv_draw_image_dsc_t * dsc, const lv
t->type = LV_DRAW_TASK_TYPE_LAYER;
t->state = LV_DRAW_TASK_STATE_WAITING;
_lv_image_buf_get_transformed_area(&t->_real_area, lv_area_get_width(coords), lv_area_get_height(coords),
dsc->rotation, dsc->scale_x, dsc->scale_y, &dsc->pivot);
lv_image_buf_get_transformed_area(&t->_real_area, lv_area_get_width(coords), lv_area_get_height(coords),
dsc->rotation, dsc->scale_x, dsc->scale_y, &dsc->pivot);
lv_area_move(&t->_real_area, coords->x1, coords->y1);
lv_layer_t * layer_to_draw = (lv_layer_t *)dsc->src;
@ -87,6 +95,11 @@ void lv_draw_image(lv_layer_t * layer, const lv_draw_image_dsc_t * dsc, const lv
}
if(dsc->opa <= LV_OPA_MIN) return;
if(dsc->scale_x <= 0 || dsc->scale_y <= 0) {
/* NOT draw if scale is negative or zero */
return;
}
LV_PROFILER_BEGIN;
lv_draw_image_dsc_t * new_image_dsc = lv_malloc(sizeof(*dsc));
@ -102,8 +115,8 @@ void lv_draw_image(lv_layer_t * layer, const lv_draw_image_dsc_t * dsc, const lv
t->draw_dsc = new_image_dsc;
t->type = LV_DRAW_TASK_TYPE_IMAGE;
_lv_image_buf_get_transformed_area(&t->_real_area, lv_area_get_width(coords), lv_area_get_height(coords),
dsc->rotation, dsc->scale_x, dsc->scale_y, &dsc->pivot);
lv_image_buf_get_transformed_area(&t->_real_area, lv_area_get_width(coords), lv_area_get_height(coords),
dsc->rotation, dsc->scale_x, dsc->scale_y, &dsc->pivot);
lv_area_move(&t->_real_area, coords->x1, coords->y1);
lv_draw_finalize_task_creation(layer, t);
@ -127,8 +140,8 @@ lv_image_src_t lv_image_src_get_type(const void * src)
}
}
void _lv_draw_image_normal_helper(lv_draw_unit_t * draw_unit, const lv_draw_image_dsc_t * draw_dsc,
const lv_area_t * coords, lv_draw_image_core_cb draw_core_cb)
void lv_draw_image_normal_helper(lv_draw_unit_t * draw_unit, const lv_draw_image_dsc_t * draw_dsc,
const lv_area_t * coords, lv_draw_image_core_cb draw_core_cb)
{
if(draw_core_cb == NULL) {
LV_LOG_WARN("draw_core_cb is NULL");
@ -141,8 +154,8 @@ void _lv_draw_image_normal_helper(lv_draw_unit_t * draw_unit, const lv_draw_imag
int32_t w = lv_area_get_width(coords);
int32_t h = lv_area_get_height(coords);
_lv_image_buf_get_transformed_area(&draw_area, w, h, draw_dsc->rotation, draw_dsc->scale_x, draw_dsc->scale_y,
&draw_dsc->pivot);
lv_image_buf_get_transformed_area(&draw_area, w, h, draw_dsc->rotation, draw_dsc->scale_x, draw_dsc->scale_y,
&draw_dsc->pivot);
draw_area.x1 += coords->x1;
draw_area.y1 += coords->y1;
@ -151,7 +164,7 @@ void _lv_draw_image_normal_helper(lv_draw_unit_t * draw_unit, const lv_draw_imag
}
lv_area_t clipped_img_area;
if(!_lv_area_intersect(&clipped_img_area, &draw_area, draw_unit->clip_area)) {
if(!lv_area_intersect(&clipped_img_area, &draw_area, draw_unit->clip_area)) {
return;
}
@ -167,8 +180,8 @@ void _lv_draw_image_normal_helper(lv_draw_unit_t * draw_unit, const lv_draw_imag
lv_image_decoder_close(&decoder_dsc);
}
void _lv_draw_image_tiled_helper(lv_draw_unit_t * draw_unit, const lv_draw_image_dsc_t * draw_dsc,
const lv_area_t * coords, lv_draw_image_core_cb draw_core_cb)
void lv_draw_image_tiled_helper(lv_draw_unit_t * draw_unit, const lv_draw_image_dsc_t * draw_dsc,
const lv_area_t * coords, lv_draw_image_core_cb draw_core_cb)
{
if(draw_core_cb == NULL) {
LV_LOG_WARN("draw_core_cb is NULL");
@ -185,7 +198,13 @@ void _lv_draw_image_tiled_helper(lv_draw_unit_t * draw_unit, const lv_draw_image
int32_t img_w = draw_dsc->header.w;
int32_t img_h = draw_dsc->header.h;
lv_area_t tile_area = *coords;
lv_area_t tile_area;
if(lv_area_get_width(&draw_dsc->image_area) >= 0) {
tile_area = draw_dsc->image_area;
}
else {
tile_area = *coords;
}
lv_area_set_width(&tile_area, img_w);
lv_area_set_height(&tile_area, img_h);
@ -198,11 +217,11 @@ void _lv_draw_image_tiled_helper(lv_draw_unit_t * draw_unit, const lv_draw_image
.y2 = LV_COORD_MIN,
};
while(tile_area.y1 <= draw_unit->clip_area->y2) {
while(tile_area.x1 <= draw_unit->clip_area->x2) {
while(tile_area.y1 <= coords->y2) {
while(tile_area.x1 <= coords->x2) {
lv_area_t clipped_img_area;
if(_lv_area_intersect(&clipped_img_area, &tile_area, draw_unit->clip_area)) {
if(lv_area_intersect(&clipped_img_area, &tile_area, coords)) {
img_decode_and_draw(draw_unit, draw_dsc, &decoder_dsc, &relative_decoded_area, &tile_area, &clipped_img_area,
draw_core_cb);
}
@ -220,8 +239,8 @@ void _lv_draw_image_tiled_helper(lv_draw_unit_t * draw_unit, const lv_draw_image
lv_image_decoder_close(&decoder_dsc);
}
void _lv_image_buf_get_transformed_area(lv_area_t * res, int32_t w, int32_t h, int32_t angle,
uint16_t scale_x, uint16_t scale_y, const lv_point_t * pivot)
void lv_image_buf_get_transformed_area(lv_area_t * res, int32_t w, int32_t h, int32_t angle,
uint16_t scale_x, uint16_t scale_y, const lv_point_t * pivot)
{
if(angle == 0 && scale_x == LV_SCALE_NONE && scale_y == LV_SCALE_NONE) {
res->x1 = 0;
@ -285,7 +304,7 @@ static void img_decode_and_draw(lv_draw_unit_t * draw_unit, const lv_draw_image_
if(res == LV_RESULT_OK) {
/*Limit draw area to the current decoded area and draw the image*/
lv_area_t clipped_img_area_sub;
if(_lv_area_intersect(&clipped_img_area_sub, clipped_img_area, &absolute_decoded_area)) {
if(lv_area_intersect(&clipped_img_area_sub, clipped_img_area, &absolute_decoded_area)) {
draw_core_cb(draw_unit, draw_dsc, decoder_dsc, &sup,
&absolute_decoded_area, &clipped_img_area_sub);
}

View File

@ -1,5 +1,5 @@
/**
* @file lv_draw_img.h
* @file lv_draw_image.h
*
*/
@ -26,17 +26,7 @@ extern "C" {
* MACROS
**********************/
/**********************
* TYPEDEFS
**********************/
typedef struct {
lv_color_t alpha_color;
const lv_color32_t * palette;
uint32_t palette_size : 9;
} lv_draw_image_sup_t;
typedef struct _lv_draw_image_dsc_t {
typedef struct lv_draw_image_dsc_t {
lv_draw_dsc_base_t base;
const void * src;
@ -59,9 +49,15 @@ typedef struct _lv_draw_image_dsc_t {
uint16_t tile : 1;
lv_draw_image_sup_t * sup;
/** Might be used to indicate the original size of the image if only a small portion is rendered now.
* Used when a part of a layer is rendered to show the total layer size*/
lv_area_t original_area;
/** Used to indicate the entire original, non-clipped area where the image is to be drawn.
* This is important for:
* 1. Layer rendering, where it might happen that only a smaller area of the layer is rendered.
* 2. Tiled images, where the target draw area is larger than the image to be tiled.
*/
lv_area_t image_area;
int32_t clip_radius;
const lv_image_dsc_t * bitmap_mask_src;
} lv_draw_image_dsc_t;
@ -100,14 +96,19 @@ lv_draw_image_dsc_t * lv_draw_task_get_image_dsc(lv_draw_task_t * task);
* @param layer pointer to a layer
* @param dsc pointer to an initialized draw descriptor
* @param coords the coordinates of the image
* @note `coords` can be small than the real image area
* (if only a part of the image is rendered)
* or can be larger (in case of tiled images). .
*/
void lv_draw_image(lv_layer_t * layer, const lv_draw_image_dsc_t * dsc, const lv_area_t * coords);
/**
* Create a draw task to blend a layer to an other layer
* Create a draw task to blend a layer to another layer
* @param layer pointer to a layer
* @param dsc pointer to an initialized draw descriptor
* @param coords the coordinates of the layer
* @param coords the coordinates of the layer.
* @note `coords` can be small than the total widget area from which the layer is created
* (if only a part of the widget was rendered to a layer)
*/
void lv_draw_layer(lv_layer_t * layer, const lv_draw_image_dsc_t * dsc, const lv_area_t * coords);
@ -121,41 +122,6 @@ void lv_draw_layer(lv_layer_t * layer, const lv_draw_image_dsc_t * dsc, const lv
*/
lv_image_src_t lv_image_src_get_type(const void * src);
/**
* Can be used by draw units to handle the decoding and
* prepare everything for the actual image rendering
* @param draw_unit pointer to a draw unit
* @param draw_dsc the draw descriptor of the image
* @param coords the absolute coordinates of the image
* @param draw_core_cb a callback to perform the actual rendering
*/
void _lv_draw_image_normal_helper(lv_draw_unit_t * draw_unit, const lv_draw_image_dsc_t * draw_dsc,
const lv_area_t * coords, lv_draw_image_core_cb draw_core_cb);
/**
* Can be used by draw units for TILED images to handle the decoding and
* prepare everything for the actual image rendering
* @param draw_unit pointer to a draw unit
* @param draw_dsc the draw descriptor of the image
* @param coords the absolute coordinates of the image
* @param draw_core_cb a callback to perform the actual rendering
*/
void _lv_draw_image_tiled_helper(lv_draw_unit_t * draw_unit, const lv_draw_image_dsc_t * draw_dsc,
const lv_area_t * coords, lv_draw_image_core_cb draw_core_cb);
/**
* Get the area of a rectangle if its rotated and scaled
* @param res store the coordinates here
* @param w width of the rectangle to transform
* @param h height of the rectangle to transform
* @param angle angle of rotation
* @param scale_x zoom in x direction, (256 no zoom)
* @param scale_y zoom in y direction, (256 no zoom)
* @param pivot x,y pivot coordinates of rotation
*/
void _lv_image_buf_get_transformed_area(lv_area_t * res, int32_t w, int32_t h, int32_t angle,
uint16_t scale_x, uint16_t scale_y, const lv_point_t * pivot);
#ifdef __cplusplus
} /*extern "C"*/
#endif

View File

@ -0,0 +1,85 @@
/**
* @file lv_draw_image_private.h
*
*/
#ifndef LV_DRAW_IMAGE_PRIVATE_H
#define LV_DRAW_IMAGE_PRIVATE_H
#ifdef __cplusplus
extern "C" {
#endif
/*********************
* INCLUDES
*********************/
#include "lv_draw_image.h"
/*********************
* DEFINES
*********************/
/**********************
* TYPEDEFS
**********************/
/**********************
* TYPEDEFS
**********************/
struct lv_draw_image_sup_t {
lv_color_t alpha_color;
const lv_color32_t * palette;
uint32_t palette_size : 9;
};
/**********************
* GLOBAL PROTOTYPES
**********************/
/**
* Can be used by draw units to handle the decoding and
* prepare everything for the actual image rendering
* @param draw_unit pointer to a draw unit
* @param draw_dsc the draw descriptor of the image
* @param coords the absolute coordinates of the image
* @param draw_core_cb a callback to perform the actual rendering
*/
void lv_draw_image_normal_helper(lv_draw_unit_t * draw_unit, const lv_draw_image_dsc_t * draw_dsc,
const lv_area_t * coords, lv_draw_image_core_cb draw_core_cb);
/**
* Can be used by draw units for TILED images to handle the decoding and
* prepare everything for the actual image rendering
* @param draw_unit pointer to a draw unit
* @param draw_dsc the draw descriptor of the image
* @param coords the absolute coordinates of the image
* @param draw_core_cb a callback to perform the actual rendering
*/
void lv_draw_image_tiled_helper(lv_draw_unit_t * draw_unit, const lv_draw_image_dsc_t * draw_dsc,
const lv_area_t * coords, lv_draw_image_core_cb draw_core_cb);
/**
* Get the area of a rectangle if its rotated and scaled
* @param res store the coordinates here
* @param w width of the rectangle to transform
* @param h height of the rectangle to transform
* @param angle angle of rotation
* @param scale_x zoom in x direction, (256 no zoom)
* @param scale_y zoom in y direction, (256 no zoom)
* @param pivot x,y pivot coordinates of rotation
*/
void lv_image_buf_get_transformed_area(lv_area_t * res, int32_t w, int32_t h, int32_t angle,
uint16_t scale_x, uint16_t scale_y, const lv_point_t * pivot);
/**********************
* MACROS
**********************/
#ifdef __cplusplus
} /*extern "C"*/
#endif
#endif /*LV_DRAW_IMAGE_PRIVATE_H*/

View File

@ -6,14 +6,20 @@
/*********************
* INCLUDES
*********************/
#include "lv_draw_label_private.h"
#include "lv_draw_private.h"
#include "../misc/lv_area_private.h"
#include "lv_draw_vector_private.h"
#include "lv_draw_rect_private.h"
#include "../core/lv_obj.h"
#include "lv_draw_label.h"
#include "../misc/lv_math.h"
#include "../core/lv_obj_event.h"
#include "../misc/lv_bidi.h"
#include "../misc/lv_bidi_private.h"
#include "../misc/lv_text_private.h"
#include "../misc/lv_assert.h"
#include "../stdlib/lv_mem.h"
#include "../stdlib/lv_string.h"
#include "../core/lv_global.h"
/*********************
* DEFINES
@ -21,6 +27,8 @@
#define LABEL_RECOLOR_PAR_LENGTH 6
#define LV_LABEL_HINT_UPDATE_TH 1024 /*Update the "hint" if the label's y coordinates have changed more then this*/
#define font_draw_buf_handlers &(LV_GLOBAL_DEFAULT()->font_draw_buf_handlers)
/**********************
* TYPEDEFS
**********************/
@ -107,7 +115,7 @@ void LV_ATTRIBUTE_FAST_MEM lv_draw_character(lv_layer_t * layer, lv_draw_label_d
return;
}
if(_lv_text_is_marker(unicode_letter)) return;
if(lv_text_is_marker(unicode_letter)) return;
LV_PROFILER_BEGIN;
@ -122,7 +130,7 @@ void LV_ATTRIBUTE_FAST_MEM lv_draw_character(lv_layer_t * layer, lv_draw_label_d
/*lv_draw_label needs UTF8 text so convert the Unicode character to an UTF8 string */
uint32_t letter_buf[2];
letter_buf[0] = _lv_text_unicode_to_encoded(unicode_letter);
letter_buf[0] = lv_text_unicode_to_encoded(unicode_letter);
letter_buf[1] = '\0';
const char * letter_buf_char = (const char *)letter_buf;
@ -146,7 +154,7 @@ void lv_draw_label_iterate_characters(lv_draw_unit_t * draw_unit, const lv_draw_
int32_t w;
lv_area_t clipped_area;
bool clip_ok = _lv_area_intersect(&clipped_area, coords, draw_unit->clip_area);
bool clip_ok = lv_area_intersect(&clipped_area, coords, draw_unit->clip_area);
if(!clip_ok) return;
lv_text_align_t align = dsc->align;
@ -198,14 +206,14 @@ void lv_draw_label_iterate_characters(lv_draw_unit_t * draw_unit, const lv_draw_
pos.y += dsc->hint->y;
}
uint32_t line_end = line_start + _lv_text_get_next_line(&dsc->text[line_start], font, dsc->letter_space, w, NULL,
dsc->flag);
uint32_t line_end = line_start + lv_text_get_next_line(&dsc->text[line_start], font, dsc->letter_space, w, NULL,
dsc->flag);
/*Go the first visible line*/
while(pos.y + line_height_font < draw_unit->clip_area->y1) {
/*Go to next line*/
line_start = line_end;
line_end += _lv_text_get_next_line(&dsc->text[line_start], font, dsc->letter_space, w, NULL, dsc->flag);
line_end += lv_text_get_next_line(&dsc->text[line_start], font, dsc->letter_space, w, NULL, dsc->flag);
pos.y += line_height;
/*Save at the threshold coordinate*/
@ -264,7 +272,7 @@ void lv_draw_label_iterate_characters(lv_draw_unit_t * draw_unit, const lv_draw_
#if LV_USE_BIDI
char * bidi_txt = lv_malloc(line_end - line_start + 1);
LV_ASSERT_MALLOC(bidi_txt);
_lv_bidi_process_paragraph(dsc->text + line_start, bidi_txt, line_end - line_start, base_dir, NULL, 0);
lv_bidi_process_paragraph(dsc->text + line_start, bidi_txt, line_end - line_start, base_dir, NULL, 0);
#else
const char * bidi_txt = dsc->text + line_start;
#endif
@ -273,17 +281,17 @@ void lv_draw_label_iterate_characters(lv_draw_unit_t * draw_unit, const lv_draw_
uint32_t logical_char_pos = 0;
if(sel_start != 0xFFFF && sel_end != 0xFFFF) {
#if LV_USE_BIDI
logical_char_pos = _lv_text_encoded_get_char_id(dsc->text, line_start);
uint32_t t = _lv_text_encoded_get_char_id(bidi_txt, i);
logical_char_pos += _lv_bidi_get_logical_pos(bidi_txt, NULL, line_end - line_start, base_dir, t, NULL);
logical_char_pos = lv_text_encoded_get_char_id(dsc->text, line_start);
uint32_t t = lv_text_encoded_get_char_id(bidi_txt, i);
logical_char_pos += lv_bidi_get_logical_pos(bidi_txt, NULL, line_end - line_start, base_dir, t, NULL);
#else
logical_char_pos = _lv_text_encoded_get_char_id(dsc->text, line_start + i);
logical_char_pos = lv_text_encoded_get_char_id(dsc->text, line_start + i);
#endif
}
uint32_t letter;
uint32_t letter_next;
_lv_text_encoded_letter_next_2(bidi_txt, &letter, &letter_next, &i);
lv_text_encoded_letter_next_2(bidi_txt, &letter, &letter_next, &i);
letter_w = lv_font_get_glyph_width(font, letter, letter_next);
@ -338,7 +346,7 @@ void lv_draw_label_iterate_characters(lv_draw_unit_t * draw_unit, const lv_draw_
#endif
/*Go to next line*/
line_start = line_end;
line_end += _lv_text_get_next_line(&dsc->text[line_start], font, dsc->letter_space, w, NULL, dsc->flag);
line_end += lv_text_get_next_line(&dsc->text[line_start], font, dsc->letter_space, w, NULL, dsc->flag);
pos.x = coords->x1;
/*Align to middle*/
@ -375,7 +383,7 @@ static void draw_letter(lv_draw_unit_t * draw_unit, lv_draw_glyph_dsc_t * dsc,
{
lv_font_glyph_dsc_t g;
if(_lv_text_is_marker(letter)) /*Markers are valid letters but should not be rendered.*/
if(lv_text_is_marker(letter)) /*Markers are valid letters but should not be rendered.*/
return;
LV_PROFILER_BEGIN;
@ -398,8 +406,8 @@ static void draw_letter(lv_draw_unit_t * draw_unit, lv_draw_glyph_dsc_t * dsc,
letter_coords.y2 = letter_coords.y1 + g.box_h - 1;
/*If the letter is completely out of mask don't draw it*/
if(_lv_area_is_out(&letter_coords, draw_unit->clip_area, 0) &&
_lv_area_is_out(dsc->bg_coords, draw_unit->clip_area, 0)) {
if(lv_area_is_out(&letter_coords, draw_unit->clip_area, 0) &&
lv_area_is_out(dsc->bg_coords, draw_unit->clip_area, 0)) {
LV_PROFILER_END;
return;
}
@ -414,14 +422,14 @@ static void draw_letter(lv_draw_unit_t * draw_unit, lv_draw_glyph_dsc_t * dsc,
uint32_t h = g.box_h;
if(h * g.box_w < 64) h *= 2; /*Alloc a slightly larger buffer*/
draw_buf = lv_draw_buf_create(g.box_w, h, LV_COLOR_FORMAT_A8, LV_STRIDE_AUTO);
draw_buf = lv_draw_buf_create_ex(font_draw_buf_handlers, g.box_w, h, LV_COLOR_FORMAT_A8, LV_STRIDE_AUTO);
LV_ASSERT_MALLOC(draw_buf);
draw_buf->header.h = g.box_h;
dsc->_draw_buf = draw_buf;
}
}
dsc->glyph_data = (void *)lv_font_get_glyph_bitmap(&g, letter, draw_buf);
dsc->glyph_data = (void *) lv_font_get_glyph_bitmap(&g, draw_buf);
dsc->format = dsc->glyph_data ? g.format : LV_FONT_GLYPH_FORMAT_NONE;
}
else {
@ -432,8 +440,7 @@ static void draw_letter(lv_draw_unit_t * draw_unit, lv_draw_glyph_dsc_t * dsc,
dsc->g = &g;
cb(draw_unit, dsc, NULL, NULL);
if(g.resolved_font && font->release_glyph) {
font->release_glyph(font, &g);
}
lv_font_glyph_release_draw_data(&g);
LV_PROFILER_END;
}

View File

@ -14,6 +14,7 @@ extern "C" {
* INCLUDES
*********************/
#include "lv_draw.h"
#include "lv_draw_rect.h"
#include "../misc/lv_bidi.h"
#include "../misc/lv_text.h"
#include "../misc/lv_color.h"
@ -28,23 +29,6 @@ extern "C" {
* TYPEDEFS
**********************/
/** Store some info to speed up drawing of very large texts
* It takes a lot of time to get the first visible character because
* all the previous characters needs to be checked to calculate the positions.
* This structure stores an earlier (e.g. at -1000 px) coordinate and the index of that line.
* Therefore the calculations can start from here.*/
typedef struct _lv_draw_label_hint_t {
/** Index of the line at `y` coordinate*/
int32_t line_start;
/** Give the `y` coordinate of the first letter at `line start` index. Relative to the label's coordinates*/
int32_t y;
/** The 'y1' coordinate of the label when the hint was saved.
* Used to invalidate the hint if the label has moved too much.*/
int32_t coord_y;
} lv_draw_label_hint_t;
typedef struct {
lv_draw_dsc_base_t base;
@ -72,17 +56,6 @@ typedef struct {
lv_draw_label_hint_t * hint;
} lv_draw_label_dsc_t;
typedef struct {
void * glyph_data; /*Depends on `format` field, it could be image source or draw buf of bitmap or vector data.*/
lv_font_glyph_format_t format;
const lv_area_t * letter_coords;
const lv_area_t * bg_coords;
const lv_font_glyph_dsc_t * g;
lv_color_t color;
lv_opa_t opa;
lv_draw_buf_t * _draw_buf; /*a shared draw buf for get_bitmap, do not use it directly, use glyph_data instead*/
} lv_draw_glyph_dsc_t;
/**
* Passed as a parameter to `lv_draw_label_iterate_characters` to
* draw the characters one by one

View File

@ -0,0 +1,68 @@
/**
* @file lv_draw_label_private.h
*
*/
#ifndef LV_DRAW_LABEL_PRIVATE_H
#define LV_DRAW_LABEL_PRIVATE_H
#ifdef __cplusplus
extern "C" {
#endif
/*********************
* INCLUDES
*********************/
#include "lv_draw_label.h"
/*********************
* DEFINES
*********************/
/**********************
* TYPEDEFS
**********************/
/** Store some info to speed up drawing of very large texts
* It takes a lot of time to get the first visible character because
* all the previous characters needs to be checked to calculate the positions.
* This structure stores an earlier (e.g. at -1000 px) coordinate and the index of that line.
* Therefore the calculations can start from here.*/
struct lv_draw_label_hint_t {
/** Index of the line at `y` coordinate*/
int32_t line_start;
/** Give the `y` coordinate of the first letter at `line start` index. Relative to the label's coordinates*/
int32_t y;
/** The 'y1' coordinate of the label when the hint was saved.
* Used to invalidate the hint if the label has moved too much.*/
int32_t coord_y;
};
struct lv_draw_glyph_dsc_t {
void * glyph_data; /**< Depends on `format` field, it could be image source or draw buf of bitmap or vector data. */
lv_font_glyph_format_t format;
const lv_area_t * letter_coords;
const lv_area_t * bg_coords;
const lv_font_glyph_dsc_t * g;
lv_color_t color;
lv_opa_t opa;
lv_draw_buf_t * _draw_buf; /**< a shared draw buf for get_bitmap, do not use it directly, use glyph_data instead */
};
/**********************
* GLOBAL PROTOTYPES
**********************/
/**********************
* MACROS
**********************/
#ifdef __cplusplus
} /*extern "C"*/
#endif
#endif /*LV_DRAW_LABEL_PRIVATE_H*/

View File

@ -6,9 +6,10 @@
/*********************
* INCLUDES
*********************/
#include <stdbool.h>
#include "lv_draw_private.h"
#include "../core/lv_refr.h"
#include "../misc/lv_math.h"
#include "../misc/lv_types.h"
#include "../stdlib/lv_string.h"
/*********************
@ -41,6 +42,7 @@ void LV_ATTRIBUTE_FAST_MEM lv_draw_line_dsc_init(lv_draw_line_dsc_t * dsc)
dsc->width = 1;
dsc->opa = LV_OPA_COVER;
dsc->color = lv_color_black();
dsc->base.dsc_size = sizeof(lv_draw_line_dsc_t);
}
lv_draw_line_dsc_t * lv_draw_task_get_line_dsc(lv_draw_task_t * task)
@ -50,6 +52,9 @@ lv_draw_line_dsc_t * lv_draw_task_get_line_dsc(lv_draw_task_t * task)
void LV_ATTRIBUTE_FAST_MEM lv_draw_line(lv_layer_t * layer, const lv_draw_line_dsc_t * dsc)
{
if(dsc->width == 0) return;
if(dsc->opa <= LV_OPA_MIN) return;
LV_PROFILER_BEGIN;
lv_area_t a;
a.x1 = (int32_t)LV_MIN(dsc->p1.x, dsc->p2.x) - dsc->width;

View File

@ -38,7 +38,7 @@ typedef struct {
lv_blend_mode_t blend_mode : 2;
uint8_t round_start : 1;
uint8_t round_end : 1;
uint8_t raw_end : 1; /*Do not bother with perpendicular line ending if it's not visible for any reason*/
uint8_t raw_end : 1; /**< Do not bother with perpendicular line ending if it's not visible for any reason */
} lv_draw_line_dsc_t;
/**********************

View File

@ -6,10 +6,11 @@
/*********************
* INCLUDES
*********************/
#include <stdbool.h>
#include "lv_draw_mask.h"
#include "lv_draw_mask_private.h"
#include "lv_draw_private.h"
#include "../core/lv_refr.h"
#include "../misc/lv_math.h"
#include "../misc/lv_types.h"
#include "../stdlib/lv_string.h"
/*********************

View File

@ -1,10 +1,10 @@
/**
* @file lv_draw_mask_rect.h
* @file lv_draw_mask.h
*
*/
#ifndef LV_DRAW_MASK_RECT_H
#define LV_DRAW_MASK_RECT_H
#ifndef LV_DRAW_MASK_H
#define LV_DRAW_MASK_H
#ifdef __cplusplus
extern "C" {
@ -13,7 +13,6 @@ extern "C" {
/*********************
* INCLUDES
*********************/
#include "lv_draw.h"
#include "../misc/lv_color.h"
#include "../misc/lv_area.h"
#include "../misc/lv_style.h"
@ -22,16 +21,6 @@ extern "C" {
* DEFINES
*********************/
/**********************
* TYPEDEFS
**********************/
typedef struct {
lv_draw_dsc_base_t base;
lv_area_t area;
int32_t radius;
} lv_draw_mask_rect_dsc_t;
/**********************
* GLOBAL PROTOTYPES
**********************/
@ -64,4 +53,4 @@ void lv_draw_mask_rect(lv_layer_t * layer, const lv_draw_mask_rect_dsc_t * dsc);
} /*extern "C"*/
#endif
#endif /*LV_DRAW_MASK_RECT_H*/
#endif /*LV_DRAW_MASK_H*/

View File

@ -0,0 +1,51 @@
/**
* @file lv_draw_mask_private.h
*
*/
#ifndef LV_DRAW_MASK_PRIVATE_H
#define LV_DRAW_MASK_PRIVATE_H
#ifdef __cplusplus
extern "C" {
#endif
/*********************
* INCLUDES
*********************/
#include "lv_draw_mask.h"
#include "lv_draw.h"
/*********************
* DEFINES
*********************/
/**********************
* TYPEDEFS
**********************/
/**********************
* TYPEDEFS
**********************/
struct lv_draw_mask_rect_dsc_t {
lv_draw_dsc_base_t base;
lv_area_t area;
int32_t radius;
};
/**********************
* GLOBAL PROTOTYPES
**********************/
/**********************
* MACROS
**********************/
#ifdef __cplusplus
} /*extern "C"*/
#endif
#endif /*LV_DRAW_MASK_PRIVATE_H*/

View File

@ -0,0 +1,196 @@
/**
* @file lv_draw_private.h
*
*/
/**
* Modified by NXP in 2024
*/
#ifndef LV_DRAW_PRIVATE_H
#define LV_DRAW_PRIVATE_H
#ifdef __cplusplus
extern "C" {
#endif
/*********************
* INCLUDES
*********************/
#include "lv_draw.h"
/*********************
* DEFINES
*********************/
/**********************
* TYPEDEFS
**********************/
struct lv_draw_task_t {
lv_draw_task_t * next;
lv_draw_task_type_t type;
/**
* The area where to draw
*/
lv_area_t area;
/**
* The real draw area. E.g. for shadow, outline, or transformed images it's different from `area`
*/
lv_area_t _real_area;
/** The original area which is updated*/
lv_area_t clip_area_original;
/**
* The clip area of the layer is saved here when the draw task is created.
* As the clip area of the layer can be changed as new draw tasks are added its current value needs to be saved.
* Therefore during drawing the layer's clip area shouldn't be used as it might be already changed for other draw tasks.
*/
lv_area_t clip_area;
#if LV_DRAW_TRANSFORM_USE_MATRIX
/** Transform matrix to be applied when rendering the layer */
lv_matrix_t matrix;
#endif
volatile int state; /** int instead of lv_draw_task_state_t to be sure its atomic */
void * draw_dsc;
/**
* The ID of the draw_unit which should take this task
*/
uint8_t preferred_draw_unit_id;
/**
* Set to which extent `preferred_draw_unit_id` is good at this task.
* 80: means 20% better (faster) than software rendering
* 100: the default value
* 110: means 10% worse (slower) than software rendering
*/
uint8_t preference_score;
};
struct lv_draw_mask_t {
void * user_data;
};
struct lv_draw_unit_t {
lv_draw_unit_t * next;
/**
* The target_layer on which drawing should happen
*/
lv_layer_t * target_layer;
const lv_area_t * clip_area;
/**
* Called to try to assign a draw task to itself.
* `lv_draw_get_next_available_task` can be used to get an independent draw task.
* A draw task should be assign only if the draw unit can draw it too
* @param draw_unit pointer to the draw unit
* @param layer pointer to a layer on which the draw task should be drawn
* @return >=0: The number of taken draw task:
* 0 means the task has not yet been completed.
* 1 means a new task has been accepted.
* -1: The draw unit wanted to work on a task but couldn't do that
* due to some errors (e.g. out of memory).
* It signals that LVGL should call the dispatcher later again
* to let draw unit try to start the rendering again.
*/
int32_t (*dispatch_cb)(lv_draw_unit_t * draw_unit, lv_layer_t * layer);
/**
*
* @param draw_unit
* @param task
* @return
*/
int32_t (*evaluate_cb)(lv_draw_unit_t * draw_unit, lv_draw_task_t * task);
/**
* Called to signal the unit to complete all tasks in order to return their ready status.
* This callback can be implemented in case of asynchronous task processing.
* Below is an example to show the difference between synchronous and asynchronous:
*
* Synchronous:
* LVGL thread DRAW thread HW
*
* task1 --> submit --> Receive task1
* wait_for_finish()
* <-- task1->state = READY <-- Complete task1
* task2 --> submit --> Receive task2
* wait_for_finish()
* task2->state = READY <-- Complete task2
* task3 --> submit --> Receive task3
* wait_for_finish()
* <-- task3->state = READY <-- Complete task3
* task4 --> submit --> Receive task4
* wait_for_finish()
* <-- task4->state = READY <-- Complete task4
* NO MORE TASKS
*
*
* Asynchronous:
* LVGL thread DRAW thread HW
* is IDLE
* task1 --> queue task1
* submit --> Receive task1
* task2 --> queue task2 is BUSY (with task1)
* task3 --> queue task3 still BUSY (with task1)
* task4 --> queue task4 becomes IDLE
* <-- task1->state = READY <-- Complete task1
* submit --> Receive task2, task3, task4
* NO MORE TASKS
* wait_for_finish_cb() wait_for_finish()
* <-- Complete task2, task3, task4
* <-- task2->state = READY <--
* <-- task3->state = READY <--
* <-- task4->state = READY <--
*
* @param draw_unit
* @return
*/
int32_t (*wait_for_finish_cb)(lv_draw_unit_t * draw_unit);
/**
* Called to delete draw unit.
* @param draw_unit
* @return
*/
int32_t (*delete_cb)(lv_draw_unit_t * draw_unit);
};
typedef struct {
lv_draw_unit_t * unit_head;
uint32_t unit_cnt;
uint32_t used_memory_for_layers_kb;
#if LV_USE_OS
lv_thread_sync_t sync;
#else
int dispatch_req;
#endif
lv_mutex_t circle_cache_mutex;
bool task_running;
} lv_draw_global_info_t;
/**********************
* GLOBAL PROTOTYPES
**********************/
/**********************
* MACROS
**********************/
#ifdef __cplusplus
} /*extern "C"*/
#endif
#endif /*LV_DRAW_PRIVATE_H*/

View File

@ -6,8 +6,9 @@
/*********************
* INCLUDES
*********************/
#include "lv_draw_rect_private.h"
#include "lv_draw_private.h"
#include "../core/lv_obj.h"
#include "lv_draw_rect.h"
#include "../misc/lv_assert.h"
#include "../core/lv_obj_event.h"
#include "../stdlib/lv_string.h"
@ -118,7 +119,10 @@ void lv_draw_rect(lv_layer_t * layer, const lv_draw_rect_dsc_t * dsc, const lv_a
if(dsc->bg_image_opa <= LV_OPA_MIN || dsc->bg_image_src == NULL) has_bg_img = false;
else has_bg_img = true;
if(dsc->border_opa <= LV_OPA_MIN || dsc->border_width == 0 || dsc->border_post == true) has_border = false;
if(dsc->border_opa <= LV_OPA_MIN
|| dsc->border_width == 0
|| dsc->border_post == true
|| dsc->border_side == LV_BORDER_SIDE_NONE) has_border = false;
else has_border = true;
if(dsc->outline_opa <= LV_OPA_MIN || dsc->outline_width == 0) has_outline = false;
@ -225,6 +229,7 @@ void lv_draw_rect(lv_layer_t * layer, const lv_draw_rect_dsc_t * dsc, const lv_a
bg_image_dsc->recolor_opa = dsc->bg_image_recolor_opa;
bg_image_dsc->tile = dsc->bg_image_tiled;
bg_image_dsc->header = header;
bg_image_dsc->clip_radius = dsc->radius;
t->type = LV_DRAW_TASK_TYPE_IMAGE;
lv_draw_finalize_task_creation(layer, t);
}

View File

@ -0,0 +1,39 @@
/**
* @file lv_draw_rect_private.h
*
*/
#ifndef LV_DRAW_RECT_PRIVATE_H
#define LV_DRAW_RECT_PRIVATE_H
#ifdef __cplusplus
extern "C" {
#endif
/*********************
* INCLUDES
*********************/
#include "lv_draw_rect.h"
/*********************
* DEFINES
*********************/
/**********************
* TYPEDEFS
**********************/
/**********************
* GLOBAL PROTOTYPES
**********************/
/**********************
* MACROS
**********************/
#ifdef __cplusplus
} /*extern "C"*/
#endif
#endif /*LV_DRAW_RECT_PRIVATE_H*/

View File

@ -6,8 +6,10 @@
/*********************
* INCLUDES
*********************/
#include "lv_draw_triangle_private.h"
#include "lv_draw_private.h"
#include "../core/lv_obj.h"
#include "lv_draw_triangle.h"
#include "../misc/lv_math.h"
#include "../stdlib/lv_mem.h"
#include "../stdlib/lv_string.h"
@ -46,6 +48,7 @@ void lv_draw_triangle_dsc_init(lv_draw_triangle_dsc_t * dsc)
dsc->bg_grad.stops[1].frac = 0xFF;
dsc->bg_grad.stops_count = 2;
dsc->bg_opa = LV_OPA_COVER;
dsc->base.dsc_size = sizeof(lv_draw_triangle_dsc_t);
LV_PROFILER_END;
}
@ -56,6 +59,8 @@ lv_draw_triangle_dsc_t * lv_draw_task_get_triangle_dsc(lv_draw_task_t * task)
void lv_draw_triangle(lv_layer_t * layer, const lv_draw_triangle_dsc_t * dsc)
{
if(dsc->bg_opa <= LV_OPA_MIN) return;
LV_PROFILER_BEGIN;
lv_area_t a;
a.x1 = (int32_t)LV_MIN3(dsc->p[0].x, dsc->p[1].x, dsc->p[2].x);

View File

@ -38,7 +38,7 @@ typedef struct {
/**
* Initialize a triangle draw descriptor
* @param dsc pointer to a draw descriptor
* @param draw_dsc pointer to a draw descriptor
*/
void lv_draw_triangle_dsc_init(lv_draw_triangle_dsc_t * draw_dsc);
@ -52,7 +52,7 @@ lv_draw_triangle_dsc_t * lv_draw_task_get_triangle_dsc(lv_draw_task_t * task);
/**
* Create a triangle draw task
* @param layer pointer to a layer
* @param dsc pointer to an initialized `lv_draw_triangle_dsc_t` variable
* @param draw_dsc pointer to an initialized `lv_draw_triangle_dsc_t` object
*/
void lv_draw_triangle(lv_layer_t * layer, const lv_draw_triangle_dsc_t * draw_dsc);

View File

@ -0,0 +1,43 @@
/**
* @file lv_draw_triangle_private.h
*
*/
#ifndef LV_DRAW_TRIANGLE_PRIVATE_H
#define LV_DRAW_TRIANGLE_PRIVATE_H
#ifdef __cplusplus
extern "C" {
#endif
/*********************
* INCLUDES
*********************/
#include "lv_draw_triangle.h"
/*********************
* DEFINES
*********************/
/**********************
* TYPEDEFS
**********************/
/**********************
* TYPEDEFS
**********************/
/**********************
* GLOBAL PROTOTYPES
**********************/
/**********************
* MACROS
**********************/
#ifdef __cplusplus
} /*extern "C"*/
#endif
#endif /*LV_DRAW_TRIANGLE_PRIVATE_H*/

View File

@ -4,15 +4,17 @@
*/
/*********************
* INCLUDES
* INCLUDES
*********************/
#include "lv_draw_vector.h"
#include "lv_draw_vector_private.h"
#include "../misc/lv_area_private.h"
#include "lv_draw_private.h"
#if LV_USE_VECTOR_GRAPHIC
#include "../misc/lv_ll.h"
#include "../misc/lv_types.h"
#include "../stdlib/lv_string.h"
#include <stdbool.h>
#include <math.h>
#include <float.h>
@ -23,10 +25,10 @@
#define RAD_TO_DEG 57.295779513082320876798154814105f
#define MATH_RADIANS(deg) ((deg) * DEG_TO_RAD)
#define MATH_DEGRESS(rad) ((rad) * RAD_TO_DEG)
#define MATH_DEGREES(rad) ((rad) * RAD_TO_DEG)
/*********************
* DEFINES
* DEFINES
*********************/
#ifndef M_PI
@ -44,59 +46,21 @@
} while(0)
/**********************
* TYPEDEFS
* TYPEDEFS
**********************/
typedef struct {
lv_vector_path_t * path;
lv_vector_draw_dsc_t dsc;
} _lv_vector_draw_task;
} lv_vector_draw_task;
/**********************
* STATIC PROTOTYPES
* STATIC PROTOTYPES
**********************/
static bool _is_identity_or_translation(const lv_matrix_t * matrix)
{
return (matrix->m[0][0] == 1.0f &&
matrix->m[0][1] == 0.0f &&
matrix->m[1][0] == 0.0f &&
matrix->m[1][1] == 1.0f &&
matrix->m[2][0] == 0.0f &&
matrix->m[2][1] == 0.0f &&
matrix->m[2][2] == 1.0f);
}
static void _multiply_matrix(lv_matrix_t * matrix, const lv_matrix_t * mul)
{
/*TODO: use NEON to optimize this function on ARM architecture.*/
lv_matrix_t tmp;
for(int y = 0; y < 3; y++) {
for(int x = 0; x < 3; x++) {
tmp.m[y][x] = (matrix->m[y][0] * mul->m[0][x])
+ (matrix->m[y][1] * mul->m[1][x])
+ (matrix->m[y][2] * mul->m[2][x]);
}
}
lv_memcpy(matrix, &tmp, sizeof(lv_matrix_t));
}
static void _copy_draw_dsc(lv_vector_draw_dsc_t * dst, const lv_vector_draw_dsc_t * src)
{
dst->fill_dsc.style = src->fill_dsc.style;
dst->fill_dsc.color = src->fill_dsc.color;
dst->fill_dsc.opa = src->fill_dsc.opa;
dst->fill_dsc.fill_rule = src->fill_dsc.fill_rule;
dst->fill_dsc.gradient.style = src->fill_dsc.gradient.style;
dst->fill_dsc.gradient.cx = src->fill_dsc.gradient.cx;
dst->fill_dsc.gradient.cy = src->fill_dsc.gradient.cy;
dst->fill_dsc.gradient.cr = src->fill_dsc.gradient.cr;
dst->fill_dsc.gradient.spread = src->fill_dsc.gradient.spread;
lv_memcpy(&(dst->fill_dsc.gradient.grad), &(src->fill_dsc.gradient.grad), sizeof(lv_grad_dsc_t));
lv_memcpy(&(dst->fill_dsc.img_dsc), &(src->fill_dsc.img_dsc), sizeof(lv_draw_image_dsc_t));
lv_memcpy(&(dst->fill_dsc.matrix), &(src->fill_dsc.matrix), sizeof(lv_matrix_t));
lv_memcpy(&(dst->fill_dsc), &(src->fill_dsc), sizeof(lv_vector_fill_dsc_t));
dst->stroke_dsc.style = src->stroke_dsc.style;
dst->stroke_dsc.color = src->stroke_dsc.color;
@ -111,7 +75,7 @@ static void _copy_draw_dsc(lv_vector_draw_dsc_t * dst, const lv_vector_draw_dsc_
dst->stroke_dsc.gradient.cy = src->stroke_dsc.gradient.cy;
dst->stroke_dsc.gradient.cr = src->stroke_dsc.gradient.cr;
dst->stroke_dsc.gradient.spread = src->fill_dsc.gradient.spread;
lv_memcpy(&(dst->stroke_dsc.gradient.grad), &(src->stroke_dsc.gradient.grad), sizeof(lv_grad_dsc_t));
lv_memcpy(&(dst->stroke_dsc.gradient), &(src->stroke_dsc.gradient), sizeof(lv_vector_gradient_t));
lv_memcpy(&(dst->stroke_dsc.matrix), &(src->stroke_dsc.matrix), sizeof(lv_matrix_t));
dst->blend_mode = src->blend_mode;
@ -119,92 +83,9 @@ static void _copy_draw_dsc(lv_vector_draw_dsc_t * dst, const lv_vector_draw_dsc_
lv_area_copy(&(dst->scissor_area), &(src->scissor_area));
}
/**********************
* GLOBAL FUNCTIONS
* GLOBAL FUNCTIONS
**********************/
/* matrix functions */
void lv_matrix_identity(lv_matrix_t * matrix)
{
matrix->m[0][0] = 1.0f;
matrix->m[0][1] = 0.0f;
matrix->m[0][2] = 0.0f;
matrix->m[1][0] = 0.0f;
matrix->m[1][1] = 1.0f;
matrix->m[1][2] = 0.0f;
matrix->m[2][0] = 0.0f;
matrix->m[2][1] = 0.0f;
matrix->m[2][2] = 1.0f;
}
void lv_matrix_translate(lv_matrix_t * matrix, float dx, float dy)
{
if(_is_identity_or_translation(matrix)) {
/*optimization for matrix translation.*/
matrix->m[0][2] += dx;
matrix->m[1][2] += dy;
return;
}
lv_matrix_t tlm = {{
{1.0f, 0.0f, dx},
{0.0f, 1.0f, dy},
{0.0f, 0.0f, 1.0f},
}
};
_multiply_matrix(matrix, &tlm);
}
void lv_matrix_scale(lv_matrix_t * matrix, float scale_x, float scale_y)
{
lv_matrix_t scm = {{
{scale_x, 0.0f, 0.0f},
{0.0f, scale_y, 0.0f},
{0.0f, 0.0f, 1.0f},
}
};
_multiply_matrix(matrix, &scm);
}
void lv_matrix_rotate(lv_matrix_t * matrix, float degree)
{
float radian = degree / 180.0f * (float)M_PI;
float cos_r = cosf(radian);
float sin_r = sinf(radian);
lv_matrix_t rtm = {{
{cos_r, -sin_r, 0.0f},
{sin_r, cos_r, 0.0f},
{0.0f, 0.0f, 1.0f},
}
};
_multiply_matrix(matrix, &rtm);
}
void lv_matrix_skew(lv_matrix_t * matrix, float skew_x, float skew_y)
{
float rskew_x = skew_x / 180.0f * (float)M_PI;
float rskew_y = skew_y / 180.0f * (float)M_PI;
float tan_x = tanf(rskew_x);
float tan_y = tanf(rskew_y);
lv_matrix_t skm = {{
{1.0f, tan_x, 0.0f},
{tan_y, 1.0f, 0.0f},
{0.0f, 0.0f, 1.0f},
}
};
_multiply_matrix(matrix, &skm);
}
void lv_matrix_multiply(lv_matrix_t * matrix, const lv_matrix_t * m)
{
_multiply_matrix(matrix, m);
}
void lv_matrix_transform_point(const lv_matrix_t * matrix, lv_fpoint_t * point)
{
float x = point->x;
@ -230,7 +111,7 @@ lv_vector_path_t * lv_vector_path_create(lv_vector_path_quality_t quality)
LV_ASSERT_MALLOC(path);
lv_memzero(path, sizeof(lv_vector_path_t));
path->quality = quality;
lv_array_init(&path->ops, 8, sizeof(uint8_t));
lv_array_init(&path->ops, 8, sizeof(lv_vector_path_op_t));
lv_array_init(&path->points, 8, sizeof(lv_fpoint_t));
return path;
}
@ -259,7 +140,7 @@ void lv_vector_path_move_to(lv_vector_path_t * path, const lv_fpoint_t * p)
{
CHECK_AND_RESIZE_PATH_CONTAINER(path, 1);
uint8_t op = LV_VECTOR_PATH_OP_MOVE_TO;
lv_vector_path_op_t op = LV_VECTOR_PATH_OP_MOVE_TO;
lv_array_push_back(&path->ops, &op);
lv_array_push_back(&path->points, p);
}
@ -273,7 +154,7 @@ void lv_vector_path_line_to(lv_vector_path_t * path, const lv_fpoint_t * p)
CHECK_AND_RESIZE_PATH_CONTAINER(path, 1);
uint8_t op = LV_VECTOR_PATH_OP_LINE_TO;
lv_vector_path_op_t op = LV_VECTOR_PATH_OP_LINE_TO;
lv_array_push_back(&path->ops, &op);
lv_array_push_back(&path->points, p);
}
@ -287,7 +168,7 @@ void lv_vector_path_quad_to(lv_vector_path_t * path, const lv_fpoint_t * p1, con
CHECK_AND_RESIZE_PATH_CONTAINER(path, 2);
uint8_t op = LV_VECTOR_PATH_OP_QUAD_TO;
lv_vector_path_op_t op = LV_VECTOR_PATH_OP_QUAD_TO;
lv_array_push_back(&path->ops, &op);
lv_array_push_back(&path->points, p1);
lv_array_push_back(&path->points, p2);
@ -303,7 +184,7 @@ void lv_vector_path_cubic_to(lv_vector_path_t * path, const lv_fpoint_t * p1, co
CHECK_AND_RESIZE_PATH_CONTAINER(path, 3);
uint8_t op = LV_VECTOR_PATH_OP_CUBIC_TO;
lv_vector_path_op_t op = LV_VECTOR_PATH_OP_CUBIC_TO;
lv_array_push_back(&path->ops, &op);
lv_array_push_back(&path->points, p1);
lv_array_push_back(&path->points, p2);
@ -319,7 +200,7 @@ void lv_vector_path_close(lv_vector_path_t * path)
CHECK_AND_RESIZE_PATH_CONTAINER(path, 1);
uint8_t op = LV_VECTOR_PATH_OP_CLOSE;
lv_vector_path_op_t op = LV_VECTOR_PATH_OP_CLOSE;
lv_array_push_back(&path->ops, &op);
}
@ -621,7 +502,7 @@ void lv_vector_dsc_delete(lv_vector_dsc_t * dsc)
{
if(dsc->tasks.task_list) {
lv_ll_t * task_list = dsc->tasks.task_list;
_lv_vector_for_each_destroy_tasks(task_list, NULL, NULL);
lv_vector_for_each_destroy_tasks(task_list, NULL, NULL);
dsc->tasks.task_list = NULL;
}
lv_array_deinit(&(dsc->current_dsc.stroke_dsc.dash_pattern));
@ -666,25 +547,40 @@ void lv_vector_dsc_set_fill_image(lv_vector_dsc_t * dsc, const lv_draw_image_dsc
lv_memcpy(&(dsc->current_dsc.fill_dsc.img_dsc), img_dsc, sizeof(lv_draw_image_dsc_t));
}
void lv_vector_dsc_set_fill_linear_gradient(lv_vector_dsc_t * dsc, const lv_grad_dsc_t * grad,
lv_vector_gradient_spread_t spread)
void lv_vector_dsc_set_fill_linear_gradient(lv_vector_dsc_t * dsc, float x1, float y1, float x2, float y2)
{
dsc->current_dsc.fill_dsc.style = LV_VECTOR_DRAW_STYLE_GRADIENT;
dsc->current_dsc.fill_dsc.gradient.style = LV_VECTOR_GRADIENT_STYLE_LINEAR;
dsc->current_dsc.fill_dsc.gradient.spread = spread;
lv_memcpy(&(dsc->current_dsc.fill_dsc.gradient.grad), grad, sizeof(lv_grad_dsc_t));
dsc->current_dsc.fill_dsc.gradient.x1 = x1;
dsc->current_dsc.fill_dsc.gradient.y1 = y1;
dsc->current_dsc.fill_dsc.gradient.x2 = x2;
dsc->current_dsc.fill_dsc.gradient.y2 = y2;
}
void lv_vector_dsc_set_fill_radial_gradient(lv_vector_dsc_t * dsc, const lv_grad_dsc_t * grad, float cx, float cy,
float radius, lv_vector_gradient_spread_t spread)
void lv_vector_dsc_set_fill_radial_gradient(lv_vector_dsc_t * dsc, float cx, float cy, float radius)
{
dsc->current_dsc.fill_dsc.style = LV_VECTOR_DRAW_STYLE_GRADIENT;
dsc->current_dsc.fill_dsc.gradient.style = LV_VECTOR_GRADIENT_STYLE_RADIAL;
dsc->current_dsc.fill_dsc.gradient.cx = cx;
dsc->current_dsc.fill_dsc.gradient.cy = cy;
dsc->current_dsc.fill_dsc.gradient.cr = radius;
}
void lv_vector_dsc_set_fill_gradient_spread(lv_vector_dsc_t * dsc, lv_vector_gradient_spread_t spread)
{
dsc->current_dsc.fill_dsc.gradient.spread = spread;
lv_memcpy(&(dsc->current_dsc.fill_dsc.gradient.grad), grad, sizeof(lv_grad_dsc_t));
}
void lv_vector_dsc_set_fill_gradient_color_stops(lv_vector_dsc_t * dsc, const lv_gradient_stop_t * stops,
uint16_t count)
{
if(count > LV_GRADIENT_MAX_STOPS) {
LV_LOG_WARN("Gradient stops limited: %d, max: %d", count, LV_GRADIENT_MAX_STOPS);
count = LV_GRADIENT_MAX_STOPS;
}
lv_memcpy(&(dsc->current_dsc.fill_dsc.gradient.stops), stops, sizeof(lv_gradient_stop_t) * count);
dsc->current_dsc.fill_dsc.gradient.stops_count = count;
}
void lv_vector_dsc_set_fill_transform(lv_vector_dsc_t * dsc, const lv_matrix_t * matrix)
@ -754,32 +650,47 @@ void lv_vector_dsc_set_stroke_miter_limit(lv_vector_dsc_t * dsc, uint16_t miter_
dsc->current_dsc.stroke_dsc.miter_limit = miter_limit;
}
void lv_vector_dsc_set_stroke_linear_gradient(lv_vector_dsc_t * dsc, const lv_grad_dsc_t * grad,
lv_vector_gradient_spread_t spread)
void lv_vector_dsc_set_stroke_linear_gradient(lv_vector_dsc_t * dsc, float x1, float y1, float x2, float y2)
{
dsc->current_dsc.stroke_dsc.style = LV_VECTOR_DRAW_STYLE_GRADIENT;
dsc->current_dsc.stroke_dsc.gradient.style = LV_VECTOR_GRADIENT_STYLE_LINEAR;
dsc->current_dsc.stroke_dsc.gradient.spread = spread;
lv_memcpy(&(dsc->current_dsc.stroke_dsc.gradient.grad), grad, sizeof(lv_grad_dsc_t));
dsc->current_dsc.stroke_dsc.gradient.x1 = x1;
dsc->current_dsc.stroke_dsc.gradient.y1 = y1;
dsc->current_dsc.stroke_dsc.gradient.x2 = x2;
dsc->current_dsc.stroke_dsc.gradient.y2 = y2;
}
void lv_vector_dsc_set_stroke_radial_gradient(lv_vector_dsc_t * dsc, const lv_grad_dsc_t * grad, float cx, float cy,
float radius, lv_vector_gradient_spread_t spread)
void lv_vector_dsc_set_stroke_radial_gradient(lv_vector_dsc_t * dsc, float cx, float cy, float radius)
{
dsc->current_dsc.stroke_dsc.style = LV_VECTOR_DRAW_STYLE_GRADIENT;
dsc->current_dsc.stroke_dsc.gradient.style = LV_VECTOR_GRADIENT_STYLE_RADIAL;
dsc->current_dsc.stroke_dsc.gradient.cx = cx;
dsc->current_dsc.stroke_dsc.gradient.cy = cy;
dsc->current_dsc.stroke_dsc.gradient.cr = radius;
}
void lv_vector_dsc_set_stroke_gradient_spread(lv_vector_dsc_t * dsc, lv_vector_gradient_spread_t spread)
{
dsc->current_dsc.stroke_dsc.gradient.spread = spread;
lv_memcpy(&(dsc->current_dsc.stroke_dsc.gradient.grad), grad, sizeof(lv_grad_dsc_t));
}
void lv_vector_dsc_set_stroke_gradient_color_stops(lv_vector_dsc_t * dsc, const lv_gradient_stop_t * stops,
uint16_t count)
{
if(count > LV_GRADIENT_MAX_STOPS) {
LV_LOG_WARN("Gradient stops limited: %d, max: %d", count, LV_GRADIENT_MAX_STOPS);
count = LV_GRADIENT_MAX_STOPS;
}
lv_memcpy(&(dsc->current_dsc.stroke_dsc.gradient.stops), stops, sizeof(lv_gradient_stop_t) * count);
dsc->current_dsc.stroke_dsc.gradient.stops_count = count;
}
/* draw functions */
void lv_vector_dsc_add_path(lv_vector_dsc_t * dsc, const lv_vector_path_t * path)
{
lv_area_t rect;
if(!_lv_area_intersect(&rect, &(dsc->layer->_clip_area), &(dsc->current_dsc.scissor_area))) {
if(!lv_area_intersect(&rect, &(dsc->layer->_clip_area), &(dsc->current_dsc.scissor_area))) {
return;
}
@ -791,11 +702,11 @@ void lv_vector_dsc_add_path(lv_vector_dsc_t * dsc, const lv_vector_path_t * path
if(!dsc->tasks.task_list) {
dsc->tasks.task_list = lv_malloc(sizeof(lv_ll_t));
LV_ASSERT_MALLOC(dsc->tasks.task_list);
_lv_ll_init(dsc->tasks.task_list, sizeof(_lv_vector_draw_task));
lv_ll_init(dsc->tasks.task_list, sizeof(lv_vector_draw_task));
}
_lv_vector_draw_task * new_task = (_lv_vector_draw_task *)_lv_ll_ins_tail(dsc->tasks.task_list);
lv_memset(new_task, 0, sizeof(_lv_vector_draw_task));
lv_vector_draw_task * new_task = (lv_vector_draw_task *)lv_ll_ins_tail(dsc->tasks.task_list);
lv_memset(new_task, 0, sizeof(lv_vector_draw_task));
new_task->path = lv_vector_path_create(0);
@ -807,18 +718,18 @@ void lv_vector_dsc_add_path(lv_vector_dsc_t * dsc, const lv_vector_path_t * path
void lv_vector_clear_area(lv_vector_dsc_t * dsc, const lv_area_t * rect)
{
lv_area_t r;
if(!_lv_area_intersect(&r, &(dsc->layer->_clip_area), &(dsc->current_dsc.scissor_area))) {
if(!lv_area_intersect(&r, &(dsc->layer->_clip_area), &(dsc->current_dsc.scissor_area))) {
return;
}
if(!dsc->tasks.task_list) {
dsc->tasks.task_list = lv_malloc(sizeof(lv_ll_t));
LV_ASSERT_MALLOC(dsc->tasks.task_list);
_lv_ll_init(dsc->tasks.task_list, sizeof(_lv_vector_draw_task));
lv_ll_init(dsc->tasks.task_list, sizeof(lv_vector_draw_task));
}
_lv_vector_draw_task * new_task = (_lv_vector_draw_task *)_lv_ll_ins_tail(dsc->tasks.task_list);
lv_memset(new_task, 0, sizeof(_lv_vector_draw_task));
lv_vector_draw_task * new_task = (lv_vector_draw_task *)lv_ll_ins_tail(dsc->tasks.task_list);
lv_memset(new_task, 0, sizeof(lv_vector_draw_task));
new_task->dsc.fill_dsc.color = dsc->current_dsc.fill_dsc.color;
new_task->dsc.fill_dsc.opa = dsc->current_dsc.fill_dsc.opa;
@ -867,14 +778,14 @@ void lv_vector_dsc_skew(lv_vector_dsc_t * dsc, float skew_x, float skew_y)
lv_matrix_skew(&(dsc->current_dsc.matrix), skew_x, skew_y);
}
void _lv_vector_for_each_destroy_tasks(lv_ll_t * task_list, vector_draw_task_cb cb, void * data)
void lv_vector_for_each_destroy_tasks(lv_ll_t * task_list, vector_draw_task_cb cb, void * data)
{
_lv_vector_draw_task * task = _lv_ll_get_head(task_list);
_lv_vector_draw_task * next_task = NULL;
lv_vector_draw_task * task = lv_ll_get_head(task_list);
lv_vector_draw_task * next_task = NULL;
while(task != NULL) {
next_task = _lv_ll_get_next(task_list, task);
_lv_ll_remove(task_list, task);
next_task = lv_ll_get_next(task_list, task);
lv_ll_remove(task_list, task);
if(cb) {
cb(data, task->path, &(task->dsc));

View File

@ -13,42 +13,43 @@ extern "C" {
/*********************
* INCLUDES
*********************/
#include "lv_draw.h"
#include "../misc/lv_array.h"
#include "../misc/lv_matrix.h"
#include "lv_draw_image.h"
#if LV_USE_VECTOR_GRAPHIC
#if !LV_USE_MATRIX
#error "lv_draw_vector needs LV_USE_MATRIX = 1"
#endif
/**********************
* TYPEDEFS
**********************/
enum {
typedef enum {
LV_VECTOR_FILL_NONZERO = 0,
LV_VECTOR_FILL_EVENODD,
};
typedef uint8_t lv_vector_fill_t;
} lv_vector_fill_t;
enum {
typedef enum {
LV_VECTOR_STROKE_CAP_BUTT = 0,
LV_VECTOR_STROKE_CAP_SQUARE,
LV_VECTOR_STROKE_CAP_ROUND,
};
typedef uint8_t lv_vector_stroke_cap_t;
} lv_vector_stroke_cap_t;
enum {
typedef enum {
LV_VECTOR_STROKE_JOIN_MITER = 0,
LV_VECTOR_STROKE_JOIN_BEVEL,
LV_VECTOR_STROKE_JOIN_ROUND,
};
typedef uint8_t lv_vector_stroke_join_t;
} lv_vector_stroke_join_t;
enum {
typedef enum {
LV_VECTOR_PATH_QUALITY_MEDIUM = 0, /* default*/
LV_VECTOR_PATH_QUALITY_HIGH,
LV_VECTOR_PATH_QUALITY_LOW,
};
typedef uint8_t lv_vector_path_quality_t;
} lv_vector_path_quality_t;
enum {
typedef enum {
LV_VECTOR_BLEND_SRC_OVER = 0,
LV_VECTOR_BLEND_SRC_IN,
LV_VECTOR_BLEND_DST_OVER,
@ -58,153 +59,42 @@ enum {
LV_VECTOR_BLEND_NONE,
LV_VECTOR_BLEND_ADDITIVE,
LV_VECTOR_BLEND_SUBTRACTIVE,
};
typedef uint8_t lv_vector_blend_t;
} lv_vector_blend_t;
enum {
typedef enum {
LV_VECTOR_PATH_OP_MOVE_TO = 0,
LV_VECTOR_PATH_OP_LINE_TO,
LV_VECTOR_PATH_OP_QUAD_TO,
LV_VECTOR_PATH_OP_CUBIC_TO,
LV_VECTOR_PATH_OP_CLOSE,
};
typedef uint8_t lv_vector_path_op_t;
} lv_vector_path_op_t;
enum {
typedef enum {
LV_VECTOR_DRAW_STYLE_SOLID = 0,
LV_VECTOR_DRAW_STYLE_PATTERN,
LV_VECTOR_DRAW_STYLE_GRADIENT,
};
typedef uint8_t lv_vector_draw_style_t;
} lv_vector_draw_style_t;
enum {
typedef enum {
LV_VECTOR_GRADIENT_SPREAD_PAD = 0,
LV_VECTOR_GRADIENT_SPREAD_REPEAT,
LV_VECTOR_GRADIENT_SPREAD_REFLECT,
};
typedef uint8_t lv_vector_gradient_spread_t;
} lv_vector_gradient_spread_t;
enum {
typedef enum {
LV_VECTOR_GRADIENT_STYLE_LINEAR = 0,
LV_VECTOR_GRADIENT_STYLE_RADIAL,
};
typedef uint8_t lv_vector_gradient_style_t;
} lv_vector_gradient_style_t;
typedef struct {
struct lv_fpoint_t {
float x;
float y;
} lv_fpoint_t;
typedef struct {
float m[3][3];
} lv_matrix_t;
typedef struct {
lv_vector_path_quality_t quality;
lv_array_t ops;
lv_array_t points;
} lv_vector_path_t;
typedef struct {
lv_vector_gradient_style_t style;
lv_grad_dsc_t grad;
float cx;
float cy;
float cr;
lv_vector_gradient_spread_t spread;
} lv_vector_gradient_t;
typedef struct {
lv_vector_draw_style_t style;
lv_color32_t color;
lv_opa_t opa;
lv_vector_fill_t fill_rule;
lv_draw_image_dsc_t img_dsc;
lv_vector_gradient_t gradient;
lv_matrix_t matrix;
} lv_vector_fill_dsc_t;
typedef struct {
lv_vector_draw_style_t style;
lv_color32_t color;
lv_opa_t opa;
float width;
lv_array_t dash_pattern;
lv_vector_stroke_cap_t cap;
lv_vector_stroke_join_t join;
uint16_t miter_limit;
lv_vector_gradient_t gradient;
lv_matrix_t matrix;
} lv_vector_stroke_dsc_t;
typedef struct {
lv_vector_fill_dsc_t fill_dsc;
lv_vector_stroke_dsc_t stroke_dsc;
lv_matrix_t matrix;
lv_vector_blend_t blend_mode;
lv_area_t scissor_area;
} lv_vector_draw_dsc_t;
typedef struct {
lv_draw_dsc_base_t base;
lv_ll_t * task_list; /*draw task list.*/
} lv_draw_vector_task_dsc_t;
typedef struct {
lv_layer_t * layer;
lv_vector_draw_dsc_t current_dsc;
/* private data */
lv_draw_vector_task_dsc_t tasks;
} lv_vector_dsc_t;
};
/**********************
* GLOBAL PROTOTYPES
**********************/
/**
* Set matrix to identity matrix
* @param matrix pointer to a matrix
*/
void lv_matrix_identity(lv_matrix_t * matrix);
/**
* Translate the matrix to new position
* @param matrix pointer to a matrix
* @param tx the amount of translate in x direction
* @param tx the amount of translate in y direction
*/
void lv_matrix_translate(lv_matrix_t * matrix, float tx, float ty);
/**
* Change the scale factor of the matrix
* @param matrix pointer to a matrix
* @param scale_x the scale factor for the X direction
* @param scale_y the scale factor for the Y direction
*/
void lv_matrix_scale(lv_matrix_t * matrix, float scale_x, float scale_y);
/**
* Rotate the matrix with origin
* @param matrix pointer to a matrix
* @param degree angle to rotate
*/
void lv_matrix_rotate(lv_matrix_t * matrix, float degree);
/**
* Change the skew factor of the matrix
* @param matrix pointer to a matrix
* @param skew_x the skew factor for x direction
* @param skew_y the skew factor for y direction
*/
void lv_matrix_skew(lv_matrix_t * matrix, float skew_x, float skew_y);
/**
* Multiply two matrix and store the result to the first one
* @param matrix pointer to a matrix
* @param matrix2 pointer to another matrix
*/
void lv_matrix_multiply(lv_matrix_t * matrix, const lv_matrix_t * matrix2);
/**
* Transform the coordinates of a point using given matrix
* @param matrix pointer to a matrix
@ -391,24 +281,39 @@ void lv_vector_dsc_set_fill_image(lv_vector_dsc_t * dsc, const lv_draw_image_dsc
/**
* Set fill linear gradient for descriptor
* @param dsc pointer to a vector graphic descriptor
* @param grad pointer to a `lv_grad_dsc_t` variable
* @param spread the gradient spread to be set in lv_vector_gradient_spread_t format
* @param dsc pointer to a vector graphic descriptor
* @param x1 the x for start point
* @param y1 the y for start point
* @param x2 the x for end point
* @param y2 the y for end point
*/
void lv_vector_dsc_set_fill_linear_gradient(lv_vector_dsc_t * dsc, const lv_grad_dsc_t * grad,
lv_vector_gradient_spread_t spread);
void lv_vector_dsc_set_fill_linear_gradient(lv_vector_dsc_t * dsc, float x1, float y1, float x2, float y2);
/**
* Set fill radial gradient for descriptor
* @param dsc pointer to a vector graphic descriptor
* @param grad pointer to a `lv_grad_dsc_t` variable
* @param cx the x for center of the circle
* @param cy the y for center of the circle
* @param radius the radius for circle
* @param spread the gradient spread to be set in lv_vector_gradient_spread_t format
* Set fill radial gradient radius for descriptor
* @param dsc pointer to a vector graphic descriptor
* @param cx the x for center of the circle
* @param cy the y for center of the circle
* @param radius the radius for circle
*/
void lv_vector_dsc_set_fill_radial_gradient(lv_vector_dsc_t * dsc, const lv_grad_dsc_t * grad, float cx, float cy,
float radius, lv_vector_gradient_spread_t spread);
void lv_vector_dsc_set_fill_radial_gradient(lv_vector_dsc_t * dsc, float cx, float cy, float radius);
/**
* Set fill radial gradient spread for descriptor
* @param dsc pointer to a vector graphic descriptor
* @param spread the gradient spread to be set in lv_vector_gradient_spread_t format
*/
void lv_vector_dsc_set_fill_gradient_spread(lv_vector_dsc_t * dsc, lv_vector_gradient_spread_t spread);
/**
* Set fill gradient color stops for descriptor
* @param dsc pointer to a vector graphic descriptor
* @param stops an array of `lv_gradient_stop_t` variables
* @param count the number of stops in the array, range: 0..LV_GRADIENT_MAX_STOPS
*/
void lv_vector_dsc_set_fill_gradient_color_stops(lv_vector_dsc_t * dsc, const lv_gradient_stop_t * stops,
uint16_t count);
/**
* Set a matrix to current fill transformation matrix
@ -477,22 +382,37 @@ void lv_vector_dsc_set_stroke_miter_limit(lv_vector_dsc_t * dsc, uint16_t miter_
/**
* Set stroke linear gradient for descriptor
* @param dsc pointer to a vector graphic descriptor
* @param grad pointer to a `lv_grad_dsc_t` variable
* @param spread the gradient spread to be set in lv_vector_gradient_spread_t format
* @param x1 the x for start point
* @param y1 the y for start point
* @param x2 the x for end point
* @param y2 the y for end point
*/
void lv_vector_dsc_set_stroke_linear_gradient(lv_vector_dsc_t * dsc, const lv_grad_dsc_t * grad,
lv_vector_gradient_spread_t spread);
void lv_vector_dsc_set_stroke_linear_gradient(lv_vector_dsc_t * dsc, float x1, float y1, float x2, float y2);
/**
* Set stroke radial gradient for descriptor
* @param dsc pointer to a vector graphic descriptor
* @param grad pointer to a `lv_grad_dsc_t` variable
* @param cx the x for center of the circle
* @param cy the y for center of the circle
* @param radius the radius for circle
*/
void lv_vector_dsc_set_stroke_radial_gradient(lv_vector_dsc_t * dsc, float cx, float cy, float radius);
/**
* Set stroke color stops for descriptor
* @param dsc pointer to a vector graphic descriptor
* @param spread the gradient spread to be set in lv_vector_gradient_spread_t format
*/
void lv_vector_dsc_set_stroke_radial_gradient(lv_vector_dsc_t * dsc, const lv_grad_dsc_t * grad, float cx, float cy,
float radius, lv_vector_gradient_spread_t spread);
void lv_vector_dsc_set_stroke_gradient_spread(lv_vector_dsc_t * dsc, lv_vector_gradient_spread_t spread);
/**
* Set stroke color stops for descriptor
* @param dsc pointer to a vector graphic descriptor
* @param stops an array of `lv_gradient_stop_t` variables
* @param count the number of stops in the array
*/
void lv_vector_dsc_set_stroke_gradient_color_stops(lv_vector_dsc_t * dsc, const lv_gradient_stop_t * stops,
uint16_t count);
/**
* Set a matrix to current stroke transformation matrix
* @param dsc pointer to a vector graphic descriptor
@ -560,8 +480,6 @@ void lv_draw_vector(lv_vector_dsc_t * dsc);
/* Traverser for task list */
typedef void (*vector_draw_task_cb)(void * ctx, const lv_vector_path_t * path, const lv_vector_draw_dsc_t * dsc);
void _lv_vector_for_each_destroy_tasks(lv_ll_t * task_list, vector_draw_task_cb cb, void * data);
#endif /* LV_USE_VECTOR_GRAPHIC */
#ifdef __cplusplus

View File

@ -0,0 +1,109 @@
/**
* @file lv_draw_vector_private.h
*
*/
#ifndef LV_DRAW_VECTOR_PRIVATE_H
#define LV_DRAW_VECTOR_PRIVATE_H
#ifdef __cplusplus
extern "C" {
#endif
/*********************
* INCLUDES
*********************/
#include "lv_draw_vector.h"
#if LV_USE_VECTOR_GRAPHIC
/*********************
* DEFINES
*********************/
/**********************
* TYPEDEFS
**********************/
struct lv_vector_path_t {
lv_vector_path_quality_t quality;
lv_array_t ops;
lv_array_t points;
};
struct lv_vector_gradient_t {
lv_vector_gradient_style_t style;
lv_gradient_stop_t stops[LV_GRADIENT_MAX_STOPS]; /**< A gradient stop array */
uint16_t stops_count; /**< The number of used stops in the array */
float x1;
float y1;
float x2;
float y2;
float cx;
float cy;
float cr;
lv_vector_gradient_spread_t spread;
};
struct lv_vector_fill_dsc_t {
lv_vector_draw_style_t style;
lv_color32_t color;
lv_opa_t opa;
lv_vector_fill_t fill_rule;
lv_draw_image_dsc_t img_dsc;
lv_vector_gradient_t gradient;
lv_matrix_t matrix;
};
struct lv_vector_stroke_dsc_t {
lv_vector_draw_style_t style;
lv_color32_t color;
lv_opa_t opa;
float width;
lv_array_t dash_pattern;
lv_vector_stroke_cap_t cap;
lv_vector_stroke_join_t join;
uint16_t miter_limit;
lv_vector_gradient_t gradient;
lv_matrix_t matrix;
};
struct lv_vector_draw_dsc_t {
lv_vector_fill_dsc_t fill_dsc;
lv_vector_stroke_dsc_t stroke_dsc;
lv_matrix_t matrix;
lv_vector_blend_t blend_mode;
lv_area_t scissor_area;
};
struct lv_draw_vector_task_dsc_t {
lv_draw_dsc_base_t base;
lv_ll_t * task_list; /*draw task list.*/
};
struct lv_vector_dsc_t {
lv_layer_t * layer;
lv_vector_draw_dsc_t current_dsc;
/* private data */
lv_draw_vector_task_dsc_t tasks;
};
/**********************
* GLOBAL PROTOTYPES
**********************/
void lv_vector_for_each_destroy_tasks(lv_ll_t * task_list, vector_draw_task_cb cb, void * data);
/**********************
* MACROS
**********************/
#endif /* LV_USE_VECTOR_GRAPHIC */
#ifdef __cplusplus
} /*extern "C"*/
#endif
#endif /*LV_DRAW_VECTOR_PRIVATE_H*/

View File

@ -6,7 +6,7 @@
/*********************
* INCLUDES
*********************/
#include "lv_image_decoder.h"
#include "lv_image_decoder_private.h"
#include "../misc/lv_assert.h"
#include "../draw/lv_draw_image.h"
#include "../misc/lv_ll.h"
@ -19,6 +19,7 @@
#define img_decoder_ll_p &(LV_GLOBAL_DEFAULT()->img_decoder_ll)
#define img_cache_p (LV_GLOBAL_DEFAULT()->img_cache)
#define img_header_cache_p (LV_GLOBAL_DEFAULT()->img_header_cache)
#define image_cache_draw_buf_handlers &(LV_GLOBAL_DEFAULT()->image_cache_draw_buf_handlers)
/**********************
* TYPEDEFS
@ -32,25 +33,14 @@ static uint32_t img_width_to_stride(lv_image_header_t * header);
/**
* Get the header info of an image source, and return the a pointer to the decoder that can open it.
* @param src The image source (e.g. a filename or a pointer to a C array)
* @param dsc Image descriptor containing the source and type of the image and other info.
* @param header The header of the image
* @return The decoder that can open the image source or NULL if not found (or can't open it).
*/
static lv_image_decoder_t * image_decoder_get_info(const void * src, lv_image_header_t * header);
#if LV_IMAGE_HEADER_CACHE_DEF_CNT > 0
static lv_cache_compare_res_t image_decoder_header_cache_compare_cb(const lv_image_header_cache_data_t * lhs,
const lv_image_header_cache_data_t * rhs);
static void image_decoder_header_cache_free_cb(lv_image_header_cache_data_t * entry, void * user_data);
#endif
#if LV_CACHE_DEF_SIZE > 0
static lv_cache_compare_res_t image_decoder_cache_compare_cb(const lv_image_cache_data_t * lhs,
const lv_image_cache_data_t * rhs);
static void image_decoder_cache_free_cb(lv_image_cache_data_t * entry, void * user_data);
static lv_image_decoder_t * image_decoder_get_info(lv_image_decoder_dsc_t * dsc, lv_image_header_t * header);
static lv_result_t try_cache(lv_image_decoder_dsc_t * dsc);
#endif
/**********************
* STATIC VARIABLES
**********************/
@ -66,48 +56,34 @@ static lv_result_t try_cache(lv_image_decoder_dsc_t * dsc);
/**
* Initialize the image decoder module
*/
void _lv_image_decoder_init(void)
void lv_image_decoder_init(uint32_t image_cache_size, uint32_t image_header_count)
{
_lv_ll_init(img_decoder_ll_p, sizeof(lv_image_decoder_t));
lv_ll_init(img_decoder_ll_p, sizeof(lv_image_decoder_t));
#if LV_CACHE_DEF_SIZE > 0
img_cache_p = lv_cache_create(&lv_cache_class_lru_rb_size,
sizeof(lv_image_cache_data_t), LV_CACHE_DEF_SIZE, (lv_cache_ops_t) {
.compare_cb = (lv_cache_compare_cb_t)image_decoder_cache_compare_cb,
.create_cb = NULL,
.free_cb = (lv_cache_free_cb_t)image_decoder_cache_free_cb,
});
#endif
#if LV_IMAGE_HEADER_CACHE_DEF_CNT > 0
img_header_cache_p = lv_cache_create(&lv_cache_class_lru_rb_count,
sizeof(lv_image_header_cache_data_t), LV_IMAGE_HEADER_CACHE_DEF_CNT, (lv_cache_ops_t) {
.compare_cb = (lv_cache_compare_cb_t)image_decoder_header_cache_compare_cb,
.create_cb = NULL,
.free_cb = (lv_cache_free_cb_t)image_decoder_header_cache_free_cb
});
#endif
/*Initialize the cache*/
lv_image_cache_init(image_cache_size);
lv_image_header_cache_init(image_header_count);
}
/**
* Deinitialize the image decoder module
*/
void _lv_image_decoder_deinit(void)
void lv_image_decoder_deinit(void)
{
#if LV_CACHE_DEF_SIZE > 0
lv_cache_destroy(img_cache_p, NULL);
#endif
#if LV_IMAGE_HEADER_CACHE_DEF_CNT > 0
lv_cache_destroy(img_header_cache_p, NULL);
#endif
_lv_ll_clear(img_decoder_ll_p);
lv_ll_clear(img_decoder_ll_p);
}
lv_result_t lv_image_decoder_get_info(const void * src, lv_image_header_t * header)
{
lv_image_decoder_t * decoder = image_decoder_get_info(src, header);
lv_image_decoder_dsc_t dsc;
lv_memzero(&dsc, sizeof(lv_image_decoder_dsc_t));
dsc.src = src;
dsc.src_type = lv_image_src_get_type(src);
lv_image_decoder_t * decoder = image_decoder_get_info(&dsc, header);
if(decoder == NULL) return LV_RESULT_INVALID;
return LV_RESULT_OK;
@ -121,19 +97,19 @@ lv_result_t lv_image_decoder_open(lv_image_decoder_dsc_t * dsc, const void * src
dsc->src = src;
dsc->src_type = lv_image_src_get_type(src);
#if LV_CACHE_DEF_SIZE > 0
dsc->cache = img_cache_p;
/*Try cache first, unless we are told to ignore cache.*/
if(!(args && args->no_cache)) {
/*
* Check the cache first
* If the image is found in the cache, just return it.*/
if(try_cache(dsc) == LV_RESULT_OK) return LV_RESULT_OK;
if(lv_image_cache_is_enabled()) {
dsc->cache = img_cache_p;
/*Try cache first, unless we are told to ignore cache.*/
if(!(args && args->no_cache)) {
/*
* Check the cache first
* If the image is found in the cache, just return it.*/
if(try_cache(dsc) == LV_RESULT_OK) return LV_RESULT_OK;
}
}
#endif
/*Find the decoder that can open the image source, and get the header info in the same time.*/
dsc->decoder = image_decoder_get_info(src, &dsc->header);
dsc->decoder = image_decoder_get_info(dsc, &dsc->header);
if(dsc->decoder == NULL) return LV_RESULT_INVALID;
/*Make a copy of args*/
@ -142,6 +118,7 @@ lv_result_t lv_image_decoder_open(lv_image_decoder_dsc_t * dsc, const void * src
.premultiply = false,
.no_cache = false,
.use_indexed = false,
.flush_cache = false,
};
/*
@ -151,6 +128,18 @@ lv_result_t lv_image_decoder_open(lv_image_decoder_dsc_t * dsc, const void * src
* */
lv_result_t res = dsc->decoder->open_cb(dsc->decoder, dsc);
/* Flush the D-Cache if enabled and the image was successfully opened */
if(dsc->args.flush_cache && res == LV_RESULT_OK && dsc->decoded != NULL) {
lv_draw_buf_flush_cache(dsc->decoded, NULL);
LV_LOG_INFO("Flushed D-cache: src %p (%s) (W%d x H%d, data: %p cf: %d)",
src,
dsc->src_type == LV_IMAGE_SRC_FILE ? (const char *)src : "c-array",
dsc->decoded->header.w,
dsc->decoded->header.h,
(void *)dsc->decoded->data,
dsc->decoded->header.cf);
}
return res;
}
@ -167,6 +156,11 @@ void lv_image_decoder_close(lv_image_decoder_dsc_t * dsc)
{
if(dsc->decoder) {
if(dsc->decoder->close_cb) dsc->decoder->close_cb(dsc->decoder, dsc);
if(lv_image_cache_is_enabled() && dsc->cache && dsc->cache_entry) {
/*Decoded data is in cache, release it from cache's callback*/
lv_cache_release(dsc->cache, dsc->cache_entry, NULL);
}
}
}
@ -177,7 +171,7 @@ void lv_image_decoder_close(lv_image_decoder_dsc_t * dsc)
lv_image_decoder_t * lv_image_decoder_create(void)
{
lv_image_decoder_t * decoder;
decoder = _lv_ll_ins_head(img_decoder_ll_p);
decoder = lv_ll_ins_head(img_decoder_ll_p);
LV_ASSERT_MALLOC(decoder);
if(decoder == NULL) return NULL;
@ -188,16 +182,16 @@ lv_image_decoder_t * lv_image_decoder_create(void)
void lv_image_decoder_delete(lv_image_decoder_t * decoder)
{
_lv_ll_remove(img_decoder_ll_p, decoder);
lv_ll_remove(img_decoder_ll_p, decoder);
lv_free(decoder);
}
lv_image_decoder_t * lv_image_decoder_get_next(lv_image_decoder_t * decoder)
{
if(decoder == NULL)
return _lv_ll_get_head(img_decoder_ll_p);
return lv_ll_get_head(img_decoder_ll_p);
else
return _lv_ll_get_next(img_decoder_ll_p, decoder);
return lv_ll_get_next(img_decoder_ll_p, decoder);
}
void lv_image_decoder_set_info_cb(lv_image_decoder_t * decoder, lv_image_decoder_info_f_t info_cb)
@ -220,12 +214,6 @@ void lv_image_decoder_set_close_cb(lv_image_decoder_t * decoder, lv_image_decode
decoder->close_cb = close_cb;
}
void lv_image_decoder_set_cache_free_cb(lv_image_decoder_t * decoder, lv_cache_free_cb_t cache_free_cb)
{
decoder->cache_free_cb = cache_free_cb;
}
#if LV_CACHE_DEF_SIZE > 0
lv_cache_entry_t * lv_image_decoder_add_to_cache(lv_image_decoder_t * decoder,
lv_image_cache_data_t * search_key,
const lv_draw_buf_t * decoded, void * user_data)
@ -248,7 +236,6 @@ lv_cache_entry_t * lv_image_decoder_add_to_cache(lv_image_decoder_t * decoder,
return cache_entry;
}
#endif
lv_draw_buf_t * lv_image_decoder_post_process(lv_image_decoder_dsc_t * dsc, lv_draw_buf_t * decoded)
{
@ -261,7 +248,8 @@ lv_draw_buf_t * lv_image_decoder_post_process(lv_image_decoder_dsc_t * dsc, lv_d
LV_LOG_TRACE("Stride mismatch");
lv_result_t res = lv_draw_buf_adjust_stride(decoded, stride_expect);
if(res != LV_RESULT_OK) {
lv_draw_buf_t * aligned = lv_draw_buf_create(decoded->header.w, decoded->header.h, decoded->header.cf, stride_expect);
lv_draw_buf_t * aligned = lv_draw_buf_create_ex(image_cache_draw_buf_handlers, decoded->header.w, decoded->header.h,
decoded->header.cf, stride_expect);
if(aligned == NULL) {
LV_LOG_ERROR("No memory for Stride adjust.");
return NULL;
@ -285,9 +273,9 @@ lv_draw_buf_t * lv_image_decoder_post_process(lv_image_decoder_dsc_t * dsc, lv_d
lv_draw_buf_premultiply(decoded);
}
else {
decoded = lv_draw_buf_dup(decoded);
decoded = lv_draw_buf_dup_ex(image_cache_draw_buf_handlers, decoded);
if(decoded == NULL) {
LV_LOG_ERROR("No memory for premulitplying.");
LV_LOG_ERROR("No memory for premultiplying.");
return NULL;
}
@ -302,22 +290,25 @@ lv_draw_buf_t * lv_image_decoder_post_process(lv_image_decoder_dsc_t * dsc, lv_d
* STATIC FUNCTIONS
**********************/
static lv_image_decoder_t * image_decoder_get_info(const void * src, lv_image_header_t * header)
static lv_image_decoder_t * image_decoder_get_info(lv_image_decoder_dsc_t * dsc, lv_image_header_t * header)
{
lv_memzero(header, sizeof(lv_image_header_t));
if(src == NULL) return NULL;
const void * src = dsc->src;
lv_image_src_t src_type = dsc->src_type;
lv_image_src_t src_type = lv_image_src_get_type(src);
if(src_type == LV_IMAGE_SRC_VARIABLE) {
const lv_image_dsc_t * img_dsc = src;
if(img_dsc->data == NULL) return NULL;
}
lv_image_decoder_t * decoder;
if(src_type == LV_IMAGE_SRC_FILE) LV_LOG_TRACE("Try to find decoder for %s", (const char *)src);
else LV_LOG_TRACE("Try to find decoder for %p", src);
#if LV_IMAGE_HEADER_CACHE_DEF_CNT > 0
if(src_type == LV_IMAGE_SRC_FILE) {
lv_image_decoder_t * decoder;
bool is_header_cache_enabled = lv_image_header_cache_is_enabled();
if(is_header_cache_enabled && src_type == LV_IMAGE_SRC_FILE) {
lv_image_header_cache_data_t search_key;
search_key.src_type = src_type;
search_key.src = src;
@ -329,15 +320,30 @@ static lv_image_decoder_t * image_decoder_get_info(const void * src, lv_image_he
*header = cached_data->header;
decoder = cached_data->decoder;
lv_cache_release(img_header_cache_p, entry, NULL);
LV_LOG_TRACE("Found decoder %s in header cache", decoder->name);
return decoder;
}
}
#endif
_LV_LL_READ(img_decoder_ll_p, decoder) {
if(src_type == LV_IMAGE_SRC_FILE) {
lv_fs_res_t fs_res = lv_fs_open(&dsc->file, src, LV_FS_MODE_RD);
if(fs_res != LV_FS_RES_OK) {
LV_LOG_ERROR("File open failed: %" LV_PRIu32, (uint32_t)fs_res);
return NULL;
}
}
/*Search the decoders*/
lv_image_decoder_t * decoder_prev = NULL;
LV_LL_READ(img_decoder_ll_p, decoder) {
/*Info and Open callbacks are required*/
if(decoder->info_cb && decoder->open_cb) {
lv_result_t res = decoder->info_cb(decoder, src, header);
lv_fs_seek(&dsc->file, 0, LV_FS_SEEK_SET);
lv_result_t res = decoder->info_cb(decoder, dsc, header);
if(decoder_prev) LV_LOG_TRACE("Can't open image with decoder %s. Trying next decoder.", decoder_prev->name);
if(res == LV_RESULT_OK) {
if(header->stride == 0) {
LV_LOG_INFO("Image decoder didn't set stride. Calculate it from width.");
@ -345,11 +351,19 @@ static lv_image_decoder_t * image_decoder_get_info(const void * src, lv_image_he
}
break;
}
decoder_prev = decoder;
}
}
#if LV_IMAGE_HEADER_CACHE_DEF_CNT > 0
if(src_type == LV_IMAGE_SRC_FILE && decoder) {
if(decoder == NULL) LV_LOG_TRACE("No decoder found");
else LV_LOG_TRACE("Found decoder %s", decoder->name);
if(src_type == LV_IMAGE_SRC_FILE) {
lv_fs_close(&dsc->file);
}
if(is_header_cache_enabled && src_type == LV_IMAGE_SRC_FILE && decoder) {
lv_cache_entry_t * entry;
lv_image_header_cache_data_t search_key;
search_key.src_type = src_type;
@ -365,7 +379,6 @@ static lv_image_decoder_t * image_decoder_get_info(const void * src, lv_image_he
lv_cache_release(img_header_cache_p, entry, NULL);
}
#endif
return decoder;
}
@ -380,73 +393,6 @@ static uint32_t img_width_to_stride(lv_image_header_t * header)
}
}
#if LV_CACHE_DEF_SIZE > 0 || LV_IMAGE_HEADER_CACHE_DEF_CNT > 0
inline static lv_cache_compare_res_t image_decoder_common_compare(const void * lhs_src, lv_image_src_t lhs_src_type,
const void * rhs_src, lv_image_src_t rhs_src_type)
{
if(lhs_src_type == rhs_src_type) {
if(lhs_src_type == LV_IMAGE_SRC_FILE) {
int32_t cmp_res = lv_strcmp(lhs_src, rhs_src);
if(cmp_res != 0) {
return cmp_res > 0 ? 1 : -1;
}
}
else if(lhs_src_type == LV_IMAGE_SRC_VARIABLE) {
if(lhs_src != rhs_src) {
return lhs_src > rhs_src ? 1 : -1;
}
}
return 0;
}
return lhs_src_type > rhs_src_type ? 1 : -1;
}
#endif
#if LV_IMAGE_HEADER_CACHE_DEF_CNT > 0
static lv_cache_compare_res_t image_decoder_header_cache_compare_cb(
const lv_image_header_cache_data_t * lhs,
const lv_image_header_cache_data_t * rhs)
{
return image_decoder_common_compare(lhs->src, lhs->src_type, rhs->src, rhs->src_type);
}
static void image_decoder_header_cache_free_cb(lv_image_header_cache_data_t * entry, void * user_data)
{
LV_UNUSED(user_data); /*Unused*/
if(entry->src_type == LV_IMAGE_SRC_FILE) lv_free((void *)entry->src);
}
#endif
#if LV_CACHE_DEF_SIZE > 0
static lv_cache_compare_res_t image_decoder_cache_compare_cb(
const lv_image_cache_data_t * lhs,
const lv_image_cache_data_t * rhs)
{
return image_decoder_common_compare(lhs->src, lhs->src_type, rhs->src, rhs->src_type);
}
static void image_decoder_cache_free_cb(lv_image_cache_data_t * entry, void * user_data)
{
const lv_image_decoder_t * decoder = entry->decoder;
if(decoder == NULL) return; /* Why ? */
if(decoder->cache_free_cb) {
/* Decoder wants to free the cache by itself. */
decoder->cache_free_cb(entry, user_data);
}
else {
/* Destroy the decoded draw buffer if necessary. */
lv_draw_buf_t * decoded = (lv_draw_buf_t *)entry->decoded;
if(lv_draw_buf_has_flag(decoded, LV_IMAGE_FLAGS_ALLOCATED)) {
lv_draw_buf_destroy(decoded);
}
/*Free the duplicated file name*/
if(entry->src_type == LV_IMAGE_SRC_FILE) lv_free((void *)entry->src);
}
}
static lv_result_t try_cache(lv_image_decoder_dsc_t * dsc)
{
lv_cache_t * cache = dsc->cache;
@ -467,4 +413,3 @@ static lv_result_t try_cache(lv_image_decoder_dsc_t * dsc)
return LV_RESULT_INVALID;
}
#endif

View File

@ -15,7 +15,6 @@ extern "C" {
*********************/
#include "../lv_conf_internal.h"
#include <stdint.h>
#include "lv_draw_buf.h"
#include "../misc/lv_fs.h"
#include "../misc/lv_types.h"
@ -32,66 +31,39 @@ extern "C" {
/**
* Source of image.*/
enum _lv_image_src_t {
typedef enum {
LV_IMAGE_SRC_VARIABLE, /** Binary/C variable*/
LV_IMAGE_SRC_FILE, /** File in filesystem*/
LV_IMAGE_SRC_SYMBOL, /** Symbol (@ref lv_symbol_def.h)*/
LV_IMAGE_SRC_UNKNOWN, /** Unknown source*/
};
#ifdef DOXYGEN
typedef _lv_image_src_t lv_image_src_t;
#else
typedef uint8_t lv_image_src_t;
#endif /*DOXYGEN*/
/*Decoder function definitions*/
struct _lv_image_decoder_dsc_t;
typedef struct _lv_image_decoder_dsc_t lv_image_decoder_dsc_t;
/**
* Image decoder args.
* It determines how to decoder an image, e.g. whether to premultiply the alpha or not.
* It should be passed to lv_img_decoder_open() function. If NULL is provided, default
* args are used.
*
* Default args:
* all field are zero or false.
*/
typedef struct _lv_image_decoder_args_t {
bool stride_align; /*Whether stride should be aligned*/
bool premultiply; /*Whether image should be premultiplied or not after decoding*/
bool no_cache; /*When set, decoded image won't be put to cache, and decoder open will also ignore cache.*/
bool use_indexed; /*Decoded indexed image as is. Convert to ARGB8888 if false.*/
} lv_image_decoder_args_t;
} lv_image_src_t;
/**
* Get info from an image and store in the `header`
* @param src the image source. Can be a pointer to a C array or a file name (Use
* `lv_image_src_get_type` to determine the type)
* @param header store the info here
* @param decoder pointer to decoder object
* @param dsc pointer to decoder descriptor
* @param header store the info here
* @return LV_RESULT_OK: info written correctly; LV_RESULT_INVALID: failed
*/
typedef lv_result_t (*lv_image_decoder_info_f_t)(lv_image_decoder_t * decoder, const void * src,
typedef lv_result_t (*lv_image_decoder_info_f_t)(lv_image_decoder_t * decoder, lv_image_decoder_dsc_t * dsc,
lv_image_header_t * header);
/**
* Open an image for decoding. Prepare it as it is required to read it later
* @param decoder pointer to the decoder the function associated with
* @param dsc pointer to decoder descriptor. `src`, `color` are already initialized in it.
* @param decoder pointer to the decoder the function associated with
* @param dsc pointer to decoder descriptor. `src`, `color` are already initialized in it.
*/
typedef lv_result_t (*lv_image_decoder_open_f_t)(lv_image_decoder_t * decoder, lv_image_decoder_dsc_t * dsc);
/**
* Decode `len` pixels starting from the given `x`, `y` coordinates and store them in `buf`.
* Decode `full_area` pixels incrementally by calling in a loop. Set `decoded_area` values to `LV_COORD_MIN` on first call.
* Required only if the "open" function can't return with the whole decoded pixel array.
* @param decoder pointer to the decoder the function associated with
* @param dsc pointer to decoder descriptor
* @param x start x coordinate
* @param y start y coordinate
* @param len number of pixels to decode
* @param buf a buffer to store the decoded pixels
* @return LV_RESULT_OK: ok; LV_RESULT_INVALID: failed
* @param full_area input parameter. the full area to decode after enough subsequent calls
* @param decoded_area input+output parameter. set the values to `LV_COORD_MIN` for the first call and to reset decoding.
* the decoded area is stored here after each call.
* @return LV_RESULT_OK: ok; LV_RESULT_INVALID: failed or there is nothing left to decode
*/
typedef lv_result_t (*lv_image_decoder_get_area_cb_t)(lv_image_decoder_t * decoder,
lv_image_decoder_dsc_t * dsc,
@ -104,90 +76,10 @@ typedef lv_result_t (*lv_image_decoder_get_area_cb_t)(lv_image_decoder_t * decod
*/
typedef void (*lv_image_decoder_close_f_t)(lv_image_decoder_t * decoder, lv_image_decoder_dsc_t * dsc);
struct _lv_image_decoder_t {
lv_image_decoder_info_f_t info_cb;
lv_image_decoder_open_f_t open_cb;
lv_image_decoder_get_area_cb_t get_area_cb;
lv_image_decoder_close_f_t close_cb;
lv_cache_free_cb_t cache_free_cb;
void * user_data;
};
typedef struct _lv_image_decoder_cache_data_t {
lv_cache_slot_size_t slot;
const void * src;
lv_image_src_t src_type;
const lv_draw_buf_t * decoded;
const lv_image_decoder_t * decoder;
void * user_data;
} lv_image_cache_data_t;
typedef struct _lv_image_decoder_header_cache_data_t {
const void * src;
lv_image_src_t src_type;
lv_image_header_t header;
lv_image_decoder_t * decoder;
} lv_image_header_cache_data_t;
/**Describe an image decoding session. Stores data about the decoding*/
struct _lv_image_decoder_dsc_t {
/**The decoder which was able to open the image source*/
lv_image_decoder_t * decoder;
/*A copy of parameters of how this image is decoded*/
lv_image_decoder_args_t args;
/**The image source. A file path like "S:my_img.png" or pointer to an `lv_image_dsc_t` variable*/
const void * src;
/**Type of the source: file or variable. Can be set in `open` function if required*/
lv_image_src_t src_type;
/**Info about the opened image: color format, size, etc. MUST be set in `open` function*/
lv_image_header_t header;
/** Pointer to a draw buffer where the image's data (pixels) are stored in a decoded, plain format.
* MUST be set in `open` or `get_area_cb`function*/
const lv_draw_buf_t * decoded; /*A draw buffer to described decoded image.*/
const lv_color32_t * palette;
uint32_t palette_size;
/** How much time did it take to open the image. [ms]
* If not set `lv_image_cache` will measure and set the time to open*/
uint32_t time_to_open;
/**A text to display instead of the image when the image can't be opened.
* Can be set in `open` function or set NULL.*/
const char * error_msg;
lv_cache_t * cache;
/**Point to cache entry information*/
lv_cache_entry_t * cache_entry;
/**Store any custom data here is required*/
void * user_data;
};
/**********************
* GLOBAL PROTOTYPES
**********************/
/**
* Initialize the image decoder module
*/
void _lv_image_decoder_init(void);
/**
* Deinitialize the image decoder module
*/
void _lv_image_decoder_deinit(void);
/**
* Get information about an image.
* Try the created image decoder one by one. Once one is able to get info that info will be used.
@ -203,24 +95,24 @@ lv_result_t lv_image_decoder_get_info(const void * src, lv_image_header_t * head
/**
* Open an image.
* Try the created image decoders one by one. Once one is able to open the image that decoder is saved in `dsc`
* @param dsc describes a decoding session. Simply a pointer to an `lv_image_decoder_dsc_t` variable.
* @param src the image source. Can be
* 1) File name: E.g. "S:folder/img1.png" (The drivers needs to registered via `lv_fs_drv_register())`)
* 2) Variable: Pointer to an `lv_image_dsc_t` variable
* 3) Symbol: E.g. `LV_SYMBOL_OK`
* @param color The color of the image with `LV_COLOR_FORMAT_ALPHA_...`
* @param args args about how the image should be opened.
* @param dsc describes a decoding session. Simply a pointer to an `lv_image_decoder_dsc_t` variable.
* @param src the image source. Can be
* 1) File name: E.g. "S:folder/img1.png" (The drivers needs to registered via `lv_fs_drv_register())`)
* 2) Variable: Pointer to an `lv_image_dsc_t` variable
* 3) Symbol: E.g. `LV_SYMBOL_OK`
* @param args args about how the image should be opened.
* @return LV_RESULT_OK: opened the image. `dsc->decoded` and `dsc->header` are set.
* LV_RESULT_INVALID: none of the registered image decoders were able to open the image.
*/
lv_result_t lv_image_decoder_open(lv_image_decoder_dsc_t * dsc, const void * src, const lv_image_decoder_args_t * args);
/**
* Decode an area of the opened image
* Decode `full_area` pixels incrementally by calling in a loop. Set `decoded_area` to `LV_COORD_MIN` on first call.
* @param dsc image decoder descriptor
* @param full_area start X coordinate (from left)
* @param decoded_area start Y coordinate (from top)
* @return LV_RESULT_OK: success; LV_RESULT_INVALID: an error occurred
* @param full_area input parameter. the full area to decode after enough subsequent calls
* @param decoded_area input+output parameter. set the values to `LV_COORD_MIN` for the first call and to reset decoding.
* the decoded area is stored here after each call.
* @return LV_RESULT_OK: success; LV_RESULT_INVALID: an error occurred or there is nothing left to decode
*/
lv_result_t lv_image_decoder_get_area(lv_image_decoder_dsc_t * dsc, const lv_area_t * full_area,
lv_area_t * decoded_area);
@ -278,22 +170,9 @@ void lv_image_decoder_set_get_area_cb(lv_image_decoder_t * decoder, lv_image_dec
*/
void lv_image_decoder_set_close_cb(lv_image_decoder_t * decoder, lv_image_decoder_close_f_t close_cb);
/**
* Set a custom method to free cache data.
* Normally this is not needed. If the custom decoder allocates additional memory other than dsc->decoded
* draw buffer, then you need to register your own method to free it. By default the cache entry is free'ed
* in `image_decoder_cache_free_cb`.
*
* @param decoder pointer to the image decoder
* @param cache_free_cb the custom callback to free cache data. Refer to `image_decoder_cache_free_cb`.
*/
void lv_image_decoder_set_cache_free_cb(lv_image_decoder_t * decoder, lv_cache_free_cb_t cache_free_cb);
#if LV_CACHE_DEF_SIZE > 0
lv_cache_entry_t * lv_image_decoder_add_to_cache(lv_image_decoder_t * decoder,
lv_image_cache_data_t * search_key,
const lv_draw_buf_t * decoded, void * user_data);
#endif
/**
* Check the decoded image, make any modification if decoder `args` requires.

View File

@ -0,0 +1,142 @@
/**
* @file lv_image_decoder_private.h
*
*/
#ifndef LV_IMAGE_DECODER_PRIVATE_H
#define LV_IMAGE_DECODER_PRIVATE_H
#ifdef __cplusplus
extern "C" {
#endif
/*********************
* INCLUDES
*********************/
#include "lv_image_decoder.h"
/*********************
* DEFINES
*********************/
/**********************
* TYPEDEFS
**********************/
/**
* Image decoder args.
* It determines how to decoder an image, e.g. whether to premultiply the alpha or not.
* It should be passed to lv_img_decoder_open() function. If NULL is provided, default
* args are used.
*
* Default args:
* all field are zero or false.
*/
struct lv_image_decoder_args_t {
bool stride_align; /**< Whether stride should be aligned */
bool premultiply; /**< Whether image should be premultiplied or not after decoding */
bool no_cache; /**< When set, decoded image won't be put to cache, and decoder open will also ignore cache. */
bool use_indexed; /**< Decoded indexed image as is. Convert to ARGB8888 if false. */
bool flush_cache; /**< Whether to flush the data cache after decoding */
};
struct lv_image_decoder_t {
lv_image_decoder_info_f_t info_cb;
lv_image_decoder_open_f_t open_cb;
lv_image_decoder_get_area_cb_t get_area_cb;
lv_image_decoder_close_f_t close_cb;
const char * name;
void * user_data;
};
struct lv_image_cache_data_t {
lv_cache_slot_size_t slot;
const void * src;
lv_image_src_t src_type;
const lv_draw_buf_t * decoded;
const lv_image_decoder_t * decoder;
void * user_data;
};
struct lv_image_header_cache_data_t {
const void * src;
lv_image_src_t src_type;
lv_image_header_t header;
lv_image_decoder_t * decoder;
};
/**Describe an image decoding session. Stores data about the decoding*/
struct lv_image_decoder_dsc_t {
/**The decoder which was able to open the image source*/
lv_image_decoder_t * decoder;
/**A copy of parameters of how this image is decoded*/
lv_image_decoder_args_t args;
/**The image source. A file path like "S:my_img.png" or pointer to an `lv_image_dsc_t` variable*/
const void * src;
/**Type of the source: file or variable. Can be set in `open` function if required*/
lv_image_src_t src_type;
lv_fs_file_t file;
/**Info about the opened image: color format, size, etc. MUST be set in `open` function*/
lv_image_header_t header;
/** Pointer to a draw buffer where the image's data (pixels) are stored in a decoded, plain format.
* MUST be set in `open` or `get_area_cb`function*/
const lv_draw_buf_t * decoded;
const lv_color32_t * palette;
uint32_t palette_size;
/** How much time did it take to open the image. [ms]
* If not set `lv_image_cache` will measure and set the time to open*/
uint32_t time_to_open;
/**A text to display instead of the image when the image can't be opened.
* Can be set in `open` function or set NULL.*/
const char * error_msg;
lv_cache_t * cache;
/**Point to cache entry information*/
lv_cache_entry_t * cache_entry;
/**Store any custom data here is required*/
void * user_data;
};
/**********************
* GLOBAL PROTOTYPES
**********************/
/**
* Initialize the image decoder module
* @param image_cache_size Image cache size in bytes. 0 to disable cache.
* @param image_header_count Number of header cache entries. 0 to disable header cache.
*/
void lv_image_decoder_init(uint32_t image_cache_size, uint32_t image_header_count);
/**
* Deinitialize the image decoder module
*/
void lv_image_decoder_deinit(void);
/**********************
* MACROS
**********************/
#ifdef __cplusplus
} /*extern "C"*/
#endif
#endif /*LV_IMAGE_DECODER_PRIVATE_H*/

View File

@ -3,8 +3,8 @@
*
*/
#ifndef LV_IMAGE_BUF_H
#define LV_IMAGE_BUF_H
#ifndef LV_IMAGE_DSC_H
#define LV_IMAGE_DSC_H
#ifdef __cplusplus
extern "C" {
@ -20,7 +20,7 @@ extern "C" {
*********************/
/** Magic number for lvgl image, 9 means lvgl version 9
* It must not be a valid ASCII character nor larger than 0x80. See `lv_image_src_get_type`.
* It must be neither a valid ASCII character nor larger than 0x80. See `lv_image_src_get_type`.
*/
#define LV_IMAGE_HEADER_MAGIC (0x19)
LV_EXPORT_CONST_INT(LV_IMAGE_HEADER_MAGIC);
@ -29,7 +29,7 @@ LV_EXPORT_CONST_INT(LV_IMAGE_HEADER_MAGIC);
* TYPEDEFS
**********************/
typedef enum _lv_image_flags_t {
typedef enum lv_image_flags_t {
/**
* For RGB map of the image data, mark if it's pre-multiplied with alpha.
* For indexed image, this bit indicated palette data is pre-multiplied with alpha.
@ -70,49 +70,49 @@ typedef enum _lv_image_flags_t {
typedef enum {
LV_IMAGE_COMPRESS_NONE = 0,
LV_IMAGE_COMPRESS_RLE, /*LVGL custom RLE compression*/
LV_IMAGE_COMPRESS_RLE, /**< LVGL custom RLE compression */
LV_IMAGE_COMPRESS_LZ4,
} lv_image_compress_t;
#if LV_BIG_ENDIAN_SYSTEM
typedef struct {
uint32_t reserved_2: 16; /*Reserved to be used later*/
uint32_t stride: 16; /*Number of bytes in a row*/
uint32_t reserved_2: 16; /**< Reserved to be used later*/
uint32_t stride: 16; /**< Number of bytes in a row*/
uint32_t h: 16;
uint32_t w: 16;
uint32_t flags: 16; /*Image flags, see `lv_image_flags_t`*/
uint32_t cf : 8; /*Color format: See `lv_color_format_t`*/
uint32_t magic: 8; /*Magic number. Must be LV_IMAGE_HEADER_MAGIC*/
uint32_t flags: 16; /**< Image flags, see `lv_image_flags_t`*/
uint32_t cf : 8; /**< Color format: See `lv_color_format_t`*/
uint32_t magic: 8; /**< Magic number. Must be LV_IMAGE_HEADER_MAGIC*/
} lv_image_header_t;
#else
typedef struct {
uint32_t magic: 8; /*Magic number. Must be LV_IMAGE_HEADER_MAGIC*/
uint32_t cf : 8; /*Color format: See `lv_color_format_t`*/
uint32_t flags: 16; /*Image flags, see `lv_image_flags_t`*/
uint32_t magic: 8; /**< Magic number. Must be LV_IMAGE_HEADER_MAGIC*/
uint32_t cf : 8; /**< Color format: See `lv_color_format_t`*/
uint32_t flags: 16; /**< Image flags, see `lv_image_flags_t`*/
uint32_t w: 16;
uint32_t h: 16;
uint32_t stride: 16; /*Number of bytes in a row*/
uint32_t reserved_2: 16; /*Reserved to be used later*/
uint32_t stride: 16; /**< Number of bytes in a row*/
uint32_t reserved_2: 16; /**< Reserved to be used later*/
} lv_image_header_t;
#endif
typedef struct {
void * buf;
uint32_t stride; /*Number of bytes in a row*/
uint32_t stride; /**< Number of bytes in a row*/
} lv_yuv_plane_t;
typedef union {
lv_yuv_plane_t yuv; /*packed format*/
lv_yuv_plane_t yuv; /**< packed format*/
struct {
lv_yuv_plane_t y;
lv_yuv_plane_t u;
lv_yuv_plane_t v;
} planar; /*planar format with 3 plane*/
} planar; /**< planar format with 3 plane*/
struct {
lv_yuv_plane_t y;
lv_yuv_plane_t uv;
} semi_planar; /*planar format with 2 plane*/
} semi_planar; /**< planar format with 2 plane*/
} lv_yuv_buf_t;
/**
@ -138,4 +138,4 @@ typedef struct {
} /*extern "C"*/
#endif
#endif /*LV_IMAGE_BUF_H*/
#endif /*LV_IMAGE_DSC_H*/

View File

@ -16,6 +16,7 @@
#include "lv_draw_pxp.h"
#if LV_USE_DRAW_PXP
#include "../../lv_draw_buf_private.h"
#include "lv_pxp_cfg.h"
#include "lv_pxp_utils.h"
@ -68,7 +69,7 @@ static void _invalidate_cache(const lv_draw_buf_t * draw_buf, const lv_area_t *
uint16_t size = stride * lv_area_get_height(area);
/* Invalidate full buffer. */
DCACHE_CleanInvalidateByRange((uint32_t)draw_buf->data, size);
DEMO_CleanInvalidateCacheByAddr((void *)draw_buf->data, size);
return;
}
@ -103,7 +104,7 @@ static void _invalidate_cache(const lv_draw_buf_t * draw_buf, const lv_area_t *
for(uint16_t y = 0; y < area_height; y++) {
const void * line_addr = buf_u8 + y * stride;
DCACHE_CleanInvalidateByRange((uint32_t)line_addr, line_size);
DEMO_CleanInvalidateCacheByAddr((void *)line_addr, line_size);
}
}

View File

@ -54,7 +54,7 @@ static int32_t _pxp_dispatch(lv_draw_unit_t * draw_unit, lv_layer_t * layer);
*/
static int32_t _pxp_delete(lv_draw_unit_t * draw_unit);
#if LV_USE_OS
#if LV_USE_PXP_DRAW_THREAD
static void _pxp_render_thread_cb(void * ptr);
#endif
@ -91,7 +91,7 @@ void lv_draw_pxp_init(void)
lv_pxp_init();
#if LV_USE_OS
#if LV_USE_PXP_DRAW_THREAD
lv_thread_init(&draw_pxp_unit->thread, LV_THREAD_PRIO_HIGH, _pxp_render_thread_cb, 2 * 1024, draw_pxp_unit);
#endif
}
@ -284,6 +284,9 @@ static int32_t _pxp_evaluate(lv_draw_unit_t * u, lv_draw_task_t * t)
lv_draw_image_dsc_t * draw_dsc = (lv_draw_image_dsc_t *) t->draw_dsc;
const lv_image_dsc_t * img_dsc = draw_dsc->src;
if(draw_dsc->tile)
return 0;
if((!_pxp_src_cf_supported(img_dsc->header.cf)) ||
(!pxp_buf_aligned(img_dsc->data, img_dsc->header.stride)))
return 0;
@ -316,18 +319,18 @@ static int32_t _pxp_dispatch(lv_draw_unit_t * draw_unit, lv_layer_t * layer)
lv_draw_task_t * t = lv_draw_get_next_available_task(layer, NULL, DRAW_UNIT_ID_PXP);
if(t == NULL || t->preferred_draw_unit_id != DRAW_UNIT_ID_PXP)
return -1;
return LV_DRAW_UNIT_IDLE;
void * buf = lv_draw_layer_alloc_buf(layer);
if(buf == NULL)
return -1;
return LV_DRAW_UNIT_IDLE;
t->state = LV_DRAW_TASK_STATE_IN_PROGRESS;
draw_pxp_unit->base_unit.target_layer = layer;
draw_pxp_unit->base_unit.clip_area = &t->clip_area;
draw_pxp_unit->task_act = t;
#if LV_USE_OS
#if LV_USE_PXP_DRAW_THREAD
/* Let the render thread work. */
if(draw_pxp_unit->inited)
lv_thread_sync_signal(&draw_pxp_unit->sync);
@ -346,7 +349,7 @@ static int32_t _pxp_dispatch(lv_draw_unit_t * draw_unit, lv_layer_t * layer)
static int32_t _pxp_delete(lv_draw_unit_t * draw_unit)
{
#if LV_USE_OS
#if LV_USE_PXP_DRAW_THREAD
lv_draw_pxp_unit_t * draw_pxp_unit = (lv_draw_pxp_unit_t *) draw_unit;
LV_LOG_INFO("Cancel PXP draw thread.");
@ -373,7 +376,7 @@ static void _pxp_execute_drawing(lv_draw_pxp_unit_t * u)
lv_draw_buf_t * draw_buf = layer->draw_buf;
lv_area_t draw_area;
if(!_lv_area_intersect(&draw_area, &t->area, draw_unit->clip_area))
if(!lv_area_intersect(&draw_area, &t->area, draw_unit->clip_area))
return; /*Fully clipped, nothing to do*/
/* Make area relative to the buffer */
@ -400,7 +403,7 @@ static void _pxp_execute_drawing(lv_draw_pxp_unit_t * u)
/*Layers manage it for themselves*/
if(t->type != LV_DRAW_TASK_TYPE_LAYER) {
lv_area_t draw_area;
if(!_lv_area_intersect(&draw_area, &t->area, u->base_unit.clip_area))
if(!lv_area_intersect(&draw_area, &t->area, u->base_unit.clip_area))
return;
int32_t idx = 0;
@ -411,7 +414,7 @@ static void _pxp_execute_drawing(lv_draw_pxp_unit_t * u)
}
lv_draw_rect_dsc_t rect_dsc;
lv_draw_rect_dsc_init(&rect_dsc);
rect_dsc.bg_color = lv_palette_main(idx % _LV_PALETTE_LAST);
rect_dsc.bg_color = lv_palette_main(idx % LV_PALETTE_LAST);
rect_dsc.border_color = rect_dsc.bg_color;
rect_dsc.bg_opa = LV_OPA_10;
rect_dsc.border_opa = LV_OPA_80;
@ -442,7 +445,7 @@ static void _pxp_execute_drawing(lv_draw_pxp_unit_t * u)
#endif
}
#if LV_USE_OS
#if LV_USE_PXP_DRAW_THREAD
static void _pxp_render_thread_cb(void * ptr)
{
lv_draw_pxp_unit_t * u = ptr;

View File

@ -64,7 +64,7 @@ void lv_draw_pxp_fill(lv_draw_unit_t * draw_unit, const lv_draw_fill_dsc_t * dsc
lv_area_move(&rel_clip_area, -layer->buf_area.x1, -layer->buf_area.y1);
lv_area_t blend_area;
if(!_lv_area_intersect(&blend_area, &rel_coords, &rel_clip_area))
if(!lv_area_intersect(&blend_area, &rel_coords, &rel_clip_area))
return; /*Fully clipped, nothing to do*/
_pxp_fill(draw_buf->data, &blend_area, draw_buf->header.stride, draw_buf->header.cf, dsc);

View File

@ -82,7 +82,7 @@ void lv_draw_pxp_img(lv_draw_unit_t * draw_unit, const lv_draw_image_dsc_t * dsc
bool has_transform = (dsc->rotation != 0 || dsc->scale_x != LV_SCALE_NONE || dsc->scale_y != LV_SCALE_NONE);
if(has_transform)
lv_area_copy(&blend_area, &rel_coords);
else if(!_lv_area_intersect(&blend_area, &rel_coords, &rel_clip_area))
else if(!lv_area_intersect(&blend_area, &rel_coords, &rel_clip_area))
return; /*Fully clipped, nothing to do*/
const uint8_t * src_buf = img_dsc->data;
@ -252,8 +252,8 @@ static void _pxp_blit_transform(uint8_t * dest_buf, const lv_area_t * dest_area,
dest_h = src_h * fp_scale_y + trim_y;
/*Final pivot offset = scale_factor * rotation_pivot_offset + scaling_pivot_offset*/
piv_offset_x = floor(fp_scale_x * piv_offset_x) - floor((fp_scale_x - 1) * pivot.x);
piv_offset_y = floor(fp_scale_y * piv_offset_y) - floor((fp_scale_y - 1) * pivot.y);
piv_offset_x = floorf(fp_scale_x * piv_offset_x) - floorf((fp_scale_x - 1) * pivot.x);
piv_offset_y = floorf(fp_scale_y * piv_offset_y) - floorf((fp_scale_y - 1) * pivot.y);
}
/*PS buffer - source image*/

View File

@ -81,8 +81,8 @@ void lv_draw_pxp_layer(lv_draw_unit_t * draw_unit, const lv_draw_image_dsc_t * d
int32_t w = lv_area_get_width(coords);
int32_t h = lv_area_get_height(coords);
_lv_image_buf_get_transformed_area(&area_rot, w, h, draw_dsc->rotation, draw_dsc->scale_x, draw_dsc->scale_y,
&draw_dsc->pivot);
lv_image_buf_get_transformed_area(&area_rot, w, h, draw_dsc->rotation, draw_dsc->scale_x, draw_dsc->scale_y,
&draw_dsc->pivot);
area_rot.x1 += coords->x1;
area_rot.y1 += coords->y1;
@ -90,7 +90,7 @@ void lv_draw_pxp_layer(lv_draw_unit_t * draw_unit, const lv_draw_image_dsc_t * d
area_rot.y2 += coords->y1;
}
lv_area_t draw_area;
if(!_lv_area_intersect(&draw_area, &area_rot, draw_unit->clip_area)) return;
if(!lv_area_intersect(&draw_area, &area_rot, draw_unit->clip_area)) return;
#endif
#if LV_USE_LAYER_DEBUG
@ -119,13 +119,13 @@ void lv_draw_pxp_layer(lv_draw_unit_t * draw_unit, const lv_draw_image_dsc_t * d
lv_draw_fill_dsc_t fill_dsc;
lv_draw_rect_dsc_init(&fill_dsc);
fill_dsc.color = lv_palette_main(idx % _LV_PALETTE_LAST);
fill_dsc.color = lv_palette_main(idx % LV_PALETTE_LAST);
fill_dsc.opa = LV_OPA_10;
lv_draw_sw_fill(draw_unit, &fill_dsc, &area_rot);
lv_draw_border_dsc_t border_dsc;
lv_draw_border_dsc_init(&border_dsc);
border_dsc.color = lv_palette_main(idx % _LV_PALETTE_LAST);
border_dsc.color = lv_palette_main(idx % LV_PALETTE_LAST);
border_dsc.opa = LV_OPA_100;
border_dsc.width = 2;
lv_draw_sw_border(draw_unit, &border_dsc, &area_rot);

View File

@ -18,11 +18,16 @@
#if LV_USE_DRAW_PXP
#include "lv_pxp_utils.h"
#include "../../../misc/lv_log.h"
#include "../../../osal/lv_os.h"
#include "fsl_pxp.h"
#if defined(SDK_OS_FREE_RTOS)
#include "FreeRTOS.h"
#include "semphr.h"
#endif
#if defined(__ZEPHYR__)
#include <zephyr/kernel.h>
#include <zephyr/irq.h>
#endif
/*********************
@ -57,12 +62,19 @@ static void _pxp_run(void);
*/
static void _pxp_wait(void);
#if defined(__ZEPHYR__)
/**
* Interrupt handler for Zephyr IRQ
*/
static void _pxp_zephyr_irq_handler(void *);
#endif
/**********************
* STATIC VARIABLES
**********************/
#if defined(SDK_OS_FREE_RTOS)
static SemaphoreHandle_t xPXPIdleSemaphore;
#if LV_USE_OS
static lv_thread_sync_t pxp_sync;
#endif
static volatile bool ucPXPIdle;
@ -83,20 +95,10 @@ static pxp_cfg_t _pxp_default_cfg = {
void PXP_IRQHandler(void)
{
#if defined(SDK_OS_FREE_RTOS)
BaseType_t xHigherPriorityTaskWoken = pdFALSE;
#endif
if(kPXP_CompleteFlag & PXP_GetStatusFlags(PXP_ID)) {
PXP_ClearStatusFlags(PXP_ID, kPXP_CompleteFlag);
#if defined(SDK_OS_FREE_RTOS)
xSemaphoreGiveFromISR(xPXPIdleSemaphore, &xHigherPriorityTaskWoken);
/* If xHigherPriorityTaskWoken is now set to pdTRUE then a context switch
should be performed to ensure the interrupt returns directly to the highest
priority task. The macro used for this purpose is dependent on the port in
use and may be called portEND_SWITCHING_ISR(). */
portYIELD_FROM_ISR(xHigherPriorityTaskWoken);
#if LV_USE_OS
lv_thread_sync_signal_isr(&pxp_sync);
#else
ucPXPIdle = true;
#endif
@ -112,24 +114,45 @@ pxp_cfg_t * pxp_get_default_cfg(void)
* STATIC FUNCTIONS
**********************/
#if defined(__ZEPHYR__)
static void _pxp_zephyr_irq_handler(void *)
{
PXP_IRQHandler();
}
#endif
static void _pxp_interrupt_init(void)
{
#if defined(SDK_OS_FREE_RTOS)
xPXPIdleSemaphore = xSemaphoreCreateBinary();
PXP_ASSERT_MSG(xPXPIdleSemaphore, "xSemaphoreCreateBinary failed!");
#if LV_USE_OS
if(lv_thread_sync_init(&pxp_sync) != LV_RESULT_OK) {
PXP_ASSERT_MSG(false, "Failed to init thread_sync.");
}
#endif
#if defined(__ZEPHYR__)
IRQ_CONNECT(DT_IRQN(DT_NODELABEL(pxp)), CONFIG_LV_Z_PXP_INTERRUPT_PRIORITY, _pxp_zephyr_irq_handler, NULL, 0);
irq_enable(DT_IRQN(DT_NODELABEL(pxp)));
#elif defined(SDK_OS_FREE_RTOS)
NVIC_SetPriority(PXP_IRQ_ID, configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY + 1);
#endif
ucPXPIdle = true;
#if !defined(__ZEPHYR__)
NVIC_EnableIRQ(PXP_IRQ_ID);
#endif
ucPXPIdle = true;
}
static void _pxp_interrupt_deinit(void)
{
#if defined(__ZEPHYR__)
irq_disable(DT_IRQN(DT_NODELABEL(pxp)));
#else
NVIC_DisableIRQ(PXP_IRQ_ID);
#if defined(SDK_OS_FREE_RTOS)
vSemaphoreDelete(xPXPIdleSemaphore);
#endif
#if LV_USE_OS
lv_thread_sync_delete(&pxp_sync);
#endif
}
@ -149,12 +172,10 @@ static void _pxp_run(void)
*/
static void _pxp_wait(void)
{
#if defined(SDK_OS_FREE_RTOS)
/* Return if PXP was never started, otherwise the semaphore will lock forever. */
if(ucPXPIdle == true)
return;
if(xSemaphoreTake(xPXPIdleSemaphore, portMAX_DELAY) == pdTRUE)
#if LV_USE_OS
if(lv_thread_sync_wait(&pxp_sync) == LV_RESULT_OK)
ucPXPIdle = true;
#else
while(ucPXPIdle == false) {

View File

@ -16,6 +16,7 @@
#include "lv_draw_vglite.h"
#if LV_USE_DRAW_VGLITE
#include "../../lv_draw_buf_private.h"
#include "lv_vglite_buf.h"
#include "lv_vglite_utils.h"
@ -33,13 +34,7 @@
* STATIC PROTOTYPES
**********************/
static void * _buf_malloc(size_t size_bytes, lv_color_format_t cf);
static void * _buf_align(void * buf, lv_color_format_t cf);
static void _invalidate_cache(const void * buf, uint32_t stride, lv_color_format_t cf, const lv_area_t * area);
static uint32_t _width_to_stride(uint32_t w, lv_color_format_t cf);
static void _invalidate_cache(const lv_draw_buf_t * draw_buf, const lv_area_t * area);
/**********************
* STATIC VARIABLES
@ -57,39 +52,13 @@ void lv_draw_buf_vglite_init_handlers(void)
{
lv_draw_buf_handlers_t * handlers = lv_draw_buf_get_handlers();
handlers->buf_malloc_cb = _buf_malloc;
handlers->align_pointer_cb = _buf_align;
handlers->invalidate_cache_cb = _invalidate_cache;
handlers->width_to_stride_cb = _width_to_stride;
}
/**********************
* STATIC FUNCTIONS
**********************/
static void * _buf_malloc(size_t size_bytes, lv_color_format_t cf)
{
uint8_t align_bytes = vglite_get_alignment(cf);
/*Allocate larger memory to be sure it can be aligned as needed*/
size_bytes += align_bytes - 1;
return lv_malloc(size_bytes);
}
static void * _buf_align(void * buf, lv_color_format_t cf)
{
uint8_t align_bytes = vglite_get_alignment(cf);
uint8_t * buf_u8 = buf;
if(buf_u8) {
buf_u8 += align_bytes - 1;
buf_u8 = (uint8_t *)((lv_uintptr_t)buf_u8 & ~(align_bytes - 1));
}
return buf_u8;
}
static void _invalidate_cache(const lv_draw_buf_t * draw_buf, const lv_area_t * area)
{
const lv_image_header_t * header = &draw_buf->header;
@ -100,11 +69,11 @@ static void _invalidate_cache(const lv_draw_buf_t * draw_buf, const lv_area_t *
uint16_t size = stride * lv_area_get_height(area);
/* Invalidate full buffer. */
DEMO_CleanInvalidateCacheByAddr((void *)buf, size);
DEMO_CleanInvalidateCacheByAddr((void *)draw_buf->data, size);
return;
}
const uint8_t * buf_u8 = buf;
const uint8_t * buf_u8 = draw_buf->data;
/* ARM require a 32 byte aligned address. */
uint8_t align_bytes = 32;
uint8_t bits_per_pixel = lv_color_format_get_bpp(cf);
@ -139,14 +108,4 @@ static void _invalidate_cache(const lv_draw_buf_t * draw_buf, const lv_area_t *
}
}
static uint32_t _width_to_stride(uint32_t w, lv_color_format_t cf)
{
uint8_t bits_per_pixel = lv_color_format_get_bpp(cf);
uint32_t width_bits = (w * bits_per_pixel + 7) & ~7;
uint32_t width_bytes = width_bits / 8;
uint8_t align_bytes = vglite_get_alignment(cf);
return (width_bytes + align_bytes - 1) & ~(align_bytes - 1);
}
#endif /*LV_USE_DRAW_VGLITE*/

View File

@ -19,9 +19,7 @@
#include "lv_vglite_buf.h"
#include "lv_vglite_utils.h"
#if LV_USE_PARALLEL_DRAW_DEBUG
#include "../../../core/lv_global.h"
#endif
#include "../../../core/lv_global.h"
/*********************
* DEFINES
@ -30,7 +28,7 @@
#define DRAW_UNIT_ID_VGLITE 2
#if LV_USE_VGLITE_DRAW_ASYNC
#define VGLITE_TASK_BUF_SIZE 10
#define VGLITE_TASK_BUF_SIZE 100
#endif
/**********************
@ -63,12 +61,19 @@ static int32_t _vglite_evaluate(lv_draw_unit_t * draw_unit, lv_draw_task_t * tas
*/
static int32_t _vglite_dispatch(lv_draw_unit_t * draw_unit, lv_layer_t * layer);
/*
* Wait for VG-Lite draw unit to finish.
*/
#if LV_USE_VGLITE_DRAW_ASYNC
static int32_t _vglite_wait_for_finish(lv_draw_unit_t * draw_unit);
#endif
/*
* Delete the VGLite draw unit.
*/
static int32_t _vglite_delete(lv_draw_unit_t * draw_unit);
#if LV_USE_OS
#if LV_USE_VGLITE_DRAW_THREAD
static void _vglite_render_thread_cb(void * ptr);
#endif
@ -78,9 +83,7 @@ static void _vglite_execute_drawing(lv_draw_vglite_unit_t * u);
* STATIC VARIABLES
**********************/
#if LV_USE_PARALLEL_DRAW_DEBUG
#define _draw_info LV_GLOBAL_DEFAULT()->draw_info
#endif
#define _draw_info LV_GLOBAL_DEFAULT()->draw_info
#if LV_USE_VGLITE_DRAW_ASYNC
/*
@ -108,9 +111,12 @@ void lv_draw_vglite_init(void)
lv_draw_vglite_unit_t * draw_vglite_unit = lv_draw_create_unit(sizeof(lv_draw_vglite_unit_t));
draw_vglite_unit->base_unit.evaluate_cb = _vglite_evaluate;
draw_vglite_unit->base_unit.dispatch_cb = _vglite_dispatch;
#if LV_USE_VGLITE_DRAW_ASYNC
draw_vglite_unit->base_unit.wait_for_finish_cb = _vglite_wait_for_finish;
#endif
draw_vglite_unit->base_unit.delete_cb = _vglite_delete;
#if LV_USE_OS
#if LV_USE_VGLITE_DRAW_THREAD
lv_thread_init(&draw_vglite_unit->thread, LV_THREAD_PRIO_HIGH, _vglite_render_thread_cb, 2 * 1024, draw_vglite_unit);
#endif
}
@ -163,7 +169,7 @@ static inline bool _vglite_dest_cf_supported(lv_color_format_t cf)
case LV_COLOR_FORMAT_L8:
#endif
case LV_COLOR_FORMAT_RGB565:
#if CHIPTID == 0x555
#if CHIPID == 0x555
case LV_COLOR_FORMAT_RGB565A8:
case LV_COLOR_FORMAT_RGB888:
#endif
@ -212,11 +218,6 @@ static int32_t _vglite_evaluate(lv_draw_unit_t * u, lv_draw_task_t * t)
return 1;
case LV_DRAW_TASK_TYPE_BORDER: {
const lv_draw_border_dsc_t * draw_dsc = (lv_draw_border_dsc_t *) t->draw_dsc;
if(draw_dsc->side != (lv_border_side_t)LV_BORDER_SIDE_FULL)
return 0;
if(t->preference_score > 90) {
t->preference_score = 90;
t->preferred_draw_unit_id = DRAW_UNIT_ID_VGLITE;
@ -259,7 +260,7 @@ static int32_t _vglite_evaluate(lv_draw_unit_t * u, lv_draw_task_t * t)
#if LV_USE_VGLITE_BLIT_SPLIT
|| has_transform
#endif
|| (!vglite_buf_aligned(img_dsc->data, img_dsc->header.stride, img_dsc->header.cf))
|| (!vglite_src_buf_aligned(img_dsc->data, img_dsc->header.stride, img_dsc->header.cf))
)
return 0;
@ -287,19 +288,36 @@ static int32_t _vglite_dispatch(lv_draw_unit_t * draw_unit, lv_layer_t * layer)
/* Try to get an ready to draw. */
lv_draw_task_t * t = lv_draw_get_next_available_task(layer, NULL, DRAW_UNIT_ID_VGLITE);
if(t == NULL || t->preferred_draw_unit_id != DRAW_UNIT_ID_VGLITE)
return -1;
if(t == NULL)
return LV_DRAW_UNIT_IDLE;
if(lv_draw_get_unit_count() > 1) {
/* Let the SW unit to draw this task. */
if(t->preferred_draw_unit_id != DRAW_UNIT_ID_VGLITE)
return LV_DRAW_UNIT_IDLE;
}
else {
/* Fake unsupported tasks as ready. */
if(t->preferred_draw_unit_id != DRAW_UNIT_ID_VGLITE) {
t->state = LV_DRAW_TASK_STATE_READY;
/* Request a new dispatching as it can get a new task. */
lv_draw_dispatch_request();
return 1;
}
}
void * buf = lv_draw_layer_alloc_buf(layer);
if(buf == NULL)
return -1;
return LV_DRAW_UNIT_IDLE;
t->state = LV_DRAW_TASK_STATE_IN_PROGRESS;
draw_vglite_unit->base_unit.target_layer = layer;
draw_vglite_unit->base_unit.clip_area = &t->clip_area;
draw_vglite_unit->task_act = t;
#if LV_USE_OS
#if LV_USE_VGLITE_DRAW_THREAD
/* Let the render thread work. */
if(draw_vglite_unit->inited)
lv_thread_sync_signal(&draw_vglite_unit->sync);
@ -316,9 +334,22 @@ static int32_t _vglite_dispatch(lv_draw_unit_t * draw_unit, lv_layer_t * layer)
return 1;
}
#if LV_USE_VGLITE_DRAW_ASYNC
static int32_t _vglite_wait_for_finish(lv_draw_unit_t * draw_unit)
{
lv_draw_vglite_unit_t * draw_vglite_unit = (lv_draw_vglite_unit_t *) draw_unit;
draw_vglite_unit->wait_for_finish = true;
if(draw_vglite_unit->inited)
lv_thread_sync_signal(&draw_vglite_unit->sync);
return 1;
}
#endif
static int32_t _vglite_delete(lv_draw_unit_t * draw_unit)
{
#if LV_USE_OS
#if LV_USE_VGLITE_DRAW_THREAD
lv_draw_vglite_unit_t * draw_vglite_unit = (lv_draw_vglite_unit_t *) draw_unit;
LV_LOG_INFO("Cancel VGLite draw thread.");
@ -333,7 +364,7 @@ static int32_t _vglite_delete(lv_draw_unit_t * draw_unit)
#else
LV_UNUSED(draw_unit);
return 0;
return 1;
#endif
}
@ -356,11 +387,11 @@ static void _vglite_execute_drawing(lv_draw_vglite_unit_t * u)
lv_area_copy(&draw_area, &t->area);
lv_area_move(&draw_area, -layer->buf_area.x1, -layer->buf_area.y1);
if(!_lv_area_intersect(&draw_area, &draw_area, &clip_area))
if(!lv_area_intersect(&draw_area, &draw_area, &clip_area))
return; /*Fully clipped, nothing to do*/
/* Invalidate the drawing area */
lv_draw_buf_invalidate_cache(draw_buf, &draw_area);
if(_draw_info.unit_cnt > 1)
lv_draw_buf_invalidate_cache(draw_buf, &draw_area);
/* Set scissor area, excluding the split blit case */
#if LV_USE_VGLITE_BLIT_SPLIT
@ -404,7 +435,7 @@ static void _vglite_execute_drawing(lv_draw_vglite_unit_t * u)
/*Layers manage it for themselves*/
if(t->type != LV_DRAW_TASK_TYPE_LAYER) {
lv_area_t draw_area;
if(!_lv_area_intersect(&draw_area, &t->area, u->base_unit.clip_area))
if(!lv_area_intersect(&draw_area, &t->area, u->base_unit.clip_area))
return;
int32_t idx = 0;
@ -415,7 +446,7 @@ static void _vglite_execute_drawing(lv_draw_vglite_unit_t * u)
}
lv_draw_rect_dsc_t rect_dsc;
lv_draw_rect_dsc_init(&rect_dsc);
rect_dsc.bg_color = lv_palette_main(idx % _LV_PALETTE_LAST);
rect_dsc.bg_color = lv_palette_main(idx % LV_PALETTE_LAST);
rect_dsc.border_color = rect_dsc.bg_color;
rect_dsc.bg_opa = LV_OPA_10;
rect_dsc.border_opa = LV_OPA_80;
@ -447,27 +478,46 @@ static void _vglite_execute_drawing(lv_draw_vglite_unit_t * u)
}
#if LV_USE_VGLITE_DRAW_ASYNC
static inline void _vglite_queue_task(lv_draw_task_t * task_act)
static inline void _vglite_queue_task(lv_draw_task_t * task)
{
_draw_task_buf[_tail].task = task_act;
VGLITE_ASSERT_MSG(((_tail + 1) % VGLITE_TASK_BUF_SIZE) != _head, "VGLite task buffer full.");
_draw_task_buf[_tail].task = task;
_draw_task_buf[_tail].flushed = false;
_tail = (_tail + 1) % VGLITE_TASK_BUF_SIZE;
}
static inline void _vglite_signal_task_ready(lv_draw_task_t * task_act)
static inline void _vglite_signal_task_ready(lv_draw_task_t * task)
{
/* Signal the ready state to dispatcher. */
task->state = LV_DRAW_TASK_STATE_READY;
_head = (_head + 1) % VGLITE_TASK_BUF_SIZE;
/* No need to cleanup the tasks in buffer as we advance with the _head. */
}
static inline void _vglite_signal_all_task_ready(void)
{
int end = (_head <= _tail) ? _tail : _tail + VGLITE_TASK_BUF_SIZE;
for(int i = _head; i < end; i++) {
lv_draw_task_t * task = _draw_task_buf[i % VGLITE_TASK_BUF_SIZE].task;
_vglite_signal_task_ready(task);
}
}
static inline void _vglite_signal_flushed_task_ready(void)
{
if(vglite_cmd_buf_is_flushed()) {
int end = (_head < _tail) ? _tail : _tail + VGLITE_TASK_BUF_SIZE;
int end = (_head <= _tail) ? _tail : _tail + VGLITE_TASK_BUF_SIZE;
for(int i = _head; i < end; i++) {
/* Previous flushed tasks are ready now. */
if(_draw_task_buf[i % VGLITE_TASK_BUF_SIZE].flushed) {
lv_draw_task_t * task = _draw_task_buf[i % VGLITE_TASK_BUF_SIZE].task;
/* Signal the ready state to dispatcher. */
task->state = LV_DRAW_TASK_STATE_READY;
_head = (_head + 1) % VGLITE_TASK_BUF_SIZE;
/* No need to cleanup the tasks in buffer as we advance with the _head. */
_vglite_signal_task_ready(task);
}
else {
/* Those tasks have been flushed now. */
@ -475,13 +525,10 @@ static inline void _vglite_signal_task_ready(lv_draw_task_t * task_act)
}
}
}
if(task_act)
VGLITE_ASSERT_MSG(_tail != _head, "VGLite task buffer full.");
}
#endif
#if LV_USE_OS
#if LV_USE_VGLITE_DRAW_THREAD
static void _vglite_render_thread_cb(void * ptr)
{
lv_draw_vglite_unit_t * u = ptr;
@ -495,9 +542,9 @@ static void _vglite_render_thread_cb(void * ptr)
#if LV_USE_VGLITE_DRAW_ASYNC
/*
* Wait for sync if _draw_task_buf is empty.
* The thread will have to run as much as there are pending tasks.
* The thread will have to run to complete any pending tasks.
*/
&& _head == _tail
&& !u->wait_for_finish
#endif
) {
if(u->exit_status)
@ -518,16 +565,14 @@ static void _vglite_render_thread_cb(void * ptr)
_vglite_execute_drawing(u);
}
#if LV_USE_VGLITE_DRAW_ASYNC
else {
/*
* Update the flush status for last pending tasks.
* vg_lite_flush() will early return if there is nothing to submit.
*/
vglite_run();
if(u->wait_for_finish) {
u->wait_for_finish = false;
vglite_wait_for_finish();
_vglite_signal_all_task_ready();
}
else { /* u->task_act */
_vglite_signal_flushed_task_ready();
}
#endif
#if LV_USE_VGLITE_DRAW_ASYNC
_vglite_signal_task_ready((void *)u->task_act);
#else
/* Signal the ready state to dispatcher. */
u->task_act->state = LV_DRAW_TASK_STATE_READY;

View File

@ -23,7 +23,9 @@ extern "C" {
#include "../../../lv_conf_internal.h"
#if LV_USE_DRAW_VGLITE
#include "../../sw/lv_draw_sw.h"
#include "../../lv_draw_private.h"
#include "../../sw/lv_draw_sw_private.h"
#include "../../../misc/lv_area_private.h"
/*********************
* DEFINES
@ -33,7 +35,12 @@ extern "C" {
* TYPEDEFS
**********************/
typedef lv_draw_sw_unit_t lv_draw_vglite_unit_t;
typedef struct lv_draw_vglite_unit {
lv_draw_sw_unit_t;
#if LV_USE_VGLITE_DRAW_ASYNC
volatile bool wait_for_finish;
#endif
} lv_draw_vglite_unit_t;
/**********************
* GLOBAL PROTOTYPES

View File

@ -30,6 +30,9 @@
* DEFINES
*********************/
/*** Define maximum numbers of rectangles needed to clip partial borders ***/
#define MAX_NUM_RECTANGLES 4
/**********************
* TYPEDEFS
**********************/
@ -88,7 +91,7 @@ void lv_draw_vglite_border(lv_draw_unit_t * draw_unit, const lv_draw_border_dsc_
lv_area_move(&clip_area, -layer->buf_area.x1, -layer->buf_area.y1);
lv_area_t clipped_coords;
if(!_lv_area_intersect(&clipped_coords, &inward_coords, &clip_area))
if(!lv_area_intersect(&clipped_coords, &inward_coords, &clip_area))
return; /*Fully clipped, nothing to do*/
_vglite_draw_border(&inward_coords, &clip_area, dsc);
@ -132,6 +135,53 @@ static void _vglite_draw_border(const lv_area_t * coords, const lv_area_t * clip
vg_lite_identity(&matrix);
int32_t line_width = dsc->width;
lv_border_side_t border_side = dsc->side;
if(border_side == LV_BORDER_SIDE_FULL)
border_side = LV_BORDER_SIDE_TOP | LV_BORDER_SIDE_BOTTOM | LV_BORDER_SIDE_LEFT | LV_BORDER_SIDE_RIGHT;
uint32_t num_rect = 0;
vg_lite_rectangle_t rect[MAX_NUM_RECTANGLES];
int32_t rect_width = coords->x2 - coords->x1;
int32_t rect_height = coords->y2 - coords->y1;
int32_t shortest_side = LV_MIN(rect_width, rect_height);
int32_t final_radius = LV_MIN(radius, shortest_side / 2);
if(border_side & LV_BORDER_SIDE_TOP) {
rect[num_rect].x = coords->x1 - ceil(line_width / 2.0f);
rect[num_rect].y = coords->y1 - ceil(line_width / 2.0f);
rect[num_rect].width = coords->x2 - coords->x1 + line_width;
rect[num_rect].height = final_radius + ceil(line_width / 2.0f);
num_rect++;
}
if(border_side & LV_BORDER_SIDE_LEFT) {
rect[num_rect].x = coords->x1 - ceil(line_width / 2.0f);
rect[num_rect].y = coords->y1 - ceil(line_width / 2.0f);
rect[num_rect].width = final_radius + ceil(line_width / 2.0f);
rect[num_rect].height = coords->y2 - coords->y1 + line_width + 1;
num_rect++;
}
if(border_side & LV_BORDER_SIDE_RIGHT) {
rect[num_rect].x = coords->x2 - final_radius + 1;
rect[num_rect].y = coords->y1 - ceil(line_width / 2.0f);
rect[num_rect].width = final_radius + ceil(line_width / 2.0f);
rect[num_rect].height = coords->y2 - coords->y1 + line_width + 1;
num_rect++;
}
if(border_side & LV_BORDER_SIDE_BOTTOM) {
rect[num_rect].x = coords->x1 - ceil(line_width / 2.0f);
rect[num_rect].y = coords->y2 - final_radius + 1;
rect[num_rect].width = coords->x2 - coords->x1 + line_width;
rect[num_rect].height = final_radius + ceil(line_width / 2.0f);
num_rect++;
}
/*** Enable scissor and apply scissor rects ***/
VGLITE_CHECK_ERROR(vg_lite_enable_scissor());
VGLITE_CHECK_ERROR(vg_lite_scissor_rects(vgbuf, num_rect, rect));
/*** Draw border ***/
VGLITE_CHECK_ERROR(vg_lite_set_draw_path_type(&path, VG_LITE_DRAW_STROKE_PATH));
@ -145,6 +195,9 @@ static void _vglite_draw_border(const lv_area_t * coords, const lv_area_t * clip
vglite_run();
VGLITE_CHECK_ERROR(vg_lite_clear_path(&path));
/*** Disable scissor ***/
VGLITE_CHECK_ERROR(vg_lite_disable_scissor());
}
#endif /*LV_USE_DRAW_VGLITE*/

View File

@ -82,7 +82,7 @@ void lv_draw_vglite_fill(lv_draw_unit_t * draw_unit, const lv_draw_fill_dsc_t *
lv_area_move(&clip_area, -layer->buf_area.x1, -layer->buf_area.y1);
lv_area_t clipped_coords;
if(!_lv_area_intersect(&clipped_coords, &relative_coords, &clip_area))
if(!lv_area_intersect(&clipped_coords, &relative_coords, &clip_area))
return; /*Fully clipped, nothing to do*/
/*

Some files were not shown because too many files have changed in this diff Show More