LVGL library from v9.3.0 to v9.4.0 (#24028)

This commit is contained in:
s-hadinger 2025-10-18 12:32:57 +02:00 committed by GitHub
parent 11693762d0
commit 9011e9a69e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
652 changed files with 101666 additions and 60673 deletions

View File

@ -12,6 +12,7 @@ All notable changes to this project will be documented in this file.
### Changed
- Refactored library UDisplay (#24007)
- LVGL library from v9.3.0 to v9.4.0
### Fixed
- TLS fix ECDSA and add `SetOption165 1` to enable ECDSA in addition to RSA (#24000)

View File

@ -19,6 +19,29 @@ anim_resolve_speed|int, int, int|int|[lv_anim_resolve_speed](https://docs.lvgl.i
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)
arclabel_create|lv.obj|lv.obj|[lv_arclabel_create](https://docs.lvgl.io/9.0/search.html?q=lv_arclabel_create)
arclabel_get_angle_size|lv.obj|int|[lv_arclabel_get_angle_size](https://docs.lvgl.io/9.0/search.html?q=lv_arclabel_get_angle_size)
arclabel_get_angle_start|lv.obj|int|[lv_arclabel_get_angle_start](https://docs.lvgl.io/9.0/search.html?q=lv_arclabel_get_angle_start)
arclabel_get_center_offset_x|lv.obj|int|[lv_arclabel_get_center_offset_x](https://docs.lvgl.io/9.0/search.html?q=lv_arclabel_get_center_offset_x)
arclabel_get_center_offset_y|lv.obj|int|[lv_arclabel_get_center_offset_y](https://docs.lvgl.io/9.0/search.html?q=lv_arclabel_get_center_offset_y)
arclabel_get_dir|lv.obj|int|[lv_arclabel_get_dir](https://docs.lvgl.io/9.0/search.html?q=lv_arclabel_get_dir)
arclabel_get_radius|lv.obj|int|[lv_arclabel_get_radius](https://docs.lvgl.io/9.0/search.html?q=lv_arclabel_get_radius)
arclabel_get_recolor|lv.obj|bool|[lv_arclabel_get_recolor](https://docs.lvgl.io/9.0/search.html?q=lv_arclabel_get_recolor)
arclabel_get_text_horizontal_align|lv.obj|int|[lv_arclabel_get_text_horizontal_align](https://docs.lvgl.io/9.0/search.html?q=lv_arclabel_get_text_horizontal_align)
arclabel_get_text_vertical_align|lv.obj|int|[lv_arclabel_get_text_vertical_align](https://docs.lvgl.io/9.0/search.html?q=lv_arclabel_get_text_vertical_align)
arclabel_set_angle_size|lv.obj, int||[lv_arclabel_set_angle_size](https://docs.lvgl.io/9.0/search.html?q=lv_arclabel_set_angle_size)
arclabel_set_angle_start|lv.obj, int||[lv_arclabel_set_angle_start](https://docs.lvgl.io/9.0/search.html?q=lv_arclabel_set_angle_start)
arclabel_set_center_offset_x|lv.obj, int||[lv_arclabel_set_center_offset_x](https://docs.lvgl.io/9.0/search.html?q=lv_arclabel_set_center_offset_x)
arclabel_set_center_offset_y|lv.obj, int||[lv_arclabel_set_center_offset_y](https://docs.lvgl.io/9.0/search.html?q=lv_arclabel_set_center_offset_y)
arclabel_set_dir|lv.obj, int||[lv_arclabel_set_dir](https://docs.lvgl.io/9.0/search.html?q=lv_arclabel_set_dir)
arclabel_set_offset|lv.obj, int||[lv_arclabel_set_offset](https://docs.lvgl.io/9.0/search.html?q=lv_arclabel_set_offset)
arclabel_set_radius|lv.obj, int||[lv_arclabel_set_radius](https://docs.lvgl.io/9.0/search.html?q=lv_arclabel_set_radius)
arclabel_set_recolor|lv.obj, bool||[lv_arclabel_set_recolor](https://docs.lvgl.io/9.0/search.html?q=lv_arclabel_set_recolor)
arclabel_set_text|lv.obj, string||[lv_arclabel_set_text](https://docs.lvgl.io/9.0/search.html?q=lv_arclabel_set_text)
arclabel_set_text_fmt|lv.obj, string, [\<any\>]||[lv_arclabel_set_text_fmt](https://docs.lvgl.io/9.0/search.html?q=lv_arclabel_set_text_fmt)
arclabel_set_text_horizontal_align|lv.obj, int||[lv_arclabel_set_text_horizontal_align](https://docs.lvgl.io/9.0/search.html?q=lv_arclabel_set_text_horizontal_align)
arclabel_set_text_static|lv.obj, string||[lv_arclabel_set_text_static](https://docs.lvgl.io/9.0/search.html?q=lv_arclabel_set_text_static)
arclabel_set_text_vertical_align|lv.obj, int||[lv_arclabel_set_text_vertical_align](https://docs.lvgl.io/9.0/search.html?q=lv_arclabel_set_text_vertical_align)
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)
@ -46,6 +69,7 @@ color_format_has_alpha|int|bool|[lv_color_format_has_alpha](https://docs.lvgl.io
color_hex|int|lv.color|[lv_color_hex](https://docs.lvgl.io/9.0/search.html?q=lv_color_hex)
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_is_in_range|lv.color, lv.color, lv.color|bool|[lv_color_is_in_range](https://docs.lvgl.io/9.0/search.html?q=lv_color_is_in_range)
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)
@ -89,6 +113,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_unit_send_event|string, int, \<any\>||[lv_draw_unit_send_event](https://docs.lvgl.io/9.0/search.html?q=lv_draw_unit_send_event)
draw_wait_for_finish|||[lv_draw_wait_for_finish](https://docs.lvgl.io/9.0/search.html?q=lv_draw_wait_for_finish)
event_code_get_name|int|string|[lv_event_code_get_name](https://docs.lvgl.io/9.0/search.html?q=lv_event_code_get_name)
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)
@ -158,9 +183,6 @@ style_prop_lookup_flags|int|int|[lv_style_prop_lookup_flags](https://docs.lvgl.i
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)
text_get_width|string, int, lv.font, int|int|[lv_text_get_width](https://docs.lvgl.io/9.0/search.html?q=lv_text_get_width)
text_get_width_with_flags|string, int, lv.font, int, int|int|[lv_text_get_width_with_flags](https://docs.lvgl.io/9.0/search.html?q=lv_text_get_width_with_flags)
text_is_cmd|comptr, int|bool|[lv_text_is_cmd](https://docs.lvgl.io/9.0/search.html?q=lv_text_is_cmd)
theme_apply|lv.obj||[lv_theme_apply](https://docs.lvgl.io/9.0/search.html?q=lv_theme_apply)
theme_get_color_primary|lv.obj|lv.color|[lv_theme_get_color_primary](https://docs.lvgl.io/9.0/search.html?q=lv_theme_get_color_primary)
theme_get_color_secondary|lv.obj|lv.color|[lv_theme_get_color_secondary](https://docs.lvgl.io/9.0/search.html?q=lv_theme_get_color_secondary)
@ -274,6 +296,7 @@ get_rotation||int|[lv_display_get_rotation](https://docs.lvgl.io/9.0/search.html
get_scr_act||lv.obj|[lv_display_get_screen_active](https://docs.lvgl.io/9.0/search.html?q=lv_display_get_screen_active)
get_scr_prev||lv.obj|[lv_display_get_screen_prev](https://docs.lvgl.io/9.0/search.html?q=lv_display_get_screen_prev)
get_screen_active||lv.obj|[lv_display_get_screen_active](https://docs.lvgl.io/9.0/search.html?q=lv_display_get_screen_active)
get_screen_loading||lv.obj|[lv_display_get_screen_loading](https://docs.lvgl.io/9.0/search.html?q=lv_display_get_screen_loading)
get_screen_prev||lv.obj|[lv_display_get_screen_prev](https://docs.lvgl.io/9.0/search.html?q=lv_display_get_screen_prev)
get_theme||lv.theme|[lv_display_get_theme](https://docs.lvgl.io/9.0/search.html?q=lv_display_get_theme)
get_theme||lv.theme|[lv_display_get_theme](https://docs.lvgl.io/9.0/search.html?q=lv_display_get_theme)
@ -319,6 +342,7 @@ unregister_vsync_event|\<closure\>, \<any\>|bool|[lv_display_unregister_vsync_ev
Method|Arguments|Return type|LVGL equivalent
:---|:---|:---|:---
free_user_data_cb|||[lv_event_free_user_data_cb](https://docs.lvgl.io/9.0/search.html?q=lv_event_free_user_data_cb)
get_code||int|[lv_event_get_code](https://docs.lvgl.io/9.0/search.html?q=lv_event_get_code)
get_cover_area||lv.area|[lv_event_get_cover_area](https://docs.lvgl.io/9.0/search.html?q=lv_event_get_cover_area)
get_current_target||comptr|[lv_event_get_current_target](https://docs.lvgl.io/9.0/search.html?q=lv_event_get_current_target)
@ -340,6 +364,7 @@ set_cover_res|int||[lv_event_set_cover_res](https://docs.lvgl.io/9.0/search.html
set_ext_draw_size|int||[lv_event_set_ext_draw_size](https://docs.lvgl.io/9.0/search.html?q=lv_event_set_ext_draw_size)
stop_bubbling|||[lv_event_stop_bubbling](https://docs.lvgl.io/9.0/search.html?q=lv_event_stop_bubbling)
stop_processing|||[lv_event_stop_processing](https://docs.lvgl.io/9.0/search.html?q=lv_event_stop_processing)
stop_trickling|||[lv_event_stop_trickling](https://docs.lvgl.io/9.0/search.html?q=lv_event_stop_trickling)
### class `lv.group`
@ -433,6 +458,7 @@ Method|Arguments|Return type|LVGL equivalent
copy|lv.style||[lv_style_copy](https://docs.lvgl.io/9.0/search.html?q=lv_style_copy)
is_const||bool|[lv_style_is_const](https://docs.lvgl.io/9.0/search.html?q=lv_style_is_const)
is_empty||bool|[lv_style_is_empty](https://docs.lvgl.io/9.0/search.html?q=lv_style_is_empty)
merge|lv.style||[lv_style_merge](https://docs.lvgl.io/9.0/search.html?q=lv_style_merge)
remove_prop|int|bool|[lv_style_remove_prop](https://docs.lvgl.io/9.0/search.html?q=lv_style_remove_prop)
reset|||[lv_style_reset](https://docs.lvgl.io/9.0/search.html?q=lv_style_reset)
set_align|int||[lv_style_set_align](https://docs.lvgl.io/9.0/search.html?q=lv_style_set_align)
@ -490,6 +516,7 @@ set_grid_column_dsc_array|lv.int_arr||[lv_style_set_grid_column_dsc_array](https
set_grid_row_align|int||[lv_style_set_grid_row_align](https://docs.lvgl.io/9.0/search.html?q=lv_style_set_grid_row_align)
set_grid_row_dsc_array|lv.int_arr||[lv_style_set_grid_row_dsc_array](https://docs.lvgl.io/9.0/search.html?q=lv_style_set_grid_row_dsc_array)
set_height|int||[lv_style_set_height](https://docs.lvgl.io/9.0/search.html?q=lv_style_set_height)
set_image_colorkey|comptr||[lv_style_set_image_colorkey](https://docs.lvgl.io/9.0/search.html?q=lv_style_set_image_colorkey)
set_image_opa|int||[lv_style_set_image_opa](https://docs.lvgl.io/9.0/search.html?q=lv_style_set_image_opa)
set_image_recolor|lv.color||[lv_style_set_image_recolor](https://docs.lvgl.io/9.0/search.html?q=lv_style_set_image_recolor)
set_image_recolor_opa|int||[lv_style_set_image_recolor_opa](https://docs.lvgl.io/9.0/search.html?q=lv_style_set_image_recolor_opa)
@ -606,6 +633,8 @@ Method|Arguments|Return type|LVGL equivalent
:---|:---|:---|:---
add_event_cb|\<closure\>, int, \<any\>|lv.event_dsc|[lv_obj_add_event_cb](https://docs.lvgl.io/9.0/search.html?q=lv_obj_add_event_cb)
add_flag|int||[lv_obj_add_flag](https://docs.lvgl.io/9.0/search.html?q=lv_obj_add_flag)
add_play_timeline_event|int, lv.anim_timeline_dsc, int, bool||[lv_obj_add_play_timeline_event](https://docs.lvgl.io/9.0/search.html?q=lv_obj_add_play_timeline_event)
add_screen_load_event|int, lv.obj, int, int, int||[lv_obj_add_screen_load_event](https://docs.lvgl.io/9.0/search.html?q=lv_obj_add_screen_load_event)
add_state|int||[lv_obj_add_state](https://docs.lvgl.io/9.0/search.html?q=lv_obj_add_state)
add_style|lv.style, int||[lv_obj_add_style](https://docs.lvgl.io/9.0/search.html?q=lv_obj_add_style)
align|int, int, int||[lv_obj_align](https://docs.lvgl.io/9.0/search.html?q=lv_obj_align)
@ -724,6 +753,7 @@ get_style_grid_column_dsc_array|int|lv.int_arr|[lv_obj_get_style_grid_column_dsc
get_style_grid_row_align|int|int|[lv_obj_get_style_grid_row_align](https://docs.lvgl.io/9.0/search.html?q=lv_obj_get_style_grid_row_align)
get_style_grid_row_dsc_array|int|lv.int_arr|[lv_obj_get_style_grid_row_dsc_array](https://docs.lvgl.io/9.0/search.html?q=lv_obj_get_style_grid_row_dsc_array)
get_style_height|int|int|[lv_obj_get_style_height](https://docs.lvgl.io/9.0/search.html?q=lv_obj_get_style_height)
get_style_image_colorkey|int|comptr|[lv_obj_get_style_image_colorkey](https://docs.lvgl.io/9.0/search.html?q=lv_obj_get_style_image_colorkey)
get_style_image_opa|int|int|[lv_obj_get_style_image_opa](https://docs.lvgl.io/9.0/search.html?q=lv_obj_get_style_image_opa)
get_style_image_recolor|int|lv.color|[lv_obj_get_style_image_recolor](https://docs.lvgl.io/9.0/search.html?q=lv_obj_get_style_image_recolor)
get_style_image_recolor_filtered|int|lv.color|[lv_obj_get_style_image_recolor_filtered](https://docs.lvgl.io/9.0/search.html?q=lv_obj_get_style_image_recolor_filtered)
@ -951,6 +981,7 @@ set_style_grid_column_dsc_array|lv.int_arr, int||[lv_obj_set_style_grid_column_d
set_style_grid_row_align|int, int||[lv_obj_set_style_grid_row_align](https://docs.lvgl.io/9.0/search.html?q=lv_obj_set_style_grid_row_align)
set_style_grid_row_dsc_array|lv.int_arr, int||[lv_obj_set_style_grid_row_dsc_array](https://docs.lvgl.io/9.0/search.html?q=lv_obj_set_style_grid_row_dsc_array)
set_style_height|int, int||[lv_obj_set_style_height](https://docs.lvgl.io/9.0/search.html?q=lv_obj_set_style_height)
set_style_image_colorkey|comptr, int||[lv_obj_set_style_image_colorkey](https://docs.lvgl.io/9.0/search.html?q=lv_obj_set_style_image_colorkey)
set_style_image_opa|int, int||[lv_obj_set_style_image_opa](https://docs.lvgl.io/9.0/search.html?q=lv_obj_set_style_image_opa)
set_style_image_recolor|lv.color, int||[lv_obj_set_style_image_recolor](https://docs.lvgl.io/9.0/search.html?q=lv_obj_set_style_image_recolor)
set_style_image_recolor_opa|int, int||[lv_obj_set_style_image_recolor_opa](https://docs.lvgl.io/9.0/search.html?q=lv_obj_set_style_image_recolor_opa)
@ -1044,6 +1075,8 @@ stop_scroll_anim|||[lv_obj_stop_scroll_anim](https://docs.lvgl.io/9.0/search.htm
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)
style_apply_recolor|int, int|int|[lv_obj_style_apply_recolor](https://docs.lvgl.io/9.0/search.html?q=lv_obj_style_apply_recolor)
style_get_disabled|lv.style, int|bool|[lv_obj_style_get_disabled](https://docs.lvgl.io/9.0/search.html?q=lv_obj_style_get_disabled)
style_set_disabled|lv.style, int, bool||[lv_obj_style_set_disabled](https://docs.lvgl.io/9.0/search.html?q=lv_obj_style_set_disabled)
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)
@ -1076,6 +1109,8 @@ set_bg_start_angle|int||[lv_arc_set_bg_start_angle](https://docs.lvgl.io/9.0/sea
set_change_rate|int||[lv_arc_set_change_rate](https://docs.lvgl.io/9.0/search.html?q=lv_arc_set_change_rate)
set_end_angle|int||[lv_arc_set_end_angle](https://docs.lvgl.io/9.0/search.html?q=lv_arc_set_end_angle)
set_knob_offset|int||[lv_arc_set_knob_offset](https://docs.lvgl.io/9.0/search.html?q=lv_arc_set_knob_offset)
set_max_value|int||[lv_arc_set_max_value](https://docs.lvgl.io/9.0/search.html?q=lv_arc_set_max_value)
set_min_value|int||[lv_arc_set_min_value](https://docs.lvgl.io/9.0/search.html?q=lv_arc_set_min_value)
set_mode|int||[lv_arc_set_mode](https://docs.lvgl.io/9.0/search.html?q=lv_arc_set_mode)
set_range|int, int||[lv_arc_set_range](https://docs.lvgl.io/9.0/search.html?q=lv_arc_set_range)
set_rotation|int||[lv_arc_set_rotation](https://docs.lvgl.io/9.0/search.html?q=lv_arc_set_rotation)
@ -1095,6 +1130,8 @@ get_orientation||int|[lv_bar_get_orientation](https://docs.lvgl.io/9.0/search.ht
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_max_value|int||[lv_bar_set_max_value](https://docs.lvgl.io/9.0/search.html?q=lv_bar_set_max_value)
set_min_value|int||[lv_bar_set_min_value](https://docs.lvgl.io/9.0/search.html?q=lv_bar_set_min_value)
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)
@ -1208,6 +1245,8 @@ set_inner_align|int||[lv_image_set_inner_align](https://docs.lvgl.io/9.0/search.
set_offset_x|int||[lv_image_set_offset_x](https://docs.lvgl.io/9.0/search.html?q=lv_image_set_offset_x)
set_offset_y|int||[lv_image_set_offset_y](https://docs.lvgl.io/9.0/search.html?q=lv_image_set_offset_y)
set_pivot|int, int||[lv_image_set_pivot](https://docs.lvgl.io/9.0/search.html?q=lv_image_set_pivot)
set_pivot_x|int||[lv_image_set_pivot_x](https://docs.lvgl.io/9.0/search.html?q=lv_image_set_pivot_x)
set_pivot_y|int||[lv_image_set_pivot_y](https://docs.lvgl.io/9.0/search.html?q=lv_image_set_pivot_y)
set_rotation|int||[lv_image_set_rotation](https://docs.lvgl.io/9.0/search.html?q=lv_image_set_rotation)
set_rotation|int||[lv_image_set_rotation](https://docs.lvgl.io/9.0/search.html?q=lv_image_set_rotation)
set_scale|int||[lv_image_set_scale](https://docs.lvgl.io/9.0/search.html?q=lv_image_set_scale)
@ -1259,6 +1298,7 @@ Method|Arguments|Return type|LVGL equivalent
:---|:---|:---|:---
get_option_cnt||int|[lv_roller_get_option_count](https://docs.lvgl.io/9.0/search.html?q=lv_roller_get_option_count)
get_option_count||int|[lv_roller_get_option_count](https://docs.lvgl.io/9.0/search.html?q=lv_roller_get_option_count)
get_option_str|int, comptr, int|int|[lv_roller_get_option_str](https://docs.lvgl.io/9.0/search.html?q=lv_roller_get_option_str)
get_options||string|[lv_roller_get_options](https://docs.lvgl.io/9.0/search.html?q=lv_roller_get_options)
get_selected||int|[lv_roller_get_selected](https://docs.lvgl.io/9.0/search.html?q=lv_roller_get_selected)
get_selected_str|comptr, int||[lv_roller_get_selected_str](https://docs.lvgl.io/9.0/search.html?q=lv_roller_get_selected_str)
@ -1280,6 +1320,8 @@ get_orientation||int|[lv_slider_get_orientation](https://docs.lvgl.io/9.0/search
get_value||int|[lv_slider_get_value](https://docs.lvgl.io/9.0/search.html?q=lv_slider_get_value)
is_dragged||bool|[lv_slider_is_dragged](https://docs.lvgl.io/9.0/search.html?q=lv_slider_is_dragged)
is_symmetrical||bool|[lv_slider_is_symmetrical](https://docs.lvgl.io/9.0/search.html?q=lv_slider_is_symmetrical)
set_max_value|int||[lv_slider_set_max_value](https://docs.lvgl.io/9.0/search.html?q=lv_slider_set_max_value)
set_min_value|int||[lv_slider_set_min_value](https://docs.lvgl.io/9.0/search.html?q=lv_slider_set_min_value)
set_mode|int||[lv_slider_set_mode](https://docs.lvgl.io/9.0/search.html?q=lv_slider_set_mode)
set_orientation|int||[lv_slider_set_orientation](https://docs.lvgl.io/9.0/search.html?q=lv_slider_set_orientation)
set_range|int, int||[lv_slider_set_range](https://docs.lvgl.io/9.0/search.html?q=lv_slider_set_range)
@ -1387,6 +1429,7 @@ set_mode|int||[lv_spangroup_set_mode](https://docs.lvgl.io/9.0/search.html?q=lv_
set_overflow|int||[lv_spangroup_set_overflow](https://docs.lvgl.io/9.0/search.html?q=lv_spangroup_set_overflow)
set_span_style|lv.span, lv.style||[lv_spangroup_set_span_style](https://docs.lvgl.io/9.0/search.html?q=lv_spangroup_set_span_style)
set_span_text|lv.span, string||[lv_spangroup_set_span_text](https://docs.lvgl.io/9.0/search.html?q=lv_spangroup_set_span_text)
set_span_text_fmt|lv.span, string, [\<any\>]||[lv_spangroup_set_span_text_fmt](https://docs.lvgl.io/9.0/search.html?q=lv_spangroup_set_span_text_fmt)
set_span_text_static|lv.span, string||[lv_spangroup_set_span_text_static](https://docs.lvgl.io/9.0/search.html?q=lv_spangroup_set_span_text_static)
### widget `lv.span`
@ -1396,6 +1439,7 @@ Method|Arguments|Return type|LVGL equivalent
get_style||lv.style|[lv_span_get_style](https://docs.lvgl.io/9.0/search.html?q=lv_span_get_style)
get_text||string|[lv_span_get_text](https://docs.lvgl.io/9.0/search.html?q=lv_span_get_text)
set_text|string||[lv_span_set_text](https://docs.lvgl.io/9.0/search.html?q=lv_span_set_text)
set_text_fmt|string, [\<any\>]||[lv_span_set_text_fmt](https://docs.lvgl.io/9.0/search.html?q=lv_span_set_text_fmt)
set_text_static|string||[lv_span_set_text_static](https://docs.lvgl.io/9.0/search.html?q=lv_span_set_text_static)
set_text_static|string||[lv_span_set_text_static](https://docs.lvgl.io/9.0/search.html?q=lv_span_set_text_static)
@ -1428,11 +1472,15 @@ set_image_needle_value|lv.obj, int||[lv_scale_set_image_needle_value](https://do
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)
set_major_tick_every|int||[lv_scale_set_major_tick_every](https://docs.lvgl.io/9.0/search.html?q=lv_scale_set_major_tick_every)
set_max_value|int||[lv_scale_set_max_value](https://docs.lvgl.io/9.0/search.html?q=lv_scale_set_max_value)
set_min_value|int||[lv_scale_set_min_value](https://docs.lvgl.io/9.0/search.html?q=lv_scale_set_min_value)
set_mode|int||[lv_scale_set_mode](https://docs.lvgl.io/9.0/search.html?q=lv_scale_set_mode)
set_post_draw|bool||[lv_scale_set_post_draw](https://docs.lvgl.io/9.0/search.html?q=lv_scale_set_post_draw)
set_range|int, int||[lv_scale_set_range](https://docs.lvgl.io/9.0/search.html?q=lv_scale_set_range)
set_rotation|int||[lv_scale_set_rotation](https://docs.lvgl.io/9.0/search.html?q=lv_scale_set_rotation)
set_rotation|int||[lv_scale_set_rotation](https://docs.lvgl.io/9.0/search.html?q=lv_scale_set_rotation)
set_section_max_value|lv.scale_section, int||[lv_scale_set_section_max_value](https://docs.lvgl.io/9.0/search.html?q=lv_scale_set_section_max_value)
set_section_min_value|lv.scale_section, int||[lv_scale_set_section_min_value](https://docs.lvgl.io/9.0/search.html?q=lv_scale_set_section_min_value)
set_section_range|lv.scale_section, int, int||[lv_scale_set_section_range](https://docs.lvgl.io/9.0/search.html?q=lv_scale_set_section_range)
set_section_style_indicator|lv.scale_section, lv.style||[lv_scale_set_section_style_indicator](https://docs.lvgl.io/9.0/search.html?q=lv_scale_set_section_style_indicator)
set_section_style_items|lv.scale_section, lv.style||[lv_scale_set_section_style_items](https://docs.lvgl.io/9.0/search.html?q=lv_scale_set_section_style_items)
@ -1459,14 +1507,18 @@ get_type||int|[lv_chart_get_type](https://docs.lvgl.io/9.0/search.html?q=lv_char
get_x_start_point|lv.chart_series|int|[lv_chart_get_x_start_point](https://docs.lvgl.io/9.0/search.html?q=lv_chart_get_x_start_point)
hide_series|lv.chart_series, bool||[lv_chart_hide_series](https://docs.lvgl.io/9.0/search.html?q=lv_chart_hide_series)
refresh|||[lv_chart_refresh](https://docs.lvgl.io/9.0/search.html?q=lv_chart_refresh)
remove_cursor|lv.chart_cursor||[lv_chart_remove_cursor](https://docs.lvgl.io/9.0/search.html?q=lv_chart_remove_cursor)
remove_series|lv.chart_series||[lv_chart_remove_series](https://docs.lvgl.io/9.0/search.html?q=lv_chart_remove_series)
set_all_values|lv.chart_series, int||[lv_chart_set_all_values](https://docs.lvgl.io/9.0/search.html?q=lv_chart_set_all_values)
set_axis_max_value|int, int||[lv_chart_set_axis_max_value](https://docs.lvgl.io/9.0/search.html?q=lv_chart_set_axis_max_value)
set_axis_min_value|int, int||[lv_chart_set_axis_min_value](https://docs.lvgl.io/9.0/search.html?q=lv_chart_set_axis_min_value)
set_axis_range|int, int, int||[lv_chart_set_axis_range](https://docs.lvgl.io/9.0/search.html?q=lv_chart_set_axis_range)
set_cursor_point|lv.chart_cursor, lv.chart_series, int||[lv_chart_set_cursor_point](https://docs.lvgl.io/9.0/search.html?q=lv_chart_set_cursor_point)
set_cursor_pos|lv.chart_cursor, comptr||[lv_chart_set_cursor_pos](https://docs.lvgl.io/9.0/search.html?q=lv_chart_set_cursor_pos)
set_cursor_pos_x|lv.chart_cursor, int||[lv_chart_set_cursor_pos_x](https://docs.lvgl.io/9.0/search.html?q=lv_chart_set_cursor_pos_x)
set_cursor_pos_y|lv.chart_cursor, int||[lv_chart_set_cursor_pos_y](https://docs.lvgl.io/9.0/search.html?q=lv_chart_set_cursor_pos_y)
set_div_line_count|int, int||[lv_chart_set_div_line_count](https://docs.lvgl.io/9.0/search.html?q=lv_chart_set_div_line_count)
set_hor_div_line_count|int||[lv_chart_set_hor_div_line_count](https://docs.lvgl.io/9.0/search.html?q=lv_chart_set_hor_div_line_count)
set_next_value|lv.chart_series, int||[lv_chart_set_next_value](https://docs.lvgl.io/9.0/search.html?q=lv_chart_set_next_value)
set_next_value2|lv.chart_series, int, int||[lv_chart_set_next_value2](https://docs.lvgl.io/9.0/search.html?q=lv_chart_set_next_value2)
set_point_count|int||[lv_chart_set_point_count](https://docs.lvgl.io/9.0/search.html?q=lv_chart_set_point_count)
@ -1480,6 +1532,7 @@ set_series_values|lv.chart_series, lv.int_arr, int||[lv_chart_set_series_values]
set_series_values2|lv.chart_series, lv.int_arr, lv.int_arr, int||[lv_chart_set_series_values2](https://docs.lvgl.io/9.0/search.html?q=lv_chart_set_series_values2)
set_type|int||[lv_chart_set_type](https://docs.lvgl.io/9.0/search.html?q=lv_chart_set_type)
set_update_mode|int||[lv_chart_set_update_mode](https://docs.lvgl.io/9.0/search.html?q=lv_chart_set_update_mode)
set_ver_div_line_count|int||[lv_chart_set_ver_div_line_count](https://docs.lvgl.io/9.0/search.html?q=lv_chart_set_ver_div_line_count)
set_x_start_point|lv.chart_series, int||[lv_chart_set_x_start_point](https://docs.lvgl.io/9.0/search.html?q=lv_chart_set_x_start_point)
### widget `lv.imagebutton`
@ -1526,8 +1579,12 @@ get_step||int|[lv_spinbox_get_step](https://docs.lvgl.io/9.0/search.html?q=lv_sp
get_value||int|[lv_spinbox_get_value](https://docs.lvgl.io/9.0/search.html?q=lv_spinbox_get_value)
increment|||[lv_spinbox_increment](https://docs.lvgl.io/9.0/search.html?q=lv_spinbox_increment)
set_cursor_pos|int||[lv_spinbox_set_cursor_pos](https://docs.lvgl.io/9.0/search.html?q=lv_spinbox_set_cursor_pos)
set_dec_point_pos|int||[lv_spinbox_set_dec_point_pos](https://docs.lvgl.io/9.0/search.html?q=lv_spinbox_set_dec_point_pos)
set_digit_count|int||[lv_spinbox_set_digit_count](https://docs.lvgl.io/9.0/search.html?q=lv_spinbox_set_digit_count)
set_digit_format|int, int||[lv_spinbox_set_digit_format](https://docs.lvgl.io/9.0/search.html?q=lv_spinbox_set_digit_format)
set_digit_step_direction|int||[lv_spinbox_set_digit_step_direction](https://docs.lvgl.io/9.0/search.html?q=lv_spinbox_set_digit_step_direction)
set_max_value|int||[lv_spinbox_set_max_value](https://docs.lvgl.io/9.0/search.html?q=lv_spinbox_set_max_value)
set_min_value|int||[lv_spinbox_set_min_value](https://docs.lvgl.io/9.0/search.html?q=lv_spinbox_set_min_value)
set_range|int, int||[lv_spinbox_set_range](https://docs.lvgl.io/9.0/search.html?q=lv_spinbox_set_range)
set_rollover|bool||[lv_spinbox_set_rollover](https://docs.lvgl.io/9.0/search.html?q=lv_spinbox_set_rollover)
set_step|int||[lv_spinbox_set_step](https://docs.lvgl.io/9.0/search.html?q=lv_spinbox_set_step)
@ -1566,6 +1623,7 @@ get_tab_act||int|[lv_tabview_get_tab_active](https://docs.lvgl.io/9.0/search.htm
get_tab_active||int|[lv_tabview_get_tab_active](https://docs.lvgl.io/9.0/search.html?q=lv_tabview_get_tab_active)
get_tab_bar||lv.obj|[lv_tabview_get_tab_bar](https://docs.lvgl.io/9.0/search.html?q=lv_tabview_get_tab_bar)
get_tab_btns||lv.obj|[lv_tabview_get_tab_bar](https://docs.lvgl.io/9.0/search.html?q=lv_tabview_get_tab_bar)
get_tab_button|int|lv.obj|[lv_tabview_get_tab_button](https://docs.lvgl.io/9.0/search.html?q=lv_tabview_get_tab_button)
get_tab_count||int|[lv_tabview_get_tab_count](https://docs.lvgl.io/9.0/search.html?q=lv_tabview_get_tab_count)
rename_tab|int, string||[lv_tabview_rename_tab](https://docs.lvgl.io/9.0/search.html?q=lv_tabview_rename_tab)
set_act|int, int||[lv_tabview_set_active](https://docs.lvgl.io/9.0/search.html?q=lv_tabview_set_active)
@ -1630,7 +1688,12 @@ header_dropdown_set_year_list|string||[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_month_shown|int, int||[lv_calendar_set_month_shown](https://docs.lvgl.io/9.0/search.html?q=lv_calendar_set_month_shown)
set_shown_month|int||[lv_calendar_set_shown_month](https://docs.lvgl.io/9.0/search.html?q=lv_calendar_set_shown_month)
set_shown_year|int||[lv_calendar_set_shown_year](https://docs.lvgl.io/9.0/search.html?q=lv_calendar_set_shown_year)
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)
set_today_day|int||[lv_calendar_set_today_day](https://docs.lvgl.io/9.0/search.html?q=lv_calendar_set_today_day)
set_today_month|int||[lv_calendar_set_today_month](https://docs.lvgl.io/9.0/search.html?q=lv_calendar_set_today_month)
set_today_year|int||[lv_calendar_set_today_year](https://docs.lvgl.io/9.0/search.html?q=lv_calendar_set_today_year)
### widget `lv.menu_page`
@ -1677,7 +1740,9 @@ set_sidebar_page|lv.obj||[lv_menu_set_sidebar_page](https://docs.lvgl.io/9.0/sea
Method|Arguments|Return type|LVGL equivalent
:---|:---|:---|:---
set_dark_color|lv.color||[lv_qrcode_set_dark_color](https://docs.lvgl.io/9.0/search.html?q=lv_qrcode_set_dark_color)
set_data|string||[lv_qrcode_set_data](https://docs.lvgl.io/9.0/search.html?q=lv_qrcode_set_data)
set_light_color|lv.color||[lv_qrcode_set_light_color](https://docs.lvgl.io/9.0/search.html?q=lv_qrcode_set_light_color)
set_quiet_zone|bool||[lv_qrcode_set_quiet_zone](https://docs.lvgl.io/9.0/search.html?q=lv_qrcode_set_quiet_zone)
set_size|int||[lv_qrcode_set_size](https://docs.lvgl.io/9.0/search.html?q=lv_qrcode_set_size)
update|\<any\>, int|int|[lv_qrcode_update](https://docs.lvgl.io/9.0/search.html?q=lv_qrcode_update)

View File

@ -16,6 +16,7 @@ const be_ntv_func_def_t lv_style_func[] = {
{ "copy", { (const void*) &lv_style_copy, "", "(lv.style)(lv.style)" } },
{ "is_const", { (const void*) &lv_style_is_const, "b", "(lv.style)" } },
{ "is_empty", { (const void*) &lv_style_is_empty, "b", "(lv.style)" } },
{ "merge", { (const void*) &lv_style_merge, "", "(lv.style)(lv.style)" } },
{ "remove_prop", { (const void*) &lv_style_remove_prop, "b", "(lv.style)i" } },
{ "reset", { (const void*) &lv_style_reset, "", "(lv.style)" } },
{ "set_align", { (const void*) &lv_style_set_align, "", "(lv.style)i" } },
@ -73,6 +74,7 @@ const be_ntv_func_def_t lv_style_func[] = {
{ "set_grid_row_align", { (const void*) &lv_style_set_grid_row_align, "", "(lv.style)i" } },
{ "set_grid_row_dsc_array", { (const void*) &lv_style_set_grid_row_dsc_array, "", "(lv.style)(lv.int_arr)" } },
{ "set_height", { (const void*) &lv_style_set_height, "", "(lv.style)i" } },
{ "set_image_colorkey", { (const void*) &lv_style_set_image_colorkey, "", "(lv.style)c" } },
{ "set_image_opa", { (const void*) &lv_style_set_image_opa, "", "(lv.style)i" } },
{ "set_image_recolor", { (const void*) &lv_style_set_image_recolor, "", "(lv.style)(lv.color)" } },
{ "set_image_recolor_opa", { (const void*) &lv_style_set_image_recolor_opa, "", "(lv.style)i" } },
@ -206,6 +208,8 @@ const be_ntv_func_def_t lv_group_func[] = {
const be_ntv_func_def_t lv_obj_func[] = {
{ "add_event_cb", { (const void*) &lv_obj_add_event_cb, "lv.event_dsc", "(lv.obj)^lv_event_cb^i." } },
{ "add_flag", { (const void*) &lv_obj_add_flag, "", "(lv.obj)i" } },
{ "add_play_timeline_event", { (const void*) &lv_obj_add_play_timeline_event, "", "(lv.obj)i(lv.anim_timeline_dsc)ib" } },
{ "add_screen_load_event", { (const void*) &lv_obj_add_screen_load_event, "", "(lv.obj)i(lv.obj)iii" } },
{ "add_state", { (const void*) &lv_obj_add_state, "", "(lv.obj)i" } },
{ "add_style", { (const void*) &lv_obj_add_style, "", "(lv.obj)(lv.style)i" } },
{ "align", { (const void*) &lv_obj_align, "", "(lv.obj)iii" } },
@ -324,6 +328,7 @@ const be_ntv_func_def_t lv_obj_func[] = {
{ "get_style_grid_row_align", { (const void*) &lv_obj_get_style_grid_row_align, "i", "(lv.obj)i" } },
{ "get_style_grid_row_dsc_array", { (const void*) &lv_obj_get_style_grid_row_dsc_array, "lv.int_arr", "(lv.obj)i" } },
{ "get_style_height", { (const void*) &lv_obj_get_style_height, "i", "(lv.obj)i" } },
{ "get_style_image_colorkey", { (const void*) &lv_obj_get_style_image_colorkey, "c", "(lv.obj)i" } },
{ "get_style_image_opa", { (const void*) &lv_obj_get_style_image_opa, "i", "(lv.obj)i" } },
{ "get_style_image_recolor", { (const void*) &lv_obj_get_style_image_recolor, "lv.color", "(lv.obj)i" } },
{ "get_style_image_recolor_filtered", { (const void*) &lv_obj_get_style_image_recolor_filtered, "lv.color", "(lv.obj)i" } },
@ -549,6 +554,7 @@ const be_ntv_func_def_t lv_obj_func[] = {
{ "set_style_grid_row_align", { (const void*) &lv_obj_set_style_grid_row_align, "", "(lv.obj)ii" } },
{ "set_style_grid_row_dsc_array", { (const void*) &lv_obj_set_style_grid_row_dsc_array, "", "(lv.obj)(lv.int_arr)i" } },
{ "set_style_height", { (const void*) &lv_obj_set_style_height, "", "(lv.obj)ii" } },
{ "set_style_image_colorkey", { (const void*) &lv_obj_set_style_image_colorkey, "", "(lv.obj)ci" } },
{ "set_style_image_opa", { (const void*) &lv_obj_set_style_image_opa, "", "(lv.obj)ii" } },
{ "set_style_image_recolor", { (const void*) &lv_obj_set_style_image_recolor, "", "(lv.obj)(lv.color)i" } },
{ "set_style_image_recolor_opa", { (const void*) &lv_obj_set_style_image_recolor_opa, "", "(lv.obj)ii" } },
@ -642,6 +648,8 @@ const be_ntv_func_def_t lv_obj_func[] = {
{ "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" } },
{ "style_apply_recolor", { (const void*) &lv_obj_style_apply_recolor, "i", "(lv.obj)ii" } },
{ "style_get_disabled", { (const void*) &lv_obj_style_get_disabled, "b", "(lv.obj)(lv.style)i" } },
{ "style_set_disabled", { (const void*) &lv_obj_style_set_disabled, "", "(lv.obj)(lv.style)ib" } },
{ "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" } },
@ -652,6 +660,7 @@ const be_ntv_func_def_t lv_obj_func[] = {
/* `lv_event` methods */
const be_ntv_func_def_t lv_event_func[] = {
{ "free_user_data_cb", { (const void*) &lv_event_free_user_data_cb, "", "(lv.event)" } },
{ "get_code", { (const void*) &lv_event_get_code, "i", "(lv.event)" } },
{ "get_cover_area", { (const void*) &lv_event_get_cover_area, "lv.area", "(lv.event)" } },
{ "get_current_target", { (const void*) &lv_event_get_current_target, "c", "(lv.event)" } },
@ -673,6 +682,7 @@ const be_ntv_func_def_t lv_event_func[] = {
{ "set_ext_draw_size", { (const void*) &lv_event_set_ext_draw_size, "", "(lv.event)i" } },
{ "stop_bubbling", { (const void*) &lv_event_stop_bubbling, "", "(lv.event)" } },
{ "stop_processing", { (const void*) &lv_event_stop_processing, "", "(lv.event)" } },
{ "stop_trickling", { (const void*) &lv_event_stop_trickling, "", "(lv.event)" } },
};
/* `lv_display` methods */
@ -714,6 +724,7 @@ const be_ntv_func_def_t lv_display_func[] = {
{ "get_scr_act", { (const void*) &lv_display_get_screen_active, "lv.obj", "(lv.display)" } },
{ "get_scr_prev", { (const void*) &lv_display_get_screen_prev, "lv.obj", "(lv.display)" } },
{ "get_screen_active", { (const void*) &lv_display_get_screen_active, "lv.obj", "(lv.display)" } },
{ "get_screen_loading", { (const void*) &lv_display_get_screen_loading, "lv.obj", "(lv.display)" } },
{ "get_screen_prev", { (const void*) &lv_display_get_screen_prev, "lv.obj", "(lv.display)" } },
{ "get_theme", { (const void*) &lv_display_get_theme, "lv.theme", "(lv.display)" } },
{ "get_tile_cnt", { (const void*) &lv_display_get_tile_cnt, "i", "(lv.display)" } },
@ -806,7 +817,9 @@ const be_ntv_func_def_t lv_indev_func[] = {
#ifdef BE_LV_WIDGET_QRCODE
const be_ntv_func_def_t lv_qrcode_func[] = {
{ "set_dark_color", { (const void*) &lv_qrcode_set_dark_color, "", "(lv.obj)(lv.color)" } },
{ "set_data", { (const void*) &lv_qrcode_set_data, "", "(lv.obj)s" } },
{ "set_light_color", { (const void*) &lv_qrcode_set_light_color, "", "(lv.obj)(lv.color)" } },
{ "set_quiet_zone", { (const void*) &lv_qrcode_set_quiet_zone, "", "(lv.obj)b" } },
{ "set_size", { (const void*) &lv_qrcode_set_size, "", "(lv.obj)i" } },
{ "update", { (const void*) &lv_qrcode_update, "i", "(lv.obj).i" } },
};
@ -914,6 +927,8 @@ const be_ntv_func_def_t lv_arc_func[] = {
{ "set_change_rate", { (const void*) &lv_arc_set_change_rate, "", "(lv.obj)i" } },
{ "set_end_angle", { (const void*) &lv_arc_set_end_angle, "", "(lv.obj)i" } },
{ "set_knob_offset", { (const void*) &lv_arc_set_knob_offset, "", "(lv.obj)i" } },
{ "set_max_value", { (const void*) &lv_arc_set_max_value, "", "(lv.obj)i" } },
{ "set_min_value", { (const void*) &lv_arc_set_min_value, "", "(lv.obj)i" } },
{ "set_mode", { (const void*) &lv_arc_set_mode, "", "(lv.obj)i" } },
{ "set_range", { (const void*) &lv_arc_set_range, "", "(lv.obj)ii" } },
{ "set_rotation", { (const void*) &lv_arc_set_rotation, "", "(lv.obj)i" } },
@ -933,6 +948,8 @@ const be_ntv_func_def_t lv_bar_func[] = {
{ "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_max_value", { (const void*) &lv_bar_set_max_value, "", "(lv.obj)i" } },
{ "set_min_value", { (const void*) &lv_bar_set_min_value, "", "(lv.obj)i" } },
{ "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" } },
@ -978,7 +995,12 @@ const be_ntv_func_def_t lv_calendar_func[] = {
{ "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_month_shown", { (const void*) &lv_calendar_set_month_shown, "", "(lv.obj)ii" } },
{ "set_shown_month", { (const void*) &lv_calendar_set_shown_month, "", "(lv.obj)i" } },
{ "set_shown_year", { (const void*) &lv_calendar_set_shown_year, "", "(lv.obj)i" } },
{ "set_today_date", { (const void*) &lv_calendar_set_today_date, "", "(lv.obj)iii" } },
{ "set_today_day", { (const void*) &lv_calendar_set_today_day, "", "(lv.obj)i" } },
{ "set_today_month", { (const void*) &lv_calendar_set_today_month, "", "(lv.obj)i" } },
{ "set_today_year", { (const void*) &lv_calendar_set_today_year, "", "(lv.obj)i" } },
};
#endif // BE_LV_WIDGET_CALENDAR
@ -1015,14 +1037,18 @@ const be_ntv_func_def_t lv_chart_func[] = {
{ "get_x_start_point", { (const void*) &lv_chart_get_x_start_point, "i", "(lv.obj)(lv.chart_series)" } },
{ "hide_series", { (const void*) &lv_chart_hide_series, "", "(lv.obj)(lv.chart_series)b" } },
{ "refresh", { (const void*) &lv_chart_refresh, "", "(lv.obj)" } },
{ "remove_cursor", { (const void*) &lv_chart_remove_cursor, "", "(lv.obj)(lv.chart_cursor)" } },
{ "remove_series", { (const void*) &lv_chart_remove_series, "", "(lv.obj)(lv.chart_series)" } },
{ "set_all_values", { (const void*) &lv_chart_set_all_values, "", "(lv.obj)(lv.chart_series)i" } },
{ "set_axis_max_value", { (const void*) &lv_chart_set_axis_max_value, "", "(lv.obj)ii" } },
{ "set_axis_min_value", { (const void*) &lv_chart_set_axis_min_value, "", "(lv.obj)ii" } },
{ "set_axis_range", { (const void*) &lv_chart_set_axis_range, "", "(lv.obj)iii" } },
{ "set_cursor_point", { (const void*) &lv_chart_set_cursor_point, "", "(lv.obj)(lv.chart_cursor)(lv.chart_series)i" } },
{ "set_cursor_pos", { (const void*) &lv_chart_set_cursor_pos, "", "(lv.obj)(lv.chart_cursor)c" } },
{ "set_cursor_pos_x", { (const void*) &lv_chart_set_cursor_pos_x, "", "(lv.obj)(lv.chart_cursor)i" } },
{ "set_cursor_pos_y", { (const void*) &lv_chart_set_cursor_pos_y, "", "(lv.obj)(lv.chart_cursor)i" } },
{ "set_div_line_count", { (const void*) &lv_chart_set_div_line_count, "", "(lv.obj)ii" } },
{ "set_hor_div_line_count", { (const void*) &lv_chart_set_hor_div_line_count, "", "(lv.obj)i" } },
{ "set_next_value", { (const void*) &lv_chart_set_next_value, "", "(lv.obj)(lv.chart_series)i" } },
{ "set_next_value2", { (const void*) &lv_chart_set_next_value2, "", "(lv.obj)(lv.chart_series)ii" } },
{ "set_point_count", { (const void*) &lv_chart_set_point_count, "", "(lv.obj)i" } },
@ -1036,6 +1062,7 @@ const be_ntv_func_def_t lv_chart_func[] = {
{ "set_series_values2", { (const void*) &lv_chart_set_series_values2, "", "(lv.obj)(lv.chart_series)(lv.int_arr)(lv.int_arr)i" } },
{ "set_type", { (const void*) &lv_chart_set_type, "", "(lv.obj)i" } },
{ "set_update_mode", { (const void*) &lv_chart_set_update_mode, "", "(lv.obj)i" } },
{ "set_ver_div_line_count", { (const void*) &lv_chart_set_ver_div_line_count, "", "(lv.obj)i" } },
{ "set_x_start_point", { (const void*) &lv_chart_set_x_start_point, "", "(lv.obj)(lv.chart_series)i" } },
};
#endif // BE_LV_WIDGET_CHART
@ -1107,6 +1134,8 @@ const be_ntv_func_def_t lv_image_func[] = {
{ "set_offset_x", { (const void*) &lv_image_set_offset_x, "", "(lv.obj)i" } },
{ "set_offset_y", { (const void*) &lv_image_set_offset_y, "", "(lv.obj)i" } },
{ "set_pivot", { (const void*) &lv_image_set_pivot, "", "(lv.obj)ii" } },
{ "set_pivot_x", { (const void*) &lv_image_set_pivot_x, "", "(lv.obj)i" } },
{ "set_pivot_y", { (const void*) &lv_image_set_pivot_y, "", "(lv.obj)i" } },
{ "set_rotation", { (const void*) &lv_image_set_rotation, "", "(lv.obj)i" } },
{ "set_scale", { (const void*) &lv_image_set_scale, "", "(lv.obj)i" } },
{ "set_scale_x", { (const void*) &lv_image_set_scale_x, "", "(lv.obj)i" } },
@ -1271,6 +1300,7 @@ const be_ntv_func_def_t lv_msgbox_func[] = {
const be_ntv_func_def_t lv_roller_func[] = {
{ "get_option_cnt", { (const void*) &lv_roller_get_option_count, "i", "(lv.obj)" } },
{ "get_option_count", { (const void*) &lv_roller_get_option_count, "i", "(lv.obj)" } },
{ "get_option_str", { (const void*) &lv_roller_get_option_str, "i", "(lv.obj)ici" } },
{ "get_options", { (const void*) &lv_roller_get_options, "s", "(lv.obj)" } },
{ "get_selected", { (const void*) &lv_roller_get_selected, "i", "(lv.obj)" } },
{ "get_selected_str", { (const void*) &lv_roller_get_selected_str, "", "(lv.obj)ci" } },
@ -1302,10 +1332,14 @@ const be_ntv_func_def_t lv_scale_func[] = {
{ "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" } },
{ "set_major_tick_every", { (const void*) &lv_scale_set_major_tick_every, "", "(lv.obj)i" } },
{ "set_max_value", { (const void*) &lv_scale_set_max_value, "", "(lv.obj)i" } },
{ "set_min_value", { (const void*) &lv_scale_set_min_value, "", "(lv.obj)i" } },
{ "set_mode", { (const void*) &lv_scale_set_mode, "", "(lv.obj)i" } },
{ "set_post_draw", { (const void*) &lv_scale_set_post_draw, "", "(lv.obj)b" } },
{ "set_range", { (const void*) &lv_scale_set_range, "", "(lv.obj)ii" } },
{ "set_rotation", { (const void*) &lv_scale_set_rotation, "", "(lv.obj)i" } },
{ "set_section_max_value", { (const void*) &lv_scale_set_section_max_value, "", "(lv.obj)(lv.scale_section)i" } },
{ "set_section_min_value", { (const void*) &lv_scale_set_section_min_value, "", "(lv.obj)(lv.scale_section)i" } },
{ "set_section_range", { (const void*) &lv_scale_set_section_range, "", "(lv.obj)(lv.scale_section)ii" } },
{ "set_section_style_indicator", { (const void*) &lv_scale_set_section_style_indicator, "", "(lv.obj)(lv.scale_section)(lv.style)" } },
{ "set_section_style_items", { (const void*) &lv_scale_set_section_style_items, "", "(lv.obj)(lv.scale_section)(lv.style)" } },
@ -1334,6 +1368,8 @@ const be_ntv_func_def_t lv_slider_func[] = {
{ "get_value", { (const void*) &lv_slider_get_value, "i", "(lv.obj)" } },
{ "is_dragged", { (const void*) &lv_slider_is_dragged, "b", "(lv.obj)" } },
{ "is_symmetrical", { (const void*) &lv_slider_is_symmetrical, "b", "(lv.obj)" } },
{ "set_max_value", { (const void*) &lv_slider_set_max_value, "", "(lv.obj)i" } },
{ "set_min_value", { (const void*) &lv_slider_set_min_value, "", "(lv.obj)i" } },
{ "set_mode", { (const void*) &lv_slider_set_mode, "", "(lv.obj)i" } },
{ "set_orientation", { (const void*) &lv_slider_set_orientation, "", "(lv.obj)i" } },
{ "set_range", { (const void*) &lv_slider_set_range, "", "(lv.obj)ii" } },
@ -1348,6 +1384,7 @@ const be_ntv_func_def_t lv_span_func[] = {
{ "get_style", { (const void*) &lv_span_get_style, "lv.style", "(lv.span)" } },
{ "get_text", { (const void*) &lv_span_get_text, "s", "(lv.span)" } },
{ "set_text", { (const void*) &lv_span_set_text, "", "(lv.span)s" } },
{ "set_text_fmt", { (const void*) &lv_span_set_text_fmt, "", "(lv.span)s[......]" } },
{ "set_text_static", { (const void*) &lv_span_set_text_static, "", "(lv.span)s" } },
};
#endif // BE_LV_WIDGET_SPAN
@ -1377,6 +1414,7 @@ const be_ntv_func_def_t lv_spangroup_func[] = {
{ "set_overflow", { (const void*) &lv_spangroup_set_overflow, "", "(lv.obj)i" } },
{ "set_span_style", { (const void*) &lv_spangroup_set_span_style, "", "(lv.obj)(lv.span)(lv.style)" } },
{ "set_span_text", { (const void*) &lv_spangroup_set_span_text, "", "(lv.obj)(lv.span)s" } },
{ "set_span_text_fmt", { (const void*) &lv_spangroup_set_span_text_fmt, "", "(lv.obj)(lv.span)s[......]" } },
{ "set_span_text_static", { (const void*) &lv_spangroup_set_span_text_static, "", "(lv.obj)(lv.span)s" } },
};
#endif // BE_LV_WIDGET_SPANGROUP
@ -1390,8 +1428,12 @@ const be_ntv_func_def_t lv_spinbox_func[] = {
{ "get_value", { (const void*) &lv_spinbox_get_value, "i", "(lv.obj)" } },
{ "increment", { (const void*) &lv_spinbox_increment, "", "(lv.obj)" } },
{ "set_cursor_pos", { (const void*) &lv_spinbox_set_cursor_pos, "", "(lv.obj)i" } },
{ "set_dec_point_pos", { (const void*) &lv_spinbox_set_dec_point_pos, "", "(lv.obj)i" } },
{ "set_digit_count", { (const void*) &lv_spinbox_set_digit_count, "", "(lv.obj)i" } },
{ "set_digit_format", { (const void*) &lv_spinbox_set_digit_format, "", "(lv.obj)ii" } },
{ "set_digit_step_direction", { (const void*) &lv_spinbox_set_digit_step_direction, "", "(lv.obj)i" } },
{ "set_max_value", { (const void*) &lv_spinbox_set_max_value, "", "(lv.obj)i" } },
{ "set_min_value", { (const void*) &lv_spinbox_set_min_value, "", "(lv.obj)i" } },
{ "set_range", { (const void*) &lv_spinbox_set_range, "", "(lv.obj)ii" } },
{ "set_rollover", { (const void*) &lv_spinbox_set_rollover, "", "(lv.obj)b" } },
{ "set_step", { (const void*) &lv_spinbox_set_step, "", "(lv.obj)i" } },
@ -1453,6 +1495,7 @@ const be_ntv_func_def_t lv_tabview_func[] = {
{ "get_tab_active", { (const void*) &lv_tabview_get_tab_active, "i", "(lv.obj)" } },
{ "get_tab_bar", { (const void*) &lv_tabview_get_tab_bar, "lv.obj", "(lv.obj)" } },
{ "get_tab_btns", { (const void*) &lv_tabview_get_tab_bar, "lv.obj", "(lv.obj)" } },
{ "get_tab_button", { (const void*) &lv_tabview_get_tab_button, "lv.obj", "(lv.obj)i" } },
{ "get_tab_count", { (const void*) &lv_tabview_get_tab_count, "i", "(lv.obj)" } },
{ "rename_tab", { (const void*) &lv_tabview_rename_tab, "", "(lv.obj)is" } },
{ "set_act", { (const void*) &lv_tabview_set_active, "", "(lv.obj)ii" } },

View File

@ -41,6 +41,29 @@ const be_ntv_func_def_t lv_func[] = {
{ "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" } },
{ "arclabel_create", { (const void*) &lv_arclabel_create, "lv.obj", "(lv.obj)" } },
{ "arclabel_get_angle_size", { (const void*) &lv_arclabel_get_angle_size, "i", "(lv.obj)" } },
{ "arclabel_get_angle_start", { (const void*) &lv_arclabel_get_angle_start, "i", "(lv.obj)" } },
{ "arclabel_get_center_offset_x", { (const void*) &lv_arclabel_get_center_offset_x, "i", "(lv.obj)" } },
{ "arclabel_get_center_offset_y", { (const void*) &lv_arclabel_get_center_offset_y, "i", "(lv.obj)" } },
{ "arclabel_get_dir", { (const void*) &lv_arclabel_get_dir, "i", "(lv.obj)" } },
{ "arclabel_get_radius", { (const void*) &lv_arclabel_get_radius, "i", "(lv.obj)" } },
{ "arclabel_get_recolor", { (const void*) &lv_arclabel_get_recolor, "b", "(lv.obj)" } },
{ "arclabel_get_text_horizontal_align", { (const void*) &lv_arclabel_get_text_horizontal_align, "i", "(lv.obj)" } },
{ "arclabel_get_text_vertical_align", { (const void*) &lv_arclabel_get_text_vertical_align, "i", "(lv.obj)" } },
{ "arclabel_set_angle_size", { (const void*) &lv_arclabel_set_angle_size, "", "(lv.obj)i" } },
{ "arclabel_set_angle_start", { (const void*) &lv_arclabel_set_angle_start, "", "(lv.obj)i" } },
{ "arclabel_set_center_offset_x", { (const void*) &lv_arclabel_set_center_offset_x, "", "(lv.obj)i" } },
{ "arclabel_set_center_offset_y", { (const void*) &lv_arclabel_set_center_offset_y, "", "(lv.obj)i" } },
{ "arclabel_set_dir", { (const void*) &lv_arclabel_set_dir, "", "(lv.obj)i" } },
{ "arclabel_set_offset", { (const void*) &lv_arclabel_set_offset, "", "(lv.obj)i" } },
{ "arclabel_set_radius", { (const void*) &lv_arclabel_set_radius, "", "(lv.obj)i" } },
{ "arclabel_set_recolor", { (const void*) &lv_arclabel_set_recolor, "", "(lv.obj)b" } },
{ "arclabel_set_text", { (const void*) &lv_arclabel_set_text, "", "(lv.obj)s" } },
{ "arclabel_set_text_fmt", { (const void*) &lv_arclabel_set_text_fmt, "", "(lv.obj)s[......]" } },
{ "arclabel_set_text_horizontal_align", { (const void*) &lv_arclabel_set_text_horizontal_align, "", "(lv.obj)i" } },
{ "arclabel_set_text_static", { (const void*) &lv_arclabel_set_text_static, "", "(lv.obj)s" } },
{ "arclabel_set_text_vertical_align", { (const void*) &lv_arclabel_set_text_vertical_align, "", "(lv.obj)i" } },
{ "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)" } },
@ -68,6 +91,7 @@ const be_ntv_func_def_t lv_func[] = {
{ "color_hex", { (const void*) &lv_color_hex, "lv.color", "i" } },
{ "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_is_in_range", { (const void*) &lv_color_is_in_range, "b", "(lv.color)(lv.color)(lv.color)" } },
{ "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" } },
@ -111,6 +135,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_unit_send_event", { (const void*) &lv_draw_unit_send_event, "", "si." } },
{ "draw_wait_for_finish", { (const void*) &lv_draw_wait_for_finish, "", "" } },
{ "event_code_get_name", { (const void*) &lv_event_code_get_name, "s", "i" } },
{ "event_dsc_get_cb", { (const void*) &lv_event_dsc_get_cb, "lv.event_cb", "(lv.event_dsc)" } },
@ -180,9 +205,6 @@ const be_ntv_func_def_t lv_func[] = {
{ "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" } },
{ "text_get_width", { (const void*) &lv_text_get_width, "i", "si(lv.font)i" } },
{ "text_get_width_with_flags", { (const void*) &lv_text_get_width_with_flags, "i", "si(lv.font)ii" } },
{ "text_is_cmd", { (const void*) &lv_text_is_cmd, "b", "ci" } },
{ "theme_apply", { (const void*) &lv_theme_apply, "", "(lv.obj)" } },
{ "theme_get_color_primary", { (const void*) &lv_theme_get_color_primary, "lv.color", "(lv.obj)" } },
{ "theme_get_color_secondary", { (const void*) &lv_theme_get_color_secondary, "lv.color", "(lv.obj)" } },
@ -241,6 +263,12 @@ const be_const_member_t lv0_constants[] = {
{ "ANIM_ON", be_cconst_int(LV_ANIM_ON) },
{ "ANIM_PLAYTIME_INFINITE", be_cconst_int(LV_ANIM_PLAYTIME_INFINITE) },
{ "ANIM_REPEAT_INFINITE", be_cconst_int(LV_ANIM_REPEAT_INFINITE) },
{ "ARCLABEL_DIR_CLOCKWISE", be_cconst_int(LV_ARCLABEL_DIR_CLOCKWISE) },
{ "ARCLABEL_DIR_COUNTER_CLOCKWISE", be_cconst_int(LV_ARCLABEL_DIR_COUNTER_CLOCKWISE) },
{ "ARCLABEL_TEXT_ALIGN_CENTER", be_cconst_int(LV_ARCLABEL_TEXT_ALIGN_CENTER) },
{ "ARCLABEL_TEXT_ALIGN_DEFAULT", be_cconst_int(LV_ARCLABEL_TEXT_ALIGN_DEFAULT) },
{ "ARCLABEL_TEXT_ALIGN_LEADING", be_cconst_int(LV_ARCLABEL_TEXT_ALIGN_LEADING) },
{ "ARCLABEL_TEXT_ALIGN_TRAILING", be_cconst_int(LV_ARCLABEL_TEXT_ALIGN_TRAILING) },
{ "ARC_MODE_NORMAL", be_cconst_int(LV_ARC_MODE_NORMAL) },
{ "ARC_MODE_REVERSE", be_cconst_int(LV_ARC_MODE_REVERSE) },
{ "ARC_MODE_SYMMETRICAL", be_cconst_int(LV_ARC_MODE_SYMMETRICAL) },
@ -316,6 +344,7 @@ const be_const_member_t lv0_constants[] = {
{ "CHART_TYPE_LINE", be_cconst_int(LV_CHART_TYPE_LINE) },
{ "CHART_TYPE_NONE", be_cconst_int(LV_CHART_TYPE_NONE) },
{ "CHART_TYPE_SCATTER", be_cconst_int(LV_CHART_TYPE_SCATTER) },
{ "CHART_TYPE_STACKED", be_cconst_int(LV_CHART_TYPE_STACKED) },
{ "CHART_UPDATE_MODE_CIRCULAR", be_cconst_int(LV_CHART_UPDATE_MODE_CIRCULAR) },
{ "CHART_UPDATE_MODE_SHIFT", be_cconst_int(LV_CHART_UPDATE_MODE_SHIFT) },
{ "COLOR_AQUA", be_cconst_int(0x00FFFF) },
@ -433,9 +462,10 @@ const be_const_member_t lv0_constants[] = {
{ "DISP_ROTATION_180", be_cconst_int(LV_DISPLAY_ROTATION_180) },
{ "DISP_ROTATION_270", be_cconst_int(LV_DISPLAY_ROTATION_270) },
{ "DISP_ROTATION_90", be_cconst_int(LV_DISPLAY_ROTATION_90) },
{ "DRAW_TASK_STATE_BLOCKED", be_cconst_int(LV_DRAW_TASK_STATE_BLOCKED) },
{ "DRAW_TASK_STATE_FINISHED", be_cconst_int(LV_DRAW_TASK_STATE_FINISHED) },
{ "DRAW_TASK_STATE_IN_PROGRESS", be_cconst_int(LV_DRAW_TASK_STATE_IN_PROGRESS) },
{ "DRAW_TASK_STATE_QUEUED", be_cconst_int(LV_DRAW_TASK_STATE_QUEUED) },
{ "DRAW_TASK_STATE_READY", be_cconst_int(LV_DRAW_TASK_STATE_READY) },
{ "DRAW_TASK_STATE_WAITING", be_cconst_int(LV_DRAW_TASK_STATE_WAITING) },
{ "DRAW_TASK_TYPE_ARC", be_cconst_int(LV_DRAW_TASK_TYPE_ARC) },
{ "DRAW_TASK_TYPE_BORDER", be_cconst_int(LV_DRAW_TASK_TYPE_BORDER) },
@ -584,7 +614,6 @@ const be_const_member_t lv0_constants[] = {
{ "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) },
@ -686,6 +715,7 @@ const be_const_member_t lv0_constants[] = {
{ "OBJ_FLAG_CLICKABLE", be_cconst_int(LV_OBJ_FLAG_CLICKABLE) },
{ "OBJ_FLAG_CLICK_FOCUSABLE", be_cconst_int(LV_OBJ_FLAG_CLICK_FOCUSABLE) },
{ "OBJ_FLAG_EVENT_BUBBLE", be_cconst_int(LV_OBJ_FLAG_EVENT_BUBBLE) },
{ "OBJ_FLAG_EVENT_TRICKLE", be_cconst_int(LV_OBJ_FLAG_EVENT_TRICKLE) },
{ "OBJ_FLAG_FLEX_IN_NEW_TRACK", be_cconst_int(LV_OBJ_FLAG_FLEX_IN_NEW_TRACK) },
{ "OBJ_FLAG_FLOATING", be_cconst_int(LV_OBJ_FLAG_FLOATING) },
{ "OBJ_FLAG_GESTURE_BUBBLE", be_cconst_int(LV_OBJ_FLAG_GESTURE_BUBBLE) },
@ -706,6 +736,7 @@ const be_const_member_t lv0_constants[] = {
{ "OBJ_FLAG_SCROLL_WITH_ARROW", be_cconst_int(LV_OBJ_FLAG_SCROLL_WITH_ARROW) },
{ "OBJ_FLAG_SEND_DRAW_TASK_EVENTS", be_cconst_int(LV_OBJ_FLAG_SEND_DRAW_TASK_EVENTS) },
{ "OBJ_FLAG_SNAPPABLE", be_cconst_int(LV_OBJ_FLAG_SNAPPABLE) },
{ "OBJ_FLAG_STATE_TRICKLE", be_cconst_int(LV_OBJ_FLAG_STATE_TRICKLE) },
{ "OBJ_FLAG_USER_1", be_cconst_int(LV_OBJ_FLAG_USER_1) },
{ "OBJ_FLAG_USER_2", be_cconst_int(LV_OBJ_FLAG_USER_2) },
{ "OBJ_FLAG_USER_3", be_cconst_int(LV_OBJ_FLAG_USER_3) },
@ -786,6 +817,22 @@ const be_const_member_t lv0_constants[] = {
{ "SCALE_NONE", be_cconst_int(LV_SCALE_NONE) },
{ "SCALE_ROTATION_ANGLE_MASK", be_cconst_int(LV_SCALE_ROTATION_ANGLE_MASK) },
{ "SCALE_TOTAL_TICK_COUNT_DEFAULT", be_cconst_int(LV_SCALE_TOTAL_TICK_COUNT_DEFAULT) },
{ "SCREEN_LOAD_ANIM_FADE_IN", be_cconst_int(LV_SCREEN_LOAD_ANIM_FADE_IN) },
{ "SCREEN_LOAD_ANIM_FADE_ON", be_cconst_int(LV_SCREEN_LOAD_ANIM_FADE_ON) },
{ "SCREEN_LOAD_ANIM_FADE_OUT", be_cconst_int(LV_SCREEN_LOAD_ANIM_FADE_OUT) },
{ "SCREEN_LOAD_ANIM_MOVE_BOTTOM", be_cconst_int(LV_SCREEN_LOAD_ANIM_MOVE_BOTTOM) },
{ "SCREEN_LOAD_ANIM_MOVE_LEFT", be_cconst_int(LV_SCREEN_LOAD_ANIM_MOVE_LEFT) },
{ "SCREEN_LOAD_ANIM_MOVE_RIGHT", be_cconst_int(LV_SCREEN_LOAD_ANIM_MOVE_RIGHT) },
{ "SCREEN_LOAD_ANIM_MOVE_TOP", be_cconst_int(LV_SCREEN_LOAD_ANIM_MOVE_TOP) },
{ "SCREEN_LOAD_ANIM_NONE", be_cconst_int(LV_SCREEN_LOAD_ANIM_NONE) },
{ "SCREEN_LOAD_ANIM_OUT_BOTTOM", be_cconst_int(LV_SCREEN_LOAD_ANIM_OUT_BOTTOM) },
{ "SCREEN_LOAD_ANIM_OUT_LEFT", be_cconst_int(LV_SCREEN_LOAD_ANIM_OUT_LEFT) },
{ "SCREEN_LOAD_ANIM_OUT_RIGHT", be_cconst_int(LV_SCREEN_LOAD_ANIM_OUT_RIGHT) },
{ "SCREEN_LOAD_ANIM_OUT_TOP", be_cconst_int(LV_SCREEN_LOAD_ANIM_OUT_TOP) },
{ "SCREEN_LOAD_ANIM_OVER_BOTTOM", be_cconst_int(LV_SCREEN_LOAD_ANIM_OVER_BOTTOM) },
{ "SCREEN_LOAD_ANIM_OVER_LEFT", be_cconst_int(LV_SCREEN_LOAD_ANIM_OVER_LEFT) },
{ "SCREEN_LOAD_ANIM_OVER_RIGHT", be_cconst_int(LV_SCREEN_LOAD_ANIM_OVER_RIGHT) },
{ "SCREEN_LOAD_ANIM_OVER_TOP", be_cconst_int(LV_SCREEN_LOAD_ANIM_OVER_TOP) },
{ "SCROLLBAR_MODE_ACTIVE", be_cconst_int(LV_SCROLLBAR_MODE_ACTIVE) },
{ "SCROLLBAR_MODE_AUTO", be_cconst_int(LV_SCROLLBAR_MODE_AUTO) },
{ "SCROLLBAR_MODE_OFF", be_cconst_int(LV_SCROLLBAR_MODE_OFF) },
@ -794,22 +841,6 @@ const be_const_member_t lv0_constants[] = {
{ "SCROLL_SNAP_END", be_cconst_int(LV_SCROLL_SNAP_END) },
{ "SCROLL_SNAP_NONE", be_cconst_int(LV_SCROLL_SNAP_NONE) },
{ "SCROLL_SNAP_START", be_cconst_int(LV_SCROLL_SNAP_START) },
{ "SCR_LOAD_ANIM_FADE_IN", be_cconst_int(LV_SCR_LOAD_ANIM_FADE_IN) },
{ "SCR_LOAD_ANIM_FADE_ON", be_cconst_int(LV_SCR_LOAD_ANIM_FADE_ON) },
{ "SCR_LOAD_ANIM_FADE_OUT", be_cconst_int(LV_SCR_LOAD_ANIM_FADE_OUT) },
{ "SCR_LOAD_ANIM_MOVE_BOTTOM", be_cconst_int(LV_SCR_LOAD_ANIM_MOVE_BOTTOM) },
{ "SCR_LOAD_ANIM_MOVE_LEFT", be_cconst_int(LV_SCR_LOAD_ANIM_MOVE_LEFT) },
{ "SCR_LOAD_ANIM_MOVE_RIGHT", be_cconst_int(LV_SCR_LOAD_ANIM_MOVE_RIGHT) },
{ "SCR_LOAD_ANIM_MOVE_TOP", be_cconst_int(LV_SCR_LOAD_ANIM_MOVE_TOP) },
{ "SCR_LOAD_ANIM_NONE", be_cconst_int(LV_SCR_LOAD_ANIM_NONE) },
{ "SCR_LOAD_ANIM_OUT_BOTTOM", be_cconst_int(LV_SCR_LOAD_ANIM_OUT_BOTTOM) },
{ "SCR_LOAD_ANIM_OUT_LEFT", be_cconst_int(LV_SCR_LOAD_ANIM_OUT_LEFT) },
{ "SCR_LOAD_ANIM_OUT_RIGHT", be_cconst_int(LV_SCR_LOAD_ANIM_OUT_RIGHT) },
{ "SCR_LOAD_ANIM_OUT_TOP", be_cconst_int(LV_SCR_LOAD_ANIM_OUT_TOP) },
{ "SCR_LOAD_ANIM_OVER_BOTTOM", be_cconst_int(LV_SCR_LOAD_ANIM_OVER_BOTTOM) },
{ "SCR_LOAD_ANIM_OVER_LEFT", be_cconst_int(LV_SCR_LOAD_ANIM_OVER_LEFT) },
{ "SCR_LOAD_ANIM_OVER_RIGHT", be_cconst_int(LV_SCR_LOAD_ANIM_OVER_RIGHT) },
{ "SCR_LOAD_ANIM_OVER_TOP", be_cconst_int(LV_SCR_LOAD_ANIM_OVER_TOP) },
{ "SIZE_CONTENT", be_cconst_int(LV_SIZE_CONTENT) },
{ "SLIDER_MODE_NORMAL", be_cconst_int(LV_SLIDER_MODE_NORMAL) },
{ "SLIDER_MODE_RANGE", be_cconst_int(LV_SLIDER_MODE_RANGE) },
@ -889,6 +920,7 @@ const be_const_member_t lv0_constants[] = {
{ "STYLE_GRID_ROW_ALIGN", be_cconst_int(LV_STYLE_GRID_ROW_ALIGN) },
{ "STYLE_GRID_ROW_DSC_ARRAY", be_cconst_int(LV_STYLE_GRID_ROW_DSC_ARRAY) },
{ "STYLE_HEIGHT", be_cconst_int(LV_STYLE_HEIGHT) },
{ "STYLE_IMAGE_COLORKEY", be_cconst_int(LV_STYLE_IMAGE_COLORKEY) },
{ "STYLE_IMAGE_OPA", be_cconst_int(LV_STYLE_IMAGE_OPA) },
{ "STYLE_IMAGE_RECOLOR", be_cconst_int(LV_STYLE_IMAGE_RECOLOR) },
{ "STYLE_IMAGE_RECOLOR_OPA", be_cconst_int(LV_STYLE_IMAGE_RECOLOR_OPA) },
@ -1050,9 +1082,6 @@ const be_const_member_t lv0_constants[] = {
{ "TEXT_ALIGN_CENTER", be_cconst_int(LV_TEXT_ALIGN_CENTER) },
{ "TEXT_ALIGN_LEFT", be_cconst_int(LV_TEXT_ALIGN_LEFT) },
{ "TEXT_ALIGN_RIGHT", be_cconst_int(LV_TEXT_ALIGN_RIGHT) },
{ "TEXT_CMD_STATE_IN", be_cconst_int(LV_TEXT_CMD_STATE_IN) },
{ "TEXT_CMD_STATE_PAR", be_cconst_int(LV_TEXT_CMD_STATE_PAR) },
{ "TEXT_CMD_STATE_WAIT", be_cconst_int(LV_TEXT_CMD_STATE_WAIT) },
{ "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) },

View File

@ -213,6 +213,7 @@ LV_OBJ_FLAG_CHECKABLE
LV_OBJ_FLAG_CLICKABLE
LV_OBJ_FLAG_CLICK_FOCUSABLE
LV_OBJ_FLAG_EVENT_BUBBLE
LV_OBJ_FLAG_EVENT_TRICKLE
LV_OBJ_FLAG_FLEX_IN_NEW_TRACK
LV_OBJ_FLAG_FLOATING
LV_OBJ_FLAG_GESTURE_BUBBLE
@ -233,35 +234,13 @@ LV_OBJ_FLAG_SCROLL_ON_FOCUS
LV_OBJ_FLAG_SCROLL_WITH_ARROW
LV_OBJ_FLAG_SEND_DRAW_TASK_EVENTS
LV_OBJ_FLAG_SNAPPABLE
LV_OBJ_FLAG_STATE_TRICKLE
LV_OBJ_FLAG_USER_1
LV_OBJ_FLAG_USER_2
LV_OBJ_FLAG_USER_3
LV_OBJ_FLAG_USER_4
LV_OBJ_FLAG_WIDGET_1
LV_OBJ_FLAG_WIDGET_2
LV_PART_ANY
LV_PART_CURSOR
LV_PART_CUSTOM_FIRST
LV_PART_INDICATOR
LV_PART_ITEMS
LV_PART_KNOB
LV_PART_MAIN
LV_PART_SCROLLBAR
LV_PART_SELECTED
LV_STATE_ANY
LV_STATE_CHECKED
LV_STATE_DEFAULT
LV_STATE_DISABLED
LV_STATE_EDITED
LV_STATE_FOCUSED
LV_STATE_FOCUS_KEY
LV_STATE_HOVERED
LV_STATE_PRESSED
LV_STATE_SCROLLED
LV_STATE_USER_1
LV_STATE_USER_2
LV_STATE_USER_3
LV_STATE_USER_4
// File: ../../lvgl/src/core/lv_obj_class.h
LV_OBJ_CLASS_EDITABLE_FALSE
@ -300,6 +279,29 @@ LV_SCROLL_SNAP_NONE
LV_SCROLL_SNAP_START
// File: ../../lvgl/src/core/lv_obj_style.h
LV_PART_ANY
LV_PART_CURSOR
LV_PART_CUSTOM_FIRST
LV_PART_INDICATOR
LV_PART_ITEMS
LV_PART_KNOB
LV_PART_MAIN
LV_PART_SCROLLBAR
LV_PART_SELECTED
LV_STATE_ANY
LV_STATE_CHECKED
LV_STATE_DEFAULT
LV_STATE_DISABLED
LV_STATE_EDITED
LV_STATE_FOCUSED
LV_STATE_FOCUS_KEY
LV_STATE_HOVERED
LV_STATE_PRESSED
LV_STATE_SCROLLED
LV_STATE_USER_1
LV_STATE_USER_2
LV_STATE_USER_3
LV_STATE_USER_4
LV_STYLE_STATE_CMP_DIFF_DRAW_PAD
LV_STYLE_STATE_CMP_DIFF_LAYOUT
LV_STYLE_STATE_CMP_DIFF_REDRAW
@ -322,27 +324,28 @@ LV_DISPLAY_ROTATION_0
LV_DISPLAY_ROTATION_180
LV_DISPLAY_ROTATION_270
LV_DISPLAY_ROTATION_90
LV_SCR_LOAD_ANIM_FADE_IN
LV_SCR_LOAD_ANIM_FADE_ON
LV_SCR_LOAD_ANIM_FADE_OUT
LV_SCR_LOAD_ANIM_MOVE_BOTTOM
LV_SCR_LOAD_ANIM_MOVE_LEFT
LV_SCR_LOAD_ANIM_MOVE_RIGHT
LV_SCR_LOAD_ANIM_MOVE_TOP
LV_SCR_LOAD_ANIM_NONE
LV_SCR_LOAD_ANIM_OUT_BOTTOM
LV_SCR_LOAD_ANIM_OUT_LEFT
LV_SCR_LOAD_ANIM_OUT_RIGHT
LV_SCR_LOAD_ANIM_OUT_TOP
LV_SCR_LOAD_ANIM_OVER_BOTTOM
LV_SCR_LOAD_ANIM_OVER_LEFT
LV_SCR_LOAD_ANIM_OVER_RIGHT
LV_SCR_LOAD_ANIM_OVER_TOP
LV_SCREEN_LOAD_ANIM_FADE_IN
LV_SCREEN_LOAD_ANIM_FADE_ON
LV_SCREEN_LOAD_ANIM_FADE_OUT
LV_SCREEN_LOAD_ANIM_MOVE_BOTTOM
LV_SCREEN_LOAD_ANIM_MOVE_LEFT
LV_SCREEN_LOAD_ANIM_MOVE_RIGHT
LV_SCREEN_LOAD_ANIM_MOVE_TOP
LV_SCREEN_LOAD_ANIM_NONE
LV_SCREEN_LOAD_ANIM_OUT_BOTTOM
LV_SCREEN_LOAD_ANIM_OUT_LEFT
LV_SCREEN_LOAD_ANIM_OUT_RIGHT
LV_SCREEN_LOAD_ANIM_OUT_TOP
LV_SCREEN_LOAD_ANIM_OVER_BOTTOM
LV_SCREEN_LOAD_ANIM_OVER_LEFT
LV_SCREEN_LOAD_ANIM_OVER_RIGHT
LV_SCREEN_LOAD_ANIM_OVER_TOP
// File: ../../lvgl/src/draw/lv_draw.h
LV_DRAW_TASK_STATE_BLOCKED
LV_DRAW_TASK_STATE_FINISHED
LV_DRAW_TASK_STATE_IN_PROGRESS
LV_DRAW_TASK_STATE_QUEUED
LV_DRAW_TASK_STATE_READY
LV_DRAW_TASK_STATE_WAITING
LV_DRAW_TASK_TYPE_ARC
LV_DRAW_TASK_TYPE_BORDER
@ -772,6 +775,7 @@ LV_STYLE_GRID_COLUMN_DSC_ARRAY
LV_STYLE_GRID_ROW_ALIGN
LV_STYLE_GRID_ROW_DSC_ARRAY
LV_STYLE_HEIGHT
LV_STYLE_IMAGE_COLORKEY
LV_STYLE_IMAGE_OPA
LV_STYLE_IMAGE_RECOLOR
LV_STYLE_IMAGE_RECOLOR_OPA
@ -861,9 +865,6 @@ LV_TEXT_ALIGN_AUTO
LV_TEXT_ALIGN_CENTER
LV_TEXT_ALIGN_LEFT
LV_TEXT_ALIGN_RIGHT
LV_TEXT_CMD_STATE_IN
LV_TEXT_CMD_STATE_PAR
LV_TEXT_CMD_STATE_WAIT
LV_TEXT_FLAG_BREAK_ALL
LV_TEXT_FLAG_EXPAND
LV_TEXT_FLAG_FIT
@ -892,6 +893,14 @@ LV_ARC_MODE_NORMAL
LV_ARC_MODE_REVERSE
LV_ARC_MODE_SYMMETRICAL
// File: ../../lvgl/src/widgets/arclabel/lv_arclabel.h
LV_ARCLABEL_DIR_CLOCKWISE
LV_ARCLABEL_DIR_COUNTER_CLOCKWISE
LV_ARCLABEL_TEXT_ALIGN_CENTER
LV_ARCLABEL_TEXT_ALIGN_DEFAULT
LV_ARCLABEL_TEXT_ALIGN_LEADING
LV_ARCLABEL_TEXT_ALIGN_TRAILING
// File: ../../lvgl/src/widgets/bar/lv_bar.h
LV_BAR_MODE_NORMAL
LV_BAR_MODE_RANGE
@ -954,6 +963,7 @@ LV_CHART_TYPE_BAR
LV_CHART_TYPE_LINE
LV_CHART_TYPE_NONE
LV_CHART_TYPE_SCATTER
LV_CHART_TYPE_STACKED
LV_CHART_UPDATE_MODE_CIRCULAR
LV_CHART_UPDATE_MODE_SHIFT
@ -963,7 +973,6 @@ LV_CHART_UPDATE_MODE_SHIFT
LV_DROPDOWN_POS_LAST
// File: ../../lvgl/src/widgets/image/lv_image.h
LV_IMAGE_ALIGN_AUTO_TRANSFORM
LV_IMAGE_ALIGN_BOTTOM_LEFT
LV_IMAGE_ALIGN_BOTTOM_MID
LV_IMAGE_ALIGN_BOTTOM_RIGHT

View File

@ -76,6 +76,9 @@ 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_add_screen_load_event(lv_obj_t * obj, lv_event_code_t trigger, lv_obj_t * screen, lv_screen_load_anim_t anim_type, uint32_t duration, uint32_t delay)
void lv_obj_add_screen_create_event(lv_obj_t * obj, lv_event_code_t trigger, lv_screen_create_cb_t screen_create_cb, lv_screen_load_anim_t anim_type, uint32_t duration, uint32_t delay)
void lv_obj_add_play_timeline_event(lv_obj_t * obj, lv_event_code_t trigger, lv_anim_timeline_t * at, uint32_t delay, bool reverse)
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_find_by_id(const lv_obj_t * obj, const void * id)
@ -214,6 +217,8 @@ void lv_obj_remove_style(lv_obj_t * obj, const lv_style_t * style, lv_style_sele
void lv_obj_remove_style_all(lv_obj_t * obj)
void lv_obj_report_style_change(lv_style_t * style)
void lv_obj_refresh_style(lv_obj_t * obj, lv_part_t part, lv_style_prop_t prop)
void lv_obj_style_set_disabled(lv_obj_t * obj, const lv_style_t * style, lv_style_selector_t selector, bool dis)
bool lv_obj_style_get_disabled(lv_obj_t * obj, const lv_style_t * style, lv_style_selector_t selector)
void lv_obj_enable_style_refresh(bool en)
lv_style_value_t lv_obj_get_style_prop(const lv_obj_t * obj, lv_part_t part, lv_style_prop_t prop)
bool lv_obj_has_style_prop(const lv_obj_t * obj, lv_style_selector_t selector, lv_style_prop_t prop)
@ -318,6 +323,7 @@ static inline lv_opa_t lv_obj_get_style_image_opa(const lv_obj_t * obj, lv_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 const lv_image_colorkey_t * lv_obj_get_style_image_colorkey(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)
@ -440,6 +446,7 @@ void lv_obj_set_style_shadow_opa(lv_obj_t * obj, lv_opa_t value, lv_style_select
void lv_obj_set_style_image_opa(lv_obj_t * obj, lv_opa_t value, lv_style_selector_t selector)
void lv_obj_set_style_image_recolor(lv_obj_t * obj, lv_color_t value, lv_style_selector_t selector)
void lv_obj_set_style_image_recolor_opa(lv_obj_t * obj, lv_opa_t value, lv_style_selector_t selector)
void lv_obj_set_style_image_colorkey(lv_obj_t * obj, const lv_image_colorkey_t * value, lv_style_selector_t selector)
void lv_obj_set_style_line_width(lv_obj_t * obj, int32_t value, lv_style_selector_t selector)
void lv_obj_set_style_line_dash_width(lv_obj_t * obj, int32_t value, lv_style_selector_t selector)
void lv_obj_set_style_line_dash_gap(lv_obj_t * obj, int32_t value, lv_style_selector_t selector)
@ -561,6 +568,7 @@ bool lv_display_get_antialiasing(lv_display_t * disp)
bool lv_display_is_double_buffered(lv_display_t * disp)
lv_obj_t * lv_display_get_screen_active(lv_display_t * disp)
lv_obj_t * lv_display_get_screen_prev(lv_display_t * disp)
lv_obj_t * lv_display_get_screen_loading(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)
@ -614,6 +622,7 @@ uint32_t lv_draw_get_unit_count(void)
lv_draw_task_t * lv_draw_get_available_task(lv_layer_t * layer, lv_draw_task_t * t_prev, uint8_t draw_unit_id)
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)
void lv_draw_unit_send_event(const char * name, lv_event_code_t code, void * param)
void lv_layer_init(lv_layer_t * layer)
void lv_layer_reset(lv_layer_t * layer)
lv_layer_t * lv_draw_layer_create(lv_layer_t * parent_layer, lv_color_format_t color_format, const lv_area_t * area)
@ -752,6 +761,8 @@ void lv_qrcode_set_size(lv_obj_t * obj, int32_t size)
void lv_qrcode_set_dark_color(lv_obj_t * obj, lv_color_t color)
void lv_qrcode_set_light_color(lv_obj_t * obj, lv_color_t color)
lv_result_t lv_qrcode_update(lv_obj_t * obj, const void * data, uint32_t data_len)
void lv_qrcode_set_data(lv_obj_t * obj, const char * data)
void lv_qrcode_set_quiet_zone(lv_obj_t * obj, bool enable)
// ../../lvgl/src/lv_api_map_v8.h
static inline uint32_t lv_task_handler(void)
@ -762,6 +773,10 @@ static inline void lv_obj_move_background(lv_obj_t * obj)
// ../../lvgl/src/lv_api_map_v9_1.h
// ../../lvgl/src/lv_api_map_v9_2.h
// ../../lvgl/src/lv_api_map_v9_3.h
// ../../lvgl/src/misc/lv_anim.h
void lv_anim_init(lv_anim_t * a)
void lv_anim_set_var(lv_anim_t * a, void * var)
@ -840,6 +855,8 @@ 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)
static inline bool lv_color_is_in_range(lv_color_t color, lv_color_t l_color, lv_color_t h_color)
static inline lv_color_t lv_color16_to_color(lv_color16_t c)
uint16_t lv_color_to_u16(lv_color_t color)
uint32_t lv_color_to_u32(lv_color_t color)
uint16_t lv_color_16_16_mix(uint16_t c1, uint16_t c2, uint8_t mix)
@ -882,7 +899,9 @@ lv_event_code_t lv_event_get_code(lv_event_t * e)
void * lv_event_get_param(lv_event_t * e)
void * lv_event_get_user_data(lv_event_t * e)
void lv_event_stop_bubbling(lv_event_t * e)
void lv_event_stop_trickling(lv_event_t * e)
void lv_event_stop_processing(lv_event_t * e)
void lv_event_free_user_data_cb(lv_event_t * e)
uint32_t lv_event_register_id(void)
const char * lv_event_code_get_name(lv_event_code_t code)
@ -895,6 +914,7 @@ lv_color_t lv_palette_darken(lv_palette_t p, uint8_t lvl)
void lv_style_init(lv_style_t * style)
void lv_style_reset(lv_style_t * style)
void lv_style_copy(lv_style_t * dst, const lv_style_t * src)
void lv_style_merge(lv_style_t * dst, const lv_style_t * src)
static inline bool lv_style_is_const(const lv_style_t * style)
lv_style_prop_t lv_style_register_prop(uint8_t flag)
lv_style_prop_t lv_style_get_num_custom_props(void)
@ -984,6 +1004,7 @@ void lv_style_set_shadow_opa(lv_style_t * style, lv_opa_t value)
void lv_style_set_image_opa(lv_style_t * style, lv_opa_t value)
void lv_style_set_image_recolor(lv_style_t * style, lv_color_t value)
void lv_style_set_image_recolor_opa(lv_style_t * style, lv_opa_t value)
void lv_style_set_image_colorkey(lv_style_t * style, const lv_image_colorkey_t * value)
void lv_style_set_line_width(lv_style_t * style, int32_t value)
void lv_style_set_line_dash_width(lv_style_t * style, int32_t value)
void lv_style_set_line_dash_gap(lv_style_t * style, int32_t value)
@ -1040,9 +1061,6 @@ 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)
int32_t lv_text_get_width_with_flags(const char * txt, uint32_t length, const lv_font_t * font, int32_t letter_space, lv_text_flag_t flags)
bool lv_text_is_cmd(lv_text_cmd_state_t * state, uint32_t c)
// ../../lvgl/src/misc/lv_timer.h
uint32_t lv_timer_handler(void)
@ -1109,6 +1127,8 @@ void lv_arc_set_rotation(lv_obj_t * obj, int32_t rotation)
void lv_arc_set_mode(lv_obj_t * obj, lv_arc_mode_t type)
void lv_arc_set_value(lv_obj_t * obj, int32_t value)
void lv_arc_set_range(lv_obj_t * obj, int32_t min, int32_t max)
void lv_arc_set_min_value(lv_obj_t * obj, int32_t min)
void lv_arc_set_max_value(lv_obj_t * obj, int32_t max)
void lv_arc_set_change_rate(lv_obj_t * obj, uint32_t rate)
void lv_arc_set_knob_offset(lv_obj_t * obj, int32_t offset)
lv_value_precise_t lv_arc_get_angle_start(lv_obj_t * obj)
@ -1124,11 +1144,38 @@ int32_t lv_arc_get_knob_offset(const lv_obj_t * obj)
void lv_arc_align_obj_to_angle(const lv_obj_t * obj, lv_obj_t * obj_to_align, int32_t r_offset)
void lv_arc_rotate_obj_to_angle(const lv_obj_t * obj, lv_obj_t * obj_to_rotate, int32_t r_offset)
// ../../lvgl/src/widgets/arclabel/lv_arclabel.h
lv_obj_t * lv_arclabel_create(lv_obj_t * parent)
void lv_arclabel_set_text(lv_obj_t * obj, const char * text)
void lv_arclabel_set_text_fmt(lv_obj_t * obj, const char * fmt, ...) LV_FORMAT_ATTRIBUTE(2, 3)
void lv_arclabel_set_text_static(lv_obj_t * obj, const char * text)
void lv_arclabel_set_angle_start(lv_obj_t * obj, lv_value_precise_t start)
void lv_arclabel_set_angle_size(lv_obj_t * obj, lv_value_precise_t size)
void lv_arclabel_set_offset(lv_obj_t * obj, int32_t offset)
void lv_arclabel_set_dir(lv_obj_t * obj, lv_arclabel_dir_t dir)
void lv_arclabel_set_recolor(lv_obj_t * obj, bool en)
void lv_arclabel_set_radius(lv_obj_t * obj, uint32_t radius)
void lv_arclabel_set_center_offset_x(lv_obj_t * obj, uint32_t x)
void lv_arclabel_set_center_offset_y(lv_obj_t * obj, uint32_t y)
void lv_arclabel_set_text_vertical_align(lv_obj_t * obj, lv_arclabel_text_align_t align)
void lv_arclabel_set_text_horizontal_align(lv_obj_t * obj, lv_arclabel_text_align_t align)
lv_value_precise_t lv_arclabel_get_angle_start(lv_obj_t * obj)
lv_value_precise_t lv_arclabel_get_angle_size(lv_obj_t * obj)
lv_arclabel_dir_t lv_arclabel_get_dir(const lv_obj_t * obj)
bool lv_arclabel_get_recolor(lv_obj_t * obj)
uint32_t lv_arclabel_get_radius(lv_obj_t * obj)
uint32_t lv_arclabel_get_center_offset_x(lv_obj_t * obj)
uint32_t lv_arclabel_get_center_offset_y(lv_obj_t * obj)
lv_arclabel_text_align_t lv_arclabel_get_text_vertical_align(lv_obj_t * obj)
lv_arclabel_text_align_t lv_arclabel_get_text_horizontal_align(lv_obj_t * obj)
// ../../lvgl/src/widgets/bar/lv_bar.h
lv_obj_t * lv_bar_create(lv_obj_t * parent)
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_min_value(lv_obj_t * obj, int32_t min)
void lv_bar_set_max_value(lv_obj_t * obj, 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)
@ -1162,7 +1209,12 @@ bool lv_buttonmatrix_get_one_checked(const lv_obj_t * obj)
// ../../lvgl/src/widgets/calendar/lv_calendar.h
lv_obj_t * lv_calendar_create(lv_obj_t * parent)
void lv_calendar_set_today_date(lv_obj_t * obj, uint32_t year, uint32_t month, uint32_t day)
void lv_calendar_set_today_year(lv_obj_t * obj, uint32_t year)
void lv_calendar_set_today_month(lv_obj_t * obj, uint32_t month)
void lv_calendar_set_today_day(lv_obj_t * obj, uint32_t day)
void lv_calendar_set_month_shown(lv_obj_t * obj, uint32_t year, uint32_t month)
void lv_calendar_set_shown_year(lv_obj_t * obj, uint32_t year)
void lv_calendar_set_shown_month(lv_obj_t * obj, uint32_t month)
void lv_calendar_set_highlighted_dates(lv_obj_t * obj, lv_calendar_date_t highlighted[], size_t date_num)
void lv_calendar_set_day_names(lv_obj_t * obj, const char ** day_names)
lv_obj_t * lv_calendar_get_btnmatrix(const lv_obj_t * obj)
@ -1205,8 +1257,12 @@ lv_obj_t * lv_chart_create(lv_obj_t * parent)
void lv_chart_set_type(lv_obj_t * obj, lv_chart_type_t type)
void lv_chart_set_point_count(lv_obj_t * obj, uint32_t cnt)
void lv_chart_set_axis_range(lv_obj_t * obj, lv_chart_axis_t axis, int32_t min, int32_t max)
void lv_chart_set_axis_min_value(lv_obj_t * obj, lv_chart_axis_t axis, int32_t min)
void lv_chart_set_axis_max_value(lv_obj_t * obj, lv_chart_axis_t axis, int32_t max)
void lv_chart_set_update_mode(lv_obj_t * obj, lv_chart_update_mode_t update_mode)
void lv_chart_set_div_line_count(lv_obj_t * obj, uint8_t hdiv, uint8_t vdiv)
void lv_chart_set_div_line_count(lv_obj_t * obj, uint32_t hdiv, uint32_t vdiv)
void lv_chart_set_hor_div_line_count(lv_obj_t * obj, uint32_t cnt)
void lv_chart_set_ver_div_line_count(lv_obj_t * obj, uint32_t cnt)
lv_chart_type_t lv_chart_get_type(const lv_obj_t * obj)
uint32_t lv_chart_get_point_count(const lv_obj_t * obj)
uint32_t lv_chart_get_x_start_point(const lv_obj_t * obj, lv_chart_series_t * ser)
@ -1220,6 +1276,7 @@ lv_color_t lv_chart_get_series_color(lv_obj_t * chart, const lv_chart_series_t *
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)
void lv_chart_remove_cursor(lv_obj_t * obj, lv_chart_cursor_t * cursor)
void lv_chart_set_cursor_pos(lv_obj_t * chart, lv_chart_cursor_t * cursor, lv_point_t * pos)
void lv_chart_set_cursor_pos_x(lv_obj_t * chart, lv_chart_cursor_t * cursor, int32_t x)
void lv_chart_set_cursor_pos_y(lv_obj_t * chart, lv_chart_cursor_t * cursor, int32_t y)
@ -1277,6 +1334,8 @@ void lv_image_set_offset_x(lv_obj_t * obj, int32_t x)
void lv_image_set_offset_y(lv_obj_t * obj, int32_t y)
void lv_image_set_rotation(lv_obj_t * obj, int32_t angle)
void lv_image_set_pivot(lv_obj_t * obj, int32_t x, int32_t y)
void lv_image_set_pivot_x(lv_obj_t * obj, int32_t x)
void lv_image_set_pivot_y(lv_obj_t * obj, int32_t y)
void lv_image_set_scale(lv_obj_t * obj, uint32_t zoom)
void lv_image_set_scale_x(lv_obj_t * obj, uint32_t zoom)
void lv_image_set_scale_y(lv_obj_t * obj, uint32_t zoom)
@ -1323,6 +1382,7 @@ const char * lv_keyboard_get_button_text(const lv_obj_t * obj, uint32_t btn_id)
lv_obj_t * lv_label_create(lv_obj_t * parent)
void lv_label_set_text(lv_obj_t * obj, const char * text)
void lv_label_set_text_fmt(lv_obj_t * obj, const char * fmt, ...) LV_FORMAT_ATTRIBUTE(2, 3)
void lv_label_set_text_vfmt(lv_obj_t * obj, const char * fmt, va_list args)
void lv_label_set_text_static(lv_obj_t * obj, const char * text)
void lv_label_set_long_mode(lv_obj_t * obj, lv_label_long_mode_t long_mode)
void lv_label_set_text_selection_start(lv_obj_t * obj, uint32_t index)
@ -1414,6 +1474,7 @@ uint32_t lv_roller_get_selected(const lv_obj_t * obj)
void lv_roller_get_selected_str(const lv_obj_t * obj, char * buf, uint32_t buf_size)
const char * lv_roller_get_options(const lv_obj_t * obj)
uint32_t lv_roller_get_option_count(const lv_obj_t * obj)
lv_result_t lv_roller_get_option_str(const lv_obj_t * obj, uint32_t option, char * buf, uint32_t buf_size)
// ../../lvgl/src/widgets/scale/lv_scale.h
lv_obj_t * lv_scale_create(lv_obj_t * parent)
@ -1422,6 +1483,8 @@ void lv_scale_set_total_tick_count(lv_obj_t * obj, uint32_t total_tick_count)
void lv_scale_set_major_tick_every(lv_obj_t * obj, uint32_t major_tick_every)
void lv_scale_set_label_show(lv_obj_t * obj, bool show_label)
void lv_scale_set_range(lv_obj_t * obj, int32_t min, int32_t max)
void lv_scale_set_min_value(lv_obj_t * obj, int32_t min)
void lv_scale_set_max_value(lv_obj_t * obj, int32_t max)
void lv_scale_set_angle_range(lv_obj_t * obj, uint32_t angle_range)
void lv_scale_set_rotation(lv_obj_t * obj, int32_t rotation)
void lv_scale_set_line_needle_value(lv_obj_t * obj, lv_obj_t * needle_line, int32_t needle_length, int32_t value)
@ -1432,6 +1495,8 @@ 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 min, int32_t max)
void lv_scale_set_section_range(lv_obj_t * scale, lv_scale_section_t * section, int32_t min, int32_t max)
void lv_scale_set_section_min_value(lv_obj_t * scale, lv_scale_section_t * section, int32_t min)
void lv_scale_set_section_max_value(lv_obj_t * scale, lv_scale_section_t * section, int32_t max)
void lv_scale_section_set_style(lv_scale_section_t * section, lv_part_t part, lv_style_t * section_part_style)
void lv_scale_set_section_style_main(lv_obj_t * scale, lv_scale_section_t * section, const lv_style_t * style)
void lv_scale_set_section_style_indicator(lv_obj_t * scale, lv_scale_section_t * section, const lv_style_t * style)
@ -1450,6 +1515,8 @@ lv_obj_t * lv_slider_create(lv_obj_t * parent)
void lv_slider_set_value(lv_obj_t * obj, int32_t value, lv_anim_enable_t anim)
void lv_slider_set_start_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_min_value(lv_obj_t * obj, int32_t min)
void lv_slider_set_max_value(lv_obj_t * obj, int32_t max)
void lv_slider_set_mode(lv_obj_t * obj, lv_slider_mode_t mode)
void lv_slider_set_orientation(lv_obj_t * obj, lv_slider_orientation_t orientation)
int32_t lv_slider_get_value(const lv_obj_t * obj)
@ -1468,9 +1535,11 @@ lv_obj_t * lv_spangroup_create(lv_obj_t * parent)
lv_span_t * lv_spangroup_add_span(lv_obj_t * obj)
void lv_spangroup_delete_span(lv_obj_t * obj, lv_span_t * span)
void lv_span_set_text(lv_span_t * span, const char * text)
void lv_span_set_text_fmt(lv_span_t * span, const char * fmt, ...) LV_FORMAT_ATTRIBUTE(2, 3)
void lv_span_set_text_static(lv_span_t * span, const char * text)
void lv_spangroup_set_span_text(lv_obj_t * obj, lv_span_t * span, const char * text)
void lv_spangroup_set_span_text_static(lv_obj_t * obj, lv_span_t * span, const char * text)
void lv_spangroup_set_span_text_fmt(lv_obj_t * obj, lv_span_t * span, const char * fmt, ...) LV_FORMAT_ATTRIBUTE(3, 4)
void lv_span_set_text_static(lv_span_t * span, const char * text)
void lv_spangroup_set_span_style(lv_obj_t * obj, lv_span_t * span, const lv_style_t * style)
void lv_spangroup_set_align(lv_obj_t * obj, lv_text_align_t align)
@ -1499,8 +1568,12 @@ lv_obj_t * lv_spinbox_create(lv_obj_t * parent)
void lv_spinbox_set_value(lv_obj_t * obj, int32_t v)
void lv_spinbox_set_rollover(lv_obj_t * obj, bool rollover)
void lv_spinbox_set_digit_format(lv_obj_t * obj, uint32_t digit_count, uint32_t sep_pos)
void lv_spinbox_set_digit_count(lv_obj_t * obj, uint32_t digit_count)
void lv_spinbox_set_dec_point_pos(lv_obj_t * obj, uint32_t dec_point_pos)
void lv_spinbox_set_step(lv_obj_t * obj, uint32_t step)
void lv_spinbox_set_range(lv_obj_t * obj, int32_t range_min, int32_t range_max)
void lv_spinbox_set_range(lv_obj_t * obj, int32_t min_value, int32_t max_value)
void lv_spinbox_set_min_value(lv_obj_t * obj, int32_t min_value)
void lv_spinbox_set_max_value(lv_obj_t * obj, int32_t max_value)
void lv_spinbox_set_cursor_pos(lv_obj_t * obj, uint32_t pos)
void lv_spinbox_set_digit_step_direction(lv_obj_t * obj, lv_dir_t direction)
bool lv_spinbox_get_rollover(lv_obj_t * obj)
@ -1548,6 +1621,7 @@ void lv_tabview_set_tab_bar_position(lv_obj_t * obj, lv_dir_t dir)
void lv_tabview_set_tab_bar_size(lv_obj_t * obj, int32_t size)
uint32_t lv_tabview_get_tab_count(lv_obj_t * obj)
uint32_t lv_tabview_get_tab_active(lv_obj_t * obj)
lv_obj_t * lv_tabview_get_tab_button(lv_obj_t * obj, int32_t idx)
lv_obj_t * lv_tabview_get_content(lv_obj_t * obj)
lv_obj_t * lv_tabview_get_tab_bar(lv_obj_t * obj)

View File

@ -51,16 +51,6 @@ const be_ctypes_structure_t be_lv_grad_stop = {
{ "opa", 3, 0, 0, ctypes_u8, 0 },
}};
const be_ctypes_structure_t be_lv_gradient_stop = {
8, /* size in bytes */
3, /* number of elements */
be_ctypes_instance_mappings,
(const be_ctypes_structure_item_t[3]) {
{ "color", 0, 0, 0, ctypes_u24, 1 },
{ "frac", 4, 0, 0, ctypes_u8, 0 },
{ "opa", 3, 0, 0, ctypes_u8, 0 },
}};
const be_ctypes_structure_t be_lv_grad_dsc = {
12, /* size in bytes */
9, /* number of elements */
@ -93,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 */
40, /* number of elements */
41, /* number of elements */
be_ctypes_instance_mappings,
(const be_ctypes_structure_item_t[40]) {
(const be_ctypes_structure_item_t[41]) {
{ "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 },
@ -103,39 +93,40 @@ const be_ctypes_structure_t be_lv_draw_rect_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 },
{ "bg_color", 33, 0, 0, ctypes_u24, 1 },
{ "bg_grad_dir", 47, 0, 4, ctypes_bf, 0 },
{ "bg_grad_extend", 47, 4, 3, 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 },
{ "bg_grad_stops_1_color", 41, 0, 0, ctypes_u24, 1 },
{ "bg_grad_stops_1_frac", 45, 0, 0, ctypes_u8, 0 },
{ "bg_grad_stops_1_opa", 44, 0, 0, ctypes_u8, 0 },
{ "bg_grad_stops_count", 46, 0, 0, ctypes_u8, 0 },
{ "bg_img_opa", 59, 0, 0, ctypes_u8, 0 },
{ "bg_img_recolor", 56, 0, 0, ctypes_u24, 1 },
{ "bg_img_recolor_opa", 60, 0, 0, ctypes_u8, 0 },
{ "bg_img_src", 48, 0, 0, ctypes_ptr32, 0 },
{ "bg_img_symbol_font", 52, 0, 0, ctypes_ptr32, 0 },
{ "bg_img_tiled", 61, 0, 0, ctypes_u8, 0 },
{ "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, 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 },
{ "outline_pad", 84, 0, 0, ctypes_i32, 0 },
{ "outline_width", 80, 0, 0, ctypes_i32, 0 },
{ "bg_color", 56, 0, 0, ctypes_u24, 1 },
{ "bg_grad_dir", 71, 0, 4, ctypes_bf, 0 },
{ "bg_grad_extend", 71, 4, 3, ctypes_bf, 0 },
{ "bg_grad_stops_0_color", 60, 0, 0, ctypes_u24, 1 },
{ "bg_grad_stops_0_frac", 64, 0, 0, ctypes_u8, 0 },
{ "bg_grad_stops_0_opa", 63, 0, 0, ctypes_u8, 0 },
{ "bg_grad_stops_1_color", 65, 0, 0, ctypes_u24, 1 },
{ "bg_grad_stops_1_frac", 69, 0, 0, ctypes_u8, 0 },
{ "bg_grad_stops_1_opa", 68, 0, 0, ctypes_u8, 0 },
{ "bg_grad_stops_count", 70, 0, 0, ctypes_u8, 0 },
{ "bg_image_colorkey", 52, 0, 0, ctypes_ptr32, 0 },
{ "bg_img_opa", 43, 0, 0, ctypes_u8, 0 },
{ "bg_img_recolor", 40, 0, 0, ctypes_u24, 1 },
{ "bg_img_recolor_opa", 44, 0, 0, ctypes_u8, 0 },
{ "bg_img_src", 32, 0, 0, ctypes_ptr32, 0 },
{ "bg_img_symbol_font", 36, 0, 0, ctypes_ptr32, 0 },
{ "bg_img_tiled", 45, 0, 0, ctypes_u8, 0 },
{ "bg_opa", 46, 0, 0, ctypes_u8, 0 },
{ "border_color", 72, 0, 0, ctypes_u24, 1 },
{ "border_opa", 47, 0, 0, ctypes_u8, 0 },
{ "border_post", 80, 5, 1, ctypes_bf, 0 },
{ "border_side", 80, 0, 5, ctypes_bf, 0 },
{ "border_width", 76, 0, 0, ctypes_i32, 0 },
{ "outline_color", 81, 0, 0, ctypes_u24, 1 },
{ "outline_opa", 48, 0, 0, ctypes_u8, 0 },
{ "outline_pad", 88, 0, 0, ctypes_i32, 0 },
{ "outline_width", 84, 0, 0, ctypes_i32, 0 },
{ "radius", 28, 0, 0, ctypes_i32, 0 },
{ "shadow_color", 89, 0, 0, ctypes_u24, 1 },
{ "shadow_ofs_x", 96, 0, 0, ctypes_i32, 0 },
{ "shadow_ofs_y", 100, 0, 0, ctypes_i32, 0 },
{ "shadow_opa", 108, 0, 0, ctypes_u8, 0 },
{ "shadow_spread", 104, 0, 0, ctypes_i32, 0 },
{ "shadow_width", 92, 0, 0, ctypes_i32, 0 },
{ "shadow_color", 92, 0, 0, ctypes_u24, 1 },
{ "shadow_ofs_x", 100, 0, 0, ctypes_i32, 0 },
{ "shadow_ofs_y", 104, 0, 0, ctypes_i32, 0 },
{ "shadow_opa", 49, 0, 0, ctypes_u8, 0 },
{ "shadow_spread", 108, 0, 0, ctypes_i32, 0 },
{ "shadow_width", 96, 0, 0, ctypes_i32, 0 },
}};
const be_ctypes_structure_t be_lv_draw_line_dsc = {
@ -165,7 +156,7 @@ const be_ctypes_structure_t be_lv_draw_line_dsc = {
}};
const be_ctypes_structure_t be_lv_draw_arc_dsc = {
64, /* size in bytes */
60, /* size in bytes */
17, /* number of elements */
be_ctypes_instance_mappings,
(const be_ctypes_structure_item_t[17]) {
@ -180,10 +171,10 @@ const be_ctypes_structure_t be_lv_draw_arc_dsc = {
{ "center_y", 48, 0, 0, ctypes_i32, 0 },
{ "color", 28, 0, 0, ctypes_u24, 1 },
{ "end_angle", 40, 0, 0, ctypes_i32, 0 },
{ "img_src", 56, 0, 0, ctypes_ptr32, 0 },
{ "opa", 60, 0, 0, ctypes_u8, 0 },
{ "radius", 52, 0, 0, ctypes_u16, 0 },
{ "rounded", 61, 0, 1, ctypes_bf, 0 },
{ "img_src", 52, 0, 0, ctypes_ptr32, 0 },
{ "opa", 58, 0, 0, ctypes_u8, 0 },
{ "radius", 56, 0, 0, ctypes_u16, 0 },
{ "rounded", 59, 0, 1, ctypes_bf, 0 },
{ "start_angle", 36, 0, 0, ctypes_i32, 0 },
{ "width", 32, 0, 0, ctypes_i32, 0 },
}};
@ -203,10 +194,10 @@ const be_ctypes_structure_t be_lv_image_header = {
}};
const be_ctypes_structure_t be_lv_draw_image_dsc = {
108, /* size in bytes */
35, /* number of elements */
112, /* size in bytes */
36, /* number of elements */
be_ctypes_instance_mappings,
(const be_ctypes_structure_item_t[35]) {
(const be_ctypes_structure_item_t[36]) {
{ "antialias", 81, 4, 1, ctypes_bf, 0 },
{ "base_dsc_size", 20, 0, 0, ctypes_u32, 0 },
{ "base_id1", 8, 0, 0, ctypes_u32, 0 },
@ -215,7 +206,7 @@ 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 },
{ "bitmap_mask_src", 108, 0, 0, ctypes_ptr32, 0 },
{ "blend_mode", 81, 0, 4, ctypes_bf, 0 },
{ "clip_radius", 44, 0, 0, ctypes_i32, 0 },
{ "header_cf", 33, 0, 0, ctypes_u8, 0 },
@ -225,10 +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", 88, 0, 0, ctypes_i32, 0 },
{ "image_area_x2", 96, 0, 0, ctypes_i32, 0 },
{ "image_area_y1", 92, 0, 0, ctypes_i32, 0 },
{ "image_area_y2", 100, 0, 0, ctypes_i32, 0 },
{ "image_area_x1", 92, 0, 0, ctypes_i32, 0 },
{ "image_area_x2", 100, 0, 0, ctypes_i32, 0 },
{ "image_area_y1", 96, 0, 0, ctypes_i32, 0 },
{ "image_area_y2", 104, 0, 0, ctypes_i32, 0 },
{ "lv_image_colorkey_t", 84, 0, 0, ctypes_ptr32, 0 },
{ "opa", 80, 0, 0, ctypes_u8, 0 },
{ "pivot_x", 68, 0, 0, ctypes_i32, 0 },
{ "pivot_y", 72, 0, 0, ctypes_i32, 0 },
@ -240,7 +232,7 @@ const be_ctypes_structure_t be_lv_draw_image_dsc = {
{ "skew_x", 60, 0, 0, ctypes_i32, 0 },
{ "skew_y", 64, 0, 0, ctypes_i32, 0 },
{ "src", 28, 0, 0, ctypes_ptr32, 0 },
{ "sup", 84, 0, 0, ctypes_ptr32, 0 },
{ "sup", 88, 0, 0, ctypes_ptr32, 0 },
{ "tile", 81, 5, 1, ctypes_bf, 0 },
}};
@ -249,7 +241,7 @@ const be_ctypes_structure_t be_lv_draw_label_dsc = {
35, /* number of elements */
be_ctypes_instance_mappings,
(const be_ctypes_structure_item_t[35]) {
{ "align", 89, 0, 0, ctypes_u8, 0 },
{ "align", 88, 0, 0, ctypes_u8, 0 },
{ "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 },
@ -257,21 +249,21 @@ const be_ctypes_structure_t be_lv_draw_label_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 },
{ "bidi_dir", 90, 0, 0, ctypes_u8, 0 },
{ "blend_mode", 93, 0, 3, ctypes_bf, 0 },
{ "bidi_dir", 89, 0, 0, ctypes_u8, 0 },
{ "blend_mode", 94, 0, 3, ctypes_bf, 0 },
{ "color", 44, 0, 0, ctypes_u24, 1 },
{ "decor", 92, 0, 3, ctypes_bf, 0 },
{ "flag", 92, 3, 5, ctypes_bf, 0 },
{ "decor", 93, 0, 3, ctypes_bf, 0 },
{ "flag", 93, 3, 5, ctypes_bf, 0 },
{ "font", 40, 0, 0, ctypes_ptr32, 0 },
{ "has_bided", 93, 5, 1, ctypes_bf, 0 },
{ "has_bided", 94, 5, 1, ctypes_bf, 0 },
{ "hint", 96, 0, 0, ctypes_ptr32, 0 },
{ "letter_space", 52, 0, 0, ctypes_i32, 0 },
{ "line_space", 48, 0, 0, ctypes_i32, 0 },
{ "ofs_x", 56, 0, 0, ctypes_i32, 0 },
{ "ofs_y", 60, 0, 0, ctypes_i32, 0 },
{ "opa", 88, 0, 0, ctypes_u8, 0 },
{ "outline_stroke_color", 101, 0, 0, ctypes_u24, 1 },
{ "outline_stroke_opa", 100, 0, 0, ctypes_u8, 0 },
{ "opa", 90, 0, 0, ctypes_u8, 0 },
{ "outline_stroke_color", 100, 0, 0, ctypes_u24, 1 },
{ "outline_stroke_opa", 91, 0, 0, ctypes_u8, 0 },
{ "outline_stroke_width", 104, 0, 0, ctypes_i32, 0 },
{ "rotation", 64, 0, 0, ctypes_i32, 0 },
{ "sel_bg_color", 79, 0, 0, ctypes_u24, 1 },
@ -280,10 +272,10 @@ const be_ctypes_structure_t be_lv_draw_label_dsc = {
{ "sel_start", 68, 0, 0, ctypes_u32, 0 },
{ "text", 28, 0, 0, ctypes_ptr32, 0 },
{ "text_length", 84, 0, 0, ctypes_u32, 0 },
{ "text_local", 93, 3, 1, ctypes_bf, 0 },
{ "text_local", 94, 3, 1, ctypes_bf, 0 },
{ "text_size_x", 32, 0, 0, ctypes_i32, 0 },
{ "text_size_y", 36, 0, 0, ctypes_i32, 0 },
{ "text_static", 93, 4, 1, ctypes_bf, 0 },
{ "text_static", 94, 4, 1, ctypes_bf, 0 },
}};
const be_ctypes_structure_t be_lv_chart_series = {
@ -337,9 +329,9 @@ const be_ctypes_structure_t be_lv_obj_class = {
const be_ctypes_structure_t be_lv_event = {
28, /* size in bytes */
9, /* number of elements */
10, /* number of elements */
be_ctypes_instance_mappings,
(const be_ctypes_structure_item_t[9]) {
(const be_ctypes_structure_item_t[10]) {
{ "code", 8, 0, 0, ctypes_i32, 0 },
{ "current_target", 0, 0, 0, ctypes_ptr32, 0 },
{ "deleted", 24, 0, 1, ctypes_bf, 0 },
@ -348,6 +340,7 @@ const be_ctypes_structure_t be_lv_event = {
{ "prev", 20, 0, 0, ctypes_ptr32, 0 },
{ "stop_bubbling", 24, 2, 1, ctypes_bf, 0 },
{ "stop_processing", 24, 1, 1, ctypes_bf, 0 },
{ "stop_trickling", 24, 3, 1, ctypes_bf, 0 },
{ "user_data", 12, 0, 0, ctypes_ptr32, 0 },
}};
@ -381,32 +374,46 @@ const be_ctypes_structure_t be_lv_style_transition_dsc = {
{ "user_data", 4, 0, 0, ctypes_ptr32, 0 },
}};
const be_ctypes_structure_t be_lv_anim_timeline_dsc = {
28, /* size in bytes */
7, /* number of elements */
be_ctypes_instance_mappings,
(const be_ctypes_structure_item_t[7]) {
{ "act_time", 8, 0, 0, ctypes_u32, 0 },
{ "anim_dsc", 0, 0, 0, ctypes_ptr32, 0 },
{ "anim_dsc_cnt", 4, 0, 0, ctypes_u32, 0 },
{ "delay", 12, 0, 0, ctypes_u32, 0 },
{ "repeat_count", 16, 0, 0, ctypes_u32, 0 },
{ "repeat_delay", 20, 0, 0, ctypes_u32, 0 },
{ "user_data", 24, 0, 0, ctypes_ptr32, 0 },
}};
const be_ctypes_structure_t be_lv_layer = {
84, /* size in bytes */
21, /* number of elements */
be_ctypes_instance_mappings,
(const be_ctypes_structure_item_t[21]) {
{ "_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 },
{ "_clip_area_y2", 36, 0, 0, ctypes_i32, 0 },
{ "buf_area_x1", 4, 0, 0, ctypes_i32, 0 },
{ "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_u32, 0 },
{ "_clip_area_x1", 52, 0, 0, ctypes_i32, 0 },
{ "_clip_area_x2", 60, 0, 0, ctypes_i32, 0 },
{ "_clip_area_y1", 56, 0, 0, ctypes_i32, 0 },
{ "_clip_area_y2", 64, 0, 0, ctypes_i32, 0 },
{ "buf_area_x1", 20, 0, 0, ctypes_i32, 0 },
{ "buf_area_x2", 28, 0, 0, ctypes_i32, 0 },
{ "buf_area_y1", 24, 0, 0, ctypes_i32, 0 },
{ "buf_area_y2", 32, 0, 0, ctypes_i32, 0 },
{ "color_format", 76, 0, 0, ctypes_u32, 0 },
{ "draw_buf", 0, 0, 0, ctypes_ptr32, 0 },
{ "draw_task_head", 68, 0, 0, ctypes_ptr32, 0 },
{ "next", 76, 0, 0, ctypes_ptr32, 0 },
{ "opa", 56, 0, 0, ctypes_u8, 0 },
{ "parent", 72, 0, 0, ctypes_ptr32, 0 },
{ "partial_y_offset", 64, 0, 0, ctypes_i32, 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 },
{ "recolor", 60, 0, 0, ctypes_u32, 0 },
{ "user_data", 80, 0, 0, ctypes_ptr32, 0 },
{ "draw_task_head", 4, 0, 0, ctypes_ptr32, 0 },
{ "next", 12, 0, 0, ctypes_ptr32, 0 },
{ "opa", 80, 0, 0, ctypes_u8, 0 },
{ "parent", 8, 0, 0, ctypes_ptr32, 0 },
{ "partial_y_offset", 68, 0, 0, ctypes_i32, 0 },
{ "phy_clip_area_x1", 36, 0, 0, ctypes_i32, 0 },
{ "phy_clip_area_x2", 44, 0, 0, ctypes_i32, 0 },
{ "phy_clip_area_y1", 40, 0, 0, ctypes_i32, 0 },
{ "phy_clip_area_y2", 48, 0, 0, ctypes_i32, 0 },
{ "recolor", 72, 0, 0, ctypes_u32, 0 },
{ "user_data", 16, 0, 0, ctypes_ptr32, 0 },
}};
const be_ctypes_structure_t be_lv_color_filter_dsc = {
@ -419,13 +426,13 @@ const be_ctypes_structure_t be_lv_color_filter_dsc = {
}};
const be_ctypes_structure_t be_lv_timer_ntv = {
24, /* size in bytes */
28, /* size in bytes */
7, /* number of elements */
be_ctypes_instance_mappings,
(const be_ctypes_structure_item_t[7]) {
{ "auto_delete", 20, 1, 1, ctypes_bf, 0 },
{ "auto_delete", 24, 0, 1, ctypes_bf, 0 },
{ "last_run", 4, 0, 0, ctypes_u32, 0 },
{ "paused", 20, 0, 1, ctypes_bf, 0 },
{ "paused", 20, 0, 0, ctypes_i32, 0 },
{ "period", 0, 0, 0, ctypes_u32, 0 },
{ "repeat_count", 16, 0, 0, ctypes_i32, 0 },
{ "timer_cb", 8, 0, 0, ctypes_ptr32, 0 },
@ -498,7 +505,7 @@ const be_ctypes_structure_t be_lv_draw_letter_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 },
{ "blend_mode", 69, 3, 3, ctypes_bf, 0 },
{ "blend_mode", 69, 3, 4, ctypes_bf, 0 },
{ "color", 36, 0, 0, ctypes_u24, 1 },
{ "decor", 69, 0, 3, ctypes_bf, 0 },
{ "font", 32, 0, 0, ctypes_ptr32, 0 },
@ -521,6 +528,7 @@ static const char * be_ctypes_instance_mappings[] = {
NULL
};
static be_define_ctypes_class(lv_anim_timeline_dsc, &be_lv_anim_timeline_dsc, &be_class_ctypes_bytes, "lv_anim_timeline_dsc");
static be_define_ctypes_class(lv_area, &be_lv_area, &be_class_ctypes_bytes, "lv_area");
static be_define_ctypes_class(lv_chart_cursor, &be_lv_chart_cursor, &be_class_ctypes_bytes, "lv_chart_cursor");
static be_define_ctypes_class(lv_chart_series, &be_lv_chart_series, &be_class_ctypes_bytes, "lv_chart_series");
@ -537,7 +545,6 @@ static be_define_ctypes_class(lv_event_dsc, &be_lv_event_dsc, &be_class_ctypes_b
static be_define_ctypes_class(lv_font_info, &be_lv_font_info, &be_class_ctypes_bytes, "lv_font_info");
static be_define_ctypes_class(lv_grad_dsc, &be_lv_grad_dsc, &be_class_ctypes_bytes, "lv_grad_dsc");
static be_define_ctypes_class(lv_grad_stop, &be_lv_grad_stop, &be_class_ctypes_bytes, "lv_grad_stop");
static be_define_ctypes_class(lv_gradient_stop, &be_lv_gradient_stop, &be_class_ctypes_bytes, "lv_gradient_stop");
static be_define_ctypes_class(lv_image_dsc, &be_lv_image_dsc, &be_class_ctypes_bytes, "lv_image_dsc");
static be_define_ctypes_class(lv_image_header, &be_lv_image_header, &be_class_ctypes_bytes, "lv_image_header");
static be_define_ctypes_class(lv_layer, &be_lv_layer, &be_class_ctypes_bytes, "lv_layer");
@ -550,6 +557,7 @@ static be_define_ctypes_class(lv_timer_ntv, &be_lv_timer_ntv, &be_class_ctypes_b
static be_define_ctypes_class(lv_ts_calibration, &be_lv_ts_calibration, &be_class_ctypes_bytes, "lv_ts_calibration");
be_ctypes_class_by_name_t be_ctypes_lvgl_classes[] = {
{ "lv_anim_timeline_dsc", &be_class_lv_anim_timeline_dsc },
{ "lv_area", &be_class_lv_area },
{ "lv_chart_cursor", &be_class_lv_chart_cursor },
{ "lv_chart_series", &be_class_lv_chart_series },
@ -566,7 +574,6 @@ be_ctypes_class_by_name_t be_ctypes_lvgl_classes[] = {
{ "lv_font_info", &be_class_lv_font_info },
{ "lv_grad_dsc", &be_class_lv_grad_dsc },
{ "lv_grad_stop", &be_class_lv_grad_stop },
{ "lv_gradient_stop", &be_class_lv_gradient_stop },
{ "lv_image_dsc", &be_class_lv_image_dsc },
{ "lv_image_header", &be_class_lv_image_header },
{ "lv_layer", &be_class_lv_layer },

View File

@ -52,7 +52,7 @@ int32_t = ct.i32
size_t = ct.u32
ptr = ct.ptr32
lv_point = [ # valid LVGL93
lv_point = [ # valid LVGL94
[int32_t, "x"],
[int32_t, "y"],
]
@ -62,13 +62,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 LVGL93
lv_point_precise = [ # valid LVGL94
[lv_value_precise, "x"],
[lv_value_precise, "y"],
]
lv_point_precise = ct.structure(lv_point_precise, "lv_point_precise")
lv_area = [ # valid LVGL93
lv_area = [ # valid LVGL94
[int32_t, "x1"],
[int32_t, "y1"],
[int32_t, "x2"],
@ -83,13 +83,12 @@ 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_grad_stop_t;
lv_gradient_stop = [ # valid LVGL93
lv_grad_stop = [ # valid LVGL94
[lv_color, "color"],
[lv_opa, "opa"],
[uint8_t, "frac"],
]
lv_grad_stop = ct.structure(lv_gradient_stop, "lv_grad_stop")
lv_gradient_stop = ct.structure(lv_gradient_stop, "lv_gradient_stop")
lv_grad_stop = ct.structure(lv_grad_stop, "lv_grad_stop")
# typedef struct {
# lv_grad_stop_t stops[LV_GRADIENT_MAX_STOPS]; /**< A gradient stop array */
@ -124,7 +123,7 @@ lv_gradient_stop = ct.structure(lv_gradient_stop, "lv_gradient_stop")
# void * state;
# #endif
# } lv_grad_dsc_t;
lv_grad_dsc = [ # valid LVGL93
lv_grad_dsc = [ # valid LVGL94
# 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"],
@ -164,7 +163,7 @@ lv_grad_dsc = ct.structure(lv_grad_dsc, "lv_grad_dsc")
# /**Any custom user data*/
# void * user_data;
# } lv_draw_dsc_base_t;
lv_draw_dsc_base = [ # valid LVGL93
lv_draw_dsc_base = [ # valid LVGL94
[ptr, "obj"],
[uint32_t, "part"],
[uint32_t, "id1"],
@ -180,11 +179,6 @@ lv_draw_dsc_base = ct.structure(lv_draw_dsc_base, "lv_draw_dsc_base")
# int32_t radius;
# /*Background*/
# lv_opa_t bg_opa;
# lv_color_t bg_color; /**< First element of a gradient is a color, so it maps well here*/
# lv_grad_dsc_t bg_grad;
# /*Background img*/
# const void * bg_image_src;
# const void * bg_image_symbol_font;
@ -192,11 +186,24 @@ lv_draw_dsc_base = ct.structure(lv_draw_dsc_base, "lv_draw_dsc_base")
# lv_opa_t bg_image_opa;
# lv_opa_t bg_image_recolor_opa;
# uint8_t bg_image_tiled;
# /*Background*/
# lv_opa_t bg_opa;
# /*Border*/
# lv_opa_t border_opa;
# /*Outline */
# lv_opa_t outline_opa;
# /*Shadow*/
# lv_opa_t shadow_opa;
# /*Background*/
# lv_color_t bg_color; /**< First element of a gradient is a color, so it maps well here*/
# lv_grad_dsc_t bg_grad;
# const lv_image_colorkey_t * bg_image_colorkey;
# /*Border*/
# lv_color_t border_color;
# int32_t border_width;
# lv_opa_t border_opa;
# lv_border_side_t border_side : 5;
# uint8_t border_post : 1; /*The border will be drawn later*/
@ -204,7 +211,6 @@ lv_draw_dsc_base = ct.structure(lv_draw_dsc_base, "lv_draw_dsc_base")
# lv_color_t outline_color;
# int32_t outline_width;
# int32_t outline_pad;
# lv_opa_t outline_opa;
# /*Shadow*/
# lv_color_t shadow_color;
@ -212,18 +218,12 @@ lv_draw_dsc_base = ct.structure(lv_draw_dsc_base, "lv_draw_dsc_base")
# int32_t shadow_offset_x;
# int32_t shadow_offset_y;
# int32_t shadow_spread;
# lv_opa_t shadow_opa;
# } lv_draw_rect_dsc_t;
lv_draw_rect_dsc = [ # valid LVGL93
lv_draw_rect_dsc = [ # valid LVGL94
[lv_draw_dsc_base, "base"],
[int32_t, "radius"],
#/*Background*/
[lv_opa, "bg_opa"],
[lv_color, "bg_color"],
[lv_grad_dsc, "bg_grad"],
#/*Background img*/
[ptr, "bg_img_src"],
[ptr, "bg_img_symbol_font"],
@ -232,10 +232,20 @@ lv_draw_rect_dsc = [ # valid LVGL93
[lv_opa, "bg_img_recolor_opa"],
[uint8_t, "bg_img_tiled"],
#/*Background*/
[lv_opa, "bg_opa"],
[lv_opa, "border_opa"],
[lv_opa, "outline_opa"],
[lv_opa, "shadow_opa"],
[ptr, "bg_image_colorkey"],
[lv_color, "bg_color"],
[lv_grad_dsc, "bg_grad"],
#/*Border*/
[lv_color, "border_color"],
[int32_t, "border_width"],
[lv_opa, "border_opa"],
[uint8_t_5, "border_side"],
[uint8_t_1, "border_post"],
@ -243,7 +253,6 @@ lv_draw_rect_dsc = [ # valid LVGL93
[lv_color, "outline_color"],
[int32_t, "outline_width"],
[int32_t, "outline_pad"],
[lv_opa, "outline_opa"],
#/*Shadow*/
[lv_color, "shadow_color"],
@ -251,7 +260,6 @@ lv_draw_rect_dsc = [ # valid LVGL93
[int32_t, "shadow_ofs_x"],
[int32_t, "shadow_ofs_y"],
[int32_t, "shadow_spread"],
[lv_opa, "shadow_opa"],
]
lv_draw_rect_dsc = ct.structure(lv_draw_rect_dsc, "lv_draw_rect_dsc")
@ -289,7 +297,7 @@ lv_draw_rect_dsc = ct.structure(lv_draw_rect_dsc, "lv_draw_rect_dsc")
# /**1: Do not bother with line ending (if it's not visible for any reason) */
# uint8_t raw_end : 1;
# } lv_draw_line_dsc_t;
lv_draw_line_dsc = [ # valid LVGL93
lv_draw_line_dsc = [ # valid LVGL94
[lv_draw_dsc_base, "base"],
[lv_point_precise, "p1"],
@ -324,12 +332,12 @@ lv_draw_line_dsc = ct.structure(lv_draw_line_dsc, "lv_draw_line_dsc")
# /**The center point of the arc. */
# lv_point_t center;
# /**The outer radius of the arc*/
# uint16_t radius;
# /**An image source to be used instead of `color`. `NULL` if unused*/
# const void * img_src;
# /**The outer radius of the arc*/
# uint16_t radius;
# /**Opacity of the arc in 0...255 range.
# * LV_OPA_TRANSP, LV_OPA_10, LV_OPA_20, .. LV_OPA_COVER can be used as well*/
# lv_opa_t opa;
@ -337,7 +345,7 @@ lv_draw_line_dsc = ct.structure(lv_draw_line_dsc, "lv_draw_line_dsc")
# /**1: Make the arc ends rounded*/
# uint8_t rounded : 1;
# } lv_draw_arc_dsc_t;
lv_draw_arc_dsc = [ # valid LVGL93
lv_draw_arc_dsc = [ # valid LVGL94
[lv_draw_dsc_base, "base"],
[lv_color, "color"],
@ -345,8 +353,8 @@ lv_draw_arc_dsc = [ # valid LVGL93
[lv_value_precise, "start_angle"],
[lv_value_precise, "end_angle"],
[lv_point, "center"],
[uint16_t, "radius"],
[ptr, "img_src"],
[uint16_t, "radius"],
[lv_opa, "opa"],
[uint8_t_1, "rounded"],
]
@ -363,7 +371,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 LVGL93
lv_image_header = [ # valid LVGL94
[uint8_t, "magic"],
[uint8_t, "cf"],
[uint16_t, "flags"],
@ -422,7 +430,7 @@ lv_image_header = ct.structure(lv_image_header, "lv_image_header")
# */
# lv_blend_mode_t blend_mode : 4;
# /**1: perform the transformation with anti-alaising */
# /**1: perform the transformation with anti-aliasing */
# uint16_t antialias : 1;
# /**If the image is smaller than the `image_area` field of `lv_draw_image_dsc_t`
@ -430,6 +438,8 @@ lv_image_header = ct.structure(lv_image_header, "lv_image_header")
# * `image_area` area*/
# uint16_t tile : 1;
# const lv_image_colorkey_t * colorkey;
# /**Used internally to store some information about the palette or the color of A8 images*/
# lv_draw_image_sup_t * sup;
@ -445,7 +455,7 @@ lv_image_header = ct.structure(lv_image_header, "lv_image_header")
# * The mask is always center aligned. */
# const lv_image_dsc_t * bitmap_mask_src;
# };
lv_draw_image_dsc = [ # valid LVGL93
lv_draw_image_dsc = [ # valid LVGL94
[lv_draw_dsc_base, "base"],
[ptr, "src"],
@ -466,6 +476,7 @@ lv_draw_image_dsc = [ # valid LVGL93
[uint8_t_4, "blend_mode"],
[uint8_t_1, "antialias"],
[uint8_t_1, "tile"],
[ptr, "lv_image_colorkey_t"],
[ptr, "sup"],
[lv_area, "image_area"],
@ -519,16 +530,19 @@ lv_draw_image_dsc = ct.structure(lv_draw_image_dsc, "lv_draw_image_dsc")
# /**The number of characters to render. 0: means render until reaching the `\0` termination.*/
# uint32_t text_length;
# /**Opacity of the text in 0...255 range.
# * LV_OPA_TRANSP, LV_OPA_10, LV_OPA_20, .. LV_OPA_COVER can be used as well*/
# lv_opa_t opa;
# /**The alignment of the text `LV_TEXT_ALIGN_LEFT/RIGHT/CENTER`*/
# lv_text_align_t align;
# /**The base direction. Used when type setting Right-to-left (e.g. Arabic) texts*/
# lv_base_dir_t bidi_dir;
# /**Opacity of the text in 0...255 range.
# * LV_OPA_TRANSP, LV_OPA_10, LV_OPA_20, .. LV_OPA_COVER can be used as well*/
# lv_opa_t opa;
# /**Letter outline stroke opacity */
# lv_opa_t outline_stroke_opa;
# /**Text decoration, e.g. underline*/
# lv_text_decor_t decor : 3;
@ -550,12 +564,11 @@ lv_draw_image_dsc = ct.structure(lv_draw_image_dsc, "lv_draw_image_dsc")
# lv_draw_label_hint_t * hint;
# /* Properties of the letter outlines */
# lv_opa_t outline_stroke_opa;
# lv_color_t outline_stroke_color;
# int32_t outline_stroke_width;
# } lv_draw_label_dsc_t;
lv_draw_label_dsc = [ # valid LVGL93
lv_draw_label_dsc = [ # valid LVGL94
[lv_draw_dsc_base, "base"],
[ptr, "text"],
[lv_point, "text_size"],
@ -571,9 +584,10 @@ lv_draw_label_dsc = [ # valid LVGL93
[lv_color, "sel_color"],
[lv_color, "sel_bg_color"],
[uint32_t, "text_length"],
[lv_opa, "opa"],
[lv_text_align, "align"],
[lv_base_dir, "bidi_dir"],
[lv_opa, "opa"],
[lv_opa, "outline_stroke_opa"],
[lv_text_flag, "flag"],
[uint8_t_3, "decor"],
[uint8_t_5, "flag"],
@ -582,7 +596,6 @@ lv_draw_label_dsc = [ # valid LVGL93
[uint8_t_1, "text_static"],
[uint8_t_1, "has_bided"],
[ptr, "hint"],
[lv_opa, "outline_stroke_opa"],
[lv_color, "outline_stroke_color"],
[int32_t, "outline_stroke_width"],
]
@ -599,7 +612,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 = [ # valid LVGL93
lv_chart_series = [ # valid LVGL94
[ptr, "x_points"],
[ptr, "y_points"],
[lv_color, "color"],
@ -620,7 +633,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 = [ # valid LVGL93
lv_chart_cursor = [ # valid LVGL94
[lv_point, "pos"],
[int32_t, "point_id"],
[lv_color, "color"],
@ -671,7 +684,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 LVGL93
lv_obj_class = [ # valid LVGL94
[lv_obj_class_ptr, "base_class"],
[constructor_cb, "constructor_cb"],
[destructor_cb, "destructor_cb"],
@ -697,8 +710,9 @@ lv_obj_class = ct.structure(lv_obj_class, "lv_obj_class")
# uint8_t deleted : 1;
# uint8_t stop_processing : 1;
# uint8_t stop_bubbling : 1;
# uint8_t stop_trickling : 1;
# };
lv_event = [ # valid LVGL93
lv_event = [ # valid LVGL94
[lv_obj_ptr, "current_target"],
[lv_obj_ptr, "original_target"],
[lv_event_code, "code"],
@ -708,6 +722,7 @@ lv_event = [ # valid LVGL93
[uint8_t_1, "deleted"],
[uint8_t_1, "stop_processing"],
[uint8_t_1, "stop_bubbling"],
[uint8_t_1, "stop_trickling"],
]
lv_event = ct.structure(lv_event, "lv_event")
@ -721,7 +736,7 @@ lv_event = ct.structure(lv_event, "lv_event")
# const void * reserved; /**< A reserved field to make it has same size as lv_draw_buf_t*/
# const void * reserved_2; /**< A reserved field to make it has same size as lv_draw_buf_t*/
# } lv_image_dsc_t;
lv_image_dsc = [ # valid LVGL93
lv_image_dsc = [ # valid LVGL94
[lv_image_header, "header"],
[uint32_t, "data_size"],
[ptr, "data"],
@ -740,7 +755,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 LVGL93
lv_style_transition_dsc = [ # valid LVGL94
[ptr, "props"],
[ptr, "user_data"],
[ptr, "path_xcb"],
@ -749,17 +764,53 @@ lv_style_transition_dsc = [ # valid LVGL93
]
lv_style_transition_dsc = ct.structure(lv_style_transition_dsc, "lv_style_transition_dsc")
#######################################################################
# lv_anim_timeline
# /*Data of anim_timeline*/
# struct _lv_anim_timeline_t {
# struct _lv_anim_timeline_dsc_t * anim_dsc;
# uint32_t anim_dsc_cnt;
# uint32_t act_time;
# bool reverse;
# uint32_t delay;
# uint32_t repeat_count;
# uint32_t repeat_delay;
# void * user_data;
# };
lv_anim_timeline_dsc = [ # valid LVGL94
[ptr, "anim_dsc"],
[uint32_t, "anim_dsc_cnt"],
[uint32_t, "act_time"],
[bool, "reverse"],
[uint32_t, "delay"],
[uint32_t, "repeat_count"],
[uint32_t, "repeat_delay"],
[ptr, "user_data"],
]
lv_anim_timeline_dsc = ct.structure(lv_anim_timeline_dsc, "lv_anim_timeline_dsc")
# struct _lv_layer_t {
# /** Target draw buffer of the layer */
# lv_draw_buf_t * draw_buf;
# /** Linked list of draw tasks */
# lv_draw_task_t * draw_task_head;
# /** Parent layer */
# lv_layer_t * parent;
# /** Next layer */
# lv_layer_t * next;
# /** User data */
# void * user_data;
# /** 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;
# /** The physical clipping area relative to the display */
# lv_area_t phy_clip_area;
# /**
# * NEVER USE IT DRAW UNITS. USED INTERNALLY DURING DRAW TASK CREATION.
@ -771,47 +822,43 @@ lv_style_transition_dsc = ct.structure(lv_style_transition_dsc, "lv_style_transi
# */
# 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
# /** Opacity of the layer */
# lv_opa_t opa;
# /*Recolor of the layer*/
# lv_color32_t recolor;
# /** Partial y offset */
# int32_t partial_y_offset;
# /** Linked list of draw tasks */
# lv_draw_task_t * draw_task_head;
# /** Recolor of the layer */
# lv_color32_t recolor;
# lv_layer_t * parent;
# lv_layer_t * next;
# /** The color format of the layer. LV_COLOR_FORMAT_... */
# lv_color_format_t color_format;
# /** Flag indicating all tasks are added */
# bool all_tasks_added;
# void * user_data;
# /** Opacity of the layer */
# lv_opa_t opa;
# };
lv_layer = [ # valid LVGL93
lv_layer = [ # valid LVGL94
[ptr, "draw_buf"],
[lv_area, "buf_area"],
[uint32_t, "color_format"],
[lv_area, "_clip_area"],
[lv_area, "phy_clip_area"],
[lv_opa, "opa"],
[lv_color32, "recolor"],
[int32_t, "partial_y_offset"],
[ptr, "draw_task_head"],
[ptr, "parent"],
[ptr, "next"],
[bool, "all_tasks_added"],
[ptr, "user_data"],
[lv_area, "buf_area"],
[lv_area, "phy_clip_area"],
[lv_area, "_clip_area"],
[int32_t, "partial_y_offset"],
[lv_color32, "recolor"],
[uint32_t, "color_format"],
[bool, "all_tasks_added"],
[lv_opa, "opa"],
]
lv_layer = ct.structure(lv_layer, "lv_layer")
@ -822,7 +869,7 @@ lv_layer = ct.structure(lv_layer, "lv_layer")
# lv_color_filter_cb_t filter_cb;
# void * user_data;
# };
lv_color_filter_dsc = [ # valid LVGL93
lv_color_filter_dsc = [ # valid LVGL94
[ptr, "filter_cb"],
[ptr, "user_data"],
]
@ -837,16 +884,16 @@ lv_color_filter_dsc = ct.structure(lv_color_filter_dsc, "lv_color_filter_dsc")
# 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;
# volatile int paused;
# uint32_t auto_delete : 1;
# };
lv_timer_ntv = [ # valid LVGL93
lv_timer_ntv = [ # valid LVGL94
[uint32_t, "period"],
[uint32_t, "last_run"],
[ptr, "timer_cb"],
[ptr, "user_data"],
[int32_t, "repeat_count"],
[uint8_t_1, "paused"],
[int32_t, "paused"],
[uint8_t_1, "auto_delete"],
]
lv_timer_ntv = ct.structure(lv_timer_ntv, "lv_timer_ntv")
@ -859,7 +906,7 @@ lv_timer_ntv = ct.structure(lv_timer_ntv, "lv_timer_ntv")
# void * user_data;
# uint32_t filter;
# };
lv_event_dsc = [ # valid LVGL93
lv_event_dsc = [ # valid LVGL94
[ptr, "cb"],
[ptr, "user_data"],
[uint32_t, "filter"],
@ -869,7 +916,7 @@ lv_event_dsc = ct.structure(lv_event_dsc, "lv_event_dsc")
#######################################################################
# Special structure used to calibrate resistive touchscreens
#######################################################################
lv_ts_calibration = [ # valid LVGL93
lv_ts_calibration = [ # valid LVGL94
[lv_coord_t, "raw_x"],
[lv_coord_t, "raw_y"],
[lv_coord_t, "x"],
@ -887,7 +934,7 @@ lv_ts_calibration = ct.structure(lv_ts_calibration, "lv_ts_calibration")
# lv_area_t middle;
# lv_area_t trailing;
# } lv_span_coords_t;
lv_span_coords = [
lv_span_coords = [ # valid LVGL94
[lv_area, "heading"],
[lv_area, "middle"],
[lv_area, "trailing"],
@ -906,7 +953,7 @@ lv_span_coords = ct.structure(lv_span_coords, "lv_span_coords")
# uint32_t style; /**< Font style, see `lv_freetype_font_style_t`*/
# lv_font_kerning_t kerning; /**< Font kerning, see `lv_font_kerning_t`*/
# };
lv_font_info = [ # valid LVGL92
lv_font_info = [ # valid LVGL94
[ptr, "name"],
[ptr, "class_p"],
[uint32_t, "size"],
@ -936,7 +983,7 @@ lv_font_info = ct.structure(lv_font_info, "lv_font_info")
# lv_opa_t opa;
# lv_text_decor_t decor : 3;
# lv_blend_mode_t blend_mode : 3;
# lv_blend_mode_t blend_mode : 4;
# /* Properties of the letter outlines */
# lv_opa_t outline_stroke_opa;
@ -957,7 +1004,7 @@ lv_draw_letter_dsc = [ # valid LVGL93
[lv_point, "pivot"],
[lv_opa, "opa"],
[uint8_t_3, "decor"],
[uint8_t_3, "blend_mode"],
[uint8_t_4, "blend_mode"],
[lv_opa, "outline_stroke_opa"],
[int32_t, "outline_stroke_width"],
[lv_color, "outline_stroke_color"],

View File

@ -279,6 +279,7 @@ class type_mapper_class:
"lv_anim_deleted_cb_t",
"lv_timer_handler_resume_cb_t",
"lv_theme_apply_cb_t",
"lv_screen_create_cb_t", # new in 9.4.0
"lv_color32_t *",
"lv_color16_t *",
"lv_color_filter_cb_t",
@ -465,11 +466,16 @@ class type_mapper_class:
"void * []": "c", # treat as a simple pointer, decoding needs to be done at Berry level
"constchar * *": "c",
# new in 9.3.0
"lv_text_cmd_state_t *": "c",
# "lv_text_cmd_state_t *": "c", # not used anymore in 9.4.0
"lv_font_info_t *": "lv_font_info",
"lv_switch_orientation_t": "i",
"lv_slider_orientation_t": "i",
"lv_draw_letter_dsc_t *": "lv_draw_letter_dsc",
# new in 9.4.0
"lv_image_colorkey_t *": "c",
"lv_arclabel_dir_t": "i",
"lv_arclabel_text_align_t": "i",
"lv_anim_timeline_t *": "lv_anim_timeline_dsc",
# callbacks
"lv_group_focus_cb_t": "lv_group_focus_cb",

View File

@ -57,6 +57,9 @@ class LVGLPreprocessor:
r"^lv_obj_get_property",
r"^lv_win_",
r"^lv_obj.*name", # we don't enable #if LV_USE_OBJ_NAME
r".*_bind_.*", # 9.4.0 remove observer methods
r".*_get_.*_by_name", # 9.4.0
r".*_translation_", # 9.4.0
]
# Enum exclusion patterns
@ -65,6 +68,7 @@ class LVGLPreprocessor:
"LV_TASK_PRIO_", "LV_THEME_", "LV_LRU_", "LV_VECTOR_",
"LV_KEYBOARD_MODE_TEXT_ARABIC", "LV_DRAW_TASK_TYPE_3D",
"LV_DRAW_TASK_TYPE_VECTOR",
"LV_EVENT_TRANSLATION_"
}
def comment_remover(self, text: str) -> str:

View File

@ -1,5 +1,5 @@
# LVGL integer constants
# LVGL version 9.3.0
# LVGL version 9.4.0
lv.ALIGN_BOTTOM_LEFT = 4
lv.ALIGN_BOTTOM_MID = 5
@ -28,6 +28,12 @@ lv.ANIM_OFF = 0
lv.ANIM_ON = 1
lv.ANIM_PLAYTIME_INFINITE = -1
lv.ANIM_REPEAT_INFINITE = -1
lv.ARCLABEL_DIR_CLOCKWISE = 0
lv.ARCLABEL_DIR_COUNTER_CLOCKWISE = 1
lv.ARCLABEL_TEXT_ALIGN_CENTER = 2
lv.ARCLABEL_TEXT_ALIGN_DEFAULT = 0
lv.ARCLABEL_TEXT_ALIGN_LEADING = 1
lv.ARCLABEL_TEXT_ALIGN_TRAILING = 3
lv.ARC_MODE_NORMAL = 0
lv.ARC_MODE_REVERSE = 2
lv.ARC_MODE_SYMMETRICAL = 1
@ -102,7 +108,8 @@ lv.CHART_POINT_NONE = 2147483647
lv.CHART_TYPE_BAR = 2
lv.CHART_TYPE_LINE = 1
lv.CHART_TYPE_NONE = 0
lv.CHART_TYPE_SCATTER = 3
lv.CHART_TYPE_SCATTER = 4
lv.CHART_TYPE_STACKED = 3
lv.CHART_UPDATE_MODE_CIRCULAR = 1
lv.CHART_UPDATE_MODE_SHIFT = 0
lv.COLOR_AQUA = 65535
@ -220,10 +227,11 @@ lv.DISP_ROTATION_0 = 0
lv.DISP_ROTATION_180 = 2
lv.DISP_ROTATION_270 = 3
lv.DISP_ROTATION_90 = 1
lv.DRAW_TASK_STATE_IN_PROGRESS = 2
lv.DRAW_TASK_STATE_QUEUED = 1
lv.DRAW_TASK_STATE_READY = 3
lv.DRAW_TASK_STATE_WAITING = 0
lv.DRAW_TASK_STATE_BLOCKED = 0
lv.DRAW_TASK_STATE_FINISHED = 4
lv.DRAW_TASK_STATE_IN_PROGRESS = 3
lv.DRAW_TASK_STATE_QUEUED = 2
lv.DRAW_TASK_STATE_WAITING = 1
lv.DRAW_TASK_TYPE_ARC = 9
lv.DRAW_TASK_TYPE_BORDER = 2
lv.DRAW_TASK_TYPE_BOX_SHADOW = 3
@ -371,7 +379,6 @@ lv.IMAGEBUTTON_STATE_DISABLED = 2
lv.IMAGEBUTTON_STATE_NUM = 6
lv.IMAGEBUTTON_STATE_PRESSED = 1
lv.IMAGEBUTTON_STATE_RELEASED = 0
lv.IMAGE_ALIGN_AUTO_TRANSFORM = 10
lv.IMAGE_ALIGN_BOTTOM_LEFT = 4
lv.IMAGE_ALIGN_BOTTOM_MID = 5
lv.IMAGE_ALIGN_BOTTOM_RIGHT = 6
@ -473,7 +480,8 @@ lv.OBJ_FLAG_CHECKABLE = 8
lv.OBJ_FLAG_CLICKABLE = 2
lv.OBJ_FLAG_CLICK_FOCUSABLE = 4
lv.OBJ_FLAG_EVENT_BUBBLE = 16384
lv.OBJ_FLAG_FLEX_IN_NEW_TRACK = 2097152
lv.OBJ_FLAG_EVENT_TRICKLE = 2097152
lv.OBJ_FLAG_FLEX_IN_NEW_TRACK = 8388608
lv.OBJ_FLAG_FLOATING = 262144
lv.OBJ_FLAG_GESTURE_BUBBLE = 32768
lv.OBJ_FLAG_HIDDEN = 1
@ -493,6 +501,7 @@ lv.OBJ_FLAG_SCROLL_ON_FOCUS = 1024
lv.OBJ_FLAG_SCROLL_WITH_ARROW = 2048
lv.OBJ_FLAG_SEND_DRAW_TASK_EVENTS = 524288
lv.OBJ_FLAG_SNAPPABLE = 4096
lv.OBJ_FLAG_STATE_TRICKLE = 4194304
lv.OBJ_FLAG_USER_1 = 134217728
lv.OBJ_FLAG_USER_2 = 268435456
lv.OBJ_FLAG_USER_3 = 536870912
@ -573,6 +582,22 @@ lv.SCALE_MODE_VERTICAL_RIGHT = 4
lv.SCALE_NONE = 256
lv.SCALE_ROTATION_ANGLE_MASK = 524287
lv.SCALE_TOTAL_TICK_COUNT_DEFAULT = 11
lv.SCREEN_LOAD_ANIM_FADE_IN = 9
lv.SCREEN_LOAD_ANIM_FADE_ON = 9
lv.SCREEN_LOAD_ANIM_FADE_OUT = 10
lv.SCREEN_LOAD_ANIM_MOVE_BOTTOM = 8
lv.SCREEN_LOAD_ANIM_MOVE_LEFT = 5
lv.SCREEN_LOAD_ANIM_MOVE_RIGHT = 6
lv.SCREEN_LOAD_ANIM_MOVE_TOP = 7
lv.SCREEN_LOAD_ANIM_NONE = 0
lv.SCREEN_LOAD_ANIM_OUT_BOTTOM = 14
lv.SCREEN_LOAD_ANIM_OUT_LEFT = 11
lv.SCREEN_LOAD_ANIM_OUT_RIGHT = 12
lv.SCREEN_LOAD_ANIM_OUT_TOP = 13
lv.SCREEN_LOAD_ANIM_OVER_BOTTOM = 4
lv.SCREEN_LOAD_ANIM_OVER_LEFT = 1
lv.SCREEN_LOAD_ANIM_OVER_RIGHT = 2
lv.SCREEN_LOAD_ANIM_OVER_TOP = 3
lv.SCROLLBAR_MODE_ACTIVE = 2
lv.SCROLLBAR_MODE_AUTO = 3
lv.SCROLLBAR_MODE_OFF = 0
@ -581,22 +606,6 @@ lv.SCROLL_SNAP_CENTER = 3
lv.SCROLL_SNAP_END = 2
lv.SCROLL_SNAP_NONE = 0
lv.SCROLL_SNAP_START = 1
lv.SCR_LOAD_ANIM_FADE_IN = 9
lv.SCR_LOAD_ANIM_FADE_ON = 9
lv.SCR_LOAD_ANIM_FADE_OUT = 10
lv.SCR_LOAD_ANIM_MOVE_BOTTOM = 8
lv.SCR_LOAD_ANIM_MOVE_LEFT = 5
lv.SCR_LOAD_ANIM_MOVE_RIGHT = 6
lv.SCR_LOAD_ANIM_MOVE_TOP = 7
lv.SCR_LOAD_ANIM_NONE = 0
lv.SCR_LOAD_ANIM_OUT_BOTTOM = 14
lv.SCR_LOAD_ANIM_OUT_LEFT = 11
lv.SCR_LOAD_ANIM_OUT_RIGHT = 12
lv.SCR_LOAD_ANIM_OUT_TOP = 13
lv.SCR_LOAD_ANIM_OVER_BOTTOM = 4
lv.SCR_LOAD_ANIM_OVER_LEFT = 1
lv.SCR_LOAD_ANIM_OVER_RIGHT = 2
lv.SCR_LOAD_ANIM_OVER_TOP = 3
lv.SIZE_CONTENT = 1073741823
lv.SLIDER_MODE_NORMAL = 0
lv.SLIDER_MODE_RANGE = 2
@ -676,13 +685,14 @@ lv.STYLE_GRID_COLUMN_DSC_ARRAY = 130
lv.STYLE_GRID_ROW_ALIGN = 128
lv.STYLE_GRID_ROW_DSC_ARRAY = 129
lv.STYLE_HEIGHT = 2
lv.STYLE_IMAGE_COLORKEY = 137
lv.STYLE_IMAGE_OPA = 68
lv.STYLE_IMAGE_RECOLOR = 69
lv.STYLE_IMAGE_RECOLOR_OPA = 70
lv.STYLE_IMG_OPA = 68
lv.STYLE_IMG_RECOLOR = 69
lv.STYLE_IMG_RECOLOR_OPA = 70
lv.STYLE_LAST_BUILT_IN_PROP = 137
lv.STYLE_LAST_BUILT_IN_PROP = 138
lv.STYLE_LAYOUT = 22
lv.STYLE_LENGTH = 3
lv.STYLE_LINE_COLOR = 76
@ -699,7 +709,7 @@ lv.STYLE_MAX_HEIGHT = 7
lv.STYLE_MAX_WIDTH = 5
lv.STYLE_MIN_HEIGHT = 6
lv.STYLE_MIN_WIDTH = 4
lv.STYLE_NUM_BUILT_IN_PROPS = 138
lv.STYLE_NUM_BUILT_IN_PROPS = 139
lv.STYLE_OPA = 98
lv.STYLE_OPA_LAYERED = 99
lv.STYLE_OUTLINE_COLOR = 57
@ -778,9 +788,6 @@ lv.TEXT_ALIGN_AUTO = 0
lv.TEXT_ALIGN_CENTER = 2
lv.TEXT_ALIGN_LEFT = 1
lv.TEXT_ALIGN_RIGHT = 3
lv.TEXT_CMD_STATE_IN = 2
lv.TEXT_CMD_STATE_PAR = 1
lv.TEXT_CMD_STATE_WAIT = 0
lv.TEXT_DECOR_NONE = 0
lv.TEXT_DECOR_STRIKETHROUGH = 2
lv.TEXT_DECOR_UNDERLINE = 1

View File

@ -2698,7 +2698,7 @@ end
# Encapsulates a `lv_screen` which is `lv.obj(0)` object
#################################################################################
#
# ex of transition: lv.scr_load_anim(scr, lv.SCR_LOAD_ANIM_MOVE_RIGHT, 500, 0, false)
# ex of transition: lv.scr_load_anim(scr, lv.SCREEN_LOAD_ANIM_MOVE_RIGHT, 500, 0, false)
#@ solidify:lvh_page,weak
class lvh_page
var _obj_id # (map) of `lvh_obj` objects by id numbers
@ -2867,11 +2867,11 @@ class lvh_page
# show this page, with animation
#====================================================================
static show_anim = {
1: lv.SCR_LOAD_ANIM_MOVE_LEFT,
-1: lv.SCR_LOAD_ANIM_MOVE_RIGHT,
-2: lv.SCR_LOAD_ANIM_MOVE_TOP,
2: lv.SCR_LOAD_ANIM_MOVE_BOTTOM,
0: lv.SCR_LOAD_ANIM_NONE,
1: lv.SCREEN_LOAD_ANIM_MOVE_LEFT,
-1: lv.SCREEN_LOAD_ANIM_MOVE_RIGHT,
-2: lv.SCREEN_LOAD_ANIM_MOVE_TOP,
2: lv.SCREEN_LOAD_ANIM_MOVE_BOTTOM,
0: lv.SCREEN_LOAD_ANIM_NONE,
}
def show(anim, duration)
# ignore if the page does not contain a screen, like when id==0
@ -2901,7 +2901,7 @@ class lvh_page
if (anim == 0)
lv.screen_load(self._lv_scr)
else # animation
var anim_lvgl = self.show_anim.find(anim, lv.SCR_LOAD_ANIM_NONE)
var anim_lvgl = self.show_anim.find(anim, lv.SCREEN_LOAD_ANIM_NONE)
# load new screen with animation, no delay, 500ms transition time, no auto-delete
lv.screen_load_anim(self._lv_scr, anim_lvgl, duration, 0, false)
end

View File

@ -12000,7 +12000,7 @@ static const bvalue be_ktab_class_lvh_page[45] = {
/* K39 */ be_nested_str_weak(_X7B_X22hasp_X22_X3A_X7B_X22p_X25i_X22_X3A_X22in_X22_X7D_X7D),
/* K40 */ be_nested_str_weak(screen_load),
/* K41 */ be_nested_str_weak(show_anim),
/* K42 */ be_nested_str_weak(SCR_LOAD_ANIM_NONE),
/* K42 */ be_nested_str_weak(SCREEN_LOAD_ANIM_NONE),
/* K43 */ be_nested_str_weak(screen_load_anim),
/* K44 */ be_nested_str_weak(_remove_page),
};

View File

@ -1,8 +1,5 @@
<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.md">中文</a> | <a href="./docs/README_pt_BR.md">Português do Brasil</a> | <a href="./docs/README_jp.md">日本語</a>
<b>English</b> | <a href="./docs/README_zh.md">中文</a> | <a href="./docs/README_pt_BR.md">Português do Brasil</a> | <a href="./docs/README_jp.md">日本語</a> | <a href="./docs/README_he.md">עברית</a>
</p>
<br>
@ -11,87 +8,85 @@
  <img src="https://lvgl.io/github-assets/logo-colored.png" width=300px>
</p>
  <h1 align="center">Light and Versatile Graphics Library</h1>
  <br>
<h1 align="center">Light and Versatile Graphics Library</h1>
<br/>
<div align="center">
<img src="https://lvgl.io/github-assets/smartwatch-demo.gif">
&nbsp;
  <img border="1px" src="https://lvgl.io/github-assets/widgets-demo.gif">
</div>
<br>
<br/>
<p align="center">
<a href="https://lvgl.io" title="Homepage of LVGL">Website</a> |
<a href="https://pro.lvgl.io" title="LVGL Pro XML based UI Editor">LVGL Pro Editor</a> |
<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>
</p>
<br>
## :ledger: Overview
<br/>
**Mature and Well-known**<br>
LVGL is the most popular free and open source embedded graphics library to create beautiful UIs for any MCU, MPU and display type. It's supported by industry leading vendors and projects like  Arm, STM32, NXP, Espressif, Nuvoton, Arduino, RT-Thread, Zephyr, NuttX, Adafruit and many more.
### Table of Contents
<p>
<a href="#ledger-overview">Overview</a> <br/>
<a href="#-features">Features</a> <br/>
<a href="#%EF%B8%8F-platform-support">Platform Support</a> <br/>
<a href="#-lvgl-pro-editor">LVGL Pro Editor</a> <br/>
<a href="#-commercial-services">Commercial Services</a> <br/>
<a href="#%E2%80%8D-integrating-lvgl">Integrating LVGL</a> <br/>
<a href="#-examples">Examples</a> <br/>
<a href="#-contributing">Contributing</a>
</p>
**Feature Rich**<br>
It has all the features to create modern and beautiful GUIs: 30+ built-in widgets, a powerful style system, web inspired layout managers, and a typography system supporting many languages. To integrate LVGL into your platform, all you need is at least 32kB RAM and 128 kB Flash, a C compiler, a frame buffer, and at least an 1/10 screen sized buffer for rendering.
<br/>
**Services**<br>
Our team is ready to help you with graphics design, UI implementation and consulting services. Contact us if you need some support during the development of your next GUI project.
## 📒 Overview
## :rocket: Features
**LVGL** is a free and open-source UI library that enables you to create graphical user interfaces
for any MCUs and MPUs from any vendor on any platform.
**Requirements**: LVGL has no external dependencies, which makes it easy to compile for any modern target,
from small MCUs to multi-core Linux-based MPUs with 3D support. For a simple UI, you need only ~100kB RAM,
~200300kB flash, and a buffer size of 1/10 of the screen for rendering.
**To get started**, pick a ready-to-use VSCode, Eclipse, or any other project and try out LVGL
on your PC. The LVGL UI code is fully platform-independent, so you can use the same UI code
on embedded targets too.
**LVGL Pro** is a complete toolkit to help you build, test, share, and ship UIs faster.
It comes with an XML Editor where you can quickly create and test reusable components,
export C code, or load the XMLs at runtime. Learn more here.
## 💡 Features
**Free and Portable**
- A fully portable C (C++ compatible) library with no external dependencies.
- Can be compiled to any MCU or MPU, with any (RT)OS.
- Supports monochrome, ePaper, OLED or TFT displays, or even monitors. [Displays](https://docs.lvgl.io/master/details/main-modules/display/index.html)
- Can be compiled for any MCU or MPU, with any (RT)OS. Make, CMake, and simple globbing are all supported.
- Supports monochrome, ePaper, OLED, or TFT displays, or even monitors. [Displays](https://docs.lvgl.io/master/details/main-modules/display/index.html)
- Distributed under the MIT license, so you can easily use it in commercial projects too.
- Needs only 32kB RAM and 128 kB Flash, a frame buffer, and at least an 1/10 screen sized buffer for rendering.
- OS, External memory and GPU are supported but not required.
- Needs only 32kB RAM and 128kB Flash, a frame buffer, and at least a 1/10 screen-sized buffer for rendering.
- OS, external memory, and GPU are supported but not required.
**Widgets, Styles, Layouts and more**
- 30+ built-in [Widgets](https://docs.lvgl.io/master/details/widgets/index.html):  Button, Label, Slider, Chart, Keyboard, Meter, Arc, Table and many more.
- Flexible [Style system](https://docs.lvgl.io/master/details/common-widget-features/styles/style.html) with  ~100 style properties to customize any part of the widgets in any state.
- [Flexbox](https://docs.lvgl.io/master/details/common-widget-features/layouts/flex.html) and [Grid](https://docs.lvgl.io/master/details/common-widget-features/layouts/grid.html)-like layouts engines to automatically size and position the widgets in a responsive way.
- Texts are rendered with UTF-8 encoding supporting CJK, Thai, Hindi, Arabic, Persian writing systems.
- 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  
**Widgets, Styles, Layouts, and More**
- 30+ built-in [Widgets](https://docs.lvgl.io/master/details/widgets/index.html): Button, Label, Slider, Chart, Keyboard, Meter, Arc, Table, and many more.
- Flexible [Style system](https://docs.lvgl.io/master/details/common-widget-features/styles/index.html) with ~100 style properties to customize any part of the widgets in any state.
- [Flexbox](https://docs.lvgl.io/master/details/common-widget-features/layouts/flex.html) and [Grid](https://docs.lvgl.io/master/details/common-widget-features/layouts/grid.html)-like layout engines to automatically size and position the widgets responsively.
- Text is rendered with UTF-8 encoding, supporting CJK, Thai, Hindi, Arabic, and Persian writing systems.
- [Data bindings](https://docs.lvgl.io/master/details/auxiliary-modules/observer/index.html) to easily connect the UI with the application.
- Rendering engine supports animations, anti-aliasing, opacity, smooth scrolling, shadows, image transformation, etc.
- [Powerful 3D rendering engine](https://docs.lvgl.io/master/details/libs/gltf.html) to show [glTF models](https://sketchfab.com/) with OpenGL.
- Supports Mouse, Touchpad, Keypad, Keyboard, External buttons, Encoder [Input devices](https://docs.lvgl.io/master/details/main-modules/indev.html).
- [Multiple display](https://docs.lvgl.io/master/details/main-modules/display/overview.html#how-many-displays-can-lvgl-use) support.
**Binding and Build Support**
- [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/details/integration/building/cmake.html) is included out of the box.
- [Develop on PC](https://docs.lvgl.io/master/details/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).
## 📦️ Platform Support
**Docs, Tools, and Services**
- Detailed [Documentation](https://docs.lvgl.io/) with [100+ simple examples](https://docs.lvgl.io/master/examples.html)
- [Services](https://lvgl.io/services) such as User interface design, Implementation and Consulting to make UI development simpler and faster.
LVGL has no external dependencies, so it can be easily compiled for any devices and it's also available in many package managers and RTOSes:
## :heart: Sponsor
If LVGL saved you a lot of time and money or you just had fun using it, consider [Supporting its Development](https://github.com/sponsors/lvgl).
**How do we spend the donations?**<br>
Our goal is to provide financial compensation for people who do the most for LVGL. It means not only the maintainers but anyone who implements a great feature should get a payment from the accumulated money. We use the donations to cover our operational costs like servers and related services.
**How to donate?**<br>
We use [GitHub Sponsors](https://github.com/sponsors/lvgl) where you can easily send one time or recurring donations. You can also see all of our expenses in a transparent way.
**How to get paid for your contribution?**<br>
If someone implements or fixes an issue labeled as [Sponsored](https://github.com/lvgl/lvgl/labels/Sponsored) he or she will get a payment for that work. We estimate the required time, complexity and importance of the issue and set a price accordingly. To jump in just comment on a [Sponsored](https://github.com/lvgl/lvgl/labels/Sponsored) issue saying "Hi, I'd like to deal with it. This is how I'm planning to fix/implement it...". A work is considered ready when it's approved and merged by a maintainer. After that you can submit and expense at [opencollective.com](https://opencollective.com/lvgl) and you will receive the payment in a few days.
**Organizations supporting LVGL**<br>
[![Sponsors of LVGL](https://opencollective.com/lvgl/organizations.svg?width=600)](https://opencollective.com/lvgl)
**Individuals supporting LVGL**<br>
[![Backers of LVGL](https://contrib.rocks/image?repo=lvgl/lvgl&max=48)](https://opencollective.com/lvgl)
## :package: Packages
LVGL is available as:
- [Arduino library](https://docs.lvgl.io/master/details/integration/framework/arduino.html)
- [PlatformIO package](https://registry.platformio.org/libraries/lvgl/lvgl)
- [Zephyr library](https://docs.lvgl.io/master/details/integration/os/zephyr.html)
@ -102,367 +97,287 @@ LVGL is available as:
- CMSIS-Pack
- [RIOT OS package](https://doc.riot-os.org/group__pkg__lvgl.html#details)
## 🚀 LVGL Pro Editor
## :robot: Examples
LVGL Pro is a complete toolkit to build, test, share, and ship embedded UIs efficiently.
See some examples of creating widgets, using layouts and applying styles. You will find C and MicroPython code, and links to try out or edit the examples in an online MicroPython editor.
It consists of four tightly related tools:
For more examples check out the [Examples](https://github.com/lvgl/lvgl/tree/master/examples) folder.
1. **XML Editor**: The heart of LVGL Pro. A desktop app to build components and screens in XML, manage data bindings, translations, animations, tests, and more. Learn more about the [XML Format](https://docs.lvgl.io/master/details/xml/xml/index.html) and the [Editor](https://docs.lvgl.io/master/details/xml/editor/index.html).
2. **Online Viewer**: Run the Editor in your browser, open GitHub projects, and share easily without setting up a developer environment. Visit [https://viewer.lvgl.io](https://viewer.lvgl.io).
3. **CLI Tool**: Generate C code and run tests in CI/CD. See the details [here](https://docs.lvgl.io/master/details/xml/tools/cli.html).
4. **Figma Plugin**: Sync and extract styles directly from Figma. See how it works [here](https://docs.lvgl.io/master/details/xml/tools/figma.html).
Together, these tools let developers build UIs efficiently, test them reliably, and collaborate with team members and customers.
### Hello world label
Learn more at https://pro.lvgl.io
![Simple Hello world label example in LVGL](https://github.com/kisvegabor/test/raw/master/readme_example_1.png)
## 🤝 Commercial Services
<details>
<summary>C code</summary>
LVGL LLC provides several types of commercial services to help you with UI development. With 15+ years of experience in the user interface and graphics industry, we can help bring your UI to the next level.
- **Graphics design**: Our in-house graphic designers are experts in creating beautiful modern designs that fit your product and the capabilities of your hardware.
- **UI implementation**: We can implement your UI based on the design you or we have created. You can be sure that we will make the most of your hardware and LVGL. If a feature or widget is missing from LVGL, don't worry, we will implement it for you.
- **Consulting and Support**: We also offer consulting to help you avoid costly and time-consuming mistakes during UI development.
- **Board certification**: For companies offering development boards or production-ready kits, we provide board certification to show how the board can run LVGL.
Check out our [Demos](https://lvgl.io/demos) as references. For more information, take a look at the [Services page](https://lvgl.io/services).
[Contact us](https://lvgl.io/#contact) and tell us how we can help.
## 🧑‍💻 Integrating LVGL
Integrating LVGL is very simple. Just drop it into any project and compile it as you would compile other files.
To configure LVGL, copy `lv_conf_template.h` as `lv_conf.h`, enable the first `#if 0`, and adjust the configs as needed.
(The default config is usually fine.) If available, LVGL can also be used with Kconfig.
Once in the project, you can initialize LVGL and create display and input devices as follows:
```c
/*Change the active screen's background color*/
lv_obj_set_style_bg_color(lv_screen_active(), lv_color_hex(0x003a57), LV_PART_MAIN);
#include "lvgl/lvgl.h" /*Define LV_LVGL_H_INCLUDE_SIMPLE to include as "lvgl.h"*/
/*Create a white label, set its text and align it to the center*/
#define TFT_HOR_RES 320
#define TFT_VER_RES 240
static uint32_t my_tick_cb(void)
{
return my_get_millisec();
}
static void my_flush_cb(lv_display_t * disp, const lv_area_t * area, uint8_t * px_map)
{
/*Write px_map to the area->x1, area->x2, area->y1, area->y2 area of the
*frame buffer or external display controller. */
}
static void my_touch_read_cb(lv_indev_t * indev, lv_indev_data_t * data)
{
if(my_touch_is_pressed()) {
data->point.x = touchpad_x;
data->point.y = touchpad_y;
data->state = LV_INDEV_STATE_PRESSED;
} else {
data->state = LV_INDEV_STATE_RELEASED;
}
}
void main(void)
{
my_hardware_init();
/*Initialize LVGL*/
lv_init();
/*Set millisecond-based tick source for LVGL so that it can track time.*/
lv_tick_set_cb(my_tick_cb);
/*Create a display where screens and widgets can be added*/
lv_display_t * display = lv_display_create(TFT_HOR_RES, TFT_VER_RES);
/*Add rendering buffers to the screen.
*Here adding a smaller partial buffer assuming 16-bit (RGB565 color format)*/
static uint8_t buf[TFT_HOR_RES * TFT_VER_RES / 10 * 2]; /* x2 because of 16-bit color depth */
lv_display_set_buffers(display, buf, NULL, sizeof(buf), LV_DISPLAY_RENDER_MODE_PARTIAL);
/*Add a callback that can flush the content from `buf` when it has been rendered*/
lv_display_set_flush_cb(display, my_flush_cb);
/*Create an input device for touch handling*/
lv_indev_t * indev = lv_indev_create();
lv_indev_set_type(indev, LV_INDEV_TYPE_POINTER);
lv_indev_set_read_cb(indev, my_touch_read_cb);
/*The drivers are in place; now we can create the UI*/
lv_obj_t * label = lv_label_create(lv_screen_active());
lv_label_set_text(label, "Hello world");
lv_obj_set_style_text_color(label, lv_color_hex(0xffffff), LV_PART_MAIN);
lv_obj_align(label, LV_ALIGN_CENTER, 0, 0);
```
</details>
lv_obj_center(label);
<details>
<summary>MicroPython code | <a href="https://sim.lvgl.io/v8.3/micropython/ports/javascript/index.html?script_direct=4ab7c40c35b0dc349aa2f0c3b00938d7d8e8ac9f" target="_blank">Online Simulator</a></summary>
```python
# Change the active screen's background color
scr = lv.screen_active()
scr.set_style_bg_color(lv.color_hex(0x003a57), lv.PART.MAIN)
# Create a white label, set its text and align it to the center
label = lv.label(lv.screen_active())
label.set_text("Hello world")
label.set_style_text_color(lv.color_hex(0xffffff), lv.PART.MAIN)
label.align(lv.ALIGN.CENTER, 0, 0)
```
</details>
<br>
### Button with Click Event
![LVGL button with label example](https://github.com/kisvegabor/test/raw/master/readme_example_2.gif)
<details>
<summary>C code</summary>
```c
lv_obj_t * button = lv_button_create(lv_screen_active());                   /*Add a button to the current screen*/
lv_obj_center(button);                                     /*Set its position*/
lv_obj_set_size(button, 100, 50);                                  /*Set its size*/
lv_obj_add_event_cb(button, button_event_cb, LV_EVENT_CLICKED, NULL); /*Assign a callback to the button*/
lv_obj_t * label = lv_label_create(button);                        /*Add a label to the button*/
lv_label_set_text(label, "Button");                             /*Set the labels text*/
lv_obj_center(label);                                           /*Align the label to the center*/
...
void button_event_cb(lv_event_t * e)
{
  printf("Clicked\n");
/*Execute the LVGL-related tasks in a loop*/
while(1) {
lv_timer_handler();
my_sleep_ms(5); /*Wait a little to let the system breathe*/
}
}
```
</details>
<details>
<summary>MicroPython code | <a href="https://sim.lvgl.io/v8.3/micropython/ports/javascript/index.html?script_startup=https://raw.githubusercontent.com/lvgl/lvgl/0d9ab4ee0e591aad1970e3c9164fd7c544ecce70/examples/header.py&script=https://raw.githubusercontent.com/lvgl/lvgl/0d9ab4ee0e591aad1970e3c9164fd7c544ecce70/examples/widgets/slider/lv_example_slider_2.py&script_direct=926bde43ec7af0146c486de470c53f11f167491e" target="_blank">Online Simulator</a></summary>
## 🤖 Examples
```python
def button_event_cb(e):
  print("Clicked")
You can check out more than 100 examples at https://docs.lvgl.io/master/examples.html
# Create a Button and a Label
button = lv.button(lv.screen_active())
button.center()
button.set_size(100, 50)
button.add_event_cb(button_event_cb, lv.EVENT.CLICKED, None)
The Online Viewer also contains tutorials to easily learn XML: https://viewer.lvgl.io/
label = lv.label(button)
label.set_text("Button")
label.center()
```
</details>
<br>
### Checkboxes with Layout
![Checkboxes with layout in LVGL](https://github.com/kisvegabor/test/raw/master/readme_example_3.gif)
### Hello World Button with an Event
<img width="311" height="232" alt="image" src="https://github.com/user-attachments/assets/5948b485-e3f7-4a63-bb21-984381417c4a" />
<details>
<summary>C code</summary>
```c
static void button_clicked_cb(lv_event_t * e)
{
printf("Clicked\n");
}
lv_obj_set_flex_flow(lv_screen_active(), LV_FLEX_FLOW_COLUMN);
lv_obj_set_flex_align(lv_screen_active(), LV_FLEX_ALIGN_CENTER, LV_FLEX_ALIGN_START, LV_FLEX_ALIGN_CENTER);
[...]
lv_obj_t * cb;
cb = lv_checkbox_create(lv_screen_active());
lv_checkbox_set_text(cb, "Apple");
lv_obj_add_event_cb(cb, event_handler, LV_EVENT_ALL, NULL);
lv_obj_t * button = lv_button_create(lv_screen_active());
lv_obj_center(button);
lv_obj_add_event_cb(button, button_clicked_cb, LV_EVENT_CLICKED, NULL);
cb = lv_checkbox_create(lv_screen_active());
lv_checkbox_set_text(cb, "Banana");
lv_obj_add_state(cb, LV_STATE_CHECKED);
lv_obj_add_event_cb(cb, event_handler, LV_EVENT_ALL, NULL);
cb = lv_checkbox_create(lv_screen_active());
lv_checkbox_set_text(cb, "Lemon");
lv_obj_add_state(cb, LV_STATE_DISABLED);
lv_obj_add_event_cb(cb, event_handler, LV_EVENT_ALL, NULL);
cb = lv_checkbox_create(lv_screen_active());
lv_obj_add_state(cb, LV_STATE_CHECKED | LV_STATE_DISABLED);
lv_checkbox_set_text(cb, "Melon\nand a new line");
lv_obj_add_event_cb(cb, event_handler, LV_EVENT_ALL, NULL);
lv_obj_t * label = lv_label_create(button);
lv_label_set_text(label, "Hello from LVGL!");
```
</details>
<details>
<summary>MicroPython code | <a href="https://sim.lvgl.io/v8.3/micropython/ports/javascript/index.html?script_startup=https://raw.githubusercontent.com/lvgl/lvgl/0d9ab4ee0e591aad1970e3c9164fd7c544ecce70/examples/header.py&script=https://raw.githubusercontent.com/lvgl/lvgl/0d9ab4ee0e591aad1970e3c9164fd7c544ecce70/examples/widgets/slider/lv_example_slider_2.py&script_direct=311d37e5f70daf1cb0d2cad24c7f72751b5f1792" target="_blank">Online Simulator</a></summary>
<summary>In XML with LVGL Pro</summary>
```python
def event_handler(e):
code = e.get_code()
obj = e.get_target_obj()
if code == lv.EVENT.VALUE_CHANGED:
txt = obj.get_text()
if obj.get_state() & lv.STATE.CHECKED:
state = "Checked"
else:
state = "Unchecked"
print(txt + ":" + state)
lv.screen_active().set_flex_flow(lv.FLEX_FLOW.COLUMN)
lv.screen_active().set_flex_align(lv.FLEX_ALIGN.CENTER, lv.FLEX_ALIGN.START, lv.FLEX_ALIGN.CENTER)
cb = lv.checkbox(lv.screen_active())
cb.set_text("Apple")
cb.add_event_cb(event_handler, lv.EVENT.ALL, None)
cb = lv.checkbox(lv.screen_active())
cb.set_text("Banana")
cb.add_state(lv.STATE.CHECKED)
cb.add_event_cb(event_handler, lv.EVENT.ALL, None)
cb = lv.checkbox(lv.screen_active())
cb.set_text("Lemon")
cb.add_state(lv.STATE.DISABLED)
cb.add_event_cb(event_handler, lv.EVENT.ALL, None)
cb = lv.checkbox(lv.screen_active())
cb.add_state(lv.STATE.CHECKED | lv.STATE.DISABLED)
cb.set_text("Melon")
cb.add_event_cb(event_handler, lv.EVENT.ALL, None)
```xml
<screen>
<view>
<lv_button align="center">
<event_cb callback="button_clicked_cb" />
<lv_label text="Hello from LVGL!" />
</lv_button>
</view>
</screen>
```
</details>
<br>
### Styling a Slider
![Styling a slider with LVGL](https://github.com/kisvegabor/test/raw/master/readme_example_4.gif)
### Styled Slider with Data-binding
<img width="314" height="233" alt="image" src="https://github.com/user-attachments/assets/268db1a0-946c-42e2-aee4-9550bdf5f4f9" />
<details>
<summary>C code</summary>
```c
static void my_observer_cb(lv_observer_t * observer, lv_subject_t * subject)
{
printf("Slider value: %d\n", lv_subject_get_int(subject));
}
[...]
static lv_subject_t subject_value;
lv_subject_init_int(&subject_value, 35);
lv_subject_add_observer(&subject_value, my_observer_cb, NULL);
lv_style_t style_base;
lv_style_init(&style_base);
lv_style_set_bg_color(&style_base, lv_color_hex(0xff8800));
lv_style_set_bg_opa(&style_base, 255);
lv_style_set_radius(&style_base, 4);
lv_obj_t * slider = lv_slider_create(lv_screen_active());
lv_slider_set_value(slider, 70, LV_ANIM_OFF);
lv_obj_set_size(slider, 300, 20);
lv_obj_center(slider);
lv_obj_set_size(slider, lv_pct(80), 16);
lv_obj_add_style(slider, &style_base, LV_PART_INDICATOR);
lv_obj_add_style(slider, &style_base, LV_PART_KNOB);
lv_obj_add_style(slider, &style_base, 0);
lv_obj_set_style_bg_opa(slider, LV_OPA_50, 0);
lv_obj_set_style_border_width(slider, 3, LV_PART_KNOB);
lv_obj_set_style_border_color(slider, lv_color_hex3(0xfff), LV_PART_KNOB);
lv_slider_bind_value(slider, &subject_value);
/*Add local styles to MAIN part (background rectangle)*/
lv_obj_set_style_bg_color(slider, lv_color_hex(0x0F1215), LV_PART_MAIN);
lv_obj_set_style_bg_opa(slider, 255, LV_PART_MAIN);
lv_obj_set_style_border_color(slider, lv_color_hex(0x333943), LV_PART_MAIN);
lv_obj_set_style_border_width(slider, 5, LV_PART_MAIN);
lv_obj_set_style_pad_all(slider, 5, LV_PART_MAIN);
/*Create a reusable style sheet for the INDICATOR part*/
static lv_style_t style_indicator;
lv_style_init(&style_indicator);
lv_style_set_bg_color(&style_indicator, lv_color_hex(0x37B9F5));
lv_style_set_bg_grad_color(&style_indicator, lv_color_hex(0x1464F0));
lv_style_set_bg_grad_dir(&style_indicator, LV_GRAD_DIR_HOR);
lv_style_set_shadow_color(&style_indicator, lv_color_hex(0x37B9F5));
lv_style_set_shadow_width(&style_indicator, 15);
lv_style_set_shadow_spread(&style_indicator, 5);
4
/*Add the style sheet to the slider's INDICATOR part*/
lv_obj_add_style(slider, &style_indicator, LV_PART_INDICATOR);
/*Add the same style to the KNOB part too and locally overwrite some properties*/
lv_obj_add_style(slider, &style_indicator, LV_PART_KNOB);
lv_obj_set_style_outline_color(slider, lv_color_hex(0x0096FF), LV_PART_KNOB);
lv_obj_set_style_outline_width(slider, 3, LV_PART_KNOB);
lv_obj_set_style_outline_pad(slider, -5, LV_PART_KNOB);
lv_obj_set_style_shadow_spread(slider, 2, LV_PART_KNOB);
lv_obj_t * label = lv_label_create(lv_screen_active());
lv_obj_align(label, LV_ALIGN_CENTER, 0, -30);
lv_label_bind_text(label, &subject_value, "Temperature: %d °C");
```
</details>
<details>
<summary>MicroPython code |
<a href="https://sim.lvgl.io/v8.3/micropython/ports/javascript/index.html?script_startup=https://raw.githubusercontent.com/lvgl/lvgl/0d9ab4ee0e591aad1970e3c9164fd7c544ecce70/examples/header.py&script=https://raw.githubusercontent.com/lvgl/lvgl/0d9ab4ee0e591aad1970e3c9164fd7c544ecce70/examples/widgets/slider/lv_example_slider_2.py&script_direct=c431c7b4dfd2cc0dd9c392b74365d5af6ea986f0" target="_blank">Online Simulator</a>
</summary>
<summary>In XML with LVGL Pro</summary>
```xml
<screen>
<styles>
<style name="style_base" bg_opa="100%" bg_color="0xff8800" radius="4" />
<style name="style_border" border_color="0xfff" border_width="3" />
</styles>
```python
# Create a slider and add the style
slider = lv.slider(lv.screen_active())
slider.set_value(70, lv.ANIM.OFF)
slider.set_size(300, 20)
slider.center()
# Add local styles to MAIN part (background rectangle)
slider.set_style_bg_color(lv.color_hex(0x0F1215), lv.PART.MAIN)
slider.set_style_bg_opa(255, lv.PART.MAIN)
slider.set_style_border_color(lv.color_hex(0x333943), lv.PART.MAIN)
slider.set_style_border_width(5, lv.PART.MAIN)
slider.set_style_pad_all(5, lv.PART.MAIN)
# Create a reusable style sheet for the INDICATOR part
style_indicator = lv.style_t()
style_indicator.init()
style_indicator.set_bg_color(lv.color_hex(0x37B9F5))
style_indicator.set_bg_grad_color(lv.color_hex(0x1464F0))
style_indicator.set_bg_grad_dir(lv.GRAD_DIR.HOR)
style_indicator.set_shadow_color(lv.color_hex(0x37B9F5))
style_indicator.set_shadow_width(15)
style_indicator.set_shadow_spread(5)
# Add the style sheet to the slider's INDICATOR part
slider.add_style(style_indicator, lv.PART.INDICATOR)
slider.add_style(style_indicator, lv.PART.KNOB)
# Add the same style to the KNOB part too and locally overwrite some properties
slider.set_style_outline_color(lv.color_hex(0x0096FF), lv.PART.KNOB)
slider.set_style_outline_width(3, lv.PART.KNOB)
slider.set_style_outline_pad(-5, lv.PART.KNOB)
slider.set_style_shadow_spread(2, lv.PART.KNOB)
<view>
<lv_label bind_text="value" bind_text-fmt="Temperature: %d °C" align="center" y="-30" />
<lv_slider align="center" bind_value="value" style_bg_opa="30%">
<style name="style_base" />
<style name="style_base" selector="knob" />
<style name="style_base" selector="indicator" />
<style name="style_border" selector="knob" />
</lv_slider>
</view>
</screen>
```
</details>
<br>
### English, Hebrew (mixed LTR-RTL) and Chinese texts
### Checkboxes in a Layout
![English, Hebrew and Chinese texts with LVGL](https://github.com/kisvegabor/test/raw/master/readme_example_5.png)
<img width="311" height="231" alt="image" src="https://github.com/user-attachments/assets/ba9af647-2ea1-4bc8-b53d-c7b43ce24b6e" />
<details>
<summary>C code</summary>
```c
lv_obj_t * ltr_label = lv_label_create(lv_screen_active());
lv_label_set_text(ltr_label, "In modern terminology, a microcontroller is similar to a system on a chip (SoC).");
lv_obj_set_style_text_font(ltr_label, &lv_font_montserrat_16, 0);
lv_obj_set_width(ltr_label, 310);
lv_obj_align(ltr_label, LV_ALIGN_TOP_LEFT, 5, 5);
/*Create a new screen and load it*/
lv_obj_t * scr = lv_obj_create(NULL);
lv_screen_load(scr);
lv_obj_t * rtl_label = lv_label_create(lv_screen_active());
lv_label_set_text(rtl_label,"מעבד, או בשמו המלא יחידת עיבוד מרכזית (באנגלית: CPU - Central Processing Unit).");
lv_obj_set_style_base_dir(rtl_label, LV_BASE_DIR_RTL, 0);
lv_obj_set_style_text_font(rtl_label, &lv_font_dejavu_16_persian_hebrew, 0);
lv_obj_set_width(rtl_label, 310);
lv_obj_align(rtl_label, LV_ALIGN_LEFT_MID, 5, 0);
/*Set a column layout*/
lv_obj_set_flex_flow(scr, LV_FLEX_FLOW_COLUMN);
lv_obj_set_flex_align(scr, LV_FLEX_ALIGN_SPACE_EVENLY, /*Vertical alignment*/
LV_FLEX_ALIGN_START, /*Horizontal alignment in the track*/
LV_FLEX_ALIGN_CENTER); /*Horizontal alignment of the track*/
lv_obj_t * cz_label = lv_label_create(lv_screen_active());
lv_label_set_text(cz_label,
"嵌入式系统Embedded System\n是一种嵌入机械或电气系统内部、具有专一功能和实时计算性能的计算机系统。");
lv_obj_set_style_text_font(cz_label, &lv_font_source_han_sans_sc_16_cjk, 0);
lv_obj_set_width(cz_label, 310);
lv_obj_align(cz_label, LV_ALIGN_BOTTOM_LEFT, 5, -5);
/*Create 5 checkboxes*/
const char * texts[5] = {"Input 1", "Input 2", "Input 3", "Output 1", "Output 2"};
for(int i = 0; i < 5; i++) {
lv_obj_t * cb = lv_checkbox_create(scr);
lv_checkbox_set_text(cb, texts[i]);
}
/*Change some states*/
lv_obj_add_state(lv_obj_get_child(scr, 1), LV_STATE_CHECKED);
lv_obj_add_state(lv_obj_get_child(scr, 3), LV_STATE_DISABLED);
```
</details>
<details>
<summary>MicroPython code | <a href="https://sim.lvgl.io/v8.3/micropython/ports/javascript/index.html?script_startup=https://raw.githubusercontent.com/lvgl/lvgl/0d9ab4ee0e591aad1970e3c9164fd7c544ecce70/examples/header.py&script=https://raw.githubusercontent.com/lvgl/lvgl/0d9ab4ee0e591aad1970e3c9164fd7c544ecce70/examples/widgets/slider/lv_example_slider_2.py&script_direct=18bb38200a64e10ead1aa17a65c977fc18131842" target="_blank">Online Simulator</a></summary>
```python
ltr_label = lv.label(lv.screen_active())
ltr_label.set_text("In modern terminology, a microcontroller is similar to a system on a chip (SoC).")
ltr_label.set_style_text_font(lv.font_montserrat_16, 0);
ltr_label.set_width(310)
ltr_label.align(lv.ALIGN.TOP_LEFT, 5, 5)
rtl_label = lv.label(lv.screen_active())
rtl_label.set_text("מעבד, או בשמו המלא יחידת עיבוד מרכזית (באנגלית: CPU - Central Processing Unit).")
rtl_label.set_style_base_dir(lv.BASE_DIR.RTL, 0)
rtl_label.set_style_text_font(lv.font_dejavu_16_persian_hebrew, 0)
rtl_label.set_width(310)
rtl_label.align(lv.ALIGN.LEFT_MID, 5, 0)
font_hans_sans_16_cjk = lv.font_load("S:../../assets/font/lv_font_source_han_sans_sc_16_cjk.fnt")
cz_label = lv.label(lv.screen_active())
cz_label.set_style_text_font(font_hans_sans_16_cjk, 0)
cz_label.set_text("嵌入式系统Embedded System\n是一种嵌入机械或电气系统内部、具有专一功能和实时计算性能的计算机系统。")
cz_label.set_width(310)
cz_label.align(lv.ALIGN.BOTTOM_LEFT, 5, -5)
<summary>In XML with LVGL Pro</summary>
```xml
<screen>
<view
flex_flow="column"
style_flex_main_place="space_evenly"
style_flex_cross_place="start"
style_flex_track_place="center"
>
<lv_checkbox text="Input 1"/>
<lv_checkbox text="Input 2"/>
<lv_checkbox text="Input 3" checked="true"/>
<lv_checkbox text="Output 1"/>
<lv_checkbox text="Output 2" disabled="true"/>
</view>
</screen>
```
</details>
## :arrow_forward: Get started
This list will guide you to get started with LVGL step-by-step.
**Get Familiar with LVGL**
## 🌟 Contributing
1. Check the [Online demos](https://lvgl.io/demos) to see LVGL in action (3 minutes).
2. Read the [Introduction](https://docs.lvgl.io/master/intro/index.html) page of the documentation (5 minutes).
3. Get familiar with the basics on the [Quick overview](https://docs.lvgl.io/master/intro/getting_started.html#lvgl-basics) page (15 minutes).
LVGL is an open project, and contributions are very welcome. There are many ways to contribute, from simply speaking about your project, writing examples, improving the documentation, fixing bugs, or even hosting your own project under the LVGL organization.
**Start to Use LVGL**
For a detailed description of contribution opportunities, visit the [Contributing](https://docs.lvgl.io/master/contributing/index.html)
section of the documentation.
4. Set up a [Simulator](https://docs.lvgl.io/master/details/integration/ide/pc-simulator.html#simulator) (10 minutes).
5. Try out some [Examples](https://github.com/lvgl/lvgl/tree/master/examples).
6. Port LVGL to a board. See the [Porting](https://docs.lvgl.io/master/details/integration/adding-lvgl-to-your-project/index.html) guide or check out the ready-to-use [Projects](https://github.com/lvgl?q=lv_port_).
More than 600 people have already left their fingerprint on LVGL. Be one of them! See you here! 🙂
**Become a Pro**
<a href="https://github.com/lvgl/lvgl/graphs/contributors"> <img src="https://contrib.rocks/image?repo=lvgl/lvgl&max=48" /> </a>
7. Read the [Main-Modules](https://docs.lvgl.io/master/details/main-modules/index.html) page to get a better understanding of the library (2-3 hours)
8. Check the documentation of the [Widgets](https://docs.lvgl.io/master/details/widgets/index.html) to see their features and usage
**Get Help and Help Others**
9. If you have questions go to the [Forum](http://forum.lvgl.io/)
10. Read the [Contributing](https://docs.lvgl.io/master/contributing/index.html) guide to see how you can help to improve LVGL (15 minutes)
## :handshake: Services
LVGL LLC was established to provide a solid background for LVGL library and to offer several type of services to help you in UI development. With 15+ years of experience in the user interface and graphics industry we can help you the bring your UI to the next level.
- **Graphics design** Our in-house graphics designers are experts in creating beautiful modern designs which fit to your product and the resources of your hardware.
- **UI implementation** We can also implement your UI based on the design you or we have created. You can be sure that we will make the most out of your hardware and LVGL. If a feature or widget is missing from LVGL, don't worry, we will implement it for you.
- **Consulting and Support** We can support you with consulting as well to avoid pricey and time consuming mistakes during the UI development.
- **Board certification** For companies who are offering development boards, or production ready kits we do board certification which shows how board can run LVGL.
Check out our [Demos](https://lvgl.io/demos) as reference. For more information take look at the [Services page](https://lvgl.io/services).
[Contact us](https://lvgl.io/#contact) and tell how we can help.
## :star2: Contributing
LVGL is an open project and contribution is very welcome. There are many ways to contribute from simply speaking about your project, through writing examples, improving the documentation, fixing bugs or even hosting your own project under the LVGL organization.
For a detailed description of contribution opportunities visit the [Contributing](https://docs.lvgl.io/master/contributing/index.html) section of the documentation.
More than 300 people already left their fingerprint in LVGL. Be one them! See you here! :slightly_smiling_face:
<a href="https://github.com/lvgl/lvgl/graphs/contributors">
<img src="https://contrib.rocks/image?repo=lvgl/lvgl&max=48" />
</a>
... and many other.
... and many more.

View File

@ -1,6 +1,6 @@
{
"name": "lvgl",
"version": "9.3.0",
"version": "9.4.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.3.0
version=9.4.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.3.0
* Configuration file for v9.4.0
*/
/*
@ -250,30 +250,6 @@
#endif
#endif
/** Use NXP's VG-Lite GPU on iMX RTxxx platforms. */
#define LV_USE_DRAW_VGLITE 0
#if LV_USE_DRAW_VGLITE
/** Enable blit quality degradation workaround recommended for screen's dimension > 352 pixels. */
#define LV_USE_VGLITE_BLIT_SPLIT 0
#if LV_USE_OS
/** 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. */
#define LV_USE_VGLITE_ASSERT 0
/** Enable VGLite error checks. */
#define LV_USE_VGLITE_CHECK_ERROR 0
#endif
/** Use NXP's PXP on iMX RTxxx platforms. */
#define LV_USE_PXP 0
@ -294,14 +270,20 @@
#endif
/** Use NXP's G2D on MPU platforms. */
#define LV_USE_DRAW_G2D 0
#define LV_USE_G2D 0
#if LV_USE_G2D
/** Use G2D for drawing. **/
#define LV_USE_DRAW_G2D 1
/** Use G2D to rotate display. **/
#define LV_USE_ROTATE_G2D 0
#if LV_USE_DRAW_G2D
/** Maximum number of buffers that can be stored for G2D draw unit.
* Includes the frame buffers and assets. */
#define LV_G2D_HASH_TABLE_SIZE 50
#if LV_USE_OS
#if LV_USE_DRAW_G2D && LV_USE_OS
/** Use additional draw thread for G2D processing.*/
#define LV_USE_G2D_DRAW_THREAD 1
#endif
@ -318,7 +300,6 @@
/** Use VG-Lite GPU. */
#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
@ -340,11 +321,53 @@
/** VG-Lite stroke maximum cache number. */
#define LV_VG_LITE_STROKE_CACHE_CNT 32
/** Remove VLC_OP_CLOSE path instruction (Workaround for NXP) **/
#define LV_VG_LITE_DISABLE_VLC_OP_CLOSE 0
/** Disable linear gradient extension for some older versions of drivers. */
#define LV_VG_LITE_DISABLE_LINEAR_GRADIENT_EXT 0
/** Enable usage of the LVGL's built-in vg_lite driver */
#define LV_USE_VG_LITE_DRIVER 0
#if LV_USE_VG_LITE_DRIVER
/** Used to pick the correct GPU series folder valid options are gc255, gc355 and gc555*/
#define LV_VG_LITE_HAL_GPU_SERIES gc255
/** Used to pick the correct GPU revision header it depends on the vendor */
#define LV_VG_LITE_HAL_GPU_REVISION 0x40
/** Base memory address of the GPU IP it depends on SoC,
* default value is for NXP based devices */
#define LV_VG_LITE_HAL_GPU_BASE_ADDRESS 0x40240000
#endif /*LV_USE_VG_LITE_DRIVER*/
/** Use ThorVG (a software vector library) as VG-Lite driver to allow testing VGLite on PC
* Requires: LV_USE_THORVG_INTERNAL or LV_USE_THORVG_EXTERNAL */
#define LV_USE_VG_LITE_THORVG 0
#if LV_USE_VG_LITE_THORVG
/** Enable LVGL's blend mode support */
#define LV_VG_LITE_THORVG_LVGL_BLEND_SUPPORT 0
/** 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 alignment on 16 pixels */
#define LV_VG_LITE_THORVG_16PIXELS_ALIGN 1
/** Buffer address alignment */
#define LV_VG_LITE_THORVG_BUF_ADDR_ALIGN 64
/** Enable multi-thread render */
#define LV_VG_LITE_THORVG_THREAD_RENDER 0
#endif /*LV_USE_VG_LITE_THORVG*/
#endif
/** Accelerate blends, fills, etc. with STM32 DMA2D */
#define LV_USE_DRAW_DMA2D 0
#if LV_USE_DRAW_DMA2D
#define LV_DRAW_DMA2D_HAL_INCLUDE "stm32h7xx_hal.h"
@ -354,8 +377,29 @@
#define LV_USE_DRAW_DMA2D_INTERRUPT 0
#endif
/** Draw using cached OpenGLES textures */
/** Draw using cached OpenGLES textures. Requires LV_USE_OPENGLES */
#define LV_USE_DRAW_OPENGLES 0
#if LV_USE_DRAW_OPENGLES
#define LV_DRAW_OPENGLES_TEXTURE_CACHE_COUNT 64
#endif
/** Draw using espressif PPA accelerator */
#define LV_USE_PPA 0
#if LV_USE_PPA
#define LV_USE_PPA_IMG 0
#endif
/* Use EVE FT81X GPU. */
#define LV_USE_DRAW_EVE 0
#if LV_USE_DRAW_EVE
/* EVE_GEN value: 2, 3, or 4 */
#define LV_DRAW_EVE_EVE_GENERATION 4
/* The maximum number of bytes to buffer before a single SPI transmission.
* Set it to 0 to disable write buffering.
*/
#define LV_DRAW_EVE_WRITE_BUFFER_SIZE 2048
#endif
/*=======================
* FEATURE CONFIGURATION
@ -497,30 +541,6 @@
/** Enable property name support. */
#define LV_USE_OBJ_PROPERTY_NAME 1
/* Use VG-Lite Simulator.
* - Requires: LV_USE_THORVG_INTERNAL or LV_USE_THORVG_EXTERNAL */
#define LV_USE_VG_LITE_THORVG 0
#if LV_USE_VG_LITE_THORVG
/** Enable LVGL's blend mode support */
#define LV_VG_LITE_THORVG_LVGL_BLEND_SUPPORT 0
/** 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 alignment on 16 pixels */
#define LV_VG_LITE_THORVG_16PIXELS_ALIGN 1
/** Buffer address alignment */
#define LV_VG_LITE_THORVG_BUF_ADDR_ALIGN 64
/** Enable multi-thread render */
#define LV_VG_LITE_THORVG_THREAD_RENDER 0
#endif
/* Enable the multi-touch gesture recognition feature */
/* Gesture recognition requires the use of floats */
#define LV_USE_GESTURE_RECOGNITION 0
@ -608,8 +628,6 @@
/* 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 */
#define LV_FONT_SOURCE_HAN_SANS_SC_14_CJK 0 /**< 1338 most common CJK radicals */
#define LV_FONT_SOURCE_HAN_SANS_SC_16_CJK 0 /**< 1338 most common CJK radicals */
@ -699,6 +717,7 @@
* - lv_dropdown_t : Options set to "Option 1", "Option 2", "Option 3", else no values are set.
* - lv_roller_t : Options set to "Option 1", "Option 2", "Option 3", "Option 4", "Option 5", else no values are set.
* - lv_label_t : Text set to "Text", else empty string.
* - lv_arclabel_t : Text set to "Arced Text", else empty string.
* */
#define LV_WIDGETS_HAS_DEFAULT_VALUE 1
@ -706,6 +725,8 @@
#define LV_USE_ARC 1
#define LV_USE_ARCLABEL 1
#define LV_USE_BAR 1
#define LV_USE_BUTTON 1
@ -796,7 +817,7 @@
/*==================
* THEMES
*==================*/
/* Documentation for themes can be found here: https://docs.lvgl.io/master/details/common-widget-features/styles/style.html#themes . */
/* Documentation for themes can be found here: https://docs.lvgl.io/master/details/common-widget-features/styles/styles.html#themes . */
/** A simple, impressive and very complete theme */
#define LV_USE_THEME_DEFAULT 1
@ -905,6 +926,11 @@
#define LV_FS_UEFI_LETTER '\0' /**< Set an upper-case driver-identifier letter for this driver (e.g. 'A'). */
#endif
#define LV_USE_FS_FROGFS 0
#if LV_USE_FS_FROGFS
#define LV_FS_FROGFS_LETTER '\0'
#endif
/** LODEPNG decoder library */
#define LV_USE_LODEPNG 0
@ -929,6 +955,8 @@
#define LV_GIF_CACHE_DECODE_DATA 0
#endif
/** GStreamer library */
#define LV_USE_GSTREAMER 0
/** Decode bin images to RAM */
#define LV_BIN_DECODER_RAM_LOAD 0
@ -958,20 +986,26 @@
#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
#define LV_TINY_TTF_CACHE_GLYPH_CNT 128
#define LV_TINY_TTF_CACHE_KERNING_CNT 256
#endif
/** Rlottie library */
#define LV_USE_RLOTTIE 0
/** Requires `LV_USE_3DTEXTURE = 1` */
#define LV_USE_GLTF 0
/** Enable Vector Graphic APIs
* - Requires `LV_USE_MATRIX = 1` */
* Requires `LV_USE_MATRIX = 1` */
#define LV_USE_VECTOR_GRAPHIC 0
/** Enable ThorVG (vector graphics library) from the src/libs folder */
/** Enable ThorVG (vector graphics library) from the src/libs folder.
* Requires LV_USE_VECTOR_GRAPHIC */
#define LV_USE_THORVG_INTERNAL 0
/** Enable ThorVG by assuming that its installed and linked to the project */
/** Enable ThorVG by assuming that its installed and linked to the project
* Requires LV_USE_VECTOR_GRAPHIC */
#define LV_USE_THORVG_EXTERNAL 0
/** Use lvgl built-in LZ4 lib */
@ -1011,6 +1045,13 @@
#if LV_USE_SYSMON
/** Get the idle percentage. E.g. uint32_t my_get_idle(void); */
#define LV_SYSMON_GET_IDLE lv_os_get_idle_percent
/** 1: Enable usage of lv_os_get_proc_idle_percent.*/
#define LV_SYSMON_PROC_IDLE_AVAILABLE 0
#if LV_SYSMON_PROC_IDLE_AVAILABLE
/** Get the applications idle percentage.
* - Requires `LV_USE_OS == LV_OS_PTHREAD` */
#define LV_SYSMON_GET_PROC_IDLE lv_os_get_proc_idle_percent
#endif
/** 1: Show CPU usage and FPS count.
* - Requires `LV_USE_SYSMON = 1` */
@ -1040,6 +1081,7 @@
/** Default profiler trace buffer size */
#define LV_PROFILER_BUILTIN_BUF_SIZE (16 * 1024) /**< [bytes] */
#define LV_PROFILER_BUILTIN_DEFAULT_ENABLE 1
#define LV_USE_PROFILER_BUILTIN_POSIX 0 /**< Enable POSIX profiler port */
#endif
/** Header to include for profiler */
@ -1149,15 +1191,19 @@
#if LV_USE_TEST
/** Enable `lv_test_screenshot_compare`.
* Requires libpng and a few MB of extra RAM. */
* Requires lodepng and a few MB of extra RAM. */
#define LV_USE_TEST_SCREENSHOT_COMPARE 0
#endif /*LV_USE_TEST*/
/** Enable loading XML UIs runtime */
#define LV_USE_XML 0
/** 1: Enable text translation support */
#define LV_USE_TRANSLATION 0
/*1: Enable color filter style*/
#define LV_USE_COLOR_FILTER 0
/*==================
* DEVICES
*==================*/
@ -1193,7 +1239,6 @@
#define LV_WAYLAND_RENDER_MODE LV_DISPLAY_RENDER_MODE_PARTIAL /**< DMABUF supports LV_DISPLAY_RENDER_MODE_FULL and LV_DISPLAY_RENDER_MODE_DIRECT*/
/**< When LV_WAYLAND_USE_DMABUF is disabled, only LV_DISPLAY_RENDER_MODE_PARTIAL is supported*/
#define LV_WAYLAND_WINDOW_DECORATIONS 0 /**< Draw client side window decorations only necessary on Mutter/GNOME. Not supported using DMABUF*/
#define LV_WAYLAND_WL_SHELL 0 /**< Use the legacy wl_shell protocol instead of the default XDG shell*/
#endif
/** Driver for /dev/fb */
@ -1230,8 +1275,21 @@
/** Driver for /dev/input */
#define LV_USE_NUTTX_TOUCHSCREEN 0
/*Touchscreen cursor size in pixels(<=0: disable cursor)*/
/** Touchscreen cursor size in pixels(<=0: disable cursor) */
#define LV_NUTTX_TOUCHSCREEN_CURSOR_SIZE 0
/** Driver for /dev/mouse */
#define LV_USE_NUTTX_MOUSE 0
/** Mouse movement step (pixels) */
#define LV_USE_NUTTX_MOUSE_MOVE_STEP 1
/*NuttX trace file and its path*/
#define LV_USE_NUTTX_TRACE_FILE 0
#if LV_USE_NUTTX_TRACE_FILE
#define LV_NUTTX_TRACE_FILE_PATH "/data/lvgl-trace.log"
#endif
#endif
/** Driver for /dev/dri/card */
@ -1243,12 +1301,22 @@
* shared across sub-systems and libraries using the Linux DMA-BUF API.
* The GBM library aims to provide a platform independent memory management system
* it supports the major GPU vendors - This option requires linking with libgbm */
#define LV_LINUX_DRM_GBM_BUFFERS 0
#define LV_USE_LINUX_DRM_GBM_BUFFERS 0
#define LV_LINUX_DRM_USE_EGL 0
#endif
/** Interface for TFT_eSPI */
#define LV_USE_TFT_ESPI 0
/** Interface for Lovyan_GFX */
#define LV_USE_LOVYAN_GFX 0
#if LV_USE_LOVYAN_GFX
#define LV_LGFX_USER_INCLUDE "lv_lgfx_user.hpp"
#endif /*LV_USE_LOVYAN_GFX*/
/** Driver for evdev input devices */
#define LV_USE_EVDEV 0
@ -1272,8 +1340,9 @@
#define LV_USE_ST7796 0
#define LV_USE_ILI9341 0
#define LV_USE_FT81X 0
#define LV_USE_NV3007 0
#if (LV_USE_ST7735 | LV_USE_ST7789 | LV_USE_ST7796 | LV_USE_ILI9341)
#if (LV_USE_ST7735 | LV_USE_ST7789 | LV_USE_ST7796 | LV_USE_ILI9341 | LV_USE_NV3007)
#define LV_USE_GENERIC_MIPI 1
#else
#define LV_USE_GENERIC_MIPI 0
@ -1289,6 +1358,9 @@
#define LV_ST_LTDC_USE_DMA2D_FLUSH 0
#endif
/** Driver for NXP ELCDIF */
#define LV_USE_NXP_ELCDIF 0
/** LVGL Windows backend */
#define LV_USE_WINDOWS 0
@ -1299,12 +1371,16 @@
#define LV_UEFI_USE_MEMORY_SERVICES 0 /**< Use the memory functions from the boot services table */
#endif
/** Use OpenGL to open window on PC and handle mouse and keyboard */
/** Use a generic OpenGL driver that can be used to embed in other applications or used with GLFW/EGL */
#define LV_USE_OPENGLES 0
#if LV_USE_OPENGLES
#define LV_USE_OPENGLES_DEBUG 1 /**< Enable or disable debug for opengles */
#endif
/** Use GLFW to open window on PC and handle mouse and keyboard. Requires*/
#define LV_USE_GLFW 0
/** QNX Screen display and input drivers */
#define LV_USE_QNX 0
#if LV_USE_QNX
@ -1360,6 +1436,9 @@
/** Vector graphic demo */
#define LV_USE_DEMO_VECTOR_GRAPHIC 0
/** GLTF demo */
#define LV_USE_DEMO_GLTF 0
/*---------------------------
* Demos from lvgl/lv_demos
---------------------------*/

View File

@ -3,12 +3,12 @@
* The current version of LVGL
*/
#ifndef LVGL_VERSION_H
#define LVGL_VERSION_H
#ifndef LV_VERSION_H
#define LV_VERSION_H
#define LVGL_VERSION_MAJOR 9
#define LVGL_VERSION_MINOR 3
#define LVGL_VERSION_MINOR 4
#define LVGL_VERSION_PATCH 0
#define LVGL_VERSION_INFO ""
#endif /* LVGL_VERSION_H */
#endif /* LV_VERSION_H */

View File

@ -36,7 +36,8 @@ extern "C" {
#include "src/misc/lv_iter.h"
#include "src/misc/lv_circle_buf.h"
#include "src/misc/lv_tree.h"
#include "src/misc/cache/lv_cache.h"
#include "src/osal/lv_os.h"
#include "src/tick/lv_tick.h"
@ -53,6 +54,7 @@ extern "C" {
#include "src/widgets/animimage/lv_animimage.h"
#include "src/widgets/arc/lv_arc.h"
#include "src/widgets/arclabel/lv_arclabel.h"
#include "src/widgets/bar/lv_bar.h"
#include "src/widgets/button/lv_button.h"
#include "src/widgets/buttonmatrix/lv_buttonmatrix.h"
@ -95,8 +97,8 @@ extern "C" {
#include "src/others/ime/lv_ime_pinyin.h"
#include "src/others/file_explorer/lv_file_explorer.h"
#include "src/others/font_manager/lv_font_manager.h"
#include "src/others/translation/lv_translation.h"
#include "src/others/xml/lv_xml.h"
#include "src/others/xml/lv_xml_component.h"
#include "src/others/test/lv_test.h"
#include "src/libs/barcode/lv_barcode.h"
@ -106,7 +108,10 @@ extern "C" {
#include "src/libs/fsdrv/lv_fsdrv.h"
#include "src/libs/lodepng/lv_lodepng.h"
#include "src/libs/libpng/lv_libpng.h"
#include "src/libs/gltf/gltf_data/lv_gltf_model.h"
#include "src/libs/gltf/gltf_view/lv_gltf.h"
#include "src/libs/gif/lv_gif.h"
#include "src/libs/gstreamer/lv_gstreamer.h"
#include "src/libs/qrcode/lv_qrcode.h"
#include "src/libs/tjpgd/lv_tjpgd.h"
#include "src/libs/libjpeg_turbo/lv_libjpeg_turbo.h"
@ -122,14 +127,21 @@ extern "C" {
#include "src/draw/lv_draw_buf.h"
#include "src/draw/lv_draw_vector.h"
#include "src/draw/sw/lv_draw_sw_utils.h"
#include "src/draw/eve/lv_draw_eve_target.h"
#include "src/themes/lv_theme.h"
#include "src/drivers/lv_drivers.h"
/* Define LV_DISABLE_API_MAPPING using a compiler option
* to make sure your application is not using deprecated names */
#ifndef LV_DISABLE_API_MAPPING
#include "src/lv_api_map_v8.h"
#include "src/lv_api_map_v9_0.h"
#include "src/lv_api_map_v9_1.h"
#include "src/lv_api_map_v9_2.h"
#include "src/lv_api_map_v9_3.h"
#endif /*LV_DISABLE_API_MAPPING*/
#if LV_USE_PRIVATE_API
#include "src/lvgl_private.h"

View File

@ -18,6 +18,7 @@ extern "C" {
#include "src/display/lv_display_private.h"
#include "src/indev/lv_indev_private.h"
#include "src/misc/lv_text_private.h"
#include "src/misc/cache/lv_cache.h"
#include "src/misc/cache/lv_cache_entry_private.h"
#include "src/misc/cache/lv_cache_private.h"
#include "src/layouts/lv_layout_private.h"
@ -31,7 +32,6 @@ extern "C" {
#include "src/others/xml/lv_xml_private.h"
#include "src/libs/qrcode/lv_qrcode_private.h"
#include "src/libs/barcode/lv_barcode_private.h"
#include "src/libs/gif/lv_gif_private.h"
#include "src/draw/lv_draw_triangle_private.h"
#include "src/draw/lv_draw_private.h"
#include "src/draw/lv_draw_rect_private.h"

View File

@ -27,7 +27,7 @@ extern "C" {
#include "../misc/lv_log.h"
#include "../misc/lv_style.h"
#include "../misc/lv_timer.h"
#include "../osal/lv_os.h"
#include "../osal/lv_os_private.h"
#include "../others/sysmon/lv_sysmon.h"
#include "../stdlib/builtin/lv_tlsf.h"
@ -35,10 +35,6 @@ extern "C" {
#include "../font/lv_font_fmt_txt_private.h"
#endif
#if LV_USE_OS != LV_OS_NONE && defined(__linux__)
#include "../osal/lv_linux_private.h"
#endif
#include "../tick/lv_tick.h"
#include "../layouts/lv_layout.h"
@ -82,6 +78,14 @@ struct _lv_nuttx_ctx_t;
#endif
typedef struct _lv_global_t {
/**
* User data for the LVGL library. Move from the bottom of the struct
* to avoid breaking the ABI. E.g., if the user data is used by a
* closed-source library, this can help to avoid re-compiling the library
* when the lvgl-related configs are changed.
*/
void * user_data;
bool inited;
bool deinit_in_progress; /**< Can be used e.g. in the LV_EVENT_DELETE to deinit the drivers too */
@ -122,6 +126,10 @@ typedef struct _lv_global_t {
* can be managed by image cache. */
lv_ll_t img_decoder_ll;
#if LV_USE_OS != LV_OS_NONE
lv_mutex_t img_decoder_info_lock;
lv_mutex_t img_decoder_open_lock;
#endif
lv_cache_t * img_cache;
lv_cache_t * img_header_cache;
@ -191,6 +199,10 @@ typedef struct _lv_global_t {
lv_fs_drv_t arduino_sd_fs_drv;
#endif
#if LV_USE_FS_FROGFS
lv_fs_drv_t frogfs_fs_drv;
#endif
#if LV_USE_FREETYPE
struct _lv_freetype_context_t * ft_context;
#endif
@ -207,8 +219,10 @@ typedef struct _lv_global_t {
struct _lv_profiler_builtin_ctx_t * profiler_context;
#endif
#if LV_USE_FILE_EXPLORER != 0
lv_style_t fe_list_button_style;
#if LV_USE_FILE_EXPLORER
lv_style_t file_explorer_quick_access_style;
size_t file_explorer_count;
#endif
#if LV_USE_MEM_MONITOR
@ -228,14 +242,24 @@ typedef struct _lv_global_t {
lv_test_state_t test_state;
#endif
#if LV_USE_TRANSLATION
lv_ll_t translation_packs_ll;
const char * translation_selected_lang;
#endif
#if LV_USE_NUTTX
struct _lv_nuttx_ctx_t * nuttx_ctx;
#endif
#if LV_USE_OS != LV_OS_NONE
lv_mutex_t lv_general_mutex;
#endif
#if defined(__linux__)
lv_proc_stat_t linux_last_proc_stat;
lv_linux_proc_stat_t linux_last_proc_stat;
#if LV_SYSMON_PROC_IDLE_AVAILABLE
uint64_t linux_last_self_proc_time_ticks;
lv_linux_proc_stat_t linux_last_system_total_ticks_stat;
#endif
#endif
@ -250,7 +274,15 @@ typedef struct _lv_global_t {
lv_evdev_discovery_t * evdev_discovery;
#endif
void * user_data;
#if LV_USE_XML
const char * xml_path_prefix;
uint32_t lv_event_xml_store_timeline;
lv_ll_t xml_loads;
#endif
#if LV_USE_DRAW_EVE
lv_draw_eve_unit_t * draw_eve_unit;
#endif
} lv_global_t;
/**********************

View File

@ -23,6 +23,7 @@
#include "../misc/lv_math.h"
#include "../misc/lv_log.h"
#include "../misc/lv_types.h"
#include "../misc/lv_anim_timeline.h"
#include "../tick/lv_tick.h"
#include "../stdlib/lv_string.h"
#include "lv_obj_draw_private.h"
@ -39,6 +40,22 @@
* TYPEDEFS
**********************/
typedef struct {
lv_screen_load_anim_t anim_type;
uint32_t duration;
uint32_t delay;
union {
lv_obj_t * screen;
lv_screen_create_cb_t create_cb;
} target;
} screen_load_anim_dsc_t;
typedef struct {
lv_anim_timeline_t * at;
uint32_t delay;
bool reverse;
} timeline_play_dsc_t;
/**********************
* STATIC PROTOTYPES
**********************/
@ -50,7 +67,13 @@ 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 lv_obj_children_add_state(lv_obj_t * obj, lv_state_t state);
static void lv_obj_children_remove_state(lv_obj_t * obj, lv_state_t state);
static void null_on_delete_cb(lv_event_t * e);
static void screen_load_on_trigger_event_cb(lv_event_t * e);
static void screen_create_on_trigger_event_cb(lv_event_t * e);
static void play_timeline_on_trigger_event_cb(lv_event_t * e);
static void delete_on_screen_unloaded_event_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 *);
@ -308,6 +331,9 @@ void lv_obj_add_state(lv_obj_t * obj, lv_state_t state)
lv_state_t new_state = obj->state | state;
if(obj->state != new_state) {
update_obj_state(obj, new_state);
if(lv_obj_has_flag(obj, LV_OBJ_FLAG_STATE_TRICKLE)) {
lv_obj_children_add_state(obj, state);
}
}
}
@ -318,6 +344,9 @@ void lv_obj_remove_state(lv_obj_t * obj, lv_state_t state)
lv_state_t new_state = obj->state & (~state);
if(obj->state != new_state) {
update_obj_state(obj, new_state);
if(lv_obj_has_flag(obj, LV_OBJ_FLAG_STATE_TRICKLE)) {
lv_obj_children_remove_state(obj, state);
}
}
}
@ -461,6 +490,55 @@ lv_obj_t * lv_obj_find_by_id(const lv_obj_t * obj, const void * id)
}
#endif
void lv_obj_add_screen_load_event(lv_obj_t * obj, lv_event_code_t trigger, lv_obj_t * screen,
lv_screen_load_anim_t anim_type, uint32_t duration, uint32_t delay)
{
if(screen == NULL) {
LV_LOG_WARN("`screen` is NULL, can't load a non existing screens");
return;
}
screen_load_anim_dsc_t * dsc = lv_malloc(sizeof(screen_load_anim_dsc_t));
LV_ASSERT_MALLOC(dsc);
lv_memzero(dsc, sizeof(screen_load_anim_dsc_t));
dsc->anim_type = anim_type;
dsc->duration = duration;
dsc->delay = delay;
dsc->target.screen = screen;
lv_obj_add_event_cb(obj, screen_load_on_trigger_event_cb, trigger, dsc);
lv_obj_add_event_cb(obj, lv_event_free_user_data_cb, LV_EVENT_DELETE, dsc);
}
void lv_obj_add_screen_create_event(lv_obj_t * obj, lv_event_code_t trigger, lv_screen_create_cb_t screen_create_cb,
lv_screen_load_anim_t anim_type, uint32_t duration, uint32_t delay)
{
screen_load_anim_dsc_t * dsc = lv_malloc(sizeof(screen_load_anim_dsc_t));
LV_ASSERT_MALLOC(dsc);
lv_memzero(dsc, sizeof(screen_load_anim_dsc_t));
dsc->anim_type = anim_type;
dsc->duration = duration;
dsc->delay = delay;
dsc->target.create_cb = screen_create_cb;
lv_obj_add_event_cb(obj, screen_create_on_trigger_event_cb, trigger, dsc);
lv_obj_add_event_cb(obj, lv_event_free_user_data_cb, LV_EVENT_DELETE, dsc);
}
void lv_obj_add_play_timeline_event(lv_obj_t * obj, lv_event_code_t trigger, lv_anim_timeline_t * at, uint32_t delay,
bool reverse)
{
timeline_play_dsc_t * dsc = lv_malloc(sizeof(timeline_play_dsc_t));
LV_ASSERT_MALLOC(dsc);
lv_memzero(dsc, sizeof(timeline_play_dsc_t));
dsc->at = at;
dsc->delay = delay;
dsc->reverse = reverse;
lv_obj_add_event_cb(obj, play_timeline_on_trigger_event_cb, trigger, dsc);
lv_obj_add_event_cb(obj, lv_event_free_user_data_cb, LV_EVENT_DELETE, dsc);
}
void lv_obj_set_user_data(lv_obj_t * obj, void * user_data)
{
obj->user_data = user_data;
@ -592,14 +670,14 @@ static void lv_obj_draw(lv_event_t * e)
return;
}
if(lv_obj_get_style_bg_grad_dir(obj, 0) != LV_GRAD_DIR_NONE) {
if(lv_obj_get_style_bg_grad_opa(obj, 0) < LV_OPA_MAX ||
lv_obj_get_style_bg_main_opa(obj, 0) < LV_OPA_MAX) {
if(lv_obj_get_style_bg_grad_dir(obj, LV_PART_MAIN) != LV_GRAD_DIR_NONE) {
if(lv_obj_get_style_bg_grad_opa(obj, LV_PART_MAIN) < LV_OPA_MAX ||
lv_obj_get_style_bg_main_opa(obj, LV_PART_MAIN) < LV_OPA_MAX) {
info->res = LV_COVER_RES_NOT_COVER;
return;
}
}
const lv_grad_dsc_t * grad_dsc = lv_obj_get_style_bg_grad(obj, 0);
const lv_grad_dsc_t * grad_dsc = lv_obj_get_style_bg_grad(obj, LV_PART_MAIN);
if(grad_dsc) {
uint32_t i;
for(i = 0; i < grad_dsc->stops_count; i++) {
@ -982,6 +1060,40 @@ static void update_obj_state(lv_obj_t * obj, lv_state_t new_state)
}
}
/**
* Apply the state to the children of the object
* @param obj pointer to an object
* @param state the state to apply
*/
static void lv_obj_children_add_state(lv_obj_t * obj, lv_state_t state)
{
uint32_t child_count = lv_obj_get_child_count(obj);
for(uint32_t i = 0; i < child_count; i++) {
lv_obj_t * child = lv_obj_get_child(obj, i);
if(child) {
lv_obj_add_state(child, state);
}
}
}
/**
* Remove the state from the children of the object
* @param obj pointer to an object
* @param state the state to remove
*/
static void lv_obj_children_remove_state(lv_obj_t * obj, lv_state_t state)
{
uint32_t child_count = lv_obj_get_child_count(obj);
for(uint32_t i = 0; i < child_count; i++) {
lv_obj_t * child = lv_obj_get_child(obj, i);
if(child) {
lv_obj_remove_state(child, state);
}
}
}
static bool obj_valid_child(const lv_obj_t * parent, const lv_obj_t * obj_to_find)
{
/*Check all children of `parent`*/
@ -1009,6 +1121,61 @@ static void null_on_delete_cb(lv_event_t * e)
*obj_ptr = NULL;
}
static void screen_load_on_trigger_event_cb(lv_event_t * e)
{
screen_load_anim_dsc_t * dsc = lv_event_get_user_data(e);
LV_ASSERT_NULL(dsc);
lv_screen_load_anim(dsc->target.screen, dsc->anim_type, dsc->duration, dsc->delay, false);
}
static void screen_create_on_trigger_event_cb(lv_event_t * e)
{
screen_load_anim_dsc_t * dsc = lv_event_get_user_data(e);
LV_ASSERT_NULL(dsc);
lv_obj_t * screen = dsc->target.create_cb();
lv_screen_load_anim(screen, dsc->anim_type, dsc->duration, dsc->delay, false);
lv_obj_add_event_cb(screen, delete_on_screen_unloaded_event_cb, LV_EVENT_SCREEN_UNLOADED, NULL);
}
static void play_timeline_on_trigger_event_cb(lv_event_t * e)
{
timeline_play_dsc_t * dsc = lv_event_get_user_data(e);
LV_ASSERT_NULL(dsc);
/*Reset the progress only if the animation was finished*/
uint16_t progress = lv_anim_timeline_get_progress(dsc->at);
if(dsc->reverse) {
if(progress == 0) {
lv_anim_timeline_set_progress(dsc->at, LV_ANIM_TIMELINE_PROGRESS_MAX);
}
if(lv_anim_timeline_get_progress(dsc->at) == LV_ANIM_TIMELINE_PROGRESS_MAX) {
lv_anim_timeline_set_delay(dsc->at, dsc->delay);
}
lv_anim_timeline_set_reverse(dsc->at, true);
}
else {
if(progress == LV_ANIM_TIMELINE_PROGRESS_MAX) {
lv_anim_timeline_set_progress(dsc->at, 0);
}
if(lv_anim_timeline_get_progress(dsc->at) == 0) {
lv_anim_timeline_set_delay(dsc->at, dsc->delay);
}
lv_anim_timeline_set_reverse(dsc->at, false);
}
lv_anim_timeline_start(dsc->at);
}
static void delete_on_screen_unloaded_event_cb(lv_event_t * e)
{
lv_obj_delete(lv_event_get_target_obj(e));
}
#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

@ -38,50 +38,6 @@ extern "C" {
/**********************
* TYPEDEFS
**********************/
/**
* Possible states of a widget.
* OR-ed values are possible
*/
enum {
LV_STATE_DEFAULT = 0x0000,
LV_STATE_CHECKED = 0x0001,
LV_STATE_FOCUSED = 0x0002,
LV_STATE_FOCUS_KEY = 0x0004,
LV_STATE_EDITED = 0x0008,
LV_STATE_HOVERED = 0x0010,
LV_STATE_PRESSED = 0x0020,
LV_STATE_SCROLLED = 0x0040,
LV_STATE_DISABLED = 0x0080,
LV_STATE_USER_1 = 0x1000,
LV_STATE_USER_2 = 0x2000,
LV_STATE_USER_3 = 0x4000,
LV_STATE_USER_4 = 0x8000,
LV_STATE_ANY = 0xFFFF, /**< Special value can be used in some functions to target all states*/
};
/**
* The possible parts of widgets.
* The parts can be considered as the internal building block of the widgets.
* E.g. slider = background + indicator + knob
* Not all parts are used by every widget
*/
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*/
LV_PART_KNOB = 0x030000, /**< Like handle to grab to adjust the value*/
LV_PART_SELECTED = 0x040000, /**< Indicate the currently selected option or section*/
LV_PART_ITEMS = 0x050000, /**< Used if the widget has multiple similar elements (e.g. table cells)*/
LV_PART_CURSOR = 0x060000, /**< Mark a specific place e.g. for text area's cursor or on a chart*/
LV_PART_CUSTOM_FIRST = 0x080000, /**< Extension point for custom widgets*/
LV_PART_ANY = 0x0F0000, /**< Special value can be used in some functions to target all parts*/
};
/**
* On/Off features controlling the object's behavior.
* OR-ed values are possible
@ -112,12 +68,14 @@ typedef enum {
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*/
#if LV_USE_FLEX
LV_OBJ_FLAG_FLEX_IN_NEW_TRACK = (1L << 21), /**< Start a new flex track on this item*/
#endif
LV_OBJ_FLAG_EVENT_TRICKLE = (1L << 21), /**< Propagate the events to the children too*/
LV_OBJ_FLAG_STATE_TRICKLE = (1L << 22), /**< Propagate the states to the children too*/
LV_OBJ_FLAG_LAYOUT_1 = (1L << 23), /**< Custom flag, free to use by layouts*/
LV_OBJ_FLAG_LAYOUT_2 = (1L << 24), /**< Custom flag, free to use by layouts*/
#if LV_USE_FLEX
LV_OBJ_FLAG_FLEX_IN_NEW_TRACK = LV_OBJ_FLAG_LAYOUT_1, /**< Start a new flex track on this item*/
#endif
LV_OBJ_FLAG_WIDGET_1 = (1L << 25), /**< Custom flag, free to use by widget*/
LV_OBJ_FLAG_WIDGET_2 = (1L << 26), /**< Custom flag, free to use by widget*/
@ -128,7 +86,7 @@ typedef enum {
} lv_obj_flag_t;
#if LV_USE_OBJ_PROPERTY
enum {
enum _lv_signed_prop_id_t {
/*OBJ flag properties */
LV_PROPERTY_ID(OBJ, FLAG_START, LV_PROPERTY_TYPE_INT, 0),
LV_PROPERTY_ID(OBJ, FLAG_HIDDEN, LV_PROPERTY_TYPE_INT, 0),
@ -152,9 +110,11 @@ enum {
LV_PROPERTY_ID(OBJ, FLAG_FLOATING, LV_PROPERTY_TYPE_INT, 18),
LV_PROPERTY_ID(OBJ, FLAG_SEND_DRAW_TASK_EVENTS, LV_PROPERTY_TYPE_INT, 19),
LV_PROPERTY_ID(OBJ, FLAG_OVERFLOW_VISIBLE, LV_PROPERTY_TYPE_INT, 20),
LV_PROPERTY_ID(OBJ, FLAG_FLEX_IN_NEW_TRACK, LV_PROPERTY_TYPE_INT, 21),
LV_PROPERTY_ID(OBJ, FLAG_EVENT_TRICKLE, LV_PROPERTY_TYPE_INT, 21),
LV_PROPERTY_ID(OBJ, FLAG_STATE_TRICKLE, LV_PROPERTY_TYPE_INT, 22),
LV_PROPERTY_ID(OBJ, FLAG_LAYOUT_1, LV_PROPERTY_TYPE_INT, 23),
LV_PROPERTY_ID(OBJ, FLAG_LAYOUT_2, LV_PROPERTY_TYPE_INT, 24),
LV_PROPERTY_ID(OBJ, FLAG_FLEX_IN_NEW_TRACK, LV_PROPERTY_TYPE_INT, 23), /*Mapped to FLAG_LAYOUT_1*/
LV_PROPERTY_ID(OBJ, FLAG_WIDGET_1, LV_PROPERTY_TYPE_INT, 25),
LV_PROPERTY_ID(OBJ, FLAG_WIDGET_2, LV_PROPERTY_TYPE_INT, 26),
LV_PROPERTY_ID(OBJ, FLAG_USER_1, LV_PROPERTY_TYPE_INT, 27),
@ -383,6 +343,43 @@ bool lv_obj_is_valid(const lv_obj_t * obj);
*/
void lv_obj_null_on_delete(lv_obj_t ** obj_ptr);
/**
* Add an event handler to a widget that will load a screen on a trigger.
* @param obj pointer to widget which should load the screen
* @param trigger an event code, e.g. `LV_EVENT_CLICKED`
* @param screen the screen to load (must be a valid widget)
* @param anim_type element of `lv_screen_load_anim_t` the screen load animation
* @param duration duration of the animation in milliseconds
* @param delay delay before the screen load in milliseconds
*/
void lv_obj_add_screen_load_event(lv_obj_t * obj, lv_event_code_t trigger, lv_obj_t * screen,
lv_screen_load_anim_t anim_type, uint32_t duration, uint32_t delay);
/**
* Add an event handler to a widget that will create a screen on a trigger.
* The created screen will be deleted when it's unloaded
* @param obj pointer to widget which should load the screen
* @param trigger an event code, e.g. `LV_EVENT_CLICKED`
* @param screen_create_cb a callback to create the screen, e.g. `lv_obj_t * myscreen_create(void)`
* @param anim_type element of `lv_screen_load_anim_t` the screen load animation
* @param duration duration of the animation in milliseconds
* @param delay delay before the screen load in milliseconds
*/
void lv_obj_add_screen_create_event(lv_obj_t * obj, lv_event_code_t trigger, lv_screen_create_cb_t screen_create_cb,
lv_screen_load_anim_t anim_type, uint32_t duration, uint32_t delay);
/**
* Play a timeline animation on a trigger
* @param obj pointer to widget which should trigger playing the animation
* @param trigger an event code, e.g. `LV_EVENT_CLICKED`
* @param at pointer to an animation timeline
* @param delay wait time before starting the animation
* @param reverse true: play in reverse
*/
void lv_obj_add_play_timeline_event(lv_obj_t * obj, lv_event_code_t trigger, lv_anim_timeline_t * at, uint32_t delay,
bool reverse);
#if LV_USE_OBJ_ID
/**
* Set an id for an object.

View File

@ -132,6 +132,8 @@ void lv_obj_init_draw_rect_dsc(lv_obj_t * obj, lv_part_t part, lv_draw_rect_dsc_
draw_dsc->bg_image_recolor = lv_color_make(result.red, result.green, result.blue);
draw_dsc->bg_image_tiled = lv_obj_get_style_bg_image_tiled(obj, part);
}
draw_dsc->bg_image_colorkey = lv_obj_get_style_image_colorkey(obj, part);
}
}
}
@ -234,6 +236,8 @@ void lv_obj_init_draw_image_dsc(lv_obj_t * obj, lv_part_t part, lv_draw_image_ds
draw_dsc->recolor_opa = result.alpha;
draw_dsc->recolor = lv_color_make(result.red, result.green, result.blue);
draw_dsc->colorkey = lv_obj_get_style_image_colorkey(obj, part);
if(part != LV_PART_MAIN) draw_dsc->blend_mode = lv_obj_get_style_blend_mode(obj, part);
LV_PROFILER_DRAW_END;

View File

@ -20,6 +20,7 @@ extern "C" {
#include "../draw/lv_draw_line.h"
#include "../draw/lv_draw_arc.h"
#include "../draw/lv_draw_triangle.h"
#include "lv_obj_style.h"
/*********************
* DEFINES
@ -36,7 +37,7 @@ typedef enum {
/**Simple layer means that the layer can be rendered in chunks.
* For example with opa_layered = 140 it's possible to render only 10 lines
* from the layer. When it's ready go the the next 10 lines.
* from the layer. When it's ready go to the next 10 lines.
* It avoids large memory allocations for the layer buffer.
* The buffer size for a chunk can be set by `LV_DRAW_LAYER_SIMPLE_BUF_SIZE` in lv_conf.h.*/
LV_LAYER_TYPE_SIMPLE,

View File

@ -27,6 +27,7 @@
**********************/
static lv_result_t event_send_core(lv_event_t * e);
static bool event_is_bubbled(lv_event_t * e);
static bool event_is_trickled(lv_event_t * e);
/**********************
* STATIC VARIABLES
@ -60,6 +61,7 @@ lv_result_t lv_obj_send_event(lv_obj_t * obj, lv_event_code_t event_code, void *
e.deleted = 0;
e.stop_bubbling = 0;
e.stop_processing = 0;
e.stop_trickling = 0;
lv_event_push(&e);
@ -140,8 +142,11 @@ uint32_t lv_obj_remove_event_cb(lv_obj_t * obj, lv_event_cb_t event_cb)
uint32_t event_cnt = lv_obj_get_event_count(obj);
uint32_t removed_count = 0;
uint32_t i;
for(i = 0; i < event_cnt; i++) {
int32_t i;
if(event_cnt == 0) return 0;
for(i = event_cnt - 1; i >= 0; i--) {
lv_event_dsc_t * dsc = lv_obj_get_event_dsc(obj, i);
if(dsc && dsc->cb == event_cb) {
lv_obj_remove_event(obj, i);
@ -352,7 +357,6 @@ static lv_result_t event_send_core(lv_event_t * e)
{
LV_TRACE_EVENT("Sending event %d to %p with %p param", e->code, (void *)e->original_target, e->param);
/*Call the input device's feedback callback if set*/
lv_indev_t * indev_act = lv_indev_active();
if(indev_act) {
if(e->stop_processing) return LV_RESULT_OK;
@ -377,6 +381,27 @@ static lv_result_t event_send_core(lv_event_t * e)
e->current_target = parent;
res = event_send_core(e);
}
if(res != LV_RESULT_OK) return res;
/*Trickle down to children if enabled*/
if(event_is_trickled(e)) {
uint32_t child_count = lv_obj_get_child_count(target);
/* we don't want the event to bubble up again when trickling down */
e->stop_bubbling = 1;
for(uint32_t i = 0; i < child_count && res == LV_RESULT_OK && !e->stop_processing; i++) {
lv_obj_t * child = lv_obj_get_child(target, i);
if(child) {
e->current_target = child;
res = event_send_core(e);
if(res != LV_RESULT_OK) {
LV_LOG_WARN("Trickle down event %d to child %p failed", e->code, (void *)child);
break;
}
}
}
}
return res;
}
@ -421,3 +446,35 @@ static bool event_is_bubbled(lv_event_t * e)
return true;
}
}
static bool event_is_trickled(lv_event_t * e)
{
if(e->stop_trickling) return false;
/*Check other codes only if trickle is enabled*/
if(lv_obj_has_flag(e->current_target, LV_OBJ_FLAG_EVENT_TRICKLE) == false) return false;
switch(e->code) {
case LV_EVENT_HIT_TEST:
case LV_EVENT_COVER_CHECK:
case LV_EVENT_REFR_EXT_DRAW_SIZE:
case LV_EVENT_DRAW_MAIN_BEGIN:
case LV_EVENT_DRAW_MAIN:
case LV_EVENT_DRAW_MAIN_END:
case LV_EVENT_DRAW_POST_BEGIN:
case LV_EVENT_DRAW_POST:
case LV_EVENT_DRAW_POST_END:
case LV_EVENT_DRAW_TASK_ADDED:
case LV_EVENT_REFRESH:
case LV_EVENT_DELETE:
case LV_EVENT_CHILD_CREATED:
case LV_EVENT_CHILD_DELETED:
case LV_EVENT_CHILD_CHANGED:
case LV_EVENT_SIZE_CHANGED:
case LV_EVENT_STYLE_CHANGED:
case LV_EVENT_GET_SELF_SIZE:
return false;
default:
return true;
}
}

View File

@ -1,5 +1,5 @@
/**
* @file lv_obj_id.c
* @file lv_obj_id_builtin.c
*
*/
@ -9,7 +9,7 @@
#include "lv_obj_class_private.h"
#include "lv_obj_private.h"
#include "lv_global.h"
#include "../osal/lv_os.h"
#include "../osal/lv_os_private.h"
#include "../stdlib/lv_sprintf.h"
/*********************

View File

@ -84,6 +84,56 @@ void lv_obj_set_y(lv_obj_t * obj, int32_t y)
}
}
static int32_t calc_dynamic_width(lv_obj_t * obj, int32_t width, int32_t * const content_width)
{
if(width == LV_SIZE_CONTENT) {
if(*content_width < 0) {
*content_width = calc_content_width(obj);
}
width = *content_width;
}
else if(LV_COORD_IS_PCT(width)) {
lv_obj_t * parent = lv_obj_get_parent(obj);
if(parent->w_layout == 0 && lv_obj_get_style_width(parent, 0) == LV_SIZE_CONTENT) {
/*If parent has content size and the child has pct size
*a circular dependency will occur. To solve it keep child size at zero */
width = lv_obj_get_style_space_left(obj, 0) + lv_obj_get_style_space_right(obj, 0);
}
else {
int32_t parent_w = lv_obj_get_content_width(parent);
width = (LV_COORD_GET_PCT(width) * parent_w) / 100;
width -= lv_obj_get_style_margin_left(obj, LV_PART_MAIN) + lv_obj_get_style_margin_right(obj, LV_PART_MAIN);
}
}
return width;
}
static int32_t calc_dynamic_height(lv_obj_t * obj, int32_t height, int32_t * const content_height)
{
if(height == LV_SIZE_CONTENT) {
if(*content_height < 0) {
*content_height = calc_content_height(obj);
}
height = *content_height;
}
else if(LV_COORD_IS_PCT(height)) {
lv_obj_t * parent = lv_obj_get_parent(obj);
if(parent->h_layout == 0 && lv_obj_get_style_height(parent, 0) == LV_SIZE_CONTENT) {
/*If parent has content size and the child has pct size
*a circular dependency will occur. To solve it keep child size at zero */
height = lv_obj_get_style_space_top(obj, 0) + lv_obj_get_style_space_bottom(obj, 0);
}
else {
int32_t parent_h = lv_obj_get_content_height(parent);
height = (LV_COORD_GET_PCT(height) * parent_h) / 100;
height -=
lv_obj_get_style_margin_top(obj, LV_PART_MAIN) + lv_obj_get_style_margin_bottom(obj, LV_PART_MAIN);
}
}
return height;
}
bool lv_obj_refr_size(lv_obj_t * obj)
{
LV_ASSERT_OBJ(obj, MY_CLASS);
@ -94,74 +144,34 @@ bool lv_obj_refr_size(lv_obj_t * obj)
lv_obj_t * parent = lv_obj_get_parent(obj);
if(parent == NULL) return false;
bool w_is_content = false;
bool w_is_pct = false;
int32_t w;
if(obj->w_layout) {
w = lv_obj_get_width(obj);
}
else {
w = lv_obj_get_style_width(obj, LV_PART_MAIN);
w_is_content = w == LV_SIZE_CONTENT;
w_is_pct = LV_COORD_IS_PCT(w);
int32_t parent_w = lv_obj_get_content_width(parent);
if(w_is_content) {
w = calc_content_width(obj);
}
else if(w_is_pct) {
/*If parent has content size and the child has pct size
*a circular dependency will occur. To solve it keep child size at zero */
if(parent->w_layout == 0 && lv_obj_get_style_width(parent, 0) == LV_SIZE_CONTENT) {
w = lv_obj_get_style_space_left(obj, 0) + lv_obj_get_style_space_right(obj, 0);
}
else {
w = (LV_COORD_GET_PCT(w) * parent_w) / 100;
w -= lv_obj_get_style_margin_left(obj, LV_PART_MAIN) + lv_obj_get_style_margin_right(obj, LV_PART_MAIN);
}
}
int32_t minw = lv_obj_get_style_min_width(obj, LV_PART_MAIN);
int32_t maxw = lv_obj_get_style_max_width(obj, LV_PART_MAIN);
w = lv_clamp_width(w, minw, maxw, parent_w);
int32_t content_width = -1;
w = calc_dynamic_width(obj, lv_obj_get_style_width(obj, LV_PART_MAIN), &content_width);
int32_t minw = calc_dynamic_width(obj, lv_obj_get_style_min_width(obj, LV_PART_MAIN), &content_width);
int32_t maxw = calc_dynamic_width(obj, lv_obj_get_style_max_width(obj, LV_PART_MAIN), &content_width);
w = LV_CLAMP(minw, w, maxw);
}
int32_t h;
bool h_is_content = false;
bool h_is_pct = false;
if(obj->h_layout) {
h = lv_obj_get_height(obj);
}
else {
h = lv_obj_get_style_height(obj, LV_PART_MAIN);
h_is_content = h == LV_SIZE_CONTENT;
h_is_pct = LV_COORD_IS_PCT(h);
int32_t parent_h = lv_obj_get_content_height(parent);
if(h_is_content) {
h = calc_content_height(obj);
}
else if(h_is_pct) {
/*If parent has content size and the child has pct size
*a circular dependency will occur. To solve it keep child size at zero */
if(parent->h_layout == 0 && lv_obj_get_style_height(parent, 0) == LV_SIZE_CONTENT) {
h = lv_obj_get_style_space_top(obj, 0) + lv_obj_get_style_space_bottom(obj, 0);
}
else {
h = (LV_COORD_GET_PCT(h) * parent_h) / 100;
h -= lv_obj_get_style_margin_top(obj, LV_PART_MAIN) + lv_obj_get_style_margin_bottom(obj, LV_PART_MAIN);
}
}
int32_t minh = lv_obj_get_style_min_height(obj, LV_PART_MAIN);
int32_t maxh = lv_obj_get_style_max_height(obj, LV_PART_MAIN);
h = lv_clamp_height(h, minh, maxh, parent_h);
int32_t content_height = -1;
h = calc_dynamic_height(obj, lv_obj_get_style_height(obj, LV_PART_MAIN), &content_height);
int32_t minh = calc_dynamic_height(obj, lv_obj_get_style_min_height(obj, LV_PART_MAIN), &content_height);
int32_t maxh = calc_dynamic_height(obj, lv_obj_get_style_max_height(obj, LV_PART_MAIN), &content_height);
h = LV_CLAMP(minh, h, maxh);
}
/*Do nothing if the size is not changed*/
/*It is very important else recursive resizing can occur without size change*/
if(lv_obj_get_width(obj) == w && lv_obj_get_height(obj) == h) return false;
if(lv_obj_get_width(obj) == w && lv_obj_get_height(obj) == h)
return false;
/*Invalidate the original area*/
lv_obj_invalidate(obj);
@ -177,7 +187,8 @@ 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);
if(!on1) lv_obj_scrollbar_invalidate(parent);
if(!on1)
lv_obj_scrollbar_invalidate(parent);
/*Set the length and height
*Be sure the content is not scrolled in an invalid position on the new size*/
@ -203,7 +214,8 @@ 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);
if(on1 || (!on1 && on2)) lv_obj_scrollbar_invalidate(parent);
if(on1 || (!on1 && on2))
lv_obj_scrollbar_invalidate(parent);
lv_obj_refresh_ext_draw_size(obj);
@ -627,12 +639,12 @@ void lv_obj_refr_pos(lv_obj_t * obj)
int32_t pw = lv_obj_get_content_width(parent);
int32_t ph = lv_obj_get_content_height(parent);
if(LV_COORD_IS_PCT(x)) {
if(lv_obj_get_style_width(parent, 0) == LV_SIZE_CONTENT) x = 0; /*Avoid circular dependency*/
if(lv_obj_get_style_width(parent, LV_PART_MAIN) == LV_SIZE_CONTENT) x = 0; /*Avoid circular dependency*/
else x = (pw * LV_COORD_GET_PCT(x)) / 100;
}
if(LV_COORD_IS_PCT(y)) {
if(lv_obj_get_style_height(parent, 0) == LV_SIZE_CONTENT) y = 0; /*Avoid circular dependency*/
if(lv_obj_get_style_height(parent, LV_PART_MAIN) == LV_SIZE_CONTENT) y = 0; /*Avoid circular dependency*/
y = (ph * LV_COORD_GET_PCT(y)) / 100;
}
@ -997,7 +1009,7 @@ void lv_obj_set_transform(lv_obj_t * obj, const lv_matrix_t * matrix)
lv_obj_allocate_spec_attr(obj);
if(!obj->spec_attr->matrix) {
obj->spec_attr->matrix = lv_malloc(sizeof(lv_matrix_t));;
obj->spec_attr->matrix = lv_malloc(sizeof(lv_matrix_t));
LV_ASSERT_MALLOC(obj->spec_attr->matrix);
}
@ -1096,7 +1108,7 @@ static int32_t calc_content_width(lv_obj_t * obj)
if(lv_obj_has_flag_any(child, LV_OBJ_FLAG_HIDDEN | LV_OBJ_FLAG_FLOATING)) continue;
if(!lv_obj_is_layout_positioned(child)) {
lv_align_t align = lv_obj_get_style_align(child, 0);
lv_align_t align = lv_obj_get_style_align(child, LV_PART_MAIN);
switch(align) {
case LV_ALIGN_DEFAULT:
case LV_ALIGN_TOP_RIGHT:
@ -1108,7 +1120,7 @@ static int32_t calc_content_width(lv_obj_t * obj)
default:
/* Consider other cases only if x=0 and use the width of the object.
* With x!=0 circular dependency could occur. */
if(lv_obj_get_style_x(child, 0) == 0) {
if(lv_obj_get_style_x(child, LV_PART_MAIN) == 0) {
child_res_tmp = lv_area_get_width(&child->coords) + space_right;
child_res_tmp += lv_obj_get_style_margin_left(child, LV_PART_MAIN);
}
@ -1132,7 +1144,7 @@ static int32_t calc_content_width(lv_obj_t * obj)
if(lv_obj_has_flag_any(child, LV_OBJ_FLAG_HIDDEN | LV_OBJ_FLAG_FLOATING)) continue;
if(!lv_obj_is_layout_positioned(child)) {
lv_align_t align = lv_obj_get_style_align(child, 0);
lv_align_t align = lv_obj_get_style_align(child, LV_PART_MAIN);
switch(align) {
case LV_ALIGN_DEFAULT:
case LV_ALIGN_TOP_LEFT:
@ -1144,7 +1156,7 @@ static int32_t calc_content_width(lv_obj_t * obj)
default:
/* Consider other cases only if x=0 and use the width of the object.
* With x!=0 circular dependency could occur. */
if(lv_obj_get_style_x(child, 0) == 0) {
if(lv_obj_get_style_x(child, LV_PART_MAIN) == 0) {
child_res_tmp = lv_area_get_width(&child->coords) + space_left;
child_res_tmp += lv_obj_get_style_margin_right(child, LV_PART_MAIN);
}
@ -1189,7 +1201,7 @@ static int32_t calc_content_height(lv_obj_t * obj)
if(lv_obj_has_flag_any(child, LV_OBJ_FLAG_HIDDEN | LV_OBJ_FLAG_FLOATING)) continue;
if(!lv_obj_is_layout_positioned(child)) {
lv_align_t align = lv_obj_get_style_align(child, 0);
lv_align_t align = lv_obj_get_style_align(child, LV_PART_MAIN);
switch(align) {
case LV_ALIGN_DEFAULT:
case LV_ALIGN_TOP_RIGHT:
@ -1201,7 +1213,7 @@ static int32_t calc_content_height(lv_obj_t * obj)
default:
/* Consider other cases only if y=0 and use the height of the object.
* With y!=0 circular dependency could occur. */
if(lv_obj_get_style_y(child, 0) == 0) {
if(lv_obj_get_style_y(child, LV_PART_MAIN) == 0) {
child_res_tmp = lv_area_get_height(&child->coords) + space_top;
child_res_tmp += lv_obj_get_style_margin_top(child, LV_PART_MAIN);
}
@ -1273,17 +1285,17 @@ static void transform_point_array(const lv_obj_t * obj, lv_point_t * p, size_t p
}
#endif /* LV_DRAW_TRANSFORM_USE_MATRIX */
int32_t angle = lv_obj_get_style_transform_rotation(obj, 0);
int32_t scale_x = lv_obj_get_style_transform_scale_x_safe(obj, 0);
int32_t scale_y = lv_obj_get_style_transform_scale_y_safe(obj, 0);
int32_t angle = lv_obj_get_style_transform_rotation(obj, LV_PART_MAIN);
int32_t scale_x = lv_obj_get_style_transform_scale_x_safe(obj, LV_PART_MAIN);
int32_t scale_y = lv_obj_get_style_transform_scale_y_safe(obj, LV_PART_MAIN);
if(scale_x == 0) scale_x = 1;
if(scale_y == 0) scale_y = 1;
if(angle == 0 && scale_x == LV_SCALE_NONE && scale_y == LV_SCALE_NONE) return;
lv_point_t pivot = {
.x = lv_obj_get_style_transform_pivot_x(obj, 0),
.y = lv_obj_get_style_transform_pivot_y(obj, 0)
.x = lv_obj_get_style_transform_pivot_x(obj, LV_PART_MAIN),
.y = lv_obj_get_style_transform_pivot_y(obj, LV_PART_MAIN)
};
if(LV_COORD_IS_PCT(pivot.x)) {

View File

@ -67,7 +67,7 @@ struct _lv_obj_t {
#endif
lv_area_t coords;
lv_obj_flag_t flags;
lv_state_t state;
uint16_t state;
uint16_t layout_inv : 1;
uint16_t readjust_scroll_after_layout : 1;
uint16_t scr_layout_inv : 1;
@ -78,7 +78,6 @@ struct _lv_obj_t {
uint16_t is_deleting : 1;
};
/**********************
* GLOBAL PROTOTYPES
**********************/

View File

@ -1,5 +1,5 @@
/**
* @file lv_obj_id.c
* @file lv_obj_property.c
*
*/

View File

@ -38,7 +38,19 @@ extern "C" {
#define LV_PROPERTY_TYPE_SHIFT 28
#define LV_PROPERTY_TYPE2_SHIFT 24
#define LV_PROPERTY_ID(clz, name, type, index) LV_PROPERTY_## clz ##_##name = (LV_PROPERTY_## clz ##_START + (index)) | ((type) << LV_PROPERTY_TYPE_SHIFT)
/* Example:
* LV_PROPERTY_ID(OBJ, FLAG_CLICKABLE, LV_PROPERTY_TYPE_INT, 1),
* produces
* LV_PROPERTY_OBJ_FLAG_CLICKABLE = (LV_PROPERTY_OBJ_START + (1)) | ((LV_PROPERTY_TYPE_INT) << LV_PROPERTY_TYPE_SHIFT)
*/
#define LV_PROPERTY_ID(clz, name, type, index) LV_PROPERTY_## clz ##_##name = (LV_PROPERTY_## clz ##_START + ((int)index)) | ((type) << LV_PROPERTY_TYPE_SHIFT)
/* Example:
* LV_PROPERTY_ID2(SLIDER, VALUE, LV_PROPERTY_TYPE_INT, LV_PROPERTY_TYPE_BOOL, 0)
* produces
* LV_PROPERTY_SLIDER_VALUE = (LV_PROPERTY_SLIDER_START + (0)) | ((LV_PROPERTY_TYPE_INT) << LV_PROPERTY_TYPE_SHIFT) | ((LV_PROPERTY_TYPE_BOOL) << LV_PROPERTY_TYPE2_SHIFT)
*/
#define LV_PROPERTY_ID2(clz, name, type, type2, index) LV_PROPERTY_ID(clz, name, type, index) | ((type2) << LV_PROPERTY_TYPE2_SHIFT)
#define LV_PROPERTY_ID_TYPE(id) ((id) >> LV_PROPERTY_TYPE_SHIFT)
@ -56,7 +68,7 @@ extern "C" {
/**
* Group of predefined widget ID start value.
*/
enum {
enum _lv_prop_id_range_boundary_t {
LV_PROPERTY_ID_INVALID = 0,
/*ID 0x01 to 0xff are style ID, check lv_style_prop_t*/

View File

@ -36,14 +36,6 @@ typedef struct {
lv_style_value_t end_value;
} trans_t;
typedef enum {
CACHE_ZERO = 0,
CACHE_TRUE = 1,
CACHE_UNSET = 2,
CACHE_255 = 3,
CACHE_NEED_CHECK = 4,
} cache_t;
/**********************
* GLOBAL PROTOTYPES
**********************/
@ -52,7 +44,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, lv_part_t part);
static lv_obj_style_t * get_trans_style(lv_obj_t * obj, lv_style_selector_t selector);
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);
@ -272,7 +264,7 @@ void lv_obj_report_style_change(lv_style_t * style)
}
}
void lv_obj_refresh_style(lv_obj_t * obj, lv_style_selector_t selector, lv_style_prop_t prop)
void lv_obj_refresh_style(lv_obj_t * obj, lv_part_t part, lv_style_prop_t prop)
{
LV_ASSERT_OBJ(obj, MY_CLASS);
@ -282,8 +274,6 @@ void lv_obj_refresh_style(lv_obj_t * obj, lv_style_selector_t selector, lv_style
lv_obj_invalidate(obj);
lv_part_t part = lv_obj_style_get_selector_part(selector);
bool is_layout_refr = lv_style_prop_has_flag(prop, LV_STYLE_PROP_FLAG_LAYOUT_UPDATE);
bool is_ext_draw = lv_style_prop_has_flag(prop, LV_STYLE_PROP_FLAG_EXT_DRAW_UPDATE);
bool is_inheritable = lv_style_prop_has_flag(prop, LV_STYLE_PROP_FLAG_INHERITABLE);
@ -292,8 +282,8 @@ void lv_obj_refresh_style(lv_obj_t * obj, lv_style_selector_t selector, lv_style
if(is_layout_refr) {
if(part == LV_PART_ANY ||
part == LV_PART_MAIN ||
lv_obj_get_style_height(obj, 0) == LV_SIZE_CONTENT ||
lv_obj_get_style_width(obj, 0) == LV_SIZE_CONTENT) {
lv_obj_get_style_height(obj, LV_PART_MAIN) == LV_SIZE_CONTENT ||
lv_obj_get_style_width(obj, LV_PART_MAIN) == LV_SIZE_CONTENT) {
lv_obj_send_event(obj, LV_EVENT_STYLE_CHANGED, NULL);
lv_obj_mark_layout_as_dirty(obj);
}
@ -322,6 +312,37 @@ void lv_obj_refresh_style(lv_obj_t * obj, lv_style_selector_t selector, lv_style
LV_PROFILER_STYLE_END;
}
void lv_obj_style_set_disabled(lv_obj_t * obj, const lv_style_t * style, lv_style_selector_t selector, bool dis)
{
uint32_t i;
for(i = 0; i < obj->style_cnt; i++) {
if(obj->styles[i].style == style && obj->styles[i].selector == selector) {
if(dis == obj->styles[i].is_disabled) {
return; /*Already in the right state*/
}
obj->styles[i].is_disabled = dis;
full_cache_refresh(obj, lv_obj_style_get_selector_part(selector));
lv_obj_refresh_style(obj, selector, LV_STYLE_PROP_ANY);
return;
}
}
LV_LOG_WARN("%p style was not found on %p widget with %6" LV_PRIx32 " selector", (void *)style, (void *)obj, selector);
}
bool lv_obj_style_get_disabled(lv_obj_t * obj, const lv_style_t * style, lv_style_selector_t selector)
{
uint32_t i;
for(i = 0; i < obj->style_cnt; i++) {
if(obj->styles[i].style == style && obj->styles[i].selector == selector) {
return obj->styles[i].is_disabled;
}
}
LV_LOG_WARN("%p style was not found on %p widget with %6" LV_PRIx32 " selector", (void *)style, (void *)obj, selector);
return false;
}
void lv_obj_enable_style_refresh(bool en)
{
style_refr = en;
@ -573,7 +594,7 @@ void lv_obj_fade_out(lv_obj_t * obj, uint32_t time, uint32_t delay)
lv_anim_t a;
lv_anim_init(&a);
lv_anim_set_var(&a, obj);
lv_anim_set_values(&a, lv_obj_get_style_opa(obj, 0), LV_OPA_TRANSP);
lv_anim_set_values(&a, lv_obj_get_style_opa(obj, LV_PART_MAIN), LV_OPA_TRANSP);
lv_anim_set_exec_cb(&a, fade_anim_cb);
lv_anim_set_duration(&a, time);
lv_anim_set_delay(&a, delay);
@ -773,6 +794,7 @@ static lv_style_res_t get_prop_core(const lv_obj_t * obj, lv_style_selector_t se
lv_obj_style_t * obj_style = &obj->styles[i];
if(obj_style->is_trans == false) break;
if(skip_trans) continue;
if(obj_style->is_disabled) continue;
lv_part_t part_act = lv_obj_style_get_selector_part(obj->styles[i].selector);
@ -786,6 +808,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;
if(obj->styles[i].is_disabled) continue;
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;
@ -796,7 +819,7 @@ static lv_style_res_t get_prop_core(const lv_obj_t * obj, lv_style_selector_t se
if((state_act & state_inv)) continue;
/*Check only better candidates*/
if(state_act <= weight) continue;
if((int32_t)state_act <= weight) continue;
found = lv_style_get_prop_inlined(obj_style->style, prop, v);
if(found == LV_STYLE_RES_FOUND) {
@ -1026,14 +1049,14 @@ static lv_layer_type_t calculate_layer_type(lv_obj_t * obj)
#if LV_DRAW_TRANSFORM_USE_MATRIX
if(lv_obj_get_transform(obj) != NULL) return LV_LAYER_TYPE_TRANSFORM;
#endif
if(lv_obj_get_style_transform_rotation(obj, 0) != 0) return LV_LAYER_TYPE_TRANSFORM;
if(lv_obj_get_style_transform_scale_x(obj, 0) != 256) return LV_LAYER_TYPE_TRANSFORM;
if(lv_obj_get_style_transform_scale_y(obj, 0) != 256) return LV_LAYER_TYPE_TRANSFORM;
if(lv_obj_get_style_transform_skew_x(obj, 0) != 0) return LV_LAYER_TYPE_TRANSFORM;
if(lv_obj_get_style_transform_skew_y(obj, 0) != 0) return LV_LAYER_TYPE_TRANSFORM;
if(lv_obj_get_style_opa_layered(obj, 0) != LV_OPA_COVER) return LV_LAYER_TYPE_SIMPLE;
if(lv_obj_get_style_bitmap_mask_src(obj, 0) != NULL) return LV_LAYER_TYPE_SIMPLE;
if(lv_obj_get_style_blend_mode(obj, 0) != LV_BLEND_MODE_NORMAL) return LV_LAYER_TYPE_SIMPLE;
if(lv_obj_get_style_transform_rotation(obj, LV_PART_MAIN) != 0) return LV_LAYER_TYPE_TRANSFORM;
if(lv_obj_get_style_transform_scale_x(obj, LV_PART_MAIN) != 256) return LV_LAYER_TYPE_TRANSFORM;
if(lv_obj_get_style_transform_scale_y(obj, LV_PART_MAIN) != 256) return LV_LAYER_TYPE_TRANSFORM;
if(lv_obj_get_style_transform_skew_x(obj, LV_PART_MAIN) != 0) return LV_LAYER_TYPE_TRANSFORM;
if(lv_obj_get_style_transform_skew_y(obj, LV_PART_MAIN) != 0) return LV_LAYER_TYPE_TRANSFORM;
if(lv_obj_get_style_opa_layered(obj, LV_PART_MAIN) != LV_OPA_COVER) return LV_LAYER_TYPE_SIMPLE;
if(lv_obj_get_style_bitmap_mask_src(obj, LV_PART_MAIN) != NULL) return LV_LAYER_TYPE_SIMPLE;
if(lv_obj_get_style_blend_mode(obj, LV_PART_MAIN) != LV_BLEND_MODE_NORMAL) return LV_LAYER_TYPE_SIMPLE;
return LV_LAYER_TYPE_NONE;
}
@ -1045,6 +1068,7 @@ static void full_cache_refresh(lv_obj_t * obj, lv_part_t part)
obj->style_main_prop_is_set = 0;
for(i = 0; i < obj->style_cnt; i++) {
if(lv_obj_style_get_selector_part(obj->styles[i].selector) != LV_PART_MAIN) continue;
if(obj->styles[i].is_disabled) continue;
lv_style_t * style = (lv_style_t *)obj->styles[i].style;
uint32_t j;
if(lv_style_is_const(style)) {
@ -1065,6 +1089,8 @@ static void full_cache_refresh(lv_obj_t * obj, lv_part_t part)
obj->style_other_prop_is_set = 0;
for(i = 0; i < obj->style_cnt; i++) {
if(lv_obj_style_get_selector_part(obj->styles[i].selector) == LV_PART_MAIN) continue;
if(obj->styles[i].is_disabled) continue;
lv_style_t * style = (lv_style_t *)obj->styles[i].style;
uint32_t j;
if(lv_style_is_const(style)) {

View File

@ -25,6 +25,49 @@ extern "C" {
* TYPEDEFS
**********************/
/**
* Possible states of a widget.
* OR-ed values are possible
*/
typedef enum {
LV_STATE_DEFAULT = 0x0000,
LV_STATE_CHECKED = 0x0001,
LV_STATE_FOCUSED = 0x0002,
LV_STATE_FOCUS_KEY = 0x0004,
LV_STATE_EDITED = 0x0008,
LV_STATE_HOVERED = 0x0010,
LV_STATE_PRESSED = 0x0020,
LV_STATE_SCROLLED = 0x0040,
LV_STATE_DISABLED = 0x0080,
LV_STATE_USER_1 = 0x1000,
LV_STATE_USER_2 = 0x2000,
LV_STATE_USER_3 = 0x4000,
LV_STATE_USER_4 = 0x8000,
LV_STATE_ANY = 0xFFFF, /**< Special value can be used in some functions to target all states*/
} lv_state_t;
/**
* The possible parts of widgets.
* The parts can be considered as the internal building block of the widgets.
* E.g. slider = background + indicator + knob
* Not all parts are used by every widget
*/
typedef 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*/
LV_PART_KNOB = 0x030000, /**< Like handle to grab to adjust the value*/
LV_PART_SELECTED = 0x040000, /**< Indicate the currently selected option or section*/
LV_PART_ITEMS = 0x050000, /**< Used if the widget has multiple similar elements (e.g. table cells)*/
LV_PART_CURSOR = 0x060000, /**< Mark a specific place e.g. for text area's cursor or on a chart*/
LV_PART_CUSTOM_FIRST = 0x080000, /**< Extension point for custom widgets*/
LV_PART_ANY = 0x0F0000, /**< Special value can be used in some functions to target all parts*/
} lv_part_t;
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 */
@ -32,6 +75,13 @@ typedef enum {
LV_STYLE_STATE_CMP_DIFF_LAYOUT, /**< The differences can be shown with a simple redraw */
} lv_style_state_cmp_t;
/**
* A joint type for `lv_part_t` and `lv_state_t`. Example values
* - `0`: means `LV_PART_MAIN | LV_STATE_DEFAULT`
* - `LV_STATE_PRSSED`
* - `LV_PART_KNOB`
* - `LV_PART_KNOB | LV_STATE_PRESSED | LV_STATE_CHECKED`
*/
typedef uint32_t lv_style_selector_t;
/**********************
@ -110,6 +160,24 @@ void lv_obj_report_style_change(lv_style_t * style);
*/
void lv_obj_refresh_style(lv_obj_t * obj, lv_part_t part, lv_style_prop_t prop);
/**
* Temporary disable a style for a selector. It will look like is the style wasn't added
* @param obj pointer to an object
* @param style pointer to a style
* @param selector the selector of a style (e.g. LV_STATE_PRESSED | LV_PART_KNOB)
* @param dis true: disable the style, false: enable the style
*/
void lv_obj_style_set_disabled(lv_obj_t * obj, const lv_style_t * style, lv_style_selector_t selector, bool dis);
/**
* Get if a given style is disabled on an object.
* @param obj pointer to an object
* @param style pointer to a style
* @param selector the selector of a style (e.g. LV_STATE_PRESSED | LV_PART_KNOB)
* @return true: disable the style, false: enable the style
*/
bool lv_obj_style_get_disabled(lv_obj_t * obj, const lv_style_t * style, lv_style_selector_t selector);
/**
* Enable or disable automatic style refreshing when a new style is added/removed to/from an object
* or any other style change happens.
@ -183,12 +251,12 @@ 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)
{
return selector & 0xFFFF;
return (lv_state_t)(selector & 0xFFFF);
}
static inline lv_part_t lv_obj_style_get_selector_part(lv_style_selector_t selector)
{
return selector & 0xFF0000;
return (lv_part_t)(selector & 0xFF0000);
}
#include "lv_obj_style_gen.h"

View File

@ -530,6 +530,14 @@ void lv_obj_set_style_image_recolor_opa(lv_obj_t * obj, lv_opa_t value, lv_style
lv_obj_set_local_style_prop(obj, LV_STYLE_IMAGE_RECOLOR_OPA, v, selector);
}
void lv_obj_set_style_image_colorkey(lv_obj_t * obj, const lv_image_colorkey_t * value, lv_style_selector_t selector)
{
lv_style_value_t v = {
.ptr = value
};
lv_obj_set_local_style_prop(obj, LV_STYLE_IMAGE_COLORKEY, v, selector);
}
void lv_obj_set_style_line_width(lv_obj_t * obj, int32_t value, lv_style_selector_t selector)
{
lv_style_value_t v = {

View File

@ -451,6 +451,12 @@ static inline lv_opa_t lv_obj_get_style_image_recolor_opa(const lv_obj_t * obj,
return (lv_opa_t)v.num;
}
static inline const lv_image_colorkey_t * lv_obj_get_style_image_colorkey(const lv_obj_t * obj, lv_part_t part)
{
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_IMAGE_COLORKEY);
return (const lv_image_colorkey_t *)v.ptr;
}
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);
@ -864,6 +870,7 @@ void lv_obj_set_style_shadow_opa(lv_obj_t * obj, lv_opa_t value, lv_style_select
void lv_obj_set_style_image_opa(lv_obj_t * obj, lv_opa_t value, lv_style_selector_t selector);
void lv_obj_set_style_image_recolor(lv_obj_t * obj, lv_color_t value, lv_style_selector_t selector);
void lv_obj_set_style_image_recolor_opa(lv_obj_t * obj, lv_opa_t value, lv_style_selector_t selector);
void lv_obj_set_style_image_colorkey(lv_obj_t * obj, const lv_image_colorkey_t * value, lv_style_selector_t selector);
void lv_obj_set_style_line_width(lv_obj_t * obj, int32_t value, lv_style_selector_t selector);
void lv_obj_set_style_line_dash_width(lv_obj_t * obj, int32_t value, lv_style_selector_t selector);
void lv_obj_set_style_line_dash_gap(lv_obj_t * obj, int32_t value, lv_style_selector_t selector);

View File

@ -29,6 +29,7 @@ struct _lv_obj_style_t {
uint32_t selector : 24;
uint32_t is_local : 1;
uint32_t is_trans : 1;
uint32_t is_disabled : 1;
};
struct _lv_obj_style_transition_dsc_t {

View File

@ -40,7 +40,7 @@ typedef lv_obj_tree_walk_res_t (*lv_obj_tree_walk_cb_t)(lv_obj_t *, void *);
/**
* Delete an object and all of its children.
* Also remove the objects from their group and remove all animations (if any).
* Send `LV_EVENT_DELETED` to deleted objects.
* Send `LV_EVENT_DELETE` to deleted objects.
* @param obj pointer to an object
*/
void lv_obj_delete(lv_obj_t * obj);
@ -48,7 +48,7 @@ void lv_obj_delete(lv_obj_t * obj);
/**
* Delete all children of an object.
* Also remove the objects from their group and remove all animations (if any).
* Send `LV_EVENT_DELETED` to deleted objects.
* Send `LV_EVENT_DELETE` to deleted objects.
* @param obj pointer to an object
*/
void lv_obj_clean(lv_obj_t * obj);

View File

@ -44,13 +44,18 @@ static void refr_invalid_areas(void);
static void refr_sync_areas(void);
static void refr_area(const lv_area_t * area_p, int32_t y_offset);
static void refr_configured_layer(lv_layer_t * layer);
static lv_obj_t * lv_refr_get_top_obj(const lv_area_t * area_p, lv_obj_t * obj);
static void refr_obj_and_children(lv_layer_t * layer, lv_obj_t * top_obj);
static 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);
static void draw_buf_flush(lv_display_t * disp);
static void call_flush_cb(lv_display_t * disp, const lv_area_t * area, uint8_t * px_map);
static void wait_for_flushing(lv_display_t * disp);
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);
static bool alpha_test_area_on_obj(lv_obj_t * obj, const lv_area_t * area);
#if LV_DRAW_TRANSFORM_USE_MATRIX
static bool refr_check_obj_clip_overflow(lv_layer_t * layer, lv_obj_t * obj);
static void refr_obj_matrix(lv_layer_t * layer, lv_obj_t * obj);
#endif
/**********************
* STATIC VARIABLES
@ -167,7 +172,7 @@ void lv_obj_redraw(lv_layer_t * layer, lv_obj_t * obj)
if(clip_corner == false) {
for(i = 0; i < child_cnt; i++) {
lv_obj_t * child = obj->spec_attr->children[i];
refr_obj(layer, child);
lv_obj_refr(layer, child);
}
/*If the object was visible on the clip area call the post draw events too*/
@ -196,7 +201,7 @@ void lv_obj_redraw(lv_layer_t * layer, lv_obj_t * obj)
for(i = 0; i < child_cnt; i++) {
lv_obj_t * child = obj->spec_attr->children[i];
refr_obj(layer_children, child);
lv_obj_refr(layer_children, child);
}
/*If all the children are redrawn send 'post draw' draw*/
@ -217,7 +222,7 @@ void lv_obj_redraw(lv_layer_t * layer, lv_obj_t * obj)
for(i = 0; i < child_cnt; i++) {
lv_obj_t * child = obj->spec_attr->children[i];
refr_obj(layer_children, child);
lv_obj_refr(layer_children, child);
}
/*If all the children are redrawn send 'post draw' draw*/
@ -239,7 +244,7 @@ void lv_obj_redraw(lv_layer_t * layer, lv_obj_t * obj)
layer->_clip_area = mid;
for(i = 0; i < child_cnt; i++) {
lv_obj_t * child = obj->spec_attr->children[i];
refr_obj(layer, child);
lv_obj_refr(layer, child);
}
/*If all the children are redrawn make 'post draw' draw*/
@ -379,7 +384,12 @@ void lv_display_refr_timer(lv_timer_t * tmr)
return;
}
lv_display_send_event(disp_refr, LV_EVENT_REFR_START, NULL);
lv_result_t res = lv_display_send_event(disp_refr, LV_EVENT_REFR_START, NULL);
if(res == LV_RESULT_INVALID) {
LV_TRACE_REFR("deleted");
LV_PROFILER_REFR_END;
return;
}
/*Refresh the screen's layout if required*/
LV_PROFILER_LAYOUT_BEGIN_TAG("layout");
@ -432,6 +442,162 @@ refr_finish:
LV_PROFILER_REFR_END;
}
/**
* Search the most top object which fully covers an area
* @param area_p pointer to an area
* @param obj the first object to start the searching (typically a screen)
* @return
*/
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_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_style_opa(obj, LV_PART_MAIN) < LV_OPA_MAX) return NULL;
/*If this object is fully cover the draw area then check the children too*/
lv_cover_check_info_t info;
info.res = LV_COVER_RES_COVER;
info.area = area_p;
lv_obj_send_event(obj, LV_EVENT_COVER_CHECK, &info);
if(info.res == LV_COVER_RES_MASKED) return NULL;
int32_t i;
int32_t child_cnt = lv_obj_get_child_count(obj);
for(i = child_cnt - 1; i >= 0; i--) {
lv_obj_t * child = obj->spec_attr->children[i];
found_p = lv_refr_get_top_obj(area_p, child);
/*If a children is ok then break*/
if(found_p != NULL) {
break;
}
}
/*If no better children use this object*/
if(found_p == NULL && info.res == LV_COVER_RES_COVER) {
found_p = obj;
}
return found_p;
}
void lv_obj_refr(lv_layer_t * layer, lv_obj_t * obj)
{
LV_ASSERT_NULL(layer);
LV_ASSERT_NULL(obj);
if(lv_obj_has_flag(obj, LV_OBJ_FLAG_HIDDEN)) return;
/*If `opa_layered != LV_OPA_COVER` draw the widget on a new layer and blend that layer with the given opacity.*/
const lv_opa_t opa_layered = lv_obj_get_style_opa_layered(obj, LV_PART_MAIN);
if(opa_layered <= LV_OPA_MIN) return;
const lv_opa_t layer_opa_ori = layer->opa;
const lv_color32_t layer_recolor = layer->recolor;
/*Normal `opa` (not layered) will just scale down `bg_opa`, `text_opa`, etc, in the upcoming drawings.*/
const lv_opa_t opa_main = lv_obj_get_style_opa(obj, LV_PART_MAIN);
if(opa_main < LV_OPA_MAX) {
layer->opa = LV_OPA_MIX2(layer_opa_ori, opa_main);
}
layer->recolor = lv_obj_style_apply_recolor(obj, LV_PART_MAIN, layer->recolor);
lv_layer_type_t layer_type = lv_obj_get_layer_type(obj);
if(layer_type == LV_LAYER_TYPE_NONE) {
lv_obj_redraw(layer, obj);
}
#if LV_DRAW_TRANSFORM_USE_MATRIX
/*If the layer opa is full then use the matrix transform*/
else if(opa_layered >= LV_OPA_MAX && !refr_check_obj_clip_overflow(layer, obj)) {
refr_obj_matrix(layer, obj);
}
#endif /* LV_DRAW_TRANSFORM_USE_MATRIX */
else {
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 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) {
int32_t w = lv_area_get_width(&layer_area_full);
uint8_t px_size = lv_color_format_get_size(disp_refr->color_format);
max_rgb_row_height = LV_DRAW_LAYER_SIMPLE_BUF_SIZE / w / px_size;
max_argb_row_height = LV_DRAW_LAYER_SIMPLE_BUF_SIZE / w / sizeof(lv_color32_t);
}
lv_area_t layer_area_act;
layer_area_act.x1 = layer_area_full.x1;
layer_area_act.x2 = layer_area_full.x2;
layer_area_act.y1 = layer_area_full.y1;
layer_area_act.y2 = layer_area_full.y1;
while(layer_area_act.y2 < layer_area_full.y2) {
/* Test with an RGB layer size (which is larger than the ARGB layer size)
* If it really doesn't need alpha use it. Else switch to the ARGB size*/
layer_area_act.y2 = layer_area_act.y1 + max_rgb_row_height - 1;
if(layer_area_act.y2 > layer_area_full.y2) layer_area_act.y2 = layer_area_full.y2;
const void * bitmap_mask_src = lv_obj_get_style_bitmap_mask_src(obj, LV_PART_MAIN);
bool area_need_alpha = bitmap_mask_src || alpha_test_area_on_obj(obj, &layer_area_act);
if(area_need_alpha) {
layer_area_act.y2 = layer_area_act.y1 + max_argb_row_height - 1;
if(layer_area_act.y2 > layer_area_full.y2) layer_area_act.y2 = layer_area_full.y2;
}
lv_layer_t * new_layer = lv_draw_layer_create(layer,
area_need_alpha ? LV_COLOR_FORMAT_ARGB8888 : LV_COLOR_FORMAT_NATIVE, &layer_area_act);
lv_obj_redraw(new_layer, obj);
lv_point_t pivot = {
.x = lv_obj_get_style_transform_pivot_x(obj, LV_PART_MAIN),
.y = lv_obj_get_style_transform_pivot_y(obj, LV_PART_MAIN)
};
if(LV_COORD_IS_PCT(pivot.x)) {
pivot.x = (LV_COORD_GET_PCT(pivot.x) * lv_area_get_width(&obj->coords)) / 100;
}
if(LV_COORD_IS_PCT(pivot.y)) {
pivot.y = (LV_COORD_GET_PCT(pivot.y) * lv_area_get_height(&obj->coords)) / 100;
}
lv_draw_image_dsc_t layer_draw_dsc;
lv_draw_image_dsc_init(&layer_draw_dsc);
layer_draw_dsc.pivot.x = obj->coords.x1 + pivot.x - new_layer->buf_area.x1;
layer_draw_dsc.pivot.y = obj->coords.y1 + pivot.y - new_layer->buf_area.y1;
layer_draw_dsc.opa = opa_layered;
layer_draw_dsc.rotation = lv_obj_get_style_transform_rotation(obj, LV_PART_MAIN);
while(layer_draw_dsc.rotation > 3600) layer_draw_dsc.rotation -= 3600;
while(layer_draw_dsc.rotation < 0) layer_draw_dsc.rotation += 3600;
layer_draw_dsc.scale_x = lv_obj_get_style_transform_scale_x(obj, LV_PART_MAIN);
layer_draw_dsc.scale_y = lv_obj_get_style_transform_scale_y(obj, LV_PART_MAIN);
layer_draw_dsc.skew_x = lv_obj_get_style_transform_skew_x(obj, LV_PART_MAIN);
layer_draw_dsc.skew_y = lv_obj_get_style_transform_skew_y(obj, LV_PART_MAIN);
layer_draw_dsc.blend_mode = lv_obj_get_style_blend_mode(obj, LV_PART_MAIN);
layer_draw_dsc.antialias = disp_refr->antialiasing;
layer_draw_dsc.bitmap_mask_src = bitmap_mask_src;
layer_draw_dsc.image_area = obj_draw_size;
layer_draw_dsc.src = new_layer;
lv_draw_layer(layer, &layer_draw_dsc, &layer_area_act);
layer_area_act.y1 = layer_area_act.y2 + 1;
}
}
/* Restore the original layer opa and recolor */
layer->opa = layer_opa_ori;
layer->recolor = layer_recolor;
}
/**********************
* STATIC FUNCTIONS
**********************/
@ -585,6 +751,9 @@ static void refr_invalid_areas(void)
if(disp_refr->inv_p == 0) return;
LV_PROFILER_REFR_BEGIN;
/*Notify the display driven rendering has started*/
lv_display_send_event(disp_refr, LV_EVENT_RENDER_START, NULL);
/*Find the last area which will be drawn*/
int32_t i;
int32_t last_i = 0;
@ -595,9 +764,6 @@ static void refr_invalid_areas(void)
}
}
/*Notify the display driven rendering has started*/
lv_display_send_event(disp_refr, LV_EVENT_RENDER_START, NULL);
disp_refr->last_area = 0;
disp_refr->last_part = 0;
disp_refr->rendering_in_progress = true;
@ -695,7 +861,7 @@ static void refr_area(const lv_area_t * area_p, int32_t y_offset)
}
else if(disp_refr->render_mode == LV_DISPLAY_RENDER_MODE_DIRECT ||
disp_refr->render_mode == LV_DISPLAY_RENDER_MODE_FULL) {
/*In direct mode and full mode the the buffer area is always the whole screen, not considering rotation*/
/*In direct mode and full mode the buffer area is always the whole screen, not considering rotation*/
layer->buf_area.x1 = 0;
layer->buf_area.y1 = 0;
if(lv_display_get_matrix_rotation(disp_refr)) {
@ -713,7 +879,7 @@ static void refr_area(const lv_area_t * area_p, int32_t y_offset)
uint32_t tile_cnt = 1;
int32_t tile_h = lv_area_get_height(area_p);
if(LV_COLOR_FORMAT_IS_INDEXED(layer->color_format) == false) {
/* Assume that the the buffer size (can be screen sized or smaller in case of partial mode)
/* Assume that the buffer size (can be screen sized or smaller in case of partial mode)
* and max tile size are the optimal scenario. From this calculate the ideal tile size
* and set the tile count and tile height accordingly.
*/
@ -902,48 +1068,6 @@ static void refr_configured_layer(lv_layer_t * layer)
LV_PROFILER_REFR_END;
}
/**
* Search the most top object which fully covers an area
* @param area_p pointer to an area
* @param obj the first object to start the searching (typically a screen)
* @return
*/
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_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_style_opa(obj, LV_PART_MAIN) < LV_OPA_MAX) return NULL;
/*If this object is fully cover the draw area then check the children too*/
lv_cover_check_info_t info;
info.res = LV_COVER_RES_COVER;
info.area = area_p;
lv_obj_send_event(obj, LV_EVENT_COVER_CHECK, &info);
if(info.res == LV_COVER_RES_MASKED) return NULL;
int32_t i;
int32_t child_cnt = lv_obj_get_child_count(obj);
for(i = child_cnt - 1; i >= 0; i--) {
lv_obj_t * child = obj->spec_attr->children[i];
found_p = lv_refr_get_top_obj(area_p, child);
/*If a children is ok then break*/
if(found_p != NULL) {
break;
}
}
/*If no better children use this object*/
if(found_p == NULL && info.res == LV_COVER_RES_COVER) {
found_p = obj;
}
return found_p;
}
/**
* Make the refreshing from an object. Draw all its children and the youngers too.
* @param top_p pointer to an objects. Start the drawing from it.
@ -970,7 +1094,7 @@ static void refr_obj_and_children(lv_layer_t * layer, lv_obj_t * top_obj)
}
/*Refresh the top object and its children*/
refr_obj(layer, top_obj);
lv_obj_refr(layer, top_obj);
/*Do until not reach the screen*/
while(parent != NULL) {
@ -984,7 +1108,7 @@ static void refr_obj_and_children(lv_layer_t * layer, lv_obj_t * top_obj)
}
else {
/*Refresh the objects*/
refr_obj(layer, child);
lv_obj_refr(layer, child);
}
}
@ -1075,18 +1199,18 @@ static bool obj_get_matrix(lv_obj_t * obj, lv_matrix_t * 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)
.x = lv_obj_get_style_transform_pivot_x(obj, LV_PART_MAIN),
.y = lv_obj_get_style_transform_pivot_y(obj, LV_PART_MAIN)
};
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);
int32_t rotation = lv_obj_get_style_transform_rotation(obj, LV_PART_MAIN);
int32_t scale_x = lv_obj_get_style_transform_scale_x(obj, LV_PART_MAIN);
int32_t scale_y = lv_obj_get_style_transform_scale_y(obj, LV_PART_MAIN);
int32_t skew_x = lv_obj_get_style_transform_skew_x(obj, LV_PART_MAIN);
int32_t skew_y = lv_obj_get_style_transform_skew_y(obj, LV_PART_MAIN);
if(scale_x <= 0 || scale_y <= 0) {
/* NOT draw if scale is negative or zero */
@ -1162,7 +1286,7 @@ static void refr_obj_matrix(lv_layer_t * layer, lv_obj_t * obj)
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) {
if(lv_obj_get_style_transform_rotation(obj, LV_PART_MAIN) == 0) {
return false;
}
@ -1185,117 +1309,6 @@ static bool refr_check_obj_clip_overflow(lv_layer_t * layer, lv_obj_t * obj)
#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;
/*If `opa_layered != LV_OPA_COVER` draw the widget on a new layer and blend that layer with the given opacity.*/
const lv_opa_t opa_layered = lv_obj_get_style_opa_layered(obj, LV_PART_MAIN);
if(opa_layered <= LV_OPA_MIN) return;
const lv_opa_t layer_opa_ori = layer->opa;
const lv_color32_t layer_recolor = layer->recolor;
/*Normal `opa` (not layered) will just scale down `bg_opa`, `text_opa`, etc, in the upcoming drawings.*/
const lv_opa_t opa_main = lv_obj_get_style_opa(obj, LV_PART_MAIN);
if(opa_main < LV_OPA_MAX) {
layer->opa = LV_OPA_MIX2(layer_opa_ori, opa_main);
}
layer->recolor = lv_obj_style_apply_recolor(obj, LV_PART_MAIN, layer->recolor);
lv_layer_type_t layer_type = lv_obj_get_layer_type(obj);
if(layer_type == LV_LAYER_TYPE_NONE) {
lv_obj_redraw(layer, obj);
}
#if LV_DRAW_TRANSFORM_USE_MATRIX
/*If the layer opa is full then use the matrix transform*/
else if(opa_layered >= LV_OPA_MAX && !refr_check_obj_clip_overflow(layer, obj)) {
refr_obj_matrix(layer, obj);
}
#endif /* LV_DRAW_TRANSFORM_USE_MATRIX */
else {
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 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) {
int32_t w = lv_area_get_width(&layer_area_full);
uint8_t px_size = lv_color_format_get_size(disp_refr->color_format);
max_rgb_row_height = LV_DRAW_LAYER_SIMPLE_BUF_SIZE / w / px_size;
max_argb_row_height = LV_DRAW_LAYER_SIMPLE_BUF_SIZE / w / sizeof(lv_color32_t);
}
lv_area_t layer_area_act;
layer_area_act.x1 = layer_area_full.x1;
layer_area_act.x2 = layer_area_full.x2;
layer_area_act.y1 = layer_area_full.y1;
layer_area_act.y2 = layer_area_full.y1;
while(layer_area_act.y2 < layer_area_full.y2) {
/* Test with an RGB layer size (which is larger than the ARGB layer size)
* If it really doesn't need alpha use it. Else switch to the ARGB size*/
layer_area_act.y2 = layer_area_act.y1 + max_rgb_row_height - 1;
if(layer_area_act.y2 > layer_area_full.y2) layer_area_act.y2 = layer_area_full.y2;
const void * bitmap_mask_src = lv_obj_get_style_bitmap_mask_src(obj, 0);
bool area_need_alpha = bitmap_mask_src || alpha_test_area_on_obj(obj, &layer_area_act);
if(area_need_alpha) {
layer_area_act.y2 = layer_area_act.y1 + max_argb_row_height - 1;
if(layer_area_act.y2 > layer_area_full.y2) layer_area_act.y2 = layer_area_full.y2;
}
lv_layer_t * new_layer = lv_draw_layer_create(layer,
area_need_alpha ? LV_COLOR_FORMAT_ARGB8888 : LV_COLOR_FORMAT_NATIVE, &layer_area_act);
lv_obj_redraw(new_layer, obj);
lv_point_t pivot = {
.x = lv_obj_get_style_transform_pivot_x(obj, 0),
.y = lv_obj_get_style_transform_pivot_y(obj, 0)
};
if(LV_COORD_IS_PCT(pivot.x)) {
pivot.x = (LV_COORD_GET_PCT(pivot.x) * lv_area_get_width(&obj->coords)) / 100;
}
if(LV_COORD_IS_PCT(pivot.y)) {
pivot.y = (LV_COORD_GET_PCT(pivot.y) * lv_area_get_height(&obj->coords)) / 100;
}
lv_draw_image_dsc_t layer_draw_dsc;
lv_draw_image_dsc_init(&layer_draw_dsc);
layer_draw_dsc.pivot.x = obj->coords.x1 + pivot.x - new_layer->buf_area.x1;
layer_draw_dsc.pivot.y = obj->coords.y1 + pivot.y - new_layer->buf_area.y1;
layer_draw_dsc.opa = opa_layered;
layer_draw_dsc.rotation = lv_obj_get_style_transform_rotation(obj, 0);
while(layer_draw_dsc.rotation > 3600) layer_draw_dsc.rotation -= 3600;
while(layer_draw_dsc.rotation < 0) layer_draw_dsc.rotation += 3600;
layer_draw_dsc.scale_x = lv_obj_get_style_transform_scale_x(obj, 0);
layer_draw_dsc.scale_y = lv_obj_get_style_transform_scale_y(obj, 0);
layer_draw_dsc.skew_x = lv_obj_get_style_transform_skew_x(obj, 0);
layer_draw_dsc.skew_y = lv_obj_get_style_transform_skew_y(obj, 0);
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 = bitmap_mask_src;
layer_draw_dsc.image_area = obj_draw_size;
layer_draw_dsc.src = new_layer;
lv_draw_layer(layer, &layer_draw_dsc, &layer_area_act);
layer_area_act.y1 = layer_area_act.y2 + 1;
}
}
/* Restore the original layer opa and recolor */
layer->opa = layer_opa_ori;
layer->recolor = layer_recolor;
}
static uint32_t get_max_row(lv_display_t * disp, int32_t area_w, int32_t area_h)
{
lv_color_format_t cf = disp->color_format;

View File

@ -58,6 +58,21 @@ lv_display_t * lv_refr_get_disp_refreshing(void);
*/
void lv_refr_set_disp_refreshing(lv_display_t * disp);
/**
* Search the most top object which fully covers an area
* @param area_p pointer to an area
* @param obj the first object to start the searching (typically a screen)
* @return
*/
lv_obj_t * lv_refr_get_top_obj(const lv_area_t * area_p, lv_obj_t * obj);
/**
* Render an object to a layer
* @param layer target drawing layer
* @param obj object to render
*/
void lv_obj_refr(lv_layer_t * layer, lv_obj_t * obj);
/**********************
* MACROS
**********************/

View File

@ -1,5 +1,5 @@
/**
* @file lv_disp.c
* @file lv_display.c
*
*/
@ -178,6 +178,7 @@ void lv_display_delete(lv_display_t * disp)
if(disp == lv_refr_get_disp_refreshing()) was_refr = true;
lv_display_send_event(disp, LV_EVENT_DELETE, NULL);
lv_event_mark_deleted(disp);
lv_event_remove_all(&(disp->event_list));
/*Detach the input devices*/
@ -592,6 +593,8 @@ uint32_t lv_display_get_tile_cnt(lv_display_t * disp)
void lv_display_set_antialiasing(lv_display_t * disp, bool en)
{
LV_LOG_WARN("Disabling anti-aliasing is not supported since v9. This function will be removed.");
if(disp == NULL) disp = lv_display_get_default();
if(disp == NULL) return;
@ -636,6 +639,17 @@ lv_obj_t * lv_display_get_screen_active(lv_display_t * disp)
return disp->act_scr;
}
lv_obj_t * lv_display_get_screen_loading(lv_display_t * disp)
{
if(!disp) disp = lv_display_get_default();
if(!disp) {
LV_LOG_WARN("no display registered to get the current screen being loaded");
return NULL;
}
return disp->scr_to_load;
}
lv_obj_t * lv_display_get_screen_prev(lv_display_t * disp)
{
if(!disp) disp = lv_display_get_default();
@ -680,9 +694,31 @@ lv_obj_t * lv_display_get_layer_bottom(lv_display_t * disp)
return disp->bottom_layer;
}
#if LV_USE_OBJ_NAME
lv_obj_t * lv_display_get_screen_by_name(const lv_display_t * disp, const char * screen_name)
{
if(!disp) disp = lv_display_get_default();
if(!disp) {
LV_LOG_WARN("no display registered to get a screen by name");
return NULL;
}
uint32_t i;
for(i = 0; i < disp->screen_cnt; i++) {
const char * n = lv_obj_get_name(disp->screens[i]);
if(n && lv_streq(screen_name, n)) return disp->screens[i];
}
return NULL;
}
#endif /*LV_USE_OBJ_NAME*/
void lv_screen_load(struct _lv_obj_t * scr)
{
lv_screen_load_anim(scr, LV_SCR_LOAD_ANIM_NONE, 0, 0, false);
lv_screen_load_anim(scr, LV_SCREEN_LOAD_ANIM_NONE, 0, 0, false);
}
void lv_screen_load_anim(lv_obj_t * new_scr, lv_screen_load_anim_t anim_type, uint32_t time, uint32_t delay,
@ -748,76 +784,76 @@ void lv_screen_load_anim(lv_obj_t * new_scr, lv_screen_load_anim_t anim_type, ui
lv_anim_set_delay(&a_old, delay);
switch(anim_type) {
case LV_SCR_LOAD_ANIM_NONE:
case LV_SCREEN_LOAD_ANIM_NONE:
/*Create a dummy animation to apply the delay*/
lv_anim_set_exec_cb(&a_new, set_x_anim);
lv_anim_set_values(&a_new, 0, 0);
break;
case LV_SCR_LOAD_ANIM_OVER_LEFT:
case LV_SCREEN_LOAD_ANIM_OVER_LEFT:
lv_anim_set_exec_cb(&a_new, set_x_anim);
lv_anim_set_values(&a_new, lv_display_get_horizontal_resolution(d), 0);
break;
case LV_SCR_LOAD_ANIM_OVER_RIGHT:
case LV_SCREEN_LOAD_ANIM_OVER_RIGHT:
lv_anim_set_exec_cb(&a_new, set_x_anim);
lv_anim_set_values(&a_new, -lv_display_get_horizontal_resolution(d), 0);
break;
case LV_SCR_LOAD_ANIM_OVER_TOP:
case LV_SCREEN_LOAD_ANIM_OVER_TOP:
lv_anim_set_exec_cb(&a_new, set_y_anim);
lv_anim_set_values(&a_new, lv_display_get_vertical_resolution(d), 0);
break;
case LV_SCR_LOAD_ANIM_OVER_BOTTOM:
case LV_SCREEN_LOAD_ANIM_OVER_BOTTOM:
lv_anim_set_exec_cb(&a_new, set_y_anim);
lv_anim_set_values(&a_new, -lv_display_get_vertical_resolution(d), 0);
break;
case LV_SCR_LOAD_ANIM_MOVE_LEFT:
case LV_SCREEN_LOAD_ANIM_MOVE_LEFT:
lv_anim_set_exec_cb(&a_new, set_x_anim);
lv_anim_set_values(&a_new, lv_display_get_horizontal_resolution(d), 0);
lv_anim_set_exec_cb(&a_old, set_x_anim);
lv_anim_set_values(&a_old, 0, -lv_display_get_horizontal_resolution(d));
break;
case LV_SCR_LOAD_ANIM_MOVE_RIGHT:
case LV_SCREEN_LOAD_ANIM_MOVE_RIGHT:
lv_anim_set_exec_cb(&a_new, set_x_anim);
lv_anim_set_values(&a_new, -lv_display_get_horizontal_resolution(d), 0);
lv_anim_set_exec_cb(&a_old, set_x_anim);
lv_anim_set_values(&a_old, 0, lv_display_get_horizontal_resolution(d));
break;
case LV_SCR_LOAD_ANIM_MOVE_TOP:
case LV_SCREEN_LOAD_ANIM_MOVE_TOP:
lv_anim_set_exec_cb(&a_new, set_y_anim);
lv_anim_set_values(&a_new, lv_display_get_vertical_resolution(d), 0);
lv_anim_set_exec_cb(&a_old, set_y_anim);
lv_anim_set_values(&a_old, 0, -lv_display_get_vertical_resolution(d));
break;
case LV_SCR_LOAD_ANIM_MOVE_BOTTOM:
case LV_SCREEN_LOAD_ANIM_MOVE_BOTTOM:
lv_anim_set_exec_cb(&a_new, set_y_anim);
lv_anim_set_values(&a_new, -lv_display_get_vertical_resolution(d), 0);
lv_anim_set_exec_cb(&a_old, set_y_anim);
lv_anim_set_values(&a_old, 0, lv_display_get_vertical_resolution(d));
break;
case LV_SCR_LOAD_ANIM_FADE_IN:
case LV_SCREEN_LOAD_ANIM_FADE_IN:
lv_anim_set_exec_cb(&a_new, opa_scale_anim);
lv_anim_set_values(&a_new, LV_OPA_TRANSP, LV_OPA_COVER);
break;
case LV_SCR_LOAD_ANIM_FADE_OUT:
case LV_SCREEN_LOAD_ANIM_FADE_OUT:
lv_anim_set_exec_cb(&a_old, opa_scale_anim);
lv_anim_set_values(&a_old, LV_OPA_COVER, LV_OPA_TRANSP);
break;
case LV_SCR_LOAD_ANIM_OUT_LEFT:
case LV_SCREEN_LOAD_ANIM_OUT_LEFT:
lv_anim_set_exec_cb(&a_old, set_x_anim);
lv_anim_set_values(&a_old, 0, -lv_display_get_horizontal_resolution(d));
break;
case LV_SCR_LOAD_ANIM_OUT_RIGHT:
case LV_SCREEN_LOAD_ANIM_OUT_RIGHT:
lv_anim_set_exec_cb(&a_old, set_x_anim);
lv_anim_set_values(&a_old, 0, lv_display_get_horizontal_resolution(d));
break;
case LV_SCR_LOAD_ANIM_OUT_TOP:
case LV_SCREEN_LOAD_ANIM_OUT_TOP:
lv_anim_set_exec_cb(&a_old, set_y_anim);
lv_anim_set_values(&a_old, 0, -lv_display_get_vertical_resolution(d));
break;
case LV_SCR_LOAD_ANIM_OUT_BOTTOM:
case LV_SCREEN_LOAD_ANIM_OUT_BOTTOM:
lv_anim_set_exec_cb(&a_old, set_y_anim);
lv_anim_set_values(&a_old, 0, lv_display_get_vertical_resolution(d));
break;
@ -881,21 +917,7 @@ uint32_t lv_display_remove_event_cb_with_user_data(lv_display_t * disp, lv_event
lv_result_t lv_display_send_event(lv_display_t * disp, lv_event_code_t code, void * param)
{
lv_event_t e;
lv_memzero(&e, sizeof(e));
e.code = code;
e.current_target = disp;
e.original_target = disp;
e.param = param;
lv_result_t res;
res = lv_event_send(&disp->event_list, &e, true);
if(res != LV_RESULT_OK) return res;
res = lv_event_send(&disp->event_list, &e, false);
if(res != LV_RESULT_OK) return res;
return res;
return lv_event_push_and_send(&disp->event_list, code, disp, param);
}
lv_area_t * lv_event_get_invalidated_area(lv_event_t * e)
@ -1328,11 +1350,11 @@ static void scr_anim_completed(lv_anim_t * a)
static bool is_out_anim(lv_screen_load_anim_t anim_type)
{
return anim_type == LV_SCR_LOAD_ANIM_FADE_OUT ||
anim_type == LV_SCR_LOAD_ANIM_OUT_LEFT ||
anim_type == LV_SCR_LOAD_ANIM_OUT_RIGHT ||
anim_type == LV_SCR_LOAD_ANIM_OUT_TOP ||
anim_type == LV_SCR_LOAD_ANIM_OUT_BOTTOM;
return anim_type == LV_SCREEN_LOAD_ANIM_FADE_OUT ||
anim_type == LV_SCREEN_LOAD_ANIM_OUT_LEFT ||
anim_type == LV_SCREEN_LOAD_ANIM_OUT_RIGHT ||
anim_type == LV_SCREEN_LOAD_ANIM_OUT_TOP ||
anim_type == LV_SCREEN_LOAD_ANIM_OUT_BOTTOM;
}
static void disp_event_cb(lv_event_t * e)

View File

@ -60,22 +60,22 @@ typedef enum {
} lv_display_render_mode_t;
typedef enum {
LV_SCR_LOAD_ANIM_NONE,
LV_SCR_LOAD_ANIM_OVER_LEFT,
LV_SCR_LOAD_ANIM_OVER_RIGHT,
LV_SCR_LOAD_ANIM_OVER_TOP,
LV_SCR_LOAD_ANIM_OVER_BOTTOM,
LV_SCR_LOAD_ANIM_MOVE_LEFT,
LV_SCR_LOAD_ANIM_MOVE_RIGHT,
LV_SCR_LOAD_ANIM_MOVE_TOP,
LV_SCR_LOAD_ANIM_MOVE_BOTTOM,
LV_SCR_LOAD_ANIM_FADE_IN,
LV_SCR_LOAD_ANIM_FADE_ON = LV_SCR_LOAD_ANIM_FADE_IN, /*For backward compatibility*/
LV_SCR_LOAD_ANIM_FADE_OUT,
LV_SCR_LOAD_ANIM_OUT_LEFT,
LV_SCR_LOAD_ANIM_OUT_RIGHT,
LV_SCR_LOAD_ANIM_OUT_TOP,
LV_SCR_LOAD_ANIM_OUT_BOTTOM,
LV_SCREEN_LOAD_ANIM_NONE,
LV_SCREEN_LOAD_ANIM_OVER_LEFT,
LV_SCREEN_LOAD_ANIM_OVER_RIGHT,
LV_SCREEN_LOAD_ANIM_OVER_TOP,
LV_SCREEN_LOAD_ANIM_OVER_BOTTOM,
LV_SCREEN_LOAD_ANIM_MOVE_LEFT,
LV_SCREEN_LOAD_ANIM_MOVE_RIGHT,
LV_SCREEN_LOAD_ANIM_MOVE_TOP,
LV_SCREEN_LOAD_ANIM_MOVE_BOTTOM,
LV_SCREEN_LOAD_ANIM_FADE_IN,
LV_SCREEN_LOAD_ANIM_FADE_ON = LV_SCREEN_LOAD_ANIM_FADE_IN, /*For backward compatibility*/
LV_SCREEN_LOAD_ANIM_FADE_OUT,
LV_SCREEN_LOAD_ANIM_OUT_LEFT,
LV_SCREEN_LOAD_ANIM_OUT_RIGHT,
LV_SCREEN_LOAD_ANIM_OUT_TOP,
LV_SCREEN_LOAD_ANIM_OUT_BOTTOM,
} lv_screen_load_anim_t;
typedef void (*lv_display_flush_cb_t)(lv_display_t * disp, const lv_area_t * area, uint8_t * px_map);
@ -358,6 +358,7 @@ void lv_display_set_tile_cnt(lv_display_t * disp, uint32_t tile_cnt);
uint32_t lv_display_get_tile_cnt(lv_display_t * disp);
/**
* Disabling anti-aliasing is not supported since v9. This function will be removed.
* Enable anti-aliasing for the render engine
* @param disp pointer to a display
* @param en true/false
@ -408,6 +409,13 @@ lv_obj_t * lv_display_get_screen_active(lv_display_t * disp);
*/
lv_obj_t * lv_display_get_screen_prev(lv_display_t * disp);
/**
* Return the screen that is currently being loaded by the display
* @param disp pointer to a display object (NULL to use the default screen)
* @return pointer to the screen being loaded or NULL if no screen is currently being loaded
*/
lv_obj_t * lv_display_get_screen_loading(lv_display_t * disp);
/**
* Return the top layer. The top layer is the same on all screens and it is above the normal screen layer.
* @param disp pointer to display which top layer should be get. (NULL to use the default screen)
@ -430,6 +438,20 @@ lv_obj_t * lv_display_get_layer_sys(lv_display_t * disp);
*/
lv_obj_t * lv_display_get_layer_bottom(lv_display_t * disp);
#if LV_USE_OBJ_NAME
/**
* Get screen by its name on a display. The name should be set by
* `lv_obj_set_name()` or `lv_obj_set_name_static()`.
* @param disp pointer to a display or NULL to use default display
* @param screen_name name of the screen to get
* @return pointer to the screen, or NULL if not found.
*/
lv_obj_t * lv_display_get_screen_by_name(const lv_display_t * disp, const char * screen_name);
#endif /*LV_USE_OBJ_NAME*/
/**
* Load a screen on the default display
* @param scr pointer to a screen
@ -439,7 +461,7 @@ void lv_screen_load(struct _lv_obj_t * scr);
/**
* Switch screen with animation
* @param scr pointer to the new screen to load
* @param anim_type type of the animation from `lv_screen_load_anim_t`, e.g. `LV_SCR_LOAD_ANIM_MOVE_LEFT`
* @param anim_type type of the animation from `lv_screen_load_anim_t`, e.g. `LV_SCREEN_LOAD_ANIM_MOVE_LEFT`
* @param time time of the animation
* @param delay delay before the transition
* @param auto_del true: automatically delete the old screen

View File

@ -0,0 +1,100 @@
/**
* @file lv_draw_buf_convert_helium.c
*
*/
/*********************
* INCLUDES
*********************/
#include "../../../lv_conf_internal.h"
#if LV_USE_DRAW_SW_ASM == LV_DRAW_SW_ASM_HELIUM
#include "lv_draw_buf_convert_helium.h"
/*********************
* DEFINES
*********************/
/**********************
* STATIC PROTOTYPES
**********************/
/**********************
* STATIC FUNCTIONS
**********************/
/**********************
* MACROS
**********************/
/**********************
* GLOBAL FUNCTIONS
**********************/
lv_result_t _lv_draw_buf_convert_premultiply_indexed_helium(lv_draw_buf_t * buf)
{
lv_draw_buf_t palette_draw_buf;
LV_ASSERT_NULL(buf);
if(!LV_COLOR_FORMAT_IS_INDEXED(buf->header.cf)) {
LV_LOG_WARN("Unsupported color format : %d", buf->header.cf);
return LV_RESULT_INVALID;
}
lv_memcpy(&palette_draw_buf, buf, sizeof(lv_draw_buf_t));
palette_draw_buf.header.w = LV_COLOR_INDEXED_PALETTE_SIZE(buf->header.cf);
palette_draw_buf.header.h = 1;
palette_draw_buf.header.cf = LV_COLOR_FORMAT_ARGB8888;
palette_draw_buf.header.stride = 4 * palette_draw_buf.header.w;
return _lv_draw_buf_convert_premultiply_argb8888_helium(&palette_draw_buf);
}
lv_result_t _lv_draw_buf_convert_premultiply_argb8888_helium(lv_draw_buf_t * buf)
{
LV_ASSERT_NULL(buf);
uint32_t h = buf->header.h;
uint32_t w = buf->header.w;
uint32_t stride = buf->header.stride;
uint8_t * data = (uint8_t *)buf->data;
if(buf->header.cf != LV_COLOR_FORMAT_ARGB8888) {
LV_LOG_WARN("Unsupported color format : %d", buf->header.cf);
return LV_RESULT_INVALID;
}
__asm volatile(
" .p2align 2 \n"
" 1: \n"
" mov r0, %[pSource] \n"
" mov r1, %[pTarget] \n"
" wlstp.8 lr, %[w], 3f \n"
" 2: \n"
" vld40.u8 {q0, q1, q2, q3}, [r0] \n"
" vld41.u8 {q0, q1, q2, q3}, [r0] \n"
" vld42.u8 {q0, q1, q2, q3}, [r0] \n"
" vld43.u8 {q0, q1, q2, q3}, [r0]! \n"
" vrmulh.u8 q0, q0, q3 \n"
" vrmulh.u8 q1, q1, q3 \n"
" vrmulh.u8 q2, q2, q3 \n"
" vst40.u8 {q0, q1, q2, q3}, [r1] \n"
" vst41.u8 {q0, q1, q2, q3}, [r1] \n"
" vst42.u8 {q0, q1, q2, q3}, [r1] \n"
" vst43.u8 {q0, q1, q2, q3}, [r1]! \n"
" letp lr, 2b \n"
" 3: \n"
" adds %[pSource], %[src_stride] \n"
" adds %[pTarget], %[dst_stride] \n"
" subs %[h], #1 \n"
" bne 1b \n"
: [pSource] "+r"(data), [pTarget] "+r"(data), [h] "+r"(h)
: [w] "r"(w), [src_stride] "r"(stride), [dst_stride] "r"(stride)
: "q0", "q1", "q2", "q3", "r0", "r1", "lr", "memory");
return LV_RESULT_OK;
}
#endif /* LV_USE_DRAW_SW_ASM == LV_DRAW_SW_ASM_HELIUM */

View File

@ -0,0 +1,57 @@
/**
* @file lv_draw_buf_convert_helium.h
*
*/
#ifndef LV_DRAW_BUF_CONVERT_HELIUM_H
#define LV_DRAW_BUF_CONVERT_HELIUM_H
#ifdef __cplusplus
extern "C" {
#endif
#include "../../../misc/lv_color.h"
#include "../../lv_draw_buf.h"
#if LV_USE_DRAW_SW_ASM == LV_DRAW_SW_ASM_HELIUM
/*********************
* DEFINES
*********************/
/**********************
* TYPEDEFS
**********************/
#ifndef LV_DRAW_CONVERT_PREMULTIPLY_INDEXED
#define LV_DRAW_CONVERT_PREMULTIPLY_INDEXED(buf) \
_lv_draw_buf_convert_premultiply_indexed_helium(buf)
#endif
#ifndef LV_DRAW_CONVERT_PREMULTIPLY_ARGB8888
#define LV_DRAW_CONVERT_PREMULTIPLY_ARGB8888(buf) \
_lv_draw_buf_convert_premultiply_argb8888_helium(buf)
#endif
/**********************
* GLOBAL PROTOTYPES
**********************/
/**
* Convert indexed draw_buf to premultiplied format with helium specific optimizations
* @param buf pointer to a draw buf
*/
lv_result_t _lv_draw_buf_convert_premultiply_indexed_helium(lv_draw_buf_t * buf);
/**
* Convert argb8888 draw_buf to premultiplied format with helium specific optimizations
* @param buf pointer to a draw buf
*/
lv_result_t _lv_draw_buf_convert_premultiply_argb8888_helium(lv_draw_buf_t * buf);
#endif /*LV_USE_DRAW_SW_ASM == LV_DRAW_SW_ASM_HELIUM*/
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif /* LV_DRAW_BUF_CONVERT_HELIUM_H */

View File

@ -0,0 +1,130 @@
/**
* @file lv_draw_buf_convert.c
*
*/
/*********************
* INCLUDES
*********************/
#include "lv_draw_buf_convert.h"
#if LV_USE_DRAW_SW_ASM == LV_DRAW_SW_ASM_NEON
#include "neon/lv_draw_buf_convert_neon.h"
#elif LV_USE_DRAW_SW_ASM == LV_DRAW_SW_ASM_HELIUM
#include "helium/lv_draw_buf_convert_helium.h"
#elif LV_USE_DRAW_SW_ASM == LV_DRAW_SW_ASM_CUSTOM
#include LV_DRAW_SW_ASM_CUSTOM_INCLUDE
#endif
/*********************
* DEFINES
*********************/
/**********************
* STATIC PROTOTYPES
**********************/
/**********************
* STATIC FUNCTIONS
**********************/
/**********************
* MACROS
**********************/
#ifndef LV_DRAW_CONVERT_PREMULTIPLY_INDEXED
#define LV_DRAW_CONVERT_PREMULTIPLY_INDEXED(...) LV_RESULT_INVALID
#endif
#ifndef LV_DRAW_CONVERT_PREMULTIPLY_ARGB8888
#define LV_DRAW_CONVERT_PREMULTIPLY_ARGB8888(...) LV_RESULT_INVALID
#endif
#ifndef LV_DRAW_CONVERT_PREMULTIPLY_RGB565A8
#define LV_DRAW_CONVERT_PREMULTIPLY_RGB565A8(...) LV_RESULT_INVALID
#endif
#ifndef LV_DRAW_CONVERT_PREMULTIPLY_ARGB8565
#define LV_DRAW_CONVERT_PREMULTIPLY_ARGB8565(...) LV_RESULT_INVALID
#endif
/**********************
* GLOBAL FUNCTIONS
**********************/
lv_result_t lv_draw_buf_convert_premultiply(lv_draw_buf_t * draw_buf)
{
LV_ASSERT_NULL(draw_buf);
/*Premultiply color with alpha, do case by case by judging color format*/
lv_color_format_t cf = draw_buf->header.cf;
if(LV_COLOR_FORMAT_IS_INDEXED(cf)) {
if(LV_RESULT_INVALID == LV_DRAW_CONVERT_PREMULTIPLY_INDEXED(draw_buf)) {
int size = LV_COLOR_INDEXED_PALETTE_SIZE(cf);
lv_color32_t * palette = (lv_color32_t *)draw_buf->data;
for(int i = 0; i < size; i++) {
lv_color_premultiply(&palette[i]);
}
}
}
else if(cf == LV_COLOR_FORMAT_ARGB8888) {
if(LV_RESULT_INVALID == LV_DRAW_CONVERT_PREMULTIPLY_ARGB8888(draw_buf)) {
uint32_t h = draw_buf->header.h;
uint32_t w = draw_buf->header.w;
uint32_t stride = draw_buf->header.stride;
uint8_t * line = (uint8_t *)draw_buf->data;
for(uint32_t y = 0; y < h; y++) {
lv_color32_t * pixel = (lv_color32_t *)line;
for(uint32_t x = 0; x < w; x++) {
lv_color_premultiply(pixel);
pixel++;
}
line += stride;
}
}
}
else if(cf == LV_COLOR_FORMAT_RGB565A8) {
if(LV_RESULT_INVALID == LV_DRAW_CONVERT_PREMULTIPLY_RGB565A8(draw_buf)) {
uint32_t h = draw_buf->header.h;
uint32_t w = draw_buf->header.w;
uint32_t stride = draw_buf->header.stride;
uint32_t alpha_stride = stride / 2;
uint8_t * line = (uint8_t *)draw_buf->data;
lv_opa_t * alpha = (lv_opa_t *)(line + stride * h);
for(uint32_t y = 0; y < h; y++) {
lv_color16_t * pixel = (lv_color16_t *)line;
for(uint32_t x = 0; x < w; x++) {
lv_color16_premultiply(pixel, alpha[x]);
pixel++;
}
line += stride;
alpha += alpha_stride;
}
}
}
else if(cf == LV_COLOR_FORMAT_ARGB8565) {
if(LV_RESULT_INVALID == LV_DRAW_CONVERT_PREMULTIPLY_ARGB8565(draw_buf)) {
uint32_t h = draw_buf->header.h;
uint32_t w = draw_buf->header.w;
uint32_t stride = draw_buf->header.stride;
uint8_t * line = (uint8_t *)draw_buf->data;
for(uint32_t y = 0; y < h; y++) {
uint8_t * pixel = line;
for(uint32_t x = 0; x < w; x++) {
uint8_t alpha = pixel[2];
lv_color16_premultiply((lv_color16_t *)pixel, alpha);
pixel += 3;
}
line += stride;
}
}
}
else if(LV_COLOR_FORMAT_IS_ALPHA_ONLY(cf)) {
/*Pass*/
}
else {
LV_LOG_WARN("draw buf has no alpha, cf: %d", cf);
}
return LV_RESULT_OK;
}

View File

@ -0,0 +1,39 @@
/**
* @file lv_draw_buf_convert.h
*
*/
#ifndef LV_DRAW_BUF_CONVERT_H
#define LV_DRAW_BUF_CONVERT_H
#ifdef __cplusplus
extern "C" {
#endif
#include "../../misc/lv_color.h"
#include "../lv_draw_buf.h"
/*********************
* DEFINES
*********************/
/**********************
* TYPEDEFS
**********************/
/**********************
* GLOBAL PROTOTYPES
**********************/
/**
* Convert draw_buf to premultiplied format
* @param buf pointer to a draw buf
*/
lv_result_t lv_draw_buf_convert_premultiply(lv_draw_buf_t * buf);
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif /* LV_DRAW_BUF_CONVERT_H */

View File

@ -0,0 +1,132 @@
/**
* @file lv_draw_buf_convert_neon.c
*
*/
/*********************
* INCLUDES
*********************/
#include "../../../lv_conf_internal.h"
#if LV_USE_DRAW_SW_ASM == LV_DRAW_SW_ASM_NEON
#include <arm_neon.h>
#include "lv_draw_buf_convert_neon.h"
/*********************
* DEFINES
*********************/
/**********************
* STATIC PROTOTYPES
**********************/
/**********************
* STATIC FUNCTIONS
**********************/
/**********************
* MACROS
**********************/
/**********************
* GLOBAL FUNCTIONS
**********************/
lv_result_t _lv_draw_buf_convert_premultiply_indexed_neon(lv_draw_buf_t * buf)
{
lv_draw_buf_t palette_draw_buf;
LV_ASSERT_NULL(buf);
if(!LV_COLOR_FORMAT_IS_INDEXED(buf->header.cf)) {
LV_LOG_WARN("Unsupported color format : %d", buf->header.cf);
return LV_RESULT_INVALID;
}
lv_memcpy(&palette_draw_buf, buf, sizeof(lv_draw_buf_t));
palette_draw_buf.header.w = LV_COLOR_INDEXED_PALETTE_SIZE(buf->header.cf);
palette_draw_buf.header.h = 1;
palette_draw_buf.header.cf = LV_COLOR_FORMAT_ARGB8888;
palette_draw_buf.header.stride = 4 * palette_draw_buf.header.w;
return _lv_draw_buf_convert_premultiply_argb8888_neon(&palette_draw_buf);
}
lv_result_t _lv_draw_buf_convert_premultiply_argb8888_neon(lv_draw_buf_t * buf)
{
LV_ASSERT_NULL(buf);
uint32_t h = buf->header.h;
uint32_t w = buf->header.w;
uint32_t stride = buf->header.stride;
uint8_t * data = (uint8_t *)buf->data;
if(buf->header.cf != LV_COLOR_FORMAT_ARGB8888) {
LV_LOG_WARN("Unsupported color format : %d", buf->header.cf);
return LV_RESULT_INVALID;
}
for(uint32_t y = 0; y < h; y++) {
uint8_t * p = (uint8_t *)data;
uint32_t remaining_pixels = w;
while(remaining_pixels >= 8) {
uint8x8x4_t rgba = vld4_u8(p);
uint16x8_t r16 = vmovl_u8(rgba.val[0]);
uint16x8_t g16 = vmovl_u8(rgba.val[1]);
uint16x8_t b16 = vmovl_u8(rgba.val[2]);
uint16x8_t a16 = vmovl_u8(rgba.val[3]);
rgba.val[0] = vshrn_n_u16(vmulq_u16(r16, a16), 8);
rgba.val[1] = vshrn_n_u16(vmulq_u16(g16, a16), 8);
rgba.val[2] = vshrn_n_u16(vmulq_u16(b16, a16), 8);
vst4_u8(p, rgba);
p += 8 * 4;
remaining_pixels -= 8;
}
if(remaining_pixels >= 4) {
uint8x8x4_t rgba;
rgba = vld4_lane_u8(p, rgba, 0);
rgba = vld4_lane_u8(p + 4, rgba, 1);
rgba = vld4_lane_u8(p + 8, rgba, 2);
rgba = vld4_lane_u8(p + 12, rgba, 3);
uint16x8_t r16 = vmovl_u8(rgba.val[0]);
uint16x8_t g16 = vmovl_u8(rgba.val[1]);
uint16x8_t b16 = vmovl_u8(rgba.val[2]);
uint16x8_t a16 = vmovl_u8(rgba.val[3]);
rgba.val[0] = vshrn_n_u16(vmulq_u16(r16, a16), 8);
rgba.val[1] = vshrn_n_u16(vmulq_u16(g16, a16), 8);
rgba.val[2] = vshrn_n_u16(vmulq_u16(b16, a16), 8);
vst4_lane_u8(p, rgba, 0);
vst4_lane_u8(p + 4, rgba, 1);
vst4_lane_u8(p + 8, rgba, 2);
vst4_lane_u8(p + 12, rgba, 3);
p += 4 * 4;
remaining_pixels -= 4;
}
while(remaining_pixels--) {
uint8_t a = p[3];
p[0] = ((uint16_t)(p[0]) * a) >> 8;
p[1] = ((uint16_t)(p[1]) * a) >> 8;
p[2] = ((uint16_t)(p[2]) * a) >> 8;
p += 4;
}
data += stride;
}
return LV_RESULT_OK;
}
#endif /* LV_USE_DRAW_SW_ASM == LV_DRAW_SW_ASM_NEON */

View File

@ -0,0 +1,58 @@
/**
* @file lv_draw_buf_convert_neon.h
*
*/
#ifndef LV_DRAW_BUF_CONVERT_NEON_H
#define LV_DRAW_BUF_CONVERT_NEON_H
#ifdef __cplusplus
extern "C" {
#endif
#include "../../../misc/lv_color.h"
#include "../../lv_draw_buf.h"
#if LV_USE_DRAW_SW_ASM == LV_DRAW_SW_ASM_NEON
/*********************
* DEFINES
*********************/
/**********************
* TYPEDEFS
**********************/
#ifndef LV_DRAW_CONVERT_PREMULTIPLY_INDEXED
#define LV_DRAW_CONVERT_PREMULTIPLY_INDEXED(buf) \
_lv_draw_buf_convert_premultiply_indexed_neon(buf)
#endif
#ifndef LV_DRAW_CONVERT_PREMULTIPLY_ARGB8888
#define LV_DRAW_CONVERT_PREMULTIPLY_ARGB8888(buf) \
_lv_draw_buf_convert_premultiply_argb8888_neon(buf)
#endif
/**********************
* GLOBAL PROTOTYPES
**********************/
/**
* Convert indexed draw_buf to premultiplied format with neon specific optimizations
* @param buf pointer to a draw buf
*/
lv_result_t _lv_draw_buf_convert_premultiply_indexed_neon(lv_draw_buf_t * buf);
/**
* Convert argb8888 draw_buf to premultiplied format with neon specific optimizations
* @param buf pointer to a draw buf
*/
lv_result_t _lv_draw_buf_convert_premultiply_argb8888_neon(lv_draw_buf_t * buf);
#endif /*LV_USE_DRAW_SW_ASM == LV_DRAW_SW_ASM_NEON*/
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif /* LV_DRAW_BUF_CONVERT_NEON_H */

View File

@ -35,7 +35,7 @@ static int32_t evaluate_cb(lv_draw_unit_t * draw_unit, lv_draw_task_t * task);
static int32_t dispatch_cb(lv_draw_unit_t * draw_unit, lv_layer_t * layer);
static int32_t delete_cb(lv_draw_unit_t * draw_unit);
#if LV_DRAW_DMA2D_ASYNC
static void thread_cb(void * arg);
static int32_t wait_finish_cb(lv_draw_unit_t * u);
#endif
#if !LV_DRAW_DMA2D_ASYNC
static bool check_transfer_completion(void);
@ -64,22 +64,22 @@ void lv_draw_dma2d_init(void)
draw_dma2d_unit->base_unit.evaluate_cb = evaluate_cb;
draw_dma2d_unit->base_unit.dispatch_cb = dispatch_cb;
draw_dma2d_unit->base_unit.delete_cb = delete_cb;
#if LV_DRAW_DMA2D_ASYNC
draw_dma2d_unit->base_unit.wait_for_finish_cb = wait_finish_cb;
#endif
draw_dma2d_unit->base_unit.name = "DMA2D";
#if LV_DRAW_DMA2D_ASYNC
g_unit = draw_dma2d_unit;
lv_result_t res = lv_thread_init(&draw_dma2d_unit->thread, "dma2d", LV_DRAW_THREAD_PRIO, thread_cb, 2 * 1024,
draw_dma2d_unit);
LV_ASSERT(res == LV_RESULT_OK);
lv_thread_sync_init(&draw_dma2d_unit->interrupt_signal);
#endif
/* enable the DMA2D clock */
#if defined(STM32F4) || defined(STM32F7) || defined(STM32U5)
#if defined(STM32F4) || defined(STM32F7) || defined(STM32U5) || defined(STM32L4)
RCC->AHB1ENR |= RCC_AHB1ENR_DMA2DEN;
#elif defined(STM32H7)
RCC->AHB3ENR |= RCC_AHB3ENR_DMA2DEN;
#elif defined(STM32H7RS)
#elif defined(STM32H7RS) || defined(STM32N6)
RCC->AHB5ENR |= RCC_AHB5ENR_DMA2DEN;
#else
#warning "LVGL can't enable the clock for DMA2D"
@ -102,15 +102,12 @@ void lv_draw_dma2d_deinit(void)
RCC->AHB1ENR &= ~RCC_AHB1ENR_DMA2DEN;
#elif defined(STM32H7)
RCC->AHB3ENR &= ~RCC_AHB3ENR_DMA2DEN;
#elif defined(STM32H7RS)
#elif defined(STM32H7RS) || defined(STM32N6)
RCC->AHB5ENR &= ~RCC_AHB5ENR_DMA2DEN;
#endif
#if LV_DRAW_DMA2D_ASYNC
lv_result_t res = lv_thread_delete(&g_unit->thread);
LV_ASSERT(res == LV_RESULT_OK);
res = lv_thread_sync_delete(&g_unit->interrupt_signal);
lv_result_t res = lv_thread_sync_delete(&g_unit->interrupt_signal);
LV_ASSERT(res == LV_RESULT_OK);
g_unit = NULL;
@ -211,72 +208,16 @@ void lv_draw_dma2d_configure_and_start_transfer(const lv_draw_dma2d_configuratio
#if LV_DRAW_DMA2D_CACHE
void lv_draw_dma2d_invalidate_cache(const lv_draw_dma2d_cache_area_t * mem_area)
{
if((SCB->CCR & SCB_CCR_DC_Msk) == 0) return; /* data cache is disabled */
uint32_t rows_remaining = mem_area->height;
uint32_t row_addr = (uint32_t)(uintptr_t) mem_area->first_byte;
uint32_t row_end_addr = 0;
__DSB();
while(rows_remaining) {
uint32_t addr = row_addr & ~(__SCB_DCACHE_LINE_SIZE - 1U);
uint32_t cache_lines = ((((row_addr + mem_area->width_bytes - 1) & ~(__SCB_DCACHE_LINE_SIZE - 1U)) - addr) /
__SCB_DCACHE_LINE_SIZE) + 1;
if(addr == row_end_addr) {
addr += __SCB_DCACHE_LINE_SIZE;
cache_lines--;
if(SCB->CCR & SCB_CCR_DC_Msk) {
SCB_InvalidateDCache();
}
while(cache_lines) {
SCB->DCIMVAC = addr;
addr += __SCB_DCACHE_LINE_SIZE;
cache_lines--;
}
row_end_addr = addr - __SCB_DCACHE_LINE_SIZE;
row_addr += mem_area->stride;
rows_remaining--;
};
__DSB();
__ISB();
}
void lv_draw_dma2d_clean_cache(const lv_draw_dma2d_cache_area_t * mem_area)
{
if((SCB->CCR & SCB_CCR_DC_Msk) == 0) return; /* data cache is disabled */
uint32_t rows_remaining = mem_area->height;
uint32_t row_addr = (uint32_t)(uintptr_t) mem_area->first_byte;
uint32_t row_end_addr = 0;
__DSB();
while(rows_remaining) {
uint32_t addr = row_addr & ~(__SCB_DCACHE_LINE_SIZE - 1U);
uint32_t cache_lines = ((((row_addr + mem_area->width_bytes - 1) & ~(__SCB_DCACHE_LINE_SIZE - 1U)) - addr) /
__SCB_DCACHE_LINE_SIZE) + 1;
if(addr == row_end_addr) {
addr += __SCB_DCACHE_LINE_SIZE;
cache_lines--;
if(SCB->CCR & SCB_CCR_DC_Msk) {
SCB_CleanDCache();
}
while(cache_lines) {
SCB->DCCMVAC = addr;
addr += __SCB_DCACHE_LINE_SIZE;
cache_lines--;
}
row_end_addr = addr - __SCB_DCACHE_LINE_SIZE;
row_addr += mem_area->stride;
rows_remaining--;
};
__DSB();
__ISB();
}
#endif
@ -344,7 +285,7 @@ static int32_t dispatch_cb(lv_draw_unit_t * draw_unit, lv_layer_t * layer)
if(draw_dma2d_unit->task_act) {
#if LV_DRAW_DMA2D_ASYNC
/*Return immediately if it's busy with draw task*/
return 0;
return LV_DRAW_UNIT_IDLE;
#else
if(!check_transfer_completion()) {
return LV_DRAW_UNIT_IDLE;
@ -402,29 +343,15 @@ static int32_t dispatch_cb(lv_draw_unit_t * draw_unit, lv_layer_t * layer)
return LV_DRAW_UNIT_IDLE;
}
void * dest = lv_draw_layer_go_to_xy(layer,
clipped_coords.x1 - layer->buf_area.x1,
clipped_coords.y1 - layer->buf_area.y1);
if(dsc->opa >= LV_OPA_MAX) {
lv_draw_dma2d_opaque_image(
t,
dest,
&clipped_coords,
lv_draw_buf_width_to_stride(lv_area_get_width(&layer->buf_area), dsc->base.layer->color_format));
lv_draw_dma2d_opaque_image(t, dsc, &t->area);
}
else {
lv_draw_dma2d_image(
t,
dest,
&clipped_coords,
lv_draw_buf_width_to_stride(lv_area_get_width(&layer->buf_area), dsc->base.layer->color_format));
lv_draw_dma2d_image(t, dsc, &t->area);
}
}
#if !LV_DRAW_DMA2D_ASYNC
lv_draw_dispatch_request();
#endif
return 1;
}
@ -435,23 +362,18 @@ static int32_t delete_cb(lv_draw_unit_t * draw_unit)
}
#if LV_DRAW_DMA2D_ASYNC
static void thread_cb(void * arg)
static int32_t wait_finish_cb(lv_draw_unit_t * draw_unit)
{
lv_draw_dma2d_unit_t * u = arg;
lv_draw_dma2d_unit_t * u = (lv_draw_dma2d_unit_t *) draw_unit;
lv_thread_sync_init(&u->interrupt_signal);
while(1) {
do {
/* If a DMA2D task has been dispatched, wait its interrupt */
lv_thread_sync_wait(&u->interrupt_signal);
} while(u->task_act != NULL);
/* Then cleanup the DMA2D draw unit to accept a new task */
post_transfer_tasks(u);
lv_draw_dispatch_request();
return 0;
}
}
#endif
#endif /*LV_DRAW_DMA2D_ASYNC*/
#if !LV_DRAW_DMA2D_ASYNC
static bool check_transfer_completion(void)
@ -465,7 +387,7 @@ static void post_transfer_tasks(lv_draw_dma2d_unit_t * u)
#if LV_DRAW_DMA2D_CACHE
lv_draw_dma2d_invalidate_cache(&u->writing_area);
#endif
u->task_act->state = LV_DRAW_TASK_STATE_READY;
u->task_act->state = LV_DRAW_TASK_STATE_FINISHED;
u->task_act = NULL;
}

View File

@ -93,8 +93,9 @@ void lv_draw_dma2d_fill(lv_draw_task_t * t, void * first_pixel, int32_t w, int32
#endif
uint32_t output_offset = (stride / cf_size) - w;
lv_draw_dma2d_configuration_t conf = {
.mode = LV_DRAW_DMA2D_MODE_MEMORY_TO_MEMORY_WITH_BLENDING_AND_FIXED_COLOR_FG,
.mode = LV_DRAW_DMA2D_MODE_MEMORY_TO_MEMORY_WITH_BLENDING,
.w = w,
.h = h,
@ -103,11 +104,16 @@ void lv_draw_dma2d_fill(lv_draw_task_t * t, void * first_pixel, int32_t w, int32
.output_cf = output_cf,
.fg_color = lv_color_to_u32(color),
.fg_address = first_pixel,
.fg_offset = output_offset,
.fg_alpha_mode = LV_DRAW_DMA2D_ALPHA_MODE_REPLACE_ALPHA_CHANNEL,
.fg_alpha = opa,
.fg_cf = LV_DRAW_DMA2D_FGBG_CF_A8,
.bg_address = first_pixel,
.bg_offset = output_offset,
.bg_alpha_mode = LV_DRAW_DMA2D_ALPHA_MODE_NO_MODIFY_IMAGE_ALPHA_CHANNEL,
.bg_alpha = opa,
.bg_cf = (lv_draw_dma2d_fgbg_cf_t) output_cf
};

View File

@ -1,5 +1,5 @@
/**
* @file lv_draw_dma2d_image.c
* @file lv_draw_dma2d_img.c
*
*/
@ -10,6 +10,10 @@
#include "lv_draw_dma2d_private.h"
#if LV_USE_DRAW_DMA2D
#include "../lv_draw_image_private.h"
#include "../lv_image_decoder_private.h"
#include "../../misc/lv_area_private.h"
/*********************
* DEFINES
*********************/
@ -22,6 +26,14 @@
* STATIC PROTOTYPES
**********************/
static void lv_draw_dma2d_opaque_image_core(lv_draw_task_t * t, const lv_draw_image_dsc_t * draw_dsc,
const lv_image_decoder_dsc_t * decoder_dsc, lv_draw_image_sup_t * sup,
const lv_area_t * img_coords, const lv_area_t * clipped_img_area);
static void lv_draw_dma2d_image_core(lv_draw_task_t * t, const lv_draw_image_dsc_t * draw_dsc,
const lv_image_decoder_dsc_t * decoder_dsc, lv_draw_image_sup_t * sup,
const lv_area_t * img_coords, const lv_area_t * clipped_img_area);
/**********************
* STATIC VARIABLES
**********************/
@ -34,25 +46,60 @@
* GLOBAL FUNCTIONS
**********************/
void lv_draw_dma2d_opaque_image(lv_draw_task_t * t, void * dest_first_pixel, lv_area_t * clipped_coords,
int32_t dest_stride)
void lv_draw_dma2d_opaque_image(lv_draw_task_t * t, const lv_draw_image_dsc_t * draw_dsc,
const lv_area_t * coords)
{
int32_t w = lv_area_get_width(clipped_coords);
int32_t h = lv_area_get_height(clipped_coords);
if(!draw_dsc->tile) {
lv_draw_image_normal_helper(t, draw_dsc, coords, lv_draw_dma2d_opaque_image_core);
}
else {
lv_draw_image_tiled_helper(t, draw_dsc, coords, lv_draw_dma2d_opaque_image_core);
}
}
lv_draw_image_dsc_t * dsc = t->draw_dsc;
lv_color_format_t output_cf = dsc->base.layer->color_format;
lv_color_format_t image_cf = dsc->header.cf;
void lv_draw_dma2d_image(lv_draw_task_t * t, const lv_draw_image_dsc_t * draw_dsc,
const lv_area_t * coords)
{
if(!draw_dsc->tile) {
lv_draw_image_normal_helper(t, draw_dsc, coords, lv_draw_dma2d_image_core);
}
else {
lv_draw_image_tiled_helper(t, draw_dsc, coords, lv_draw_dma2d_image_core);
}
}
/**********************
* STATIC FUNCTIONS
**********************/
static void lv_draw_dma2d_opaque_image_core(lv_draw_task_t * t, const lv_draw_image_dsc_t * draw_dsc,
const lv_image_decoder_dsc_t * decoder_dsc, lv_draw_image_sup_t * sup,
const lv_area_t * img_coords, const lv_area_t * clipped_img_area)
{
LV_UNUSED(sup);
LV_UNUSED(img_coords);
lv_layer_t * layer = t->target_layer;
void * dest_first_pixel = lv_draw_layer_go_to_xy(layer,
clipped_img_area->x1 - layer->buf_area.x1,
clipped_img_area->y1 - layer->buf_area.y1);
int32_t dest_stride = lv_draw_buf_width_to_stride(lv_area_get_width(&layer->buf_area), layer->color_format);
int32_t w = lv_area_get_width(clipped_img_area);
int32_t h = lv_area_get_height(clipped_img_area);
lv_color_format_t output_cf = layer->color_format;
uint32_t output_cf_size = lv_color_format_get_size(output_cf);
lv_draw_dma2d_output_cf_t output_cf_dma2d = lv_draw_dma2d_cf_to_dma2d_output_cf(output_cf);
uint32_t output_cf_size = LV_COLOR_FORMAT_GET_SIZE(output_cf);
const lv_draw_buf_t * decoded = decoder_dsc->decoded;
const uint8_t * src_buf = decoded->data;
uint32_t image_stride = decoded->header.stride;
lv_color_format_t image_cf = decoded->header.cf;
lv_draw_dma2d_fgbg_cf_t image_cf_dma2d = (lv_draw_dma2d_fgbg_cf_t) lv_draw_dma2d_cf_to_dma2d_output_cf(image_cf);
uint32_t image_cf_size = LV_COLOR_FORMAT_GET_SIZE(image_cf);
const lv_image_dsc_t * img_dsc = dsc->src;
uint32_t image_stride = img_dsc->header.stride;
if(image_stride == 0) image_stride = image_cf_size * img_dsc->header.w;
if(image_stride == 0) image_stride = image_cf_size * decoded->header.w;
#if LV_DRAW_DMA2D_CACHE
lv_draw_dma2d_cache_area_t dest_area = {
@ -69,9 +116,9 @@ void lv_draw_dma2d_opaque_image(lv_draw_task_t * t, void * dest_first_pixel, lv_
}
#endif
const void * image_first_byte = img_dsc->data
+ (image_stride * (clipped_coords->y1 - dsc->image_area.y1))
+ (image_cf_size * (clipped_coords->x1 - dsc->image_area.x1));
const void * image_first_byte = src_buf
+ (image_stride * (clipped_img_area->y1 - draw_dsc->image_area.y1))
+ (image_cf_size * (clipped_img_area->x1 - draw_dsc->image_area.x1));
#if LV_DRAW_DMA2D_CACHE
lv_draw_dma2d_cache_area_t src_area = {
@ -121,26 +168,35 @@ void lv_draw_dma2d_opaque_image(lv_draw_task_t * t, void * dest_first_pixel, lv_
lv_draw_dma2d_configure_and_start_transfer(&conf);
}
void lv_draw_dma2d_image(lv_draw_task_t * t, void * dest_first_pixel, lv_area_t * clipped_coords,
int32_t dest_stride)
static void lv_draw_dma2d_image_core(lv_draw_task_t * t, const lv_draw_image_dsc_t * draw_dsc,
const lv_image_decoder_dsc_t * decoder_dsc, lv_draw_image_sup_t * sup,
const lv_area_t * img_coords, const lv_area_t * clipped_img_area)
{
int32_t w = lv_area_get_width(clipped_coords);
int32_t h = lv_area_get_height(clipped_coords);
LV_UNUSED(sup);
LV_UNUSED(img_coords);
lv_draw_image_dsc_t * dsc = t->draw_dsc;
lv_color_format_t output_cf = dsc->base.layer->color_format;
lv_color_format_t image_cf = dsc->header.cf;
lv_opa_t opa = dsc->opa;
lv_layer_t * layer = t->target_layer;
void * dest_first_pixel = lv_draw_layer_go_to_xy(layer,
clipped_img_area->x1 - layer->buf_area.x1,
clipped_img_area->y1 - layer->buf_area.y1);
int32_t dest_stride = lv_draw_buf_width_to_stride(lv_area_get_width(&layer->buf_area), layer->color_format);
int32_t w = lv_area_get_width(clipped_img_area);
int32_t h = lv_area_get_height(clipped_img_area);
lv_color_format_t output_cf = layer->color_format;
uint32_t output_cf_size = lv_color_format_get_size(output_cf);
lv_draw_dma2d_output_cf_t output_cf_dma2d = lv_draw_dma2d_cf_to_dma2d_output_cf(output_cf);
uint32_t output_cf_size = LV_COLOR_FORMAT_GET_SIZE(output_cf);
const lv_draw_buf_t * decoded = decoder_dsc->decoded;
const uint8_t * src_buf = decoded->data;
uint32_t image_stride = decoded->header.stride;
lv_color_format_t image_cf = decoded->header.cf;
lv_opa_t opa = draw_dsc->opa;
lv_draw_dma2d_fgbg_cf_t image_cf_dma2d = (lv_draw_dma2d_fgbg_cf_t) lv_draw_dma2d_cf_to_dma2d_output_cf(image_cf);
uint32_t image_cf_size = LV_COLOR_FORMAT_GET_SIZE(image_cf);
const lv_image_dsc_t * img_dsc = dsc->src;
uint32_t image_stride = img_dsc->header.stride;
if(image_stride == 0) image_stride = image_cf_size * img_dsc->header.w;
if(image_stride == 0) image_stride = image_cf_size * decoded->header.w;
#if LV_DRAW_DMA2D_CACHE
lv_draw_dma2d_cache_area_t dest_area = {
@ -155,9 +211,9 @@ void lv_draw_dma2d_image(lv_draw_task_t * t, void * dest_first_pixel, lv_area_t
lv_draw_dma2d_clean_cache(&dest_area);
#endif
const void * image_first_byte = img_dsc->data
+ (image_stride * (clipped_coords->y1 - dsc->image_area.y1))
+ (image_cf_size * (clipped_coords->x1 - dsc->image_area.x1));
const void * image_first_byte = src_buf
+ (image_stride * (clipped_img_area->y1 - draw_dsc->image_area.y1))
+ (image_cf_size * (clipped_img_area->x1 - draw_dsc->image_area.x1));
#if LV_DRAW_DMA2D_CACHE
lv_draw_dma2d_cache_area_t src_area = {
@ -203,8 +259,4 @@ void lv_draw_dma2d_image(lv_draw_task_t * t, void * dest_first_pixel, lv_area_t
lv_draw_dma2d_configure_and_start_transfer(&conf);
}
/**********************
* STATIC FUNCTIONS
**********************/
#endif /*LV_USE_DRAW_DMA2D*/

View File

@ -31,7 +31,7 @@ extern "C" {
#define LV_DRAW_DMA2D_ASYNC 0
#endif
#if defined(__CORTEX_M) && (__CORTEX_M == 7)
#if defined(__CORTEX_M) && ((__CORTEX_M == 7) || (__CORTEX_M == 55))
#define LV_DRAW_DMA2D_CACHE 1
#else
#define LV_DRAW_DMA2D_CACHE 0
@ -120,7 +120,6 @@ typedef struct {
lv_draw_dma2d_cache_area_t writing_area;
#endif
#if LV_DRAW_DMA2D_ASYNC
lv_thread_t thread;
lv_thread_sync_t interrupt_signal;
#endif
} lv_draw_dma2d_unit_t;
@ -131,10 +130,10 @@ typedef struct {
void lv_draw_dma2d_opaque_fill(lv_draw_task_t * t, void * first_pixel, int32_t w, int32_t h, int32_t stride);
void lv_draw_dma2d_fill(lv_draw_task_t * t, void * first_pixel, int32_t w, int32_t h, int32_t stride);
void lv_draw_dma2d_opaque_image(lv_draw_task_t * t, void * dest_first_pixel, lv_area_t * clipped_coords,
int32_t dest_stride);
void lv_draw_dma2d_image(lv_draw_task_t * t, void * dest_first_pixel, lv_area_t * clipped_coords,
int32_t dest_stride);
void lv_draw_dma2d_opaque_image(lv_draw_task_t * t, const lv_draw_image_dsc_t * draw_dsc,
const lv_area_t * coords);
void lv_draw_dma2d_image(lv_draw_task_t * t, const lv_draw_image_dsc_t * draw_dsc,
const lv_area_t * coords);
lv_draw_dma2d_output_cf_t lv_draw_dma2d_cf_to_dma2d_output_cf(lv_color_format_t cf);
uint32_t lv_draw_dma2d_color_to_dma2d_color(lv_draw_dma2d_output_cf_t cf, lv_color_t color);
void lv_draw_dma2d_configure_and_start_transfer(const lv_draw_dma2d_configuration_t * conf);

View File

@ -0,0 +1,255 @@
/**
* @file lv_draw_ppa.c
*
*/
/*********************
* INCLUDES
*********************/
#include "lv_draw_ppa_private.h"
#include "lv_draw_ppa.h"
#if LV_USE_PPA
/*********************
* DEFINES
*********************/
#define DRAW_UNIT_ID_PPA 80
#define DRAW_UNIT_PPA_PREF_SCORE 70
/**********************
* STATIC PROTOTYPES
**********************/
static int32_t ppa_evaluate(lv_draw_unit_t * draw_unit, lv_draw_task_t * task);
static int32_t ppa_dispatch(lv_draw_unit_t * draw_unit, lv_layer_t * layer);
static int32_t ppa_delete(lv_draw_unit_t * draw_unit);
static void ppa_execute_drawing(lv_draw_ppa_unit_t * u);
static bool ppa_isr(ppa_client_handle_t ppa_client, ppa_event_data_t * event_data, void * user_data);
#if LV_PPA_NONBLOCKING_OPS
static void ppa_thread(void * arg);
#endif
static bool g_ppa_complete = true;
/**********************
* GLOBAL FUNCTIONS
**********************/
void lv_draw_ppa_init(void)
{
esp_err_t res;
ppa_client_config_t cfg = {0};
ppa_event_callbacks_t ppa_cbs = {
.on_trans_done = ppa_isr,
};
/* Create draw unit */
lv_draw_buf_ppa_init_handlers();
lv_draw_ppa_unit_t * draw_ppa_unit = lv_draw_create_unit(sizeof(lv_draw_ppa_unit_t));
draw_ppa_unit->base_unit.evaluate_cb = ppa_evaluate;
draw_ppa_unit->base_unit.dispatch_cb = ppa_dispatch;
draw_ppa_unit->base_unit.delete_cb = ppa_delete;
draw_ppa_unit->base_unit.name = "ESP_PPA";
/* Register SRM client */
cfg.oper_type = PPA_OPERATION_SRM;
cfg.max_pending_trans_num = 8;
cfg.data_burst_length = PPA_DATA_BURST_LENGTH_128;
res = ppa_register_client(&cfg, &draw_ppa_unit->srm_client);
LV_ASSERT(res == ESP_OK);
/* Register Fill client */
cfg.oper_type = PPA_OPERATION_FILL;
cfg.data_burst_length = PPA_DATA_BURST_LENGTH_128;
res = ppa_register_client(&cfg, &draw_ppa_unit->fill_client);
LV_ASSERT(res == ESP_OK);
/* Register Blend client */
cfg.oper_type = PPA_OPERATION_BLEND;
cfg.data_burst_length = PPA_DATA_BURST_LENGTH_32;
res = ppa_register_client(&cfg, &draw_ppa_unit->blend_client);
LV_ASSERT(res == ESP_OK);
ppa_client_register_event_callbacks(draw_ppa_unit->srm_client, &ppa_cbs);
ppa_client_register_event_callbacks(draw_ppa_unit->fill_client, &ppa_cbs);
ppa_client_register_event_callbacks(draw_ppa_unit->blend_client, &ppa_cbs);
#if LV_PPA_NONBLOCKING_OPS
lv_result_t lv_res = lv_thread_init(&draw_ppa_unit->thread, "ppa_thread", LV_DRAW_THREAD_PRIO, ppa_thread, 8192,
draw_ppa_unit);
LV_ASSERT(lv_res == LV_RESULT_OK);
#endif
}
void lv_draw_ppa_deinit(void)
{
/* No global deinit required */
}
/**********************
* STATIC FUNCTIONS
**********************/
static bool ppa_isr(ppa_client_handle_t ppa_client, ppa_event_data_t * event_data, void * user_data)
{
g_ppa_complete = true;
#if LV_PPA_NONBLOCKING_OPS
lv_draw_ppa_unit_t * u = (lv_draw_ppa_unit_t *)user_data;
lv_thread_sync_signal_isr(&u->interrupt_signal);
#endif
return false;
}
static int32_t ppa_evaluate(lv_draw_unit_t * u, lv_draw_task_t * t)
{
LV_UNUSED(u);
const lv_draw_dsc_base_t * base = (lv_draw_dsc_base_t *)t->draw_dsc;
if(!ppa_dest_cf_supported(base->layer->color_format)) return 0;
switch(t->type) {
case LV_DRAW_TASK_TYPE_FILL: {
const lv_draw_fill_dsc_t * dsc = (lv_draw_fill_dsc_t *)t->draw_dsc;
if((dsc->radius != 0 || dsc->grad.dir != LV_GRAD_DIR_NONE)) return 0;
if(dsc->opa <= (lv_opa_t)LV_OPA_MAX) return 0;
if(t->preference_score > DRAW_UNIT_PPA_PREF_SCORE) {
t->preference_score = DRAW_UNIT_PPA_PREF_SCORE;
t->preferred_draw_unit_id = DRAW_UNIT_ID_PPA;
}
return 1;
}
#if LV_USE_PPA_IMG
case LV_DRAW_TASK_TYPE_IMAGE: {
lv_draw_image_dsc_t * dsc = t->draw_dsc;
if(!(dsc->header.cf < LV_COLOR_FORMAT_PROPRIETARY_START
&& dsc->clip_radius == 0
&& dsc->bitmap_mask_src == NULL
&& dsc->sup == NULL
&& dsc->tile == 0
&& dsc->blend_mode == LV_BLEND_MODE_NORMAL
&& dsc->recolor_opa <= LV_OPA_MIN
&& dsc->opa <= (lv_opa_t)LV_OPA_MAX
&& dsc->skew_y == 0
&& dsc->skew_x == 0
&& dsc->scale_x == 256
&& dsc->scale_y == 256
&& dsc->rotation == 0
&& lv_image_src_get_type(dsc->src) == LV_IMAGE_SRC_VARIABLE
&& (dsc->header.cf == LV_COLOR_FORMAT_RGB888
|| dsc->header.cf == LV_COLOR_FORMAT_RGB565)
&& (dsc->base.layer->color_format == LV_COLOR_FORMAT_RGB888
|| dsc->base.layer->color_format == LV_COLOR_FORMAT_RGB565))) {
return 0;
}
if(t->preference_score > DRAW_UNIT_PPA_PREF_SCORE) {
t->preference_score = DRAW_UNIT_PPA_PREF_SCORE;
t->preferred_draw_unit_id = DRAW_UNIT_ID_PPA;
}
return 1;
}
#endif
default:
return 0;
}
}
static int32_t ppa_dispatch(lv_draw_unit_t * draw_unit, lv_layer_t * layer)
{
lv_draw_ppa_unit_t * u = (lv_draw_ppa_unit_t *)draw_unit;
if(u->task_act) {
if(!g_ppa_complete) {
return LV_DRAW_UNIT_IDLE;
}
else {
u->task_act->state = LV_DRAW_TASK_STATE_FINISHED;
u->task_act = NULL;
}
}
lv_draw_task_t * t = lv_draw_get_available_task(layer, NULL, DRAW_UNIT_ID_PPA);
if(!t || t->preferred_draw_unit_id != DRAW_UNIT_ID_PPA) return LV_DRAW_UNIT_IDLE;
if(!lv_draw_layer_alloc_buf(layer)) return LV_DRAW_UNIT_IDLE;
t->state = LV_DRAW_TASK_STATE_IN_PROGRESS;
u->task_act = t;
u->task_act->draw_unit = draw_unit;
ppa_execute_drawing(u);
#if !LV_PPA_NONBLOCKING_OPS
u->task_act->state = LV_DRAW_TASK_STATE_FINISHED;
u->task_act = NULL;
lv_draw_dispatch_request();
#endif
return 1;
}
static int32_t ppa_delete(lv_draw_unit_t * draw_unit)
{
lv_draw_ppa_unit_t * u = (lv_draw_ppa_unit_t *)draw_unit;
ppa_unregister_client(u->srm_client);
ppa_unregister_client(u->fill_client);
ppa_unregister_client(u->blend_client);
return 0;
}
static void ppa_execute_drawing(lv_draw_ppa_unit_t * u)
{
lv_draw_task_t * t = u->task_act;
lv_layer_t * layer = t->target_layer;
lv_draw_buf_t * buf = layer->draw_buf;
lv_area_t area;
lv_area_t draw_area;
if(!lv_area_intersect(&area, &t->area, &t->clip_area)) return;
lv_area_move(&draw_area, -layer->buf_area.x1, -layer->buf_area.y1);
lv_draw_buf_invalidate_cache(buf, &draw_area);
switch(t->type) {
case LV_DRAW_TASK_TYPE_FILL:
g_ppa_complete = false;
lv_draw_ppa_fill(t, (lv_draw_fill_dsc_t *)t->draw_dsc, &area);
break;
case LV_DRAW_TASK_TYPE_IMAGE:
g_ppa_complete = false;
lv_draw_ppa_img(t, (lv_draw_image_dsc_t *)t->draw_dsc, &area);
break;
default:
break;
}
}
#if LV_PPA_NONBLOCKING_OPS
static void ppa_thread(void * arg)
{
lv_draw_ppa_unit_t * u = arg;
lv_thread_sync_init(&u->interrupt_signal);
while(1) {
do {
lv_thread_sync_wait(&u->interrupt_signal);
} while(u->task_act != NULL);
u->task_act->state = LV_DRAW_TASK_STATE_FINISHED;
u->task_act = NULL;
lv_draw_dispatch_request();
}
}
#endif
#endif /*LV_USE_PPA*/

View File

@ -0,0 +1,57 @@
/**
* @file lv_draw_ppa.h
*
*/
#ifndef LV_DRAW_PPA_H
#define LV_DRAW_PPA_H
#ifdef __cplusplus
extern "C" {
#endif
/*********************
* INCLUDES
*********************/
#include "../../../lv_conf_internal.h"
#if LV_USE_PPA
#include "../../lv_draw_private.h"
#include "../../../display/lv_display_private.h"
#include "../../../misc/lv_area_private.h"
/*********************
* DEFINES
*********************/
/**********************
* TYPEDEFS
**********************/
/**********************
* GLOBAL PROTOTYPES
**********************/
void lv_draw_ppa_init(void);
void lv_draw_ppa_deinit(void);
void lv_draw_buf_ppa_init_handlers(void);
void lv_draw_ppa_fill(lv_draw_task_t * t, const lv_draw_fill_dsc_t * dsc,
const lv_area_t * coords);
void lv_draw_ppa_img(lv_draw_task_t * t, const lv_draw_image_dsc_t * dsc,
const lv_area_t * coords);
/**********************
* MACROS
**********************/
#endif /* LV_USE_PPA */
#ifdef __cplusplus
} /*extern "C"*/
#endif
#endif /* LV_DRAW_PPA_H */

View File

@ -0,0 +1,52 @@
/**
* @file lv_draw_ppa_buf.c
*
*/
/*********************
* INCLUDES
*********************/
#include "lv_draw_ppa_private.h"
#include "lv_draw_ppa.h"
#if LV_USE_PPA
#include LV_STDINT_INCLUDE
#include "../../lv_draw_buf_private.h"
/*********************
* DEFINES
*********************/
/**********************
* TYPEDEFS
*********************/
/**********************
* STATIC PROTOTYPES
*********************/
static void invalidate_cache(const lv_draw_buf_t * draw_buf, const lv_area_t * area);
/**********************
* GLOBAL FUNCTIONS
*********************/
void lv_draw_buf_ppa_init_handlers(void)
{
lv_draw_buf_handlers_t * handlers = lv_draw_buf_get_handlers();
lv_draw_buf_handlers_t * image_handlers = lv_draw_buf_get_image_handlers();
handlers->invalidate_cache_cb = invalidate_cache;
image_handlers->invalidate_cache_cb = invalidate_cache;
}
/**********************
* STATIC FUNCTIONS
*********************/
static void invalidate_cache(const lv_draw_buf_t * draw_buf, const lv_area_t * area)
{
esp_cache_msync((void *)PPA_PTR_ALIGN_DOWN(draw_buf->data, CONFIG_CACHE_L1_CACHE_LINE_SIZE),
PPA_ALIGN_DOWN(draw_buf->data_size, CONFIG_CACHE_L1_CACHE_LINE_SIZE),
ESP_CACHE_MSYNC_FLAG_DIR_C2M | ESP_CACHE_MSYNC_FLAG_TYPE_DATA);
}
#endif /* LV_USE_PPA */

View File

@ -0,0 +1,48 @@
/**
* @file lv_draw_ppa_fill.c
*
*/
#include "lv_draw_ppa_private.h"
#include "lv_draw_ppa.h"
#if LV_USE_PPA
void lv_draw_ppa_fill(lv_draw_task_t * t, const lv_draw_fill_dsc_t * dsc,
const lv_area_t * coords)
{
lv_draw_ppa_unit_t * u = (lv_draw_ppa_unit_t *)t->draw_unit;
lv_draw_buf_t * draw_buf = t->target_layer->draw_buf;
int width = lv_area_get_width(coords);
int height = lv_area_get_height(coords);
if(width <= 0 || height <= 0) {
LV_LOG_WARN("Invalid draw area for filling!");
return;
}
ppa_fill_oper_config_t cfg = {
.fill_argb_color.val = lv_color_to_u32(dsc->color),
.fill_block_w = width,
.fill_block_h = height,
.out = {
.buffer = draw_buf->data,
.buffer_size = draw_buf->data_size,
.pic_w = width,
.pic_h = height,
.block_offset_x = 0,
.block_offset_y = 0,
.fill_cm = lv_color_format_to_ppa_fill(draw_buf->header.cf),
},
.mode = PPA_TRANS_MODE_NON_BLOCKING,
.user_data = u,
};
esp_err_t ret = ppa_do_fill(u->fill_client, &cfg);
if(ret != ESP_OK) {
LV_LOG_ERROR("PPA fill failed: %d", ret);
}
}
#endif /* LV_USE_PPA */

View File

@ -0,0 +1,77 @@
/**
* @file lv_draw_ppa_img.c
*
*/
#include "lv_draw_ppa_private.h"
#include "lv_draw_ppa.h"
#if LV_USE_PPA
void lv_draw_ppa_img(lv_draw_task_t * t, const lv_draw_image_dsc_t * dsc,
const lv_area_t * coords)
{
if(dsc->opa <= (lv_opa_t)LV_OPA_MIN) {
return;
}
lv_draw_ppa_unit_t * u = (lv_draw_ppa_unit_t *)t->draw_unit;
lv_draw_buf_t * draw_buf = t->target_layer->draw_buf;
const lv_image_dsc_t * img_dsc = dsc->src;
int width = lv_area_get_width(coords);
int height = lv_area_get_height(coords);
ppa_blend_oper_config_t cfg = {
.in_bg = {
.buffer = (void *)draw_buf->data,
.pic_w = draw_buf->header.w,
.pic_h = draw_buf->header.h,
.block_w = width,
.block_h = height,
.block_offset_x = 0,
.block_offset_y = 0,
.blend_cm = lv_color_format_to_ppa_blend(draw_buf->header.cf),
},
.bg_rgb_swap = false,
.bg_byte_swap = false,
.bg_alpha_update_mode = PPA_ALPHA_NO_CHANGE,
.bg_alpha_fix_val = 0,
.bg_ck_en = false,
.in_fg = {
.buffer = (void *)img_dsc->data,
.pic_w = width,
.pic_h = height,
.block_w = width,
.block_h = height,
.block_offset_x = 0,
.block_offset_y = 0,
.blend_cm = lv_color_format_to_ppa_blend(dsc->header.cf),
},
.fg_rgb_swap = false,
.fg_byte_swap = false,
.fg_alpha_update_mode = PPA_ALPHA_NO_CHANGE,
.fg_alpha_fix_val = 0xFF,
.fg_ck_en = false,
.out = {
.buffer = draw_buf->data,
.buffer_size = PPA_ALIGN_UP(draw_buf->data_size, CONFIG_CACHE_L1_CACHE_LINE_SIZE),
.pic_w = draw_buf->header.w,
.pic_h = draw_buf->header.h,
.block_offset_x = 0,
.block_offset_y = 0,
.blend_cm = lv_color_format_to_ppa_blend(draw_buf->header.cf),
},
.mode = PPA_TRANS_MODE_NON_BLOCKING,
.user_data = u,
};
esp_err_t ret = ppa_do_blend(u->blend_client, &cfg);
if(ret != ESP_OK) {
LV_LOG_WARN("PPA draw_img blend failed: %d", ret);
}
}
#endif /* LV_USE_PPA */

View File

@ -0,0 +1,185 @@
/**
* @file lv_draw_ppa_private.h
*
*/
#ifndef LV_DRAW_PPA_PRIVATE_H
#define LV_DRAW_PPA_PRIVATE_H
#ifdef __cplusplus
extern "C" {
#endif
/*********************
* INCLUDES
*********************/
#include "../../../lv_conf_internal.h"
#if LV_USE_PPA
#if LV_PPA_NONBLOCKING_OPS
#error "PPA draw in nonblocking is experimental and not supported yet, please make it to 0!"
#endif
#ifndef LV_PPA_NONBLOCKING_OPS
#define LV_PPA_NONBLOCKING_OPS 0
#endif
#include LV_STDDEF_INCLUDE
#include LV_STDBOOL_INCLUDE
#include LV_STDINT_INCLUDE
#include "../../../misc/lv_color.h"
#include "../../../misc/lv_log.h"
#include "../../lv_draw_private.h"
#include "../../../display/lv_display_private.h"
#include "../../../misc/lv_area_private.h"
/* The ppa driver depends heavily on the esp-idf headers*/
#include "sdkconfig.h"
#if CONFIG_LV_ATTRIBUTE_MEM_ALIGN_SIZE != CONFIG_CACHE_L1_CACHE_LINE_SIZE || CONFIG_LV_DRAW_BUF_ALIGN != CONFIG_CACHE_L1_CACHE_LINE_SIZE
#error "For using PPA buffers need to be aligned to 64-byte boundary!"
#endif
#ifndef CONFIG_SOC_PPA_SUPPORTED
#error "This SoC does not support PPA"
#endif
#include "driver/ppa.h"
#include "esp_heap_caps.h"
#include "esp_err.h"
#include "hal/color_hal.h"
#include "esp_cache.h"
#include "esp_log.h"
/*********************
* DEFINES
*********************/
/**********************
* TYPEDEFS
**********************/
typedef struct lv_draw_ppa_unit {
lv_draw_unit_t base_unit;
lv_draw_task_t * task_act;
ppa_client_handle_t srm_client;
ppa_client_handle_t fill_client;
ppa_client_handle_t blend_client;
uint8_t * buf;
#if LV_PPA_NONBLOCKING_OPS
lv_thread_t thread;
lv_thread_sync_t interrupt_signal;
#endif
} lv_draw_ppa_unit_t;
/**********************
* STATIC PROTOTYPES
**********************/
/**********************
* GLOBAL PROTOTYPES
**********************/
/**********************
* MACROS
**********************/
/**********************
* STATIC FUNCTIONS
**********************/
static inline bool ppa_src_cf_supported(lv_color_format_t cf)
{
bool is_cf_supported = false;
switch(cf) {
case LV_COLOR_FORMAT_RGB565:
case LV_COLOR_FORMAT_ARGB8888:
case LV_COLOR_FORMAT_XRGB8888:
is_cf_supported = true;
break;
default:
break;
}
return is_cf_supported;
}
static inline bool ppa_dest_cf_supported(lv_color_format_t cf)
{
bool is_cf_supported = false;
switch(cf) {
case LV_COLOR_FORMAT_RGB565:
case LV_COLOR_FORMAT_RGB888:
case LV_COLOR_FORMAT_ARGB8888:
case LV_COLOR_FORMAT_XRGB8888:
is_cf_supported = true;
break;
default:
break;
}
return is_cf_supported;
}
static inline ppa_fill_color_mode_t lv_color_format_to_ppa_fill(lv_color_format_t lv_fmt)
{
switch(lv_fmt) {
case LV_COLOR_FORMAT_RGB565:
return PPA_FILL_COLOR_MODE_RGB565;
case LV_COLOR_FORMAT_RGB888:
return PPA_FILL_COLOR_MODE_RGB888;
case LV_COLOR_FORMAT_ARGB8888:
case LV_COLOR_FORMAT_XRGB8888:
return PPA_FILL_COLOR_MODE_ARGB8888;
default:
return PPA_FILL_COLOR_MODE_RGB565;
}
}
static inline ppa_blend_color_mode_t lv_color_format_to_ppa_blend(lv_color_format_t lv_fmt)
{
switch(lv_fmt) {
case LV_COLOR_FORMAT_RGB565:
return PPA_BLEND_COLOR_MODE_RGB565;
case LV_COLOR_FORMAT_RGB888:
return PPA_BLEND_COLOR_MODE_RGB888;
case LV_COLOR_FORMAT_ARGB8888:
case LV_COLOR_FORMAT_XRGB8888:
return PPA_BLEND_COLOR_MODE_ARGB8888;
default:
return PPA_BLEND_COLOR_MODE_RGB565;
}
}
static inline ppa_srm_color_mode_t lv_color_format_to_ppa_srm(lv_color_format_t lv_fmt)
{
switch(lv_fmt) {
case LV_COLOR_FORMAT_RGB565:
return PPA_SRM_COLOR_MODE_RGB565;
case LV_COLOR_FORMAT_RGB888:
return PPA_SRM_COLOR_MODE_RGB888;
case LV_COLOR_FORMAT_XRGB8888:
case LV_COLOR_FORMAT_ARGB8888:
return PPA_SRM_COLOR_MODE_ARGB8888;
default:
return PPA_SRM_COLOR_MODE_RGB565;
}
}
#define PPA_ALIGN_UP(x, align) ((((x) + (align) - 1) / (align)) * (align))
#define PPA_PTR_ALIGN_UP(p, align) \
((void*)(((uintptr_t)(p) + (uintptr_t)((align) - 1)) & ~(uintptr_t)((align) - 1)))
#define PPA_ALIGN_DOWN(x, align) ((((x) - (align) - 1) / (align)) * (align))
#define PPA_PTR_ALIGN_DOWN(p, align) \
((void*)(((uintptr_t)(p) - (uintptr_t)((align) - 1)) & ~(uintptr_t)((align) - 1)))
#endif /* LV_USE_PPA */
#ifdef __cplusplus
} /*extern "C"*/
#endif
#endif /* LV_DRAW_PPA_PRIVATE_H */

View File

@ -0,0 +1,164 @@
/**
* @file lv_draw_eve.c
*
*/
/* Created on: 3 dic 2023
* Author: juanj
*
* Modified by LVGL
*/
/*********************
* INCLUDES
*********************/
#include "lv_draw_eve_private.h"
#if LV_USE_DRAW_EVE
#include "../../core/lv_refr.h"
#include "../../display/lv_display_private.h"
#include "../../stdlib/lv_string.h"
#include "lv_draw_eve_ram_g.h"
#include "lv_draw_eve.h"
#include "lv_eve.h"
/*********************
* DEFINES
*********************/
#define DRAW_UNIT_ID_EVE 9
/**********************
* TYPEDEFS
**********************/
/**********************
* STATIC PROTOTYPES
**********************/
static void eve_execute_drawing(lv_draw_eve_unit_t * u);
static int32_t eve_dispatch(lv_draw_unit_t * draw_unit, lv_layer_t * layer);
static int32_t eve_evaluate(lv_draw_unit_t * draw_unit, lv_draw_task_t * task);
static void disp_delete_cb(lv_event_t * e);
/**********************
* GLOBAL PROTOTYPES
**********************/
/**********************
* STATIC VARIABLES
**********************/
/**********************
* MACROS
**********************/
/**********************
* GLOBAL FUNCTIONS
**********************/
void lv_draw_eve_init(void)
{
lv_draw_eve_unit_t * draw_eve_unit = lv_draw_create_unit(sizeof(lv_draw_eve_unit_t));
draw_eve_unit->base_unit.dispatch_cb = eve_dispatch;
draw_eve_unit->base_unit.evaluate_cb = eve_evaluate;
lv_draw_eve_unit_g = draw_eve_unit;
}
void lv_draw_eve_set_display_data(lv_display_t * disp, const lv_draw_eve_parameters_t * params,
lv_draw_eve_operation_cb_t op_cb)
{
if(lv_draw_eve_unit_g == NULL) {
LV_LOG_WARN("lv_draw_eve is not initialized.");
return;
}
lv_draw_eve_unit_g->disp = disp;
lv_draw_eve_unit_g->params = *params; /* make a copy */
lv_draw_eve_unit_g->op_cb = op_cb;
lv_display_add_event_cb(disp, disp_delete_cb, LV_EVENT_DELETE, NULL);
}
/**********************
* STATIC FUNCTIONS
**********************/
static int32_t eve_dispatch(lv_draw_unit_t * draw_unit, lv_layer_t * layer)
{
lv_draw_eve_unit_t * draw_eve_unit = (lv_draw_eve_unit_t *) draw_unit;
lv_draw_task_t * t = NULL;
t = lv_draw_get_next_available_task(layer, NULL, DRAW_UNIT_ID_EVE);
if(t == NULL) return LV_DRAW_UNIT_IDLE;
t->state = LV_DRAW_TASK_STATE_IN_PROGRESS;
draw_eve_unit->task_act = t;
eve_execute_drawing(draw_eve_unit);
draw_eve_unit->task_act->state = LV_DRAW_TASK_STATE_FINISHED;
draw_eve_unit->task_act = NULL;
/*The draw unit is free now. Request a new dispatching as it can get a new task*/
lv_draw_dispatch_request();
return 1;
}
static int32_t eve_evaluate(lv_draw_unit_t * draw_unit, lv_draw_task_t * task)
{
LV_UNUSED(draw_unit);
if(((lv_draw_dsc_base_t *)task->draw_dsc)->user_data == NULL) {
task->preference_score = 0;
task->preferred_draw_unit_id = DRAW_UNIT_ID_EVE;
}
return 0;
}
static void eve_execute_drawing(lv_draw_eve_unit_t * u)
{
lv_draw_task_t * t = u->task_act;
switch(t->type) {
case LV_DRAW_TASK_TYPE_LINE:
lv_draw_eve_line(t, t->draw_dsc);
break;
case LV_DRAW_TASK_TYPE_BORDER:
lv_draw_eve_border(t, t->draw_dsc, &t->area);
break;
case LV_DRAW_TASK_TYPE_FILL:
lv_draw_eve_fill(t, t->draw_dsc, &t->area);
break;
case LV_DRAW_TASK_TYPE_IMAGE:
lv_draw_eve_image(t, t->draw_dsc, &t->area);
break;
case LV_DRAW_TASK_TYPE_LABEL:
lv_draw_eve_label(t, t->draw_dsc, &t->area);
break;
case LV_DRAW_TASK_TYPE_ARC:
lv_draw_eve_arc(t, t->draw_dsc, &t->area);
break;
case LV_DRAW_TASK_TYPE_TRIANGLE:
lv_draw_eve_triangle(t, t->draw_dsc);
break;
default:
break;
}
}
static void disp_delete_cb(lv_event_t * e)
{
lv_draw_eve_unit_g->disp = NULL;
lv_draw_eve_unit_g = NULL;
}
#endif /*LV_USE_DRAW_EVE*/

View File

@ -0,0 +1,57 @@
/**
* @file lv_draw_eve.h
*
*/
/* Created on: 3 dic 2023
* Author: juanj
*
* Modified by LVGL
*/
#ifndef LV_DRAW_EVE_H
#define LV_DRAW_EVE_H
#ifdef __cplusplus
extern "C" {
#endif
/*********************
* INCLUDES
*********************/
#include "../../lv_conf_internal.h"
#if LV_USE_DRAW_EVE
#include "lv_draw_eve_target.h"
/*********************
* DEFINES
*********************/
/**********************
* TYPEDEFS
**********************/
/**********************
* GLOBAL PROTOTYPES
**********************/
void lv_draw_eve_init(void);
void lv_draw_eve_set_display_data(lv_display_t * disp, const lv_draw_eve_parameters_t * params,
lv_draw_eve_operation_cb_t op_cb);
/**********************
* MACROS
**********************/
#endif /*LV_USE_DRAW_EVE*/
#ifdef __cplusplus
} /*extern "C"*/
#endif
#endif /* LV_DRAW_EVE_H */

View File

@ -0,0 +1,325 @@
/**
* @file lv_draw_eve_arc.c
*
*/
/* Created on: 11 dic 2023
* Author: juanj
*
* Modified by LVGL
*/
/*********************
* INCLUDES
*********************/
#include "lv_draw_eve_private.h"
#if LV_USE_DRAW_EVE
#include "../lv_draw_arc.h"
#include "lv_eve.h"
/*********************
* DEFINES
*********************/
/**********************
* STATIC PROTOTYPES
**********************/
static void draw_eve_arc(lv_draw_task_t * t, const lv_draw_arc_dsc_t * dsc, const lv_area_t * coords);
static bool is_same_quadrant(int16_t start_angle, int16_t end_angle) ;
static void draw_rounded_end(lv_point_t center, int32_t radius, int32_t angle, int32_t width);
static void lv_draw_eve_mask_angle(const lv_draw_arc_dsc_t * dsc, int32_t vertex_x, int32_t vertex_y,
int32_t start_angle, int32_t end_angle);
static lv_eve_primitive_t get_mask_direction(int16_t angle);
static int32_t chord_length(int16_t radius, int16_t angle_degrees);
/**********************
* GLOBAL FUNCTIONS
**********************/
void lv_draw_eve_arc(lv_draw_task_t * t, const lv_draw_arc_dsc_t * dsc, const lv_area_t * coords)
{
draw_eve_arc(t, dsc, coords);
}
/**********************
* STATIC FUNCTIONS
**********************/
static int32_t chord_length(int16_t radius, int16_t angle_degrees)
{
angle_degrees %= 360;
if(angle_degrees < 0) angle_degrees += 360;
int32_t sin_value = lv_trigo_sin(angle_degrees / 2);
int64_t chord_length = 2 * radius * sin_value / 32768.0;
return (int32_t)chord_length ;
}
static lv_eve_primitive_t get_mask_direction(int16_t angle)
{
if(angle >= 315 || angle < 45) {
return LV_EVE_PRIMITIVE_EDGE_STRIP_R;
}
if(angle >= 45 && angle < 135) {
return LV_EVE_PRIMITIVE_EDGE_STRIP_B;
}
if(angle >= 135 && angle < 225) {
return LV_EVE_PRIMITIVE_EDGE_STRIP_L;
}
if(angle >= 225 && angle < 315) {
return LV_EVE_PRIMITIVE_EDGE_STRIP_A;
}
return 0;
}
static void draw_rounded_end(lv_point_t center, int32_t radius, int32_t angle, int32_t width)
{
int32_t rounded_y = center.y + ((lv_trigo_sin(angle) * radius) >> LV_TRIGO_SHIFT);
int32_t rounded_x = center.x + ((lv_trigo_cos(angle) * radius) >> LV_TRIGO_SHIFT);
lv_eve_draw_circle_simple(rounded_x, rounded_y, width);
}
static bool is_same_quadrant(int16_t start_angle, int16_t end_angle)
{
if(start_angle > end_angle) {
if((start_angle >= 0 && start_angle < 90) && (end_angle >= 0 && end_angle < 90)) {
return true;
}
else if((start_angle >= 90 && start_angle < 180) && (end_angle >= 90 && end_angle < 180)) {
return true;
}
else if((start_angle >= 180 && start_angle < 270) && (end_angle >= 180 && end_angle < 270)) {
return true;
}
else if((start_angle >= 270 && start_angle < 360) && (end_angle >= 270 && end_angle < 360)) {
return true;
}
else {
return false;
}
}
else {
return false;
}
}
static void lv_draw_eve_mask_angle(const lv_draw_arc_dsc_t * dsc, int32_t vertex_x, int32_t vertex_y,
int32_t start_angle, int32_t end_angle)
{
/*Constrain the input angles*/
if(start_angle < 0)
start_angle = 0;
else if(start_angle > 359)
start_angle = 359;
if(end_angle < 0)
end_angle = 0;
else if(end_angle > 359)
end_angle = 359;
LV_ASSERT_MSG(start_angle >= 0 && start_angle <= 360, "Unexpected start angle");
int32_t mid_angle_op;
int32_t angle_range;
int32_t mask_dir_start;
int32_t mask_dir_end;
lv_point_t start;
lv_point_t end;
lv_point_t angle_range_op;
if(end_angle > start_angle) {
angle_range = LV_ABS(end_angle - start_angle);
}
else {
angle_range = 360 - start_angle + end_angle;
}
mid_angle_op = (angle_range / 2) + start_angle + 180;
mid_angle_op = mid_angle_op % 360;
mask_dir_end = LV_ABS(((360 - angle_range) / 4) + end_angle);
mask_dir_start = LV_ABS(((360 - angle_range) / 4) + mid_angle_op);
mask_dir_start = mask_dir_start % 360;
mask_dir_end = mask_dir_end % 360;
start.y = (lv_trigo_sin(start_angle) >> 5) + vertex_y;
start.x = (lv_trigo_cos(start_angle) >> 5) + vertex_x;
end.y = (lv_trigo_sin(end_angle) >> 5) + vertex_y;
end.x = (lv_trigo_cos(end_angle) >> 5) + vertex_x;
angle_range_op.y = (lv_trigo_sin(mid_angle_op) >> 5) + vertex_y;
angle_range_op.x = (lv_trigo_cos(mid_angle_op) >> 5) + vertex_x;
if(angle_range <= 180) {
/* Two sides mask and 6 vertex points */
/* Masking end angle */
lv_eve_primitive_t edge = get_mask_direction(mask_dir_end);
lv_eve_primitive(edge); /* Side one */
lv_eve_vertex_2f(angle_range_op.x, angle_range_op.y);
lv_eve_vertex_2f(vertex_x, vertex_y);
lv_eve_vertex_2f(end.x, end.y);
/* Masking start angle */
edge = get_mask_direction(mask_dir_start);
lv_eve_primitive(edge); /* Side two */
lv_eve_vertex_2f(angle_range_op.x, angle_range_op.y);
lv_eve_vertex_2f(vertex_x, vertex_y);
lv_eve_vertex_2f(start.x, start.y);
}
else {
if(is_same_quadrant(start_angle,
end_angle)) { /* "It is not an optimal implementation for the case where both angles (start and end) are in the same quadrant */
/* todo */
lv_point_t end_line_cntr;
lv_point_t start_line_cntr;
lv_point_t end_line_brd;
lv_point_t start_line_brd;
int16_t chord = chord_length(dsc->radius, 360 - angle_range);
int16_t w = ((chord / 4) < 1) ? 1 : chord / 4;
int16_t r_width = w;
end_line_brd.y = vertex_y + ((lv_trigo_sin(end_angle) * dsc->radius) >> LV_TRIGO_SHIFT);
end_line_brd.x = vertex_x + ((lv_trigo_cos(end_angle) * dsc->radius) >> LV_TRIGO_SHIFT);
start_line_brd.y = vertex_y + ((lv_trigo_sin(start_angle) * dsc->radius) >> LV_TRIGO_SHIFT);
start_line_brd.x = vertex_x + ((lv_trigo_cos(start_angle) * dsc->radius) >> LV_TRIGO_SHIFT);
lv_eve_draw_rect_simple(start_line_brd.x, start_line_brd.y, end_line_brd.x, end_line_brd.y, 0);
start_line_brd.y = start_line_brd.y + ((lv_trigo_sin(start_angle - 90) * r_width) >> LV_TRIGO_SHIFT);
start_line_brd.x = start_line_brd.x + ((lv_trigo_cos(start_angle - 90) * r_width) >> LV_TRIGO_SHIFT);
end_line_brd.y = end_line_brd.y + ((lv_trigo_sin(end_angle + 90) * r_width) >> LV_TRIGO_SHIFT);
end_line_brd.x = end_line_brd.x + ((lv_trigo_cos(end_angle + 90) * r_width) >> LV_TRIGO_SHIFT);
end_line_cntr.y = vertex_y + ((lv_trigo_sin(end_angle + 90) * r_width) >> LV_TRIGO_SHIFT);
end_line_cntr.x = vertex_x + ((lv_trigo_cos(end_angle + 90) * r_width) >> LV_TRIGO_SHIFT);
start_line_cntr.y = vertex_y + ((lv_trigo_sin(start_angle + 270) * r_width) >> LV_TRIGO_SHIFT);
start_line_cntr.x = vertex_x + ((lv_trigo_cos(start_angle + 270) * r_width) >> LV_TRIGO_SHIFT);
lv_eve_primitive(LV_EVE_PRIMITIVE_LINE_STRIP);
lv_eve_line_width(r_width * 16);
lv_eve_vertex_2f(start_line_cntr.x, start_line_cntr.y);
lv_eve_vertex_2f(start_line_brd.x, start_line_brd.y);
lv_eve_vertex_2f(end_line_brd.x, end_line_brd.y);
lv_eve_vertex_2f(end_line_cntr.x, end_line_cntr.y);
}
else { /* One side mask and 3 vertex points */
/* Masking end and start angles */
lv_eve_primitive_t edge = get_mask_direction(mid_angle_op);
lv_eve_primitive(edge);
lv_eve_vertex_2f(end.x, end.y);
lv_eve_vertex_2f(vertex_x, vertex_y);
lv_eve_vertex_2f(start.x, start.y);
}
}
}
static void draw_eve_arc(lv_draw_task_t * t, const lv_draw_arc_dsc_t * dsc, const lv_area_t * coords)
{
if(dsc->opa <= LV_OPA_MIN)
return;
if(dsc->width == 0)
return;
if(dsc->start_angle == dsc->end_angle)
return;
lv_color_t color = dsc->color;
lv_opa_t opa = dsc->opa;
lv_point_t center = dsc->center;
int32_t width = dsc->width;
uint16_t radius_out = dsc->radius;
uint16_t radius_in = dsc->radius - dsc->width;
int32_t start_angle = (int32_t) dsc->start_angle;
int32_t end_angle = (int32_t) dsc->end_angle;
if(width > radius_out)
width = radius_out;
while(start_angle >= 360)
start_angle -= 360;
while(end_angle >= 360)
end_angle -= 360;
lv_eve_scissor(t->clip_area.x1, t->clip_area.y1, t->clip_area.x2, t->clip_area.y2);
lv_eve_save_context();
lv_eve_color(color);
lv_eve_color_opa(opa);
lv_eve_color_mask(0, 0, 0, 1);
lv_eve_stencil_func(EVE_ALWAYS, 0, 1);
lv_eve_stencil_op(EVE_REPLACE, EVE_REPLACE);
lv_eve_draw_circle_simple(center.x, center.y, radius_out); /* radius_out */
lv_eve_blend_func(EVE_ONE, EVE_ZERO);
lv_eve_draw_circle_simple(center.x, center.y, radius_in + 2); /* radius_in */
lv_eve_stencil_func(EVE_ALWAYS, 1, 1);
lv_eve_stencil_op(EVE_REPLACE, EVE_REPLACE);
lv_eve_blend_func(EVE_ZERO, EVE_ONE_MINUS_SRC_ALPHA);
lv_eve_color_opa(0XFF);
/* Start masking arc */
lv_draw_eve_mask_angle(dsc, center.x, center.y, start_angle, end_angle);
/* End masking arc */
lv_eve_draw_circle_simple(center.x, center.y, radius_in); /* radius_in */
lv_eve_color_mask(1, 1, 1, 1);
lv_eve_blend_func(EVE_DST_ALPHA, EVE_ONE_MINUS_DST_ALPHA);
lv_eve_draw_circle_simple(center.x, center.y, radius_in); /* radius_in */
lv_eve_stencil_func(EVE_NOTEQUAL, 1, 0XFF);
lv_eve_stencil_op(EVE_KEEP, EVE_KEEP);
lv_eve_blend_func(EVE_SRC_ALPHA, EVE_ONE_MINUS_SRC_ALPHA);
lv_eve_color_opa(opa);
lv_eve_draw_circle_simple(center.x, center.y, radius_out); /* radius_out */
if(dsc->rounded) {
lv_eve_stencil_func(EVE_EQUAL, 1, 0XFF);
if(opa < 255) {
lv_eve_stencil_op(EVE_ZERO, EVE_ZERO);
}
int32_t half_width = width / 2;
int32_t adjusted_radius = radius_out - half_width;
draw_rounded_end(center, adjusted_radius, end_angle, half_width);
draw_rounded_end(center, adjusted_radius, start_angle, half_width);
}
lv_eve_restore_context();
}
#endif /*LV_USE_DRAW_EVE*/

View File

@ -0,0 +1,121 @@
/**
* @file lv_draw_eve_fill.c
*
*/
/* Created on: 27 mar 2023
* Author: juanj
*
* Modified by LVGL
*/
/*********************
* INCLUDES
*********************/
#include "lv_draw_eve_private.h"
#if LV_USE_DRAW_EVE
#include "lv_eve.h"
/**********************
* STATIC PROTOTYPES
**********************/
/**********************
* GLOBAL FUNCTIONS
**********************/
void lv_draw_eve_fill(lv_draw_task_t * t, const lv_draw_fill_dsc_t * dsc, const lv_area_t * coords)
{
int32_t rad = dsc->radius;
int32_t bg_w = lv_area_get_width(coords);
int32_t bg_h = lv_area_get_height(coords);
int32_t real_radius = LV_MIN3(bg_w / 2, bg_h / 2, rad);
lv_eve_scissor(t->clip_area.x1, t->clip_area.y1, t->clip_area.x2, t->clip_area.y2);
lv_eve_save_context();
lv_eve_color(dsc->color);
lv_eve_color_opa(dsc->opa);
if(bg_w == bg_h && rad == LV_RADIUS_CIRCLE) {
lv_eve_draw_circle_simple(coords->x1 + (bg_w / 2), coords->y1 + (bg_h / 2), real_radius);
}
else {
lv_eve_draw_rect_simple(coords->x1, coords->y1, coords->x2, coords->y2, real_radius);
}
lv_eve_restore_context();
}
/**********************
* STATIC FUNCTIONS
**********************/
void lv_draw_eve_border(lv_draw_task_t * t, const lv_draw_border_dsc_t * dsc, const lv_area_t * coords)
{
if(dsc->opa <= LV_OPA_MIN) return;
if(dsc->width == 0) return;
if(dsc->side == LV_BORDER_SIDE_NONE) return;
int32_t coords_w = lv_area_get_width(coords);
int32_t coords_h = lv_area_get_height(coords);
int32_t rout = dsc->radius;
int32_t short_side = LV_MIN(coords_w, coords_h);
if(rout > short_side >> 1) rout = short_side >> 1;
/*Get the inner area*/
lv_area_t area_inner;
lv_area_copy(&area_inner, coords);
area_inner.x1 += ((dsc->side & LV_BORDER_SIDE_LEFT) ? dsc->width : - (dsc->width));
area_inner.x2 -= ((dsc->side & LV_BORDER_SIDE_RIGHT) ? dsc->width : - (dsc->width));
area_inner.y1 += ((dsc->side & LV_BORDER_SIDE_TOP) ? dsc->width : - (dsc->width));
area_inner.y2 -= ((dsc->side & LV_BORDER_SIDE_BOTTOM) ? dsc->width : - (dsc->width));
int32_t rin = rout - dsc->width;
if(rin < 0) rin = 0;
lv_eve_save_context();
lv_eve_scissor(t->clip_area.x1, t->clip_area.y1, t->clip_area.x2, t->clip_area.y2);
lv_eve_color(dsc->color);
lv_eve_color_opa(dsc->opa);
lv_eve_color_mask(0, 0, 0, 1);
lv_eve_stencil_func(EVE_ALWAYS, 0, 1);
lv_eve_stencil_op(EVE_REPLACE, EVE_REPLACE);
lv_eve_draw_rect_simple(coords->x1, coords->y1, coords->x2, coords->y2, 0);
lv_eve_blend_func(EVE_ONE, EVE_ZERO);
lv_eve_draw_rect_simple(area_inner.x1 - 2, area_inner.y1 - 1, area_inner.x2 + 1, area_inner.y2 + 2, rin);
lv_eve_stencil_func(EVE_ALWAYS, 1, 1);
lv_eve_stencil_op(EVE_REPLACE, EVE_REPLACE);
lv_eve_blend_func(EVE_ZERO, EVE_ONE_MINUS_SRC_ALPHA);
lv_eve_color_opa(255);
lv_eve_draw_rect_simple(area_inner.x1, area_inner.y1, area_inner.x2, area_inner.y2, rin);
lv_eve_color_mask(1, 1, 1, 1);
if(dsc->side == LV_BORDER_SIDE_FULL) {
lv_eve_blend_func(EVE_DST_ALPHA, EVE_ONE_MINUS_DST_ALPHA);
lv_eve_draw_rect_simple(area_inner.x1, area_inner.y1, area_inner.x2, area_inner.y2, rin);
}
lv_eve_stencil_func(EVE_NOTEQUAL, 1, 255);
lv_eve_blend_func(EVE_SRC_ALPHA, EVE_ONE_MINUS_SRC_ALPHA);
lv_eve_color_opa(dsc->opa);
lv_eve_draw_rect_simple(coords->x1, coords->y1, coords->x2, coords->y2, rout);
lv_eve_restore_context();
}
#endif /*LV_USE_DRAW_EVE*/

View File

@ -0,0 +1,299 @@
/**
* @file lv_draw_eve_image.c
*
*/
/* Created on: 17 jun 2023
* Author: juanj
*
* Modified by LVGL
*/
/*********************
* INCLUDES
*********************/
#include "lv_draw_eve_private.h"
#if LV_USE_DRAW_EVE
#include "../lv_draw_image_private.h"
#include "lv_draw_eve_ram_g.h"
#include "lv_eve.h"
/*********************
* DEFINES
*********************/
/**********************
* TYPEDEFS
**********************/
/**********************
* STATIC PROTOTYPES
**********************/
static void convert_row_rgb565a8_to_argb4444(const uint8_t * src, const uint8_t * src_alpha, uint8_t * dst,
uint32_t width);
static void convert_row_argb8888_to_argb4444(const uint8_t * src, uint8_t * dst, uint32_t width);
/**********************
* STATIC VARIABLES
**********************/
/**********************
* MACROS
**********************/
#define F16_PIVOT_SHIFT(x) ((int32_t)((((x) >> 1)) * 65536L))
#define F16_SCALE_DIV_256(x) ((int32_t)(((x) / 256.0f) * 65536L))
/**********************
* GLOBAL FUNCTIONS
**********************/
void lv_draw_eve_image(lv_draw_task_t * t, const lv_draw_image_dsc_t * draw_dsc, const lv_area_t * coords)
{
if(!lv_draw_eve_image_src_check(draw_dsc->src)) {
return;
}
const lv_image_dsc_t * img_dsc = draw_dsc->src;
int32_t src_w = img_dsc->header.w;
int32_t src_h = img_dsc->header.h;
int32_t src_stride = img_dsc->header.stride;
lv_color_format_t src_cf = img_dsc->header.cf;
if(src_stride == 0) {
src_stride = src_w * lv_color_format_get_size(src_cf);
}
uint8_t eve_format;
int32_t eve_stride;
switch(src_cf) {
case LV_COLOR_FORMAT_L8:
eve_format = EVE_L8;
eve_stride = src_stride;
break;
case LV_COLOR_FORMAT_RGB565:
eve_format = EVE_RGB565;
eve_stride = src_stride;
break;
case LV_COLOR_FORMAT_RGB565A8:
case LV_COLOR_FORMAT_ARGB8888:
eve_format = EVE_ARGB4;
eve_stride = src_w * 2;
break;
default :
LV_ASSERT(0);
}
uint32_t ramg_addr = lv_draw_eve_image_upload_image(true, img_dsc);
if(ramg_addr == LV_DRAW_EVE_RAMG_OUT_OF_RAMG) {
LV_LOG_WARN("Could not load image because space could not be allocated in RAM_G.");
return;
}
lv_eve_scissor(t->clip_area.x1, t->clip_area.y1, t->clip_area.x2, t->clip_area.y2);
lv_eve_save_context();
lv_eve_color_opa(draw_dsc->opa);
if(draw_dsc->recolor_opa > LV_OPA_MIN) {
lv_eve_color(lv_color_mix(draw_dsc->recolor, lv_color_white(), draw_dsc->recolor_opa));
}
lv_eve_primitive(LV_EVE_PRIMITIVE_BITMAPS);
lv_eve_bitmap_source(ramg_addr);
/*real height and width is mandatory for rotation and scale (Clip Area)*/
lv_eve_bitmap_size(EVE_NEAREST, EVE_BORDER, EVE_BORDER, src_w, src_h);
lv_eve_bitmap_layout(eve_format, eve_stride, src_h);
if(draw_dsc->rotation || draw_dsc->scale_x != LV_SCALE_NONE || draw_dsc->scale_y != LV_SCALE_NONE) {
EVE_cmd_dl_burst(CMD_LOADIDENTITY);
EVE_cmd_translate_burst(F16(coords->x1 - t->clip_area.x1 + draw_dsc->pivot.x),
F16(coords->y1 - t->clip_area.y1 + draw_dsc->pivot.y));
if(draw_dsc->scale_x != LV_SCALE_NONE || draw_dsc->scale_y != LV_SCALE_NONE) {
/*Image Scale*/
EVE_cmd_scale_burst(F16_SCALE_DIV_256(draw_dsc->scale_x), F16_SCALE_DIV_256(draw_dsc->scale_y));
}
if(draw_dsc->rotation != 0) {
/*Image Rotate*/
EVE_cmd_rotate_burst(DEGREES(draw_dsc->rotation));
}
EVE_cmd_translate_burst(-F16(draw_dsc->pivot.x), -F16(draw_dsc->pivot.y));
EVE_cmd_dl_burst(CMD_SETMATRIX);
EVE_cmd_dl_burst(CMD_LOADIDENTITY);
lv_eve_vertex_2f(t->clip_area.x1, t->clip_area.y1);
}
else {
lv_eve_vertex_2f(coords->x1, coords->y1);
}
lv_eve_restore_context();
}
bool lv_draw_eve_image_src_check(const void * src)
{
if(lv_image_src_get_type(src) != LV_IMAGE_SRC_VARIABLE) {
LV_LOG_WARN("lv_draw_eve can only render images from variables (not files or symbols) for now.");
return false;
}
const lv_image_dsc_t * img_dsc = src;
switch(img_dsc->header.cf) {
case LV_COLOR_FORMAT_L8:
case LV_COLOR_FORMAT_RGB565:
case LV_COLOR_FORMAT_RGB565A8:
case LV_COLOR_FORMAT_ARGB8888:
break;
default :
LV_LOG_WARN("lv_draw_eve can only render L8, RGB565, RGB565A8, and ARGB8888 images for now.");
return false;
}
return true;
}
uint32_t lv_draw_eve_image_upload_image(bool burst_is_active, const lv_image_dsc_t * img_dsc)
{
const uint8_t * src_buf = img_dsc->data;
int32_t src_w = img_dsc->header.w;
int32_t src_h = img_dsc->header.h;
int32_t src_stride = img_dsc->header.stride;
lv_color_format_t src_cf = img_dsc->header.cf;
if(src_stride == 0) {
src_stride = src_w * lv_color_format_get_size(src_cf);
}
int32_t eve_stride;
uint8_t eve_alignment;
switch(src_cf) {
case LV_COLOR_FORMAT_L8:
eve_stride = src_stride;
eve_alignment = 1;
break;
case LV_COLOR_FORMAT_RGB565:
eve_stride = src_stride;
eve_alignment = 2;
break;
case LV_COLOR_FORMAT_RGB565A8:
case LV_COLOR_FORMAT_ARGB8888:
eve_stride = src_w * 2;
eve_alignment = 2;
break;
default :
LV_ASSERT(0);
}
int32_t eve_size = eve_stride * src_h;
uint32_t ramg_addr;
bool img_is_loaded = lv_draw_eve_ramg_get_addr(&ramg_addr, (uintptr_t) src_buf, eve_size, eve_alignment);
/* New image to load */
if(!img_is_loaded && ramg_addr != LV_DRAW_EVE_RAMG_OUT_OF_RAMG) {
/* Load image to RAM_G */
if(burst_is_active) {
EVE_end_cmd_burst();
}
switch(src_cf) {
case LV_COLOR_FORMAT_L8:
case LV_COLOR_FORMAT_RGB565:
EVE_memWrite_flash_buffer(ramg_addr, src_buf, eve_size);
break;
case LV_COLOR_FORMAT_RGB565A8: {
uint8_t * tmp_buf = lv_malloc(eve_stride);
LV_ASSERT_MALLOC(tmp_buf);
const uint8_t * src_alpha_buf = src_buf + src_h * src_stride;
int32_t src_alpha_stride = src_stride / 2;
for(uint32_t y = 0; y < src_h; y++) {
convert_row_rgb565a8_to_argb4444(src_buf + y * src_stride, src_alpha_buf + y * src_alpha_stride, tmp_buf, src_w);
EVE_memWrite_flash_buffer(ramg_addr + y * eve_stride, tmp_buf, eve_stride);
}
lv_free(tmp_buf);
break;
}
case LV_COLOR_FORMAT_ARGB8888: {
uint8_t * tmp_buf = lv_malloc(eve_stride);
LV_ASSERT_MALLOC(tmp_buf);
for(uint32_t y = 0; y < src_h; y++) {
convert_row_argb8888_to_argb4444(src_buf + y * src_stride, tmp_buf, src_w);
EVE_memWrite_flash_buffer(ramg_addr + y * eve_stride, tmp_buf, eve_stride);
}
lv_free(tmp_buf);
break;
}
default:
LV_ASSERT(0);
}
if(burst_is_active) {
EVE_start_cmd_burst();
}
}
return ramg_addr;
}
/**********************
* STATIC FUNCTIONS
**********************/
static void convert_row_rgb565a8_to_argb4444(const uint8_t * src, const uint8_t * src_alpha, uint8_t * dst,
uint32_t width)
{
for(uint32_t x = 0; x < width; x++) {
uint16_t rgb565 = ((const uint16_t *) src)[x];
uint8_t r5 = (rgb565 >> 11) & 0x1F;
uint8_t g6 = (rgb565 >> 5) & 0x3F;
uint8_t b5 = rgb565 & 0x1F;
uint8_t alpha = src_alpha[x];
uint8_t r4 = r5 >> 1;
uint8_t g4 = g6 >> 2;
uint8_t b4 = b5 >> 1;
uint8_t a4 = alpha >> 4;
uint16_t argb4444 = (a4 << 12) | (r4 << 8) | (g4 << 4) | b4;
dst[2 * x] = argb4444 & 0xFF;
dst[2 * x + 1] = (argb4444 >> 8) & 0xFF;
}
}
static void convert_row_argb8888_to_argb4444(const uint8_t * src, uint8_t * dst, uint32_t width)
{
for(uint32_t x = 0; x < width; x++) {
uint8_t blue = src[4 * x];
uint8_t green = src[4 * x + 1];
uint8_t red = src[4 * x + 2];
uint8_t alpha = src[4 * x + 3];
uint8_t r4 = red >> 4;
uint8_t g4 = green >> 4;
uint8_t b4 = blue >> 4;
uint8_t a4 = alpha >> 4;
uint16_t argb4444 = (a4 << 12) | (r4 << 8) | (g4 << 4) | b4;
dst[2 * x] = argb4444 & 0xFF;
dst[2 * x + 1] = (argb4444 >> 8) & 0xFF;
}
}
#endif /*LV_USE_DRAW_EVE*/

View File

@ -0,0 +1,233 @@
/**
* @file lv_draw_eve_letter.c
*
*/
/* Author: juanj
*
* Modified by LVGL
*/
/*********************
* INCLUDES
*********************/
#include "lv_draw_eve_private.h"
#if LV_USE_DRAW_EVE
#include "../lv_draw_private.h"
#include "../lv_draw_label_private.h"
#include "../lv_draw_rect.h"
#include "lv_eve.h"
/*********************
* DEFINES
*********************/
/**********************
* TYPEDEFS
**********************/
/**********************
* STATIC PROTOTYPES
**********************/
static void lv_draw_eve_letter_cb(lv_draw_task_t * t, lv_draw_glyph_dsc_t * glyph_draw_dsc,
lv_draw_fill_dsc_t * fill_draw_dsc, const lv_area_t * fill_area);
static void font_bitmap_to_ramg(uint32_t addr, const uint8_t * src, uint32_t width,
uint32_t height, uint8_t src_stride_align);
/**********************
* STATIC VARIABLES
**********************/
/**********************
* MACROS
**********************/
#define GET_NIBBLE_1(w) ((uint8_t) ((w) >> 4))
#define GET_NIBBLE_2(w) ((uint8_t) ((w) & 0xf))
/**********************
* GLOBAL FUNCTIONS
**********************/
void lv_draw_eve_label(lv_draw_task_t * t, const lv_draw_label_dsc_t * dsc, const lv_area_t * coords)
{
if(dsc->opa <= LV_OPA_MIN) return;
lv_eve_scissor(t->clip_area.x1, t->clip_area.y1, t->clip_area.x2, t->clip_area.y2);
lv_eve_save_context();
lv_eve_primitive(LV_EVE_PRIMITIVE_BITMAPS);
lv_draw_label_iterate_characters(t, dsc, coords, lv_draw_eve_letter_cb);
lv_eve_restore_context();
}
bool lv_draw_eve_label_font_check(const lv_font_t * font)
{
if(font->get_glyph_bitmap != lv_font_get_bitmap_fmt_txt) {
LV_LOG_WARN("lv_draw_eve can only render static fonts for now.");
return false;
}
const lv_font_fmt_txt_dsc_t * font_dsc = font->dsc;
/* Only 4 bpp is supported for now. Support for 1 and 8 bpp can be added. (EVE_L1, EVE_L8) */
if(font_dsc->bpp != 4) {
LV_LOG_WARN("lv_draw_eve can only render static fonts for now.");
return false;
}
return true;
}
uint32_t lv_draw_eve_label_upload_glyph(bool burst_is_active, const lv_font_fmt_txt_dsc_t * font_dsc,
uint32_t gid_index)
{
const lv_font_fmt_txt_glyph_dsc_t * glyph_dsc = &font_dsc->glyph_dsc[gid_index];
const uint8_t * glyph_bitmap = &font_dsc->glyph_bitmap[glyph_dsc->bitmap_index];
uint16_t g_box_w = glyph_dsc->box_w;
uint16_t g_box_h = glyph_dsc->box_h;
uint16_t g_aligned_stride = (g_box_w + 1) / 2;
uint32_t glyph_ramg_size = g_aligned_stride * g_box_h;
uint32_t ramg_addr;
uintptr_t glyph_ramg_key = (uintptr_t) glyph_bitmap;
bool font_is_loaded = lv_draw_eve_ramg_get_addr(&ramg_addr, glyph_ramg_key, glyph_ramg_size, 1);
/* If the font is not yet loaded in ramG, load it */
if(!font_is_loaded && ramg_addr != LV_DRAW_EVE_RAMG_OUT_OF_RAMG) {
if(burst_is_active) {
EVE_end_cmd_burst();
}
uint8_t glyph_bitmap_stride_align = font_dsc->stride;
font_bitmap_to_ramg(ramg_addr, glyph_bitmap, g_box_w, g_box_h, glyph_bitmap_stride_align);
if(burst_is_active) {
EVE_start_cmd_burst();
}
}
return ramg_addr;
}
/**********************
* STATIC FUNCTIONS
**********************/
static void lv_draw_eve_letter_cb(lv_draw_task_t * t, lv_draw_glyph_dsc_t * glyph_draw_dsc,
lv_draw_fill_dsc_t * fill_draw_dsc, const lv_area_t * fill_area)
{
if(fill_draw_dsc && fill_area) {
/* draw UNDERLINE and STRIKETHROUGH */
lv_eve_draw_rect_simple(fill_area->x1, fill_area->y1, fill_area->x2, fill_area->y2, 0);
}
if(glyph_draw_dsc == NULL)
return; /* Important */
const lv_font_t * font = glyph_draw_dsc->g->resolved_font;
if(!lv_draw_eve_label_font_check(font)) {
return;
}
const lv_font_fmt_txt_dsc_t * font_dsc = font->dsc;
uint32_t gid_index = glyph_draw_dsc->g->gid.index;
const lv_font_fmt_txt_glyph_dsc_t * glyph_dsc = &font_dsc->glyph_dsc[gid_index];
uint16_t g_box_w = glyph_dsc->box_w;
uint16_t g_box_h = glyph_dsc->box_h;
uint16_t g_aligned_stride = (g_box_w + 1) / 2;
uint8_t bpp_eve = EVE_L4;
uint32_t ramg_addr = lv_draw_eve_label_upload_glyph(true, font_dsc, gid_index);
if(ramg_addr == LV_DRAW_EVE_RAMG_OUT_OF_RAMG) {
LV_LOG_WARN("Could not load glyph because space could not be allocated in RAM_G.");
return;
}
lv_eve_color_opa(glyph_draw_dsc->opa);
lv_eve_color(glyph_draw_dsc->color);
lv_eve_bitmap_source(ramg_addr);
lv_eve_bitmap_size(EVE_NEAREST, EVE_BORDER, EVE_BORDER, g_box_w, g_box_h);
lv_eve_bitmap_layout(bpp_eve, g_aligned_stride, g_box_h);
lv_eve_vertex_2f(glyph_draw_dsc->letter_coords->x1, glyph_draw_dsc->letter_coords->y1);
}
static void font_bitmap_to_ramg(uint32_t addr, const uint8_t * src, uint32_t width,
uint32_t height, uint8_t src_stride_align)
{
uint32_t stride = (width + 1) / 2;
if(src_stride_align == 1 || (src_stride_align == 0 && width % 2 == 0)) {
uint32_t size = stride * height;
EVE_memWrite_flash_buffer(addr, src, size);
return;
}
if(src_stride_align > 0) {
uint32_t src_stride = LV_ALIGN_UP(stride, src_stride_align);
for(uint32_t y = 0; y < height; y++) {
EVE_memWrite_sram_buffer(addr, src, stride);
addr += stride;
src += src_stride;
}
return;
}
uint8_t * row_buf = lv_malloc(stride);
LV_ASSERT_MALLOC(row_buf);
uint32_t src_i = 0;
uint8_t nibble_1;
uint8_t nibble_2;
uint8_t key = 0;
/* Iterate through each row of the bitmap*/
for(uint32_t y = 0; y < height; y++) {
/* Iterate through each byte of the row*/
uint32_t row_i;
for(row_i = 0; row_i < (width / 2); ++row_i) {
/*Get the two nibbles from the current byte*/
if(key == 0) {
nibble_1 = GET_NIBBLE_1(src[src_i]);
nibble_2 = GET_NIBBLE_2(src[src_i]);
}
else {
nibble_1 = GET_NIBBLE_2(src[src_i - 1]);
nibble_2 = GET_NIBBLE_1(src[src_i]);
}
/*Combine the nibbles and assign the result to the output byte*/
row_buf[row_i] = (nibble_1 << 4) | nibble_2;
src_i++;
}
/*process the last remaining nibble*/
row_buf[row_i] =
(key == 0) ?
(GET_NIBBLE_1(src[src_i])) << 4 | 0x0 : (GET_NIBBLE_2(src[src_i - 1])) << 4 | 0x0;
key = (key == 0) ? 1 : 0;
src_i += (key == 1) ? 1 : 0;
EVE_memWrite_sram_buffer(addr, row_buf, stride);
addr += stride;
}
lv_free(row_buf);
}
#endif /*LV_USE_DRAW_EVE*/

View File

@ -0,0 +1,63 @@
/**
* @file lv_draw_eve_line.c
*
*/
/* Created on: 8 abr 2023
* Author: juanj
*
* Modified by LVGL
*/
/*********************
* INCLUDES
*********************/
#include "lv_draw_eve_private.h"
#if LV_USE_DRAW_EVE
#include "lv_eve.h"
void lv_draw_eve_line(lv_draw_task_t * t, const lv_draw_line_dsc_t * dsc)
{
if(dsc->width == 0)
return;
if(dsc->opa <= LV_OPA_MIN)
return;
if(dsc->p1.x == dsc->p2.x && dsc->p1.y == dsc->p2.y)
return;
uint32_t line_w = dsc->width * 8;
lv_eve_scissor(t->clip_area.x1, t->clip_area.y1, t->clip_area.x2, t->clip_area.y2);
lv_eve_save_context();
lv_eve_color_opa(dsc->opa);
lv_eve_color(dsc->color);
if(dsc->dash_gap || dsc->dash_width) {
LV_LOG_WARN("line dash_gap and dash_width not implemented by EVE yet.");
}
/* Check if it's a vertical or horizontal line without rounding */
bool is_vertical = (dsc->p1.x == dsc->p2.x);
bool is_horizontal = (dsc->p1.y == dsc->p2.y);
bool no_round = (!dsc->round_end || !dsc->round_start);
if((is_vertical || is_horizontal) && no_round) {
lv_eve_primitive(LV_EVE_PRIMITIVE_RECTS);
lv_eve_vertex_2f(dsc->p1.x, dsc->p1.y);
lv_eve_vertex_2f(dsc->p2.x, dsc->p2.y);
}
else {
/* Draw inclined line or line with rounding (not possible without rounding)*/
lv_eve_primitive(LV_EVE_PRIMITIVE_LINE_STRIP);
lv_eve_line_width(line_w);
lv_eve_vertex_2f(dsc->p1.x, dsc->p1.y);
lv_eve_vertex_2f(dsc->p2.x, dsc->p2.y);
}
lv_eve_restore_context();
}
#endif /*LV_USE_DRAW_EVE*/

View File

@ -0,0 +1,117 @@
/**
* @file lv_draw_eve_private.h
*
*/
/* Author: juanj
*
* Modified by LVGL
*/
#ifndef LV_DRAW_EVE_PRIVATE_H
#define LV_DRAW_EVE_PRIVATE_H
#ifdef __cplusplus
extern "C" {
#endif
/*********************
* INCLUDES
*********************/
#include "lv_draw_eve.h"
#if LV_USE_DRAW_EVE
#include "lv_draw_eve_target.h"
#include "lv_draw_eve_ram_g.h"
#include "../lv_draw_private.h"
#include "../../misc/lv_types.h"
#include "../../core/lv_global.h"
#include "../lv_draw_triangle.h"
#include "../lv_draw_line.h"
#include "../lv_draw_label.h"
#include "../../font/lv_font_fmt_txt.h"
#include "../lv_draw_arc.h"
#if LV_DRAW_EVE_WRITE_BUFFER_SIZE != 0 && LV_DRAW_EVE_WRITE_BUFFER_SIZE < 4
#warning LV_DRAW_EVE_WRITE_BUFFER_SIZE cannot be less than 4. Using 0 (buffering disabled).
#define LV_DRAW_EVE_WRITE_BUFFER_SIZE_INTERNAL 0
#else
#define LV_DRAW_EVE_WRITE_BUFFER_SIZE_INTERNAL LV_DRAW_EVE_WRITE_BUFFER_SIZE
#endif
/*********************
* DEFINES
*********************/
/**********************
* TYPEDEFS
**********************/
typedef struct {
uintptr_t key;
uint32_t addr;
} lv_draw_eve_ramg_hash_table_cell_t;
typedef struct {
uint32_t ramg_addr_end;
uint32_t hash_table_cell_count;
uint32_t hash_table_cells_occupied;
lv_draw_eve_ramg_hash_table_cell_t * hash_table;
} lv_draw_eve_ramg_t;
struct _lv_draw_eve_unit_t {
lv_draw_unit_t base_unit;
lv_draw_task_t * task_act;
lv_display_t * disp;
lv_draw_eve_ramg_t ramg;
lv_draw_eve_parameters_t params;
lv_draw_eve_operation_cb_t op_cb;
#if LV_DRAW_EVE_WRITE_BUFFER_SIZE_INTERNAL
uint32_t lv_eve_write_buf_len;
uint8_t lv_eve_write_buf[LV_DRAW_EVE_WRITE_BUFFER_SIZE_INTERNAL];
#endif
};
/**********************
* GLOBAL PROTOTYPES
**********************/
void lv_draw_eve_image(lv_draw_task_t * t, const lv_draw_image_dsc_t * draw_dsc,
const lv_area_t * coords);
bool lv_draw_eve_image_src_check(const void * src);
uint32_t lv_draw_eve_image_upload_image(bool burst_is_active, const lv_image_dsc_t * img_dsc);
void lv_draw_eve_fill(lv_draw_task_t * t, const lv_draw_fill_dsc_t * dsc, const lv_area_t * coords);
void lv_draw_eve_border(lv_draw_task_t * t, const lv_draw_border_dsc_t * dsc,
const lv_area_t * coords);
void lv_draw_eve_line(lv_draw_task_t * t, const lv_draw_line_dsc_t * dsc);
void lv_draw_eve_label(lv_draw_task_t * t, const lv_draw_label_dsc_t * dsc,
const lv_area_t * coords);
bool lv_draw_eve_label_font_check(const lv_font_t * font);
uint32_t lv_draw_eve_label_upload_glyph(bool burst_is_active, const lv_font_fmt_txt_dsc_t * font_dsc,
uint32_t gid_index);
void lv_draw_eve_arc(lv_draw_task_t * t, const lv_draw_arc_dsc_t * dsc, const lv_area_t * coords);
void lv_draw_eve_triangle(lv_draw_task_t * t, const lv_draw_triangle_dsc_t * dsc);
/**********************
* MACROS
**********************/
#define DEGREES(n) ((65536UL * (n)) / 3600)
#define F16(x) ((int32_t)((x) * 65536L))
#define lv_draw_eve_unit_g (LV_GLOBAL_DEFAULT()->draw_eve_unit)
#endif /*LV_USE_DRAW_EVE*/
#ifdef __cplusplus
} /*extern "C"*/
#endif
#endif /*LV_DRAW_EVE_PRIVATE_H*/

View File

@ -0,0 +1,221 @@
/**
* @file lv_draw_eve_ram_g.c
*
*/
/* Created on: 19 nov 2023
* Author: juanj
*
* Modified by LVGL
*/
/*********************
* INCLUDES
*********************/
#include "lv_draw_eve_private.h"
#if LV_USE_DRAW_EVE
#include "lv_draw_eve_ram_g.h"
#include "lv_eve.h"
/*********************
* DEFINES
*********************/
#define RAMG_DEBUG 0
/**********************
* TYPEDEFS
**********************/
/**********************
* STATIC PROTOTYPES
**********************/
static void ramg_init(lv_draw_eve_ramg_t * ramg);
static uint32_t hash_key(uintptr_t key);
static uint32_t fnv_1a_hash(const void * src, size_t len);
static void grow_hash_table(lv_draw_eve_ramg_t * ramg);
#if RAMG_DEBUG
static void ramg_debug(lv_draw_eve_ramg_t * ramg, uint32_t key_hash, uint32_t table_index);
#endif
/**********************
* STATIC VARIABLES
**********************/
/**********************
* MACROS
**********************/
/**********************
* GLOBAL FUNCTIONS
**********************/
bool lv_draw_eve_ramg_get_addr(uint32_t * addr_dst, uintptr_t key,
uint32_t addr_size, uint32_t addr_align)
{
LV_ASSERT(key != 0);
lv_draw_eve_ramg_t * ramg = &lv_draw_eve_unit_g->ramg;
if(ramg->hash_table_cell_count == 0) {
ramg_init(ramg);
}
uint32_t key_hash = hash_key(key);
uint32_t table_index = key_hash % ramg->hash_table_cell_count;
lv_draw_eve_ramg_hash_table_cell_t * cell;
while(1) {
cell = &ramg->hash_table[table_index];
if(cell->key == key) {
#if RAMG_DEBUG
ramg_debug(ramg, key_hash, table_index);
#endif
*addr_dst = cell->addr;
return true;
}
if(cell->key == 0) {
break;
}
table_index++;
if(table_index >= ramg->hash_table_cell_count) table_index = 0;
}
uint32_t addr_ret = LV_ALIGN_UP(ramg->ramg_addr_end, addr_align);
uint32_t addr_new_end = addr_ret + addr_size;
if(addr_new_end > 1024 * 1024) {
LV_LOG_WARN("EVE on-chip 1 MB RAM_G for images and fonts has run out.");
*addr_dst = LV_DRAW_EVE_RAMG_OUT_OF_RAMG;
return false;
}
ramg->ramg_addr_end = addr_new_end;
ramg->hash_table_cells_occupied++;
cell->key = key;
cell->addr = addr_ret;
*addr_dst = addr_ret;
#if RAMG_DEBUG
ramg_debug(ramg, key_hash, table_index);
#endif
if(ramg->hash_table_cells_occupied > ramg->hash_table_cell_count / 4 * 3) {
grow_hash_table(ramg);
}
return false;
}
/**********************
* STATIC FUNCTIONS
**********************/
static void ramg_init(lv_draw_eve_ramg_t * ramg)
{
ramg->hash_table_cell_count = 32;
ramg->hash_table = lv_calloc(32, sizeof(lv_draw_eve_ramg_hash_table_cell_t));
LV_ASSERT_MALLOC(ramg->hash_table);
}
static uint32_t hash_key(uintptr_t key)
{
return fnv_1a_hash(&key, sizeof(key));
}
static uint32_t fnv_1a_hash(const void * src, size_t len)
{
const uint8_t * src_u8 = src;
uint32_t hash = 2166136261u;
for(size_t i = 0; i < len; i++) {
hash ^= src_u8[i];
hash *= 16777619u;
}
return hash;
}
static void grow_hash_table(lv_draw_eve_ramg_t * ramg)
{
uint32_t old_cell_count = ramg->hash_table_cell_count;
lv_draw_eve_ramg_hash_table_cell_t * old_hash_table = ramg->hash_table;
ramg->hash_table_cell_count += ramg->hash_table_cell_count / 2;
ramg->hash_table = lv_calloc(ramg->hash_table_cell_count,
sizeof(lv_draw_eve_ramg_hash_table_cell_t));
LV_ASSERT_MALLOC(ramg->hash_table);
for(uint32_t i = 0; i < old_cell_count; i++) {
lv_draw_eve_ramg_hash_table_cell_t * old_cell = &old_hash_table[i];
if(old_cell->key == 0) continue;
uint32_t key_hash = hash_key(old_cell->key);
uint32_t new_table_index = key_hash % ramg->hash_table_cell_count;
lv_draw_eve_ramg_hash_table_cell_t * new_cell_dst = &ramg->hash_table[new_table_index];
while(new_cell_dst->key != 0) {
new_table_index++;
if(new_table_index >= ramg->hash_table_cell_count) new_table_index = 0;
new_cell_dst = &ramg->hash_table[new_table_index];
}
*new_cell_dst = *old_cell;
}
lv_free(old_hash_table);
}
#if RAMG_DEBUG
/*
Print tables like this:
113 kB of RAM_G used
================================-==-=====---=---===---=====-=-=-=-==--=======----=-==-==---=--===--=-=-=========================
========^$==========--=-==-=-=--=--=========---=----========-------===--=====----=======--=====--====--=====-=--=-=
'-' unoccupied cells
'=' occupied cells
'^' where the hash pointed to in the table initially and linear probing started
'$' where linear probing ended because a matching or unoccupied cell
was found. This symbol is not shown if the initial guess was correct.
This example has 244 cells. Each cell uses 8 bytes of local RAM, so just under 2 kB.
Each cell represents an allocation in EVE RAM_G. The RAM_G allocation sizes are not
represented in this table, except for the overall "113 kB of RAM_G used" message.
*/
static void ramg_debug(lv_draw_eve_ramg_t * ramg, uint32_t key_hash, uint32_t table_index)
{
uint32_t table_index_initial_guess = key_hash % ramg->hash_table_cell_count;
lv_log("%u kB of RAM_G used\n", (unsigned) ramg->ramg_addr_end / 1024);
for(uint32_t i = 0; i < ramg->hash_table_cell_count; i++) {
if(i != 0 && i % 128 == 0) {
lv_log("\n");
}
if(i == table_index_initial_guess) {
lv_log("^");
}
else if(i == table_index) {
lv_log("$");
}
else if(ramg->hash_table[i].key) {
lv_log("=");
}
else {
lv_log("-");
}
}
lv_log("\n\n");
}
#endif
#endif/*LV_USE_EVE_DRAW*/

View File

@ -0,0 +1,48 @@
/**
* @file lv_draw_eve_ram_g.h
*
*/
/* Created on: 19 nov 2023
* Author: juanj
*
* Modified by LVGL
*/
#ifndef LV_DRAW_EVE_RAM_G_H
#define LV_DRAW_EVE_RAM_G_H
#ifdef __cplusplus
extern "C" {
#endif
/*********************
* INCLUDES
*********************/
#include "lv_draw_eve.h"
#if LV_USE_DRAW_EVE
/*********************
* DEFINES
*********************/
#define LV_DRAW_EVE_RAMG_OUT_OF_RAMG UINT32_MAX
/**********************
* TYPEDEFS
**********************/
/**********************
* GLOBAL PROTOTYPES
**********************/
bool lv_draw_eve_ramg_get_addr(uint32_t * addr_dst, uintptr_t key,
uint32_t addr_size, uint32_t addr_align);
#endif/*LV_USE_DRAW_EVE*/
#ifdef __cplusplus
} /*extern "C"*/
#endif
#endif /* LV_DRAW_EVE_RAM_G_H */

View File

@ -0,0 +1,79 @@
/**
* @file lv_draw_eve_target.h
*
*/
#ifndef LV_DRAW_EVE_TARGET_H
#define LV_DRAW_EVE_TARGET_H
#ifdef __cplusplus
extern "C" {
#endif
/*********************
* INCLUDES
*********************/
#include "../../lv_conf_internal.h"
#if LV_USE_DRAW_EVE
#include "../../misc/lv_types.h"
#include LV_STDBOOL_INCLUDE
#include LV_STDINT_INCLUDE
typedef struct {
uint16_t hor_res; /**< active display width */
uint16_t ver_res; /**< active display height */
uint16_t hcycle; /**< total number of clocks per line, incl front/back porch */
uint16_t hoffset; /**< start of active line */
uint16_t hsync0; /**< start of horizontal sync pulse */
uint16_t hsync1; /**< end of horizontal sync pulse */
uint16_t vcycle; /**< total number of lines per screen, including pre/post */
uint16_t voffset; /**< start of active screen */
uint16_t vsync0; /**< start of vertical sync pulse */
uint16_t vsync1; /**< end of vertical sync pulse */
uint8_t swizzle; /**< FT8xx output to LCD - pin order */
uint8_t pclkpol; /**< LCD data is clocked in on this PCLK edge */
uint8_t cspread; /**< helps with noise, when set to 1 fewer signals are changed simultaneously, reset-default: 1 */
uint8_t pclk; /**< 60MHz / pclk = pclk frequency */
bool has_crystal; /**< has an external clock crystal */
bool has_gt911; /**< has a touch controller */
uint8_t backlight_pwm; /**< backlight PWM duty cycle 0 = off, 128 = max */
uint16_t backlight_freq; /**< backlight PWM frequency. try 4000 if unsure */
} lv_draw_eve_parameters_t;
typedef enum {
LV_DRAW_EVE_OPERATION_POWERDOWN_SET, /**< set the "PD_N" pin low */
LV_DRAW_EVE_OPERATION_POWERDOWN_CLEAR, /**< set the "PD_N" pin high */
LV_DRAW_EVE_OPERATION_CS_ASSERT, /**< set the "CS_N" pin low */
LV_DRAW_EVE_OPERATION_CS_DEASSERT, /**< set the "CS_N" pin high */
LV_DRAW_EVE_OPERATION_SPI_SEND, /**< send `length` bytes of `data` over SPI */
LV_DRAW_EVE_OPERATION_SPI_RECEIVE /**< receive `length` bytes into `data` from SPI */
} lv_draw_eve_operation_t;
typedef void (*lv_draw_eve_operation_cb_t)(lv_display_t * disp, lv_draw_eve_operation_t operation, void * data,
uint32_t length);
/*********************
* DEFINES
*********************/
/**********************
* TYPEDEFS
**********************/
/**********************
* GLOBAL PROTOTYPES
**********************/
/**********************
* MACROS
**********************/
#endif /*LV_USE_DRAW_EVE*/
#ifdef __cplusplus
} /*extern "C"*/
#endif
#endif /*LV_DRAW_EVE_TARGET_H*/

View File

@ -0,0 +1,127 @@
/**
* @file lv_draw_eve_triangle.c
*
*/
/* Created on: 10 ene 2024
* Author: juanj
*
* Modified by LVGL
*/
/*********************
* INCLUDES
*********************/
#include "lv_draw_eve_private.h"
#if LV_USE_DRAW_EVE
#include "../../misc/lv_math.h"
#include "../../stdlib/lv_mem.h"
#include "../../misc/lv_area_private.h"
#include "../../misc/lv_color.h"
#include "../../stdlib/lv_string.h"
#include "lv_eve.h"
/*********************
* DEFINES
*********************/
/**********************
* TYPEDEFS
**********************/
/**********************
* STATIC PROTOTYPES
**********************/
/**********************
* STATIC VARIABLES
**********************/
/**********************
* MACROS
**********************/
/**********************
* GLOBAL FUNCTIONS
**********************/
void lv_draw_eve_triangle(lv_draw_task_t * t, const lv_draw_triangle_dsc_t * dsc)
{
lv_area_t tri_area;
tri_area.x1 = (int32_t)LV_MIN3(dsc->p[0].x, dsc->p[1].x, dsc->p[2].x);
tri_area.y1 = (int32_t)LV_MIN3(dsc->p[0].y, dsc->p[1].y, dsc->p[2].y);
tri_area.x2 = (int32_t)LV_MAX3(dsc->p[0].x, dsc->p[1].x, dsc->p[2].x);
tri_area.y2 = (int32_t)LV_MAX3(dsc->p[0].y, dsc->p[1].y, dsc->p[2].y);
bool is_common;
lv_area_t draw_area;
is_common = lv_area_intersect(&draw_area, &tri_area, &t->clip_area);
if(!is_common) return;
lv_point_t p[3];
/*If there is a vertical side use it as p[0] and p[1]*/
if(dsc->p[0].x == dsc->p[1].x) {
p[0] = lv_point_from_precise(&dsc->p[0]);
p[1] = lv_point_from_precise(&dsc->p[1]);
p[2] = lv_point_from_precise(&dsc->p[2]);
}
else if(dsc->p[0].x == dsc->p[2].x) {
p[0] = lv_point_from_precise(&dsc->p[0]);
p[1] = lv_point_from_precise(&dsc->p[2]);
p[2] = lv_point_from_precise(&dsc->p[1]);
}
else if(dsc->p[1].x == dsc->p[2].x) {
p[0] = lv_point_from_precise(&dsc->p[1]);
p[1] = lv_point_from_precise(&dsc->p[2]);
p[2] = lv_point_from_precise(&dsc->p[0]);
}
else {
p[0] = lv_point_from_precise(&dsc->p[0]);
p[1] = lv_point_from_precise(&dsc->p[1]);
p[2] = lv_point_from_precise(&dsc->p[2]);
/*Set the smallest y as p[0]*/
if(p[0].y > p[1].y) lv_point_swap(&p[0], &p[1]);
if(p[0].y > p[2].y) lv_point_swap(&p[0], &p[2]);
/*Set the greatest y as p[1]*/
if(p[1].y < p[2].y) lv_point_swap(&p[1], &p[2]);
}
/*Be sure p[0] is on the top*/
if(p[0].y > p[1].y) lv_point_swap(&p[0], &p[1]);
lv_eve_save_context();
lv_eve_scissor(t->clip_area.x1, t->clip_area.y1, t->clip_area.x2, t->clip_area.y2);
lv_eve_color(dsc->color);
lv_eve_color_opa(dsc->opa);
lv_eve_color_mask(0, 0, 0, 0);
lv_eve_stencil_op(EVE_KEEP, EVE_INVERT);
lv_eve_stencil_func(EVE_ALWAYS, 255, 255);
lv_eve_primitive(LV_EVE_PRIMITIVE_EDGE_STRIP_A);
lv_eve_vertex_2f(p[0].x, p[0].y);
lv_eve_vertex_2f(p[1].x, p[1].y);
lv_eve_vertex_2f(p[2].x, p[2].y);
lv_eve_color_mask(1, 1, 1, 1);
lv_eve_stencil_func(EVE_EQUAL, 255, 255) ;
lv_eve_vertex_2f(0, 0);
lv_eve_vertex_2f(1022, 0);
lv_eve_restore_context();
}
/**********************
* STATIC FUNCTIONS
**********************/
#endif /*LV_USE_DRAW_EVE*/

View File

@ -0,0 +1,265 @@
/**
* @file lv_eve.c
*
*/
/* Created on: 8 jun 2023
* Author: juanj
*
* Modified by LVGL
*/
/*********************
* INCLUDES
*********************/
#include "lv_draw_eve.h"
#if LV_USE_DRAW_EVE
#include "lv_eve.h"
#include "../../libs/FT800-FT813/EVE_commands.h"
/*********************
* DEFINES
*********************/
/**********************
* TYPEDEFS
**********************/
/**********************
* STATIC PROTOTYPES
**********************/
/**********************
* STATIC VARIABLES
**********************/
static uint16_t scissor_x1 = 0;
static uint16_t scissor_y1 = 0;
static uint16_t scissor_x2 = 0;
static uint16_t scissor_y2 = 0;
static lv_eve_drawing_context_t ct = {
.primitive = LV_EVE_PRIMITIVE_ZERO_VALUE,
.color = {0xff, 0xff, 0xff},
.opa = 255,
.line_width = 1, /* for format(0) */
.point_size = 1,
.color_mask = {1, 1, 1, 1},
.stencil_func = {EVE_ALWAYS, 0, 255},
.stencil_op = {EVE_KEEP, EVE_KEEP},
.blend_func = {EVE_SRC_ALPHA, EVE_ONE_MINUS_SRC_ALPHA},
.scx = 0,
.scy = 0,
};
static lv_eve_drawing_context_t ct_temp;
static lv_eve_drawing_state_t st;
/**********************
* MACROS
**********************/
/**********************
* GLOBAL FUNCTIONS
**********************/
void lv_eve_save_context(void)
{
EVE_cmd_dl_burst(DL_SAVE_CONTEXT);
ct_temp = ct;
}
void lv_eve_restore_context(void)
{
EVE_cmd_dl_burst(DL_RESTORE_CONTEXT);
ct = ct_temp;
}
void lv_eve_primitive(uint8_t context)
{
if(context != ct.primitive && context != LV_EVE_PRIMITIVE_ZERO_VALUE) {
EVE_cmd_dl_burst(DL_BEGIN | context);
ct.primitive = context;
}
}
void lv_eve_scissor(uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2)
{
if(x1 != scissor_x1 || y1 != scissor_y1) {
int16_t adjusted_x1 = x1 > 0 ? x1 - 1 : 0;
int16_t adjusted_y1 = y1 > 0 ? y1 - 1 : 0;
EVE_cmd_dl_burst(SCISSOR_XY(adjusted_x1, adjusted_y1));
scissor_x1 = x1;
scissor_y1 = y1;
}
if(x2 != scissor_x2 || y2 != scissor_y2) {
uint16_t w = x2 - x1 + 3;
uint16_t h = y2 - y1 + 3;
EVE_cmd_dl_burst(SCISSOR_SIZE(w, h));
scissor_x2 = x2;
scissor_y2 = y2;
}
}
void lv_eve_color(lv_color_t color)
{
if((ct.color.red != color.red) || (ct.color.green != color.green) || (ct.color.blue != color.blue)) {
EVE_cmd_dl_burst(COLOR_RGB(color.red, color.green, color.blue));
ct.color = color;
}
}
void lv_eve_color_mask(uint8_t r, uint8_t g, uint8_t b, uint8_t a)
{
if((ct.color_mask[0] != r) ||
(ct.color_mask[1] != g) ||
(ct.color_mask[2] != b) ||
(ct.color_mask[3] != a)) {
EVE_cmd_dl_burst(COLOR_MASK(r, g, b, a));
ct.color_mask[0] = r;
ct.color_mask[1] = g;
ct.color_mask[2] = b;
ct.color_mask[3] = a;
}
}
void lv_eve_stencil_func(uint8_t func, uint8_t ref, uint8_t mask)
{
if(func != ct.stencil_func[0] || ref != ct.stencil_func[1] || mask != ct.stencil_func[2]) {
EVE_cmd_dl_burst(STENCIL_FUNC(func, ref, mask));
ct.stencil_func[0] = func;
ct.stencil_func[1] = ref;
ct.stencil_func[2] = mask;
}
}
void lv_eve_stencil_op(uint8_t sfail, uint8_t spass)
{
if(sfail != ct.stencil_op[0] || spass != ct.stencil_op[1]) {
EVE_cmd_dl_burst(STENCIL_OP(sfail, spass));
ct.stencil_op[0] = sfail;
ct.stencil_op[1] = spass;
}
}
void lv_eve_blend_func(uint8_t src, uint8_t dst)
{
if(src != ct.blend_func[0] || dst != ct.blend_func[1]) {
EVE_cmd_dl_burst(BLEND_FUNC(src, dst));
ct.blend_func[0] = src;
ct.blend_func[1] = dst;
}
}
void lv_eve_color_opa(lv_opa_t opa)
{
if(opa != ct.opa) {
EVE_cmd_dl_burst(COLOR_A(opa));
ct.opa = opa;
}
}
void lv_eve_line_width(int32_t width)
{
if(width != ct.line_width) {
EVE_cmd_dl_burst(LINE_WIDTH(width));
ct.line_width = width;
}
}
void lv_eve_point_size(uint16_t radius)
{
if(radius != ct.point_size) {
EVE_cmd_dl_burst(POINT_SIZE(radius * 16));
ct.point_size = radius;
}
}
void lv_eve_vertex_2f(int16_t x, int16_t y)
{
EVE_cmd_dl_burst(VERTEX2F(x, y));
}
void lv_eve_draw_circle_simple(int16_t coord_x1, int16_t coord_y1, uint16_t radius_t)
{
lv_eve_primitive(LV_EVE_PRIMITIVE_POINTS);
lv_eve_point_size(radius_t);
lv_eve_vertex_2f(coord_x1, coord_y1);
}
void lv_eve_draw_rect_simple(int16_t coord_x1, int16_t coord_y1, int16_t coord_x2, int16_t coord_y2, uint16_t radius)
{
lv_eve_primitive(LV_EVE_PRIMITIVE_RECTS);
if(radius > 1) {
lv_eve_line_width(radius * 16);
}
lv_eve_vertex_2f(coord_x1 + radius, coord_y1 + radius);
lv_eve_vertex_2f(coord_x2 - radius, coord_y2 - radius);
}
void lv_eve_mask_round(int16_t coord_x1, int16_t coord_y1, int16_t coord_x2, int16_t coord_y2, int16_t radius)
{
lv_eve_color_mask(0, 0, 0, 1);
EVE_cmd_dl_burst(CLEAR(1, 1, 1));
lv_eve_draw_rect_simple(coord_x1, coord_y1, coord_x2, coord_y2, radius);
lv_eve_color_mask(1, 1, 1, 0);
lv_eve_blend_func(EVE_DST_ALPHA, EVE_ONE_MINUS_DST_ALPHA);
}
void lv_eve_bitmap_source(uint32_t addr)
{
uint32_t bitmap_source = BITMAP_SOURCE(addr);
if(st.bitmap_source != bitmap_source) {
EVE_cmd_dl_burst(bitmap_source);
st.bitmap_source = bitmap_source;
}
}
void lv_eve_bitmap_size(uint8_t filter, uint8_t wrapx, uint8_t wrapy, uint16_t width, uint16_t height)
{
uint32_t bitmap_size = BITMAP_SIZE(filter, wrapx, wrapy, width, height);
if(st.bitmap_size != bitmap_size) {
EVE_cmd_dl_burst(bitmap_size);
st.bitmap_size = bitmap_size;
}
/* set the high bits too, of the width and height */
uint32_t bitmap_size_h = BITMAP_SIZE_H(width, height);
if(st.bitmap_size_h != bitmap_size_h) {
EVE_cmd_dl_burst(bitmap_size_h);
st.bitmap_size_h = bitmap_size_h;
}
}
void lv_eve_bitmap_layout(uint8_t format, uint16_t linestride, uint16_t height)
{
uint32_t bitmap_layout = BITMAP_LAYOUT(format, linestride, height);
if(st.bitmap_layout != bitmap_layout) {
EVE_cmd_dl_burst(bitmap_layout);
st.bitmap_layout = bitmap_layout;
}
/* set the high bits too, of the linestride and height */
uint32_t bitmap_layout_h = BITMAP_LAYOUT_H(linestride, height);
if(st.bitmap_layout_h != bitmap_layout_h) {
EVE_cmd_dl_burst(bitmap_layout_h);
st.bitmap_layout_h = bitmap_layout_h;
}
}
/**********************
* STATIC FUNCTIONS
**********************/
#endif /*LV_USE_DRAW_EVE*/

View File

@ -0,0 +1,151 @@
/**
* @file lv_eve.h
*
*/
/* Created on: 8 jun 2023
* Author: juanj
*
* Modified by LVGL
*/
#ifndef LV_EVE_H
#define LV_EVE_H
#ifdef __cplusplus
extern "C" {
#endif
/*********************
* INCLUDES
*********************/
#include "lv_draw_eve.h"
#if LV_USE_DRAW_EVE
#include "../../misc/lv_types.h"
#include "../../misc/lv_color.h"
#include "../../libs/FT800-FT813/EVE.h"
/*********************
* DEFINES
*********************/
/**********************
* TYPEDEFS
**********************/
typedef enum {
LV_EVE_PRIMITIVE_ZERO_VALUE,
LV_EVE_PRIMITIVE_BITMAPS = 1UL, /* Bitmap drawing primitive */
LV_EVE_PRIMITIVE_POINTS = 2UL, /* Point drawing primitive */
LV_EVE_PRIMITIVE_LINES = 3UL, /* Line drawing primitive */
LV_EVE_PRIMITIVE_LINE_STRIP = 4UL, /* Line strip drawing primitive */
LV_EVE_PRIMITIVE_EDGE_STRIP_R = 5UL, /* Edge strip right side drawing primitive */
LV_EVE_PRIMITIVE_EDGE_STRIP_L = 6UL, /* Edge strip left side drawing primitive */
LV_EVE_PRIMITIVE_EDGE_STRIP_A = 7UL, /* Edge strip above drawing primitive */
LV_EVE_PRIMITIVE_EDGE_STRIP_B = 8UL, /* Edge strip below side drawing primitive */
LV_EVE_PRIMITIVE_RECTS = 9UL, /* Rectangle drawing primitive */
} lv_eve_primitive_t;
typedef struct {
lv_eve_primitive_t primitive;
lv_color_t color;
lv_opa_t opa;
int32_t line_width;
uint16_t point_size;
uint8_t color_mask[4];
uint8_t stencil_func[3];
uint8_t stencil_op[2];
uint8_t blend_func[2];
uint16_t scx;
uint16_t scy;
} lv_eve_drawing_context_t;
/* drawing context that is not saved and restored
* by SAVE_CONTEXT and RESTORE_CONTEXT
*/
typedef struct {
uint32_t bitmap_source;
uint32_t bitmap_size;
uint32_t bitmap_size_h;
uint32_t bitmap_layout;
uint32_t bitmap_layout_h;
} lv_eve_drawing_state_t;
/**********************
* GLOBAL PROTOTYPES
**********************/
void lv_eve_save_context(void);
void lv_eve_restore_context(void);
void lv_eve_scissor(uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2);
void lv_eve_primitive(uint8_t context);
void lv_eve_color(lv_color_t color);
void lv_eve_color_opa(lv_opa_t opa);
void lv_eve_line_width(int32_t width);
void lv_eve_point_size(uint16_t radius);
void lv_eve_vertex_2f(int16_t x, int16_t y);
void lv_eve_color_mask(uint8_t r, uint8_t g, uint8_t b, uint8_t a);
void lv_eve_stencil_func(uint8_t func, uint8_t ref, uint8_t mask);
void lv_eve_stencil_op(uint8_t sfail, uint8_t spass);
void lv_eve_blend_func(uint8_t src, uint8_t dst);
void lv_eve_draw_circle_simple(int16_t coord_x1, int16_t coord_y1, uint16_t radius_t);
void lv_eve_draw_rect_simple(int16_t coord_x1, int16_t coord_y1, int16_t coord_x2, int16_t coord_y2,
uint16_t radius);
void lv_eve_mask_round(int16_t coord_x1, int16_t coord_y1, int16_t coord_x2, int16_t coord_y2, int16_t radius);
/**
* Set the bitmap source to `addr`. SPI transmission will occur unless it is already set to this value.
* The bitmap source is not part of the saved and restored context.
* @param addr the remote EVE memory address to set as the bitmap source
*/
void lv_eve_bitmap_source(uint32_t addr);
/**
* Set the bitmap size and sampling parameters. SPI transmission will occur unless the currently set parameters are already these.
* The bitmap size is not part of the saved and restored context.
* @param filter the sampling method. Either EVE_NEAREST or EVE_BILINEAR
* @param wrapx the out of bounds sampling behavior in the X direction. Either EVE_BORDER or EVE_REPEAT
* @param wrapy the out of bounds sampling behavior in the Y direction. Either EVE_BORDER or EVE_REPEAT
* @param width the width of the bitmap in pixels
* @param height the height of the bitmap in pixels
*/
void lv_eve_bitmap_size(uint8_t filter, uint8_t wrapx, uint8_t wrapy, uint16_t width, uint16_t height);
/**
* Set the bitmap format/layout parameters. SPI transmission will occur unless the currently set parameters are already these.
* The bitmap layout is not part of the saved and restored context.
* @param format an eve color format value like EVE_RGB565
* @param linestride the stride of the bitmap rows in bytes
* @param height the number of rows in the bitmap
*/
void lv_eve_bitmap_layout(uint8_t format, uint16_t linestride, uint16_t height);
/**********************
* EXTERN VARIABLES
**********************/
/**********************
* MACROS
**********************/
/**********************
* INLINE FUNCTIONS
**********************/
/**********************
* STATIC FUNCTIONS
**********************/
#endif /*LV_USE_DRAW_EVE*/
#ifdef __cplusplus
} /*extern "C"*/
#endif
#endif /* LV_EVE_H */

View File

@ -12,6 +12,7 @@
*********************/
#include "../misc/lv_area_private.h"
#include "../misc/lv_assert.h"
#include "../misc/lv_event_private.h"
#include "lv_draw_private.h"
#include "lv_draw_mask_private.h"
#include "lv_draw_vector_private.h"
@ -34,7 +35,7 @@
/**********************
* STATIC PROTOTYPES
**********************/
static bool is_independent(lv_layer_t * layer, lv_draw_task_t * t_check);
static bool is_independent(lv_layer_t * layer, lv_draw_task_t * t_check, uint8_t draw_unit_id);
static void cleanup_task(lv_draw_task_t * t, lv_display_t * disp);
static inline size_t get_draw_dsc_size(lv_draw_task_type_t type);
static lv_draw_task_t * get_first_available_task(lv_layer_t * layer);
@ -110,9 +111,10 @@ lv_draw_task_t * lv_draw_add_task(lv_layer_t * layer, const lv_area_t * coords,
#if LV_DRAW_TRANSFORM_USE_MATRIX
new_task->matrix = layer->matrix;
#endif
new_task->opa = layer->opa;
new_task->type = type;
new_task->draw_dsc = (uint8_t *)new_task + LV_ALIGN_UP(sizeof(lv_draw_task_t), 8);
new_task->state = LV_DRAW_TASK_STATE_QUEUED;
new_task->state = LV_DRAW_TASK_STATE_WAITING;
/*Find the tail*/
if(layer->draw_task_head == NULL) {
@ -165,7 +167,7 @@ void lv_draw_finalize_task_creation(lv_layer_t * layer, lv_draw_task_t * t)
}
if(t->preferred_draw_unit_id == LV_DRAW_UNIT_NONE) {
LV_LOG_WARN("the draw task was not taken by any units");
t->state = LV_DRAW_TASK_STATE_READY;
t->state = LV_DRAW_TASK_STATE_FINISHED;
}
else {
lv_draw_dispatch();
@ -213,20 +215,19 @@ void lv_draw_dispatch(void)
{
LV_PROFILER_DRAW_BEGIN;
bool task_dispatched = false;
lv_display_t * disp = lv_display_get_next(NULL);
while(disp) {
lv_display_t * disp = lv_refr_get_disp_refreshing();
if(disp != NULL) {
lv_layer_t * layer = disp->layer_head;
while(layer) {
if(lv_draw_dispatch_layer(disp, layer))
task_dispatched = true;
layer = layer->next;
}
}
if(!task_dispatched) {
lv_draw_wait_for_finish();
lv_draw_dispatch_request();
}
disp = lv_display_get_next(disp);
}
LV_PROFILER_DRAW_END;
}
@ -240,7 +241,7 @@ bool lv_draw_dispatch_layer(lv_display_t * disp, lv_layer_t * layer)
bool remove_task = false;
while(t) {
t_next = t->next;
if(t->state == LV_DRAW_TASK_STATE_READY) {
if(t->state == LV_DRAW_TASK_STATE_FINISHED) {
cleanup_task(t, disp);
remove_task = true;
if(t_prev != NULL)
@ -261,10 +262,10 @@ bool lv_draw_dispatch_layer(lv_display_t * disp, lv_layer_t * layer)
/*Find a draw task with TYPE_LAYER in the layer where the src is this layer*/
lv_draw_task_t * t_src = layer->parent->draw_task_head;
while(t_src) {
if(t_src->type == LV_DRAW_TASK_TYPE_LAYER && t_src->state == LV_DRAW_TASK_STATE_WAITING) {
if(t_src->type == LV_DRAW_TASK_TYPE_LAYER && t_src->state == LV_DRAW_TASK_STATE_BLOCKED) {
lv_draw_image_dsc_t * draw_dsc = t_src->draw_dsc;
if(draw_dsc->src == layer) {
t_src->state = LV_DRAW_TASK_STATE_QUEUED;
t_src->state = LV_DRAW_TASK_STATE_WAITING;
lv_draw_dispatch_request();
break;
}
@ -339,7 +340,7 @@ lv_draw_task_t * lv_draw_get_next_available_task(lv_layer_t * layer, lv_draw_tas
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 &&
if(t->state != LV_DRAW_TASK_STATE_WAITING &&
t->area.x1 <= 0 && t->area.x2 >= hor_res - 1 &&
t->area.y1 <= 0 && t->area.y2 >= ver_res - 1) {
LV_PROFILER_DRAW_END;
@ -349,13 +350,14 @@ lv_draw_task_t * lv_draw_get_next_available_task(lv_layer_t * layer, lv_draw_tas
lv_draw_task_t * t = t_prev ? t_prev->next : layer->draw_task_head;
while(t) {
/*Find a queued and independent task*/
if(t->state == LV_DRAW_TASK_STATE_QUEUED &&
(t->preferred_draw_unit_id == LV_DRAW_UNIT_NONE || t->preferred_draw_unit_id == draw_unit_id) &&
is_independent(layer, t)) {
/*Find a draw task for this draw unit which is waiting and independent?*/
if((t->preferred_draw_unit_id == draw_unit_id || t->preferred_draw_unit_id == LV_DRAW_UNIT_NONE) &&
t->state == LV_DRAW_TASK_STATE_WAITING &&
is_independent(layer, t, draw_unit_id)) {
LV_PROFILER_DRAW_END;
return t;
}
t = t->next;
}
@ -373,7 +375,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) &&
if((t->state == LV_DRAW_TASK_STATE_WAITING || t->state == LV_DRAW_TASK_STATE_BLOCKED) &&
lv_area_is_on(&t_check->area, &t->area)) {
cnt++;
}
@ -384,6 +386,29 @@ uint32_t lv_draw_get_dependent_count(lv_draw_task_t * t_check)
return cnt;
}
void lv_draw_unit_send_event(const char * name, lv_event_code_t code, void * param)
{
LV_PROFILER_DRAW_BEGIN;
lv_event_t event = { 0 };
event.code = code;
event.param = param;
lv_draw_unit_t * u = _draw_info.unit_head;
while(u) {
if(u->event_cb && (!name || lv_strcmp(name, u->name) == 0)) {
event.current_target = event.original_target = u;
LV_PROFILER_DRAW_BEGIN_TAG("event_cb");
LV_PROFILER_DRAW_BEGIN_TAG(u->name);
u->event_cb(&event);
LV_PROFILER_DRAW_END_TAG(u->name);
LV_PROFILER_DRAW_END_TAG("event_cb");
}
u = u->next;
}
LV_PROFILER_DRAW_END;
}
void lv_layer_init(lv_layer_t * layer)
{
LV_ASSERT_NULL(layer);
@ -520,22 +545,29 @@ void lv_draw_task_get_area(const lv_draw_task_t * t, lv_area_t * area)
* Check if there are older draw task overlapping the area of `t_check`
* @param layer the draw ctx to search in
* @param t_check check this task if it overlaps with the older ones
* @param draw_unit_id draw unit ID for which the independence check is called
* @return true: `t_check` is not overlapping with older tasks so it's independent
*/
static bool is_independent(lv_layer_t * layer, lv_draw_task_t * t_check)
static bool is_independent(lv_layer_t * layer, lv_draw_task_t * t_check, uint8_t draw_unit_id)
{
LV_PROFILER_DRAW_BEGIN;
lv_draw_task_t * t = layer->draw_task_head;
/*If t_check is outside of the older tasks then it's independent*/
while(t && t != t_check) {
if(t->state != LV_DRAW_TASK_STATE_READY) {
/*It's independent of finished draw tasks, and queued draw tasks of the same draw unit,
*so no need to check it*/
if(t->state == LV_DRAW_TASK_STATE_FINISHED ||
(t->state == LV_DRAW_TASK_STATE_QUEUED && t->preferred_draw_unit_id == draw_unit_id)) {
t = t->next;
continue;
}
lv_area_t a;
if(lv_area_intersect(&a, &t->_real_area, &t_check->_real_area)) {
LV_PROFILER_DRAW_END;
return false;
}
}
t = t->next;
}
LV_PROFILER_DRAW_END;
@ -581,7 +613,7 @@ static inline size_t get_draw_dsc_size(lv_draw_task_type_t type)
return 0;
#if LV_USE_VECTOR_GRAPHIC
case LV_DRAW_TASK_TYPE_VECTOR:
return sizeof(lv_draw_vector_task_dsc_t);
return sizeof(lv_draw_vector_dsc_t);
#endif
#if LV_USE_3DTEXTURE
case LV_DRAW_TASK_TYPE_3D:
@ -662,16 +694,16 @@ static lv_draw_task_t * get_first_available_task(lv_layer_t * layer)
* all its tasks are ready. As other areas might be on top of that
* layer-to-blend don't skip it. Instead stop there, so that the
* draw tasks of that layer can be consumed and can be finished.
* After that this layer-to-blenf will have `LV_DRAW_TASK_STATE_QUEUED`
* After that this layer-to-blenf will have `LV_DRAW_TASK_STATE_WAITING`
* so it can be blended normally.*/
lv_draw_task_t * t = layer->draw_task_head;
while(t) {
/*Not queued yet, leave this layer while the first task is queued*/
if(t->state != LV_DRAW_TASK_STATE_QUEUED) {
/*Not waiting to be rendered, leave this layer while the first task is ready (i.e. not blocked)*/
if(t->state != LV_DRAW_TASK_STATE_WAITING) {
t = NULL;
break;
}
/*It's a supported and queued task, process it*/
/*Waiting to be rendered, use it*/
else {
break;
}

View File

@ -24,6 +24,7 @@ extern "C" {
#include "../misc/lv_text.h"
#include "../misc/lv_profiler.h"
#include "../misc/lv_matrix.h"
#include "../misc/lv_event.h"
#include "lv_image_decoder.h"
#include "lv_draw_buf.h"
@ -66,22 +67,52 @@ typedef enum {
} lv_draw_task_type_t;
typedef enum {
LV_DRAW_TASK_STATE_WAITING, /*Waiting for something to be finished. E.g. rendering a layer*/
/** Waiting for an other task to be finished.
* For example in case of `LV_DRAW_TASK_TYPE_LAYER` (used to blend a layer)
* is blocked until all the draw tasks of the layer is rendered. */
LV_DRAW_TASK_STATE_BLOCKED,
/** The draw task is added to the layers list and waits to be rendered. */
LV_DRAW_TASK_STATE_WAITING,
/** The draw task is added to the command queue of the draw unit.
* As the queued task are executed in order it's possible to queue multiple draw task
* (for the same draw unit) even if they are depending on each other.
* Therefore `lv_draw_get_available_task` and `lv_draw_get_next_available_task` can return
* draw task for the same draw unit even if a dependent draw task is not finished ready yet.*/
LV_DRAW_TASK_STATE_QUEUED,
/** The draw task is being rendered. This draw task needs to be finished before
* `lv_draw_get_available_task` and `lv_draw_get_next_available_task` would
* return any depending draw tasks.*/
LV_DRAW_TASK_STATE_IN_PROGRESS,
LV_DRAW_TASK_STATE_READY,
/** The draw task is rendered. It will be removed from the draw task list of the layer
* and freed automatically. */
LV_DRAW_TASK_STATE_FINISHED,
} lv_draw_task_state_t;
struct _lv_layer_t {
/** Target draw buffer of the layer */
lv_draw_buf_t * draw_buf;
/** Linked list of draw tasks */
lv_draw_task_t * draw_task_head;
/** Parent layer */
lv_layer_t * parent;
/** Next layer */
lv_layer_t * next;
/** User data */
void * user_data;
/** 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;
/** The physical clipping area relative to the display */
lv_area_t phy_clip_area;
/**
* NEVER USE IT DRAW UNITS. USED INTERNALLY DURING DRAW TASK CREATION.
@ -93,32 +124,25 @@ 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
/** Opacity of the layer */
lv_opa_t opa;
/*Recolor of the layer*/
lv_color32_t recolor;
/** Partial y offset */
int32_t partial_y_offset;
/** Linked list of draw tasks */
lv_draw_task_t * draw_task_head;
/** Recolor of the layer */
lv_color32_t recolor;
lv_layer_t * parent;
lv_layer_t * next;
/** The color format of the layer. LV_COLOR_FORMAT_... */
lv_color_format_t color_format;
/** Flag indicating all tasks are added */
bool all_tasks_added;
void * user_data;
/** Opacity of the layer */
lv_opa_t opa;
};
typedef struct {
@ -126,7 +150,7 @@ typedef struct {
lv_obj_t * obj;
/**The widget part for which draw descriptor was created */
lv_part_t part;
uint32_t part;
/**A widget type specific ID (e.g. table row index). See the docs of the given widget.*/
uint32_t id1;
@ -248,6 +272,15 @@ lv_draw_task_t * lv_draw_get_next_available_task(lv_layer_t * layer, lv_draw_tas
*/
uint32_t lv_draw_get_dependent_count(lv_draw_task_t * t_check);
/**
* Send an event to the draw units
* @param name the name of the draw unit to send the event to
* @param code the event code
* @param param the event parameter
*/
void lv_draw_unit_send_event(const char * name, lv_event_code_t code, void * param);
/**
* Initialize a layer
* @param layer pointer to a layer to initialize

View File

@ -41,6 +41,8 @@ void lv_draw_3d_dsc_init(lv_draw_3d_dsc_t * dsc)
lv_memzero(dsc, sizeof(lv_draw_3d_dsc_t));
dsc->base.dsc_size = sizeof(lv_draw_3d_dsc_t);
dsc->tex_id = LV_3DTEXTURE_ID_NULL;
dsc->h_flip = false;
dsc->v_flip = false;
dsc->opa = LV_OPA_COVER;
}

View File

@ -30,6 +30,8 @@ extern "C" {
typedef struct {
lv_draw_dsc_base_t base;
lv_3dtexture_id_t tex_id;
bool h_flip;
bool v_flip;
lv_opa_t opa;
} lv_draw_3d_dsc_t;

View File

@ -45,12 +45,12 @@ typedef struct {
/**The center point of the arc. */
lv_point_t center;
/**The outer radius of the arc*/
uint16_t radius;
/**An image source to be used instead of `color`. `NULL` if unused*/
const void * img_src;
/**The outer radius of the arc*/
uint16_t radius;
/**Opacity of the arc in 0...255 range.
* LV_OPA_TRANSP, LV_OPA_10, LV_OPA_20, .. LV_OPA_COVER can be used as well*/
lv_opa_t opa;

View File

@ -12,6 +12,7 @@
#include "../core/lv_global.h"
#include "../misc/lv_math.h"
#include "../misc/lv_area_private.h"
#include "convert/lv_draw_buf_convert.h"
/*********************
* DEFINES
@ -29,6 +30,8 @@
**********************/
static void * buf_malloc(size_t size, lv_color_format_t color_format);
static void buf_free(void * buf);
static void buf_copy(lv_draw_buf_t * dest, const lv_area_t * dest_area,
const lv_draw_buf_t * src, const lv_area_t * src_area);
static void * buf_align(void * buf, lv_color_format_t color_format);
static void * draw_buf_malloc(const lv_draw_buf_handlers_t * handler, size_t size_bytes,
lv_color_format_t color_format);
@ -58,20 +61,22 @@ void lv_draw_buf_init_handlers(void)
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);
lv_draw_buf_handlers_init(handlers, buf_malloc, buf_free, buf_copy, 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_draw_buf_malloc_cb_t buf_malloc_cb,
lv_draw_buf_free_cb_t buf_free_cb,
lv_draw_buf_copy_cb_t buf_copy_cb,
lv_draw_buf_align_cb_t align_pointer_cb,
lv_draw_buf_cache_operation_cb_t invalidate_cache_cb,
lv_draw_buf_cache_operation_cb_t flush_cache_cb,
lv_draw_buf_width_to_stride_cb_t 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->buf_copy_cb = buf_copy_cb;
handlers->align_pointer_cb = align_pointer_cb;
handlers->invalidate_cache_cb = invalidate_cache_cb;
handlers->flush_cache_cb = flush_cache_cb;
@ -210,64 +215,6 @@ void lv_draw_buf_clear(lv_draw_buf_t * draw_buf, const lv_area_t * a)
LV_PROFILER_DRAW_END;
}
void lv_draw_buf_copy(lv_draw_buf_t * dest, const lv_area_t * dest_area,
const lv_draw_buf_t * src, const lv_area_t * src_area)
{
LV_PROFILER_DRAW_BEGIN;
uint8_t * dest_bufc;
uint8_t * src_bufc;
int32_t line_width;
/*Source and dest color format must be same. Color conversion is not supported yet.*/
LV_ASSERT_FORMAT_MSG(dest->header.cf == src->header.cf, "Color format mismatch: %d != %d",
dest->header.cf, src->header.cf);
if(dest_area == NULL) line_width = dest->header.w;
else line_width = lv_area_get_width(dest_area);
/* For indexed image, copy the palette if we are copying full image area*/
if(dest_area == NULL || src_area == NULL) {
if(LV_COLOR_FORMAT_IS_INDEXED(dest->header.cf)) {
lv_memcpy(dest->data, src->data, LV_COLOR_INDEXED_PALETTE_SIZE(dest->header.cf) * sizeof(lv_color32_t));
}
}
/*Check source and dest area have same width*/
if((src_area == NULL && line_width != src->header.w) || \
(src_area != NULL && line_width != lv_area_get_width(src_area))) {
LV_ASSERT_MSG(0, "Source and destination areas have different width");
LV_PROFILER_DRAW_END;
return;
}
if(src_area) src_bufc = lv_draw_buf_goto_xy(src, src_area->x1, src_area->y1);
else src_bufc = lv_draw_buf_goto_xy(src, 0, 0);
if(dest_area) dest_bufc = lv_draw_buf_goto_xy(dest, dest_area->x1, dest_area->y1);
else dest_bufc = lv_draw_buf_goto_xy(dest, 0, 0);
int32_t start_y, end_y;
if(dest_area) {
start_y = dest_area->y1;
end_y = dest_area->y2;
}
else {
start_y = 0;
end_y = dest->header.h - 1;
}
uint32_t dest_stride = dest->header.stride;
uint32_t src_stride = src->header.stride;
uint32_t line_bytes = (line_width * lv_color_format_get_bpp(dest->header.cf) + 7) >> 3;
for(; start_y <= end_y; start_y++) {
lv_memcpy(dest_bufc, src_bufc, line_bytes);
dest_bufc += dest_stride;
src_bufc += src_stride;
}
LV_PROFILER_DRAW_END;
}
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)
{
@ -416,11 +363,28 @@ void lv_draw_buf_destroy(lv_draw_buf_t * draw_buf)
LV_PROFILER_DRAW_END;
}
void lv_draw_buf_copy(lv_draw_buf_t * dest, const lv_area_t * dest_area,
const lv_draw_buf_t * src, const lv_area_t * src_area)
{
LV_ASSERT_NULL(dest);
LV_ASSERT_NULL(dest->handlers);
LV_ASSERT_NULL(dest->handlers->buf_copy_cb);
LV_ASSERT_NULL(src);
dest->handlers->buf_copy_cb(dest, dest_area, src, src_area);
}
void * lv_draw_buf_goto_xy(const lv_draw_buf_t * buf, uint32_t x, uint32_t y)
{
LV_ASSERT_NULL(buf);
if(buf == NULL) return NULL;
if(x >= buf->header.w || y >= buf->header.h) {
LV_LOG_ERROR("coordinates out of range, x: %" LV_PRIu32 ", y: %"LV_PRIu32", w: %"LV_PRIu32", h: %"LV_PRIu32, x, y,
(uint32_t)buf->header.w, (uint32_t)buf->header.h);
return NULL;
}
uint8_t * data = buf->data;
/*Skip palette*/
@ -515,67 +479,7 @@ lv_result_t lv_draw_buf_premultiply(lv_draw_buf_t * draw_buf)
}
LV_PROFILER_DRAW_BEGIN;
/*Premultiply color with alpha, do case by case by judging color format*/
lv_color_format_t cf = draw_buf->header.cf;
if(LV_COLOR_FORMAT_IS_INDEXED(cf)) {
int size = LV_COLOR_INDEXED_PALETTE_SIZE(cf);
lv_color32_t * palette = (lv_color32_t *)draw_buf->data;
for(int i = 0; i < size; i++) {
lv_color_premultiply(&palette[i]);
}
}
else if(cf == LV_COLOR_FORMAT_ARGB8888) {
uint32_t h = draw_buf->header.h;
uint32_t w = draw_buf->header.w;
uint32_t stride = draw_buf->header.stride;
uint8_t * line = (uint8_t *)draw_buf->data;
for(uint32_t y = 0; y < h; y++) {
lv_color32_t * pixel = (lv_color32_t *)line;
for(uint32_t x = 0; x < w; x++) {
lv_color_premultiply(pixel);
pixel++;
}
line += stride;
}
}
else if(cf == LV_COLOR_FORMAT_RGB565A8) {
uint32_t h = draw_buf->header.h;
uint32_t w = draw_buf->header.w;
uint32_t stride = draw_buf->header.stride;
uint32_t alpha_stride = stride / 2;
uint8_t * line = (uint8_t *)draw_buf->data;
lv_opa_t * alpha = (lv_opa_t *)(line + stride * h);
for(uint32_t y = 0; y < h; y++) {
lv_color16_t * pixel = (lv_color16_t *)line;
for(uint32_t x = 0; x < w; x++) {
lv_color16_premultiply(pixel, alpha[x]);
pixel++;
}
line += stride;
alpha += alpha_stride;
}
}
else if(cf == LV_COLOR_FORMAT_ARGB8565) {
uint32_t h = draw_buf->header.h;
uint32_t w = draw_buf->header.w;
uint32_t stride = draw_buf->header.stride;
uint8_t * line = (uint8_t *)draw_buf->data;
for(uint32_t y = 0; y < h; y++) {
uint8_t * pixel = line;
for(uint32_t x = 0; x < w; x++) {
uint8_t alpha = pixel[2];
lv_color16_premultiply((lv_color16_t *)pixel, alpha);
pixel += 3;
}
line += stride;
}
}
else if(LV_COLOR_FORMAT_IS_ALPHA_ONLY(cf)) {
/*Pass*/
}
else {
LV_LOG_WARN("draw buf has no alpha, cf: %d", cf);
}
lv_draw_buf_convert_premultiply(draw_buf);
draw_buf->header.flags |= LV_IMAGE_FLAGS_PREMULTIPLIED;
@ -664,6 +568,64 @@ static void buf_free(void * buf)
lv_free(buf);
}
static void buf_copy(lv_draw_buf_t * dest, const lv_area_t * dest_area,
const lv_draw_buf_t * src, const lv_area_t * src_area)
{
LV_PROFILER_DRAW_BEGIN;
uint8_t * dest_bufc;
uint8_t * src_bufc;
int32_t line_width;
/*Source and dest color format must be same. Color conversion is not supported yet.*/
LV_ASSERT_FORMAT_MSG(dest->header.cf == src->header.cf, "Color format mismatch: %d != %d",
dest->header.cf, src->header.cf);
if(dest_area == NULL) line_width = dest->header.w;
else line_width = lv_area_get_width(dest_area);
/* For indexed image, copy the palette if we are copying full image area*/
if(dest_area == NULL || src_area == NULL) {
if(LV_COLOR_FORMAT_IS_INDEXED(dest->header.cf)) {
lv_memcpy(dest->data, src->data, LV_COLOR_INDEXED_PALETTE_SIZE(dest->header.cf) * sizeof(lv_color32_t));
}
}
/*Check source and dest area have same width*/
if((src_area == NULL && line_width != src->header.w) || \
(src_area != NULL && line_width != lv_area_get_width(src_area))) {
LV_ASSERT_MSG(0, "Source and destination areas have different width");
LV_PROFILER_DRAW_END;
return;
}
if(src_area) src_bufc = lv_draw_buf_goto_xy(src, src_area->x1, src_area->y1);
else src_bufc = lv_draw_buf_goto_xy(src, 0, 0);
if(dest_area) dest_bufc = lv_draw_buf_goto_xy(dest, dest_area->x1, dest_area->y1);
else dest_bufc = lv_draw_buf_goto_xy(dest, 0, 0);
int32_t start_y, end_y;
if(dest_area) {
start_y = dest_area->y1;
end_y = dest_area->y2;
}
else {
start_y = 0;
end_y = dest->header.h - 1;
}
uint32_t dest_stride = dest->header.stride;
uint32_t src_stride = src->header.stride;
uint32_t line_bytes = (line_width * lv_color_format_get_bpp(dest->header.cf) + 7) >> 3;
for(; start_y <= end_y; start_y++) {
lv_memcpy(dest_bufc, src_bufc, line_bytes);
dest_bufc += dest_stride;
src_bufc += src_stride;
}
LV_PROFILER_DRAW_END;
}
static void * buf_align(void * buf, lv_color_format_t color_format)
{
LV_UNUSED(color_format);

View File

@ -75,15 +75,18 @@ LV_EXPORT_CONST_INT(LV_STRIDE_AUTO);
* TYPEDEFS
**********************/
typedef void * (*lv_draw_buf_malloc_cb)(size_t size, lv_color_format_t color_format);
typedef void * (*lv_draw_buf_malloc_cb_t)(size_t size, lv_color_format_t color_format);
typedef void (*lv_draw_buf_free_cb)(void * draw_buf);
typedef void (*lv_draw_buf_free_cb_t)(void * draw_buf);
typedef void * (*lv_draw_buf_align_cb)(void * buf, lv_color_format_t color_format);
typedef void (*lv_draw_buf_copy_cb_t)(lv_draw_buf_t * dest, const lv_area_t * dest_area,
const lv_draw_buf_t * src, const lv_area_t * src_area);
typedef void (*lv_draw_buf_cache_operation_cb)(const lv_draw_buf_t * draw_buf, const lv_area_t * area);
typedef void * (*lv_draw_buf_align_cb_t)(void * buf, lv_color_format_t color_format);
typedef uint32_t (*lv_draw_buf_width_to_stride_cb)(uint32_t w, lv_color_format_t color_format);
typedef void (*lv_draw_buf_cache_operation_cb_t)(const lv_draw_buf_t * draw_buf, const lv_area_t * area);
typedef uint32_t (*lv_draw_buf_width_to_stride_cb_t)(uint32_t w, lv_color_format_t color_format);
struct _lv_draw_buf_t {
lv_image_header_t header;
@ -110,18 +113,20 @@ void lv_draw_buf_init_with_default_handlers(lv_draw_buf_handlers_t * 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 buf_copy_cb the callback to copy a draw buffer to an other
* @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);
lv_draw_buf_malloc_cb_t buf_malloc_cb,
lv_draw_buf_free_cb_t buf_free_cb,
lv_draw_buf_copy_cb_t buf_copy_cb,
lv_draw_buf_align_cb_t align_pointer_cb,
lv_draw_buf_cache_operation_cb_t invalidate_cache_cb,
lv_draw_buf_cache_operation_cb_t flush_cache_cb,
lv_draw_buf_width_to_stride_cb_t width_to_stride_cb);
/**
* Get the struct which holds the callbacks for draw buf management.
@ -192,17 +197,6 @@ uint32_t lv_draw_buf_width_to_stride_ex(const lv_draw_buf_handlers_t * handlers,
*/
void lv_draw_buf_clear(lv_draw_buf_t * draw_buf, const lv_area_t * a);
/**
* 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
* @param src_area the area to copy from the destination buffer, if NULL, use the whole buffer
* @note `dest_area` and `src_area` should have the same width and height
* @note `dest` and `src` should have same color format. Color converting is not supported fow now.
*/
void lv_draw_buf_copy(lv_draw_buf_t * dest, const lv_area_t * dest_area,
const lv_draw_buf_t * src, const lv_area_t * src_area);
/**
* Note: Eventually, lv_draw_buf_malloc/free will be kept as private.
@ -285,6 +279,19 @@ lv_draw_buf_t * lv_draw_buf_reshape(lv_draw_buf_t * draw_buf, lv_color_format_t
*/
void lv_draw_buf_destroy(lv_draw_buf_t * draw_buf);
/**
* 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
* @param src_area the area to copy from the destination buffer, if NULL, use the whole buffer
* @note `dest_area` and `src_area` should have the same width and height
* @note The default copy function required `dest` and `src` to have the same color format.
* Overwriting dest->handlers->buf_copy_cb can resolve this limitation.
*/
void lv_draw_buf_copy(lv_draw_buf_t * dest, const lv_area_t * dest_area,
const lv_draw_buf_t * src, const lv_area_t * src_area);
/**
* Return pointer to the buffer at the given coordinates
*/

View File

@ -25,12 +25,13 @@ extern "C" {
**********************/
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;
lv_draw_buf_malloc_cb_t buf_malloc_cb;
lv_draw_buf_free_cb_t buf_free_cb;
lv_draw_buf_copy_cb_t buf_copy_cb;
lv_draw_buf_align_cb_t align_pointer_cb;
lv_draw_buf_cache_operation_cb_t invalidate_cache_cb;
lv_draw_buf_cache_operation_cb_t flush_cache_cb;
lv_draw_buf_width_to_stride_cb_t width_to_stride_cb;
};
/**********************

View File

@ -1,5 +1,5 @@
/**
* @file lv_draw_img.c
* @file lv_draw_image.c
*
*/
@ -76,7 +76,7 @@ void lv_draw_layer(lv_layer_t * layer, const lv_draw_image_dsc_t * dsc, const lv
lv_draw_task_t * t = lv_draw_add_task(layer, coords, LV_DRAW_TASK_TYPE_LAYER);
lv_draw_image_dsc_t * new_image_dsc = t->draw_dsc;
lv_memcpy(new_image_dsc, dsc, sizeof(*dsc));
t->state = LV_DRAW_TASK_STATE_WAITING;
t->state = LV_DRAW_TASK_STATE_BLOCKED;
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);
@ -180,6 +180,8 @@ void lv_draw_image(lv_layer_t * layer, const lv_draw_image_dsc_t * dsc, const lv
}
}
lv_image_decoder_close(&decoder_dsc);
}
LV_PROFILER_DRAW_END;

View File

@ -73,7 +73,7 @@ struct _lv_draw_image_dsc_t {
*/
lv_blend_mode_t blend_mode : 4;
/**1: perform the transformation with anti-alaising */
/**1: perform the transformation with anti-aliasing */
uint16_t antialias : 1;
/**If the image is smaller than the `image_area` field of `lv_draw_image_dsc_t`
@ -81,6 +81,8 @@ struct _lv_draw_image_dsc_t {
* `image_area` area*/
uint16_t tile : 1;
const lv_image_colorkey_t * colorkey;
/**Used internally to store some information about the palette or the color of A8 images*/
lv_draw_image_sup_t * sup;

View File

@ -137,6 +137,7 @@ void LV_ATTRIBUTE_FAST_MEM lv_draw_character(lv_layer_t * layer, lv_draw_label_d
LV_PROFILER_DRAW_BEGIN;
lv_font_glyph_dsc_t g;
lv_font_get_glyph_dsc(dsc->font, &g, unicode_letter, 0);
lv_area_t a;
@ -175,6 +176,7 @@ void LV_ATTRIBUTE_FAST_MEM lv_draw_letter(lv_layer_t * layer, lv_draw_letter_dsc
LV_PROFILER_DRAW_BEGIN;
lv_font_glyph_dsc_t g;
lv_font_get_glyph_dsc(font, &g, dsc->unicode, 0);
font = g.resolved_font ? g.resolved_font : dsc->font;
@ -223,9 +225,15 @@ void lv_draw_label_iterate_characters(lv_draw_task_t * t, const lv_draw_label_ds
w = dsc->text_size.x;
}
else {
lv_text_attributes_t attributes = {0};
attributes.letter_space = dsc->letter_space;
attributes.line_space = dsc->line_space;
attributes.max_width = LV_COORD_MAX;
attributes.text_flags = dsc->flag;
lv_point_t p;
lv_text_get_size(&p, dsc->text, dsc->font, dsc->letter_space, dsc->line_space, LV_COORD_MAX,
dsc->flag);
lv_text_get_size_attributes(&p, dsc->text, dsc->font, &attributes);
w = p.x;
}
}
@ -263,15 +271,19 @@ void lv_draw_label_iterate_characters(lv_draw_task_t * t, const lv_draw_label_ds
}
uint32_t remaining_len = dsc->text_length;
lv_text_attributes_t attributes = {0};
attributes.letter_space = dsc->letter_space;
attributes.text_flags = dsc->flag;
attributes.max_width = w;
uint32_t line_end = line_start + lv_text_get_next_line(&dsc->text[line_start], remaining_len, font, dsc->letter_space,
w, NULL, dsc->flag);
uint32_t line_end = line_start + lv_text_get_next_line(&dsc->text[line_start], remaining_len, font, NULL, &attributes);
/*Go the first visible line*/
while(pos.y + line_height_font < t->clip_area.y1) {
/*Go to next line*/
remaining_len -= line_end - line_start;
line_start = line_end;
line_end += lv_text_get_next_line(&dsc->text[line_start], remaining_len, font, dsc->letter_space, w, NULL, dsc->flag);
line_end += lv_text_get_next_line(&dsc->text[line_start], remaining_len, font, NULL, &attributes);
pos.y += line_height;
/*Save at the threshold coordinate*/
@ -286,16 +298,13 @@ void lv_draw_label_iterate_characters(lv_draw_task_t * t, const lv_draw_label_ds
/*Align to middle*/
if(align == LV_TEXT_ALIGN_CENTER) {
line_width = lv_text_get_width_with_flags(&dsc->text[line_start], line_end - line_start, font, dsc->letter_space,
dsc->flag);
line_width = lv_text_get_width(&dsc->text[line_start], line_end - line_start, font, &attributes);
pos.x += (lv_area_get_width(coords) - line_width) / 2;
}
/*Align to the right*/
else if(align == LV_TEXT_ALIGN_RIGHT) {
line_width = lv_text_get_width_with_flags(&dsc->text[line_start], line_end - line_start, font, dsc->letter_space,
dsc->flag);
line_width = lv_text_get_width(&dsc->text[line_start], line_end - line_start, font, &attributes);
pos.x += lv_area_get_width(coords) - line_width;
}
@ -309,11 +318,13 @@ void lv_draw_label_iterate_characters(lv_draw_task_t * t, const lv_draw_label_ds
lv_area_t bg_coords;
lv_draw_glyph_dsc_t draw_letter_dsc;
lv_font_glyph_dsc_t glyph_dsc;
lv_draw_glyph_dsc_init(&draw_letter_dsc);
draw_letter_dsc.opa = dsc->opa;
draw_letter_dsc.bg_coords = &bg_coords;
draw_letter_dsc.color = dsc->color;
draw_letter_dsc.rotation = dsc->rotation;
draw_letter_dsc.g = &glyph_dsc;
/* Set letter outline stroke attributes */
draw_letter_dsc.outline_stroke_width = dsc->outline_stroke_width;
@ -328,6 +339,7 @@ void lv_draw_label_iterate_characters(lv_draw_task_t * t, const lv_draw_label_ds
uint32_t next_char_offset;
uint32_t recolor_command_start_index = 0;
int32_t letter_w;
cmd_state_t recolor_cmd_state = RECOLOR_CMD_STATE_WAIT_FOR_PARAMETER;
lv_color_t recolor = lv_color_black(); /* Holds the selected color inside the recolor command */
uint8_t is_first_space_after_cmd = 0;
@ -338,7 +350,6 @@ void lv_draw_label_iterate_characters(lv_draw_task_t * t, const lv_draw_label_ds
line_start_x = pos.x;
/*Write all letter of a line*/
recolor_cmd_state = RECOLOR_CMD_STATE_WAIT_FOR_PARAMETER;
next_char_offset = 0;
#if LV_USE_BIDI
size_t bidi_size = line_end - line_start;
@ -455,12 +466,13 @@ void lv_draw_label_iterate_characters(lv_draw_task_t * t, const lv_draw_label_ds
logical_char_pos -= (LABEL_RECOLOR_PAR_LENGTH + 1);
}
letter_w = lv_font_get_glyph_width(font, letter, letter_next);
lv_font_get_glyph_dsc(font, &glyph_dsc, letter, letter_next);
letter_w = lv_text_is_marker(letter) ? 0 : glyph_dsc.adv_w;
/*Always set the bg_coordinates for placeholder drawing*/
bg_coords.x1 = pos.x;
bg_coords.x1 = pos.x - dsc->letter_space / 2;
bg_coords.y1 = pos.y;
bg_coords.x2 = pos.x + letter_w - 1;
bg_coords.x2 = pos.x + letter_w - 1 + (dsc->letter_space + 1) / 2;
bg_coords.y2 = pos.y + line_height - 1;
if(next_char_offset >= line_end - line_start) {
@ -511,25 +523,31 @@ void lv_draw_label_iterate_characters(lv_draw_task_t * t, const lv_draw_label_ds
lv_free(bidi_txt);
bidi_txt = NULL;
#endif
lv_text_attributes_t text_attributes = {0};
text_attributes.letter_space = dsc->letter_space;
text_attributes.text_flags = dsc->flag;
text_attributes.max_width = w;
/*Go to next line*/
remaining_len -= line_end - line_start;
line_start = line_end;
if(remaining_len) {
line_end += lv_text_get_next_line(&dsc->text[line_start], remaining_len, font, dsc->letter_space, w, NULL, dsc->flag);
line_end += lv_text_get_next_line(&dsc->text[line_start], remaining_len, font, NULL, &text_attributes);
}
pos.x = coords->x1;
/*Align to middle*/
if(align == LV_TEXT_ALIGN_CENTER) {
line_width =
lv_text_get_width_with_flags(&dsc->text[line_start], line_end - line_start, font, dsc->letter_space, dsc->flag);
lv_text_get_width(&dsc->text[line_start], line_end - line_start, font, &text_attributes);
pos.x += (lv_area_get_width(coords) - line_width) / 2;
}
/*Align to the right*/
else if(align == LV_TEXT_ALIGN_RIGHT) {
line_width =
lv_text_get_width_with_flags(&dsc->text[line_start], line_end - line_start, font, dsc->letter_space, dsc->flag);
lv_text_get_width(&dsc->text[line_start], line_end - line_start, font, &text_attributes);
pos.x += lv_area_get_width(coords) - line_width;
}
@ -569,16 +587,23 @@ void lv_draw_unit_draw_letter(lv_draw_task_t * t, lv_draw_glyph_dsc_t * dsc, co
return;
LV_PROFILER_DRAW_BEGIN;
bool g_ret = lv_font_get_glyph_dsc(font, &g, letter, '\0');
if(dsc->g == NULL) {
dsc->g = &g;
/*If the glyph dsc is not set then get it from the font*/
bool g_ret = lv_font_get_glyph_dsc(font, &g, letter, 0);
if(g_ret == false) {
/*Add warning if the dsc is not found*/
LV_LOG_WARN("lv_draw_letter: glyph dsc. not found for U+%" LV_PRIX32, letter);
}
}
else {
/*If the glyph dsc is set then use it*/
g = *dsc->g;
}
/*Don't draw anything if the character is empty. E.g. space*/
if((g.box_h == 0) || (g.box_w == 0)) {
LV_PROFILER_DRAW_END;
return;
goto exit;
}
lv_area_t letter_coords;
@ -592,8 +617,7 @@ void lv_draw_unit_draw_letter(lv_draw_task_t * t, lv_draw_glyph_dsc_t * dsc, co
if(lv_area_is_out(&letter_coords, &t->clip_area, 0) &&
dsc->bg_coords &&
lv_area_is_out(dsc->bg_coords, &t->clip_area, 0)) {
LV_PROFILER_DRAW_END;
return;
goto exit;
}
if(g.resolved_font) {
@ -617,8 +641,7 @@ void lv_draw_unit_draw_letter(lv_draw_task_t * t, lv_draw_glyph_dsc_t * dsc, co
if(g.format == LV_FONT_GLYPH_FORMAT_VECTOR) {
/*Load the outline of the glyph, even if the function says bitmap*/
g.outline_stroke_width = dsc->outline_stroke_width;
dsc->glyph_data = (void *) lv_font_get_glyph_bitmap(&g, draw_buf);
dsc->glyph_data = (void *) lv_font_get_glyph_bitmap(dsc->g, draw_buf);
dsc->format = dsc->glyph_data ? g.format : LV_FONT_GLYPH_FORMAT_NONE;
}
}
@ -627,10 +650,14 @@ void lv_draw_unit_draw_letter(lv_draw_task_t * t, lv_draw_glyph_dsc_t * dsc, co
}
dsc->letter_coords = &letter_coords;
dsc->g = &g;
cb(t, dsc, NULL, NULL);
lv_font_glyph_release_draw_data(&g);
lv_font_glyph_release_draw_data(dsc->g);
exit:
if(dsc->g == &g) {
/* If the glyph was created locally, we don't need to keep it */
dsc->g = NULL;
}
LV_PROFILER_DRAW_END;
}

View File

@ -74,16 +74,19 @@ typedef struct {
/**The number of characters to render. 0: means render until reaching the `\0` termination.*/
uint32_t text_length;
/**Opacity of the text in 0...255 range.
* LV_OPA_TRANSP, LV_OPA_10, LV_OPA_20, .. LV_OPA_COVER can be used as well*/
lv_opa_t opa;
/**The alignment of the text `LV_TEXT_ALIGN_LEFT/RIGHT/CENTER`*/
lv_text_align_t align;
/**The base direction. Used when type setting Right-to-left (e.g. Arabic) texts*/
lv_base_dir_t bidi_dir;
/**Opacity of the text in 0...255 range.
* LV_OPA_TRANSP, LV_OPA_10, LV_OPA_20, .. LV_OPA_COVER can be used as well*/
lv_opa_t opa;
/**Letter outline stroke opacity */
lv_opa_t outline_stroke_opa;
/**Text decoration, e.g. underline*/
lv_text_decor_t decor : 3;
@ -105,7 +108,6 @@ typedef struct {
lv_draw_label_hint_t * hint;
/* Properties of the letter outlines */
lv_opa_t outline_stroke_opa;
lv_color_t outline_stroke_color;
int32_t outline_stroke_width;
@ -127,7 +129,7 @@ typedef struct {
lv_opa_t opa;
lv_text_decor_t decor : 3;
lv_blend_mode_t blend_mode : 3;
lv_blend_mode_t blend_mode : 4;
/* Properties of the letter outlines */
lv_opa_t outline_stroke_opa;

View File

@ -19,7 +19,7 @@ extern "C" {
*********************/
#include "lv_draw.h"
#include "../osal/lv_os.h"
#include "../osal/lv_os_private.h"
#include "../misc/cache/lv_cache.h"
/*********************
@ -68,6 +68,9 @@ struct _lv_draw_task_t {
void * draw_dsc;
/** Opacity of the layer */
lv_opa_t opa;
/**
* The ID of the draw_unit which should take this task
*/
@ -171,6 +174,12 @@ struct _lv_draw_unit_t {
* @return
*/
int32_t (*delete_cb)(lv_draw_unit_t * draw_unit);
/**
* Called when an event is sent to the draw unit.
* @param event pointer to the event descriptor
*/
void (*event_cb)(lv_event_t * event);
};
typedef struct {

View File

@ -10,6 +10,7 @@
#include "lv_draw_private.h"
#include "../core/lv_obj.h"
#include "../misc/lv_assert.h"
#include "../misc/lv_text_private.h"
#include "../core/lv_obj_event.h"
#include "../stdlib/lv_string.h"
@ -266,6 +267,7 @@ void lv_draw_rect(lv_layer_t * layer, const lv_draw_rect_dsc_t * dsc, const lv_a
bg_image_dsc->recolor = dsc->bg_image_recolor;
bg_image_dsc->recolor_opa = dsc->bg_image_recolor_opa;
bg_image_dsc->tile = dsc->bg_image_tiled;
bg_image_dsc->colorkey = dsc->bg_image_colorkey;
bg_image_dsc->header = header;
bg_image_dsc->clip_radius = dsc->radius;
bg_image_dsc->image_area = *coords;
@ -273,7 +275,14 @@ void lv_draw_rect(lv_layer_t * layer, const lv_draw_rect_dsc_t * dsc, const lv_a
}
else {
lv_point_t s;
lv_text_get_size(&s, dsc->bg_image_src, dsc->bg_image_symbol_font, 0, 0, LV_COORD_MAX, LV_TEXT_FLAG_NONE);
lv_text_attributes_t attributes = {0};
attributes.text_flags = LV_TEXT_FLAG_NONE;
attributes.max_width = LV_COORD_MAX;
attributes.line_space = 0;
attributes.letter_space = 0;
lv_text_get_size_attributes(&s, dsc->bg_image_src, dsc->bg_image_symbol_font, &attributes);
lv_area_t a = {0, 0, s.x - 1, s.y - 1};
lv_area_align(coords, &a, LV_ALIGN_CENTER, 0, 0);

View File

@ -33,11 +33,6 @@ typedef struct {
int32_t radius;
/*Background*/
lv_opa_t bg_opa;
lv_color_t bg_color; /**< First element of a gradient is a color, so it maps well here*/
lv_grad_dsc_t bg_grad;
/*Background img*/
const void * bg_image_src;
const void * bg_image_symbol_font;
@ -45,11 +40,24 @@ typedef struct {
lv_opa_t bg_image_opa;
lv_opa_t bg_image_recolor_opa;
uint8_t bg_image_tiled;
/*Background*/
lv_opa_t bg_opa;
/*Border*/
lv_opa_t border_opa;
/*Outline */
lv_opa_t outline_opa;
/*Shadow*/
lv_opa_t shadow_opa;
/*Background*/
lv_color_t bg_color; /**< First element of a gradient is a color, so it maps well here*/
lv_grad_dsc_t bg_grad;
const lv_image_colorkey_t * bg_image_colorkey;
/*Border*/
lv_color_t border_color;
int32_t border_width;
lv_opa_t border_opa;
lv_border_side_t border_side : 5;
uint8_t border_post : 1; /*The border will be drawn later*/
@ -57,7 +65,6 @@ typedef struct {
lv_color_t outline_color;
int32_t outline_width;
int32_t outline_pad;
lv_opa_t outline_opa;
/*Shadow*/
lv_color_t shadow_color;
@ -65,7 +72,6 @@ typedef struct {
int32_t shadow_offset_x;
int32_t shadow_offset_y;
int32_t shadow_spread;
lv_opa_t shadow_opa;
} lv_draw_rect_dsc_t;
typedef struct {
@ -116,7 +122,7 @@ typedef struct {
/**Radius, LV_RADIUS_CIRCLE for max. radius */
int32_t radius;
/**Color of the the shadow */
/**Color of shadow */
lv_color_t color;
/**Width of the shadow. (radius of the blur)*/

View File

@ -12,12 +12,17 @@
#if LV_USE_VECTOR_GRAPHIC
#if !((LV_USE_DRAW_SW && LV_USE_THORVG) || LV_USE_DRAW_VG_LITE || (LV_USE_NEMA_GFX && LV_USE_NEMA_VG))
#error "LV_USE_VECTOR_GRAPHIC requires (LV_USE_DRAW_SW and LV_USE_THORVG) or LV_USE_DRAW_VG_LITE or (LV_USE_NEMA_GFX and LV_USE_NEMA_VG)"
#endif
#include "../misc/lv_ll.h"
#include "../misc/lv_types.h"
#include "../stdlib/lv_string.h"
#include <math.h>
#include <float.h>
#define EPSILON 1e-6f
#define MATH_PI 3.14159265358979323846f
#define MATH_HALF_PI 1.57079632679489661923f
@ -49,16 +54,11 @@
* TYPEDEFS
**********************/
typedef struct {
lv_vector_path_t * path;
lv_vector_draw_dsc_t dsc;
} lv_vector_draw_task;
/**********************
* STATIC PROTOTYPES
**********************/
static void _copy_draw_dsc(lv_vector_draw_dsc_t * dst, const lv_vector_draw_dsc_t * src)
static void _copy_draw_dsc(lv_vector_path_ctx_t * dst, const lv_vector_path_ctx_t * src)
{
lv_memcpy(&(dst->fill_dsc), &(src->fill_dsc), sizeof(lv_vector_fill_dsc_t));
@ -70,11 +70,6 @@ static void _copy_draw_dsc(lv_vector_draw_dsc_t * dst, const lv_vector_draw_dsc_
dst->stroke_dsc.join = src->stroke_dsc.join;
dst->stroke_dsc.miter_limit = src->stroke_dsc.miter_limit;
lv_array_copy(&(dst->stroke_dsc.dash_pattern), &(src->stroke_dsc.dash_pattern));
dst->stroke_dsc.gradient.style = src->stroke_dsc.gradient.style;
dst->stroke_dsc.gradient.cx = src->stroke_dsc.gradient.cx;
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), &(src->stroke_dsc.gradient), sizeof(lv_vector_gradient_t));
lv_memcpy(&(dst->stroke_dsc.matrix), &(src->stroke_dsc.matrix), sizeof(lv_matrix_t));
@ -82,6 +77,8 @@ static void _copy_draw_dsc(lv_vector_draw_dsc_t * dst, const lv_vector_draw_dsc_
lv_memcpy(&(dst->matrix), &(src->matrix), sizeof(lv_matrix_t));
lv_area_copy(&(dst->scissor_area), &(src->scissor_area));
}
/**********************
* GLOBAL FUNCTIONS
**********************/
@ -91,8 +88,8 @@ void lv_matrix_transform_point(const lv_matrix_t * matrix, lv_fpoint_t * point)
float x = point->x;
float y = point->y;
point->x = x * matrix->m[0][0] + y * matrix->m[1][0] + matrix->m[0][2];
point->y = x * matrix->m[0][1] + y * matrix->m[1][1] + matrix->m[1][2];
point->x = x * matrix->m[0][0] + y * matrix->m[0][1] + matrix->m[0][2];
point->y = x * matrix->m[1][0] + y * matrix->m[1][1] + matrix->m[1][2];
}
void lv_matrix_transform_path(const lv_matrix_t * matrix, lv_vector_path_t * path)
@ -191,6 +188,162 @@ void lv_vector_path_cubic_to(lv_vector_path_t * path, const lv_fpoint_t * p1, co
lv_array_push_back(&path->points, p3);
}
static lv_fpoint_t _point_on_ellipse(float rx, float ry, float cos_r, float sin_r,
float cx, float cy, float theta, float alpha)
{
float cos_theta = cosf(theta);
float sin_theta = sinf(theta);
float x = rx * cos_theta;
float y = ry * sin_theta;
float x_rot = cos_r * x - sin_r * y;
float y_rot = sin_r * x + cos_r * y;
if(fabsf(alpha) > EPSILON) {
float dx = -rx * sin_theta;
float dy = ry * cos_theta;
float dx_rot = cos_r * dx - sin_r * dy;
float dy_rot = sin_r * dx + cos_r * dy;
x_rot += alpha * dx_rot;
y_rot += alpha * dy_rot;
}
return (lv_fpoint_t) {
x_rot + cx, y_rot + cy
};
}
void lv_vector_path_arc_to(lv_vector_path_t * path, float rx, float ry, float rotate_angle, bool large_arc,
bool clockwise, const lv_fpoint_t * p)
{
LV_ASSERT_NULL(path);
LV_ASSERT_NULL(p);
if(lv_array_is_empty(&path->ops)) {
/*first op must be move_to*/
return;
}
if(rx <= 0 || ry <= 0) {
/*no needed to draw*/
return;
}
/*https://www.w3.org/TR/SVG/implnote.html#ArcImplementationNotes*/
lv_fpoint_t * cpt = lv_array_back(&path->points);
float x0 = cpt->x;
float y0 = cpt->y;
/*1. dealing with degradation*/
if(fabsf(x0 - p->x) < EPSILON && fabsf(y0 - p->y) < EPSILON) {
/*same point*/
return;
}
float rotate = MATH_RADIANS(rotate_angle);
float sin_r = sinf(rotate);
float cos_r = cosf(rotate);
/*2. transform point*/
float dx = (x0 - p->x) * 0.5f;
float dy = (y0 - p->y) * 0.5f;
float x1 = cos_r * dx + sin_r * dy;
float y1 = -sin_r * dx + cos_r * dy;
/*3. adjust radius*/
float lambda_val = (x1 * x1) / (rx * rx) + (y1 * y1) / (ry * ry);
if(lambda_val > 1.0f) {
rx *= sqrtf(lambda_val);
ry *= sqrtf(lambda_val);
}
/*4. calc center point*/
float rx_sq = rx * rx;
float ry_sq = ry * ry;
float x1_sq = x1 * x1;
float y1_sq = y1 * y1;
float num = rx_sq * ry_sq - rx_sq * y1_sq - ry_sq * x1_sq;
float denom = rx_sq * y1_sq + ry_sq * x1_sq;
float radicand = (denom > EPSILON) ? num / denom : 0.0f;
if(radicand < 0.0f) radicand = 0.0f;
float sign = (large_arc == clockwise) ? -1.0f : 1.0f;
float coef = sign * sqrtf(radicand);
float cx_prime = (coef * rx * y1) / ry;
float cy_prime = -(coef * ry * x1) / rx;
float cx = cos_r * cx_prime - sin_r * cy_prime + (x0 + p->x) * 0.5f;
float cy = sin_r * cx_prime + cos_r * cy_prime + (y0 + p->y) * 0.5f;
float ux = (x1 - cx_prime) / rx;
float uy = (y1 - cy_prime) / ry;
/*5. calculate the starting angle and ending angle*/
float n_sq = ux * ux + uy * uy;
float theta1 = 0.0f;
if(n_sq > EPSILON) {
theta1 = atan2f(uy, ux);
}
float vx = (-x1 - cx_prime) / rx;
float vy = (-y1 - cy_prime) / ry;
float n = sqrtf(n_sq * (vx * vx + vy * vy));
float delta = 0.0f;
if(n > EPSILON) {
float cos_delta = (ux * vx + uy * vy) / n;
if(cos_delta > 1.0f) cos_delta = 1.0f;
else if(cos_delta < -1.0f) cos_delta = -1.0f;
delta = acosf(cos_delta);
if(ux * vy - uy * vx < 0.0f) delta = -delta;
}
if(!clockwise && delta > 0.0f) {
delta -= 2.0f * MATH_PI;
}
else if(clockwise && delta < 0.0f) {
delta += 2.0f * MATH_PI;
}
/*6. split arc into segments within 90 degrees*/
float angle_left = fabsf(delta);
int seg_count = (int)ceilf(angle_left / MATH_HALF_PI);
if(seg_count == 0) seg_count = 1;
float segment_angle = delta / (float)seg_count;
float current_angle = theta1;
for(int i = 0; i < seg_count; i++) {
float next_angle = current_angle + segment_angle;
float alpha_val;
if(fabsf(segment_angle) < 0.1f) {
alpha_val = segment_angle / 6.0f;
}
else {
float tan_half = tanf(segment_angle * 0.5f);
alpha_val = sinf(segment_angle) * (sqrtf(4.0f + 3.0f * tan_half * tan_half) - 1.0f) / 3.0f;
}
lv_fpoint_t p1 = _point_on_ellipse(rx, ry, cos_r, sin_r, cx, cy, current_angle, alpha_val);
lv_fpoint_t p2 = _point_on_ellipse(rx, ry, cos_r, sin_r, cx, cy, next_angle, -alpha_val);
lv_fpoint_t p3 = _point_on_ellipse(rx, ry, cos_r, sin_r, cx, cy, next_angle, 0.0f);
lv_vector_path_cubic_to(path, &p1, &p2, &p3);
current_angle = next_angle;
}
}
void lv_vector_path_close(lv_vector_path_t * path)
{
if(lv_array_is_empty(&path->ops)) {
@ -234,12 +387,9 @@ void lv_vector_path_get_bounding(const lv_vector_path_t * path, lv_area_t * area
area->y2 = lroundf(y2);
}
void lv_vector_path_append_rect(lv_vector_path_t * path, const lv_area_t * rect, float rx, float ry)
void lv_vector_path_append_rectangle(lv_vector_path_t * path, float x, float y, float w, float h, float rx, float ry)
{
float x = rect->x1;
float y = rect->y1;
float w = (float)lv_area_get_width(rect);
float h = (float)lv_area_get_height(rect);
if(w <= 0.0f || h <= 0.0f) return;
float hw = w * 0.5f;
float hh = h * 0.5f;
@ -247,7 +397,7 @@ void lv_vector_path_append_rect(lv_vector_path_t * path, const lv_area_t * rect,
if(rx > hw) rx = hw;
if(ry > hh) ry = hh;
if(rx == 0 && ry == 0) {
if(rx <= 0.0f && ry <= 0.0f) {
lv_fpoint_t pt = {x, y};
lv_vector_path_move_to(path, &pt);
pt.x += w;
@ -257,12 +407,15 @@ void lv_vector_path_append_rect(lv_vector_path_t * path, const lv_area_t * rect,
pt.x -= w;
lv_vector_path_line_to(path, &pt);
lv_vector_path_close(path);
return;
}
else if(rx == hw && ry == hh) {
lv_fpoint_t pt = {x + w * 0.5f, y + h * 0.5f};
if(rx == hw && ry == hh) {
lv_fpoint_t pt = {x + hw, y + hh};
lv_vector_path_append_circle(path, &pt, rx, ry);
return;
}
else {
float hrx = rx * 0.5f;
float hry = ry * 0.5f;
lv_fpoint_t pt, pt2, pt3;
@ -318,9 +471,9 @@ void lv_vector_path_append_rect(lv_vector_path_t * path, const lv_area_t * rect,
pt3.x = x + rx;
pt3.y = y;
lv_vector_path_cubic_to(path, &pt, &pt2, &pt3);
lv_vector_path_close(path);
}
}
void lv_vector_path_append_circle(lv_vector_path_t * path, const lv_fpoint_t * c, float rx, float ry)
{
@ -471,22 +624,33 @@ void lv_vector_path_append_path(lv_vector_path_t * path, const lv_vector_path_t
/* draw dsc functions */
lv_vector_dsc_t * lv_vector_dsc_create(lv_layer_t * layer)
lv_draw_vector_dsc_t * lv_draw_vector_dsc_create(lv_layer_t * layer)
{
lv_vector_dsc_t * dsc = lv_malloc(sizeof(lv_vector_dsc_t));
lv_draw_vector_dsc_t * dsc = lv_zalloc(sizeof(lv_draw_vector_dsc_t));
LV_ASSERT_MALLOC(dsc);
lv_memzero(dsc, sizeof(lv_vector_dsc_t));
if(dsc == NULL) {
LV_LOG_WARN("Couldn't allocate lv_draw_vector_dsc_t");
return NULL;
}
dsc->layer = layer;
dsc->base.layer = layer;
lv_vector_fill_dsc_t * fill_dsc = &(dsc->current_dsc.fill_dsc);
dsc->ctx = lv_zalloc(sizeof(lv_vector_path_ctx_t));
if(dsc->ctx == NULL) {
LV_LOG_WARN("Couldn't allocate vector path context");
lv_free(dsc);
return NULL;
}
lv_vector_fill_dsc_t * fill_dsc = &(dsc->ctx->fill_dsc);
fill_dsc->style = LV_VECTOR_DRAW_STYLE_SOLID;
fill_dsc->color = lv_color_to_32(lv_color_black(), 0xFF);
fill_dsc->opa = LV_OPA_COVER;
fill_dsc->fill_rule = LV_VECTOR_FILL_NONZERO;
lv_matrix_identity(&(fill_dsc->matrix)); /*identity matrix*/
lv_vector_stroke_dsc_t * stroke_dsc = &(dsc->current_dsc.stroke_dsc);
lv_vector_stroke_dsc_t * stroke_dsc = &(dsc->ctx->stroke_dsc);
stroke_dsc->style = LV_VECTOR_DRAW_STYLE_SOLID;
stroke_dsc->color = lv_color_to_32(lv_color_black(), 0xFF);
stroke_dsc->opa = LV_OPA_0; /*default no stroke*/
@ -496,92 +660,93 @@ lv_vector_dsc_t * lv_vector_dsc_create(lv_layer_t * layer)
stroke_dsc->miter_limit = 4.0f;
lv_matrix_identity(&(stroke_dsc->matrix)); /*identity matrix*/
dsc->current_dsc.blend_mode = LV_VECTOR_BLEND_SRC_OVER;
dsc->current_dsc.scissor_area = layer->_clip_area;
lv_matrix_identity(&(dsc->current_dsc.matrix)); /*identity matrix*/
dsc->tasks.task_list = NULL;
dsc->ctx->blend_mode = LV_VECTOR_BLEND_SRC_OVER;
dsc->ctx->scissor_area = layer->_clip_area;
lv_matrix_identity(&(dsc->ctx->matrix)); /*identity matrix*/
dsc->task_list = NULL;
return dsc;
}
void lv_vector_dsc_delete(lv_vector_dsc_t * dsc)
void lv_draw_vector_dsc_delete(lv_draw_vector_dsc_t * dsc)
{
if(dsc->tasks.task_list) {
lv_ll_t * task_list = dsc->tasks.task_list;
if(dsc->task_list) {
lv_ll_t * task_list = dsc->task_list;
lv_vector_for_each_destroy_tasks(task_list, NULL, NULL);
dsc->tasks.task_list = NULL;
dsc->task_list = NULL;
}
lv_array_deinit(&(dsc->current_dsc.stroke_dsc.dash_pattern));
lv_array_deinit(&(dsc->ctx->stroke_dsc.dash_pattern));
lv_free(dsc->ctx);
lv_free(dsc);
}
void lv_vector_dsc_set_blend_mode(lv_vector_dsc_t * dsc, lv_vector_blend_t blend)
void lv_draw_vector_dsc_set_blend_mode(lv_draw_vector_dsc_t * dsc, lv_vector_blend_t blend)
{
dsc->current_dsc.blend_mode = blend;
dsc->ctx->blend_mode = blend;
}
void lv_vector_dsc_set_transform(lv_vector_dsc_t * dsc, const lv_matrix_t * matrix)
void lv_draw_vector_dsc_set_transform(lv_draw_vector_dsc_t * dsc, const lv_matrix_t * matrix)
{
lv_memcpy(&(dsc->current_dsc.matrix), matrix, sizeof(lv_matrix_t));
lv_memcpy(&(dsc->ctx->matrix), matrix, sizeof(lv_matrix_t));
}
void lv_vector_dsc_set_fill_color(lv_vector_dsc_t * dsc, lv_color_t color)
void lv_draw_vector_dsc_set_fill_color(lv_draw_vector_dsc_t * dsc, lv_color_t color)
{
dsc->current_dsc.fill_dsc.style = LV_VECTOR_DRAW_STYLE_SOLID;
dsc->current_dsc.fill_dsc.color = lv_color_to_32(color, 0xFF);
dsc->ctx->fill_dsc.style = LV_VECTOR_DRAW_STYLE_SOLID;
dsc->ctx->fill_dsc.color = lv_color_to_32(color, 0xFF);
}
void lv_vector_dsc_set_fill_color32(lv_vector_dsc_t * dsc, lv_color32_t color)
void lv_draw_vector_dsc_set_fill_color32(lv_draw_vector_dsc_t * dsc, lv_color32_t color)
{
dsc->current_dsc.fill_dsc.style = LV_VECTOR_DRAW_STYLE_SOLID;
dsc->current_dsc.fill_dsc.color = color;
dsc->ctx->fill_dsc.style = LV_VECTOR_DRAW_STYLE_SOLID;
dsc->ctx->fill_dsc.color = color;
}
void lv_vector_dsc_set_fill_opa(lv_vector_dsc_t * dsc, lv_opa_t opa)
void lv_draw_vector_dsc_set_fill_opa(lv_draw_vector_dsc_t * dsc, lv_opa_t opa)
{
dsc->current_dsc.fill_dsc.opa = opa;
dsc->ctx->fill_dsc.opa = opa;
}
void lv_vector_dsc_set_fill_rule(lv_vector_dsc_t * dsc, lv_vector_fill_t rule)
void lv_draw_vector_dsc_set_fill_rule(lv_draw_vector_dsc_t * dsc, lv_vector_fill_t rule)
{
dsc->current_dsc.fill_dsc.fill_rule = rule;
dsc->ctx->fill_dsc.fill_rule = rule;
}
void lv_vector_dsc_set_fill_units(lv_vector_dsc_t * dsc, const lv_vector_fill_units_t units)
void lv_draw_vector_dsc_set_fill_units(lv_draw_vector_dsc_t * dsc, const lv_vector_fill_units_t units)
{
dsc->current_dsc.fill_dsc.fill_units = units;
dsc->ctx->fill_dsc.fill_units = units;
}
void lv_vector_dsc_set_fill_image(lv_vector_dsc_t * dsc, const lv_draw_image_dsc_t * img_dsc)
void lv_draw_vector_dsc_set_fill_image(lv_draw_vector_dsc_t * dsc, const lv_draw_image_dsc_t * img_dsc)
{
dsc->current_dsc.fill_dsc.style = LV_VECTOR_DRAW_STYLE_PATTERN;
lv_memcpy(&(dsc->current_dsc.fill_dsc.img_dsc), img_dsc, sizeof(lv_draw_image_dsc_t));
dsc->ctx->fill_dsc.style = LV_VECTOR_DRAW_STYLE_PATTERN;
lv_memcpy(&(dsc->ctx->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, float x1, float y1, float x2, float y2)
void lv_draw_vector_dsc_set_fill_linear_gradient(lv_draw_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.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;
dsc->ctx->fill_dsc.style = LV_VECTOR_DRAW_STYLE_GRADIENT;
dsc->ctx->fill_dsc.gradient.style = LV_VECTOR_GRADIENT_STYLE_LINEAR;
dsc->ctx->fill_dsc.gradient.x1 = x1;
dsc->ctx->fill_dsc.gradient.y1 = y1;
dsc->ctx->fill_dsc.gradient.x2 = x2;
dsc->ctx->fill_dsc.gradient.y2 = y2;
}
void lv_vector_dsc_set_fill_radial_gradient(lv_vector_dsc_t * dsc, float cx, float cy, float radius)
void lv_draw_vector_dsc_set_fill_radial_gradient(lv_draw_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;
dsc->ctx->fill_dsc.style = LV_VECTOR_DRAW_STYLE_GRADIENT;
dsc->ctx->fill_dsc.gradient.style = LV_VECTOR_GRADIENT_STYLE_RADIAL;
dsc->ctx->fill_dsc.gradient.cx = cx;
dsc->ctx->fill_dsc.gradient.cy = cy;
dsc->ctx->fill_dsc.gradient.cr = radius;
}
void lv_vector_dsc_set_fill_gradient_spread(lv_vector_dsc_t * dsc, lv_vector_gradient_spread_t spread)
void lv_draw_vector_dsc_set_fill_gradient_spread(lv_draw_vector_dsc_t * dsc, lv_vector_gradient_spread_t spread)
{
dsc->current_dsc.fill_dsc.gradient.spread = spread;
dsc->ctx->fill_dsc.gradient.spread = spread;
}
void lv_vector_dsc_set_fill_gradient_color_stops(lv_vector_dsc_t * dsc, const lv_grad_stop_t * stops,
void lv_draw_vector_dsc_set_fill_gradient_color_stops(lv_draw_vector_dsc_t * dsc, const lv_grad_stop_t * stops,
uint16_t count)
{
if(count > LV_GRADIENT_MAX_STOPS) {
@ -589,45 +754,45 @@ void lv_vector_dsc_set_fill_gradient_color_stops(lv_vector_dsc_t * dsc, const lv
count = LV_GRADIENT_MAX_STOPS;
}
lv_memcpy(&(dsc->current_dsc.fill_dsc.gradient.stops), stops, sizeof(lv_grad_stop_t) * count);
dsc->current_dsc.fill_dsc.gradient.stops_count = count;
lv_memcpy(&(dsc->ctx->fill_dsc.gradient.stops), stops, sizeof(lv_grad_stop_t) * count);
dsc->ctx->fill_dsc.gradient.stops_count = count;
}
void lv_vector_dsc_set_fill_transform(lv_vector_dsc_t * dsc, const lv_matrix_t * matrix)
void lv_draw_vector_dsc_set_fill_transform(lv_draw_vector_dsc_t * dsc, const lv_matrix_t * matrix)
{
lv_memcpy(&(dsc->current_dsc.fill_dsc.matrix), matrix, sizeof(lv_matrix_t));
lv_memcpy(&(dsc->ctx->fill_dsc.matrix), matrix, sizeof(lv_matrix_t));
}
void lv_vector_dsc_set_stroke_transform(lv_vector_dsc_t * dsc, const lv_matrix_t * matrix)
void lv_draw_vector_dsc_set_stroke_transform(lv_draw_vector_dsc_t * dsc, const lv_matrix_t * matrix)
{
lv_memcpy(&(dsc->current_dsc.stroke_dsc.matrix), matrix, sizeof(lv_matrix_t));
lv_memcpy(&(dsc->ctx->stroke_dsc.matrix), matrix, sizeof(lv_matrix_t));
}
void lv_vector_dsc_set_stroke_color32(lv_vector_dsc_t * dsc, lv_color32_t color)
void lv_draw_vector_dsc_set_stroke_color32(lv_draw_vector_dsc_t * dsc, lv_color32_t color)
{
dsc->current_dsc.stroke_dsc.style = LV_VECTOR_DRAW_STYLE_SOLID;
dsc->current_dsc.stroke_dsc.color = color;
dsc->ctx->stroke_dsc.style = LV_VECTOR_DRAW_STYLE_SOLID;
dsc->ctx->stroke_dsc.color = color;
}
void lv_vector_dsc_set_stroke_color(lv_vector_dsc_t * dsc, lv_color_t color)
void lv_draw_vector_dsc_set_stroke_color(lv_draw_vector_dsc_t * dsc, lv_color_t color)
{
dsc->current_dsc.stroke_dsc.style = LV_VECTOR_DRAW_STYLE_SOLID;
dsc->current_dsc.stroke_dsc.color = lv_color_to_32(color, 0xFF);
dsc->ctx->stroke_dsc.style = LV_VECTOR_DRAW_STYLE_SOLID;
dsc->ctx->stroke_dsc.color = lv_color_to_32(color, 0xFF);
}
void lv_vector_dsc_set_stroke_opa(lv_vector_dsc_t * dsc, lv_opa_t opa)
void lv_draw_vector_dsc_set_stroke_opa(lv_draw_vector_dsc_t * dsc, lv_opa_t opa)
{
dsc->current_dsc.stroke_dsc.opa = opa;
dsc->ctx->stroke_dsc.opa = opa;
}
void lv_vector_dsc_set_stroke_width(lv_vector_dsc_t * dsc, float width)
void lv_draw_vector_dsc_set_stroke_width(lv_draw_vector_dsc_t * dsc, float width)
{
dsc->current_dsc.stroke_dsc.width = width;
dsc->ctx->stroke_dsc.width = width;
}
void lv_vector_dsc_set_stroke_dash(lv_vector_dsc_t * dsc, float * dash_pattern, uint16_t dash_count)
void lv_draw_vector_dsc_set_stroke_dash(lv_draw_vector_dsc_t * dsc, float * dash_pattern, uint16_t dash_count)
{
lv_array_t * dash_array = &(dsc->current_dsc.stroke_dsc.dash_pattern);
lv_array_t * dash_array = &(dsc->ctx->stroke_dsc.dash_pattern);
if(dash_pattern) {
lv_array_clear(dash_array);
if(lv_array_capacity(dash_array) == 0) {
@ -645,46 +810,46 @@ void lv_vector_dsc_set_stroke_dash(lv_vector_dsc_t * dsc, float * dash_pattern,
}
}
void lv_vector_dsc_set_stroke_cap(lv_vector_dsc_t * dsc, lv_vector_stroke_cap_t cap)
void lv_draw_vector_dsc_set_stroke_cap(lv_draw_vector_dsc_t * dsc, lv_vector_stroke_cap_t cap)
{
dsc->current_dsc.stroke_dsc.cap = cap;
dsc->ctx->stroke_dsc.cap = cap;
}
void lv_vector_dsc_set_stroke_join(lv_vector_dsc_t * dsc, lv_vector_stroke_join_t join)
void lv_draw_vector_dsc_set_stroke_join(lv_draw_vector_dsc_t * dsc, lv_vector_stroke_join_t join)
{
dsc->current_dsc.stroke_dsc.join = join;
dsc->ctx->stroke_dsc.join = join;
}
void lv_vector_dsc_set_stroke_miter_limit(lv_vector_dsc_t * dsc, uint16_t miter_limit)
void lv_draw_vector_dsc_set_stroke_miter_limit(lv_draw_vector_dsc_t * dsc, uint16_t miter_limit)
{
dsc->current_dsc.stroke_dsc.miter_limit = miter_limit;
dsc->ctx->stroke_dsc.miter_limit = miter_limit;
}
void lv_vector_dsc_set_stroke_linear_gradient(lv_vector_dsc_t * dsc, float x1, float y1, float x2, float y2)
void lv_draw_vector_dsc_set_stroke_linear_gradient(lv_draw_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.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;
dsc->ctx->stroke_dsc.style = LV_VECTOR_DRAW_STYLE_GRADIENT;
dsc->ctx->stroke_dsc.gradient.style = LV_VECTOR_GRADIENT_STYLE_LINEAR;
dsc->ctx->stroke_dsc.gradient.x1 = x1;
dsc->ctx->stroke_dsc.gradient.y1 = y1;
dsc->ctx->stroke_dsc.gradient.x2 = x2;
dsc->ctx->stroke_dsc.gradient.y2 = y2;
}
void lv_vector_dsc_set_stroke_radial_gradient(lv_vector_dsc_t * dsc, float cx, float cy, float radius)
void lv_draw_vector_dsc_set_stroke_radial_gradient(lv_draw_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;
dsc->ctx->stroke_dsc.style = LV_VECTOR_DRAW_STYLE_GRADIENT;
dsc->ctx->stroke_dsc.gradient.style = LV_VECTOR_GRADIENT_STYLE_RADIAL;
dsc->ctx->stroke_dsc.gradient.cx = cx;
dsc->ctx->stroke_dsc.gradient.cy = cy;
dsc->ctx->stroke_dsc.gradient.cr = radius;
}
void lv_vector_dsc_set_stroke_gradient_spread(lv_vector_dsc_t * dsc, lv_vector_gradient_spread_t spread)
void lv_draw_vector_dsc_set_stroke_gradient_spread(lv_draw_vector_dsc_t * dsc, lv_vector_gradient_spread_t spread)
{
dsc->current_dsc.stroke_dsc.gradient.spread = spread;
dsc->ctx->stroke_dsc.gradient.spread = spread;
}
void lv_vector_dsc_set_stroke_gradient_color_stops(lv_vector_dsc_t * dsc, const lv_grad_stop_t * stops,
void lv_draw_vector_dsc_set_stroke_gradient_color_stops(lv_draw_vector_dsc_t * dsc, const lv_grad_stop_t * stops,
uint16_t count)
{
if(count > LV_GRADIENT_MAX_STOPS) {
@ -692,43 +857,43 @@ void lv_vector_dsc_set_stroke_gradient_color_stops(lv_vector_dsc_t * dsc, const
count = LV_GRADIENT_MAX_STOPS;
}
lv_memcpy(&(dsc->current_dsc.stroke_dsc.gradient.stops), stops, sizeof(lv_grad_stop_t) * count);
dsc->current_dsc.stroke_dsc.gradient.stops_count = count;
lv_memcpy(&(dsc->ctx->stroke_dsc.gradient.stops), stops, sizeof(lv_grad_stop_t) * count);
dsc->ctx->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)
void lv_draw_vector_dsc_add_path(lv_draw_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->base.layer->_clip_area), &(dsc->ctx->scissor_area))) {
return;
}
if(dsc->current_dsc.fill_dsc.opa == 0
&& dsc->current_dsc.stroke_dsc.opa == 0) {
if(dsc->ctx->fill_dsc.opa == 0
&& dsc->ctx->stroke_dsc.opa == 0) {
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));
if(!dsc->task_list) {
dsc->task_list = lv_malloc(sizeof(lv_ll_t));
LV_ASSERT_MALLOC(dsc->task_list);
lv_ll_init(dsc->task_list, sizeof(lv_draw_vector_subtask_t));
}
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_draw_vector_subtask_t * new_task = (lv_draw_vector_subtask_t *)lv_ll_ins_tail(dsc->task_list);
lv_memset(new_task, 0, sizeof(lv_draw_vector_subtask_t));
new_task->path = lv_vector_path_create(0);
_copy_draw_dsc(&(new_task->dsc), &(dsc->current_dsc));
_copy_draw_dsc(&(new_task->ctx), dsc->ctx);
lv_vector_path_copy(new_task->path, path);
new_task->dsc.scissor_area = rect;
new_task->ctx.scissor_area = rect;
}
void lv_vector_clear_area(lv_vector_dsc_t * dsc, const lv_area_t * rect)
void lv_draw_vector_dsc_clear_area(lv_draw_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->base.layer->_clip_area), &(dsc->ctx->scissor_area))) {
return;
}
@ -737,83 +902,89 @@ void lv_vector_clear_area(lv_vector_dsc_t * dsc, const lv_area_t * rect)
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));
if(!dsc->task_list) {
dsc->task_list = lv_malloc(sizeof(lv_ll_t));
LV_ASSERT_MALLOC(dsc->task_list);
lv_ll_init(dsc->task_list, sizeof(lv_draw_vector_subtask_t));
}
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_draw_vector_subtask_t * new_task = (lv_draw_vector_subtask_t *)lv_ll_ins_tail(dsc->task_list);
lv_memset(new_task, 0, sizeof(lv_draw_vector_subtask_t));
new_task->dsc.fill_dsc.color = dsc->current_dsc.fill_dsc.color;
new_task->dsc.fill_dsc.opa = dsc->current_dsc.fill_dsc.opa;
lv_area_copy(&(new_task->dsc.scissor_area), &final_rect);
new_task->ctx.fill_dsc.color = dsc->ctx->fill_dsc.color;
new_task->ctx.fill_dsc.opa = dsc->ctx->fill_dsc.opa;
lv_area_copy(&(new_task->ctx.scissor_area), &final_rect);
}
void lv_draw_vector(lv_vector_dsc_t * dsc)
void lv_draw_vector(lv_draw_vector_dsc_t * dsc)
{
if(!dsc->tasks.task_list) {
if(!dsc->task_list) {
return;
}
lv_layer_t * layer = dsc->layer;
lv_layer_t * layer = dsc->base.layer;
lv_draw_task_t * t = lv_draw_add_task(layer, &(layer->_clip_area), LV_DRAW_TASK_TYPE_VECTOR);
lv_memcpy(t->draw_dsc, &(dsc->tasks), sizeof(lv_draw_vector_task_dsc_t));
lv_memcpy(t->draw_dsc, dsc, sizeof(lv_draw_vector_dsc_t));
lv_draw_finalize_task_creation(layer, t);
dsc->tasks.task_list = NULL;
dsc->task_list = NULL;
}
/* draw dsc transform */
void lv_vector_dsc_identity(lv_vector_dsc_t * dsc)
void lv_draw_vector_dsc_identity(lv_draw_vector_dsc_t * dsc)
{
lv_matrix_identity(&(dsc->current_dsc.matrix)); /*identity matrix*/
lv_matrix_identity(&(dsc->ctx->matrix)); /*identity matrix*/
}
void lv_vector_dsc_scale(lv_vector_dsc_t * dsc, float scale_x, float scale_y)
void lv_draw_vector_dsc_scale(lv_draw_vector_dsc_t * dsc, float scale_x, float scale_y)
{
lv_matrix_scale(&(dsc->current_dsc.matrix), scale_x, scale_y);
lv_matrix_scale(&(dsc->ctx->matrix), scale_x, scale_y);
}
void lv_vector_dsc_rotate(lv_vector_dsc_t * dsc, float degree)
void lv_draw_vector_dsc_rotate(lv_draw_vector_dsc_t * dsc, float degree)
{
lv_matrix_rotate(&(dsc->current_dsc.matrix), degree);
lv_matrix_rotate(&(dsc->ctx->matrix), degree);
}
void lv_vector_dsc_translate(lv_vector_dsc_t * dsc, float tx, float ty)
void lv_draw_vector_dsc_translate(lv_draw_vector_dsc_t * dsc, float tx, float ty)
{
lv_matrix_translate(&(dsc->current_dsc.matrix), tx, ty);
lv_matrix_translate(&(dsc->ctx->matrix), tx, ty);
}
void lv_vector_dsc_skew(lv_vector_dsc_t * dsc, float skew_x, float skew_y)
void lv_draw_vector_dsc_skew(lv_draw_vector_dsc_t * dsc, float skew_x, float skew_y)
{
lv_matrix_skew(&(dsc->current_dsc.matrix), skew_x, skew_y);
lv_matrix_skew(&(dsc->ctx->matrix), skew_x, skew_y);
}
void lv_vector_for_each_destroy_tasks(lv_ll_t * task_list, vector_draw_task_cb cb, void * data)
{
if(task_list == NULL) return;
lv_vector_draw_task * task = lv_ll_get_head(task_list);
lv_vector_draw_task * next_task = NULL;
lv_draw_vector_subtask_t * task = lv_ll_get_head(task_list);
lv_draw_vector_subtask_t * next_task = NULL;
while(task != NULL) {
next_task = lv_ll_get_next(task_list, task);
lv_ll_remove(task_list, task);
if(cb) {
cb(data, task->path, &(task->dsc));
cb(data, task->path, &task->ctx);
}
if(task->path) {
lv_vector_path_delete(task->path);
}
lv_array_deinit(&(task->dsc.stroke_dsc.dash_pattern));
lv_array_deinit(&(task->ctx.stroke_dsc.dash_pattern));
lv_free(task);
task = next_task;
}
lv_free(task_list);
}
lv_draw_vector_dsc_t * lv_draw_task_get_vector_dsc(lv_draw_task_t * task)
{
return task->type == LV_DRAW_TASK_TYPE_VECTOR ? (lv_draw_vector_dsc_t *)task->draw_dsc : NULL;
}
#endif /* LV_USE_VECTOR_GRAPHIC */

View File

@ -172,6 +172,20 @@ void lv_vector_path_quad_to(lv_vector_path_t * path, const lv_fpoint_t * p1, con
void lv_vector_path_cubic_to(lv_vector_path_t * path, const lv_fpoint_t * p1, const lv_fpoint_t * p2,
const lv_fpoint_t * p3);
/**
* Add ellipse arc to the path from last point to the point
* @param path pointer to a path
* @param radius_x the x radius for ellipse arc
* @param radius_y the y radius for ellipse arc
* @param rotate_angle the rotate angle for arc
* @param large_arc true for large arc, otherwise small
* @param clockwise true for clockwise, otherwise anticlockwise
* @param p pointer to a `lv_fpoint_t` variable for end point
*/
void lv_vector_path_arc_to(lv_vector_path_t * path, float radius_x, float radius_y, float rotate_angle,
bool large_arc,
bool clockwise, const lv_fpoint_t * p);
/**
* Close the sub path
* @param path pointer to a path
@ -186,13 +200,32 @@ void lv_vector_path_close(lv_vector_path_t * path);
void lv_vector_path_get_bounding(const lv_vector_path_t * path, lv_area_t * area);
/**
* Add a rectangle to the path
* Add a rectangle to the path by x/y/w/h. rx/ry are corner radii
* @param path pointer to a path
* @param x the x coordinate of the top-left corner of the rectangle
* @param y the y coordinate of the top-left corner of the rectangle
* @param w the width of the rectangle
* @param h the height of the rectangle
* @param rx the horizontal radius for rounded rectangle
* @param ry the vertical radius for rounded rectangle
*/
void lv_vector_path_append_rectangle(lv_vector_path_t * path, float x, float y, float w, float h, float rx, float ry);
/**
* Add a rectangle to the path (legacy api, recommend use lv_vector_path_append_rectangle instead)
* @param path pointer to a path
* @param rect pointer to a `lv_area_t` variable
* @param rx the horizontal radius for rounded rectangle
* @param ry the vertical radius for rounded rectangle
*/
void lv_vector_path_append_rect(lv_vector_path_t * path, const lv_area_t * rect, float rx, float ry);
static inline void lv_vector_path_append_rect(lv_vector_path_t * path, const lv_area_t * rect, float rx, float ry)
{
LV_ASSERT_NULL(path);
LV_ASSERT_NULL(rect);
lv_vector_path_append_rectangle(path, rect->x1, rect->y1, (float)lv_area_get_width(rect),
(float)lv_area_get_height(rect), rx, ry);
}
/**
* Add a circle to the path
@ -227,272 +260,309 @@ void lv_vector_path_append_path(lv_vector_path_t * path, const lv_vector_path_t
* @param layer pointer to a layer
* @return pointer to the created descriptor
*/
lv_vector_dsc_t * lv_vector_dsc_create(lv_layer_t * layer);
lv_draw_vector_dsc_t * lv_draw_vector_dsc_create(lv_layer_t * layer);
/**
* Delete the vector graphic descriptor
* @param dsc pointer to a vector graphic descriptor
*/
void lv_vector_dsc_delete(lv_vector_dsc_t * dsc);
void lv_draw_vector_dsc_delete(lv_draw_vector_dsc_t * dsc);
/**
* Set a matrix to current transformation matrix
* Set a matrix to current transformation matrix.
* The new path shapes added by `lv_draw_vector_dsc_add_path` will use this matrix.
* @param dsc pointer to a vector graphic descriptor
* @param matrix pointer to a matrix
*/
void lv_vector_dsc_set_transform(lv_vector_dsc_t * dsc, const lv_matrix_t * matrix);
void lv_draw_vector_dsc_set_transform(lv_draw_vector_dsc_t * dsc, const lv_matrix_t * matrix);
/**
* Set blend mode for descriptor
* Set blend mode for descriptor.
* The new path shapes added by `lv_draw_vector_dsc_add_path` will use this blend mode.
* @param dsc pointer to a vector graphic descriptor
* @param blend the blend mode to be set in `lv_vector_blend_t`
*/
void lv_vector_dsc_set_blend_mode(lv_vector_dsc_t * dsc, lv_vector_blend_t blend);
void lv_draw_vector_dsc_set_blend_mode(lv_draw_vector_dsc_t * dsc, lv_vector_blend_t blend);
/**
* Set fill color for descriptor
* Set the fill color for descriptor.
* The new path shapes added by `lv_draw_vector_dsc_add_path` will use this color.
* @param dsc pointer to a vector graphic descriptor
* @param color the color to be set in lv_color32_t format
*/
void lv_vector_dsc_set_fill_color32(lv_vector_dsc_t * dsc, lv_color32_t color);
void lv_draw_vector_dsc_set_fill_color32(lv_draw_vector_dsc_t * dsc, lv_color32_t color);
/**
* Set fill color for descriptor
* Set fill color for descriptor.
* The new path shapes added by `lv_draw_vector_dsc_add_path` will use this color.
* @param dsc pointer to a vector graphic descriptor
* @param color the color to be set in lv_color_t format
*/
void lv_vector_dsc_set_fill_color(lv_vector_dsc_t * dsc, lv_color_t color);
void lv_draw_vector_dsc_set_fill_color(lv_draw_vector_dsc_t * dsc, lv_color_t color);
/**
* Set fill opacity for descriptor
* Set fill opacity for descriptor.
* The new path shapes added by `lv_draw_vector_dsc_add_path` will use this opacity.
* @param dsc pointer to a vector graphic descriptor
* @param opa the opacity to be set in lv_opa_t format
*/
void lv_vector_dsc_set_fill_opa(lv_vector_dsc_t * dsc, lv_opa_t opa);
void lv_draw_vector_dsc_set_fill_opa(lv_draw_vector_dsc_t * dsc, lv_opa_t opa);
/**
* Set fill rule for descriptor
* Set fill rule for descriptor.
* The new path shapes added by `lv_draw_vector_dsc_add_path` will use this fill rule.
* @param dsc pointer to a vector graphic descriptor
* @param rule the fill rule to be set in lv_vector_fill_t format
*/
void lv_vector_dsc_set_fill_rule(lv_vector_dsc_t * dsc, lv_vector_fill_t rule);
void lv_draw_vector_dsc_set_fill_rule(lv_draw_vector_dsc_t * dsc, lv_vector_fill_t rule);
/**
* Set the fill units for descriptor.
* The new path shapes added by `lv_draw_vector_dsc_add_path` will use this fill units.
* @param dsc pointer to a vector graphic descriptor
* @param units the units to be set in lv_vector_fill_units_t format
* @note The units can be either relative to the object bounding box or absolute in user space.
* This API specifically affects the drawing position of the fill image and does not impact other elements.
*/
void lv_vector_dsc_set_fill_units(lv_vector_dsc_t * dsc, const lv_vector_fill_units_t units);
void lv_draw_vector_dsc_set_fill_units(lv_draw_vector_dsc_t * dsc, const lv_vector_fill_units_t units);
/**
* Set fill image for descriptor
* Set fill image for descriptor.
* The new path shapes added by `lv_draw_vector_dsc_add_path` will use this fill image.
* @param dsc pointer to a vector graphic descriptor
* @param img_dsc pointer to a `lv_draw_image_dsc_t` variable
*/
void lv_vector_dsc_set_fill_image(lv_vector_dsc_t * dsc, const lv_draw_image_dsc_t * img_dsc);
void lv_draw_vector_dsc_set_fill_image(lv_draw_vector_dsc_t * dsc, const lv_draw_image_dsc_t * img_dsc);
/**
* Set fill linear gradient for descriptor
* The new path shapes added by `lv_draw_vector_dsc_add_path` will use this gradient.
* @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, float x1, float y1, float x2, float y2);
void lv_draw_vector_dsc_set_fill_linear_gradient(lv_draw_vector_dsc_t * dsc, float x1, float y1, float x2, float y2);
/**
* Set fill radial gradient radius for descriptor
* The new path shapes added by `lv_draw_vector_dsc_add_path` will use this gradient.
* @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, float cx, float cy, float radius);
void lv_draw_vector_dsc_set_fill_radial_gradient(lv_draw_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);
void lv_draw_vector_dsc_set_fill_gradient_spread(lv_draw_vector_dsc_t * dsc, lv_vector_gradient_spread_t spread);
/**
* Set fill gradient color stops for descriptor
* Set fill gradient color stops for descriptor.
* The new path shapes added by `lv_draw_vector_dsc_add_path` will use this gradient color stops.
* @param dsc pointer to a vector graphic descriptor
* @param stops an array of `lv_grad_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_grad_stop_t * stops,
void lv_draw_vector_dsc_set_fill_gradient_color_stops(lv_draw_vector_dsc_t * dsc, const lv_grad_stop_t * stops,
uint16_t count);
/**
* Set a matrix to current fill transformation matrix
* The new path shapes added by `lv_draw_vector_dsc_add_path` will use this matrix.
* @param dsc pointer to a vector graphic descriptor
* @param matrix pointer to a matrix
*/
void lv_vector_dsc_set_fill_transform(lv_vector_dsc_t * dsc, const lv_matrix_t * matrix);
void lv_draw_vector_dsc_set_fill_transform(lv_draw_vector_dsc_t * dsc, const lv_matrix_t * matrix);
/**
* Set stroke color for descriptor
* Set stroke color for descriptor.
* The new path shapes added by `lv_draw_vector_dsc_add_path` will use this color.
* @param dsc pointer to a vector graphic descriptor
* @param color the color to be set in lv_color32_t format
*/
void lv_vector_dsc_set_stroke_color32(lv_vector_dsc_t * dsc, lv_color32_t color);
void lv_draw_vector_dsc_set_stroke_color32(lv_draw_vector_dsc_t * dsc, lv_color32_t color);
/**
* Set stroke color for descriptor
* Set stroke color for descriptor.
* The new path shapes added by `lv_draw_vector_dsc_add_path` will use this color.
* @param dsc pointer to a vector graphic descriptor
* @param color the color to be set in lv_color_t format
*/
void lv_vector_dsc_set_stroke_color(lv_vector_dsc_t * dsc, lv_color_t color);
void lv_draw_vector_dsc_set_stroke_color(lv_draw_vector_dsc_t * dsc, lv_color_t color);
/**
* Set stroke opacity for descriptor
* @param dsc pointer to a vector graphic descriptor
* @param opa the opacity to be set in lv_opa_t format
*/
void lv_vector_dsc_set_stroke_opa(lv_vector_dsc_t * dsc, lv_opa_t opa);
void lv_draw_vector_dsc_set_stroke_opa(lv_draw_vector_dsc_t * dsc, lv_opa_t opa);
/**
* Set stroke line width for descriptor
* Set stroke line width for descriptor.
* The new path shapes added by `lv_draw_vector_dsc_add_path` will use this stroke width.
* @param dsc pointer to a vector graphic descriptor
* @param width the stroke line width
*/
void lv_vector_dsc_set_stroke_width(lv_vector_dsc_t * dsc, float width);
void lv_draw_vector_dsc_set_stroke_width(lv_draw_vector_dsc_t * dsc, float width);
/**
* Set stroke line dash pattern for descriptor
* The new path shapes added by `lv_draw_vector_dsc_add_path` will use this dash.
* @param dsc pointer to a vector graphic descriptor
* @param dash_pattern an array of values that specify the segments of dash line
* @param dash_count the length of dash pattern array
*/
void lv_vector_dsc_set_stroke_dash(lv_vector_dsc_t * dsc, float * dash_pattern, uint16_t dash_count);
void lv_draw_vector_dsc_set_stroke_dash(lv_draw_vector_dsc_t * dsc, float * dash_pattern, uint16_t dash_count);
/**
* Set stroke line cap style for descriptor
* The new path shapes added by `lv_draw_vector_dsc_add_path` will use this line cap.
* @param dsc pointer to a vector graphic descriptor
* @param cap the line cap to be set in lv_vector_stroke_cap_t format
*/
void lv_vector_dsc_set_stroke_cap(lv_vector_dsc_t * dsc, lv_vector_stroke_cap_t cap);
void lv_draw_vector_dsc_set_stroke_cap(lv_draw_vector_dsc_t * dsc, lv_vector_stroke_cap_t cap);
/**
* Set stroke line join style for descriptor
* @param dsc pointer to a vector graphic descriptor
* @param join the line join to be set in lv_vector_stroke_join_t format
*/
void lv_vector_dsc_set_stroke_join(lv_vector_dsc_t * dsc, lv_vector_stroke_join_t join);
void lv_draw_vector_dsc_set_stroke_join(lv_draw_vector_dsc_t * dsc, lv_vector_stroke_join_t join);
/**
* Set stroke miter limit for descriptor
* The new path shapes added by `lv_draw_vector_dsc_add_path` will use this miter limit.
* @param dsc pointer to a vector graphic descriptor
* @param miter_limit the stroke miter_limit
*/
void lv_vector_dsc_set_stroke_miter_limit(lv_vector_dsc_t * dsc, uint16_t miter_limit);
void lv_draw_vector_dsc_set_stroke_miter_limit(lv_draw_vector_dsc_t * dsc, uint16_t miter_limit);
/**
* Set stroke linear gradient for descriptor
* The new path shapes added by `lv_draw_vector_dsc_add_path` will use this gradient.
* @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_stroke_linear_gradient(lv_vector_dsc_t * dsc, float x1, float y1, float x2, float y2);
void lv_draw_vector_dsc_set_stroke_linear_gradient(lv_draw_vector_dsc_t * dsc, float x1, float y1, float x2, float y2);
/**
* Set stroke radial gradient for descriptor
* The new path shapes added by `lv_draw_vector_dsc_add_path` will use this gradient.
* @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_stroke_radial_gradient(lv_vector_dsc_t * dsc, float cx, float cy, float radius);
void lv_draw_vector_dsc_set_stroke_radial_gradient(lv_draw_vector_dsc_t * dsc, float cx, float cy, float radius);
/**
* Set stroke color stops for descriptor
* The new path shapes added by `lv_draw_vector_dsc_add_path` will use this gradient spread.
* @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_gradient_spread(lv_vector_dsc_t * dsc, lv_vector_gradient_spread_t spread);
void lv_draw_vector_dsc_set_stroke_gradient_spread(lv_draw_vector_dsc_t * dsc, lv_vector_gradient_spread_t spread);
/**
* Set stroke color stops for descriptor
* The new path shapes added by `lv_draw_vector_dsc_add_path` will use this color stops.
* @param dsc pointer to a vector graphic descriptor
* @param stops an array of `lv_grad_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_grad_stop_t * stops,
void lv_draw_vector_dsc_set_stroke_gradient_color_stops(lv_draw_vector_dsc_t * dsc, const lv_grad_stop_t * stops,
uint16_t count);
/**
* Set a matrix to current stroke transformation matrix
* Set a matrix to current stroke transformation matrix.
* The new path shapes added by `lv_draw_vector_dsc_add_path` will use this matrix.
* @param dsc pointer to a vector graphic descriptor
* @param matrix pointer to a matrix
*/
void lv_vector_dsc_set_stroke_transform(lv_vector_dsc_t * dsc, const lv_matrix_t * matrix);
void lv_draw_vector_dsc_set_stroke_transform(lv_draw_vector_dsc_t * dsc, const lv_matrix_t * matrix);
/**
* Set current transformation matrix to identity matrix
* The new path shapes added by `lv_draw_vector_dsc_add_path` will use this matrix.
* @param dsc pointer to a vector graphic descriptor
*/
void lv_vector_dsc_identity(lv_vector_dsc_t * dsc);
void lv_draw_vector_dsc_identity(lv_draw_vector_dsc_t * dsc);
/**
* Change the scale factor of current transformation matrix
* The new path shapes added by `lv_draw_vector_dsc_add_path` will use this scale.
* @param dsc pointer to a vector graphic descriptor
* @param scale_x the scale factor for the X direction
* @param scale_y the scale factor for the Y direction
*/
void lv_vector_dsc_scale(lv_vector_dsc_t * dsc, float scale_x, float scale_y);
void lv_draw_vector_dsc_scale(lv_draw_vector_dsc_t * dsc, float scale_x, float scale_y);
/**
* Rotate current transformation matrix with origin
* The new path shapes added by `lv_draw_vector_dsc_add_path` will use this rotation.
* @param dsc pointer to a vector graphic descriptor
* @param degree angle to rotate
*/
void lv_vector_dsc_rotate(lv_vector_dsc_t * dsc, float degree);
void lv_draw_vector_dsc_rotate(lv_draw_vector_dsc_t * dsc, float degree);
/**
* Translate current transformation matrix to new position
* The new path shapes added by `lv_draw_vector_dsc_add_path` will use this rotation.
* @param dsc pointer to a vector graphic descriptor
* @param tx the amount of translate in x direction
* @param tx the amount of translate in y direction
* @param ty the amount of translate in y direction
*/
void lv_vector_dsc_translate(lv_vector_dsc_t * dsc, float tx, float ty);
void lv_draw_vector_dsc_translate(lv_draw_vector_dsc_t * dsc, float tx, float ty);
/**
* Change the skew factor of current transformation matrix
* The new path shapes added by `lv_draw_vector_dsc_add_path` will use this skew.
* @param dsc pointer to a vector graphic descriptor
* @param skew_x the skew factor for x direction
* @param skew_y the skew factor for y direction
*/
void lv_vector_dsc_skew(lv_vector_dsc_t * dsc, float skew_x, float skew_y);
void lv_draw_vector_dsc_skew(lv_draw_vector_dsc_t * dsc, float skew_x, float skew_y);
/**
* Add a graphic path to the draw list
* Add a graphic path to the draw list.
* It will use colors, opacity, matrix and other parameters set
* by `lv_draw_vector_dsc_set_fill_color()` and similar functions.
* @param dsc pointer to a vector graphic descriptor
* @param path pointer to a path
*/
void lv_vector_dsc_add_path(lv_vector_dsc_t * dsc, const lv_vector_path_t * path);
void lv_draw_vector_dsc_add_path(lv_draw_vector_dsc_t * dsc, const lv_vector_path_t * path);
/**
* Clear a rectangle area use current fill color
* @param dsc pointer to a vector graphic descriptor
* @param rect the area to clear in the buffer
*/
void lv_vector_clear_area(lv_vector_dsc_t * dsc, const lv_area_t * rect);
void lv_draw_vector_dsc_clear_area(lv_draw_vector_dsc_t * dsc, const lv_area_t * rect);
/**
* Draw all the vector graphic paths
* @param dsc pointer to a vector graphic descriptor
*/
void lv_draw_vector(lv_vector_dsc_t * dsc);
void lv_draw_vector(lv_draw_vector_dsc_t * dsc);
/**
* Try to get a vector draw descriptor from a draw task.
* @param task draw task
* @return the task's draw descriptor or NULL if the task is not of type LV_DRAW_TASK_TYPE_VECTOR
*/
lv_draw_vector_dsc_t * lv_draw_task_get_vector_dsc(lv_draw_task_t * task);
/* 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);
typedef void (*vector_draw_task_cb)(void * ctx, const lv_vector_path_t * path, const lv_vector_path_ctx_t * dsc);
#endif /* LV_USE_VECTOR_GRAPHIC */

View File

@ -26,6 +26,13 @@ extern "C" {
* TYPEDEFS
**********************/
/**
* Stores the shape of the path as arrays of operations and points.
* For example move to 10;20 then draw a line to 30;40 and draw an
* arc with 30 radius and 70° sweep.
*
* `lv_vector_path_ctx_t` is also required to describe how to fill and stroke the path.
*/
struct _lv_vector_path_t {
lv_vector_path_quality_t quality;
lv_array_t ops;
@ -70,7 +77,10 @@ struct _lv_vector_stroke_dsc_t {
lv_matrix_t matrix;
};
struct _lv_vector_draw_dsc_t {
/**
* Stores how to fill, stroke, transform etc a given path
*/
struct _lv_vector_path_ctx_t {
lv_vector_fill_dsc_t fill_dsc;
lv_vector_stroke_dsc_t stroke_dsc;
lv_matrix_t matrix;
@ -78,23 +88,45 @@ struct _lv_vector_draw_dsc_t {
lv_area_t scissor_area;
};
struct _lv_draw_vector_task_dsc_t {
struct _lv_draw_vector_dsc_t {
lv_draw_dsc_base_t base;
lv_ll_t * task_list; /*draw task list.*/
/** The current colors, opacities, matrix, etc for the next task to be added
* by */
lv_vector_path_ctx_t * ctx;
/**
* Store path shapes and their attributes
* in a list as `lv_draw_vector_subtask_t`. */
lv_ll_t * 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;
};
/**
* Contains a path shape and its attributes together.
* It's a task that will be passed to the vector rendering engine.
* It's used in the `task_list` of `lv_draw_vector_dsc_t`.
*/
typedef struct {
lv_vector_path_t * path;
lv_vector_path_ctx_t ctx;
} lv_draw_vector_subtask_t;
/**********************
* GLOBAL PROTOTYPES
**********************/
void lv_vector_for_each_destroy_tasks(lv_ll_t * task_list, vector_draw_task_cb cb, void * data);
/**
* This is the main function to draw the accumulated vector tasks by passing them
* to a vector renderer callback.
* When the callback returns the processed vector task will be destroyed.
* @param task_list pointer to the linked list in `lv_draw_vector_dsc_t` that stores
* the path shapes and their attributes.
* @param cb the callback used to iterate through the task
* @param user_data a custom pointer that will be passed to the callback
*/
void lv_vector_for_each_destroy_tasks(lv_ll_t * task_list, vector_draw_task_cb cb, void * used_data);
/**********************
* MACROS

View File

@ -21,6 +21,14 @@
#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)
#if LV_USE_OS != LV_OS_NONE
#define img_decoder_info_lock_p &(LV_GLOBAL_DEFAULT()->img_decoder_info_lock)
#define img_decoder_open_lock_p &(LV_GLOBAL_DEFAULT()->img_decoder_open_lock)
#else
#define img_decoder_info_lock_p NULL
#define img_decoder_open_lock_p NULL
#endif
/**********************
* TYPEDEFS
**********************/
@ -63,6 +71,9 @@ void lv_image_decoder_init(uint32_t image_cache_size, uint32_t image_header_coun
/*Initialize the cache*/
lv_image_cache_init(image_cache_size);
lv_image_header_cache_init(image_header_count);
lv_mutex_init(img_decoder_info_lock_p);
lv_mutex_init(img_decoder_open_lock_p);
}
/**
@ -73,6 +84,9 @@ void lv_image_decoder_deinit(void)
lv_cache_destroy(img_cache_p, NULL);
lv_cache_destroy(img_header_cache_p, NULL);
lv_mutex_delete(img_decoder_info_lock_p);
lv_mutex_delete(img_decoder_open_lock_p);
lv_ll_clear(img_decoder_ll_p);
}
@ -83,7 +97,9 @@ lv_result_t lv_image_decoder_get_info(const void * src, lv_image_header_t * head
dsc.src = src;
dsc.src_type = lv_image_src_get_type(src);
lv_mutex_lock(img_decoder_info_lock_p);
lv_image_decoder_t * decoder = image_decoder_get_info(&dsc, header);
lv_mutex_unlock(img_decoder_info_lock_p);
if(decoder == NULL) return LV_RESULT_INVALID;
return LV_RESULT_OK;
@ -97,6 +113,8 @@ 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);
lv_mutex_lock(img_decoder_open_lock_p);
if(lv_image_cache_is_enabled()) {
dsc->cache = img_cache_p;
/*Try cache first, unless we are told to ignore cache.*/
@ -104,13 +122,19 @@ lv_result_t lv_image_decoder_open(lv_image_decoder_dsc_t * dsc, const void * src
/*
* 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(try_cache(dsc) == LV_RESULT_OK) {
lv_mutex_unlock(img_decoder_open_lock_p);
return LV_RESULT_OK;
}
}
}
/*Find the decoder that can open the image source, and get the header info in the same time.*/
dsc->decoder = image_decoder_get_info(dsc, &dsc->header);
if(dsc->decoder == NULL) return LV_RESULT_INVALID;
if(dsc->decoder == NULL) {
lv_mutex_unlock(img_decoder_open_lock_p);
return LV_RESULT_INVALID;
}
/*Make a copy of args*/
dsc->args = args ? *args : (lv_image_decoder_args_t) {
@ -144,6 +168,7 @@ lv_result_t lv_image_decoder_open(lv_image_decoder_dsc_t * dsc, const void * src
}
}
lv_mutex_unlock(img_decoder_open_lock_p);
return res;
}
@ -158,14 +183,20 @@ lv_result_t lv_image_decoder_get_area(lv_image_decoder_dsc_t * dsc, const lv_are
void lv_image_decoder_close(lv_image_decoder_dsc_t * dsc)
{
if(dsc->decoder) {
if(!dsc->decoder) {
return;
}
lv_mutex_lock(img_decoder_open_lock_p);
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);
}
}
lv_mutex_unlock(img_decoder_open_lock_p);
}
/**
@ -269,7 +300,8 @@ lv_draw_buf_t * lv_image_decoder_post_process(lv_image_decoder_dsc_t * dsc, lv_d
if(args->premultiply
&& !LV_COLOR_FORMAT_IS_ALPHA_ONLY(decoded->header.cf)
&& lv_color_format_has_alpha(decoded->header.cf)
&& !lv_draw_buf_has_flag(decoded, LV_IMAGE_FLAGS_PREMULTIPLIED) /*Hasn't done yet*/
&& !lv_draw_buf_has_flag(decoded, LV_IMAGE_FLAGS_PREMULTIPLIED)
&& decoded->header.cf != LV_COLOR_FORMAT_ARGB8888_PREMULTIPLIED /*Hasn't done yet*/
) {
LV_LOG_TRACE("Alpha premultiply.");
if(lv_draw_buf_has_flag(decoded, LV_IMAGE_FLAGS_MODIFIABLE)) {

View File

@ -25,6 +25,11 @@ extern "C" {
#define LV_IMAGE_HEADER_MAGIC (0x19)
LV_EXPORT_CONST_INT(LV_IMAGE_HEADER_MAGIC);
/**
* Flags reserved for user, lvgl won't use these bits.
*/
#define LV_IMAGE_FLAGS_USER_MASK (0xFF00)
/**********************
* TYPEDEFS
**********************/

View File

@ -243,12 +243,18 @@ static int32_t nema_gfx_evaluate(lv_draw_unit_t * draw_unit, lv_draw_task_t * ta
}
break;
}
#if LV_USE_VECTOR_GRAPHIC && LV_USE_NEMA_VG
case LV_DRAW_TASK_TYPE_VECTOR: {
if(task->preference_score > 80) {
task->preference_score = 80;
task->preferred_draw_unit_id = DRAW_UNIT_ID_NEMA_GFX;
}
return 1;
}
#endif
case LV_DRAW_TASK_TYPE_BOX_SHADOW:
case LV_DRAW_TASK_TYPE_MASK_RECTANGLE:
case LV_DRAW_TASK_TYPE_MASK_BITMAP:
#if LV_USE_VECTOR_GRAPHIC
case LV_DRAW_TASK_TYPE_VECTOR:
#endif
default:
break;
}
@ -285,7 +291,7 @@ static int32_t nema_gfx_dispatch(lv_draw_unit_t * draw_unit, lv_layer_t * layer)
#else
nema_gfx_execute_drawing(draw_nema_gfx_unit);
draw_nema_gfx_unit->task_act->state = LV_DRAW_TASK_STATE_READY;
draw_nema_gfx_unit->task_act->state = LV_DRAW_TASK_STATE_FINISHED;
draw_nema_gfx_unit->task_act = NULL;
/* The draw unit is free now. Request a new dispatching as it can get a new task. */
@ -328,6 +334,11 @@ static void nema_gfx_execute_drawing(lv_draw_nema_gfx_unit_t * u)
case LV_DRAW_TASK_TYPE_BORDER:
lv_draw_nema_gfx_border(t, t->draw_dsc, &t->area);
break;
#if LV_USE_VECTOR_GRAPHIC && LV_USE_NEMA_VG
case LV_DRAW_TASK_TYPE_VECTOR:
lv_draw_nema_gfx_vector(t, t->draw_dsc, &t->area);
break;
#endif
default:
break;
}
@ -388,7 +399,7 @@ static void nema_gfx_render_thread_cb(void * ptr)
nema_gfx_execute_drawing(u);
}
/* Signal the ready state to dispatcher. */
u->task_act->state = LV_DRAW_TASK_STATE_READY;
u->task_act->state = LV_DRAW_TASK_STATE_FINISHED;
/* Cleanup. */
u->task_act = NULL;

View File

@ -110,6 +110,11 @@ void lv_draw_nema_gfx_border(lv_draw_task_t * t, const lv_draw_border_dsc_t * ds
void lv_draw_nema_gfx_arc(lv_draw_task_t * t, const lv_draw_arc_dsc_t * dsc,
const lv_area_t * coords);
#if LV_USE_VECTOR_GRAPHIC && LV_USE_NEMA_VG
void lv_draw_nema_gfx_vector(lv_draw_task_t * t, const lv_draw_vector_dsc_t * dsc,
const lv_area_t * coords);
#endif
/**********************
* MACROS

View File

@ -25,7 +25,7 @@
*/
/**
* @file lv_draw_nema_gfx_fill.c
* @file lv_draw_nema_gfx_border.c
*
*/

View File

@ -99,13 +99,12 @@ void lv_draw_nema_gfx_fill(lv_draw_task_t * t, const lv_draw_fill_dsc_t * dsc, c
nema_vg_paint_clear(draw_nema_gfx_unit->paint);
nema_vg_paint_set_type(draw_nema_gfx_unit->paint, NEMA_VG_PAINT_GRAD_LINEAR);
nema_vg_set_blend(NEMA_BL_SRC_OVER | NEMA_BLOP_SRC_PREMULT);
float stops[LV_GRADIENT_MAX_STOPS];
color_var_t colors[LV_GRADIENT_MAX_STOPS];
uint32_t cnt = LV_MAX(dsc->grad.stops_count, LV_GRADIENT_MAX_STOPS);
uint32_t cnt = LV_MIN(dsc->grad.stops_count, LV_GRADIENT_MAX_STOPS);
for(uint8_t i = 0; i < cnt; i++) {
stops[i] = (float)(dsc->grad.stops[i].frac) / 255.f;
@ -117,23 +116,57 @@ void lv_draw_nema_gfx_fill(lv_draw_task_t * t, const lv_draw_fill_dsc_t * dsc, c
nema_vg_grad_set(draw_nema_gfx_unit->gradient, cnt, stops, colors);
nema_tex_mode_t extend_type;
switch(dsc->grad.extend) {
case LV_GRAD_EXTEND_REPEAT:
extend_type = NEMA_TEX_REPEAT;
break;
case LV_GRAD_EXTEND_REFLECT:
extend_type = NEMA_TEX_MIRROR;
break;
case LV_GRAD_EXTEND_PAD:
default:
extend_type = NEMA_TEX_CLAMP;
break;
}
if(dsc->grad.dir == LV_GRAD_DIR_VER || dsc->grad.dir == LV_GRAD_DIR_HOR
|| dsc->grad.dir == LV_GRAD_DIR_LINEAR) {
nema_vg_paint_set_type(draw_nema_gfx_unit->paint, NEMA_VG_PAINT_GRAD_LINEAR);
float x0, y0, x1, y1;
if(dsc->grad.dir == LV_GRAD_DIR_HOR) {
x0 = rel_coords.x1;
x1 = rel_coords.x2;
y0 = rel_coords.y1;
y1 = rel_coords.y1;
y1 = rel_coords.y2;
}
else {
else if(dsc->grad.dir == LV_GRAD_DIR_VER) {
x0 = rel_coords.x1;
x1 = rel_coords.x1;
y0 = rel_coords.y1;
y1 = rel_coords.y2;
}
else {
x0 = rel_coords.x1 + lv_pct_to_px(dsc->grad.params.linear.start.x, lv_area_get_width(coords));
x1 = rel_coords.x1 + lv_pct_to_px(dsc->grad.params.linear.end.x, lv_area_get_width(coords));
y0 = rel_coords.y1 + lv_pct_to_px(dsc->grad.params.linear.start.y, lv_area_get_height(coords));
y1 = rel_coords.y1 + lv_pct_to_px(dsc->grad.params.linear.end.y, lv_area_get_height(coords));
}
nema_vg_paint_set_grad_linear(draw_nema_gfx_unit->paint, draw_nema_gfx_unit->gradient, x0, y0, x1, y1,
NEMA_TEX_CLAMP | NEMA_FILTER_BL);
extend_type | NEMA_FILTER_BL);
}
else if(dsc->grad.dir == LV_GRAD_DIR_RADIAL) {
nema_vg_paint_set_type(draw_nema_gfx_unit->paint, NEMA_VG_PAINT_GRAD_RADIAL);
nema_vg_paint_set_grad_radial(draw_nema_gfx_unit->paint, draw_nema_gfx_unit->gradient,
rel_coords.x1 + dsc->grad.params.radial.end.x,
rel_coords.y1 + dsc->grad.params.radial.end.y,
LV_ABS(dsc->grad.params.radial.end_extent.x - dsc->grad.params.radial.end.x),
extend_type | NEMA_FILTER_BL);
}
if(radius > 0.f)
nema_vg_draw_rounded_rect(rel_coords.x1, rel_coords.y1, coords_bg_w, coords_bg_h, radius, radius, NULL,

View File

@ -25,7 +25,7 @@
*/
/**
* @file lv_draw_nema_gfx_fill.c
* @file lv_draw_nema_gfx_img.c
*
*/
@ -41,9 +41,9 @@
* STATIC PROTOTYPES
**********************/
static void _draw_nema_gfx_tile(lv_draw_task_t * t, const lv_draw_image_dsc_t * dsc, const lv_area_t * coords);
static void _draw_nema_gfx_img(lv_draw_task_t * t, const lv_draw_image_dsc_t * dsc, const lv_area_t * coords);
static void _draw_nema_gfx_img(lv_draw_task_t * t, const lv_draw_image_dsc_t * dsc,
const lv_image_decoder_dsc_t * decoder_dsc, lv_draw_image_sup_t * sup,
const lv_area_t * img_coords, const lv_area_t * clipped_img_area);
static uint32_t lv_nemagfx_mask_cf_to_nema(lv_color_format_t cf);
@ -51,80 +51,29 @@ static uint32_t lv_nemagfx_mask_cf_to_nema(lv_color_format_t cf);
* STATIC FUNCTIONS
**********************/
static void _draw_nema_gfx_tile(lv_draw_task_t * t, const lv_draw_image_dsc_t * dsc, const lv_area_t * coords)
{
lv_image_decoder_dsc_t decoder_dsc;
lv_result_t res = lv_image_decoder_open(&decoder_dsc, dsc->src, NULL);
if(res != LV_RESULT_OK) {
LV_LOG_ERROR("Failed to open image");
return;
}
int32_t img_w = dsc->header.w;
int32_t img_h = dsc->header.h;
lv_area_t tile_area;
if(lv_area_get_width(&dsc->image_area) >= 0) {
tile_area = dsc->image_area;
}
else {
tile_area = *coords;
}
lv_area_set_width(&tile_area, img_w);
lv_area_set_height(&tile_area, img_h);
int32_t tile_x_start = tile_area.x1;
while(tile_area.y1 <= t->clip_area.y2) {
while(tile_area.x1 <= t->clip_area.x2) {
lv_area_t clipped_img_area;
if(lv_area_intersect(&clipped_img_area, &tile_area, &t->clip_area)) {
_draw_nema_gfx_img(t, dsc, &tile_area);
}
tile_area.x1 += img_w;
tile_area.x2 += img_w;
}
tile_area.y1 += img_h;
tile_area.y2 += img_h;
tile_area.x1 = tile_x_start;
tile_area.x2 = tile_x_start + img_w - 1;
}
lv_image_decoder_close(&decoder_dsc);
}
static void _draw_nema_gfx_img(lv_draw_task_t * t, const lv_draw_image_dsc_t * dsc, const lv_area_t * coords)
static void _draw_nema_gfx_img(lv_draw_task_t * t, const lv_draw_image_dsc_t * dsc,
const lv_image_decoder_dsc_t * decoder_dsc, lv_draw_image_sup_t * sup,
const lv_area_t * img_coords, const lv_area_t * clipped_img_area)
{
if(dsc->opa <= LV_OPA_MIN) return;
lv_draw_nema_gfx_unit_t * draw_nema_gfx_unit = (lv_draw_nema_gfx_unit_t *)t->draw_unit;
lv_layer_t * layer = t->target_layer;
const lv_image_dsc_t * img_dsc = dsc->src;
const lv_draw_buf_t * decoded = decoder_dsc->decoded;
const lv_image_header_t * header = &decoded->header;
bool masked = dsc->bitmap_mask_src != NULL;
lv_area_t blend_area;
/*Let's get the blend area which is the intersection of the area to fill and the clip area.*/
if(!lv_area_intersect(&blend_area, coords, &t->clip_area))
return; /*Fully clipped, nothing to do*/
lv_area_t rel_clip_area;
lv_area_copy(&rel_clip_area, &t->clip_area);
lv_area_copy(&rel_clip_area, clipped_img_area);
lv_area_move(&rel_clip_area, -layer->buf_area.x1, -layer->buf_area.y1);
bool has_transform = (dsc->rotation != 0 || dsc->scale_x != LV_SCALE_NONE || dsc->scale_y != LV_SCALE_NONE);
bool recolor = (dsc->recolor_opa > LV_OPA_MIN);
/*Make the blend area relative to the buffer*/
lv_area_move(&blend_area, -layer->buf_area.x1, -layer->buf_area.y1);
uint32_t tex_w = lv_area_get_width(coords);
uint32_t tex_h = lv_area_get_height(coords);
uint32_t tex_w = header->w;
uint32_t tex_h = header->h;
nema_set_clip(rel_clip_area.x1, rel_clip_area.y1, lv_area_get_width(&rel_clip_area),
lv_area_get_height(&rel_clip_area));
@ -132,11 +81,11 @@ static void _draw_nema_gfx_img(lv_draw_task_t * t, const lv_draw_image_dsc_t * d
lv_color_format_t dst_cf = layer->draw_buf->header.cf;
uint32_t dst_nema_cf = lv_nemagfx_cf_to_nema(dst_cf);
const void * src_buf = img_dsc->data;
const void * src_buf = decoded->data;
uint32_t blending_mode = lv_nemagfx_blending_mode(dsc->blend_mode);
lv_color_format_t src_cf = img_dsc->header.cf;
lv_color_format_t src_cf = header->cf;
/*Image contains Alpha*/
if(src_cf == LV_COLOR_FORMAT_ARGB8888 || src_cf == LV_COLOR_FORMAT_XRGB8888) {
@ -146,7 +95,7 @@ static void _draw_nema_gfx_img(lv_draw_task_t * t, const lv_draw_image_dsc_t * d
uint32_t src_nema_cf = lv_nemagfx_cf_to_nema(src_cf);
/* the stride should be computed internally for NEMA_TSC images and images missing a stride value */
int32_t src_stride = (src_cf >= LV_COLOR_FORMAT_NEMA_TSC_START && src_cf <= LV_COLOR_FORMAT_NEMA_TSC_END)
|| img_dsc->header.stride == 0 ? -1 : (int32_t)img_dsc->header.stride;
|| header->stride == 0 ? -1 : (int32_t)header->stride;
int32_t stride = (dst_cf >= LV_COLOR_FORMAT_NEMA_TSC_START && dst_cf <= LV_COLOR_FORMAT_NEMA_TSC_END) ?
-1 : lv_area_get_width(&(layer->buf_area)) * lv_color_format_get_size(dst_cf);
@ -189,13 +138,13 @@ static void _draw_nema_gfx_img(lv_draw_task_t * t, const lv_draw_image_dsc_t * d
const lv_area_t * image_area;
lv_area_t mask_area;
if(lv_area_get_width(&dsc->image_area) < 0) image_area = coords;
if(lv_area_get_width(&dsc->image_area) < 0) image_area = img_coords;
else image_area = &dsc->image_area;
lv_area_set(&mask_area, 0, 0, dsc->bitmap_mask_src->header.w - 1, dsc->bitmap_mask_src->header.h - 1);
lv_area_align(image_area, &mask_area, LV_ALIGN_CENTER, 0, 0);
mask_buf += dsc->bitmap_mask_src->header.w * (coords->y1 - mask_area.y1) + (coords->x1 - mask_area.x1);
mask_buf += dsc->bitmap_mask_src->header.w * (img_coords->y1 - mask_area.y1) + (img_coords->x1 - mask_area.x1);
nema_bind_tex(NEMA_TEX3, (uintptr_t)NEMA_VIRT2PHYS(mask_buf), mask->header.w, mask->header.h,
lv_nemagfx_mask_cf_to_nema(mask->header.cf),
@ -206,13 +155,13 @@ static void _draw_nema_gfx_img(lv_draw_task_t * t, const lv_draw_image_dsc_t * d
nema_set_blend_blit(blending_mode);
if(!has_transform) {
nema_blit_rect((coords->x1 - layer->buf_area.x1),
(coords->y1 - layer->buf_area.y1), tex_w, tex_h);
nema_blit_rect((img_coords->x1 - layer->buf_area.x1),
(img_coords->y1 - layer->buf_area.y1), tex_w, tex_h);
}
else {
/*Calculate the transformed points*/
float x0 = (coords->x1 - layer->buf_area.x1);
float y0 = (coords->y1 - layer->buf_area.y1);
float x0 = (img_coords->x1 - layer->buf_area.x1);
float y0 = (img_coords->y1 - layer->buf_area.y1);
float x1 = x0 + tex_w ;
float y1 = y0;
float x2 = x0 + tex_w ;
@ -273,10 +222,10 @@ void lv_draw_nema_gfx_img(lv_draw_task_t * t, const lv_draw_image_dsc_t * dsc, c
{
if(!dsc->tile) {
_draw_nema_gfx_img(t, dsc, coords);
lv_draw_image_normal_helper(t, dsc, coords, _draw_nema_gfx_img);
}
else {
_draw_nema_gfx_tile(t, dsc, coords);
lv_draw_image_tiled_helper(t, dsc, coords, _draw_nema_gfx_img);
}
}

View File

@ -25,7 +25,7 @@
*/
/**
* @file lv_draw_nema_gfx_fill.c
* @file lv_draw_nema_gfx_label.c
*
*/
@ -414,7 +414,11 @@ static void _draw_label_iterate_characters(lv_draw_task_t * t, const lv_draw_lab
const lv_area_t * coords)
{
const lv_font_t * font = dsc->font;
int32_t w;
lv_text_attributes_t attributes = {0};
attributes.letter_space = dsc->letter_space;
attributes.line_space = dsc->line_space;
attributes.max_width = LV_COORD_MAX;
attributes.text_flags = dsc->flag;
lv_area_t clipped_area;
bool clip_ok = lv_area_intersect(&clipped_area, coords, &t->clip_area);
@ -427,14 +431,13 @@ static void _draw_label_iterate_characters(lv_draw_task_t * t, const lv_draw_lab
if((dsc->flag & LV_TEXT_FLAG_EXPAND) == 0) {
/*Normally use the label's width as width*/
w = lv_area_get_width(coords);
attributes.max_width = lv_area_get_width(coords);
}
else {
/*If EXPAND is enabled then not limit the text's width to the object's width*/
lv_point_t p;
lv_text_get_size(&p, dsc->text, dsc->font, dsc->letter_space, dsc->line_space, LV_COORD_MAX,
dsc->flag);
w = p.x;
lv_text_get_size_attributes(&p, dsc->text, dsc->font, &attributes);
attributes.max_width = p.x;
}
int32_t line_height_font = lv_font_get_line_height(font);
@ -471,14 +474,13 @@ static void _draw_label_iterate_characters(lv_draw_task_t * t, const lv_draw_lab
uint32_t remaining_len = dsc->text_length;
uint32_t line_end = line_start + lv_text_get_next_line(&dsc->text[line_start], remaining_len, font, dsc->letter_space,
w, NULL, dsc->flag);
uint32_t line_end = line_start + lv_text_get_next_line(&dsc->text[line_start], remaining_len, font, NULL, &attributes);
/*Go the first visible line*/
while(pos.y + line_height_font < t->clip_area.y1) {
/*Go to next line*/
line_start = line_end;
line_end += lv_text_get_next_line(&dsc->text[line_start], remaining_len, font, dsc->letter_space, w, NULL, dsc->flag);
line_end += lv_text_get_next_line(&dsc->text[line_start], remaining_len, font, NULL, &attributes);
pos.y += line_height;
/*Save at the threshold coordinate*/
@ -493,16 +495,14 @@ static void _draw_label_iterate_characters(lv_draw_task_t * t, const lv_draw_lab
/*Align to middle*/
if(align == LV_TEXT_ALIGN_CENTER) {
line_width = lv_text_get_width_with_flags(&dsc->text[line_start], line_end - line_start, font, dsc->letter_space,
dsc->flag);
line_width = lv_text_get_width(&dsc->text[line_start], line_end - line_start, font, &attributes);
pos.x += (lv_area_get_width(coords) - line_width) / 2;
}
/*Align to the right*/
else if(align == LV_TEXT_ALIGN_RIGHT) {
line_width = lv_text_get_width_with_flags(&dsc->text[line_start], line_end - line_start, font, dsc->letter_space,
dsc->flag);
line_width = lv_text_get_width(&dsc->text[line_start], line_end - line_start, font, &attributes);
pos.x += lv_area_get_width(coords) - line_width;
}
@ -530,6 +530,7 @@ static void _draw_label_iterate_characters(lv_draw_task_t * t, const lv_draw_lab
uint32_t next_char_offset;
uint32_t recolor_command_start_index = 0;
int32_t letter_w;
cmd_state_t recolor_cmd_state = RECOLOR_CMD_STATE_WAIT_FOR_PARAMETER;
lv_color_t recolor = lv_color_black(); /* Holds the selected color inside the recolor command */
uint8_t is_first_space_after_cmd = 0;
@ -553,7 +554,6 @@ static void _draw_label_iterate_characters(lv_draw_task_t * t, const lv_draw_lab
line_start_x = pos.x;
/*Write all letter of a line*/
recolor_cmd_state = RECOLOR_CMD_STATE_WAIT_FOR_PARAMETER;
next_char_offset = 0;
#if LV_USE_BIDI
char * bidi_txt = lv_malloc(line_end - line_start + 1);
@ -731,21 +731,21 @@ static void _draw_label_iterate_characters(lv_draw_task_t * t, const lv_draw_lab
remaining_len -= line_end - line_start;
line_start = line_end;
if(remaining_len) {
line_end += lv_text_get_next_line(&dsc->text[line_start], remaining_len, font, dsc->letter_space, w, NULL, dsc->flag);
line_end += lv_text_get_next_line(&dsc->text[line_start], remaining_len, font, NULL, &attributes);
}
pos.x = coords->x1;
/*Align to middle*/
if(align == LV_TEXT_ALIGN_CENTER) {
line_width =
lv_text_get_width_with_flags(&dsc->text[line_start], line_end - line_start, font, dsc->letter_space, dsc->flag);
lv_text_get_width(&dsc->text[line_start], line_end - line_start, font, &attributes);
pos.x += (lv_area_get_width(coords) - line_width) / 2;
}
/*Align to the right*/
else if(align == LV_TEXT_ALIGN_RIGHT) {
line_width =
lv_text_get_width_with_flags(&dsc->text[line_start], line_end - line_start, font, dsc->letter_space, dsc->flag);
lv_text_get_width(&dsc->text[line_start], line_end - line_start, font, &attributes);
pos.x += lv_area_get_width(coords) - line_width;
}

View File

@ -25,7 +25,7 @@
*/
/**
* @file lv_draw_nema_gfx_fill.c
* @file lv_draw_nema_gfx_layer.c
*
*/

View File

@ -25,7 +25,7 @@
*/
/**
* @file lv_draw_nema_gfx_fill.c
* @file lv_draw_nema_gfx_line.c
*
*/

View File

@ -1,5 +1,5 @@
/**
* @file lv_draw_nema_gfx_hal.c
* @file lv_draw_nema_gfx_stm32_hal.c
*
* Global functions that implement some HAL functionality
* which Nema will call directly.

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