mirror of
https://github.com/arendst/Tasmota.git
synced 2025-04-24 23:07:17 +00:00
Merge pull request #16019 from s-hadinger/lvgl_8_3_0
ESP32 LVGL library from v8.2.0 to v8.3.0
This commit is contained in:
commit
cc9ae02909
@ -6,6 +6,7 @@ All notable changes to this project will be documented in this file.
|
||||
## [12.0.2.4]
|
||||
### Added
|
||||
- Command ``SetOption45 1..250`` to change default bistable latching relay pulse length of 40 milliseconds
|
||||
- ESP32 LVGL library from v8.2.0 to v8.3.0
|
||||
|
||||
### Changed
|
||||
|
||||
|
@ -18,26 +18,23 @@ const be_ntv_func_def_t lv_style_func[] = {
|
||||
{ "remove_prop", { (const void*) &lv_style_remove_prop, "b", "(lv.lv_style)i" } },
|
||||
{ "reset", { (const void*) &lv_style_reset, "", "(lv.lv_style)" } },
|
||||
{ "set_align", { (const void*) &lv_style_set_align, "", "(lv.lv_style)i" } },
|
||||
{ "set_anim", { (const void*) &lv_style_set_anim, "", "(lv.lv_style)(lv.lv_anim)" } },
|
||||
{ "set_anim_speed", { (const void*) &lv_style_set_anim_speed, "", "(lv.lv_style)i" } },
|
||||
{ "set_anim_time", { (const void*) &lv_style_set_anim_time, "", "(lv.lv_style)i" } },
|
||||
{ "set_arc_color", { (const void*) &lv_style_set_arc_color, "", "(lv.lv_style)(lv.lv_color)" } },
|
||||
{ "set_arc_color_filtered", { (const void*) &lv_style_set_arc_color_filtered, "", "(lv.lv_style)(lv.lv_color)" } },
|
||||
{ "set_arc_img_src", { (const void*) &lv_style_set_arc_img_src, "", "(lv.lv_style)." } },
|
||||
{ "set_arc_opa", { (const void*) &lv_style_set_arc_opa, "", "(lv.lv_style)i" } },
|
||||
{ "set_arc_rounded", { (const void*) &lv_style_set_arc_rounded, "", "(lv.lv_style)b" } },
|
||||
{ "set_arc_width", { (const void*) &lv_style_set_arc_width, "", "(lv.lv_style)i" } },
|
||||
{ "set_base_dir", { (const void*) &lv_style_set_base_dir, "", "(lv.lv_style)i" } },
|
||||
{ "set_bg_color", { (const void*) &lv_style_set_bg_color, "", "(lv.lv_style)(lv.lv_color)" } },
|
||||
{ "set_bg_color_filtered", { (const void*) &lv_style_set_bg_color_filtered, "", "(lv.lv_style)(lv.lv_color)" } },
|
||||
{ "set_bg_dither_mode", { (const void*) &lv_style_set_bg_dither_mode, "", "(lv.lv_style)i" } },
|
||||
{ "set_bg_grad", { (const void*) &lv_style_set_bg_grad, "", "(lv.lv_style)(lv.lv_grad_dsc)" } },
|
||||
{ "set_bg_grad_color", { (const void*) &lv_style_set_bg_grad_color, "", "(lv.lv_style)(lv.lv_color)" } },
|
||||
{ "set_bg_grad_color_filtered", { (const void*) &lv_style_set_bg_grad_color_filtered, "", "(lv.lv_style)(lv.lv_color)" } },
|
||||
{ "set_bg_grad_dir", { (const void*) &lv_style_set_bg_grad_dir, "", "(lv.lv_style)i" } },
|
||||
{ "set_bg_grad_stop", { (const void*) &lv_style_set_bg_grad_stop, "", "(lv.lv_style)i" } },
|
||||
{ "set_bg_img_opa", { (const void*) &lv_style_set_bg_img_opa, "", "(lv.lv_style)i" } },
|
||||
{ "set_bg_img_recolor", { (const void*) &lv_style_set_bg_img_recolor, "", "(lv.lv_style)(lv.lv_color)" } },
|
||||
{ "set_bg_img_recolor_filtered", { (const void*) &lv_style_set_bg_img_recolor_filtered, "", "(lv.lv_style)(lv.lv_color)" } },
|
||||
{ "set_bg_img_recolor_opa", { (const void*) &lv_style_set_bg_img_recolor_opa, "", "(lv.lv_style)i" } },
|
||||
{ "set_bg_img_src", { (const void*) &lv_style_set_bg_img_src, "", "(lv.lv_style)." } },
|
||||
{ "set_bg_img_tiled", { (const void*) &lv_style_set_bg_img_tiled, "", "(lv.lv_style)b" } },
|
||||
@ -45,7 +42,6 @@ const be_ntv_func_def_t lv_style_func[] = {
|
||||
{ "set_bg_opa", { (const void*) &lv_style_set_bg_opa, "", "(lv.lv_style)i" } },
|
||||
{ "set_blend_mode", { (const void*) &lv_style_set_blend_mode, "", "(lv.lv_style)i" } },
|
||||
{ "set_border_color", { (const void*) &lv_style_set_border_color, "", "(lv.lv_style)(lv.lv_color)" } },
|
||||
{ "set_border_color_filtered", { (const void*) &lv_style_set_border_color_filtered, "", "(lv.lv_style)(lv.lv_color)" } },
|
||||
{ "set_border_opa", { (const void*) &lv_style_set_border_opa, "", "(lv.lv_style)i" } },
|
||||
{ "set_border_post", { (const void*) &lv_style_set_border_post, "", "(lv.lv_style)b" } },
|
||||
{ "set_border_side", { (const void*) &lv_style_set_border_side, "", "(lv.lv_style)i" } },
|
||||
@ -71,11 +67,9 @@ const be_ntv_func_def_t lv_style_func[] = {
|
||||
{ "set_height", { (const void*) &lv_style_set_height, "", "(lv.lv_style)i" } },
|
||||
{ "set_img_opa", { (const void*) &lv_style_set_img_opa, "", "(lv.lv_style)i" } },
|
||||
{ "set_img_recolor", { (const void*) &lv_style_set_img_recolor, "", "(lv.lv_style)(lv.lv_color)" } },
|
||||
{ "set_img_recolor_filtered", { (const void*) &lv_style_set_img_recolor_filtered, "", "(lv.lv_style)(lv.lv_color)" } },
|
||||
{ "set_img_recolor_opa", { (const void*) &lv_style_set_img_recolor_opa, "", "(lv.lv_style)i" } },
|
||||
{ "set_layout", { (const void*) &lv_style_set_layout, "", "(lv.lv_style)i" } },
|
||||
{ "set_line_color", { (const void*) &lv_style_set_line_color, "", "(lv.lv_style)(lv.lv_color)" } },
|
||||
{ "set_line_color_filtered", { (const void*) &lv_style_set_line_color_filtered, "", "(lv.lv_style)(lv.lv_color)" } },
|
||||
{ "set_line_dash_gap", { (const void*) &lv_style_set_line_dash_gap, "", "(lv.lv_style)i" } },
|
||||
{ "set_line_dash_width", { (const void*) &lv_style_set_line_dash_width, "", "(lv.lv_style)i" } },
|
||||
{ "set_line_opa", { (const void*) &lv_style_set_line_opa, "", "(lv.lv_style)i" } },
|
||||
@ -87,7 +81,6 @@ const be_ntv_func_def_t lv_style_func[] = {
|
||||
{ "set_min_width", { (const void*) &lv_style_set_min_width, "", "(lv.lv_style)i" } },
|
||||
{ "set_opa", { (const void*) &lv_style_set_opa, "", "(lv.lv_style)i" } },
|
||||
{ "set_outline_color", { (const void*) &lv_style_set_outline_color, "", "(lv.lv_style)(lv.lv_color)" } },
|
||||
{ "set_outline_color_filtered", { (const void*) &lv_style_set_outline_color_filtered, "", "(lv.lv_style)(lv.lv_color)" } },
|
||||
{ "set_outline_opa", { (const void*) &lv_style_set_outline_opa, "", "(lv.lv_style)i" } },
|
||||
{ "set_outline_pad", { (const void*) &lv_style_set_outline_pad, "", "(lv.lv_style)i" } },
|
||||
{ "set_outline_width", { (const void*) &lv_style_set_outline_width, "", "(lv.lv_style)i" } },
|
||||
@ -102,9 +95,9 @@ const be_ntv_func_def_t lv_style_func[] = {
|
||||
{ "set_pad_top", { (const void*) &lv_style_set_pad_top, "", "(lv.lv_style)i" } },
|
||||
{ "set_pad_ver", { (const void*) &lv_style_set_pad_ver, "", "(lv.lv_style)i" } },
|
||||
{ "set_prop", { (const void*) &lv_style_set_prop, "", "(lv.lv_style)ii" } },
|
||||
{ "set_prop_meta", { (const void*) &lv_style_set_prop_meta, "", "(lv.lv_style)ii" } },
|
||||
{ "set_radius", { (const void*) &lv_style_set_radius, "", "(lv.lv_style)i" } },
|
||||
{ "set_shadow_color", { (const void*) &lv_style_set_shadow_color, "", "(lv.lv_style)(lv.lv_color)" } },
|
||||
{ "set_shadow_color_filtered", { (const void*) &lv_style_set_shadow_color_filtered, "", "(lv.lv_style)(lv.lv_color)" } },
|
||||
{ "set_shadow_ofs_x", { (const void*) &lv_style_set_shadow_ofs_x, "", "(lv.lv_style)i" } },
|
||||
{ "set_shadow_ofs_y", { (const void*) &lv_style_set_shadow_ofs_y, "", "(lv.lv_style)i" } },
|
||||
{ "set_shadow_opa", { (const void*) &lv_style_set_shadow_opa, "", "(lv.lv_style)i" } },
|
||||
@ -113,7 +106,6 @@ const be_ntv_func_def_t lv_style_func[] = {
|
||||
{ "set_size", { (const void*) &lv_style_set_size, "", "(lv.lv_style)i" } },
|
||||
{ "set_text_align", { (const void*) &lv_style_set_text_align, "", "(lv.lv_style)i" } },
|
||||
{ "set_text_color", { (const void*) &lv_style_set_text_color, "", "(lv.lv_style)(lv.lv_color)" } },
|
||||
{ "set_text_color_filtered", { (const void*) &lv_style_set_text_color_filtered, "", "(lv.lv_style)(lv.lv_color)" } },
|
||||
{ "set_text_decor", { (const void*) &lv_style_set_text_decor, "", "(lv.lv_style)i" } },
|
||||
{ "set_text_font", { (const void*) &lv_style_set_text_font, "", "(lv.lv_style)(lv.lv_font)" } },
|
||||
{ "set_text_letter_space", { (const void*) &lv_style_set_text_letter_space, "", "(lv.lv_style)i" } },
|
||||
@ -121,6 +113,8 @@ const be_ntv_func_def_t lv_style_func[] = {
|
||||
{ "set_text_opa", { (const void*) &lv_style_set_text_opa, "", "(lv.lv_style)i" } },
|
||||
{ "set_transform_angle", { (const void*) &lv_style_set_transform_angle, "", "(lv.lv_style)i" } },
|
||||
{ "set_transform_height", { (const void*) &lv_style_set_transform_height, "", "(lv.lv_style)i" } },
|
||||
{ "set_transform_pivot_x", { (const void*) &lv_style_set_transform_pivot_x, "", "(lv.lv_style)i" } },
|
||||
{ "set_transform_pivot_y", { (const void*) &lv_style_set_transform_pivot_y, "", "(lv.lv_style)i" } },
|
||||
{ "set_transform_width", { (const void*) &lv_style_set_transform_width, "", "(lv.lv_style)i" } },
|
||||
{ "set_transform_zoom", { (const void*) &lv_style_set_transform_zoom, "", "(lv.lv_style)i" } },
|
||||
{ "set_transition", { (const void*) &lv_style_set_transition, "", "(lv.lv_style)(lv.lv_style_transition_dsc)" } },
|
||||
@ -170,12 +164,14 @@ const be_ntv_func_def_t lv_img_func[] = {
|
||||
const be_ntv_func_def_t lv_disp_func[] = {
|
||||
{ "clean_dcache", { (const void*) &lv_disp_clean_dcache, "", "(lv.lv_disp)" } },
|
||||
{ "dpx", { (const void*) &lv_disp_dpx, "i", "(lv.lv_disp)i" } },
|
||||
{ "enable_invalidation", { (const void*) &lv_disp_enable_invalidation, "", "(lv.lv_disp)b" } },
|
||||
{ "get_inactive_time", { (const void*) &lv_disp_get_inactive_time, "i", "(lv.lv_disp)" } },
|
||||
{ "get_layer_sys", { (const void*) &lv_disp_get_layer_sys, "lv.lv_obj", "(lv.lv_disp)" } },
|
||||
{ "get_layer_top", { (const void*) &lv_disp_get_layer_top, "lv.lv_obj", "(lv.lv_disp)" } },
|
||||
{ "get_scr_act", { (const void*) &lv_disp_get_scr_act, "lv.lv_obj", "(lv.lv_disp)" } },
|
||||
{ "get_scr_prev", { (const void*) &lv_disp_get_scr_prev, "lv.lv_obj", "(lv.lv_disp)" } },
|
||||
{ "get_theme", { (const void*) &lv_disp_get_theme, "lv.lv_theme", "(lv.lv_disp)" } },
|
||||
{ "is_invalidation_enabled", { (const void*) &lv_disp_is_invalidation_enabled, "b", "(lv.lv_disp)" } },
|
||||
{ "load_scr", { (const void*) &lv_disp_load_scr, "", "(lv.lv_obj)" } },
|
||||
{ "set_bg_color", { (const void*) &lv_disp_set_bg_color, "", "(lv.lv_disp)(lv.lv_color)" } },
|
||||
{ "set_bg_image", { (const void*) &lv_disp_set_bg_image, "", "(lv.lv_disp)." } },
|
||||
@ -241,6 +237,7 @@ const be_ntv_func_def_t lv_obj_func[] = {
|
||||
{ "get_self_width", { (const void*) &lv_obj_get_self_width, "i", "(lv.lv_obj)" } },
|
||||
{ "get_state", { (const void*) &lv_obj_get_state, "i", "(lv.lv_obj)" } },
|
||||
{ "get_style_align", { (const void*) &lv_obj_get_style_align, "i", "(lv.lv_obj)i" } },
|
||||
{ "get_style_anim", { (const void*) &lv_obj_get_style_anim, "lv.lv_anim", "(lv.lv_obj)i" } },
|
||||
{ "get_style_anim_speed", { (const void*) &lv_obj_get_style_anim_speed, "i", "(lv.lv_obj)i" } },
|
||||
{ "get_style_anim_time", { (const void*) &lv_obj_get_style_anim_time, "i", "(lv.lv_obj)i" } },
|
||||
{ "get_style_arc_color", { (const void*) &lv_obj_get_style_arc_color, "lv.lv_color", "(lv.lv_obj)i" } },
|
||||
@ -339,6 +336,8 @@ const be_ntv_func_def_t lv_obj_func[] = {
|
||||
{ "get_style_text_opa", { (const void*) &lv_obj_get_style_text_opa, "i", "(lv.lv_obj)i" } },
|
||||
{ "get_style_transform_angle", { (const void*) &lv_obj_get_style_transform_angle, "i", "(lv.lv_obj)i" } },
|
||||
{ "get_style_transform_height", { (const void*) &lv_obj_get_style_transform_height, "i", "(lv.lv_obj)i" } },
|
||||
{ "get_style_transform_pivot_x", { (const void*) &lv_obj_get_style_transform_pivot_x, "i", "(lv.lv_obj)i" } },
|
||||
{ "get_style_transform_pivot_y", { (const void*) &lv_obj_get_style_transform_pivot_y, "i", "(lv.lv_obj)i" } },
|
||||
{ "get_style_transform_width", { (const void*) &lv_obj_get_style_transform_width, "i", "(lv.lv_obj)i" } },
|
||||
{ "get_style_transform_zoom", { (const void*) &lv_obj_get_style_transform_zoom, "i", "(lv.lv_obj)i" } },
|
||||
{ "get_style_transition", { (const void*) &lv_obj_get_style_transition, "lv.lv_style_transition_dsc", "(lv.lv_obj)i" } },
|
||||
@ -347,6 +346,7 @@ const be_ntv_func_def_t lv_obj_func[] = {
|
||||
{ "get_style_width", { (const void*) &lv_obj_get_style_width, "i", "(lv.lv_obj)i" } },
|
||||
{ "get_style_x", { (const void*) &lv_obj_get_style_x, "i", "(lv.lv_obj)i" } },
|
||||
{ "get_style_y", { (const void*) &lv_obj_get_style_y, "i", "(lv.lv_obj)i" } },
|
||||
{ "get_transformed_area", { (const void*) &lv_obj_get_transformed_area, "", "(lv.lv_obj)(lv.lv_area)bb" } },
|
||||
{ "get_user_data", { (const void*) &lv_obj_get_user_data, ".", "(lv.lv_obj)" } },
|
||||
{ "get_width", { (const void*) &lv_obj_get_width, "i", "(lv.lv_obj)" } },
|
||||
{ "get_x", { (const void*) &lv_obj_get_x, "i", "(lv.lv_obj)" } },
|
||||
@ -412,6 +412,7 @@ const be_ntv_func_def_t lv_obj_func[] = {
|
||||
{ "set_height", { (const void*) &lv_obj_set_height, "", "(lv.lv_obj)i" } },
|
||||
{ "set_layout", { (const void*) &lv_obj_set_layout, "", "(lv.lv_obj)i" } },
|
||||
{ "set_local_style_prop", { (const void*) &lv_obj_set_local_style_prop, "", "(lv.lv_obj)iii" } },
|
||||
{ "set_local_style_prop_meta", { (const void*) &lv_obj_set_local_style_prop_meta, "", "(lv.lv_obj)iii" } },
|
||||
{ "set_parent", { (const void*) &lv_obj_set_parent, "", "(lv.lv_obj)(lv.lv_obj)" } },
|
||||
{ "set_pos", { (const void*) &lv_obj_set_pos, "", "(lv.lv_obj)ii" } },
|
||||
{ "set_scroll_dir", { (const void*) &lv_obj_set_scroll_dir, "", "(lv.lv_obj)i" } },
|
||||
@ -420,26 +421,23 @@ const be_ntv_func_def_t lv_obj_func[] = {
|
||||
{ "set_scrollbar_mode", { (const void*) &lv_obj_set_scrollbar_mode, "", "(lv.lv_obj)i" } },
|
||||
{ "set_size", { (const void*) &lv_obj_set_size, "", "(lv.lv_obj)ii" } },
|
||||
{ "set_style_align", { (const void*) &lv_obj_set_style_align, "", "(lv.lv_obj)ii" } },
|
||||
{ "set_style_anim", { (const void*) &lv_obj_set_style_anim, "", "(lv.lv_obj)(lv.lv_anim)i" } },
|
||||
{ "set_style_anim_speed", { (const void*) &lv_obj_set_style_anim_speed, "", "(lv.lv_obj)ii" } },
|
||||
{ "set_style_anim_time", { (const void*) &lv_obj_set_style_anim_time, "", "(lv.lv_obj)ii" } },
|
||||
{ "set_style_arc_color", { (const void*) &lv_obj_set_style_arc_color, "", "(lv.lv_obj)(lv.lv_color)i" } },
|
||||
{ "set_style_arc_color_filtered", { (const void*) &lv_obj_set_style_arc_color_filtered, "", "(lv.lv_obj)(lv.lv_color)i" } },
|
||||
{ "set_style_arc_img_src", { (const void*) &lv_obj_set_style_arc_img_src, "", "(lv.lv_obj).i" } },
|
||||
{ "set_style_arc_opa", { (const void*) &lv_obj_set_style_arc_opa, "", "(lv.lv_obj)ii" } },
|
||||
{ "set_style_arc_rounded", { (const void*) &lv_obj_set_style_arc_rounded, "", "(lv.lv_obj)bi" } },
|
||||
{ "set_style_arc_width", { (const void*) &lv_obj_set_style_arc_width, "", "(lv.lv_obj)ii" } },
|
||||
{ "set_style_base_dir", { (const void*) &lv_obj_set_style_base_dir, "", "(lv.lv_obj)ii" } },
|
||||
{ "set_style_bg_color", { (const void*) &lv_obj_set_style_bg_color, "", "(lv.lv_obj)(lv.lv_color)i" } },
|
||||
{ "set_style_bg_color_filtered", { (const void*) &lv_obj_set_style_bg_color_filtered, "", "(lv.lv_obj)(lv.lv_color)i" } },
|
||||
{ "set_style_bg_dither_mode", { (const void*) &lv_obj_set_style_bg_dither_mode, "", "(lv.lv_obj)ii" } },
|
||||
{ "set_style_bg_grad", { (const void*) &lv_obj_set_style_bg_grad, "", "(lv.lv_obj)(lv.lv_grad_dsc)i" } },
|
||||
{ "set_style_bg_grad_color", { (const void*) &lv_obj_set_style_bg_grad_color, "", "(lv.lv_obj)(lv.lv_color)i" } },
|
||||
{ "set_style_bg_grad_color_filtered", { (const void*) &lv_obj_set_style_bg_grad_color_filtered, "", "(lv.lv_obj)(lv.lv_color)i" } },
|
||||
{ "set_style_bg_grad_dir", { (const void*) &lv_obj_set_style_bg_grad_dir, "", "(lv.lv_obj)ii" } },
|
||||
{ "set_style_bg_grad_stop", { (const void*) &lv_obj_set_style_bg_grad_stop, "", "(lv.lv_obj)ii" } },
|
||||
{ "set_style_bg_img_opa", { (const void*) &lv_obj_set_style_bg_img_opa, "", "(lv.lv_obj)ii" } },
|
||||
{ "set_style_bg_img_recolor", { (const void*) &lv_obj_set_style_bg_img_recolor, "", "(lv.lv_obj)(lv.lv_color)i" } },
|
||||
{ "set_style_bg_img_recolor_filtered", { (const void*) &lv_obj_set_style_bg_img_recolor_filtered, "", "(lv.lv_obj)(lv.lv_color)i" } },
|
||||
{ "set_style_bg_img_recolor_opa", { (const void*) &lv_obj_set_style_bg_img_recolor_opa, "", "(lv.lv_obj)ii" } },
|
||||
{ "set_style_bg_img_src", { (const void*) &lv_obj_set_style_bg_img_src, "", "(lv.lv_obj).i" } },
|
||||
{ "set_style_bg_img_tiled", { (const void*) &lv_obj_set_style_bg_img_tiled, "", "(lv.lv_obj)bi" } },
|
||||
@ -447,7 +445,6 @@ const be_ntv_func_def_t lv_obj_func[] = {
|
||||
{ "set_style_bg_opa", { (const void*) &lv_obj_set_style_bg_opa, "", "(lv.lv_obj)ii" } },
|
||||
{ "set_style_blend_mode", { (const void*) &lv_obj_set_style_blend_mode, "", "(lv.lv_obj)ii" } },
|
||||
{ "set_style_border_color", { (const void*) &lv_obj_set_style_border_color, "", "(lv.lv_obj)(lv.lv_color)i" } },
|
||||
{ "set_style_border_color_filtered", { (const void*) &lv_obj_set_style_border_color_filtered, "", "(lv.lv_obj)(lv.lv_color)i" } },
|
||||
{ "set_style_border_opa", { (const void*) &lv_obj_set_style_border_opa, "", "(lv.lv_obj)ii" } },
|
||||
{ "set_style_border_post", { (const void*) &lv_obj_set_style_border_post, "", "(lv.lv_obj)bi" } },
|
||||
{ "set_style_border_side", { (const void*) &lv_obj_set_style_border_side, "", "(lv.lv_obj)ii" } },
|
||||
@ -473,11 +470,9 @@ const be_ntv_func_def_t lv_obj_func[] = {
|
||||
{ "set_style_height", { (const void*) &lv_obj_set_style_height, "", "(lv.lv_obj)ii" } },
|
||||
{ "set_style_img_opa", { (const void*) &lv_obj_set_style_img_opa, "", "(lv.lv_obj)ii" } },
|
||||
{ "set_style_img_recolor", { (const void*) &lv_obj_set_style_img_recolor, "", "(lv.lv_obj)(lv.lv_color)i" } },
|
||||
{ "set_style_img_recolor_filtered", { (const void*) &lv_obj_set_style_img_recolor_filtered, "", "(lv.lv_obj)(lv.lv_color)i" } },
|
||||
{ "set_style_img_recolor_opa", { (const void*) &lv_obj_set_style_img_recolor_opa, "", "(lv.lv_obj)ii" } },
|
||||
{ "set_style_layout", { (const void*) &lv_obj_set_style_layout, "", "(lv.lv_obj)ii" } },
|
||||
{ "set_style_line_color", { (const void*) &lv_obj_set_style_line_color, "", "(lv.lv_obj)(lv.lv_color)i" } },
|
||||
{ "set_style_line_color_filtered", { (const void*) &lv_obj_set_style_line_color_filtered, "", "(lv.lv_obj)(lv.lv_color)i" } },
|
||||
{ "set_style_line_dash_gap", { (const void*) &lv_obj_set_style_line_dash_gap, "", "(lv.lv_obj)ii" } },
|
||||
{ "set_style_line_dash_width", { (const void*) &lv_obj_set_style_line_dash_width, "", "(lv.lv_obj)ii" } },
|
||||
{ "set_style_line_opa", { (const void*) &lv_obj_set_style_line_opa, "", "(lv.lv_obj)ii" } },
|
||||
@ -489,7 +484,6 @@ const be_ntv_func_def_t lv_obj_func[] = {
|
||||
{ "set_style_min_width", { (const void*) &lv_obj_set_style_min_width, "", "(lv.lv_obj)ii" } },
|
||||
{ "set_style_opa", { (const void*) &lv_obj_set_style_opa, "", "(lv.lv_obj)ii" } },
|
||||
{ "set_style_outline_color", { (const void*) &lv_obj_set_style_outline_color, "", "(lv.lv_obj)(lv.lv_color)i" } },
|
||||
{ "set_style_outline_color_filtered", { (const void*) &lv_obj_set_style_outline_color_filtered, "", "(lv.lv_obj)(lv.lv_color)i" } },
|
||||
{ "set_style_outline_opa", { (const void*) &lv_obj_set_style_outline_opa, "", "(lv.lv_obj)ii" } },
|
||||
{ "set_style_outline_pad", { (const void*) &lv_obj_set_style_outline_pad, "", "(lv.lv_obj)ii" } },
|
||||
{ "set_style_outline_width", { (const void*) &lv_obj_set_style_outline_width, "", "(lv.lv_obj)ii" } },
|
||||
@ -505,7 +499,6 @@ const be_ntv_func_def_t lv_obj_func[] = {
|
||||
{ "set_style_pad_ver", { (const void*) &lv_obj_set_style_pad_ver, "", "(lv.lv_obj)ii" } },
|
||||
{ "set_style_radius", { (const void*) &lv_obj_set_style_radius, "", "(lv.lv_obj)ii" } },
|
||||
{ "set_style_shadow_color", { (const void*) &lv_obj_set_style_shadow_color, "", "(lv.lv_obj)(lv.lv_color)i" } },
|
||||
{ "set_style_shadow_color_filtered", { (const void*) &lv_obj_set_style_shadow_color_filtered, "", "(lv.lv_obj)(lv.lv_color)i" } },
|
||||
{ "set_style_shadow_ofs_x", { (const void*) &lv_obj_set_style_shadow_ofs_x, "", "(lv.lv_obj)ii" } },
|
||||
{ "set_style_shadow_ofs_y", { (const void*) &lv_obj_set_style_shadow_ofs_y, "", "(lv.lv_obj)ii" } },
|
||||
{ "set_style_shadow_opa", { (const void*) &lv_obj_set_style_shadow_opa, "", "(lv.lv_obj)ii" } },
|
||||
@ -514,7 +507,6 @@ const be_ntv_func_def_t lv_obj_func[] = {
|
||||
{ "set_style_size", { (const void*) &lv_obj_set_style_size, "", "(lv.lv_obj)ii" } },
|
||||
{ "set_style_text_align", { (const void*) &lv_obj_set_style_text_align, "", "(lv.lv_obj)ii" } },
|
||||
{ "set_style_text_color", { (const void*) &lv_obj_set_style_text_color, "", "(lv.lv_obj)(lv.lv_color)i" } },
|
||||
{ "set_style_text_color_filtered", { (const void*) &lv_obj_set_style_text_color_filtered, "", "(lv.lv_obj)(lv.lv_color)i" } },
|
||||
{ "set_style_text_decor", { (const void*) &lv_obj_set_style_text_decor, "", "(lv.lv_obj)ii" } },
|
||||
{ "set_style_text_font", { (const void*) &lv_obj_set_style_text_font, "", "(lv.lv_obj)(lv.lv_font)i" } },
|
||||
{ "set_style_text_letter_space", { (const void*) &lv_obj_set_style_text_letter_space, "", "(lv.lv_obj)ii" } },
|
||||
@ -522,6 +514,8 @@ const be_ntv_func_def_t lv_obj_func[] = {
|
||||
{ "set_style_text_opa", { (const void*) &lv_obj_set_style_text_opa, "", "(lv.lv_obj)ii" } },
|
||||
{ "set_style_transform_angle", { (const void*) &lv_obj_set_style_transform_angle, "", "(lv.lv_obj)ii" } },
|
||||
{ "set_style_transform_height", { (const void*) &lv_obj_set_style_transform_height, "", "(lv.lv_obj)ii" } },
|
||||
{ "set_style_transform_pivot_x", { (const void*) &lv_obj_set_style_transform_pivot_x, "", "(lv.lv_obj)ii" } },
|
||||
{ "set_style_transform_pivot_y", { (const void*) &lv_obj_set_style_transform_pivot_y, "", "(lv.lv_obj)ii" } },
|
||||
{ "set_style_transform_width", { (const void*) &lv_obj_set_style_transform_width, "", "(lv.lv_obj)ii" } },
|
||||
{ "set_style_transform_zoom", { (const void*) &lv_obj_set_style_transform_zoom, "", "(lv.lv_obj)ii" } },
|
||||
{ "set_style_transition", { (const void*) &lv_obj_set_style_transition, "", "(lv.lv_obj)(lv.lv_style_transition_dsc)i" } },
|
||||
@ -535,6 +529,7 @@ const be_ntv_func_def_t lv_obj_func[] = {
|
||||
{ "set_x", { (const void*) &lv_obj_set_x, "", "(lv.lv_obj)i" } },
|
||||
{ "set_y", { (const void*) &lv_obj_set_y, "", "(lv.lv_obj)i" } },
|
||||
{ "swap", { (const void*) &lv_obj_swap, "", "(lv.lv_obj)(lv.lv_obj)" } },
|
||||
{ "transform_point", { (const void*) &lv_obj_transform_point, "", "(lv.lv_obj)(lv.lv_point)bb" } },
|
||||
{ "tree_walk", { (const void*) &lv_obj_tree_walk, "", "(lv.lv_obj)^lv_obj_tree_walk_cb^." } },
|
||||
{ "update_layout", { (const void*) &lv_obj_update_layout, "", "(lv.lv_obj)" } },
|
||||
{ "update_snap", { (const void*) &lv_obj_update_snap, "", "(lv.lv_obj)i" } },
|
||||
@ -548,6 +543,7 @@ const be_ntv_func_def_t lv_group_func[] = {
|
||||
{ "focus_next", { (const void*) &lv_group_focus_next, "", "(lv.lv_group)" } },
|
||||
{ "focus_obj", { (const void*) &lv_group_focus_obj, "", "(lv.lv_obj)" } },
|
||||
{ "focus_prev", { (const void*) &lv_group_focus_prev, "", "(lv.lv_group)" } },
|
||||
{ "get_edge_cb", { (const void*) &lv_group_get_edge_cb, "C", "(lv.lv_group)" } },
|
||||
{ "get_editing", { (const void*) &lv_group_get_editing, "b", "(lv.lv_group)" } },
|
||||
{ "get_focus_cb", { (const void*) &lv_group_get_focus_cb, "lv.lv_group_focus_cb", "(lv.lv_group)" } },
|
||||
{ "get_focused", { (const void*) &lv_group_get_focused, "lv.lv_obj", "(lv.lv_group)" } },
|
||||
@ -557,6 +553,7 @@ const be_ntv_func_def_t lv_group_func[] = {
|
||||
{ "remove_obj", { (const void*) &lv_group_remove_obj, "", "(lv.lv_obj)" } },
|
||||
{ "send_data", { (const void*) &lv_group_send_data, "i", "(lv.lv_group)i" } },
|
||||
{ "set_default", { (const void*) &lv_group_set_default, "", "(lv.lv_group)" } },
|
||||
{ "set_edge_cb", { (const void*) &lv_group_set_edge_cb, "", "(lv.lv_group)^lv_group_edge_cb^" } },
|
||||
{ "set_editing", { (const void*) &lv_group_set_editing, "", "(lv.lv_group)b" } },
|
||||
{ "set_focus_cb", { (const void*) &lv_group_set_focus_cb, "", "(lv.lv_group)^lv_group_focus_cb^" } },
|
||||
{ "set_refocus_policy", { (const void*) &lv_group_set_refocus_policy, "", "(lv.lv_group)(lv.lv_group_refocus_policy)" } },
|
||||
@ -706,9 +703,9 @@ const be_ntv_func_def_t lv_spinbox_func[] = {
|
||||
{ "get_step", { (const void*) &lv_spinbox_get_step, "i", "(lv.lv_obj)" } },
|
||||
{ "get_value", { (const void*) &lv_spinbox_get_value, "i", "(lv.lv_obj)" } },
|
||||
{ "increment", { (const void*) &lv_spinbox_increment, "", "(lv.lv_obj)" } },
|
||||
{ "set_cursor_pos", { (const void*) &lv_spinbox_set_cursor_pos, "", "(lv.lv_obj)i" } },
|
||||
{ "set_digit_format", { (const void*) &lv_spinbox_set_digit_format, "", "(lv.lv_obj)ii" } },
|
||||
{ "set_digit_step_direction", { (const void*) &lv_spinbox_set_digit_step_direction, "", "(lv.lv_obj)i" } },
|
||||
{ "set_pos", { (const void*) &lv_spinbox_set_pos, "", "(lv.lv_obj)i" } },
|
||||
{ "set_range", { (const void*) &lv_spinbox_set_range, "", "(lv.lv_obj)ii" } },
|
||||
{ "set_rollover", { (const void*) &lv_spinbox_set_rollover, "", "(lv.lv_obj)b" } },
|
||||
{ "set_step", { (const void*) &lv_spinbox_set_step, "", "(lv.lv_obj)i" } },
|
||||
@ -734,6 +731,7 @@ const be_ntv_func_def_t lv_anim_func[] = {
|
||||
{ "init", { (const void*) &lv_anim_init, "", "(lv.lv_anim)" } },
|
||||
{ "set_custom_exec_cb", { (const void*) &lv_anim_set_custom_exec_cb, "", "(lv.lv_anim)c" } },
|
||||
{ "set_delay", { (const void*) &lv_anim_set_delay, "", "(lv.lv_anim)i" } },
|
||||
{ "set_deleted_cb", { (const void*) &lv_anim_set_deleted_cb, "", "(lv.lv_anim)^lv_anim_deleted_cb^" } },
|
||||
{ "set_early_apply", { (const void*) &lv_anim_set_early_apply, "", "(lv.lv_anim)b" } },
|
||||
{ "set_exec_cb", { (const void*) &lv_anim_set_exec_cb, "", "(lv.lv_anim)c" } },
|
||||
{ "set_get_value_cb", { (const void*) &lv_anim_set_get_value_cb, "", "(lv.lv_anim)c" } },
|
||||
@ -767,6 +765,7 @@ const be_ntv_func_def_t lv_timer_func[] = {
|
||||
/* `lv_arc` methods */
|
||||
#ifdef BE_LV_WIDGET_ARC
|
||||
const be_ntv_func_def_t lv_arc_func[] = {
|
||||
{ "align_obj_to_angle", { (const void*) &lv_arc_align_obj_to_angle, "", "(lv.lv_obj)(lv.lv_obj)i" } },
|
||||
{ "get_angle_end", { (const void*) &lv_arc_get_angle_end, "i", "(lv.lv_obj)" } },
|
||||
{ "get_angle_start", { (const void*) &lv_arc_get_angle_start, "i", "(lv.lv_obj)" } },
|
||||
{ "get_bg_angle_end", { (const void*) &lv_arc_get_bg_angle_end, "i", "(lv.lv_obj)" } },
|
||||
@ -775,6 +774,7 @@ const be_ntv_func_def_t lv_arc_func[] = {
|
||||
{ "get_min_value", { (const void*) &lv_arc_get_min_value, "i", "(lv.lv_obj)" } },
|
||||
{ "get_mode", { (const void*) &lv_arc_get_mode, "i", "(lv.lv_obj)" } },
|
||||
{ "get_value", { (const void*) &lv_arc_get_value, "i", "(lv.lv_obj)" } },
|
||||
{ "rotate_obj_to_angle", { (const void*) &lv_arc_rotate_obj_to_angle, "", "(lv.lv_obj)(lv.lv_obj)i" } },
|
||||
{ "set_angles", { (const void*) &lv_arc_set_angles, "", "(lv.lv_obj)ii" } },
|
||||
{ "set_bg_angles", { (const void*) &lv_arc_set_bg_angles, "", "(lv.lv_obj)ii" } },
|
||||
{ "set_bg_end_angle", { (const void*) &lv_arc_set_bg_end_angle, "", "(lv.lv_obj)i" } },
|
||||
@ -872,6 +872,7 @@ const be_ntv_func_def_t lv_dropdown_func[] = {
|
||||
{ "get_dir", { (const void*) &lv_dropdown_get_dir, "i", "(lv.lv_obj)" } },
|
||||
{ "get_list", { (const void*) &lv_dropdown_get_list, "lv.lv_obj", "(lv.lv_obj)" } },
|
||||
{ "get_option_cnt", { (const void*) &lv_dropdown_get_option_cnt, "i", "(lv.lv_obj)" } },
|
||||
{ "get_option_index", { (const void*) &lv_dropdown_get_option_index, "i", "(lv.lv_obj)s" } },
|
||||
{ "get_options", { (const void*) &lv_dropdown_get_options, "s", "(lv.lv_obj)" } },
|
||||
{ "get_selected", { (const void*) &lv_dropdown_get_selected, "i", "(lv.lv_obj)" } },
|
||||
{ "get_selected_highlight", { (const void*) &lv_dropdown_get_selected_highlight, "b", "(lv.lv_obj)" } },
|
||||
@ -994,6 +995,7 @@ const be_ntv_func_def_t lv_textarea_func[] = {
|
||||
{ "get_label", { (const void*) &lv_textarea_get_label, "lv.lv_obj", "(lv.lv_obj)" } },
|
||||
{ "get_max_length", { (const void*) &lv_textarea_get_max_length, "i", "(lv.lv_obj)" } },
|
||||
{ "get_one_line", { (const void*) &lv_textarea_get_one_line, "b", "(lv.lv_obj)" } },
|
||||
{ "get_password_bullet", { (const void*) &lv_textarea_get_password_bullet, "s", "(lv.lv_obj)" } },
|
||||
{ "get_password_mode", { (const void*) &lv_textarea_get_password_mode, "b", "(lv.lv_obj)" } },
|
||||
{ "get_password_show_time", { (const void*) &lv_textarea_get_password_show_time, "i", "(lv.lv_obj)" } },
|
||||
{ "get_placeholder_text", { (const void*) &lv_textarea_get_placeholder_text, "s", "(lv.lv_obj)" } },
|
||||
@ -1006,6 +1008,7 @@ const be_ntv_func_def_t lv_textarea_func[] = {
|
||||
{ "set_insert_replace", { (const void*) &lv_textarea_set_insert_replace, "", "(lv.lv_obj)s" } },
|
||||
{ "set_max_length", { (const void*) &lv_textarea_set_max_length, "", "(lv.lv_obj)i" } },
|
||||
{ "set_one_line", { (const void*) &lv_textarea_set_one_line, "", "(lv.lv_obj)b" } },
|
||||
{ "set_password_bullet", { (const void*) &lv_textarea_set_password_bullet, "", "(lv.lv_obj)s" } },
|
||||
{ "set_password_mode", { (const void*) &lv_textarea_set_password_mode, "", "(lv.lv_obj)b" } },
|
||||
{ "set_password_show_time", { (const void*) &lv_textarea_set_password_show_time, "", "(lv.lv_obj)i" } },
|
||||
{ "set_placeholder_text", { (const void*) &lv_textarea_set_placeholder_text, "", "(lv.lv_obj)s" } },
|
||||
|
@ -31,6 +31,7 @@ const be_ntv_func_def_t lv_func[] = {
|
||||
{ "anim_del", { (const void*) &lv_anim_del, "b", ".c" } },
|
||||
{ "anim_del_all", { (const void*) &lv_anim_del_all, "", "" } },
|
||||
{ "anim_get", { (const void*) &lv_anim_get, "lv.lv_anim", ".c" } },
|
||||
{ "anim_get_timer", { (const void*) &lv_anim_get_timer, "lv.lv_timer", "" } },
|
||||
{ "anim_refr_now", { (const void*) &lv_anim_refr_now, "", "" } },
|
||||
{ "anim_speed_to_time", { (const void*) &lv_anim_speed_to_time, "i", "iii" } },
|
||||
{ "area_align", { (const void*) &lv_area_align, "", "(lv.lv_area)(lv.lv_area)iii" } },
|
||||
@ -80,6 +81,10 @@ const be_ntv_func_def_t lv_func[] = {
|
||||
{ "draw_init", { (const void*) &lv_draw_init, "", "" } },
|
||||
{ "draw_label", { (const void*) &lv_draw_label, "", "(lv.lv_draw_ctx)(lv.lv_draw_label_dsc)(lv.lv_area)s(lv.lv_draw_label_hint)" } },
|
||||
{ "draw_label_dsc_init", { (const void*) &lv_draw_label_dsc_init, "", "(lv.lv_draw_label_dsc)" } },
|
||||
{ "draw_layer_adjust", { (const void*) &lv_draw_layer_adjust, "", "(lv.lv_draw_ctx)(lv.lv_draw_layer_ctx)(lv.lv_draw_layer_flags)" } },
|
||||
{ "draw_layer_blend", { (const void*) &lv_draw_layer_blend, "", "(lv.lv_draw_ctx)(lv.lv_draw_layer_ctx)(lv.lv_draw_img_dsc)" } },
|
||||
{ "draw_layer_create", { (const void*) &lv_draw_layer_create, "lv.lv_draw_layer_ctx", "(lv.lv_draw_ctx)(lv.lv_area)(lv.lv_draw_layer_flags)" } },
|
||||
{ "draw_layer_destroy", { (const void*) &lv_draw_layer_destroy, "", "(lv.lv_draw_ctx)(lv.lv_draw_layer_ctx)" } },
|
||||
{ "draw_letter", { (const void*) &lv_draw_letter, "", "(lv.lv_draw_ctx)(lv.lv_draw_label_dsc)(lv.lv_point)i" } },
|
||||
{ "draw_line", { (const void*) &lv_draw_line, "", "(lv.lv_draw_ctx)(lv.lv_draw_line_dsc)(lv.lv_point)(lv.lv_point)" } },
|
||||
{ "draw_line_dsc_init", { (const void*) &lv_draw_line_dsc_init, "", "(lv.lv_draw_line_dsc)" } },
|
||||
@ -101,7 +106,9 @@ const be_ntv_func_def_t lv_func[] = {
|
||||
{ "draw_polygon", { (const void*) &lv_draw_polygon, "", "(lv.lv_draw_ctx)(lv.lv_draw_rect_dsc)(lv.lv_point_arr)i" } },
|
||||
{ "draw_rect", { (const void*) &lv_draw_rect, "", "(lv.lv_draw_ctx)(lv.lv_draw_rect_dsc)(lv.lv_area)" } },
|
||||
{ "draw_rect_dsc_init", { (const void*) &lv_draw_rect_dsc_init, "", "(lv.lv_draw_rect_dsc)" } },
|
||||
{ "draw_transform", { (const void*) &lv_draw_transform, "", "(lv.lv_draw_ctx)(lv.lv_area).iii(lv.lv_draw_img_dsc)i(lv.lv_color)(lv.lv_opa)" } },
|
||||
{ "draw_triangle", { (const void*) &lv_draw_triangle, "", "(lv.lv_draw_ctx)(lv.lv_draw_rect_dsc)(lv.lv_point_arr)" } },
|
||||
{ "draw_wait_for_finish", { (const void*) &lv_draw_wait_for_finish, "", "(lv.lv_draw_ctx)" } },
|
||||
{ "event_register_id", { (const void*) &lv_event_register_id, "i", "" } },
|
||||
{ "event_send", { (const void*) &lv_event_send, "i", "(lv.lv_obj)i." } },
|
||||
{ "event_set_cover_res", { (const void*) &lv_event_set_cover_res, "", "(lv.lv_event)(lv.lv_cover_res)" } },
|
||||
@ -135,6 +142,7 @@ const be_ntv_func_def_t lv_func[] = {
|
||||
{ "obj_draw_part_check_type", { (const void*) &lv_obj_draw_part_check_type, "b", "(lv.lv_obj_draw_part_dsc)(lv._lv_obj_class)i" } },
|
||||
{ "obj_enable_style_refresh", { (const void*) &lv_obj_enable_style_refresh, "", "b" } },
|
||||
{ "obj_event_base", { (const void*) &lv_obj_event_base, "i", "(lv.lv_obj_class)(lv.lv_event)" } },
|
||||
{ "obj_redraw", { (const void*) &lv_obj_redraw, "", "(lv.lv_draw_ctx)(lv.lv_obj)" } },
|
||||
{ "obj_report_style_change", { (const void*) &lv_obj_report_style_change, "", "(lv.lv_style)" } },
|
||||
{ "obj_style_get_selector_part", { (const void*) &lv_obj_style_get_selector_part, "i", "i" } },
|
||||
{ "obj_style_get_selector_state", { (const void*) &lv_obj_style_get_selector_state, "i", "i" } },
|
||||
@ -142,15 +150,17 @@ const be_ntv_func_def_t lv_func[] = {
|
||||
{ "palette_lighten", { (const void*) &lv_palette_lighten, "lv.lv_color", "ii" } },
|
||||
{ "palette_main", { (const void*) &lv_palette_main, "lv.lv_color", "i" } },
|
||||
{ "pct", { (const void*) &lv_pct, "i", "i" } },
|
||||
{ "point_transform", { (const void*) &lv_point_transform, "", "(lv.lv_point)ii(lv.lv_point)" } },
|
||||
{ "rand", { (const void*) &lv_rand, "i", "ii" } },
|
||||
{ "refr_now", { (const void*) &lv_refr_now, "", "(lv.lv_disp)" } },
|
||||
{ "refr_obj", { (const void*) &lv_refr_obj, "", "(lv.lv_draw_ctx)(lv.lv_obj)" } },
|
||||
{ "scr_act", { (const void*) &lv_scr_act, "lv.lv_obj", "" } },
|
||||
{ "scr_load", { (const void*) &lv_scr_load, "", "(lv.lv_obj)" } },
|
||||
{ "scr_load_anim", { (const void*) &lv_scr_load_anim, "", "(lv.lv_obj)iiib" } },
|
||||
{ "sqrt", { (const void*) &lv_sqrt, "", "i(lv.lv_sqrt_res)i" } },
|
||||
{ "style_get_num_custom_props", { (const void*) &lv_style_get_num_custom_props, "i", "" } },
|
||||
{ "style_prop_get_default", { (const void*) &lv_style_prop_get_default, "i", "i" } },
|
||||
{ "style_register_prop", { (const void*) &lv_style_register_prop, "i", "" } },
|
||||
{ "style_prop_has_flag", { (const void*) &lv_style_prop_has_flag, "b", "ii" } },
|
||||
{ "style_register_prop", { (const void*) &lv_style_register_prop, "i", "i" } },
|
||||
{ "style_transition_dsc_init", { (const void*) &lv_style_transition_dsc_init, "", "(lv.lv_style_transition_dsc)(lv.lv_style_prop)cii." } },
|
||||
{ "task_handler", { (const void*) &lv_task_handler, "i", "" } },
|
||||
{ "theme_apply", { (const void*) &lv_theme_apply, "", "(lv.lv_obj)" } },
|
||||
@ -166,6 +176,7 @@ const be_ntv_func_def_t lv_func[] = {
|
||||
{ "theme_haspmota_init", { (const void*) &lv_theme_haspmota_init, "lv.lv_theme", "(lv.lv_disp)(lv.lv_color)(lv.lv_color)b(lv.lv_font)" } },
|
||||
{ "theme_haspmota_is_inited", { (const void*) &lv_theme_haspmota_is_inited, "b", "" } },
|
||||
{ "theme_mono_init", { (const void*) &lv_theme_mono_init, "lv.lv_theme", "(lv.lv_disp)b(lv.lv_font)" } },
|
||||
{ "theme_mono_is_inited", { (const void*) &lv_theme_mono_is_inited, "b", "" } },
|
||||
{ "theme_set_apply_cb", { (const void*) &lv_theme_set_apply_cb, "", "(lv.lv_theme)^lv_theme_apply_cb^" } },
|
||||
{ "theme_set_parent", { (const void*) &lv_theme_set_parent, "", "(lv.lv_theme)(lv.lv_theme)" } },
|
||||
{ "timer_create", { (const void*) &lv_timer_create, "lv.lv_timer", "^lv_timer_cb^i." } },
|
||||
@ -173,6 +184,7 @@ const be_ntv_func_def_t lv_func[] = {
|
||||
{ "timer_enable", { (const void*) &lv_timer_enable, "", "b" } },
|
||||
{ "timer_get_idle", { (const void*) &lv_timer_get_idle, "i", "" } },
|
||||
{ "timer_handler", { (const void*) &lv_timer_handler, "i", "" } },
|
||||
{ "timer_handler_run_in_period", { (const void*) &lv_timer_handler_run_in_period, "i", "i" } },
|
||||
{ "trigo_cos", { (const void*) &lv_trigo_cos, "i", "i" } },
|
||||
{ "trigo_sin", { (const void*) &lv_trigo_sin, "i", "i" } },
|
||||
|
||||
@ -311,6 +323,9 @@ const be_const_member_t lv0_constants[] = {
|
||||
{ "DITHER_ERR_DIFF", be_cconst_int(LV_DITHER_ERR_DIFF) },
|
||||
{ "DITHER_NONE", be_cconst_int(LV_DITHER_NONE) },
|
||||
{ "DITHER_ORDERED", be_cconst_int(LV_DITHER_ORDERED) },
|
||||
{ "DRAW_LAYER_FLAG_CAN_SUBDIVIDE", be_cconst_int(LV_DRAW_LAYER_FLAG_CAN_SUBDIVIDE) },
|
||||
{ "DRAW_LAYER_FLAG_HAS_ALPHA", be_cconst_int(LV_DRAW_LAYER_FLAG_HAS_ALPHA) },
|
||||
{ "DRAW_LAYER_FLAG_NONE", be_cconst_int(LV_DRAW_LAYER_FLAG_NONE) },
|
||||
{ "DRAW_MASK_LINE_SIDE_BOTTOM", be_cconst_int(LV_DRAW_MASK_LINE_SIDE_BOTTOM) },
|
||||
{ "DRAW_MASK_LINE_SIDE_LEFT", be_cconst_int(LV_DRAW_MASK_LINE_SIDE_LEFT) },
|
||||
{ "DRAW_MASK_LINE_SIDE_RIGHT", be_cconst_int(LV_DRAW_MASK_LINE_SIDE_RIGHT) },
|
||||
@ -439,6 +454,12 @@ const be_const_member_t lv0_constants[] = {
|
||||
{ "IMG_CF_RAW", be_cconst_int(LV_IMG_CF_RAW) },
|
||||
{ "IMG_CF_RAW_ALPHA", be_cconst_int(LV_IMG_CF_RAW_ALPHA) },
|
||||
{ "IMG_CF_RAW_CHROMA_KEYED", be_cconst_int(LV_IMG_CF_RAW_CHROMA_KEYED) },
|
||||
{ "IMG_CF_RGB565", be_cconst_int(LV_IMG_CF_RGB565) },
|
||||
{ "IMG_CF_RGB565A8", be_cconst_int(LV_IMG_CF_RGB565A8) },
|
||||
{ "IMG_CF_RGB888", be_cconst_int(LV_IMG_CF_RGB888) },
|
||||
{ "IMG_CF_RGBA5658", be_cconst_int(LV_IMG_CF_RGBA5658) },
|
||||
{ "IMG_CF_RGBA8888", be_cconst_int(LV_IMG_CF_RGBA8888) },
|
||||
{ "IMG_CF_RGBX8888", be_cconst_int(LV_IMG_CF_RGBX8888) },
|
||||
{ "IMG_CF_TRUE_COLOR", be_cconst_int(LV_IMG_CF_TRUE_COLOR) },
|
||||
{ "IMG_CF_TRUE_COLOR_ALPHA", be_cconst_int(LV_IMG_CF_TRUE_COLOR_ALPHA) },
|
||||
{ "IMG_CF_TRUE_COLOR_CHROMA_KEYED", be_cconst_int(LV_IMG_CF_TRUE_COLOR_CHROMA_KEYED) },
|
||||
@ -477,6 +498,9 @@ const be_const_member_t lv0_constants[] = {
|
||||
{ "LABEL_LONG_WRAP", be_cconst_int(LV_LABEL_LONG_WRAP) },
|
||||
{ "LABEL_POS_LAST", be_cconst_int(LV_LABEL_POS_LAST) },
|
||||
{ "LABEL_TEXT_SELECTION_OFF", be_cconst_int(LV_LABEL_TEXT_SELECTION_OFF) },
|
||||
{ "LAYER_TYPE_NONE", be_cconst_int(LV_LAYER_TYPE_NONE) },
|
||||
{ "LAYER_TYPE_SIMPLE", be_cconst_int(LV_LAYER_TYPE_SIMPLE) },
|
||||
{ "LAYER_TYPE_TRANSFORM", be_cconst_int(LV_LAYER_TYPE_TRANSFORM) },
|
||||
{ "LED_DRAW_PART_RECTANGLE", be_cconst_int(LV_LED_DRAW_PART_RECTANGLE) },
|
||||
{ "LOG_LEVEL_ERROR", be_cconst_int(LV_LOG_LEVEL_ERROR) },
|
||||
{ "LOG_LEVEL_INFO", be_cconst_int(LV_LOG_LEVEL_INFO) },
|
||||
@ -596,12 +620,18 @@ 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) },
|
||||
@ -632,26 +662,23 @@ const be_const_member_t lv0_constants[] = {
|
||||
{ "STATE_USER_3", be_cconst_int(LV_STATE_USER_3) },
|
||||
{ "STATE_USER_4", be_cconst_int(LV_STATE_USER_4) },
|
||||
{ "STYLE_ALIGN", be_cconst_int(LV_STYLE_ALIGN) },
|
||||
{ "STYLE_ANIM", be_cconst_int(LV_STYLE_ANIM) },
|
||||
{ "STYLE_ANIM_SPEED", be_cconst_int(LV_STYLE_ANIM_SPEED) },
|
||||
{ "STYLE_ANIM_TIME", be_cconst_int(LV_STYLE_ANIM_TIME) },
|
||||
{ "STYLE_ARC_COLOR", be_cconst_int(LV_STYLE_ARC_COLOR) },
|
||||
{ "STYLE_ARC_COLOR_FILTERED", be_cconst_int(LV_STYLE_ARC_COLOR_FILTERED) },
|
||||
{ "STYLE_ARC_IMG_SRC", be_cconst_int(LV_STYLE_ARC_IMG_SRC) },
|
||||
{ "STYLE_ARC_OPA", be_cconst_int(LV_STYLE_ARC_OPA) },
|
||||
{ "STYLE_ARC_ROUNDED", be_cconst_int(LV_STYLE_ARC_ROUNDED) },
|
||||
{ "STYLE_ARC_WIDTH", be_cconst_int(LV_STYLE_ARC_WIDTH) },
|
||||
{ "STYLE_BASE_DIR", be_cconst_int(LV_STYLE_BASE_DIR) },
|
||||
{ "STYLE_BG_COLOR", be_cconst_int(LV_STYLE_BG_COLOR) },
|
||||
{ "STYLE_BG_COLOR_FILTERED", be_cconst_int(LV_STYLE_BG_COLOR_FILTERED) },
|
||||
{ "STYLE_BG_DITHER_MODE", be_cconst_int(LV_STYLE_BG_DITHER_MODE) },
|
||||
{ "STYLE_BG_GRAD", be_cconst_int(LV_STYLE_BG_GRAD) },
|
||||
{ "STYLE_BG_GRAD_COLOR", be_cconst_int(LV_STYLE_BG_GRAD_COLOR) },
|
||||
{ "STYLE_BG_GRAD_COLOR_FILTERED", be_cconst_int(LV_STYLE_BG_GRAD_COLOR_FILTERED) },
|
||||
{ "STYLE_BG_GRAD_DIR", be_cconst_int(LV_STYLE_BG_GRAD_DIR) },
|
||||
{ "STYLE_BG_GRAD_STOP", be_cconst_int(LV_STYLE_BG_GRAD_STOP) },
|
||||
{ "STYLE_BG_IMG_OPA", be_cconst_int(LV_STYLE_BG_IMG_OPA) },
|
||||
{ "STYLE_BG_IMG_RECOLOR", be_cconst_int(LV_STYLE_BG_IMG_RECOLOR) },
|
||||
{ "STYLE_BG_IMG_RECOLOR_FILTERED", be_cconst_int(LV_STYLE_BG_IMG_RECOLOR_FILTERED) },
|
||||
{ "STYLE_BG_IMG_RECOLOR_OPA", be_cconst_int(LV_STYLE_BG_IMG_RECOLOR_OPA) },
|
||||
{ "STYLE_BG_IMG_SRC", be_cconst_int(LV_STYLE_BG_IMG_SRC) },
|
||||
{ "STYLE_BG_IMG_TILED", be_cconst_int(LV_STYLE_BG_IMG_TILED) },
|
||||
@ -659,7 +686,6 @@ const be_const_member_t lv0_constants[] = {
|
||||
{ "STYLE_BG_OPA", be_cconst_int(LV_STYLE_BG_OPA) },
|
||||
{ "STYLE_BLEND_MODE", be_cconst_int(LV_STYLE_BLEND_MODE) },
|
||||
{ "STYLE_BORDER_COLOR", be_cconst_int(LV_STYLE_BORDER_COLOR) },
|
||||
{ "STYLE_BORDER_COLOR_FILTERED", be_cconst_int(LV_STYLE_BORDER_COLOR_FILTERED) },
|
||||
{ "STYLE_BORDER_OPA", be_cconst_int(LV_STYLE_BORDER_OPA) },
|
||||
{ "STYLE_BORDER_POST", be_cconst_int(LV_STYLE_BORDER_POST) },
|
||||
{ "STYLE_BORDER_SIDE", be_cconst_int(LV_STYLE_BORDER_SIDE) },
|
||||
@ -670,11 +696,9 @@ const be_const_member_t lv0_constants[] = {
|
||||
{ "STYLE_HEIGHT", be_cconst_int(LV_STYLE_HEIGHT) },
|
||||
{ "STYLE_IMG_OPA", be_cconst_int(LV_STYLE_IMG_OPA) },
|
||||
{ "STYLE_IMG_RECOLOR", be_cconst_int(LV_STYLE_IMG_RECOLOR) },
|
||||
{ "STYLE_IMG_RECOLOR_FILTERED", be_cconst_int(LV_STYLE_IMG_RECOLOR_FILTERED) },
|
||||
{ "STYLE_IMG_RECOLOR_OPA", be_cconst_int(LV_STYLE_IMG_RECOLOR_OPA) },
|
||||
{ "STYLE_LAYOUT", be_cconst_int(LV_STYLE_LAYOUT) },
|
||||
{ "STYLE_LINE_COLOR", be_cconst_int(LV_STYLE_LINE_COLOR) },
|
||||
{ "STYLE_LINE_COLOR_FILTERED", be_cconst_int(LV_STYLE_LINE_COLOR_FILTERED) },
|
||||
{ "STYLE_LINE_DASH_GAP", be_cconst_int(LV_STYLE_LINE_DASH_GAP) },
|
||||
{ "STYLE_LINE_DASH_WIDTH", be_cconst_int(LV_STYLE_LINE_DASH_WIDTH) },
|
||||
{ "STYLE_LINE_OPA", be_cconst_int(LV_STYLE_LINE_OPA) },
|
||||
@ -686,7 +710,6 @@ const be_const_member_t lv0_constants[] = {
|
||||
{ "STYLE_MIN_WIDTH", be_cconst_int(LV_STYLE_MIN_WIDTH) },
|
||||
{ "STYLE_OPA", be_cconst_int(LV_STYLE_OPA) },
|
||||
{ "STYLE_OUTLINE_COLOR", be_cconst_int(LV_STYLE_OUTLINE_COLOR) },
|
||||
{ "STYLE_OUTLINE_COLOR_FILTERED", be_cconst_int(LV_STYLE_OUTLINE_COLOR_FILTERED) },
|
||||
{ "STYLE_OUTLINE_OPA", be_cconst_int(LV_STYLE_OUTLINE_OPA) },
|
||||
{ "STYLE_OUTLINE_PAD", be_cconst_int(LV_STYLE_OUTLINE_PAD) },
|
||||
{ "STYLE_OUTLINE_WIDTH", be_cconst_int(LV_STYLE_OUTLINE_WIDTH) },
|
||||
@ -699,8 +722,10 @@ const be_const_member_t lv0_constants[] = {
|
||||
{ "STYLE_PROP_ANY", be_cconst_int(LV_STYLE_PROP_ANY) },
|
||||
{ "STYLE_PROP_INV", be_cconst_int(LV_STYLE_PROP_INV) },
|
||||
{ "STYLE_RADIUS", be_cconst_int(LV_STYLE_RADIUS) },
|
||||
{ "STYLE_RES_FOUND", be_cconst_int(LV_STYLE_RES_FOUND) },
|
||||
{ "STYLE_RES_INHERIT", be_cconst_int(LV_STYLE_RES_INHERIT) },
|
||||
{ "STYLE_RES_NOT_FOUND", be_cconst_int(LV_STYLE_RES_NOT_FOUND) },
|
||||
{ "STYLE_SHADOW_COLOR", be_cconst_int(LV_STYLE_SHADOW_COLOR) },
|
||||
{ "STYLE_SHADOW_COLOR_FILTERED", be_cconst_int(LV_STYLE_SHADOW_COLOR_FILTERED) },
|
||||
{ "STYLE_SHADOW_OFS_X", be_cconst_int(LV_STYLE_SHADOW_OFS_X) },
|
||||
{ "STYLE_SHADOW_OFS_Y", be_cconst_int(LV_STYLE_SHADOW_OFS_Y) },
|
||||
{ "STYLE_SHADOW_OPA", be_cconst_int(LV_STYLE_SHADOW_OPA) },
|
||||
@ -708,7 +733,6 @@ const be_const_member_t lv0_constants[] = {
|
||||
{ "STYLE_SHADOW_WIDTH", be_cconst_int(LV_STYLE_SHADOW_WIDTH) },
|
||||
{ "STYLE_TEXT_ALIGN", be_cconst_int(LV_STYLE_TEXT_ALIGN) },
|
||||
{ "STYLE_TEXT_COLOR", be_cconst_int(LV_STYLE_TEXT_COLOR) },
|
||||
{ "STYLE_TEXT_COLOR_FILTERED", be_cconst_int(LV_STYLE_TEXT_COLOR_FILTERED) },
|
||||
{ "STYLE_TEXT_DECOR", be_cconst_int(LV_STYLE_TEXT_DECOR) },
|
||||
{ "STYLE_TEXT_FONT", be_cconst_int(LV_STYLE_TEXT_FONT) },
|
||||
{ "STYLE_TEXT_LETTER_SPACE", be_cconst_int(LV_STYLE_TEXT_LETTER_SPACE) },
|
||||
@ -716,6 +740,8 @@ const be_const_member_t lv0_constants[] = {
|
||||
{ "STYLE_TEXT_OPA", be_cconst_int(LV_STYLE_TEXT_OPA) },
|
||||
{ "STYLE_TRANSFORM_ANGLE", be_cconst_int(LV_STYLE_TRANSFORM_ANGLE) },
|
||||
{ "STYLE_TRANSFORM_HEIGHT", be_cconst_int(LV_STYLE_TRANSFORM_HEIGHT) },
|
||||
{ "STYLE_TRANSFORM_PIVOT_X", be_cconst_int(LV_STYLE_TRANSFORM_PIVOT_X) },
|
||||
{ "STYLE_TRANSFORM_PIVOT_Y", be_cconst_int(LV_STYLE_TRANSFORM_PIVOT_Y) },
|
||||
{ "STYLE_TRANSFORM_WIDTH", be_cconst_int(LV_STYLE_TRANSFORM_WIDTH) },
|
||||
{ "STYLE_TRANSFORM_ZOOM", be_cconst_int(LV_STYLE_TRANSFORM_ZOOM) },
|
||||
{ "STYLE_TRANSITION", be_cconst_int(LV_STYLE_TRANSITION) },
|
||||
|
@ -48,6 +48,7 @@ extern int lvbe_style_set_grid_cell_y_align(bvm *vm);
|
||||
extern int lvbe_style_reset(bvm *vm);
|
||||
extern int lvbe_style_remove_prop(bvm *vm);
|
||||
extern int lvbe_style_set_prop(bvm *vm);
|
||||
extern int lvbe_style_set_prop_meta(bvm *vm);
|
||||
extern int lvbe_style_get_prop(bvm *vm);
|
||||
extern int lvbe_style_get_prop_inlined(bvm *vm);
|
||||
extern int lvbe_style_is_empty(bvm *vm);
|
||||
@ -71,6 +72,8 @@ extern int lvbe_style_set_translate_x(bvm *vm);
|
||||
extern int lvbe_style_set_translate_y(bvm *vm);
|
||||
extern int lvbe_style_set_transform_zoom(bvm *vm);
|
||||
extern int lvbe_style_set_transform_angle(bvm *vm);
|
||||
extern int lvbe_style_set_transform_pivot_x(bvm *vm);
|
||||
extern int lvbe_style_set_transform_pivot_y(bvm *vm);
|
||||
extern int lvbe_style_set_pad_top(bvm *vm);
|
||||
extern int lvbe_style_set_pad_bottom(bvm *vm);
|
||||
extern int lvbe_style_set_pad_left(bvm *vm);
|
||||
@ -78,10 +81,8 @@ extern int lvbe_style_set_pad_right(bvm *vm);
|
||||
extern int lvbe_style_set_pad_row(bvm *vm);
|
||||
extern int lvbe_style_set_pad_column(bvm *vm);
|
||||
extern int lvbe_style_set_bg_color(bvm *vm);
|
||||
extern int lvbe_style_set_bg_color_filtered(bvm *vm);
|
||||
extern int lvbe_style_set_bg_opa(bvm *vm);
|
||||
extern int lvbe_style_set_bg_grad_color(bvm *vm);
|
||||
extern int lvbe_style_set_bg_grad_color_filtered(bvm *vm);
|
||||
extern int lvbe_style_set_bg_grad_dir(bvm *vm);
|
||||
extern int lvbe_style_set_bg_main_stop(bvm *vm);
|
||||
extern int lvbe_style_set_bg_grad_stop(bvm *vm);
|
||||
@ -90,18 +91,15 @@ extern int lvbe_style_set_bg_dither_mode(bvm *vm);
|
||||
extern int lvbe_style_set_bg_img_src(bvm *vm);
|
||||
extern int lvbe_style_set_bg_img_opa(bvm *vm);
|
||||
extern int lvbe_style_set_bg_img_recolor(bvm *vm);
|
||||
extern int lvbe_style_set_bg_img_recolor_filtered(bvm *vm);
|
||||
extern int lvbe_style_set_bg_img_recolor_opa(bvm *vm);
|
||||
extern int lvbe_style_set_bg_img_tiled(bvm *vm);
|
||||
extern int lvbe_style_set_border_color(bvm *vm);
|
||||
extern int lvbe_style_set_border_color_filtered(bvm *vm);
|
||||
extern int lvbe_style_set_border_opa(bvm *vm);
|
||||
extern int lvbe_style_set_border_width(bvm *vm);
|
||||
extern int lvbe_style_set_border_side(bvm *vm);
|
||||
extern int lvbe_style_set_border_post(bvm *vm);
|
||||
extern int lvbe_style_set_outline_width(bvm *vm);
|
||||
extern int lvbe_style_set_outline_color(bvm *vm);
|
||||
extern int lvbe_style_set_outline_color_filtered(bvm *vm);
|
||||
extern int lvbe_style_set_outline_opa(bvm *vm);
|
||||
extern int lvbe_style_set_outline_pad(bvm *vm);
|
||||
extern int lvbe_style_set_shadow_width(bvm *vm);
|
||||
@ -109,27 +107,22 @@ extern int lvbe_style_set_shadow_ofs_x(bvm *vm);
|
||||
extern int lvbe_style_set_shadow_ofs_y(bvm *vm);
|
||||
extern int lvbe_style_set_shadow_spread(bvm *vm);
|
||||
extern int lvbe_style_set_shadow_color(bvm *vm);
|
||||
extern int lvbe_style_set_shadow_color_filtered(bvm *vm);
|
||||
extern int lvbe_style_set_shadow_opa(bvm *vm);
|
||||
extern int lvbe_style_set_img_opa(bvm *vm);
|
||||
extern int lvbe_style_set_img_recolor(bvm *vm);
|
||||
extern int lvbe_style_set_img_recolor_filtered(bvm *vm);
|
||||
extern int lvbe_style_set_img_recolor_opa(bvm *vm);
|
||||
extern int lvbe_style_set_line_width(bvm *vm);
|
||||
extern int lvbe_style_set_line_dash_width(bvm *vm);
|
||||
extern int lvbe_style_set_line_dash_gap(bvm *vm);
|
||||
extern int lvbe_style_set_line_rounded(bvm *vm);
|
||||
extern int lvbe_style_set_line_color(bvm *vm);
|
||||
extern int lvbe_style_set_line_color_filtered(bvm *vm);
|
||||
extern int lvbe_style_set_line_opa(bvm *vm);
|
||||
extern int lvbe_style_set_arc_width(bvm *vm);
|
||||
extern int lvbe_style_set_arc_rounded(bvm *vm);
|
||||
extern int lvbe_style_set_arc_color(bvm *vm);
|
||||
extern int lvbe_style_set_arc_color_filtered(bvm *vm);
|
||||
extern int lvbe_style_set_arc_opa(bvm *vm);
|
||||
extern int lvbe_style_set_arc_img_src(bvm *vm);
|
||||
extern int lvbe_style_set_text_color(bvm *vm);
|
||||
extern int lvbe_style_set_text_color_filtered(bvm *vm);
|
||||
extern int lvbe_style_set_text_opa(bvm *vm);
|
||||
extern int lvbe_style_set_text_font(bvm *vm);
|
||||
extern int lvbe_style_set_text_letter_space(bvm *vm);
|
||||
@ -141,6 +134,7 @@ extern int lvbe_style_set_clip_corner(bvm *vm);
|
||||
extern int lvbe_style_set_opa(bvm *vm);
|
||||
extern int lvbe_style_set_color_filter_dsc(bvm *vm);
|
||||
extern int lvbe_style_set_color_filter_opa(bvm *vm);
|
||||
extern int lvbe_style_set_anim(bvm *vm);
|
||||
extern int lvbe_style_set_anim_time(bvm *vm);
|
||||
extern int lvbe_style_set_anim_speed(bvm *vm);
|
||||
extern int lvbe_style_set_transition(bvm *vm);
|
||||
@ -188,6 +182,8 @@ extern int lvbe_disp_set_bg_opa(bvm *vm);
|
||||
extern int lvbe_disp_get_inactive_time(bvm *vm);
|
||||
extern int lvbe_disp_trig_activity(bvm *vm);
|
||||
extern int lvbe_disp_clean_dcache(bvm *vm);
|
||||
extern int lvbe_disp_enable_invalidation(bvm *vm);
|
||||
extern int lvbe_disp_is_invalidation_enabled(bvm *vm);
|
||||
extern int lvbe_disp_dpx(bvm *vm);
|
||||
|
||||
/* `lv_obj` external functions definitions */
|
||||
@ -259,6 +255,8 @@ extern int lvbe_obj_refresh_self_size(bvm *vm);
|
||||
extern int lvbe_obj_refr_pos(bvm *vm);
|
||||
extern int lvbe_obj_move_to(bvm *vm);
|
||||
extern int lvbe_obj_move_children_by(bvm *vm);
|
||||
extern int lvbe_obj_transform_point(bvm *vm);
|
||||
extern int lvbe_obj_get_transformed_area(bvm *vm);
|
||||
extern int lvbe_obj_invalidate_area(bvm *vm);
|
||||
extern int lvbe_obj_invalidate(bvm *vm);
|
||||
extern int lvbe_obj_area_is_visible(bvm *vm);
|
||||
@ -299,6 +297,7 @@ extern int lvbe_obj_remove_style_all(bvm *vm);
|
||||
extern int lvbe_obj_refresh_style(bvm *vm);
|
||||
extern int lvbe_obj_get_style_prop(bvm *vm);
|
||||
extern int lvbe_obj_set_local_style_prop(bvm *vm);
|
||||
extern int lvbe_obj_set_local_style_prop_meta(bvm *vm);
|
||||
extern int lvbe_obj_get_local_style_prop(bvm *vm);
|
||||
extern int lvbe_obj_remove_local_style_prop(bvm *vm);
|
||||
extern int lvbe_obj_fade_in(bvm *vm);
|
||||
@ -324,6 +323,8 @@ extern int lvbe_obj_get_style_translate_x(bvm *vm);
|
||||
extern int lvbe_obj_get_style_translate_y(bvm *vm);
|
||||
extern int lvbe_obj_get_style_transform_zoom(bvm *vm);
|
||||
extern int lvbe_obj_get_style_transform_angle(bvm *vm);
|
||||
extern int lvbe_obj_get_style_transform_pivot_x(bvm *vm);
|
||||
extern int lvbe_obj_get_style_transform_pivot_y(bvm *vm);
|
||||
extern int lvbe_obj_get_style_pad_top(bvm *vm);
|
||||
extern int lvbe_obj_get_style_pad_bottom(bvm *vm);
|
||||
extern int lvbe_obj_get_style_pad_left(bvm *vm);
|
||||
@ -394,6 +395,7 @@ extern int lvbe_obj_get_style_clip_corner(bvm *vm);
|
||||
extern int lvbe_obj_get_style_opa(bvm *vm);
|
||||
extern int lvbe_obj_get_style_color_filter_dsc(bvm *vm);
|
||||
extern int lvbe_obj_get_style_color_filter_opa(bvm *vm);
|
||||
extern int lvbe_obj_get_style_anim(bvm *vm);
|
||||
extern int lvbe_obj_get_style_anim_time(bvm *vm);
|
||||
extern int lvbe_obj_get_style_anim_speed(bvm *vm);
|
||||
extern int lvbe_obj_get_style_transition(bvm *vm);
|
||||
@ -415,6 +417,8 @@ extern int lvbe_obj_set_style_translate_x(bvm *vm);
|
||||
extern int lvbe_obj_set_style_translate_y(bvm *vm);
|
||||
extern int lvbe_obj_set_style_transform_zoom(bvm *vm);
|
||||
extern int lvbe_obj_set_style_transform_angle(bvm *vm);
|
||||
extern int lvbe_obj_set_style_transform_pivot_x(bvm *vm);
|
||||
extern int lvbe_obj_set_style_transform_pivot_y(bvm *vm);
|
||||
extern int lvbe_obj_set_style_pad_top(bvm *vm);
|
||||
extern int lvbe_obj_set_style_pad_bottom(bvm *vm);
|
||||
extern int lvbe_obj_set_style_pad_left(bvm *vm);
|
||||
@ -422,10 +426,8 @@ extern int lvbe_obj_set_style_pad_right(bvm *vm);
|
||||
extern int lvbe_obj_set_style_pad_row(bvm *vm);
|
||||
extern int lvbe_obj_set_style_pad_column(bvm *vm);
|
||||
extern int lvbe_obj_set_style_bg_color(bvm *vm);
|
||||
extern int lvbe_obj_set_style_bg_color_filtered(bvm *vm);
|
||||
extern int lvbe_obj_set_style_bg_opa(bvm *vm);
|
||||
extern int lvbe_obj_set_style_bg_grad_color(bvm *vm);
|
||||
extern int lvbe_obj_set_style_bg_grad_color_filtered(bvm *vm);
|
||||
extern int lvbe_obj_set_style_bg_grad_dir(bvm *vm);
|
||||
extern int lvbe_obj_set_style_bg_main_stop(bvm *vm);
|
||||
extern int lvbe_obj_set_style_bg_grad_stop(bvm *vm);
|
||||
@ -434,18 +436,15 @@ extern int lvbe_obj_set_style_bg_dither_mode(bvm *vm);
|
||||
extern int lvbe_obj_set_style_bg_img_src(bvm *vm);
|
||||
extern int lvbe_obj_set_style_bg_img_opa(bvm *vm);
|
||||
extern int lvbe_obj_set_style_bg_img_recolor(bvm *vm);
|
||||
extern int lvbe_obj_set_style_bg_img_recolor_filtered(bvm *vm);
|
||||
extern int lvbe_obj_set_style_bg_img_recolor_opa(bvm *vm);
|
||||
extern int lvbe_obj_set_style_bg_img_tiled(bvm *vm);
|
||||
extern int lvbe_obj_set_style_border_color(bvm *vm);
|
||||
extern int lvbe_obj_set_style_border_color_filtered(bvm *vm);
|
||||
extern int lvbe_obj_set_style_border_opa(bvm *vm);
|
||||
extern int lvbe_obj_set_style_border_width(bvm *vm);
|
||||
extern int lvbe_obj_set_style_border_side(bvm *vm);
|
||||
extern int lvbe_obj_set_style_border_post(bvm *vm);
|
||||
extern int lvbe_obj_set_style_outline_width(bvm *vm);
|
||||
extern int lvbe_obj_set_style_outline_color(bvm *vm);
|
||||
extern int lvbe_obj_set_style_outline_color_filtered(bvm *vm);
|
||||
extern int lvbe_obj_set_style_outline_opa(bvm *vm);
|
||||
extern int lvbe_obj_set_style_outline_pad(bvm *vm);
|
||||
extern int lvbe_obj_set_style_shadow_width(bvm *vm);
|
||||
@ -453,27 +452,22 @@ extern int lvbe_obj_set_style_shadow_ofs_x(bvm *vm);
|
||||
extern int lvbe_obj_set_style_shadow_ofs_y(bvm *vm);
|
||||
extern int lvbe_obj_set_style_shadow_spread(bvm *vm);
|
||||
extern int lvbe_obj_set_style_shadow_color(bvm *vm);
|
||||
extern int lvbe_obj_set_style_shadow_color_filtered(bvm *vm);
|
||||
extern int lvbe_obj_set_style_shadow_opa(bvm *vm);
|
||||
extern int lvbe_obj_set_style_img_opa(bvm *vm);
|
||||
extern int lvbe_obj_set_style_img_recolor(bvm *vm);
|
||||
extern int lvbe_obj_set_style_img_recolor_filtered(bvm *vm);
|
||||
extern int lvbe_obj_set_style_img_recolor_opa(bvm *vm);
|
||||
extern int lvbe_obj_set_style_line_width(bvm *vm);
|
||||
extern int lvbe_obj_set_style_line_dash_width(bvm *vm);
|
||||
extern int lvbe_obj_set_style_line_dash_gap(bvm *vm);
|
||||
extern int lvbe_obj_set_style_line_rounded(bvm *vm);
|
||||
extern int lvbe_obj_set_style_line_color(bvm *vm);
|
||||
extern int lvbe_obj_set_style_line_color_filtered(bvm *vm);
|
||||
extern int lvbe_obj_set_style_line_opa(bvm *vm);
|
||||
extern int lvbe_obj_set_style_arc_width(bvm *vm);
|
||||
extern int lvbe_obj_set_style_arc_rounded(bvm *vm);
|
||||
extern int lvbe_obj_set_style_arc_color(bvm *vm);
|
||||
extern int lvbe_obj_set_style_arc_color_filtered(bvm *vm);
|
||||
extern int lvbe_obj_set_style_arc_opa(bvm *vm);
|
||||
extern int lvbe_obj_set_style_arc_img_src(bvm *vm);
|
||||
extern int lvbe_obj_set_style_text_color(bvm *vm);
|
||||
extern int lvbe_obj_set_style_text_color_filtered(bvm *vm);
|
||||
extern int lvbe_obj_set_style_text_opa(bvm *vm);
|
||||
extern int lvbe_obj_set_style_text_font(bvm *vm);
|
||||
extern int lvbe_obj_set_style_text_letter_space(bvm *vm);
|
||||
@ -485,6 +479,7 @@ extern int lvbe_obj_set_style_clip_corner(bvm *vm);
|
||||
extern int lvbe_obj_set_style_opa(bvm *vm);
|
||||
extern int lvbe_obj_set_style_color_filter_dsc(bvm *vm);
|
||||
extern int lvbe_obj_set_style_color_filter_opa(bvm *vm);
|
||||
extern int lvbe_obj_set_style_anim(bvm *vm);
|
||||
extern int lvbe_obj_set_style_anim_time(bvm *vm);
|
||||
extern int lvbe_obj_set_style_anim_speed(bvm *vm);
|
||||
extern int lvbe_obj_set_style_transition(bvm *vm);
|
||||
@ -559,11 +554,13 @@ extern int lvbe_group_focus_prev(bvm *vm);
|
||||
extern int lvbe_group_focus_freeze(bvm *vm);
|
||||
extern int lvbe_group_send_data(bvm *vm);
|
||||
extern int lvbe_group_set_focus_cb(bvm *vm);
|
||||
extern int lvbe_group_set_edge_cb(bvm *vm);
|
||||
extern int lvbe_group_set_refocus_policy(bvm *vm);
|
||||
extern int lvbe_group_set_editing(bvm *vm);
|
||||
extern int lvbe_group_set_wrap(bvm *vm);
|
||||
extern int lvbe_group_get_focused(bvm *vm);
|
||||
extern int lvbe_group_get_focus_cb(bvm *vm);
|
||||
extern int lvbe_group_get_edge_cb(bvm *vm);
|
||||
extern int lvbe_group_get_editing(bvm *vm);
|
||||
extern int lvbe_group_get_wrap(bvm *vm);
|
||||
extern int lvbe_group_get_obj_count(bvm *vm);
|
||||
@ -686,7 +683,7 @@ extern int lvbe_spinbox_set_rollover(bvm *vm);
|
||||
extern int lvbe_spinbox_set_digit_format(bvm *vm);
|
||||
extern int lvbe_spinbox_set_step(bvm *vm);
|
||||
extern int lvbe_spinbox_set_range(bvm *vm);
|
||||
extern int lvbe_spinbox_set_pos(bvm *vm);
|
||||
extern int lvbe_spinbox_set_cursor_pos(bvm *vm);
|
||||
extern int lvbe_spinbox_set_digit_step_direction(bvm *vm);
|
||||
extern int lvbe_spinbox_get_rollover(bvm *vm);
|
||||
extern int lvbe_spinbox_get_value(bvm *vm);
|
||||
@ -711,6 +708,7 @@ extern int lvbe_anim_set_path_cb(bvm *vm);
|
||||
extern int lvbe_anim_set_start_cb(bvm *vm);
|
||||
extern int lvbe_anim_set_get_value_cb(bvm *vm);
|
||||
extern int lvbe_anim_set_ready_cb(bvm *vm);
|
||||
extern int lvbe_anim_set_deleted_cb(bvm *vm);
|
||||
extern int lvbe_anim_set_playback_time(bvm *vm);
|
||||
extern int lvbe_anim_set_playback_delay(bvm *vm);
|
||||
extern int lvbe_anim_set_repeat_count(bvm *vm);
|
||||
@ -756,6 +754,8 @@ extern int lvbe_arc_get_value(bvm *vm);
|
||||
extern int lvbe_arc_get_min_value(bvm *vm);
|
||||
extern int lvbe_arc_get_max_value(bvm *vm);
|
||||
extern int lvbe_arc_get_mode(bvm *vm);
|
||||
extern int lvbe_arc_align_obj_to_angle(bvm *vm);
|
||||
extern int lvbe_arc_rotate_obj_to_angle(bvm *vm);
|
||||
|
||||
/* `lv_bar` external functions definitions */
|
||||
extern int lvbe_bar_create(bvm *vm);
|
||||
@ -833,6 +833,7 @@ extern int lvbe_dropdown_get_options(bvm *vm);
|
||||
extern int lvbe_dropdown_get_selected(bvm *vm);
|
||||
extern int lvbe_dropdown_get_option_cnt(bvm *vm);
|
||||
extern int lvbe_dropdown_get_selected_str(bvm *vm);
|
||||
extern int lvbe_dropdown_get_option_index(bvm *vm);
|
||||
extern int lvbe_dropdown_get_symbol(bvm *vm);
|
||||
extern int lvbe_dropdown_get_selected_highlight(bvm *vm);
|
||||
extern int lvbe_dropdown_get_dir(bvm *vm);
|
||||
@ -919,6 +920,7 @@ extern int lvbe_textarea_set_placeholder_text(bvm *vm);
|
||||
extern int lvbe_textarea_set_cursor_pos(bvm *vm);
|
||||
extern int lvbe_textarea_set_cursor_click_pos(bvm *vm);
|
||||
extern int lvbe_textarea_set_password_mode(bvm *vm);
|
||||
extern int lvbe_textarea_set_password_bullet(bvm *vm);
|
||||
extern int lvbe_textarea_set_one_line(bvm *vm);
|
||||
extern int lvbe_textarea_set_accepted_chars(bvm *vm);
|
||||
extern int lvbe_textarea_set_max_length(bvm *vm);
|
||||
@ -932,6 +934,7 @@ extern int lvbe_textarea_get_label(bvm *vm);
|
||||
extern int lvbe_textarea_get_cursor_pos(bvm *vm);
|
||||
extern int lvbe_textarea_get_cursor_click_pos(bvm *vm);
|
||||
extern int lvbe_textarea_get_password_mode(bvm *vm);
|
||||
extern int lvbe_textarea_get_password_bullet(bvm *vm);
|
||||
extern int lvbe_textarea_get_one_line(bvm *vm);
|
||||
extern int lvbe_textarea_get_accepted_chars(bvm *vm);
|
||||
extern int lvbe_textarea_get_max_length(bvm *vm);
|
||||
|
@ -124,7 +124,13 @@ 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_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
|
||||
|
||||
// File: ../../lvgl/src/core/lv_event.h
|
||||
LV_EVENT_ALL
|
||||
@ -267,6 +273,10 @@ LV_COVER_RES_COVER
|
||||
LV_COVER_RES_NOT_COVER
|
||||
LV_COVER_RES_MASKED
|
||||
|
||||
LV_LAYER_TYPE_NONE
|
||||
LV_LAYER_TYPE_SIMPLE
|
||||
LV_LAYER_TYPE_TRANSFORM
|
||||
|
||||
// File: ../../lvgl/src/core/lv_obj_pos.h
|
||||
// File: ../../lvgl/src/core/lv_obj_scroll.h
|
||||
LV_SCROLLBAR_MODE_OFF
|
||||
@ -292,6 +302,11 @@ LV_OBJ_TREE_WALK_END
|
||||
// File: ../../lvgl/src/draw/lv_draw_arc.h
|
||||
// File: ../../lvgl/src/draw/lv_draw_img.h
|
||||
// File: ../../lvgl/src/draw/lv_draw_label.h
|
||||
// File: ../../lvgl/src/draw/lv_draw_layer.h
|
||||
LV_DRAW_LAYER_FLAG_NONE
|
||||
LV_DRAW_LAYER_FLAG_HAS_ALPHA
|
||||
LV_DRAW_LAYER_FLAG_CAN_SUBDIVIDE
|
||||
|
||||
// File: ../../lvgl/src/draw/lv_draw_line.h
|
||||
// File: ../../lvgl/src/draw/lv_draw_mask.h
|
||||
LV_DRAW_MASK_RES_TRANSP
|
||||
@ -312,6 +327,7 @@ LV_DRAW_MASK_LINE_SIDE_BOTTOM
|
||||
|
||||
// File: ../../lvgl/src/draw/lv_draw_rect.h
|
||||
LV_RADIUS_CIRCLE
|
||||
// File: ../../lvgl/src/draw/lv_draw_transform.h
|
||||
// File: ../../lvgl/src/draw/lv_draw_triangle.h
|
||||
// File: ../../lvgl/src/draw/lv_img_buf.h
|
||||
LV_IMG_CF_UNKNOWN
|
||||
@ -329,6 +345,12 @@ LV_IMG_CF_ALPHA_1BIT
|
||||
LV_IMG_CF_ALPHA_2BIT
|
||||
LV_IMG_CF_ALPHA_4BIT
|
||||
LV_IMG_CF_ALPHA_8BIT
|
||||
LV_IMG_CF_RGB888
|
||||
LV_IMG_CF_RGBA8888
|
||||
LV_IMG_CF_RGBX8888
|
||||
LV_IMG_CF_RGB565
|
||||
LV_IMG_CF_RGBA5658
|
||||
LV_IMG_CF_RGB565A8
|
||||
|
||||
// File: ../../lvgl/src/draw/lv_img_cache.h
|
||||
// File: ../../lvgl/src/draw/lv_img_decoder.h
|
||||
@ -623,23 +645,19 @@ LV_STYLE_MAX_HEIGHT
|
||||
LV_STYLE_X
|
||||
LV_STYLE_Y
|
||||
LV_STYLE_ALIGN
|
||||
LV_STYLE_TRANSFORM_WIDTH
|
||||
LV_STYLE_TRANSFORM_HEIGHT
|
||||
LV_STYLE_TRANSLATE_X
|
||||
LV_STYLE_TRANSLATE_Y
|
||||
LV_STYLE_TRANSFORM_ZOOM
|
||||
LV_STYLE_TRANSFORM_ANGLE
|
||||
LV_STYLE_LAYOUT
|
||||
LV_STYLE_RADIUS
|
||||
LV_STYLE_PAD_TOP
|
||||
LV_STYLE_PAD_BOTTOM
|
||||
LV_STYLE_PAD_LEFT
|
||||
LV_STYLE_PAD_RIGHT
|
||||
LV_STYLE_PAD_ROW
|
||||
LV_STYLE_PAD_COLUMN
|
||||
LV_STYLE_BASE_DIR
|
||||
LV_STYLE_CLIP_CORNER
|
||||
LV_STYLE_BG_COLOR
|
||||
LV_STYLE_BG_COLOR_FILTERED
|
||||
LV_STYLE_BG_OPA
|
||||
LV_STYLE_BG_GRAD_COLOR
|
||||
LV_STYLE_BG_GRAD_COLOR_FILTERED
|
||||
LV_STYLE_BG_GRAD_DIR
|
||||
LV_STYLE_BG_MAIN_STOP
|
||||
LV_STYLE_BG_GRAD_STOP
|
||||
@ -648,18 +666,15 @@ LV_STYLE_BG_DITHER_MODE
|
||||
LV_STYLE_BG_IMG_SRC
|
||||
LV_STYLE_BG_IMG_OPA
|
||||
LV_STYLE_BG_IMG_RECOLOR
|
||||
LV_STYLE_BG_IMG_RECOLOR_FILTERED
|
||||
LV_STYLE_BG_IMG_RECOLOR_OPA
|
||||
LV_STYLE_BG_IMG_TILED
|
||||
LV_STYLE_BORDER_COLOR
|
||||
LV_STYLE_BORDER_COLOR_FILTERED
|
||||
LV_STYLE_BORDER_OPA
|
||||
LV_STYLE_BORDER_WIDTH
|
||||
LV_STYLE_BORDER_SIDE
|
||||
LV_STYLE_BORDER_POST
|
||||
LV_STYLE_OUTLINE_WIDTH
|
||||
LV_STYLE_OUTLINE_COLOR
|
||||
LV_STYLE_OUTLINE_COLOR_FILTERED
|
||||
LV_STYLE_OUTLINE_OPA
|
||||
LV_STYLE_OUTLINE_PAD
|
||||
LV_STYLE_SHADOW_WIDTH
|
||||
@ -667,45 +682,48 @@ LV_STYLE_SHADOW_OFS_X
|
||||
LV_STYLE_SHADOW_OFS_Y
|
||||
LV_STYLE_SHADOW_SPREAD
|
||||
LV_STYLE_SHADOW_COLOR
|
||||
LV_STYLE_SHADOW_COLOR_FILTERED
|
||||
LV_STYLE_SHADOW_OPA
|
||||
LV_STYLE_IMG_OPA
|
||||
LV_STYLE_IMG_RECOLOR
|
||||
LV_STYLE_IMG_RECOLOR_FILTERED
|
||||
LV_STYLE_IMG_RECOLOR_OPA
|
||||
LV_STYLE_LINE_WIDTH
|
||||
LV_STYLE_LINE_DASH_WIDTH
|
||||
LV_STYLE_LINE_DASH_GAP
|
||||
LV_STYLE_LINE_ROUNDED
|
||||
LV_STYLE_LINE_COLOR
|
||||
LV_STYLE_LINE_COLOR_FILTERED
|
||||
LV_STYLE_LINE_OPA
|
||||
LV_STYLE_ARC_WIDTH
|
||||
LV_STYLE_ARC_ROUNDED
|
||||
LV_STYLE_ARC_COLOR
|
||||
LV_STYLE_ARC_COLOR_FILTERED
|
||||
LV_STYLE_ARC_OPA
|
||||
LV_STYLE_ARC_IMG_SRC
|
||||
LV_STYLE_TEXT_COLOR
|
||||
LV_STYLE_TEXT_COLOR_FILTERED
|
||||
LV_STYLE_TEXT_OPA
|
||||
LV_STYLE_TEXT_FONT
|
||||
LV_STYLE_TEXT_LETTER_SPACE
|
||||
LV_STYLE_TEXT_LINE_SPACE
|
||||
LV_STYLE_TEXT_DECOR
|
||||
LV_STYLE_TEXT_ALIGN
|
||||
LV_STYLE_RADIUS
|
||||
LV_STYLE_CLIP_CORNER
|
||||
LV_STYLE_OPA
|
||||
LV_STYLE_COLOR_FILTER_DSC
|
||||
LV_STYLE_COLOR_FILTER_OPA
|
||||
LV_STYLE_ANIM
|
||||
LV_STYLE_ANIM_TIME
|
||||
LV_STYLE_ANIM_SPEED
|
||||
LV_STYLE_TRANSITION
|
||||
LV_STYLE_BLEND_MODE
|
||||
LV_STYLE_LAYOUT
|
||||
LV_STYLE_BASE_DIR
|
||||
LV_STYLE_TRANSFORM_WIDTH
|
||||
LV_STYLE_TRANSFORM_HEIGHT
|
||||
LV_STYLE_TRANSLATE_X
|
||||
LV_STYLE_TRANSLATE_Y
|
||||
LV_STYLE_TRANSFORM_ZOOM
|
||||
LV_STYLE_TRANSFORM_ANGLE
|
||||
LV_STYLE_TRANSFORM_PIVOT_X
|
||||
LV_STYLE_TRANSFORM_PIVOT_Y
|
||||
LV_STYLE_PROP_ANY
|
||||
LV_STYLE_RES_NOT_FOUND
|
||||
LV_STYLE_RES_FOUND
|
||||
LV_STYLE_RES_INHERIT
|
||||
LV_IMG_ZOOM_NONE
|
||||
// File: ../../lvgl/src/misc/lv_style_gen.h
|
||||
// File: ../../lvgl/src/misc/lv_templ.h
|
||||
|
@ -44,6 +44,8 @@ void lv_scr_load_anim(lv_obj_t * scr, lv_scr_load_anim_t anim_type, uint32_t tim
|
||||
uint32_t lv_disp_get_inactive_time(const lv_disp_t * disp)
|
||||
void lv_disp_trig_activity(lv_disp_t * disp)
|
||||
void lv_disp_clean_dcache(lv_disp_t * disp)
|
||||
void lv_disp_enable_invalidation(lv_disp_t * disp, bool en)
|
||||
bool lv_disp_is_invalidation_enabled(lv_disp_t * disp)
|
||||
static inline lv_obj_t * lv_scr_act(void)
|
||||
static inline lv_obj_t * lv_layer_top(void)
|
||||
static inline lv_obj_t * lv_layer_sys(void)
|
||||
@ -80,11 +82,13 @@ void lv_group_focus_prev(lv_group_t * group)
|
||||
void lv_group_focus_freeze(lv_group_t * group, bool en)
|
||||
lv_res_t lv_group_send_data(lv_group_t * group, uint32_t c)
|
||||
void lv_group_set_focus_cb(lv_group_t * group, lv_group_focus_cb_t focus_cb)
|
||||
void lv_group_set_edge_cb(lv_group_t * group, lv_group_edge_cb_t edge_cb)
|
||||
void lv_group_set_refocus_policy(lv_group_t * group, lv_group_refocus_policy_t policy)
|
||||
void lv_group_set_editing(lv_group_t * group, bool edit)
|
||||
void lv_group_set_wrap(lv_group_t * group, bool en)
|
||||
struct _lv_obj_t * lv_group_get_focused(const lv_group_t * group)
|
||||
lv_group_focus_cb_t lv_group_get_focus_cb(const lv_group_t * group)
|
||||
lv_group_edge_cb_t lv_group_get_edge_cb(const lv_group_t * group)
|
||||
bool lv_group_get_editing(const lv_group_t * group)
|
||||
bool lv_group_get_wrap(lv_group_t * group)
|
||||
uint32_t lv_group_get_obj_count(lv_group_t * group)
|
||||
@ -187,6 +191,8 @@ bool lv_obj_refresh_self_size(struct _lv_obj_t * obj)
|
||||
void lv_obj_refr_pos(struct _lv_obj_t * obj)
|
||||
void lv_obj_move_to(struct _lv_obj_t * obj, lv_coord_t x, lv_coord_t y)
|
||||
void lv_obj_move_children_by(struct _lv_obj_t * obj, lv_coord_t x_diff, lv_coord_t y_diff, bool ignore_floating)
|
||||
void lv_obj_transform_point(const struct _lv_obj_t * obj, lv_point_t * p, bool recursive, bool inv)
|
||||
void lv_obj_get_transformed_area(const struct _lv_obj_t * obj, lv_area_t * area, bool recursive, bool inv)
|
||||
void lv_obj_invalidate_area(const struct _lv_obj_t * obj, const lv_area_t * area)
|
||||
void lv_obj_invalidate(const struct _lv_obj_t * obj)
|
||||
bool lv_obj_area_is_visible(const struct _lv_obj_t * obj, lv_area_t * area)
|
||||
@ -235,7 +241,8 @@ void lv_obj_refresh_style(struct _lv_obj_t * obj, lv_part_t part, lv_style_prop_
|
||||
void lv_obj_enable_style_refresh(bool en)
|
||||
lv_style_value_t lv_obj_get_style_prop(const struct _lv_obj_t * obj, lv_part_t part, lv_style_prop_t prop)
|
||||
void lv_obj_set_local_style_prop(struct _lv_obj_t * obj, lv_style_prop_t prop, lv_style_value_t value, lv_style_selector_t selector)
|
||||
lv_res_t lv_obj_get_local_style_prop(struct _lv_obj_t * obj, lv_style_prop_t prop, lv_style_value_t * value, lv_style_selector_t selector)
|
||||
void lv_obj_set_local_style_prop_meta(struct _lv_obj_t * obj, lv_style_prop_t prop, uint16_t meta, lv_style_selector_t selector)
|
||||
lv_style_res_t lv_obj_get_local_style_prop(struct _lv_obj_t * obj, lv_style_prop_t prop, lv_style_value_t * value, lv_style_selector_t selector)
|
||||
bool lv_obj_remove_local_style_prop(struct _lv_obj_t * obj, lv_style_prop_t prop, lv_style_selector_t selector)
|
||||
void lv_obj_fade_in(struct _lv_obj_t * obj, uint32_t time, uint32_t delay)
|
||||
void lv_obj_fade_out(struct _lv_obj_t * obj, uint32_t time, uint32_t delay)
|
||||
@ -264,6 +271,8 @@ static inline lv_coord_t lv_obj_get_style_translate_x(const struct _lv_obj_t * o
|
||||
static inline lv_coord_t lv_obj_get_style_translate_y(const struct _lv_obj_t * obj, uint32_t part)
|
||||
static inline lv_coord_t lv_obj_get_style_transform_zoom(const struct _lv_obj_t * obj, uint32_t part)
|
||||
static inline lv_coord_t lv_obj_get_style_transform_angle(const struct _lv_obj_t * obj, uint32_t part)
|
||||
static inline lv_coord_t lv_obj_get_style_transform_pivot_x(const struct _lv_obj_t * obj, uint32_t part)
|
||||
static inline lv_coord_t lv_obj_get_style_transform_pivot_y(const struct _lv_obj_t * obj, uint32_t part)
|
||||
static inline lv_coord_t lv_obj_get_style_pad_top(const struct _lv_obj_t * obj, uint32_t part)
|
||||
static inline lv_coord_t lv_obj_get_style_pad_bottom(const struct _lv_obj_t * obj, uint32_t part)
|
||||
static inline lv_coord_t lv_obj_get_style_pad_left(const struct _lv_obj_t * obj, uint32_t part)
|
||||
@ -334,6 +343,7 @@ static inline bool lv_obj_get_style_clip_corner(const struct _lv_obj_t * obj, ui
|
||||
static inline lv_opa_t lv_obj_get_style_opa(const struct _lv_obj_t * obj, uint32_t part)
|
||||
static inline const lv_color_filter_dsc_t * lv_obj_get_style_color_filter_dsc(const struct _lv_obj_t * obj, uint32_t part)
|
||||
static inline lv_opa_t lv_obj_get_style_color_filter_opa(const struct _lv_obj_t * obj, uint32_t part)
|
||||
static inline const lv_anim_t * lv_obj_get_style_anim(const struct _lv_obj_t * obj, uint32_t part)
|
||||
static inline uint32_t lv_obj_get_style_anim_time(const struct _lv_obj_t * obj, uint32_t part)
|
||||
static inline uint32_t lv_obj_get_style_anim_speed(const struct _lv_obj_t * obj, uint32_t part)
|
||||
static inline const lv_style_transition_dsc_t * lv_obj_get_style_transition(const struct _lv_obj_t * obj, uint32_t part)
|
||||
@ -355,6 +365,8 @@ void lv_obj_set_style_translate_x(struct _lv_obj_t * obj, lv_coord_t value, lv_s
|
||||
void lv_obj_set_style_translate_y(struct _lv_obj_t * obj, lv_coord_t value, lv_style_selector_t selector)
|
||||
void lv_obj_set_style_transform_zoom(struct _lv_obj_t * obj, lv_coord_t value, lv_style_selector_t selector)
|
||||
void lv_obj_set_style_transform_angle(struct _lv_obj_t * obj, lv_coord_t value, lv_style_selector_t selector)
|
||||
void lv_obj_set_style_transform_pivot_x(struct _lv_obj_t * obj, lv_coord_t value, lv_style_selector_t selector)
|
||||
void lv_obj_set_style_transform_pivot_y(struct _lv_obj_t * obj, lv_coord_t value, lv_style_selector_t selector)
|
||||
void lv_obj_set_style_pad_top(struct _lv_obj_t * obj, lv_coord_t value, lv_style_selector_t selector)
|
||||
void lv_obj_set_style_pad_bottom(struct _lv_obj_t * obj, lv_coord_t value, lv_style_selector_t selector)
|
||||
void lv_obj_set_style_pad_left(struct _lv_obj_t * obj, lv_coord_t value, lv_style_selector_t selector)
|
||||
@ -362,10 +374,8 @@ void lv_obj_set_style_pad_right(struct _lv_obj_t * obj, lv_coord_t value, lv_sty
|
||||
void lv_obj_set_style_pad_row(struct _lv_obj_t * obj, lv_coord_t value, lv_style_selector_t selector)
|
||||
void lv_obj_set_style_pad_column(struct _lv_obj_t * obj, lv_coord_t value, lv_style_selector_t selector)
|
||||
void lv_obj_set_style_bg_color(struct _lv_obj_t * obj, lv_color_t value, lv_style_selector_t selector)
|
||||
void lv_obj_set_style_bg_color_filtered(struct _lv_obj_t * obj, lv_color_t value, lv_style_selector_t selector)
|
||||
void lv_obj_set_style_bg_opa(struct _lv_obj_t * obj, lv_opa_t value, lv_style_selector_t selector)
|
||||
void lv_obj_set_style_bg_grad_color(struct _lv_obj_t * obj, lv_color_t value, lv_style_selector_t selector)
|
||||
void lv_obj_set_style_bg_grad_color_filtered(struct _lv_obj_t * obj, lv_color_t value, lv_style_selector_t selector)
|
||||
void lv_obj_set_style_bg_grad_dir(struct _lv_obj_t * obj, lv_grad_dir_t value, lv_style_selector_t selector)
|
||||
void lv_obj_set_style_bg_main_stop(struct _lv_obj_t * obj, lv_coord_t value, lv_style_selector_t selector)
|
||||
void lv_obj_set_style_bg_grad_stop(struct _lv_obj_t * obj, lv_coord_t value, lv_style_selector_t selector)
|
||||
@ -374,18 +384,15 @@ void lv_obj_set_style_bg_dither_mode(struct _lv_obj_t * obj, lv_dither_mode_t va
|
||||
void lv_obj_set_style_bg_img_src(struct _lv_obj_t * obj, const void * value, lv_style_selector_t selector)
|
||||
void lv_obj_set_style_bg_img_opa(struct _lv_obj_t * obj, lv_opa_t value, lv_style_selector_t selector)
|
||||
void lv_obj_set_style_bg_img_recolor(struct _lv_obj_t * obj, lv_color_t value, lv_style_selector_t selector)
|
||||
void lv_obj_set_style_bg_img_recolor_filtered(struct _lv_obj_t * obj, lv_color_t value, lv_style_selector_t selector)
|
||||
void lv_obj_set_style_bg_img_recolor_opa(struct _lv_obj_t * obj, lv_opa_t value, lv_style_selector_t selector)
|
||||
void lv_obj_set_style_bg_img_tiled(struct _lv_obj_t * obj, bool value, lv_style_selector_t selector)
|
||||
void lv_obj_set_style_border_color(struct _lv_obj_t * obj, lv_color_t value, lv_style_selector_t selector)
|
||||
void lv_obj_set_style_border_color_filtered(struct _lv_obj_t * obj, lv_color_t value, lv_style_selector_t selector)
|
||||
void lv_obj_set_style_border_opa(struct _lv_obj_t * obj, lv_opa_t value, lv_style_selector_t selector)
|
||||
void lv_obj_set_style_border_width(struct _lv_obj_t * obj, lv_coord_t value, lv_style_selector_t selector)
|
||||
void lv_obj_set_style_border_side(struct _lv_obj_t * obj, lv_border_side_t value, lv_style_selector_t selector)
|
||||
void lv_obj_set_style_border_post(struct _lv_obj_t * obj, bool value, lv_style_selector_t selector)
|
||||
void lv_obj_set_style_outline_width(struct _lv_obj_t * obj, lv_coord_t value, lv_style_selector_t selector)
|
||||
void lv_obj_set_style_outline_color(struct _lv_obj_t * obj, lv_color_t value, lv_style_selector_t selector)
|
||||
void lv_obj_set_style_outline_color_filtered(struct _lv_obj_t * obj, lv_color_t value, lv_style_selector_t selector)
|
||||
void lv_obj_set_style_outline_opa(struct _lv_obj_t * obj, lv_opa_t value, lv_style_selector_t selector)
|
||||
void lv_obj_set_style_outline_pad(struct _lv_obj_t * obj, lv_coord_t value, lv_style_selector_t selector)
|
||||
void lv_obj_set_style_shadow_width(struct _lv_obj_t * obj, lv_coord_t value, lv_style_selector_t selector)
|
||||
@ -393,27 +400,22 @@ void lv_obj_set_style_shadow_ofs_x(struct _lv_obj_t * obj, lv_coord_t value, lv_
|
||||
void lv_obj_set_style_shadow_ofs_y(struct _lv_obj_t * obj, lv_coord_t value, lv_style_selector_t selector)
|
||||
void lv_obj_set_style_shadow_spread(struct _lv_obj_t * obj, lv_coord_t value, lv_style_selector_t selector)
|
||||
void lv_obj_set_style_shadow_color(struct _lv_obj_t * obj, lv_color_t value, lv_style_selector_t selector)
|
||||
void lv_obj_set_style_shadow_color_filtered(struct _lv_obj_t * obj, lv_color_t value, lv_style_selector_t selector)
|
||||
void lv_obj_set_style_shadow_opa(struct _lv_obj_t * obj, lv_opa_t value, lv_style_selector_t selector)
|
||||
void lv_obj_set_style_img_opa(struct _lv_obj_t * obj, lv_opa_t value, lv_style_selector_t selector)
|
||||
void lv_obj_set_style_img_recolor(struct _lv_obj_t * obj, lv_color_t value, lv_style_selector_t selector)
|
||||
void lv_obj_set_style_img_recolor_filtered(struct _lv_obj_t * obj, lv_color_t value, lv_style_selector_t selector)
|
||||
void lv_obj_set_style_img_recolor_opa(struct _lv_obj_t * obj, lv_opa_t value, lv_style_selector_t selector)
|
||||
void lv_obj_set_style_line_width(struct _lv_obj_t * obj, lv_coord_t value, lv_style_selector_t selector)
|
||||
void lv_obj_set_style_line_dash_width(struct _lv_obj_t * obj, lv_coord_t value, lv_style_selector_t selector)
|
||||
void lv_obj_set_style_line_dash_gap(struct _lv_obj_t * obj, lv_coord_t value, lv_style_selector_t selector)
|
||||
void lv_obj_set_style_line_rounded(struct _lv_obj_t * obj, bool value, lv_style_selector_t selector)
|
||||
void lv_obj_set_style_line_color(struct _lv_obj_t * obj, lv_color_t value, lv_style_selector_t selector)
|
||||
void lv_obj_set_style_line_color_filtered(struct _lv_obj_t * obj, lv_color_t value, lv_style_selector_t selector)
|
||||
void lv_obj_set_style_line_opa(struct _lv_obj_t * obj, lv_opa_t value, lv_style_selector_t selector)
|
||||
void lv_obj_set_style_arc_width(struct _lv_obj_t * obj, lv_coord_t value, lv_style_selector_t selector)
|
||||
void lv_obj_set_style_arc_rounded(struct _lv_obj_t * obj, bool value, lv_style_selector_t selector)
|
||||
void lv_obj_set_style_arc_color(struct _lv_obj_t * obj, lv_color_t value, lv_style_selector_t selector)
|
||||
void lv_obj_set_style_arc_color_filtered(struct _lv_obj_t * obj, lv_color_t value, lv_style_selector_t selector)
|
||||
void lv_obj_set_style_arc_opa(struct _lv_obj_t * obj, lv_opa_t value, lv_style_selector_t selector)
|
||||
void lv_obj_set_style_arc_img_src(struct _lv_obj_t * obj, const void * value, lv_style_selector_t selector)
|
||||
void lv_obj_set_style_text_color(struct _lv_obj_t * obj, lv_color_t value, lv_style_selector_t selector)
|
||||
void lv_obj_set_style_text_color_filtered(struct _lv_obj_t * obj, lv_color_t value, lv_style_selector_t selector)
|
||||
void lv_obj_set_style_text_opa(struct _lv_obj_t * obj, lv_opa_t value, lv_style_selector_t selector)
|
||||
void lv_obj_set_style_text_font(struct _lv_obj_t * obj, const lv_font_t * value, lv_style_selector_t selector)
|
||||
void lv_obj_set_style_text_letter_space(struct _lv_obj_t * obj, lv_coord_t value, lv_style_selector_t selector)
|
||||
@ -425,6 +427,7 @@ void lv_obj_set_style_clip_corner(struct _lv_obj_t * obj, bool value, lv_style_s
|
||||
void lv_obj_set_style_opa(struct _lv_obj_t * obj, lv_opa_t value, lv_style_selector_t selector)
|
||||
void lv_obj_set_style_color_filter_dsc(struct _lv_obj_t * obj, const lv_color_filter_dsc_t * value, lv_style_selector_t selector)
|
||||
void lv_obj_set_style_color_filter_opa(struct _lv_obj_t * obj, lv_opa_t value, lv_style_selector_t selector)
|
||||
void lv_obj_set_style_anim(struct _lv_obj_t * obj, const lv_anim_t * value, lv_style_selector_t selector)
|
||||
void lv_obj_set_style_anim_time(struct _lv_obj_t * obj, uint32_t value, lv_style_selector_t selector)
|
||||
void lv_obj_set_style_anim_speed(struct _lv_obj_t * obj, uint32_t value, lv_style_selector_t selector)
|
||||
void lv_obj_set_style_transition(struct _lv_obj_t * obj, const lv_style_transition_dsc_t * value, lv_style_selector_t selector)
|
||||
@ -451,7 +454,7 @@ void lv_obj_tree_walk(struct _lv_obj_t * start_obj, lv_obj_tree_walk_cb_t cb, vo
|
||||
|
||||
// ../../lvgl/src/core/lv_refr.h
|
||||
void lv_refr_now(lv_disp_t * disp)
|
||||
void lv_refr_obj(lv_draw_ctx_t * draw_ctx, lv_obj_t * obj)
|
||||
void lv_obj_redraw(lv_draw_ctx_t * draw_ctx, lv_obj_t * obj)
|
||||
|
||||
// ../../lvgl/src/core/lv_theme.h
|
||||
lv_theme_t * lv_theme_get_from_obj(lv_obj_t * obj)
|
||||
@ -466,6 +469,7 @@ lv_color_t lv_theme_get_color_secondary(lv_obj_t * obj)
|
||||
|
||||
// ../../lvgl/src/draw/lv_draw.h
|
||||
void lv_draw_init(void)
|
||||
void lv_draw_wait_for_finish(lv_draw_ctx_t * draw_ctx)
|
||||
|
||||
// ../../lvgl/src/draw/lv_draw_arc.h
|
||||
void lv_draw_arc_dsc_init(lv_draw_arc_dsc_t * dsc)
|
||||
@ -483,6 +487,12 @@ void lv_draw_label_dsc_init(lv_draw_label_dsc_t * dsc)
|
||||
void lv_draw_label(struct _lv_draw_ctx_t * draw_ctx, const lv_draw_label_dsc_t * dsc, const lv_area_t * coords, const char * txt, lv_draw_label_hint_t * hint)
|
||||
void lv_draw_letter(struct _lv_draw_ctx_t * draw_ctx, const lv_draw_label_dsc_t * dsc, const lv_point_t * pos_p, uint32_t letter)
|
||||
|
||||
// ../../lvgl/src/draw/lv_draw_layer.h
|
||||
struct _lv_draw_layer_ctx_t * lv_draw_layer_create(struct _lv_draw_ctx_t * draw_ctx, const lv_area_t * layer_area, lv_draw_layer_flags_t flags)
|
||||
void lv_draw_layer_adjust(struct _lv_draw_ctx_t * draw_ctx, struct _lv_draw_layer_ctx_t * layer_ctx, lv_draw_layer_flags_t flags)
|
||||
void lv_draw_layer_blend(struct _lv_draw_ctx_t * draw_ctx, struct _lv_draw_layer_ctx_t * layer_ctx, lv_draw_img_dsc_t * draw_dsc)
|
||||
void lv_draw_layer_destroy(struct _lv_draw_ctx_t * draw_ctx, struct _lv_draw_layer_ctx_t * layer_ctx)
|
||||
|
||||
// ../../lvgl/src/draw/lv_draw_line.h
|
||||
void lv_draw_line_dsc_init(lv_draw_line_dsc_t * dsc)
|
||||
void lv_draw_line(struct _lv_draw_ctx_t * draw_ctx, const lv_draw_line_dsc_t * dsc, const lv_point_t * point1, const lv_point_t * point2)
|
||||
@ -510,6 +520,9 @@ void lv_draw_mask_polygon_init(lv_draw_mask_polygon_param_t * param, const lv_po
|
||||
void lv_draw_rect_dsc_init(lv_draw_rect_dsc_t * dsc)
|
||||
void lv_draw_rect(struct _lv_draw_ctx_t * draw_ctx, const lv_draw_rect_dsc_t * dsc, const lv_area_t * coords)
|
||||
|
||||
// ../../lvgl/src/draw/lv_draw_transform.h
|
||||
void lv_draw_transform(struct _lv_draw_ctx_t * draw_ctx, const lv_area_t * dest_area, const void * src_buf, lv_coord_t src_w, lv_coord_t src_h, lv_coord_t src_stride, const lv_draw_img_dsc_t * draw_dsc, lv_img_cf_t cf, lv_color_t * cbuf, lv_opa_t * abuf)
|
||||
|
||||
// ../../lvgl/src/draw/lv_draw_triangle.h
|
||||
void lv_draw_polygon(struct _lv_draw_ctx_t * draw_ctx, const lv_draw_rect_dsc_t * draw_dsc, const lv_point_t points[], uint16_t point_cnt)
|
||||
void lv_draw_triangle(struct _lv_draw_ctx_t * draw_ctx, const lv_draw_rect_dsc_t * draw_dsc, const lv_point_t points[])
|
||||
@ -592,6 +605,7 @@ bool lv_theme_default_is_inited(void)
|
||||
|
||||
// ../../lvgl/src/extra/themes/mono/lv_theme_mono.h
|
||||
lv_theme_t * lv_theme_mono_init(lv_disp_t * disp, bool dark_bg, const lv_font_t * font)
|
||||
bool lv_theme_mono_is_inited(void)
|
||||
|
||||
// ../../lvgl/src/extra/widgets/chart/lv_chart.h
|
||||
lv_obj_t * lv_chart_create(lv_obj_t * parent)
|
||||
@ -689,7 +703,7 @@ void lv_spinbox_set_rollover(lv_obj_t * obj, bool b)
|
||||
void lv_spinbox_set_digit_format(lv_obj_t * obj, uint8_t digit_count, uint8_t separator_position)
|
||||
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_pos(lv_obj_t * obj, uint8_t pos)
|
||||
void lv_spinbox_set_cursor_pos(lv_obj_t * obj, uint8_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)
|
||||
int32_t lv_spinbox_get_value(lv_obj_t * obj)
|
||||
@ -726,6 +740,7 @@ static inline void lv_anim_set_path_cb(lv_anim_t * a, lv_anim_path_cb_t path_cb)
|
||||
static inline void lv_anim_set_start_cb(lv_anim_t * a, lv_anim_start_cb_t start_cb)
|
||||
static inline void lv_anim_set_get_value_cb(lv_anim_t * a, lv_anim_get_value_cb_t get_value_cb)
|
||||
static inline void lv_anim_set_ready_cb(lv_anim_t * a, lv_anim_ready_cb_t ready_cb)
|
||||
static inline void lv_anim_set_deleted_cb(lv_anim_t * a, lv_anim_deleted_cb_t deleted_cb)
|
||||
static inline void lv_anim_set_playback_time(lv_anim_t * a, uint32_t time)
|
||||
static inline void lv_anim_set_playback_delay(lv_anim_t * a, uint32_t delay)
|
||||
static inline void lv_anim_set_repeat_count(lv_anim_t * a, uint16_t cnt)
|
||||
@ -739,6 +754,7 @@ static inline void * lv_anim_get_user_data(lv_anim_t * a)
|
||||
bool lv_anim_del(void * var, lv_anim_exec_xcb_t exec_cb)
|
||||
void lv_anim_del_all(void)
|
||||
lv_anim_t * lv_anim_get(void * var, lv_anim_exec_xcb_t exec_cb)
|
||||
struct _lv_timer_t * lv_anim_get_timer(void)
|
||||
static inline bool lv_anim_custom_del(lv_anim_t * a, lv_anim_custom_exec_cb_t exec_cb)
|
||||
static inline lv_anim_t * lv_anim_custom_get(lv_anim_t * a, lv_anim_custom_exec_cb_t exec_cb)
|
||||
uint16_t lv_anim_count_running(void)
|
||||
@ -756,6 +772,7 @@ uint32_t lv_area_get_size(const lv_area_t * area_p)
|
||||
void lv_area_increase(lv_area_t * area, lv_coord_t w_extra, lv_coord_t h_extra)
|
||||
void lv_area_move(lv_area_t * area, lv_coord_t x_ofs, lv_coord_t y_ofs)
|
||||
void lv_area_align(const lv_area_t * base, lv_area_t * to_align, lv_align_t align, lv_coord_t ofs_x, lv_coord_t ofs_y)
|
||||
void lv_point_transform(lv_point_t * p, int32_t angle, int32_t zoom, const lv_point_t * pivot)
|
||||
static inline lv_coord_t lv_pct(lv_coord_t x)
|
||||
|
||||
// ../../lvgl/src/misc/lv_color.h
|
||||
@ -798,19 +815,22 @@ uint32_t lv_rand(uint32_t min, uint32_t max)
|
||||
// ../../lvgl/src/misc/lv_style.h
|
||||
void lv_style_init(lv_style_t * style)
|
||||
void lv_style_reset(lv_style_t * style)
|
||||
lv_style_prop_t lv_style_register_prop(void)
|
||||
lv_style_prop_t lv_style_register_prop(uint8_t flag)
|
||||
lv_style_prop_t lv_style_get_num_custom_props(void)
|
||||
bool lv_style_remove_prop(lv_style_t * style, lv_style_prop_t prop)
|
||||
void lv_style_set_prop(lv_style_t * style, lv_style_prop_t prop, lv_style_value_t value)
|
||||
lv_res_t lv_style_get_prop(const lv_style_t * style, lv_style_prop_t prop, lv_style_value_t * value)
|
||||
static inline lv_res_t lv_style_get_prop_inlined(const lv_style_t * style, lv_style_prop_t prop, lv_style_value_t * value)
|
||||
void lv_style_set_prop_meta(lv_style_t * style, lv_style_prop_t prop, uint16_t meta)
|
||||
lv_style_res_t lv_style_get_prop(const lv_style_t * style, lv_style_prop_t prop, lv_style_value_t * value)
|
||||
void lv_style_transition_dsc_init(lv_style_transition_dsc_t * tr, const lv_style_prop_t props[], lv_anim_path_cb_t path_cb, uint32_t time, uint32_t delay, void * user_data)
|
||||
lv_style_value_t lv_style_prop_get_default(lv_style_prop_t prop)
|
||||
static inline lv_style_res_t lv_style_get_prop_inlined(const lv_style_t * style, lv_style_prop_t prop, lv_style_value_t * value)
|
||||
bool lv_style_is_empty(const lv_style_t * style)
|
||||
static inline void lv_style_set_size(lv_style_t * style, lv_coord_t value)
|
||||
static inline void lv_style_set_pad_all(lv_style_t * style, lv_coord_t value)
|
||||
static inline void lv_style_set_pad_hor(lv_style_t * style, lv_coord_t value)
|
||||
static inline void lv_style_set_pad_ver(lv_style_t * style, lv_coord_t value)
|
||||
static inline void lv_style_set_pad_gap(lv_style_t * style, lv_coord_t value)
|
||||
static inline bool lv_style_prop_has_flag(lv_style_prop_t prop, uint8_t flag)
|
||||
|
||||
// ../../lvgl/src/misc/lv_style_gen.h
|
||||
void lv_style_set_width(lv_style_t * style, lv_coord_t value)
|
||||
@ -828,6 +848,8 @@ void lv_style_set_translate_x(lv_style_t * style, lv_coord_t value)
|
||||
void lv_style_set_translate_y(lv_style_t * style, lv_coord_t value)
|
||||
void lv_style_set_transform_zoom(lv_style_t * style, lv_coord_t value)
|
||||
void lv_style_set_transform_angle(lv_style_t * style, lv_coord_t value)
|
||||
void lv_style_set_transform_pivot_x(lv_style_t * style, lv_coord_t value)
|
||||
void lv_style_set_transform_pivot_y(lv_style_t * style, lv_coord_t value)
|
||||
void lv_style_set_pad_top(lv_style_t * style, lv_coord_t value)
|
||||
void lv_style_set_pad_bottom(lv_style_t * style, lv_coord_t value)
|
||||
void lv_style_set_pad_left(lv_style_t * style, lv_coord_t value)
|
||||
@ -835,10 +857,8 @@ void lv_style_set_pad_right(lv_style_t * style, lv_coord_t value)
|
||||
void lv_style_set_pad_row(lv_style_t * style, lv_coord_t value)
|
||||
void lv_style_set_pad_column(lv_style_t * style, lv_coord_t value)
|
||||
void lv_style_set_bg_color(lv_style_t * style, lv_color_t value)
|
||||
void lv_style_set_bg_color_filtered(lv_style_t * style, lv_color_t value)
|
||||
void lv_style_set_bg_opa(lv_style_t * style, lv_opa_t value)
|
||||
void lv_style_set_bg_grad_color(lv_style_t * style, lv_color_t value)
|
||||
void lv_style_set_bg_grad_color_filtered(lv_style_t * style, lv_color_t value)
|
||||
void lv_style_set_bg_grad_dir(lv_style_t * style, lv_grad_dir_t value)
|
||||
void lv_style_set_bg_main_stop(lv_style_t * style, lv_coord_t value)
|
||||
void lv_style_set_bg_grad_stop(lv_style_t * style, lv_coord_t value)
|
||||
@ -847,18 +867,15 @@ void lv_style_set_bg_dither_mode(lv_style_t * style, lv_dither_mode_t value)
|
||||
void lv_style_set_bg_img_src(lv_style_t * style, const void * value)
|
||||
void lv_style_set_bg_img_opa(lv_style_t * style, lv_opa_t value)
|
||||
void lv_style_set_bg_img_recolor(lv_style_t * style, lv_color_t value)
|
||||
void lv_style_set_bg_img_recolor_filtered(lv_style_t * style, lv_color_t value)
|
||||
void lv_style_set_bg_img_recolor_opa(lv_style_t * style, lv_opa_t value)
|
||||
void lv_style_set_bg_img_tiled(lv_style_t * style, bool value)
|
||||
void lv_style_set_border_color(lv_style_t * style, lv_color_t value)
|
||||
void lv_style_set_border_color_filtered(lv_style_t * style, lv_color_t value)
|
||||
void lv_style_set_border_opa(lv_style_t * style, lv_opa_t value)
|
||||
void lv_style_set_border_width(lv_style_t * style, lv_coord_t value)
|
||||
void lv_style_set_border_side(lv_style_t * style, lv_border_side_t value)
|
||||
void lv_style_set_border_post(lv_style_t * style, bool value)
|
||||
void lv_style_set_outline_width(lv_style_t * style, lv_coord_t value)
|
||||
void lv_style_set_outline_color(lv_style_t * style, lv_color_t value)
|
||||
void lv_style_set_outline_color_filtered(lv_style_t * style, lv_color_t value)
|
||||
void lv_style_set_outline_opa(lv_style_t * style, lv_opa_t value)
|
||||
void lv_style_set_outline_pad(lv_style_t * style, lv_coord_t value)
|
||||
void lv_style_set_shadow_width(lv_style_t * style, lv_coord_t value)
|
||||
@ -866,27 +883,22 @@ void lv_style_set_shadow_ofs_x(lv_style_t * style, lv_coord_t value)
|
||||
void lv_style_set_shadow_ofs_y(lv_style_t * style, lv_coord_t value)
|
||||
void lv_style_set_shadow_spread(lv_style_t * style, lv_coord_t value)
|
||||
void lv_style_set_shadow_color(lv_style_t * style, lv_color_t value)
|
||||
void lv_style_set_shadow_color_filtered(lv_style_t * style, lv_color_t value)
|
||||
void lv_style_set_shadow_opa(lv_style_t * style, lv_opa_t value)
|
||||
void lv_style_set_img_opa(lv_style_t * style, lv_opa_t value)
|
||||
void lv_style_set_img_recolor(lv_style_t * style, lv_color_t value)
|
||||
void lv_style_set_img_recolor_filtered(lv_style_t * style, lv_color_t value)
|
||||
void lv_style_set_img_recolor_opa(lv_style_t * style, lv_opa_t value)
|
||||
void lv_style_set_line_width(lv_style_t * style, lv_coord_t value)
|
||||
void lv_style_set_line_dash_width(lv_style_t * style, lv_coord_t value)
|
||||
void lv_style_set_line_dash_gap(lv_style_t * style, lv_coord_t value)
|
||||
void lv_style_set_line_rounded(lv_style_t * style, bool value)
|
||||
void lv_style_set_line_color(lv_style_t * style, lv_color_t value)
|
||||
void lv_style_set_line_color_filtered(lv_style_t * style, lv_color_t value)
|
||||
void lv_style_set_line_opa(lv_style_t * style, lv_opa_t value)
|
||||
void lv_style_set_arc_width(lv_style_t * style, lv_coord_t value)
|
||||
void lv_style_set_arc_rounded(lv_style_t * style, bool value)
|
||||
void lv_style_set_arc_color(lv_style_t * style, lv_color_t value)
|
||||
void lv_style_set_arc_color_filtered(lv_style_t * style, lv_color_t value)
|
||||
void lv_style_set_arc_opa(lv_style_t * style, lv_opa_t value)
|
||||
void lv_style_set_arc_img_src(lv_style_t * style, const void * value)
|
||||
void lv_style_set_text_color(lv_style_t * style, lv_color_t value)
|
||||
void lv_style_set_text_color_filtered(lv_style_t * style, lv_color_t value)
|
||||
void lv_style_set_text_opa(lv_style_t * style, lv_opa_t value)
|
||||
void lv_style_set_text_font(lv_style_t * style, const lv_font_t * value)
|
||||
void lv_style_set_text_letter_space(lv_style_t * style, lv_coord_t value)
|
||||
@ -898,6 +910,7 @@ void lv_style_set_clip_corner(lv_style_t * style, bool value)
|
||||
void lv_style_set_opa(lv_style_t * style, lv_opa_t value)
|
||||
void lv_style_set_color_filter_dsc(lv_style_t * style, const lv_color_filter_dsc_t * value)
|
||||
void lv_style_set_color_filter_opa(lv_style_t * style, lv_opa_t value)
|
||||
void lv_style_set_anim(lv_style_t * style, const lv_anim_t * value)
|
||||
void lv_style_set_anim_time(lv_style_t * style, uint32_t value)
|
||||
void lv_style_set_anim_speed(lv_style_t * style, uint32_t value)
|
||||
void lv_style_set_transition(lv_style_t * style, const lv_style_transition_dsc_t * value)
|
||||
@ -907,6 +920,7 @@ void lv_style_set_base_dir(lv_style_t * style, lv_base_dir_t value)
|
||||
|
||||
// ../../lvgl/src/misc/lv_timer.h
|
||||
uint32_t lv_timer_handler(void)
|
||||
static inline uint32_t lv_timer_handler_run_in_period(uint32_t ms)
|
||||
lv_timer_t * lv_timer_create_basic(void)
|
||||
lv_timer_t * lv_timer_create(lv_timer_cb_t timer_xcb, uint32_t period, void * user_data)
|
||||
void lv_timer_del(lv_timer_t * timer)
|
||||
@ -923,17 +937,17 @@ lv_timer_t * lv_timer_get_next(lv_timer_t * timer)
|
||||
|
||||
// ../../lvgl/src/widgets/lv_arc.h
|
||||
lv_obj_t * lv_arc_create(lv_obj_t * parent)
|
||||
void lv_arc_set_start_angle(lv_obj_t * arc, uint16_t start)
|
||||
void lv_arc_set_end_angle(lv_obj_t * arc, uint16_t end)
|
||||
void lv_arc_set_angles(lv_obj_t * arc, uint16_t start, uint16_t end)
|
||||
void lv_arc_set_bg_start_angle(lv_obj_t * arc, uint16_t start)
|
||||
void lv_arc_set_bg_end_angle(lv_obj_t * arc, uint16_t end)
|
||||
void lv_arc_set_bg_angles(lv_obj_t * arc, uint16_t start, uint16_t end)
|
||||
void lv_arc_set_rotation(lv_obj_t * arc, uint16_t rotation)
|
||||
void lv_arc_set_mode(lv_obj_t * arc, lv_arc_mode_t type)
|
||||
void lv_arc_set_value(lv_obj_t * arc, int16_t value)
|
||||
void lv_arc_set_range(lv_obj_t * arc, int16_t min, int16_t max)
|
||||
void lv_arc_set_change_rate(lv_obj_t * arc, uint16_t rate)
|
||||
void lv_arc_set_start_angle(lv_obj_t * obj, uint16_t start)
|
||||
void lv_arc_set_end_angle(lv_obj_t * obj, uint16_t end)
|
||||
void lv_arc_set_angles(lv_obj_t * obj, uint16_t start, uint16_t end)
|
||||
void lv_arc_set_bg_start_angle(lv_obj_t * obj, uint16_t start)
|
||||
void lv_arc_set_bg_end_angle(lv_obj_t * obj, uint16_t end)
|
||||
void lv_arc_set_bg_angles(lv_obj_t * obj, uint16_t start, uint16_t end)
|
||||
void lv_arc_set_rotation(lv_obj_t * obj, uint16_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, int16_t value)
|
||||
void lv_arc_set_range(lv_obj_t * obj, int16_t min, int16_t max)
|
||||
void lv_arc_set_change_rate(lv_obj_t * obj, uint16_t rate)
|
||||
uint16_t lv_arc_get_angle_start(lv_obj_t * obj)
|
||||
uint16_t lv_arc_get_angle_end(lv_obj_t * obj)
|
||||
uint16_t lv_arc_get_bg_angle_start(lv_obj_t * obj)
|
||||
@ -942,6 +956,8 @@ int16_t lv_arc_get_value(const lv_obj_t * obj)
|
||||
int16_t lv_arc_get_min_value(const lv_obj_t * obj)
|
||||
int16_t lv_arc_get_max_value(const lv_obj_t * obj)
|
||||
lv_arc_mode_t lv_arc_get_mode(const lv_obj_t * obj)
|
||||
void lv_arc_align_obj_to_angle(const lv_obj_t * obj, lv_obj_t * obj_to_align, lv_coord_t r_offset)
|
||||
void lv_arc_rotate_obj_to_angle(const lv_obj_t * obj, lv_obj_t * obj_to_rotate, lv_coord_t r_offset)
|
||||
|
||||
// ../../lvgl/src/widgets/lv_bar.h
|
||||
lv_obj_t * lv_bar_create(lv_obj_t * parent)
|
||||
@ -1019,6 +1035,7 @@ const char * lv_dropdown_get_options(const lv_obj_t * obj)
|
||||
uint16_t lv_dropdown_get_selected(const lv_obj_t * obj)
|
||||
uint16_t lv_dropdown_get_option_cnt(const lv_obj_t * obj)
|
||||
void lv_dropdown_get_selected_str(const lv_obj_t * obj, char * buf, uint32_t buf_size)
|
||||
int32_t lv_dropdown_get_option_index(lv_obj_t * obj, const char * option)
|
||||
const char * lv_dropdown_get_symbol(lv_obj_t * obj)
|
||||
bool lv_dropdown_get_selected_highlight(lv_obj_t * obj)
|
||||
lv_dir_t lv_dropdown_get_dir(const lv_obj_t * obj)
|
||||
@ -1126,6 +1143,7 @@ void lv_textarea_set_placeholder_text(lv_obj_t * obj, const char * txt)
|
||||
void lv_textarea_set_cursor_pos(lv_obj_t * obj, int32_t pos)
|
||||
void lv_textarea_set_cursor_click_pos(lv_obj_t * obj, bool en)
|
||||
void lv_textarea_set_password_mode(lv_obj_t * obj, bool en)
|
||||
void lv_textarea_set_password_bullet(lv_obj_t * obj, const char * bullet)
|
||||
void lv_textarea_set_one_line(lv_obj_t * obj, bool en)
|
||||
void lv_textarea_set_accepted_chars(lv_obj_t * obj, const char * list)
|
||||
void lv_textarea_set_max_length(lv_obj_t * obj, uint32_t num)
|
||||
@ -1139,6 +1157,7 @@ lv_obj_t * lv_textarea_get_label(const lv_obj_t * obj)
|
||||
uint32_t lv_textarea_get_cursor_pos(const lv_obj_t * obj)
|
||||
bool lv_textarea_get_cursor_click_pos(lv_obj_t * obj)
|
||||
bool lv_textarea_get_password_mode(const lv_obj_t * obj)
|
||||
const char * lv_textarea_get_password_bullet(lv_obj_t * obj)
|
||||
bool lv_textarea_get_one_line(const lv_obj_t * obj)
|
||||
const char * lv_textarea_get_accepted_chars(lv_obj_t * obj)
|
||||
uint32_t lv_textarea_get_max_length(lv_obj_t * obj)
|
||||
|
@ -138,7 +138,7 @@ const be_ctypes_structure_t be_lv_draw_img_dsc = {
|
||||
10, /* number of elements */
|
||||
be_ctypes_instance_mappings,
|
||||
(const be_ctypes_structure_item_t[10]) {
|
||||
{ "angle", 0, 0, 0, ctypes_u16, 0 },
|
||||
{ "angle", 0, 0, 0, ctypes_i16, 0 },
|
||||
{ "antialias", 20, 0, 1, ctypes_bf, 0 },
|
||||
{ "blend_mode", 12, 0, 4, ctypes_bf, 0 },
|
||||
{ "frame_id", 16, 0, 0, ctypes_i32, 0 },
|
||||
@ -175,6 +175,27 @@ const be_ctypes_structure_t be_lv_obj_draw_part_dsc = {
|
||||
{ "value", 64, 0, 0, ctypes_i32, 0 },
|
||||
}};
|
||||
|
||||
const be_ctypes_structure_t be_lv_draw_layer_ctx = {
|
||||
40, /* size in bytes */
|
||||
14, /* number of elements */
|
||||
be_ctypes_instance_mappings,
|
||||
(const be_ctypes_structure_item_t[14]) {
|
||||
{ "area_act_x1", 8, 0, 0, ctypes_i16, 0 },
|
||||
{ "area_act_x2", 12, 0, 0, ctypes_i16, 0 },
|
||||
{ "area_act_y1", 10, 0, 0, ctypes_i16, 0 },
|
||||
{ "area_act_y2", 14, 0, 0, ctypes_i16, 0 },
|
||||
{ "area_full_x1", 0, 0, 0, ctypes_i16, 0 },
|
||||
{ "area_full_x2", 4, 0, 0, ctypes_i16, 0 },
|
||||
{ "area_full_y1", 2, 0, 0, ctypes_i16, 0 },
|
||||
{ "area_full_y2", 6, 0, 0, ctypes_i16, 0 },
|
||||
{ "buf", 32, 0, 0, ctypes_ptr32, 0 },
|
||||
{ "buf_area", 28, 0, 0, ctypes_ptr32, 0 },
|
||||
{ "clip_area", 24, 0, 0, ctypes_ptr32, 0 },
|
||||
{ "max_row_with_alpha", 16, 0, 0, ctypes_i16, 0 },
|
||||
{ "max_row_with_no_alpha", 18, 0, 0, ctypes_i16, 0 },
|
||||
{ "screen_transp", 36, 0, 0, ctypes_u8, 0 },
|
||||
}};
|
||||
|
||||
const be_ctypes_structure_t be_lv_draw_mask_common_dsc = {
|
||||
8, /* size in bytes */
|
||||
2, /* number of elements */
|
||||
@ -446,68 +467,6 @@ const be_ctypes_structure_t be_lv_meter_indicator = {
|
||||
{ "type", 4, 0, 0, ctypes_u8, 0 },
|
||||
}};
|
||||
|
||||
const be_ctypes_structure_t be_lv_meter_indicator_needle_img = {
|
||||
24, /* size in bytes */
|
||||
8, /* number of elements */
|
||||
be_ctypes_instance_mappings,
|
||||
(const be_ctypes_structure_item_t[8]) {
|
||||
{ "end_value", 12, 0, 0, ctypes_i32, 0 },
|
||||
{ "opa", 5, 0, 0, ctypes_u8, 0 },
|
||||
{ "pivot_x", 20, 0, 0, ctypes_i16, 0 },
|
||||
{ "pivot_y", 22, 0, 0, ctypes_i16, 0 },
|
||||
{ "scale", 0, 0, 0, ctypes_ptr32, 0 },
|
||||
{ "src", 16, 0, 0, ctypes_ptr32, 0 },
|
||||
{ "start_value", 8, 0, 0, ctypes_i32, 0 },
|
||||
{ "type", 4, 0, 0, ctypes_u8, 0 },
|
||||
}};
|
||||
|
||||
const be_ctypes_structure_t be_lv_meter_indicator_needle_line = {
|
||||
24, /* size in bytes */
|
||||
8, /* number of elements */
|
||||
be_ctypes_instance_mappings,
|
||||
(const be_ctypes_structure_item_t[8]) {
|
||||
{ "color", 20, 0, 0, ctypes_u16, 1 },
|
||||
{ "end_value", 12, 0, 0, ctypes_i32, 0 },
|
||||
{ "opa", 5, 0, 0, ctypes_u8, 0 },
|
||||
{ "r_mod", 18, 0, 0, ctypes_i16, 0 },
|
||||
{ "scale", 0, 0, 0, ctypes_ptr32, 0 },
|
||||
{ "start_value", 8, 0, 0, ctypes_i32, 0 },
|
||||
{ "type", 4, 0, 0, ctypes_u8, 0 },
|
||||
{ "width", 16, 0, 0, ctypes_u16, 0 },
|
||||
}};
|
||||
|
||||
const be_ctypes_structure_t be_lv_meter_indicator_arc = {
|
||||
28, /* size in bytes */
|
||||
9, /* number of elements */
|
||||
be_ctypes_instance_mappings,
|
||||
(const be_ctypes_structure_item_t[9]) {
|
||||
{ "color", 24, 0, 0, ctypes_u16, 1 },
|
||||
{ "end_value", 12, 0, 0, ctypes_i32, 0 },
|
||||
{ "opa", 5, 0, 0, ctypes_u8, 0 },
|
||||
{ "r_mod", 26, 0, 0, ctypes_i16, 0 },
|
||||
{ "scale", 0, 0, 0, ctypes_ptr32, 0 },
|
||||
{ "src", 20, 0, 0, ctypes_ptr32, 0 },
|
||||
{ "start_value", 8, 0, 0, ctypes_i32, 0 },
|
||||
{ "type", 4, 0, 0, ctypes_u8, 0 },
|
||||
{ "width", 16, 0, 0, ctypes_u16, 0 },
|
||||
}};
|
||||
|
||||
const be_ctypes_structure_t be_lv_meter_indicator_scale_lines = {
|
||||
24, /* size in bytes */
|
||||
9, /* number of elements */
|
||||
be_ctypes_instance_mappings,
|
||||
(const be_ctypes_structure_item_t[9]) {
|
||||
{ "color_end", 20, 0, 0, ctypes_u16, 1 },
|
||||
{ "color_start", 18, 0, 0, ctypes_u16, 1 },
|
||||
{ "end_value", 12, 0, 0, ctypes_i32, 0 },
|
||||
{ "local_grad", 22, 0, 1, ctypes_bf, 0 },
|
||||
{ "opa", 5, 0, 0, ctypes_u8, 0 },
|
||||
{ "scale", 0, 0, 0, ctypes_ptr32, 0 },
|
||||
{ "start_value", 8, 0, 0, ctypes_i32, 0 },
|
||||
{ "type", 4, 0, 0, ctypes_u8, 0 },
|
||||
{ "width_mod", 16, 0, 0, ctypes_i16, 0 },
|
||||
}};
|
||||
|
||||
const be_ctypes_structure_t be_lv_chart_series = {
|
||||
16, /* size in bytes */
|
||||
9, /* number of elements */
|
||||
@ -654,29 +613,36 @@ const be_ctypes_structure_t be_lv_timer = {
|
||||
}};
|
||||
|
||||
const be_ctypes_structure_t be_lv_draw_ctx = {
|
||||
60, /* size in bytes */
|
||||
19, /* number of elements */
|
||||
88, /* size in bytes */
|
||||
26, /* number of elements */
|
||||
be_ctypes_instance_mappings,
|
||||
(const be_ctypes_structure_item_t[19]) {
|
||||
(const be_ctypes_structure_item_t[26]) {
|
||||
{ "buf", 0, 0, 0, ctypes_ptr32, 0 },
|
||||
{ "buf_area_x1", 4, 0, 0, ctypes_i16, 0 },
|
||||
{ "buf_area_x2", 8, 0, 0, ctypes_i16, 0 },
|
||||
{ "buf_area_y1", 6, 0, 0, ctypes_i16, 0 },
|
||||
{ "buf_area_y2", 10, 0, 0, ctypes_i16, 0 },
|
||||
{ "buffer_copy", 60, 0, 0, ctypes_ptr32, 0 },
|
||||
{ "clip_area_x1", 12, 0, 0, ctypes_i16, 0 },
|
||||
{ "clip_area_x2", 16, 0, 0, ctypes_i16, 0 },
|
||||
{ "clip_area_y1", 14, 0, 0, ctypes_i16, 0 },
|
||||
{ "clip_area_y2", 18, 0, 0, ctypes_i16, 0 },
|
||||
{ "draw_arc", 24, 0, 0, ctypes_ptr32, 0 },
|
||||
{ "draw_bg", 48, 0, 0, ctypes_ptr32, 0 },
|
||||
{ "draw_bg", 52, 0, 0, ctypes_ptr32, 0 },
|
||||
{ "draw_img", 32, 0, 0, ctypes_ptr32, 0 },
|
||||
{ "draw_img_decoded", 28, 0, 0, ctypes_ptr32, 0 },
|
||||
{ "draw_letter", 36, 0, 0, ctypes_ptr32, 0 },
|
||||
{ "draw_line", 40, 0, 0, ctypes_ptr32, 0 },
|
||||
{ "draw_polygon", 44, 0, 0, ctypes_ptr32, 0 },
|
||||
{ "draw_rect", 20, 0, 0, ctypes_ptr32, 0 },
|
||||
{ "user_data", 56, 0, 0, ctypes_ptr32, 0 },
|
||||
{ "wait_for_finish", 52, 0, 0, ctypes_ptr32, 0 },
|
||||
{ "draw_transform", 48, 0, 0, ctypes_ptr32, 0 },
|
||||
{ "layer_adjust", 68, 0, 0, ctypes_ptr32, 0 },
|
||||
{ "layer_blend", 72, 0, 0, ctypes_ptr32, 0 },
|
||||
{ "layer_destroy", 76, 0, 0, ctypes_ptr32, 0 },
|
||||
{ "layer_init", 64, 0, 0, ctypes_ptr32, 0 },
|
||||
{ "layer_instance_size", 80, 0, 0, ctypes_u32, 0 },
|
||||
{ "user_data", 84, 0, 0, ctypes_ptr32, 0 },
|
||||
{ "wait_for_finish", 56, 0, 0, ctypes_ptr32, 0 },
|
||||
}};
|
||||
|
||||
const be_ctypes_structure_t be_lv_ts_calibration = {
|
||||
@ -705,6 +671,7 @@ static be_define_ctypes_class(lv_coord, &be_lv_coord, &be_class_ctypes_bytes, "l
|
||||
static be_define_ctypes_class(lv_draw_arc_dsc, &be_lv_draw_arc_dsc, &be_class_ctypes_bytes, "lv_draw_arc_dsc");
|
||||
static be_define_ctypes_class(lv_draw_ctx, &be_lv_draw_ctx, &be_class_ctypes_bytes, "lv_draw_ctx");
|
||||
static be_define_ctypes_class(lv_draw_img_dsc, &be_lv_draw_img_dsc, &be_class_ctypes_bytes, "lv_draw_img_dsc");
|
||||
static be_define_ctypes_class(lv_draw_layer_ctx, &be_lv_draw_layer_ctx, &be_class_ctypes_bytes, "lv_draw_layer_ctx");
|
||||
static be_define_ctypes_class(lv_draw_line_dsc, &be_lv_draw_line_dsc, &be_class_ctypes_bytes, "lv_draw_line_dsc");
|
||||
static be_define_ctypes_class(lv_draw_mask_angle_param, &be_lv_draw_mask_angle_param, &be_class_ctypes_bytes, "lv_draw_mask_angle_param");
|
||||
static be_define_ctypes_class(lv_draw_mask_angle_param_cfg, &be_lv_draw_mask_angle_param_cfg, &be_class_ctypes_bytes, "lv_draw_mask_angle_param_cfg");
|
||||
@ -728,10 +695,6 @@ static be_define_ctypes_class(lv_gradient_stop, &be_lv_gradient_stop, &be_class_
|
||||
static be_define_ctypes_class(lv_img_dsc, &be_lv_img_dsc, &be_class_ctypes_bytes, "lv_img_dsc");
|
||||
static be_define_ctypes_class(lv_img_header, &be_lv_img_header, &be_class_ctypes_bytes, "lv_img_header");
|
||||
static be_define_ctypes_class(lv_meter_indicator, &be_lv_meter_indicator, &be_class_ctypes_bytes, "lv_meter_indicator");
|
||||
static be_define_ctypes_class(lv_meter_indicator_arc, &be_lv_meter_indicator_arc, &be_class_ctypes_bytes, "lv_meter_indicator_arc");
|
||||
static be_define_ctypes_class(lv_meter_indicator_needle_img, &be_lv_meter_indicator_needle_img, &be_class_ctypes_bytes, "lv_meter_indicator_needle_img");
|
||||
static be_define_ctypes_class(lv_meter_indicator_needle_line, &be_lv_meter_indicator_needle_line, &be_class_ctypes_bytes, "lv_meter_indicator_needle_line");
|
||||
static be_define_ctypes_class(lv_meter_indicator_scale_lines, &be_lv_meter_indicator_scale_lines, &be_class_ctypes_bytes, "lv_meter_indicator_scale_lines");
|
||||
static be_define_ctypes_class(lv_meter_scale, &be_lv_meter_scale, &be_class_ctypes_bytes, "lv_meter_scale");
|
||||
static be_define_ctypes_class(lv_obj_class, &be_lv_obj_class, &be_class_ctypes_bytes, "lv_obj_class");
|
||||
static be_define_ctypes_class(lv_obj_draw_part_dsc, &be_lv_obj_draw_part_dsc, &be_class_ctypes_bytes, "lv_obj_draw_part_dsc");
|
||||
@ -751,6 +714,7 @@ void be_load_ctypes_lvgl_definitions_lib(bvm *vm) {
|
||||
ctypes_register_class(vm, &be_class_lv_draw_arc_dsc);
|
||||
ctypes_register_class(vm, &be_class_lv_draw_ctx);
|
||||
ctypes_register_class(vm, &be_class_lv_draw_img_dsc);
|
||||
ctypes_register_class(vm, &be_class_lv_draw_layer_ctx);
|
||||
ctypes_register_class(vm, &be_class_lv_draw_line_dsc);
|
||||
ctypes_register_class(vm, &be_class_lv_draw_mask_angle_param);
|
||||
ctypes_register_class(vm, &be_class_lv_draw_mask_angle_param_cfg);
|
||||
@ -774,10 +738,6 @@ void be_load_ctypes_lvgl_definitions_lib(bvm *vm) {
|
||||
ctypes_register_class(vm, &be_class_lv_img_dsc);
|
||||
ctypes_register_class(vm, &be_class_lv_img_header);
|
||||
ctypes_register_class(vm, &be_class_lv_meter_indicator);
|
||||
ctypes_register_class(vm, &be_class_lv_meter_indicator_arc);
|
||||
ctypes_register_class(vm, &be_class_lv_meter_indicator_needle_img);
|
||||
ctypes_register_class(vm, &be_class_lv_meter_indicator_needle_line);
|
||||
ctypes_register_class(vm, &be_class_lv_meter_indicator_scale_lines);
|
||||
ctypes_register_class(vm, &be_class_lv_meter_scale);
|
||||
ctypes_register_class(vm, &be_class_lv_obj_class);
|
||||
ctypes_register_class(vm, &be_class_lv_obj_draw_part_dsc);
|
||||
@ -798,6 +758,7 @@ be_ctypes_class_by_name_t be_ctypes_lvgl_classes[] = {
|
||||
{ "lv_draw_arc_dsc", &be_class_lv_draw_arc_dsc },
|
||||
{ "lv_draw_ctx", &be_class_lv_draw_ctx },
|
||||
{ "lv_draw_img_dsc", &be_class_lv_draw_img_dsc },
|
||||
{ "lv_draw_layer_ctx", &be_class_lv_draw_layer_ctx },
|
||||
{ "lv_draw_line_dsc", &be_class_lv_draw_line_dsc },
|
||||
{ "lv_draw_mask_angle_param", &be_class_lv_draw_mask_angle_param },
|
||||
{ "lv_draw_mask_angle_param_cfg", &be_class_lv_draw_mask_angle_param_cfg },
|
||||
@ -821,10 +782,6 @@ be_ctypes_class_by_name_t be_ctypes_lvgl_classes[] = {
|
||||
{ "lv_img_dsc", &be_class_lv_img_dsc },
|
||||
{ "lv_img_header", &be_class_lv_img_header },
|
||||
{ "lv_meter_indicator", &be_class_lv_meter_indicator },
|
||||
{ "lv_meter_indicator_arc", &be_class_lv_meter_indicator_arc },
|
||||
{ "lv_meter_indicator_needle_img", &be_class_lv_meter_indicator_needle_img },
|
||||
{ "lv_meter_indicator_needle_line", &be_class_lv_meter_indicator_needle_line },
|
||||
{ "lv_meter_indicator_scale_lines", &be_class_lv_meter_indicator_scale_lines },
|
||||
{ "lv_meter_scale", &be_class_lv_meter_scale },
|
||||
{ "lv_obj_class", &be_class_lv_obj_class },
|
||||
{ "lv_obj_draw_part_dsc", &be_class_lv_obj_draw_part_dsc },
|
||||
|
@ -46,18 +46,18 @@ uint32_t = ct.u32
|
||||
int32_t = ct.i32
|
||||
ptr = ct.ptr32
|
||||
|
||||
lv_coord = [ # valid LVGL8
|
||||
lv_coord = [ # valid LVGL8.3
|
||||
[lv_coord_t, "v"],
|
||||
]
|
||||
lv_coord = ct.structure(lv_coord, "lv_coord")
|
||||
|
||||
lv_point = [ # valid LVGL8
|
||||
lv_point = [ # valid LVGL8.3
|
||||
[lv_coord_t, "x"],
|
||||
[lv_coord_t, "y"],
|
||||
]
|
||||
lv_point = ct.structure(lv_point, "lv_point")
|
||||
|
||||
lv_area = [ # valid LVGL8
|
||||
lv_area = [ # valid LVGL8.3
|
||||
[lv_coord_t, "x1"],
|
||||
[lv_coord_t, "y1"],
|
||||
[lv_coord_t, "x2"],
|
||||
@ -67,13 +67,13 @@ lv_area = ct.structure(lv_area, "lv_area")
|
||||
|
||||
#######################################################################
|
||||
# lv_grad_dsc
|
||||
lv_gradient_stop = [
|
||||
lv_gradient_stop = [ # valid LVGL8.3
|
||||
[lv_color, "color"],
|
||||
[uint8_t, "frac"],
|
||||
]
|
||||
lv_gradient_stop = ct.structure(lv_gradient_stop, "lv_gradient_stop")
|
||||
|
||||
lv_grad_dsc = [
|
||||
lv_grad_dsc = [ # valid LVGL8.3
|
||||
[lv_gradient_stop, "stops_0"],
|
||||
[lv_gradient_stop, "stops_1"],
|
||||
[uint8_t, "stops_count"],
|
||||
@ -82,7 +82,7 @@ lv_grad_dsc = [
|
||||
]
|
||||
lv_grad_dsc = ct.structure(lv_grad_dsc, "lv_grad_dsc")
|
||||
|
||||
lv_draw_rect_dsc = [ # valid LVGL8.2
|
||||
lv_draw_rect_dsc = [ # valid LVGL8.3
|
||||
[lv_coord_t, "radius"],
|
||||
[lv_blend_mode, "blend_mode"],
|
||||
|
||||
@ -122,7 +122,7 @@ lv_draw_rect_dsc = [ # valid LVGL8.2
|
||||
]
|
||||
lv_draw_rect_dsc = ct.structure(lv_draw_rect_dsc, "lv_draw_rect_dsc")
|
||||
|
||||
lv_draw_line_dsc = [ # valid LVGL8.2
|
||||
lv_draw_line_dsc = [ # valid LVGL8.3
|
||||
[lv_color, "color"],
|
||||
[lv_coord_t, "width"],
|
||||
[lv_coord_t, "dash_width"],
|
||||
@ -135,7 +135,7 @@ lv_draw_line_dsc = [ # valid LVGL8.2
|
||||
]
|
||||
lv_draw_line_dsc = ct.structure(lv_draw_line_dsc, "lv_draw_line_dsc")
|
||||
|
||||
lv_draw_arc_dsc = [ # valid LVGL8.2
|
||||
lv_draw_arc_dsc = [ # valid LVGL8.3
|
||||
[lv_color, "color"],
|
||||
[lv_coord_t, "width"],
|
||||
[uint16_t, "start_angle"],
|
||||
@ -147,8 +147,8 @@ lv_draw_arc_dsc = [ # valid LVGL8.2
|
||||
]
|
||||
lv_draw_arc_dsc = ct.structure(lv_draw_arc_dsc, "lv_draw_arc_dsc")
|
||||
|
||||
lv_draw_img_dsc = [ # valid LVGL8.2
|
||||
[uint16_t, "angle"],
|
||||
lv_draw_img_dsc = [ # valid LVGL8.3
|
||||
[int16_t, "angle"],
|
||||
[uint16_t, "zoom"],
|
||||
[lv_point, "pivot"],
|
||||
|
||||
@ -163,7 +163,7 @@ lv_draw_img_dsc = [ # valid LVGL8.2
|
||||
]
|
||||
lv_draw_img_dsc = ct.structure(lv_draw_img_dsc, "lv_draw_img_dsc")
|
||||
|
||||
lv_obj_draw_part_dsc = [ # valid LVGL8.2
|
||||
lv_obj_draw_part_dsc = [ # valid LVGL8.3
|
||||
[ptr, "draw_ctx"],
|
||||
[ptr, "class_p"],
|
||||
[uint32_t, "type"],
|
||||
@ -185,18 +185,31 @@ lv_obj_draw_part_dsc = [ # valid LVGL8.2
|
||||
]
|
||||
lv_obj_draw_part_dsc = ct.structure(lv_obj_draw_part_dsc, "lv_obj_draw_part_dsc")
|
||||
|
||||
lv_draw_layer_ctx = [ # valid LVGL8.3
|
||||
[lv_area, "area_full"],
|
||||
[lv_area, "area_act"],
|
||||
[lv_coord_t, "max_row_with_alpha"],
|
||||
[lv_coord_t, "max_row_with_no_alpha"],
|
||||
[ptr, "buf"],
|
||||
[ptr, "clip_area"],
|
||||
[ptr, "buf_area"],
|
||||
[ptr, "buf"],
|
||||
[uint8_t, "screen_transp"],
|
||||
]
|
||||
lv_draw_layer_ctx = ct.structure(lv_draw_layer_ctx, "lv_draw_layer_ctx")
|
||||
|
||||
#- --------- lv_mask --------- -#
|
||||
lv_draw_mask_xcb = ptr # callback
|
||||
lv_draw_mask_type = ct.u8
|
||||
lv_draw_mask_line_side = ct.u8
|
||||
|
||||
lv_draw_mask_common_dsc = [ # valid LVGL8.2
|
||||
lv_draw_mask_common_dsc = [ # valid LVGL8.3
|
||||
[lv_draw_mask_xcb, "cb"],
|
||||
[lv_draw_mask_type, "type"],
|
||||
]
|
||||
lv_draw_mask_common_dsc = ct.structure(lv_draw_mask_common_dsc, "lv_draw_mask_common_dsc")
|
||||
|
||||
lv_draw_mask_line_param_cfg = [ # valid LVGL8.2
|
||||
lv_draw_mask_line_param_cfg = [ # valid LVGL8.3
|
||||
#/*First point */
|
||||
[lv_point, "p1"],
|
||||
|
||||
@ -208,7 +221,7 @@ lv_draw_mask_line_param_cfg = [ # valid LVGL8.2
|
||||
]
|
||||
lv_draw_mask_line_param_cfg = ct.structure(lv_draw_mask_line_param_cfg, "lv_draw_mask_line_param_cfg")
|
||||
|
||||
lv_draw_mask_line_param = [ # valid LVGL8.2
|
||||
lv_draw_mask_line_param = [ # valid LVGL8.3
|
||||
#/*The first element must be the common descriptor*/
|
||||
[lv_draw_mask_common_dsc, "dsc"],
|
||||
[lv_draw_mask_line_param_cfg, "cfg"],
|
||||
@ -230,14 +243,14 @@ lv_draw_mask_line_param = [ # valid LVGL8.2
|
||||
]
|
||||
lv_draw_mask_line_param = ct.structure(lv_draw_mask_line_param, "lv_draw_mask_line_param")
|
||||
|
||||
lv_draw_mask_angle_param_cfg = [ # valid LVGL8.2
|
||||
lv_draw_mask_angle_param_cfg = [ # valid LVGL8.3
|
||||
[lv_point, "vertex_p"],
|
||||
[lv_coord_t, "start_angle"],
|
||||
[lv_coord_t, "end_angle"],
|
||||
]
|
||||
lv_draw_mask_angle_param_cfg = ct.structure(lv_draw_mask_angle_param_cfg, "lv_draw_mask_angle_param_cfg")
|
||||
|
||||
lv_draw_mask_angle_param = [ # valid LVGL8.2
|
||||
lv_draw_mask_angle_param = [ # valid LVGL8.3
|
||||
#/*The first element must be the common descriptor*/
|
||||
[lv_draw_mask_common_dsc, "dsc"],
|
||||
[lv_draw_mask_angle_param_cfg, "cfg"],
|
||||
@ -249,14 +262,14 @@ lv_draw_mask_angle_param = [ # valid LVGL8.2
|
||||
lv_draw_mask_angle_param = ct.structure(lv_draw_mask_angle_param, "lv_draw_mask_angle_param")
|
||||
|
||||
|
||||
lv_draw_mask_radius_param_cfg = [ # valid LVGL8.2
|
||||
lv_draw_mask_radius_param_cfg = [ # valid LVGL8.3
|
||||
[lv_area, "rect"],
|
||||
[lv_coord_t, "radius"],
|
||||
[uint8_t_1, "outer"],
|
||||
]
|
||||
lv_draw_mask_radius_param_cfg = ct.structure(lv_draw_mask_radius_param_cfg, "lv_draw_mask_radius_param_cfg")
|
||||
|
||||
lv_draw_mask_radius_circle_dsc = [ # valid LVGL8.2
|
||||
lv_draw_mask_radius_circle_dsc = [ # valid LVGL8.3
|
||||
[ptr, "buf"],
|
||||
[ptr, "cir_opa"],
|
||||
[ptr, "x_start_on_y"],
|
||||
@ -267,7 +280,7 @@ lv_draw_mask_radius_circle_dsc = [ # valid LVGL8.2
|
||||
]
|
||||
lv_draw_mask_radius_circle_dsc = ct.structure(lv_draw_mask_radius_circle_dsc, "lv_draw_mask_radius_circle_dsc")
|
||||
|
||||
lv_draw_mask_radius_param = [ # valid LVGL8.2
|
||||
lv_draw_mask_radius_param = [ # valid LVGL8.3
|
||||
#/*The first element must be the common descriptor*/
|
||||
[lv_draw_mask_common_dsc, "dsc"],
|
||||
[lv_draw_mask_radius_param_cfg, "cfg"],
|
||||
@ -276,7 +289,7 @@ lv_draw_mask_radius_param = [ # valid LVGL8.2
|
||||
lv_draw_mask_radius_param = ct.structure(lv_draw_mask_radius_param, "lv_draw_mask_radius_param")
|
||||
|
||||
|
||||
lv_draw_mask_fade_param_cfg = [ # valid LVGL8.2
|
||||
lv_draw_mask_fade_param_cfg = [ # valid LVGL8.3
|
||||
[lv_area, "coords"],
|
||||
[lv_coord_t, "y_top"],
|
||||
[lv_coord_t, "y_bottom"],
|
||||
@ -285,7 +298,7 @@ lv_draw_mask_fade_param_cfg = [ # valid LVGL8.2
|
||||
]
|
||||
lv_draw_mask_fade_param_cfg = ct.structure(lv_draw_mask_fade_param_cfg, "lv_draw_mask_fade_param_cfg")
|
||||
|
||||
lv_draw_mask_fade_param = [ # valid LVGL8.2
|
||||
lv_draw_mask_fade_param = [ # valid LVGL8.3
|
||||
# /*The first element must be the common descriptor*/
|
||||
[lv_draw_mask_common_dsc, "dsc"],
|
||||
[lv_draw_mask_fade_param_cfg, "cfg"],
|
||||
@ -293,33 +306,33 @@ lv_draw_mask_fade_param = [ # valid LVGL8.2
|
||||
lv_draw_mask_fade_param = ct.structure(lv_draw_mask_fade_param, "lv_draw_mask_fade_param")
|
||||
|
||||
|
||||
lv_draw_mask_map_param_cfg = [ # valid LVGL8.2
|
||||
lv_draw_mask_map_param_cfg = [ # valid LVGL8.3
|
||||
[lv_area, "coords"],
|
||||
[ptr, "map"],
|
||||
]
|
||||
lv_draw_mask_map_param_cfg = ct.structure(lv_draw_mask_map_param_cfg, "lv_draw_mask_map_param_cfg")
|
||||
|
||||
lv_draw_mask_map_param = [ # valid LVGL8.2
|
||||
lv_draw_mask_map_param = [ # valid LVGL8.3
|
||||
[lv_draw_mask_common_dsc, "dsc"],
|
||||
[lv_draw_mask_map_param_cfg, "cfg"],
|
||||
]
|
||||
lv_draw_mask_map_param = ct.structure(lv_draw_mask_map_param, "lv_draw_mask_map_param")
|
||||
|
||||
|
||||
lv_draw_mask_polygon_param_cfg = [ # valid LVGL8.2
|
||||
lv_draw_mask_polygon_param_cfg = [ # valid LVGL8.3
|
||||
[ptr, "points"],
|
||||
[uint16_t, "point_cnt"],
|
||||
]
|
||||
lv_draw_mask_polygon_param_cfg = ct.structure(lv_draw_mask_polygon_param_cfg, "lv_draw_mask_polygon_param_cfg")
|
||||
|
||||
lv_draw_mask_polygon_param = [ # valid LVGL8.2
|
||||
lv_draw_mask_polygon_param = [ # valid LVGL8.3
|
||||
[lv_draw_mask_common_dsc, "dsc"],
|
||||
[lv_draw_mask_polygon_param_cfg, "cfg"],
|
||||
]
|
||||
lv_draw_mask_polygon_param = ct.structure(lv_draw_mask_polygon_param, "lv_draw_mask_polygon_param")
|
||||
|
||||
|
||||
lv_draw_mask_saved = [ # valid LVGL8.2
|
||||
lv_draw_mask_saved = [ # valid LVGL8.3
|
||||
[ptr, "param"],
|
||||
[ptr, "custom_id"],
|
||||
]
|
||||
@ -328,7 +341,7 @@ lv_draw_mask_saved = ct.structure(lv_draw_mask_saved, "lv_draw_mask_saved")
|
||||
# lv_meter
|
||||
|
||||
# lv_meter_scale_t
|
||||
lv_meter_scale = [ # valid LVGL8.2
|
||||
lv_meter_scale = [ # valid LVGL8.3
|
||||
[lv_color, "tick_color"],
|
||||
[uint16_t, "tick_cnt"],
|
||||
[uint16_t, "tick_length"],
|
||||
@ -351,7 +364,7 @@ lv_meter_scale = [ # valid LVGL8.2
|
||||
lv_meter_scale = ct.structure(lv_meter_scale, "lv_meter_scale")
|
||||
|
||||
# lv_meter_indicator_t
|
||||
lv_meter_indicator = [ # valid LVGL8.2
|
||||
lv_meter_indicator = [ # valid LVGL8.3
|
||||
[ptr, "scale"],
|
||||
[lv_meter_indicator_type_t, "type"],
|
||||
[lv_opa, "opa"],
|
||||
@ -364,61 +377,61 @@ lv_meter_indicator = [ # valid LVGL8.2
|
||||
]
|
||||
lv_meter_indicator = ct.structure(lv_meter_indicator, "lv_meter_indicator")
|
||||
|
||||
# variants
|
||||
lv_meter_indicator_needle_img = [ # valid LVGL8.2
|
||||
[ptr, "scale"],
|
||||
[lv_meter_indicator_type_t, "type"],
|
||||
[lv_opa, "opa"],
|
||||
[int32_t, "start_value"],
|
||||
[int32_t, "end_value"],
|
||||
# specifc portion
|
||||
[ptr, "src"],
|
||||
[lv_point, "pivot"],
|
||||
]
|
||||
lv_meter_indicator_needle_img = ct.structure(lv_meter_indicator_needle_img, "lv_meter_indicator_needle_img")
|
||||
# # variants
|
||||
# lv_meter_indicator_needle_img = [ # valid LVGL8.2
|
||||
# [ptr, "scale"],
|
||||
# [lv_meter_indicator_type_t, "type"],
|
||||
# [lv_opa, "opa"],
|
||||
# [int32_t, "start_value"],
|
||||
# [int32_t, "end_value"],
|
||||
# # specifc portion
|
||||
# [ptr, "src"],
|
||||
# [lv_point, "pivot"],
|
||||
# ]
|
||||
# lv_meter_indicator_needle_img = ct.structure(lv_meter_indicator_needle_img, "lv_meter_indicator_needle_img")
|
||||
|
||||
lv_meter_indicator_needle_line = [ # valid LVGL8.2
|
||||
[ptr, "scale"],
|
||||
[lv_meter_indicator_type_t, "type"],
|
||||
[lv_opa, "opa"],
|
||||
[int32_t, "start_value"],
|
||||
[int32_t, "end_value"],
|
||||
# specifc portion
|
||||
[uint16_t, "width"],
|
||||
[int16_t, "r_mod"],
|
||||
[lv_color, "color"],
|
||||
]
|
||||
lv_meter_indicator_needle_line = ct.structure(lv_meter_indicator_needle_line, "lv_meter_indicator_needle_line")
|
||||
# lv_meter_indicator_needle_line = [ # valid LVGL8.2
|
||||
# [ptr, "scale"],
|
||||
# [lv_meter_indicator_type_t, "type"],
|
||||
# [lv_opa, "opa"],
|
||||
# [int32_t, "start_value"],
|
||||
# [int32_t, "end_value"],
|
||||
# # specifc portion
|
||||
# [uint16_t, "width"],
|
||||
# [int16_t, "r_mod"],
|
||||
# [lv_color, "color"],
|
||||
# ]
|
||||
# lv_meter_indicator_needle_line = ct.structure(lv_meter_indicator_needle_line, "lv_meter_indicator_needle_line")
|
||||
|
||||
lv_meter_indicator_arc = [ # valid LVGL8.2
|
||||
[ptr, "scale"],
|
||||
[lv_meter_indicator_type_t, "type"],
|
||||
[lv_opa, "opa"],
|
||||
[int32_t, "start_value"],
|
||||
[int32_t, "end_value"],
|
||||
# specifc portion
|
||||
[uint16_t, "width"],
|
||||
[ptr, "src"],
|
||||
[lv_color, "color"],
|
||||
[int16_t, "r_mod"],
|
||||
]
|
||||
lv_meter_indicator_arc = ct.structure(lv_meter_indicator_arc, "lv_meter_indicator_arc")
|
||||
# lv_meter_indicator_arc = [ # valid LVGL8.2
|
||||
# [ptr, "scale"],
|
||||
# [lv_meter_indicator_type_t, "type"],
|
||||
# [lv_opa, "opa"],
|
||||
# [int32_t, "start_value"],
|
||||
# [int32_t, "end_value"],
|
||||
# # specifc portion
|
||||
# [uint16_t, "width"],
|
||||
# [ptr, "src"],
|
||||
# [lv_color, "color"],
|
||||
# [int16_t, "r_mod"],
|
||||
# ]
|
||||
# lv_meter_indicator_arc = ct.structure(lv_meter_indicator_arc, "lv_meter_indicator_arc")
|
||||
|
||||
lv_meter_indicator_scale_lines = [ # valid LVGL8.2
|
||||
[ptr, "scale"],
|
||||
[lv_meter_indicator_type_t, "type"],
|
||||
[lv_opa, "opa"],
|
||||
[int32_t, "start_value"],
|
||||
[int32_t, "end_value"],
|
||||
# specifc portion
|
||||
[int16_t, "width_mod"],
|
||||
[lv_color, "color_start"],
|
||||
[lv_color, "color_end"],
|
||||
[uint8_t_1, "local_grad"],
|
||||
]
|
||||
lv_meter_indicator_scale_lines = ct.structure(lv_meter_indicator_scale_lines, "lv_meter_indicator_scale_lines")
|
||||
# lv_meter_indicator_scale_lines = [ # valid LVGL8.2
|
||||
# [ptr, "scale"],
|
||||
# [lv_meter_indicator_type_t, "type"],
|
||||
# [lv_opa, "opa"],
|
||||
# [int32_t, "start_value"],
|
||||
# [int32_t, "end_value"],
|
||||
# # specifc portion
|
||||
# [int16_t, "width_mod"],
|
||||
# [lv_color, "color_start"],
|
||||
# [lv_color, "color_end"],
|
||||
# [uint8_t_1, "local_grad"],
|
||||
# ]
|
||||
# lv_meter_indicator_scale_lines = ct.structure(lv_meter_indicator_scale_lines, "lv_meter_indicator_scale_lines")
|
||||
|
||||
lv_chart_series = [ # valid LVGL8.2
|
||||
lv_chart_series = [ # valid LVGL8.3
|
||||
[ptr, "x_points"],
|
||||
[ptr, "y_points"],
|
||||
[lv_color, "color"],
|
||||
@ -431,7 +444,7 @@ lv_chart_series = [ # valid LVGL8.2
|
||||
]
|
||||
lv_chart_series = ct.structure(lv_chart_series, "lv_chart_series")
|
||||
|
||||
lv_chart_cursor = [ # valid LVGL8.2
|
||||
lv_chart_cursor = [ # valid LVGL8.3
|
||||
[lv_point, "pos"],
|
||||
[uint16_t, "point_id"],
|
||||
[lv_color, "color"],
|
||||
@ -441,7 +454,7 @@ lv_chart_cursor = [ # valid LVGL8.2
|
||||
]
|
||||
lv_chart_cursor = ct.structure(lv_chart_cursor, "lv_chart_cursor")
|
||||
|
||||
lv_chart_tick_dsc = [ # valid LVGL8.2
|
||||
lv_chart_tick_dsc = [ # valid LVGL8.3
|
||||
[lv_coord_t, "major_len"],
|
||||
[lv_coord_t, "minor_len"],
|
||||
[lv_coord_t, "draw_size"],
|
||||
@ -461,7 +474,7 @@ destructor_cb = ptr # callback
|
||||
event_cb = ptr # callback
|
||||
lv_event_code = ct.i32
|
||||
|
||||
lv_obj_class = [ # valid LVGL8.2
|
||||
lv_obj_class = [ # valid LVGL8.3
|
||||
[lv_obj_class_ptr, "base_class"],
|
||||
[constructor_cb, "constructor_cb"],
|
||||
[destructor_cb, "destructor_cb"],
|
||||
@ -475,7 +488,7 @@ lv_obj_class = [ # valid LVGL8.2
|
||||
]
|
||||
lv_obj_class = ct.structure(lv_obj_class, "lv_obj_class")
|
||||
|
||||
lv_event = [ # valid LVGL8.2
|
||||
lv_event = [ # valid LVGL8.3
|
||||
[lv_obj_ptr, "target"],
|
||||
[lv_obj_ptr, "current_target"],
|
||||
[lv_event_code, "code"],
|
||||
@ -488,7 +501,7 @@ lv_event = [ # valid LVGL8.2
|
||||
]
|
||||
lv_event = ct.structure(lv_event, "lv_event")
|
||||
|
||||
lv_sqrt_res = [ # valid LVGL8.2
|
||||
lv_sqrt_res = [ # valid LVGL8.3
|
||||
[uint16_t, "i"],
|
||||
[uint16_t, "f"],
|
||||
]
|
||||
@ -496,7 +509,7 @@ lv_sqrt_res = ct.structure(lv_sqrt_res, "lv_sqrt_res")
|
||||
|
||||
#######################################################################
|
||||
# lv_img structures
|
||||
lv_img_header = [ # valid LVGL8.2
|
||||
lv_img_header = [ # valid LVGL8.3
|
||||
[uint8_t_5, "cf"],
|
||||
[uint8_t_3, "always_zero"],
|
||||
[uint8_t_2, "reserved"],
|
||||
@ -505,7 +518,7 @@ lv_img_header = [ # valid LVGL8.2
|
||||
]
|
||||
lv_img_header = ct.structure(lv_img_header, "lv_img_header")
|
||||
|
||||
lv_img_dsc = [ # valid LVGL8.2
|
||||
lv_img_dsc = [ # valid LVGL8.3
|
||||
[lv_img_header, "header"],
|
||||
[uint32_t, "data_size"],
|
||||
[ptr, "data"],
|
||||
@ -514,7 +527,7 @@ lv_img_dsc = ct.structure(lv_img_dsc, "lv_img_dsc")
|
||||
|
||||
#######################################################################
|
||||
# lv_style
|
||||
lv_style_transition_dsc = [ # valid LVGL8.2
|
||||
lv_style_transition_dsc = [ # valid LVGL8.3
|
||||
[ptr, "props"],
|
||||
[ptr, "user_data"],
|
||||
[ptr, "path_xcb"],
|
||||
@ -532,7 +545,7 @@ lv_style_transition_dsc = ct.structure(lv_style_transition_dsc, "lv_style_transi
|
||||
# ]
|
||||
# lv_color_hsv = ct.structure(lv_color_hsv, "lv_color_hsv")
|
||||
|
||||
lv_color_filter_dsc = [ # valid LVGL8.2
|
||||
lv_color_filter_dsc = [ # valid LVGL8.3
|
||||
[ptr, "filter_cb"],
|
||||
[ptr, "user_data"],
|
||||
]
|
||||
@ -540,7 +553,7 @@ lv_color_filter_dsc = ct.structure(lv_color_filter_dsc, "lv_color_filter_dsc")
|
||||
|
||||
#######################################################################
|
||||
# lv_timer
|
||||
lv_timer = [ # valid LVGL8.2
|
||||
lv_timer = [ # valid LVGL8.3
|
||||
[uint32_t, "period"],
|
||||
[uint32_t, "last_run"],
|
||||
[ptr, "timer_cb"],
|
||||
@ -582,7 +595,7 @@ lv_timer = ct.structure(lv_timer, "lv_timer")
|
||||
|
||||
#######################################################################
|
||||
# lv_draw_ctx
|
||||
lv_draw_ctx = [ # valid LVGL8.2
|
||||
lv_draw_ctx = [ # valid LVGL8.3
|
||||
[ptr, "buf"],
|
||||
[lv_area, "buf_area"],
|
||||
[lv_area, "clip_area"],
|
||||
@ -593,8 +606,15 @@ lv_draw_ctx = [ # valid LVGL8.2
|
||||
[ptr, "draw_letter"],
|
||||
[ptr, "draw_line"],
|
||||
[ptr, "draw_polygon"],
|
||||
[ptr, "draw_transform"],
|
||||
[ptr, "draw_bg"],
|
||||
[ptr, "wait_for_finish"],
|
||||
[ptr, "buffer_copy"],
|
||||
[ptr, "layer_init"],
|
||||
[ptr, "layer_adjust"],
|
||||
[ptr, "layer_blend"],
|
||||
[ptr, "layer_destroy"],
|
||||
[uint32_t, "layer_instance_size"],
|
||||
[ptr, "user_data"],
|
||||
]
|
||||
lv_draw_ctx = ct.structure(lv_draw_ctx, "lv_draw_ctx")
|
||||
@ -602,7 +622,7 @@ lv_draw_ctx = ct.structure(lv_draw_ctx, "lv_draw_ctx")
|
||||
#######################################################################
|
||||
# Special structure used to calibrate resistive touchscreens
|
||||
#######################################################################
|
||||
lv_ts_calibration = [ # valid LVGL8
|
||||
lv_ts_calibration = [ # valid LVGL8.3
|
||||
[lv_coord_t, "raw_x"],
|
||||
[lv_coord_t, "raw_y"],
|
||||
[lv_coord_t, "x"],
|
||||
|
@ -73,7 +73,7 @@ return_types = {
|
||||
"lv_textarea_style_t": "i",
|
||||
"lv_slider_type_t": "i",
|
||||
"lv_spinner_type_t": "i",
|
||||
"lv_spinner_dir_t": "i",
|
||||
"lv_spinner_dir_t": "i",
|
||||
"lv_blend_mode_t": "i",
|
||||
"lv_grad_dir_t": "i",
|
||||
"lv_border_side_t": "i",
|
||||
@ -107,6 +107,7 @@ return_types = {
|
||||
"lv_style_prop_t": "i",
|
||||
"lv_dither_mode_t": "i",
|
||||
"lv_chart_update_mode_t": "i",
|
||||
"lv_style_res_t": "i",
|
||||
# layouts
|
||||
"lv_flex_align_t": "i",
|
||||
"lv_flex_flow_t": "i",
|
||||
@ -157,11 +158,13 @@ return_types = {
|
||||
"lv_style_transition_dsc_t *": "lv_style_transition_dsc",
|
||||
"lv_draw_ctx_t *": "lv_draw_ctx",
|
||||
"_lv_draw_ctx_t *": "lv_draw_ctx",
|
||||
"_lv_draw_layer_ctx_t *": "lv_draw_layer_ctx",
|
||||
"lv_grad_dsc_t *": "lv_grad_dsc",
|
||||
"lv_sqrt_res_t *": "lv_sqrt_res",
|
||||
# "lv_color_hsv_t *": "lv_color_hsv",
|
||||
"lv_color_filter_dsc_t *": "lv_color_filter_dsc",
|
||||
"lv_timer_t *": "lv_timer",
|
||||
"_lv_timer_t *": "lv_timer",
|
||||
"lv_coord_t *": "c", # treat as a simple pointer, decoding needs to be done at Berry level
|
||||
"char **": "c", # treat as a simple pointer, decoding needs to be done at Berry level
|
||||
"constchar **": "c", # treat as a simple pointer, decoding needs to be done at Berry level
|
||||
|
@ -3,4 +3,4 @@
|
||||
python3 preprocessor.py
|
||||
python3 convert.py
|
||||
cd ../src/embedded
|
||||
python3 berry_ctypes.py
|
||||
python3 lvgl_ctypes.py
|
File diff suppressed because it is too large
Load Diff
@ -17,7 +17,7 @@ LVGL provides everything you need to create an embedded GUI with easy-to-use gra
|
||||
</h4>
|
||||
|
||||
|
||||
**English** | [中文](./README_zh.md) |
|
||||
**English** | [中文](./README_zh.md) | [Português do Brasil](./README_pt_BR.md)
|
||||
|
||||
|
||||
---
|
||||
@ -40,11 +40,11 @@ LVGL provides everything you need to create an embedded GUI with easy-to-use gra
|
||||
* Multi-language support with UTF-8 handling, CJK, Bidirectional and Arabic script support
|
||||
* Fully customizable graphical elements via [CSS-like styles](https://docs.lvgl.io/master/overview/style.html)
|
||||
* Powerful layouts inspired by CSS: [Flexbox](https://docs.lvgl.io/master/layouts/flex.html) and [Grid](https://docs.lvgl.io/master/layouts/grid.html)
|
||||
* OS, External memory and GPU are supported but not required. (built in support for STM32 DMA2D, and NXP PXP and VGLite)
|
||||
* OS, External memory and GPU are supported but not required. (built in support for STM32 DMA2D, SWM341 DMA2D, and NXP PXP and VGLite)
|
||||
* Smooth rendering even with a [single frame buffer](https://docs.lvgl.io/master/porting/display.html)
|
||||
* Written in C and compatible with C++
|
||||
* Micropython Binding exposes [LVGL API in Micropython](https://blog.lvgl.io/2019-02-20/micropython-bindings)
|
||||
* [Simulator](https://docs.lvgl.io/master/get-started/pc-simulator.html) to develop on PC without embedded hardware
|
||||
* [Simulator](https://docs.lvgl.io/master/get-started/platforms/pc-simulator.html) to develop on PC without embedded hardware
|
||||
* 100+ simple [Examples](https://github.com/lvgl/lvgl/tree/master/examples)
|
||||
* [Documentation](http://docs.lvgl.io/) and API references online and in PDF
|
||||
|
||||
@ -93,26 +93,27 @@ Basically, every modern controller (which is able to drive a display) is suitabl
|
||||
*Note that the memory usage might vary depending on the architecture, compiler and build options.*
|
||||
|
||||
### Supported platforms
|
||||
LVGL is completely platform independent and can be used with any MCU that fulfills the requirements.
|
||||
LVGL is completely platform independent and can be used with any MCU that fulfills the requirements.
|
||||
Just to mention some platforms:
|
||||
- NXP: Kinetis, LPC, iMX, iMX RT
|
||||
- STM32F1, STM32F3, STM32F4, STM32F7, STM32L4, STM32L5, STM32H7
|
||||
- Microchip dsPIC33, PIC24, PIC32MX, PIC32MZ
|
||||
- [Linux frame buffer](https://blog.lvgl.io/2018-01-03/linux_fb) (/dev/fb)
|
||||
- [Raspberry Pi](http://www.vk3erw.com/index.php/16-software/63-raspberry-pi-official-7-touchscreen-and-littlevgl)
|
||||
- [Raspberry Pi](https://github.com/lvgl/lv_port_linux_frame_buffer)
|
||||
- [Espressif ESP32](https://github.com/lvgl/lv_port_esp32)
|
||||
- [Infineon Aurix](https://github.com/lvgl/lv_port_aurix)
|
||||
- Nordic NRF52 Bluetooth modules
|
||||
- Quectel modems
|
||||
- [SYNWIT SWM341](http://www.synwit.cn/)
|
||||
|
||||
LVGL is also available as:
|
||||
- [Arduino library](https://docs.lvgl.io/master/get-started/arduino.html)
|
||||
- [PlatformIO package](https://platformio.org/lib/show/12440/lvgl)
|
||||
- [Arduino library](https://docs.lvgl.io/master/get-started/platforms/arduino.html)
|
||||
- [PlatformIO package](https://registry.platformio.org/libraries/lvgl/lvgl)
|
||||
- [Zephyr library](https://docs.zephyrproject.org/latest/reference/kconfig/CONFIG_LVGL.html)
|
||||
- [ESP32 component](https://docs.lvgl.io/master/get-started/espressif.html)
|
||||
- [ESP32 component](https://docs.lvgl.io/master/get-started/platforms/espressif.html)
|
||||
- [NXP MCUXpresso component](https://www.nxp.com/design/software/embedded-software/lvgl-open-source-graphics-library:LITTLEVGL-OPEN-SOURCE-GRAPHICS-LIBRARY)
|
||||
- [NuttX library](https://docs.lvgl.io/master/get-started/nuttx.html)
|
||||
- [RT-Thread RTOS](https://docs.lvgl.io/master/get-started/rt-thread.html)
|
||||
- [NuttX library](https://docs.lvgl.io/master/get-started/os/nuttx.html)
|
||||
- [RT-Thread RTOS](https://docs.lvgl.io/master/get-started/os/rt-thread.html)
|
||||
|
||||
|
||||
## Get started
|
||||
@ -120,7 +121,7 @@ This list shows the recommended way of learning the library:
|
||||
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/get-started/quick-overview.html) page (15 minutes)
|
||||
4. Set up a [Simulator](https://docs.lvgl.io/master/get-started/pc-simulator.html) (10 minutes)
|
||||
4. Set up a [Simulator](https://docs.lvgl.io/master/get-started/platforms/pc-simulator.html) (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/porting/index.html) guide or check the ready to use [Projects](https://github.com/lvgl?q=lv_port_)
|
||||
7. Read the [Overview](https://docs.lvgl.io/master/overview/index.html) page to get a better understanding of the library (2-3 hours)
|
||||
@ -152,7 +153,7 @@ void btn_event_cb(lv_event_t * e)
|
||||
}
|
||||
```
|
||||
### Micropython
|
||||
Learn more about [Micropython](https://docs.lvgl.io/master/get-started/micropython.html).
|
||||
Learn more about [Micropython](https://docs.lvgl.io/master/get-started/bindings/micropython.html).
|
||||
```python
|
||||
def btn_event_cb(e):
|
||||
print("Clicked")
|
||||
|
206
lib/libesp32_lvgl/lvgl/README_pt_BR.md
Normal file
206
lib/libesp32_lvgl/lvgl/README_pt_BR.md
Normal file
@ -0,0 +1,206 @@
|
||||
<h1 align="center"> LVGL - Biblioteca gráfica leve e versátil</h1>
|
||||
<p align="center">
|
||||
<img src="https://lvgl.io/assets/images/lvgl_widgets_demo.gif">
|
||||
</p>
|
||||
<p align="center">
|
||||
O LVGL fornece tudo o que você precisa para criar uma GUI incorporada com elementos gráficos fáceis de usar, belos efeitos visuais e um baixo consumo de memória.
|
||||
</p>
|
||||
<h4 align="center">
|
||||
<a href="https://lvgl.io">Site</a> ·
|
||||
<a href="https://docs.lvgl.io/">Documentação</a> ·
|
||||
<a href="https://forum.lvgl.io">Fórum</a> ·
|
||||
<a href="https://lvgl.io/services">Serviços</a> ·
|
||||
<a href="https://docs.lvgl.io/master/examples.html">Exemplos interativos</a>
|
||||
</h4>
|
||||
|
||||
[English](./README.md) | [中文](./README_zh.md) | **Português do Brasil**
|
||||
|
||||
---
|
||||
|
||||
### Tabela de conteúdo
|
||||
|
||||
- [Visão Geral](#visão-geral)
|
||||
- [Iniciando](#iniciando)
|
||||
- [Exemplos](#exemplos)
|
||||
- [Serviços](#serviços)
|
||||
- [Contribuindo](#contribuindo)
|
||||
|
||||
## Visão Geral
|
||||
|
||||
### Recursos
|
||||
* Poderosos [widgets](https://docs.lvgl.io/master/widgets/index.html): botões, gráficos, listas, controles deslizantes (sliders), imagens, etc.
|
||||
* Mecanismo gráfico avançado: animações, anti-aliasing, opacidade, rolagem suave, modos de mesclagem (blending modes), etc.
|
||||
* Suporte à [vários dispositivos de entrada](https://docs.lvgl.io/master/overview/indev.html): tela sensível ao toque, mouse, teclado, codificador, botões, etc.
|
||||
* Suporte à [vários monitores](https://docs.lvgl.io/master/overview/display.html)
|
||||
* Pode ser usado com qualquer microcontrolador e display, independente do hardware
|
||||
* Escalável para operar com pouca memória (64 kB Flash, 16 kB RAM)
|
||||
* Suporte multilíngue com manipulação UTF-8, suporte ao alfabeto bidirecional, árabe e CJK (Chinês, Japonês e Coreano)
|
||||
* Elementos gráficos totalmente personalizáveis por meio de [CSS](https://docs.lvgl.io/master/overview/style.html)
|
||||
* Layouts poderosos inspirados em CSS: [Flexbox](https://docs.lvgl.io/master/layouts/flex.html) e [Grid](https://docs.lvgl.io/master/layouts/grid.html)
|
||||
* SO, memória externa e GPU são suportados, mas não obrigatórios. (suporte integrado para STM32 DMA2D, SWM341 DMA2D e NXP PXP e VGLite)
|
||||
* Renderização suave mesmo com um [buffer de quadro único](https://docs.lvgl.io/master/porting/display.html) (single frame buffer)
|
||||
* Escrito em C e compatível com C++
|
||||
* Uso do LittlevGL com Micropython simplificado com [LVGL API in Micropython](https://blog.lvgl.io/2019-02-20/micropython-bindings)
|
||||
* [Simulador](https://docs.lvgl.io/master/get-started/platforms/pc-simulator.html) para desenvolver no PC sem hardware embutido
|
||||
* Mais de 100 [exemplos simples](https://github.com/lvgl/lvgl/tree/master/examples)
|
||||
* [Documentação](http://docs.lvgl.io/) e referências de API online e em PDF
|
||||
|
||||
### Requerimentos
|
||||
Basicamente, todo controlador moderno (que é capaz de acionar um display) é adequado para executar LVGL. Os requisitos mínimos são:
|
||||
|
||||
<table>
|
||||
<tr>
|
||||
<td>
|
||||
<strong>Nome</strong>
|
||||
</td>
|
||||
<td>
|
||||
<strong>Minímo</strong>
|
||||
</td>
|
||||
<td>
|
||||
<strong>Recomendado</strong>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<strong>Arquitetura</strong>
|
||||
</td>
|
||||
<td colspan="2">Microcontrolador ou processador de 16, 32 ou 64 bits</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<strong>Clock</strong>
|
||||
</td>
|
||||
<td>> 16 MHz</td>
|
||||
<td>> 48 MHz</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<strong>Flash/ROM</strong>
|
||||
</td>
|
||||
<td>> 64 kB</td>
|
||||
<td>> 180 kB</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>
|
||||
<strong>RAM estática</strong>
|
||||
</td>
|
||||
<td>> 16 kB</td>
|
||||
<td>> 48 kB</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>
|
||||
<strong>Draw buffer</strong>
|
||||
</td>
|
||||
<td>> 1 × <em>hor. res.</em> pixels</td>
|
||||
<td>> tamanho da tela de 1/10</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>
|
||||
<strong>Compilador</strong>
|
||||
</td>
|
||||
<td colspan="2">Padrão C99 ou mais recente</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
*Observe que o uso de memória pode variar dependendo da arquitetura, do compilador e das opções de compilação.*
|
||||
|
||||
### Plataformas suportadas
|
||||
O LVGL é completamente independente de plataforma e pode ser usado com qualquer MCU que atenda aos requisitos.
|
||||
Apenas para citar algumas plataformas:
|
||||
|
||||
- NXP: Kinetis, LPC, iMX, iMX RT
|
||||
- STM32F1, STM32F3, STM32F4, STM32F7, STM32L4, STM32L5, STM32H7
|
||||
- Microchip dsPIC33, PIC24, PIC32MX, PIC32MZ
|
||||
- [Linux frame buffer](https://blog.lvgl.io/2018-01-03/linux_fb) (/dev/fb)
|
||||
- [Raspberry Pi](http://www.vk3erw.com/index.php/16-software/63-raspberry-pi-official-7-touchscreen-and-littlevgl)
|
||||
- [Espressif ESP32](https://github.com/lvgl/lv_port_esp32)
|
||||
- [Infineon Aurix](https://github.com/lvgl/lv_port_aurix)
|
||||
- Nordic NRF52 Bluetooth modules
|
||||
- Quectel modems
|
||||
- [SYNWIT SWM341](https://www.synwit.cn/)
|
||||
|
||||
LVGL também está disponível para:
|
||||
- [Arduino library](https://docs.lvgl.io/master/get-started/platforms/arduino.html)
|
||||
- [PlatformIO package](https://registry.platformio.org/libraries/lvgl/lvgl)
|
||||
- [Zephyr library](https://docs.zephyrproject.org/latest/reference/kconfig/CONFIG_LVGL.html)
|
||||
- [ESP32 component](https://docs.lvgl.io/master/get-started/platforms/espressif.html)
|
||||
- [NXP MCUXpresso component](https://www.nxp.com/design/software/embedded-software/lvgl-open-source-graphics-library:LITTLEVGL-OPEN-SOURCE-GRAPHICS-LIBRARY)
|
||||
- [NuttX library](https://docs.lvgl.io/master/get-started/os/nuttx.html)
|
||||
- [RT-Thread RTOS](https://docs.lvgl.io/master/get-started/os/rt-thread.html)
|
||||
|
||||
## Iniciando
|
||||
Esta lista mostra a maneira recomendada de aprender sobre a biblioteca:
|
||||
|
||||
1. Confira as [demos on-line](https://lvgl.io/demos) para ver o LVGL em ação (3 minutos)
|
||||
2. Leia a [introdução](https://docs.lvgl.io/master/intro/index.html) da documentação (5 minutos)
|
||||
3. Familiarize-se com o básico da [Visão geral rápida](https://docs.lvgl.io/master/get-started/quick-overview.html) (15 minutos)
|
||||
4. Configure um [simulador](https://docs.lvgl.io/master/get-started/platforms/pc-simulator.html) (10 minutos)
|
||||
5. Experimente alguns [Exemplos](https://github.com/lvgl/lvgl/tree/master/examples)
|
||||
6. Placa para porta LVGL. Veja o guia [porting](https://docs.lvgl.io/master/porting/index.html) ou verifique o pronto para usar [Projects](https://github.com/lvgl?q=lv_port_)
|
||||
7. Leia a [visão geral](https://docs.lvgl.io/master/overview/index.html) para entender melhor a biblioteca (2-3 horas)
|
||||
8. Verifique a documentação dos [widgets](https://docs.lvgl.io/master/widgets/index.html) para ver seus recursos e como utilizá-los
|
||||
9. Se você tiver dúvidas, acesse o [fórum](http://forum.lvgl.io/)
|
||||
10. Leia o guia de [contribuição](https://docs.lvgl.io/master/CONTRIBUTING.html) para ver como você pode ajudar a melhorar o LVGL (15 minutos)
|
||||
|
||||
## Exemplos
|
||||
Para mais exemplos, veja a pasta [examples](https://github.com/lvgl/lvgl/tree/master/examples).
|
||||
|
||||

|
||||
|
||||
### C
|
||||
|
||||
```c
|
||||
lv_obj_t * button = lv_btn_create(lv_scr_act()); /* Adiciona um botão à tela atual */
|
||||
lv_obj_set_pos(button, 10, 10); /* Define uma posição ao botão na tela */
|
||||
lv_obj_set_size(button, 100, 50); /* Define o tamanho */
|
||||
lv_obj_add_event_cb(button, button_event_callback, LV_EVENT_CLICKED, NULL); /* Atribui um retorno de chamada (callback) */
|
||||
|
||||
lv_obj_t * label = lv_label_create(button); /* Adiciona um rótulo (label) */
|
||||
lv_label_set_text(label, "Clique aqui"); /* Define o texto do rótulo (label) */
|
||||
lv_obj_center(label); /* Alinha o texto ao centro */
|
||||
...
|
||||
|
||||
void button_event_callback(lv_event_t * e)
|
||||
{
|
||||
printf("Clicado\n");
|
||||
}
|
||||
```
|
||||
|
||||
### Micropython
|
||||
Saiba mais em [Micropython](https://docs.lvgl.io/master/get-started/bindings/micropython.html)
|
||||
|
||||
```python
|
||||
def button_event_callback(event):
|
||||
print("Clicado")
|
||||
|
||||
# Cria um botão e um rótulo (label)
|
||||
button = lv.btn(lv.scr_act())
|
||||
button.set_pos(10, 10)
|
||||
button.set_size(100, 50)
|
||||
button.add_event_cb(button_event_callback, lv.EVENT.CLICKED, None)
|
||||
|
||||
label = lv.label(button)
|
||||
label.set_text("Cliquq aqui")
|
||||
label.center()
|
||||
```
|
||||
|
||||
## Serviços
|
||||
O LVGL Kft foi estabelecido para fornecer uma base sólida para a biblioteca LVGL. Oferecemos vários tipos de serviços
|
||||
para ajudá-lo no desenvolvimento da interface do usuário:
|
||||
|
||||
- Design gráfico
|
||||
- Implementação de IU
|
||||
- Consultoria/Suporte
|
||||
|
||||
Para mais informações, consulte [LVGL Serviços](https://lvgl.io/services). Sinta-se à vontade para entrar em contato
|
||||
conosco se tiver alguma dúvida.
|
||||
|
||||
## Contribuindo
|
||||
O LVGL é um projeto aberto e sua contribuição é muito bem-vinda. Há muitas maneiras de contribuir, desde simplesmente
|
||||
falando sobre seu projeto, escrevendo exemplos, melhorando a documentação, corrigindo bugs até hospedar seu próprio
|
||||
projeto sob a organização LVGL.
|
||||
|
||||
Para obter uma descrição detalhada das oportunidades de contribuição, visite a seção de [contribuição](https://docs.lvgl.io/master/CONTRIBUTING.html) da documentação.
|
193
lib/libesp32_lvgl/lvgl/README_zh.md
Normal file
193
lib/libesp32_lvgl/lvgl/README_zh.md
Normal file
@ -0,0 +1,193 @@
|
||||
<h1 align="center"> LVGL - Light and Versatile Graphics Library</h1>
|
||||
<h2 align="center"> LVGL - 轻量级通用型图形库</h2>
|
||||
|
||||
|
||||
|
||||
<p align="center">
|
||||
<img src="https://lvgl.io/assets/images/lvgl_widgets_demo.gif">
|
||||
</p>
|
||||
<p align="center">
|
||||
LVGL是一个高度可裁剪、低资源占用、界面美观且易用的嵌入式系统图形库
|
||||
</p>
|
||||
|
||||
|
||||
<h4 align="center">
|
||||
<a href="https://lvgl.io">官网</a> ·
|
||||
<a href="https://docs.lvgl.io/">文档</a> ·
|
||||
<a href="https://forum.lvgl.io">论坛</a> ·
|
||||
<a href="https://lvgl.io/services">服务</a> ·
|
||||
<a href="https://docs.lvgl.io/master/examples.html">例程</a>
|
||||
</h4>
|
||||
|
||||
|
||||
[English](./README.md) | **中文** | [Português do Brasil](./README_pt_BR.md)
|
||||
|
||||
|
||||
---
|
||||
|
||||
#### 目录
|
||||
- [概况与总览](#概况与总览)
|
||||
- [如何入门](#如何入门)
|
||||
- [例程](#例程)
|
||||
- [服务](#服务)
|
||||
- [如何向社区贡献](#如何向社区贡献)
|
||||
|
||||
## 概况与总览
|
||||
### 特性
|
||||
* 丰富且强大的模块化[图形组件](https://docs.lvgl.io/master/widgets/index.html):按钮 (buttons)、图表 (charts)、列表 (lists)、滑动条 (sliders)、图片 (images) 等
|
||||
* 高级的图形引擎:动画、抗锯齿、透明度、平滑滚动、图层混合等效果
|
||||
* 支持多种[输入设备](https://docs.lvgl.io/master/overview/indev.html):触摸屏、 键盘、编码器、按键等
|
||||
* 支持[多显示设备](https://docs.lvgl.io/master/overview/display.html)
|
||||
* 不依赖特定的硬件平台,可以在任何显示屏上运行
|
||||
* 配置可裁剪(最低资源占用:64 kB Flash,16 kB RAM)
|
||||
* 基于UTF-8的多语种支持,例如中文、日文、韩文、阿拉伯文等
|
||||
* 可以通过[类CSS](https://docs.lvgl.io/master/overview/style.html)的方式来设计、布局图形界面(例如:[Flexbox](https://docs.lvgl.io/master/layouts/flex.html)、[Grid](https://docs.lvgl.io/master/layouts/grid.html))
|
||||
* 支持操作系统、外置内存、以及硬件加速(LVGL已内建支持STM32 DMA2D、SWM341 DMA2D、NXP PXP和VGLite)
|
||||
* 即便仅有[单缓冲区(frame buffer)](https://docs.lvgl.io/master/porting/display.html)的情况下,也可保证渲染如丝般顺滑
|
||||
* 全部由C编写完成,并支持C++调用
|
||||
* 支持Micropython编程,参见:[LVGL API in Micropython](https://blog.lvgl.io/2019-02-20/micropython-bindings)
|
||||
* 支持[模拟器](https://docs.lvgl.io/master/get-started/platforms/pc-simulator.html)仿真,可以无硬件依托进行开发
|
||||
* 丰富详实的[例程](https://github.com/lvgl/lvgl/tree/master/examples)
|
||||
* 详尽的[文档](http://docs.lvgl.io/)以及API参考手册,可线上查阅或可下载为PDF格式
|
||||
|
||||
### 硬件要求
|
||||
|
||||
<table>
|
||||
<tr>
|
||||
<td> <strong>要求</strong> </td>
|
||||
<td><strong>最低要求</strong></td>
|
||||
<td><strong>建议要求</strong></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><strong>架构</strong></td>
|
||||
<td colspan="2">16、32、64位微控制器或微处理器</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td> <strong>时钟</strong></td>
|
||||
<td> > 16 MHz</td>
|
||||
<td> > 48 MHz</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td> <strong>Flash/ROM</strong></td>
|
||||
<td> > 64 kB </td>
|
||||
<td> > 180 kB</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td> <strong>Static RAM</strong></td>
|
||||
<td> > 16 kB </td>
|
||||
<td> > 48 kB</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td> <strong>Draw buffer</strong></td>
|
||||
<td> > 1 × <em>hor. res.</em> pixels </td>
|
||||
<td> > 1/10屏幕大小 </td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td> <strong>编译器</strong></td>
|
||||
<td colspan="2"> C99或更新 </td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
*注意:资源占用情况与具体硬件平台、编译器等因素有关,上表中仅给出参考值*
|
||||
|
||||
### 已经支持的平台
|
||||
LVGL本身并不依赖特定的硬件平台,任何满足LVGL硬件配置要求的微控制器均可运行LVGL。
|
||||
如下仅列举其中一部分:
|
||||
|
||||
- NXP: Kinetis, LPC, iMX, iMX RT
|
||||
- STM32F1, STM32F3, STM32F4, STM32F7, STM32L4, STM32L5, STM32H7
|
||||
- Microchip dsPIC33, PIC24, PIC32MX, PIC32MZ
|
||||
- [Linux frame buffer](https://blog.lvgl.io/2018-01-03/linux_fb) (/dev/fb)
|
||||
- [Raspberry Pi](http://www.vk3erw.com/index.php/16-software/63-raspberry-pi-official-7-touchscreen-and-littlevgl)
|
||||
- [Espressif ESP32](https://github.com/lvgl/lv_port_esp32)
|
||||
- [Infineon Aurix](https://github.com/lvgl/lv_port_aurix)
|
||||
- Nordic NRF52 Bluetooth modules
|
||||
- Quectel modems
|
||||
- [SYNWIT SWM341](https://www.synwit.cn/)
|
||||
|
||||
LVGL也支持:
|
||||
- [Arduino library](https://docs.lvgl.io/master/get-started/platforms/arduino.html)
|
||||
- [PlatformIO package](https://platformio.org/lib/show/12440/lvgl)
|
||||
- [Zephyr library](https://docs.zephyrproject.org/latest/reference/kconfig/CONFIG_LVGL.html)
|
||||
- [ESP32 component](https://docs.lvgl.io/master/get-started/platforms/espressif.html)
|
||||
- [NXP MCUXpresso component](https://www.nxp.com/design/software/embedded-software/lvgl-open-source-graphics-library:LITTLEVGL-OPEN-SOURCE-GRAPHICS-LIBRARY)
|
||||
- [NuttX library](https://docs.lvgl.io/master/get-started/os/nuttx.html)
|
||||
- [RT-Thread RTOS](https://www.rt-thread.org/document/site/#/rt-thread-version/rt-thread-standard/packages-manual/lvgl-docs/introduction)
|
||||
|
||||
|
||||
## 如何入门
|
||||
请按照如下顺序来学习LVGL:
|
||||
1. 使用[网页在线例程](https://lvgl.io/demos)来体验LVGL(3分钟)
|
||||
2. 阅读文档[简介](https://docs.lvgl.io/master/intro/index.html)章节来初步了解LVGL(5分钟)
|
||||
3. 再来阅读一下文档快速[快速概览](https://docs.lvgl.io/master/get-started/quick-overview.html)章节来了解LVGL的基本知识(15分钟)
|
||||
4. 学习如何使用[模拟器](https://docs.lvgl.io/master/get-started/platforms/pc-simulator.html)来在电脑上仿真LVGL(10分钟)
|
||||
5. 试着动手实践一些[例程](https://github.com/lvgl/lvgl/tree/master/examples)
|
||||
6. 参考[移植指南](https://docs.lvgl.io/master/porting/index.html)尝试将LVGL移植到一块开发板上,LVGL也已经提供了一些移植好的[工程](https://github.com/lvgl?q=lv_port_)
|
||||
7. 仔细阅读文档[总览](https://docs.lvgl.io/master/overview/index.html)章节来更加深入的了解和熟悉LVGL(2-3小时)
|
||||
8. 浏览文档[组件(Widgets)](https://docs.lvgl.io/master/widgets/index.html)章节来了解如何使用它们
|
||||
9. 如果你有问题可以到LVGL[论坛](http://forum.lvgl.io/)提问
|
||||
10. 阅读文档[如何向社区贡献](https://docs.lvgl.io/master/CONTRIBUTING.html)章节来看看你能帮LVGL社区做些什么,以促进LVGL软件质量的不断提高(15分钟)
|
||||
|
||||
## 例程
|
||||
|
||||
更多例程请参见 [examples](https://github.com/lvgl/lvgl/tree/master/examples) 文件夹。
|
||||
|
||||

|
||||
|
||||
### C
|
||||
```c
|
||||
lv_obj_t * btn = lv_btn_create(lv_scr_act()); /*Add a button to the current screen*/
|
||||
lv_obj_set_pos(btn, 10, 10); /*Set its position*/
|
||||
lv_obj_set_size(btn, 100, 50); /*Set its size*/
|
||||
lv_obj_add_event_cb(btn, btn_event_cb, LV_EVENT_CLICKED, NULL); /*Assign a callback to the button*/
|
||||
|
||||
lv_obj_t * label = lv_label_create(btn); /*Add a label to the button*/
|
||||
lv_label_set_text(label, "Button"); /*Set the labels text*/
|
||||
lv_obj_center(label); /*Align the label to the center*/
|
||||
...
|
||||
|
||||
void btn_event_cb(lv_event_t * e)
|
||||
{
|
||||
printf("Clicked\n");
|
||||
}
|
||||
```
|
||||
### Micropython
|
||||
更多信息请到 [Micropython官网](https://docs.lvgl.io/master/get-started/bindings/micropython.html) 查询.
|
||||
```python
|
||||
def btn_event_cb(e):
|
||||
print("Clicked")
|
||||
|
||||
# Create a Button and a Label
|
||||
btn = lv.btn(lv.scr_act())
|
||||
btn.set_pos(10, 10)
|
||||
btn.set_size(100, 50)
|
||||
btn.add_event_cb(btn_event_cb, lv.EVENT.CLICKED, None)
|
||||
|
||||
label = lv.label(btn)
|
||||
label.set_text("Button")
|
||||
label.center()
|
||||
```
|
||||
|
||||
## 服务
|
||||
LVGL 责任有限公司成立的目的是为了给用户使用LVGL图形库提供额外的技术支持,我们致力于提供以下服务:
|
||||
|
||||
- 图形设计
|
||||
- UI设计
|
||||
- 技术咨询以及技术支持
|
||||
|
||||
更多信息请参见 https://lvgl.io/services ,如果有任何问题请随时联系我们。
|
||||
|
||||
|
||||
## 如何向社区贡献
|
||||
LVGL是一个开源项目,非常欢迎您参与到社区贡献当中。您有很多种方式来为提高LVGL贡献您的一份力量,包括但不限于:
|
||||
|
||||
- 介绍你基于LVGL设计的作品或项目
|
||||
- 写一些例程
|
||||
- 修改以及完善文档
|
||||
- 修复bug
|
||||
|
||||
请参见文档[如何向社区贡献](https://docs.lvgl.io/master/CONTRIBUTING.html)章节来获取更多信息。
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "lvgl",
|
||||
"version": "8.2.0",
|
||||
"version": "8.3.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": {
|
||||
|
@ -1,5 +1,5 @@
|
||||
name=lvgl
|
||||
version=8.2.0
|
||||
version=8.3.0
|
||||
author=kisvegabor
|
||||
maintainer=kisvegabor,embeddedt,pete-pjb
|
||||
sentence=Full-featured Graphics Library for Embedded Systems
|
||||
|
@ -1,6 +1,6 @@
|
||||
/**
|
||||
* @file lv_conf.h
|
||||
* Configuration file for v8.2.0
|
||||
* Configuration file for v8.3.0
|
||||
*/
|
||||
|
||||
/*
|
||||
@ -29,14 +29,14 @@
|
||||
/*Swap the 2 bytes of RGB565 color. Useful if the display has an 8-bit interface (e.g. SPI)*/
|
||||
#define LV_COLOR_16_SWAP 0
|
||||
|
||||
/*Enable more complex drawing routines to manage screens transparency.
|
||||
*Can be used if the UI is above another layer, e.g. an OSD menu or video player.
|
||||
*Requires `LV_COLOR_DEPTH = 32` colors and the screen's `bg_opa` should be set to non LV_OPA_COVER value*/
|
||||
/*Enable features to draw on transparent background.
|
||||
*It's required if opa, and transform_* style properties are used.
|
||||
*Can be also used if the UI is above another layer, e.g. an OSD menu or video player.*/
|
||||
#define LV_COLOR_SCREEN_TRANSP 0
|
||||
|
||||
/* Adjust color mix functions rounding. GPUs might calculate color mix (blending) differently.
|
||||
* 0: round down, 64: round up from x.75, 128: round up from half, 192: round up from x.25, 254: round up */
|
||||
#define LV_COLOR_MIX_ROUND_OFS (LV_COLOR_DEPTH == 32 ? 0: 128)
|
||||
#define LV_COLOR_MIX_ROUND_OFS 0
|
||||
|
||||
/*Images pixels with this color will not be drawn if they are chroma keyed)*/
|
||||
#define LV_COLOR_CHROMA_KEY lv_color_hex(0x00ff00) /*pure green*/
|
||||
@ -55,8 +55,8 @@
|
||||
#define LV_MEM_ADR 0 /*0: unused*/
|
||||
/*Instead of an address give a memory allocator that will be called to get a memory pool for LVGL. E.g. my_malloc*/
|
||||
#if LV_MEM_ADR == 0
|
||||
//#define LV_MEM_POOL_INCLUDE your_alloc_library /* Uncomment if using an external allocator*/
|
||||
//#define LV_MEM_POOL_ALLOC your_alloc /* Uncomment if using an external allocator*/
|
||||
#undef LV_MEM_POOL_INCLUDE
|
||||
#undef LV_MEM_POOL_ALLOC
|
||||
#endif
|
||||
|
||||
#else /*LV_MEM_CUSTOM*/
|
||||
@ -120,33 +120,49 @@
|
||||
#define LV_CIRCLE_CACHE_SIZE 4
|
||||
#endif /*LV_DRAW_COMPLEX*/
|
||||
|
||||
/**
|
||||
* "Simple layers" are used when a widget has `style_opa < 255` to buffer the widget into a layer
|
||||
* and blend it as an image with the given opacity.
|
||||
* Note that `bg_opa`, `text_opa` etc don't require buffering into layer)
|
||||
* The widget can be buffered in smaller chunks to avoid using large buffers.
|
||||
*
|
||||
* - LV_LAYER_SIMPLE_BUF_SIZE: [bytes] the optimal target buffer size. LVGL will try to allocate it
|
||||
* - LV_LAYER_SIMPLE_FALLBACK_BUF_SIZE: [bytes] used if `LV_LAYER_SIMPLE_BUF_SIZE` couldn't be allocated.
|
||||
*
|
||||
* Both buffer sizes are in bytes.
|
||||
* "Transformed layers" (where transform_angle/zoom properties are used) use larger buffers
|
||||
* and can't be drawn in chunks. So these settings affects only widgets with opacity.
|
||||
*/
|
||||
#define LV_LAYER_SIMPLE_BUF_SIZE (24 * 1024)
|
||||
#define LV_LAYER_SIMPLE_FALLBACK_BUF_SIZE (3 * 1024)
|
||||
|
||||
/*Default image cache size. Image caching keeps the images opened.
|
||||
*If only the built-in image formats are used there is no real advantage of caching. (I.e. if no new image decoder is added)
|
||||
*With complex image decoders (e.g. PNG or JPG) caching can save the continuous open/decode of images.
|
||||
*However the opened images might consume additional RAM.
|
||||
*0: to disable caching*/
|
||||
#define LV_IMG_CACHE_DEF_SIZE 0
|
||||
#define LV_IMG_CACHE_DEF_SIZE 0
|
||||
|
||||
/*Number of stops allowed per gradient. Increase this to allow more stops.
|
||||
*This adds (sizeof(lv_color_t) + 1) bytes per additional stop*/
|
||||
#define LV_GRADIENT_MAX_STOPS 2
|
||||
#define LV_GRADIENT_MAX_STOPS 2
|
||||
|
||||
/*Default gradient buffer size.
|
||||
*When LVGL calculates the gradient "maps" it can save them into a cache to avoid calculating them again.
|
||||
*LV_GRAD_CACHE_DEF_SIZE sets the size of this cache in bytes.
|
||||
*If the cache is too small the map will be allocated only while it's required for the drawing.
|
||||
*0 mean no caching.*/
|
||||
#define LV_GRAD_CACHE_DEF_SIZE 0
|
||||
#define LV_GRAD_CACHE_DEF_SIZE 0
|
||||
|
||||
/*Allow dithering the gradients (to achieve visual smooth color gradients on limited color depth display)
|
||||
*LV_DITHER_GRADIENT implies allocating one or two more lines of the object's rendering surface
|
||||
*The increase in memory consumption is (32 bits * object width) plus 24 bits * object width if using error diffusion */
|
||||
#define LV_DITHER_GRADIENT 0
|
||||
#define LV_DITHER_GRADIENT 0
|
||||
#if LV_DITHER_GRADIENT
|
||||
/*Add support for error diffusion dithering.
|
||||
*Error diffusion dithering gets a much better visual result, but implies more CPU consumption and memory when drawing.
|
||||
*The increase in memory consumption is (24 bits * object's width)*/
|
||||
#define LV_DITHER_ERROR_DIFFUSION 0
|
||||
#define LV_DITHER_ERROR_DIFFUSION 0
|
||||
#endif
|
||||
|
||||
/*Maximum buffer size to allocate for rotation.
|
||||
@ -157,6 +173,9 @@
|
||||
* GPU
|
||||
*-----------*/
|
||||
|
||||
/*Use Arm's 2D acceleration library Arm-2D */
|
||||
#define LV_USE_GPU_ARM2D 0
|
||||
|
||||
/*Use STM32's DMA2D (aka Chrom Art) GPU*/
|
||||
#define LV_USE_GPU_STM32_DMA2D 0
|
||||
#if LV_USE_GPU_STM32_DMA2D
|
||||
@ -165,6 +184,12 @@
|
||||
#define LV_GPU_DMA2D_CMSIS_INCLUDE
|
||||
#endif
|
||||
|
||||
/*Use SWM341's DMA2D GPU*/
|
||||
#define LV_USE_GPU_SWM341_DMA2D 0
|
||||
#if LV_USE_GPU_SWM341_DMA2D
|
||||
#define LV_GPU_SWM341_DMA2D_INCLUDE "SWM341.h"
|
||||
#endif
|
||||
|
||||
/*Use NXP's PXP GPU iMX RTxxx platforms*/
|
||||
#define LV_USE_GPU_NXP_PXP 0
|
||||
#if LV_USE_GPU_NXP_PXP
|
||||
@ -380,6 +405,9 @@
|
||||
#define LV_FONT_SUBPX_BGR 0 /*0: RGB; 1:BGR order*/
|
||||
#endif
|
||||
|
||||
/*Enable drawing placeholders when glyph dsc is not found*/
|
||||
#define LV_USE_FONT_PLACEHOLDER 1
|
||||
|
||||
/*=================
|
||||
* TEXT SETTINGS
|
||||
*=================*/
|
||||
@ -434,8 +462,6 @@
|
||||
|
||||
#define LV_USE_ARC 1
|
||||
|
||||
#define LV_USE_ANIMIMG 1
|
||||
|
||||
#define LV_USE_BAR 1
|
||||
|
||||
#define LV_USE_BTN 1
|
||||
@ -481,6 +507,8 @@
|
||||
/*-----------
|
||||
* Widgets
|
||||
*----------*/
|
||||
#define LV_USE_ANIMIMG 1
|
||||
|
||||
#define LV_USE_CALENDAR 1
|
||||
#if LV_USE_CALENDAR
|
||||
#define LV_CALENDAR_WEEK_STARTS_MONDAY 0
|
||||
@ -513,6 +541,12 @@
|
||||
|
||||
#define LV_USE_MSGBOX 1
|
||||
|
||||
#define LV_USE_SPAN 1
|
||||
#if LV_USE_SPAN
|
||||
/*A line text can contain maximum num of span descriptor */
|
||||
#define LV_SPAN_SNIPPET_STACK_SIZE 64
|
||||
#endif
|
||||
|
||||
#define LV_USE_SPINBOX 1
|
||||
|
||||
#define LV_USE_SPINNER 1
|
||||
@ -523,12 +557,6 @@
|
||||
|
||||
#define LV_USE_WIN 1
|
||||
|
||||
#define LV_USE_SPAN 1
|
||||
#if LV_USE_SPAN
|
||||
/*A line text can contain maximum num of span descriptor */
|
||||
#define LV_SPAN_SNIPPET_STACK_SIZE 64
|
||||
#endif
|
||||
|
||||
/*-----------
|
||||
* Themes
|
||||
*----------*/
|
||||
@ -574,7 +602,7 @@
|
||||
#if LV_USE_FS_STDIO
|
||||
#define LV_FS_STDIO_LETTER '\0' /*Set an upper cased letter on which the drive will accessible (e.g. 'A')*/
|
||||
#define LV_FS_STDIO_PATH "" /*Set the working directory. File/directory paths will be appended to it.*/
|
||||
#define LV_FS_STDIO_CACHE_SIZE 0 /*>0 to cache this number of bytes in lv_fs_read()*/
|
||||
#define LV_FS_STDIO_CACHE_SIZE 0 /*>0 to cache this number of bytes in lv_fs_read()*/
|
||||
#endif
|
||||
|
||||
/*API for open, read, etc*/
|
||||
@ -582,19 +610,19 @@
|
||||
#if LV_USE_FS_POSIX
|
||||
#define LV_FS_POSIX_LETTER '\0' /*Set an upper cased letter on which the drive will accessible (e.g. 'A')*/
|
||||
#define LV_FS_POSIX_PATH "" /*Set the working directory. File/directory paths will be appended to it.*/
|
||||
#define LV_FS_POSIX_CACHE_SIZE 0 /*>0 to cache this number of bytes in lv_fs_read()*/
|
||||
#define LV_FS_POSIX_CACHE_SIZE 0 /*>0 to cache this number of bytes in lv_fs_read()*/
|
||||
#endif
|
||||
|
||||
/*API for CreateFile, ReadFile, etc*/
|
||||
#define LV_USE_FS_WIN32 0
|
||||
#if LV_USE_FS_WIN32
|
||||
#define LV_FS_WIN32_LETTER '\0' /*Set an upper cased letter on which the drive will accessible (e.g. 'A')*/
|
||||
#define LV_FS_WIN32_LETTER '\0' /*Set an upper cased letter on which the drive will accessible (e.g. 'A')*/
|
||||
#define LV_FS_WIN32_PATH "" /*Set the working directory. File/directory paths will be appended to it.*/
|
||||
#define LV_FS_WIN32_CACHE_SIZE 0 /*>0 to cache this number of bytes in lv_fs_read()*/
|
||||
#endif
|
||||
|
||||
/*API for FATFS (needs to be added separately). Uses f_open, f_read, etc*/
|
||||
#define LV_USE_FS_FATFS 0
|
||||
#define LV_USE_FS_FATFS 0
|
||||
#if LV_USE_FS_FATFS
|
||||
#define LV_FS_FATFS_LETTER '\0' /*Set an upper cased letter on which the drive will accessible (e.g. 'A')*/
|
||||
#define LV_FS_FATFS_CACHE_SIZE 0 /*>0 to cache this number of bytes in lv_fs_read()*/
|
||||
@ -638,10 +666,10 @@
|
||||
|
||||
/*FFmpeg library for image decoding and playing videos
|
||||
*Supports all major image formats so do not enable other image decoder with it*/
|
||||
#define LV_USE_FFMPEG 0
|
||||
#define LV_USE_FFMPEG 0
|
||||
#if LV_USE_FFMPEG
|
||||
/*Dump input information to stderr*/
|
||||
#define LV_FFMPEG_AV_DUMP_FORMAT 0
|
||||
#define LV_FFMPEG_DUMP_FORMAT 0
|
||||
#endif
|
||||
|
||||
/*-----------
|
||||
@ -652,10 +680,37 @@
|
||||
#define LV_USE_SNAPSHOT 0
|
||||
|
||||
/*1: Enable Monkey test*/
|
||||
#define LV_USE_MONKEY 0
|
||||
#define LV_USE_MONKEY 0
|
||||
|
||||
/*1: Enable grid navigation*/
|
||||
#define LV_USE_GRIDNAV 0
|
||||
#define LV_USE_GRIDNAV 0
|
||||
|
||||
/*1: Enable lv_obj fragment*/
|
||||
#define LV_USE_FRAGMENT 0
|
||||
|
||||
/*1: Support using images as font in label or span widgets */
|
||||
#define LV_USE_IMGFONT 0
|
||||
|
||||
/*1: Enable a published subscriber based messaging system */
|
||||
#define LV_USE_MSG 0
|
||||
|
||||
/*1: Enable Pinyin input method*/
|
||||
/*Requires: lv_keyboard*/
|
||||
#define LV_USE_IME_PINYIN 0
|
||||
#if LV_USE_IME_PINYIN
|
||||
/*1: Use default thesaurus*/
|
||||
/*If you do not use the default thesaurus, be sure to use `lv_ime_pinyin` after setting the thesauruss*/
|
||||
#define LV_IME_PINYIN_USE_DEFAULT_DICT 1
|
||||
/*Set the maximum number of candidate panels that can be displayed*/
|
||||
/*This needs to be adjusted according to the size of the screen*/
|
||||
#define LV_IME_PINYIN_CAND_TEXT_NUM 6
|
||||
|
||||
/*Use 9 key input(k9)*/
|
||||
#define LV_IME_PINYIN_USE_K9_MODE 1
|
||||
#if LV_IME_PINYIN_USE_K9_MODE == 1
|
||||
#define LV_IME_PINYIN_K9_CAND_TEXT_NUM 3
|
||||
#endif // LV_IME_PINYIN_USE_K9_MODE
|
||||
#endif
|
||||
|
||||
/*==================
|
||||
* EXAMPLES
|
||||
@ -669,28 +724,32 @@
|
||||
====================*/
|
||||
|
||||
/*Show some widget. It might be required to increase `LV_MEM_SIZE` */
|
||||
#define LV_USE_DEMO_WIDGETS 0
|
||||
#define LV_USE_DEMO_WIDGETS 0
|
||||
#if LV_USE_DEMO_WIDGETS
|
||||
#define LV_DEMO_WIDGETS_SLIDESHOW 0
|
||||
#define LV_DEMO_WIDGETS_SLIDESHOW 0
|
||||
#endif
|
||||
|
||||
/*Demonstrate the usage of encoder and keyboard*/
|
||||
#define LV_USE_DEMO_KEYPAD_AND_ENCODER 0
|
||||
#define LV_USE_DEMO_KEYPAD_AND_ENCODER 0
|
||||
|
||||
/*Benchmark your system*/
|
||||
#define LV_USE_DEMO_BENCHMARK 0
|
||||
#define LV_USE_DEMO_BENCHMARK 0
|
||||
#if LV_USE_DEMO_BENCHMARK
|
||||
/*Use RGB565A8 images with 16 bit color depth instead of ARGB8565*/
|
||||
#define LV_DEMO_BENCHMARK_RGB565A8 0
|
||||
#endif
|
||||
|
||||
/*Stress test for LVGL*/
|
||||
#define LV_USE_DEMO_STRESS 0
|
||||
#define LV_USE_DEMO_STRESS 0
|
||||
|
||||
/*Music player demo*/
|
||||
#define LV_USE_DEMO_MUSIC 0
|
||||
#define LV_USE_DEMO_MUSIC 0
|
||||
#if LV_USE_DEMO_MUSIC
|
||||
# define LV_DEMO_MUSIC_SQUARE 0
|
||||
# define LV_DEMO_MUSIC_LANDSCAPE 0
|
||||
# define LV_DEMO_MUSIC_ROUND 0
|
||||
# define LV_DEMO_MUSIC_LARGE 0
|
||||
# define LV_DEMO_MUSIC_AUTO_PLAY 0
|
||||
#define LV_DEMO_MUSIC_SQUARE 0
|
||||
#define LV_DEMO_MUSIC_LANDSCAPE 0
|
||||
#define LV_DEMO_MUSIC_ROUND 0
|
||||
#define LV_DEMO_MUSIC_LARGE 0
|
||||
#define LV_DEMO_MUSIC_AUTO_PLAY 0
|
||||
#endif
|
||||
|
||||
/*--END OF LV_CONF_H--*/
|
||||
|
@ -14,7 +14,7 @@ extern "C" {
|
||||
* CURRENT VERSION OF LVGL
|
||||
***************************/
|
||||
#define LVGL_VERSION_MAJOR 8
|
||||
#define LVGL_VERSION_MINOR 2
|
||||
#define LVGL_VERSION_MINOR 3
|
||||
#define LVGL_VERSION_PATCH 0
|
||||
#define LVGL_VERSION_INFO ""
|
||||
|
||||
@ -67,11 +67,6 @@ extern "C" {
|
||||
* EXTRAS
|
||||
*----------------*/
|
||||
#include "src/extra/lv_extra.h"
|
||||
#include "src/extra/widgets/lv_widgets.h"
|
||||
#include "src/extra/layouts/lv_layouts.h"
|
||||
#include "src/extra/themes/lv_themes.h"
|
||||
#include "src/extra/others/lv_others.h"
|
||||
#include "src/extra/libs/lv_libs.h"
|
||||
|
||||
/*********************
|
||||
* DEFINES
|
||||
|
@ -1,10 +0,0 @@
|
||||
include $(LVGL_DIR)/$(LVGL_DIR_NAME)/demos/lv_demos.mk
|
||||
include $(LVGL_DIR)/$(LVGL_DIR_NAME)/examples/examples.mk
|
||||
include $(LVGL_DIR)/$(LVGL_DIR_NAME)/src/extra/extra.mk
|
||||
include $(LVGL_DIR)/$(LVGL_DIR_NAME)/src/core/lv_core.mk
|
||||
include $(LVGL_DIR)/$(LVGL_DIR_NAME)/src/draw/lv_draw.mk
|
||||
include $(LVGL_DIR)/$(LVGL_DIR_NAME)/src/draw/sw/lv_draw_sw.mk
|
||||
include $(LVGL_DIR)/$(LVGL_DIR_NAME)/src/font/lv_font.mk
|
||||
include $(LVGL_DIR)/$(LVGL_DIR_NAME)/src/hal/lv_hal.mk
|
||||
include $(LVGL_DIR)/$(LVGL_DIR_NAME)/src/misc/lv_misc.mk
|
||||
include $(LVGL_DIR)/$(LVGL_DIR_NAME)/src/widgets/lv_widgets.mk
|
@ -21,12 +21,13 @@
|
||||
/**********************
|
||||
* STATIC PROTOTYPES
|
||||
**********************/
|
||||
|
||||
static void scr_load_internal(lv_obj_t * scr);
|
||||
static void scr_load_anim_start(lv_anim_t * a);
|
||||
static void opa_scale_anim(void * obj, int32_t v);
|
||||
static void set_x_anim(void * obj, int32_t v);
|
||||
static void set_y_anim(void * obj, int32_t v);
|
||||
static void scr_anim_ready(lv_anim_t * a);
|
||||
static bool is_out_anim(lv_scr_load_anim_t a);
|
||||
|
||||
/**********************
|
||||
* STATIC VARIABLES
|
||||
@ -80,20 +81,7 @@ lv_obj_t * lv_disp_get_scr_prev(lv_disp_t * disp)
|
||||
*/
|
||||
void lv_disp_load_scr(lv_obj_t * scr)
|
||||
{
|
||||
lv_disp_t * d = lv_obj_get_disp(scr);
|
||||
if(!d) return; /*Shouldn't happen, just to be sure*/
|
||||
|
||||
lv_obj_t * old_scr = d->act_scr;
|
||||
|
||||
if(d->act_scr) lv_event_send(old_scr, LV_EVENT_SCREEN_UNLOAD_START, NULL);
|
||||
if(d->act_scr) lv_event_send(scr, LV_EVENT_SCREEN_LOAD_START, NULL);
|
||||
|
||||
d->act_scr = scr;
|
||||
|
||||
if(d->act_scr) lv_event_send(scr, LV_EVENT_SCREEN_LOADED, NULL);
|
||||
if(d->act_scr) lv_event_send(old_scr, LV_EVENT_SCREEN_UNLOADED, NULL);
|
||||
|
||||
lv_obj_invalidate(scr);
|
||||
lv_scr_load_anim(scr, LV_SCR_LOAD_ANIM_NONE, 0, 0, false);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -135,7 +123,12 @@ lv_obj_t * lv_disp_get_layer_sys(lv_disp_t * disp)
|
||||
*/
|
||||
void lv_disp_set_theme(lv_disp_t * disp, lv_theme_t * th)
|
||||
{
|
||||
if(disp == NULL) disp = lv_disp_get_default();
|
||||
if(!disp) disp = lv_disp_get_default();
|
||||
if(!disp) {
|
||||
LV_LOG_WARN("no display registered");
|
||||
return;
|
||||
}
|
||||
|
||||
disp->theme = th;
|
||||
|
||||
if(disp->screen_cnt == 3 &&
|
||||
@ -220,7 +213,7 @@ void lv_disp_set_bg_opa(lv_disp_t * disp, lv_opa_t opa)
|
||||
/**
|
||||
* Switch screen with animation
|
||||
* @param scr pointer to the new screen to load
|
||||
* @param anim_type type of the animation from `lv_scr_load_anim_t`. E.g. `LV_SCR_LOAD_ANIM_MOVE_LEFT`
|
||||
* @param anim_type type of the animation from `lv_scr_load_anim_t`, e.g. `LV_SCR_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
|
||||
@ -234,7 +227,7 @@ void lv_scr_load_anim(lv_obj_t * new_scr, lv_scr_load_anim_t anim_type, uint32_t
|
||||
/*If an other screen load animation is in progress
|
||||
*make target screen loaded immediately. */
|
||||
if(d->scr_to_load && act_scr != d->scr_to_load) {
|
||||
lv_disp_load_scr(d->scr_to_load);
|
||||
scr_load_internal(d->scr_to_load);
|
||||
lv_anim_del(d->scr_to_load, NULL);
|
||||
lv_obj_set_pos(d->scr_to_load, 0, 0);
|
||||
lv_obj_remove_local_style_prop(d->scr_to_load, LV_STYLE_OPA, 0);
|
||||
@ -252,6 +245,7 @@ void lv_scr_load_anim(lv_obj_t * new_scr, lv_scr_load_anim_t anim_type, uint32_t
|
||||
d->prev_scr = NULL;
|
||||
}
|
||||
|
||||
d->draw_prev_over_act = is_out_anim(anim_type);
|
||||
d->del_prev = auto_del;
|
||||
|
||||
/*Be sure there is no other animation on the screens*/
|
||||
@ -264,6 +258,13 @@ void lv_scr_load_anim(lv_obj_t * new_scr, lv_scr_load_anim_t anim_type, uint32_t
|
||||
lv_obj_remove_local_style_prop(new_scr, LV_STYLE_OPA, 0);
|
||||
lv_obj_remove_local_style_prop(lv_scr_act(), LV_STYLE_OPA, 0);
|
||||
|
||||
|
||||
/*Shortcut for immediate load*/
|
||||
if(time == 0 && delay == 0) {
|
||||
scr_load_internal(new_scr);
|
||||
return;
|
||||
}
|
||||
|
||||
lv_anim_t a_new;
|
||||
lv_anim_init(&a_new);
|
||||
lv_anim_set_var(&a_new, new_scr);
|
||||
@ -328,18 +329,36 @@ void lv_scr_load_anim(lv_obj_t * new_scr, lv_scr_load_anim_t anim_type, uint32_t
|
||||
lv_anim_set_exec_cb(&a_old, set_y_anim);
|
||||
lv_anim_set_values(&a_old, 0, lv_disp_get_ver_res(d));
|
||||
break;
|
||||
|
||||
case LV_SCR_LOAD_ANIM_FADE_ON:
|
||||
case LV_SCR_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:
|
||||
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:
|
||||
lv_anim_set_exec_cb(&a_old, set_x_anim);
|
||||
lv_anim_set_values(&a_old, 0, -lv_disp_get_hor_res(d));
|
||||
break;
|
||||
case LV_SCR_LOAD_ANIM_OUT_RIGHT:
|
||||
lv_anim_set_exec_cb(&a_old, set_x_anim);
|
||||
lv_anim_set_values(&a_old, 0, lv_disp_get_hor_res(d));
|
||||
break;
|
||||
case LV_SCR_LOAD_ANIM_OUT_TOP:
|
||||
lv_anim_set_exec_cb(&a_old, set_y_anim);
|
||||
lv_anim_set_values(&a_old, 0, -lv_disp_get_ver_res(d));
|
||||
break;
|
||||
case LV_SCR_LOAD_ANIM_OUT_BOTTOM:
|
||||
lv_anim_set_exec_cb(&a_old, set_y_anim);
|
||||
lv_anim_set_values(&a_old, 0, lv_disp_get_ver_res(d));
|
||||
break;
|
||||
}
|
||||
|
||||
lv_event_send(act_scr, LV_EVENT_SCREEN_UNLOAD_START, NULL);
|
||||
|
||||
lv_anim_start(&a_new);
|
||||
lv_anim_start(&a_old);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@ -394,6 +413,38 @@ void lv_disp_clean_dcache(lv_disp_t * disp)
|
||||
disp->driver->clean_dcache_cb(disp->driver);
|
||||
}
|
||||
|
||||
/**
|
||||
* Temporarily enable and disable the invalidation of the display.
|
||||
* @param disp pointer to a display (NULL to use the default display)
|
||||
* @param en true: enable invalidation; false: invalidation
|
||||
*/
|
||||
void lv_disp_enable_invalidation(lv_disp_t * disp, bool en)
|
||||
{
|
||||
if(!disp) disp = lv_disp_get_default();
|
||||
if(!disp) {
|
||||
LV_LOG_WARN("no display registered");
|
||||
return;
|
||||
}
|
||||
|
||||
disp->inv_en_cnt += en ? 1 : -1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get display invalidation is enabled.
|
||||
* @param disp pointer to a display (NULL to use the default display)
|
||||
* @return return true if invalidation is enabled
|
||||
*/
|
||||
bool lv_disp_is_invalidation_enabled(lv_disp_t * disp)
|
||||
{
|
||||
if(!disp) disp = lv_disp_get_default();
|
||||
if(!disp) {
|
||||
LV_LOG_WARN("no display registered");
|
||||
return false;
|
||||
}
|
||||
|
||||
return (disp->inv_en_cnt > 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a pointer to the screen refresher timer to
|
||||
* modify its parameters with `lv_timer_...` functions.
|
||||
@ -415,6 +466,24 @@ lv_timer_t * _lv_disp_get_refr_timer(lv_disp_t * disp)
|
||||
* STATIC FUNCTIONS
|
||||
**********************/
|
||||
|
||||
static void scr_load_internal(lv_obj_t * scr)
|
||||
{
|
||||
lv_disp_t * d = lv_obj_get_disp(scr);
|
||||
if(!d) return; /*Shouldn't happen, just to be sure*/
|
||||
|
||||
lv_obj_t * old_scr = d->act_scr;
|
||||
|
||||
if(d->act_scr) lv_event_send(old_scr, LV_EVENT_SCREEN_UNLOAD_START, NULL);
|
||||
if(d->act_scr) lv_event_send(scr, LV_EVENT_SCREEN_LOAD_START, NULL);
|
||||
|
||||
d->act_scr = scr;
|
||||
|
||||
if(d->act_scr) lv_event_send(scr, LV_EVENT_SCREEN_LOADED, NULL);
|
||||
if(d->act_scr) lv_event_send(old_scr, LV_EVENT_SCREEN_UNLOADED, NULL);
|
||||
|
||||
lv_obj_invalidate(scr);
|
||||
}
|
||||
|
||||
static void scr_load_anim_start(lv_anim_t * a)
|
||||
{
|
||||
lv_disp_t * d = lv_obj_get_disp(a->var);
|
||||
@ -449,6 +518,17 @@ static void scr_anim_ready(lv_anim_t * a)
|
||||
|
||||
if(d->prev_scr && d->del_prev) lv_obj_del(d->prev_scr);
|
||||
d->prev_scr = NULL;
|
||||
d->draw_prev_over_act = false;
|
||||
d->scr_to_load = NULL;
|
||||
lv_obj_remove_local_style_prop(a->var, LV_STYLE_OPA, 0);
|
||||
lv_obj_invalidate(d->act_scr);
|
||||
}
|
||||
|
||||
static bool is_out_anim(lv_scr_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;
|
||||
}
|
||||
|
@ -35,7 +35,13 @@ typedef enum {
|
||||
LV_SCR_LOAD_ANIM_MOVE_RIGHT,
|
||||
LV_SCR_LOAD_ANIM_MOVE_TOP,
|
||||
LV_SCR_LOAD_ANIM_MOVE_BOTTOM,
|
||||
LV_SCR_LOAD_ANIM_FADE_ON,
|
||||
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_scr_load_anim_t;
|
||||
|
||||
/**********************
|
||||
@ -116,7 +122,7 @@ void lv_disp_set_bg_opa(lv_disp_t * disp, lv_opa_t opa);
|
||||
/**
|
||||
* Switch screen with animation
|
||||
* @param scr pointer to the new screen to load
|
||||
* @param anim_type type of the animation from `lv_scr_load_anim_t`. E.g. `LV_SCR_LOAD_ANIM_MOVE_LEFT`
|
||||
* @param anim_type type of the animation from `lv_scr_load_anim_t`, e.g. `LV_SCR_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
|
||||
@ -142,6 +148,20 @@ void lv_disp_trig_activity(lv_disp_t * disp);
|
||||
*/
|
||||
void lv_disp_clean_dcache(lv_disp_t * disp);
|
||||
|
||||
/**
|
||||
* Temporarily enable and disable the invalidation of the display.
|
||||
* @param disp pointer to a display (NULL to use the default display)
|
||||
* @param en true: enable invalidation; false: invalidation
|
||||
*/
|
||||
void lv_disp_enable_invalidation(lv_disp_t * disp, bool en);
|
||||
|
||||
/**
|
||||
* Get display invalidation is enabled.
|
||||
* @param disp pointer to a display (NULL to use the default display)
|
||||
* @return return true if invalidation is enabled
|
||||
*/
|
||||
bool lv_disp_is_invalidation_enabled(lv_disp_t * disp);
|
||||
|
||||
/**
|
||||
* Get a pointer to the screen refresher timer to
|
||||
* modify its parameters with `lv_timer_...` functions.
|
||||
|
@ -208,7 +208,7 @@ bool lv_obj_remove_event_cb_with_user_data(lv_obj_t * obj, lv_event_cb_t event_c
|
||||
|
||||
int32_t i = 0;
|
||||
for(i = 0; i < obj->spec_attr->event_dsc_cnt; i++) {
|
||||
if((event_cb == NULL || obj->spec_attr->event_dsc[i].cb) &&
|
||||
if((event_cb == NULL || obj->spec_attr->event_dsc[i].cb == event_cb) &&
|
||||
obj->spec_attr->event_dsc[i].user_data == user_data) {
|
||||
/*Shift the remaining event handlers forward*/
|
||||
for(; i < (obj->spec_attr->event_dsc_cnt - 1); i++) {
|
||||
@ -254,7 +254,7 @@ bool lv_obj_remove_event_dsc(lv_obj_t * obj, struct _lv_event_dsc_t * event_dsc)
|
||||
void * lv_obj_get_event_user_data(struct _lv_obj_t * obj, lv_event_cb_t event_cb)
|
||||
{
|
||||
LV_ASSERT_OBJ(obj, MY_CLASS);
|
||||
if(obj->spec_attr == NULL) return false;
|
||||
if(obj->spec_attr == NULL) return NULL;
|
||||
|
||||
int32_t i = 0;
|
||||
for(i = 0; i < obj->spec_attr->event_dsc_cnt; i++) {
|
||||
@ -436,7 +436,7 @@ static lv_res_t event_send_core(lv_event_t * e)
|
||||
}
|
||||
|
||||
lv_res_t res = LV_RES_OK;
|
||||
lv_event_dsc_t * event_dsc = res == LV_RES_INV ? NULL : lv_obj_get_event_dsc(e->current_target, 0);
|
||||
lv_event_dsc_t * event_dsc = lv_obj_get_event_dsc(e->current_target, 0);
|
||||
|
||||
uint32_t i = 0;
|
||||
while(event_dsc && res == LV_RES_OK) {
|
||||
|
@ -41,7 +41,7 @@ typedef enum {
|
||||
LV_EVENT_LONG_PRESSED_REPEAT, /**< Called after `long_press_time` in every `long_press_repeat_time` ms. Not called if scrolled.*/
|
||||
LV_EVENT_CLICKED, /**< Called on release if not scrolled (regardless to long press)*/
|
||||
LV_EVENT_RELEASED, /**< Called in every cases when the object has been released*/
|
||||
LV_EVENT_SCROLL_BEGIN, /**< Scrolling begins*/
|
||||
LV_EVENT_SCROLL_BEGIN, /**< Scrolling begins. The event parameter is a pointer to the animation of the scroll. Can be modified*/
|
||||
LV_EVENT_SCROLL_END, /**< Scrolling ends*/
|
||||
LV_EVENT_SCROLL, /**< Scrolling*/
|
||||
LV_EVENT_GESTURE, /**< A gesture is detected. Get the gesture with `lv_indev_get_gesture_dir(lv_indev_get_act());` */
|
||||
|
@ -24,7 +24,7 @@
|
||||
/**********************
|
||||
* STATIC PROTOTYPES
|
||||
**********************/
|
||||
static void focus_next_core(lv_group_t * group, void * (*begin)(const lv_ll_t *),
|
||||
static bool focus_next_core(lv_group_t * group, void * (*begin)(const lv_ll_t *),
|
||||
void * (*move)(const lv_ll_t *, const void *));
|
||||
static void lv_group_refocus(lv_group_t * g);
|
||||
static lv_indev_t * get_indev(const lv_group_t * g);
|
||||
@ -57,6 +57,7 @@ lv_group_t * lv_group_create(void)
|
||||
group->obj_focus = NULL;
|
||||
group->frozen = 0;
|
||||
group->focus_cb = NULL;
|
||||
group->edge_cb = NULL;
|
||||
group->editing = 0;
|
||||
group->refocus_policy = LV_GROUP_REFOCUS_POLICY_PREV;
|
||||
group->wrap = 1;
|
||||
@ -261,12 +262,20 @@ void lv_group_focus_obj(lv_obj_t * obj)
|
||||
|
||||
void lv_group_focus_next(lv_group_t * group)
|
||||
{
|
||||
focus_next_core(group, _lv_ll_get_head, _lv_ll_get_next);
|
||||
bool focus_changed = focus_next_core(group, _lv_ll_get_head, _lv_ll_get_next);
|
||||
if(group->edge_cb) {
|
||||
if(!focus_changed)
|
||||
group->edge_cb(group, true);
|
||||
}
|
||||
}
|
||||
|
||||
void lv_group_focus_prev(lv_group_t * group)
|
||||
{
|
||||
focus_next_core(group, _lv_ll_get_tail, _lv_ll_get_prev);
|
||||
bool focus_changed = focus_next_core(group, _lv_ll_get_tail, _lv_ll_get_prev);
|
||||
if(group->edge_cb) {
|
||||
if(!focus_changed)
|
||||
group->edge_cb(group, false);
|
||||
}
|
||||
}
|
||||
|
||||
void lv_group_focus_freeze(lv_group_t * group, bool en)
|
||||
@ -279,6 +288,9 @@ lv_res_t lv_group_send_data(lv_group_t * group, uint32_t c)
|
||||
{
|
||||
lv_obj_t * act = lv_group_get_focused(group);
|
||||
if(act == NULL) return LV_RES_OK;
|
||||
|
||||
if(lv_obj_has_state(act, LV_STATE_DISABLED)) return LV_RES_OK;
|
||||
|
||||
return lv_event_send(act, LV_EVENT_KEY, &c);
|
||||
}
|
||||
|
||||
@ -287,6 +299,11 @@ void lv_group_set_focus_cb(lv_group_t * group, lv_group_focus_cb_t focus_cb)
|
||||
group->focus_cb = focus_cb;
|
||||
}
|
||||
|
||||
void lv_group_set_edge_cb(lv_group_t * group, lv_group_edge_cb_t edge_cb)
|
||||
{
|
||||
group->edge_cb = edge_cb;
|
||||
}
|
||||
|
||||
void lv_group_set_editing(lv_group_t * group, bool edit)
|
||||
{
|
||||
if(group == NULL) return;
|
||||
@ -329,6 +346,12 @@ lv_group_focus_cb_t lv_group_get_focus_cb(const lv_group_t * group)
|
||||
return group->focus_cb;
|
||||
}
|
||||
|
||||
lv_group_edge_cb_t lv_group_get_edge_cb(const lv_group_t * group)
|
||||
{
|
||||
if(!group) return NULL;
|
||||
return group->edge_cb;
|
||||
}
|
||||
|
||||
bool lv_group_get_editing(const lv_group_t * group)
|
||||
{
|
||||
if(!group) return false;
|
||||
@ -363,10 +386,11 @@ static void lv_group_refocus(lv_group_t * g)
|
||||
g->wrap = temp_wrap;
|
||||
}
|
||||
|
||||
static void focus_next_core(lv_group_t * group, void * (*begin)(const lv_ll_t *),
|
||||
static bool focus_next_core(lv_group_t * group, void * (*begin)(const lv_ll_t *),
|
||||
void * (*move)(const lv_ll_t *, const void *))
|
||||
{
|
||||
if(group->frozen) return;
|
||||
bool focus_changed = false;
|
||||
if(group->frozen) return focus_changed;
|
||||
|
||||
lv_obj_t ** obj_next = group->obj_focus;
|
||||
lv_obj_t ** obj_sentinel = NULL;
|
||||
@ -376,27 +400,27 @@ static void focus_next_core(lv_group_t * group, void * (*begin)(const lv_ll_t *)
|
||||
for(;;) {
|
||||
if(obj_next == NULL) {
|
||||
if(group->wrap || obj_sentinel == NULL) {
|
||||
if(!can_begin) return;
|
||||
if(!can_begin) return focus_changed;
|
||||
obj_next = begin(&group->obj_ll);
|
||||
can_move = false;
|
||||
can_begin = false;
|
||||
}
|
||||
else {
|
||||
/*Currently focused object is the last/first in the group, keep it that way*/
|
||||
return;
|
||||
return focus_changed;
|
||||
}
|
||||
}
|
||||
|
||||
if(obj_sentinel == NULL) {
|
||||
obj_sentinel = obj_next;
|
||||
if(obj_sentinel == NULL) return; /*Group is empty*/
|
||||
if(obj_sentinel == NULL) return focus_changed; /*Group is empty*/
|
||||
}
|
||||
|
||||
if(can_move) {
|
||||
obj_next = move(&group->obj_ll, obj_next);
|
||||
|
||||
/*Give up if we walked the entire list and haven't found another visible object*/
|
||||
if(obj_next == obj_sentinel) return;
|
||||
if(obj_next == obj_sentinel) return focus_changed;
|
||||
}
|
||||
|
||||
can_move = true;
|
||||
@ -418,22 +442,24 @@ static void focus_next_core(lv_group_t * group, void * (*begin)(const lv_ll_t *)
|
||||
break;
|
||||
}
|
||||
|
||||
if(obj_next == group->obj_focus) return; /*There's only one visible object and it's already focused*/
|
||||
if(obj_next == group->obj_focus) return focus_changed; /*There's only one visible object and it's already focused*/
|
||||
|
||||
if(group->obj_focus) {
|
||||
lv_res_t res = lv_event_send(*group->obj_focus, LV_EVENT_DEFOCUSED, get_indev(group));
|
||||
if(res != LV_RES_OK) return;
|
||||
if(res != LV_RES_OK) return focus_changed;
|
||||
lv_obj_invalidate(*group->obj_focus);
|
||||
}
|
||||
|
||||
group->obj_focus = obj_next;
|
||||
|
||||
lv_res_t res = lv_event_send(*group->obj_focus, LV_EVENT_FOCUSED, get_indev(group));
|
||||
if(res != LV_RES_OK) return;
|
||||
if(res != LV_RES_OK) return focus_changed;
|
||||
|
||||
lv_obj_invalidate(*group->obj_focus);
|
||||
|
||||
if(group->focus_cb) group->focus_cb(group);
|
||||
focus_changed = true;
|
||||
return focus_changed;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -50,6 +50,7 @@ struct _lv_obj_t;
|
||||
struct _lv_group_t;
|
||||
|
||||
typedef void (*lv_group_focus_cb_t)(struct _lv_group_t *);
|
||||
typedef void (*lv_group_edge_cb_t)(struct _lv_group_t *, bool);
|
||||
|
||||
/**
|
||||
* Groups can be used to logically hold objects so that they can be individually focused.
|
||||
@ -60,6 +61,10 @@ typedef struct _lv_group_t {
|
||||
struct _lv_obj_t ** obj_focus; /**< The object in focus*/
|
||||
|
||||
lv_group_focus_cb_t focus_cb; /**< A function to call when a new object is focused (optional)*/
|
||||
lv_group_edge_cb_t edge_cb; /**< A function to call when an edge is reached, no more focus
|
||||
targets are available in this direction (to allow edge feedback
|
||||
like a sound or a scroll bounce) */
|
||||
|
||||
#if LV_USE_USER_DATA
|
||||
void * user_data;
|
||||
#endif
|
||||
@ -178,6 +183,14 @@ lv_res_t lv_group_send_data(lv_group_t * group, uint32_t c);
|
||||
*/
|
||||
void lv_group_set_focus_cb(lv_group_t * group, lv_group_focus_cb_t focus_cb);
|
||||
|
||||
/**
|
||||
* Set a function for a group which will be called when a focus edge is reached
|
||||
* @param group pointer to a group
|
||||
* @param edge_cb the call back function or NULL if unused
|
||||
*/
|
||||
void lv_group_set_edge_cb(lv_group_t * group, lv_group_edge_cb_t edge_cb);
|
||||
|
||||
|
||||
/**
|
||||
* Set whether the next or previous item in a group is focused if the currently focused obj is
|
||||
* deleted.
|
||||
@ -214,6 +227,13 @@ struct _lv_obj_t * lv_group_get_focused(const lv_group_t * group);
|
||||
*/
|
||||
lv_group_focus_cb_t lv_group_get_focus_cb(const lv_group_t * group);
|
||||
|
||||
/**
|
||||
* Get the edge callback function of a group
|
||||
* @param group pointer to a group
|
||||
* @return the call back function or NULL if not set
|
||||
*/
|
||||
lv_group_edge_cb_t lv_group_get_edge_cb(const lv_group_t * group);
|
||||
|
||||
/**
|
||||
* Get the current mode (edit or navigate).
|
||||
* @param group pointer to group
|
||||
|
@ -75,14 +75,15 @@ void lv_indev_read_timer_cb(lv_timer_t * timer)
|
||||
/*Handle reset query before processing the point*/
|
||||
indev_proc_reset_query_handler(indev_act);
|
||||
|
||||
if(indev_act->proc.disabled) return;
|
||||
if(indev_act->proc.disabled ||
|
||||
indev_act->driver->disp->prev_scr != NULL) return; /*Input disabled or screen animation active*/
|
||||
bool continue_reading;
|
||||
do {
|
||||
/*Read the data*/
|
||||
_lv_indev_read(indev_act, &data);
|
||||
continue_reading = data.continue_reading;
|
||||
|
||||
/*The active object might deleted even in the read function*/
|
||||
/*The active object might be deleted even in the read function*/
|
||||
indev_proc_reset_query_handler(indev_act);
|
||||
indev_obj_act = NULL;
|
||||
|
||||
@ -121,9 +122,18 @@ void lv_indev_read_timer_cb(lv_timer_t * timer)
|
||||
|
||||
void lv_indev_enable(lv_indev_t * indev, bool en)
|
||||
{
|
||||
if(!indev) return;
|
||||
uint8_t enable = en ? 0 : 1;
|
||||
|
||||
indev->proc.disabled = en ? 0 : 1;
|
||||
if(indev) {
|
||||
indev->proc.disabled = enable;
|
||||
}
|
||||
else {
|
||||
lv_indev_t * i = lv_indev_get_next(NULL);
|
||||
while(i) {
|
||||
i->proc.disabled = enable;
|
||||
i = lv_indev_get_next(i);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
lv_indev_t * lv_indev_get_act(void)
|
||||
@ -286,6 +296,7 @@ lv_timer_t * lv_indev_get_read_timer(lv_disp_t * indev)
|
||||
return indev->refr_timer;
|
||||
}
|
||||
|
||||
|
||||
lv_obj_t * lv_indev_search_obj(lv_obj_t * obj, lv_point_t * point)
|
||||
{
|
||||
lv_obj_t * found_p = NULL;
|
||||
@ -293,16 +304,20 @@ lv_obj_t * lv_indev_search_obj(lv_obj_t * obj, lv_point_t * point)
|
||||
/*If this obj is hidden the children are hidden too so return immediately*/
|
||||
if(lv_obj_has_flag(obj, LV_OBJ_FLAG_HIDDEN)) return NULL;
|
||||
|
||||
bool hit_test_ok = lv_obj_hit_test(obj, point);
|
||||
lv_point_t p_trans = *point;
|
||||
lv_obj_transform_point(obj, &p_trans, false, true);
|
||||
|
||||
bool hit_test_ok = lv_obj_hit_test(obj, &p_trans);
|
||||
|
||||
/*If the point is on this object or has overflow visible check its children too*/
|
||||
if(_lv_area_is_point_on(&obj->coords, point, 0) || lv_obj_has_flag(obj, LV_OBJ_FLAG_OVERFLOW_VISIBLE)) {
|
||||
if(_lv_area_is_point_on(&obj->coords, &p_trans, 0) || lv_obj_has_flag(obj, LV_OBJ_FLAG_OVERFLOW_VISIBLE)) {
|
||||
int32_t i;
|
||||
uint32_t child_cnt = lv_obj_get_child_cnt(obj);
|
||||
|
||||
/*If a child matches use it*/
|
||||
for(i = child_cnt - 1; i >= 0; i--) {
|
||||
lv_obj_t * child = obj->spec_attr->children[i];
|
||||
found_p = lv_indev_search_obj(child, point);
|
||||
found_p = lv_indev_search_obj(child, &p_trans);
|
||||
if(found_p) return found_p;
|
||||
}
|
||||
}
|
||||
@ -395,6 +410,8 @@ static void indev_keypad_proc(lv_indev_t * i, lv_indev_data_t * data)
|
||||
indev_obj_act = lv_group_get_focused(g);
|
||||
if(indev_obj_act == NULL) return;
|
||||
|
||||
bool dis = lv_obj_has_state(indev_obj_act, LV_STATE_DISABLED);
|
||||
|
||||
/*Save the last key to compare it with the current latter on RELEASE*/
|
||||
uint32_t prev_key = i->proc.types.keypad.last_key;
|
||||
|
||||
@ -410,26 +427,11 @@ static void indev_keypad_proc(lv_indev_t * i, lv_indev_data_t * data)
|
||||
|
||||
/*Key press happened*/
|
||||
if(data->state == LV_INDEV_STATE_PRESSED && prev_state == LV_INDEV_STATE_RELEASED) {
|
||||
LV_LOG_INFO("%d key is pressed", data->key);
|
||||
LV_LOG_INFO("%" LV_PRIu32 " key is pressed", data->key);
|
||||
i->proc.pr_timestamp = lv_tick_get();
|
||||
|
||||
/*Simulate a press on the object if ENTER was pressed*/
|
||||
if(data->key == LV_KEY_ENTER) {
|
||||
/*Send the ENTER as a normal KEY*/
|
||||
lv_group_send_data(g, LV_KEY_ENTER);
|
||||
|
||||
lv_event_send(indev_obj_act, LV_EVENT_PRESSED, indev_act);
|
||||
if(indev_reset_check(&i->proc)) return;
|
||||
}
|
||||
else if(data->key == LV_KEY_ESC) {
|
||||
/*Send the ESC as a normal KEY*/
|
||||
lv_group_send_data(g, LV_KEY_ESC);
|
||||
|
||||
lv_event_send(indev_obj_act, LV_EVENT_CANCEL, indev_act);
|
||||
if(indev_reset_check(&i->proc)) return;
|
||||
}
|
||||
/*Move the focus on NEXT*/
|
||||
else if(data->key == LV_KEY_NEXT) {
|
||||
if(data->key == LV_KEY_NEXT) {
|
||||
lv_group_set_editing(g, false); /*Editing is not used by KEYPAD is be sure it is disabled*/
|
||||
lv_group_focus_next(g);
|
||||
if(indev_reset_check(&i->proc)) return;
|
||||
@ -440,13 +442,33 @@ static void indev_keypad_proc(lv_indev_t * i, lv_indev_data_t * data)
|
||||
lv_group_focus_prev(g);
|
||||
if(indev_reset_check(&i->proc)) return;
|
||||
}
|
||||
/*Just send other keys to the object (e.g. 'A' or `LV_GROUP_KEY_RIGHT`)*/
|
||||
else {
|
||||
lv_group_send_data(g, data->key);
|
||||
else if(!dis) {
|
||||
/*Simulate a press on the object if ENTER was pressed*/
|
||||
if(data->key == LV_KEY_ENTER) {
|
||||
/*Send the ENTER as a normal KEY*/
|
||||
lv_group_send_data(g, LV_KEY_ENTER);
|
||||
if(indev_reset_check(&i->proc)) return;
|
||||
|
||||
if(!dis) lv_event_send(indev_obj_act, LV_EVENT_PRESSED, indev_act);
|
||||
if(indev_reset_check(&i->proc)) return;
|
||||
}
|
||||
else if(data->key == LV_KEY_ESC) {
|
||||
/*Send the ESC as a normal KEY*/
|
||||
lv_group_send_data(g, LV_KEY_ESC);
|
||||
if(indev_reset_check(&i->proc)) return;
|
||||
|
||||
lv_event_send(indev_obj_act, LV_EVENT_CANCEL, indev_act);
|
||||
if(indev_reset_check(&i->proc)) return;
|
||||
}
|
||||
/*Just send other keys to the object (e.g. 'A' or `LV_GROUP_KEY_RIGHT`)*/
|
||||
else {
|
||||
lv_group_send_data(g, data->key);
|
||||
if(indev_reset_check(&i->proc)) return;
|
||||
}
|
||||
}
|
||||
}
|
||||
/*Pressing*/
|
||||
else if(data->state == LV_INDEV_STATE_PRESSED && prev_state == LV_INDEV_STATE_PRESSED) {
|
||||
else if(!dis && data->state == LV_INDEV_STATE_PRESSED && prev_state == LV_INDEV_STATE_PRESSED) {
|
||||
|
||||
if(data->key == LV_KEY_ENTER) {
|
||||
lv_event_send(indev_obj_act, LV_EVENT_PRESSING, indev_act);
|
||||
@ -493,8 +515,8 @@ static void indev_keypad_proc(lv_indev_t * i, lv_indev_data_t * data)
|
||||
}
|
||||
}
|
||||
/*Release happened*/
|
||||
else if(data->state == LV_INDEV_STATE_RELEASED && prev_state == LV_INDEV_STATE_PRESSED) {
|
||||
LV_LOG_INFO("%d key is released", data->key);
|
||||
else if(!dis && data->state == LV_INDEV_STATE_RELEASED && prev_state == LV_INDEV_STATE_PRESSED) {
|
||||
LV_LOG_INFO("%" LV_PRIu32 " key is released", data->key);
|
||||
/*The user might clear the key when it was released. Always release the pressed key*/
|
||||
data->key = prev_key;
|
||||
if(data->key == LV_KEY_ENTER) {
|
||||
@ -579,6 +601,7 @@ static void indev_encoder_proc(lv_indev_t * i, lv_indev_data_t * data)
|
||||
else if(data->key == LV_KEY_ESC) {
|
||||
/*Send the ESC as a normal KEY*/
|
||||
lv_group_send_data(g, LV_KEY_ESC);
|
||||
if(indev_reset_check(&i->proc)) return;
|
||||
|
||||
lv_event_send(indev_obj_act, LV_EVENT_CANCEL, indev_act);
|
||||
if(indev_reset_check(&i->proc)) return;
|
||||
@ -586,6 +609,7 @@ static void indev_encoder_proc(lv_indev_t * i, lv_indev_data_t * data)
|
||||
/*Just send other keys to the object (e.g. 'A' or `LV_GROUP_KEY_RIGHT`)*/
|
||||
else {
|
||||
lv_group_send_data(g, data->key);
|
||||
if(indev_reset_check(&i->proc)) return;
|
||||
}
|
||||
}
|
||||
/*Pressing*/
|
||||
@ -676,8 +700,8 @@ static void indev_encoder_proc(lv_indev_t * i, lv_indev_data_t * data)
|
||||
lv_event_send(indev_obj_act, LV_EVENT_CLICKED, indev_act);
|
||||
if(indev_reset_check(&i->proc)) return;
|
||||
|
||||
|
||||
lv_group_send_data(g, LV_KEY_ENTER);
|
||||
if(indev_reset_check(&i->proc)) return;
|
||||
}
|
||||
else {
|
||||
lv_obj_clear_state(indev_obj_act, LV_STATE_PRESSED); /*Remove the pressed state manually*/
|
||||
@ -703,10 +727,16 @@ static void indev_encoder_proc(lv_indev_t * i, lv_indev_data_t * data)
|
||||
LV_LOG_INFO("rotated by %+d (edit)", data->enc_diff);
|
||||
int32_t s;
|
||||
if(data->enc_diff < 0) {
|
||||
for(s = 0; s < -data->enc_diff; s++) lv_group_send_data(g, LV_KEY_LEFT);
|
||||
for(s = 0; s < -data->enc_diff; s++) {
|
||||
lv_group_send_data(g, LV_KEY_LEFT);
|
||||
if(indev_reset_check(&i->proc)) return;
|
||||
}
|
||||
}
|
||||
else if(data->enc_diff > 0) {
|
||||
for(s = 0; s < data->enc_diff; s++) lv_group_send_data(g, LV_KEY_RIGHT);
|
||||
for(s = 0; s < data->enc_diff; s++) {
|
||||
lv_group_send_data(g, LV_KEY_RIGHT);
|
||||
if(indev_reset_check(&i->proc)) return;
|
||||
}
|
||||
}
|
||||
}
|
||||
/*In navigate mode focus on the next/prev objects*/
|
||||
@ -714,10 +744,16 @@ static void indev_encoder_proc(lv_indev_t * i, lv_indev_data_t * data)
|
||||
LV_LOG_INFO("rotated by %+d (nav)", data->enc_diff);
|
||||
int32_t s;
|
||||
if(data->enc_diff < 0) {
|
||||
for(s = 0; s < -data->enc_diff; s++) lv_group_focus_prev(g);
|
||||
for(s = 0; s < -data->enc_diff; s++) {
|
||||
lv_group_focus_prev(g);
|
||||
if(indev_reset_check(&i->proc)) return;
|
||||
}
|
||||
}
|
||||
else if(data->enc_diff > 0) {
|
||||
for(s = 0; s < data->enc_diff; s++) lv_group_focus_next(g);
|
||||
for(s = 0; s < data->enc_diff; s++) {
|
||||
lv_group_focus_next(g);
|
||||
if(indev_reset_check(&i->proc)) return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -743,10 +779,10 @@ static void indev_button_proc(lv_indev_t * i, lv_indev_data_t * data)
|
||||
static lv_indev_state_t prev_state = LV_INDEV_STATE_RELEASED;
|
||||
if(prev_state != data->state) {
|
||||
if(data->state == LV_INDEV_STATE_PRESSED) {
|
||||
LV_LOG_INFO("button %d is pressed (x:%d y:%d)", data->btn_id, x, y);
|
||||
LV_LOG_INFO("button %" LV_PRIu32 " is pressed (x:%d y:%d)", data->btn_id, x, y);
|
||||
}
|
||||
else {
|
||||
LV_LOG_INFO("button %d is released (x:%d y:%d)", data->btn_id, x, y);
|
||||
LV_LOG_INFO("button %" LV_PRIu32 " is released (x:%d y:%d)", data->btn_id, x, y);
|
||||
}
|
||||
}
|
||||
|
||||
@ -816,7 +852,9 @@ static void indev_proc_press(_lv_indev_proc_t * proc)
|
||||
if(indev_reset_check(proc)) return;
|
||||
}
|
||||
|
||||
/*If a new object was found reset some variables and send a pressed Call the ancestor's event handler*/
|
||||
lv_obj_transform_point(indev_obj_act, &proc->types.pointer.act_point, true, true);
|
||||
|
||||
/*If a new object was found reset some variables and send a pressed event handler*/
|
||||
if(indev_obj_act != proc->types.pointer.act_obj) {
|
||||
proc->types.pointer.last_point.x = proc->types.pointer.act_point.x;
|
||||
proc->types.pointer.last_point.y = proc->types.pointer.act_point.y;
|
||||
@ -864,11 +902,8 @@ static void indev_proc_press(_lv_indev_proc_t * proc)
|
||||
proc->types.pointer.vect.x = proc->types.pointer.act_point.x - proc->types.pointer.last_point.x;
|
||||
proc->types.pointer.vect.y = proc->types.pointer.act_point.y - proc->types.pointer.last_point.y;
|
||||
|
||||
proc->types.pointer.scroll_throw_vect.x = (proc->types.pointer.scroll_throw_vect.x * 4) >> 3;
|
||||
proc->types.pointer.scroll_throw_vect.y = (proc->types.pointer.scroll_throw_vect.y * 4) >> 3;
|
||||
|
||||
proc->types.pointer.scroll_throw_vect.x += (proc->types.pointer.vect.x * 4) >> 3;
|
||||
proc->types.pointer.scroll_throw_vect.y += (proc->types.pointer.vect.y * 4) >> 3;
|
||||
proc->types.pointer.scroll_throw_vect.x = (proc->types.pointer.scroll_throw_vect.x + proc->types.pointer.vect.x) / 2;
|
||||
proc->types.pointer.scroll_throw_vect.y = (proc->types.pointer.scroll_throw_vect.y + proc->types.pointer.vect.y) / 2;
|
||||
|
||||
proc->types.pointer.scroll_throw_vect_ori = proc->types.pointer.scroll_throw_vect;
|
||||
|
||||
@ -917,6 +952,9 @@ static void indev_proc_press(_lv_indev_proc_t * proc)
|
||||
static void indev_proc_release(_lv_indev_proc_t * proc)
|
||||
{
|
||||
if(proc->wait_until_release != 0) {
|
||||
lv_event_send(proc->types.pointer.act_obj, LV_EVENT_PRESS_LOST, indev_act);
|
||||
if(indev_reset_check(proc)) return;
|
||||
|
||||
proc->types.pointer.act_obj = NULL;
|
||||
proc->types.pointer.last_obj = NULL;
|
||||
proc->pr_timestamp = 0;
|
||||
|
@ -35,7 +35,11 @@ extern "C" {
|
||||
*/
|
||||
void lv_indev_read_timer_cb(lv_timer_t * timer);
|
||||
|
||||
|
||||
/**
|
||||
* Enable or disable one or all input devices (default enabled)
|
||||
* @param indev pointer to an input device or NULL to enable/disable all of them
|
||||
* @param en true to enable, false to disable
|
||||
*/
|
||||
void lv_indev_enable(lv_indev_t * indev, bool en);
|
||||
|
||||
/**
|
||||
|
@ -85,7 +85,8 @@ void _lv_indev_scroll_handler(_lv_indev_proc_t * proc)
|
||||
/*Respect the scroll limit area*/
|
||||
scroll_limit_diff(proc, &diff_x, &diff_y);
|
||||
|
||||
lv_obj_scroll_by(scroll_obj, diff_x, diff_y, LV_ANIM_OFF);
|
||||
_lv_obj_scroll_by_raw(scroll_obj, diff_x, diff_y);
|
||||
if(proc->reset_query) return;
|
||||
proc->types.pointer.scroll_sum.x += diff_x;
|
||||
proc->types.pointer.scroll_sum.y += diff_y;
|
||||
}
|
||||
|
@ -30,9 +30,12 @@
|
||||
#include "../draw/stm32_dma2d/lv_gpu_stm32_dma2d.h"
|
||||
#endif
|
||||
|
||||
#if LV_USE_GPU_SWM341_DMA2D
|
||||
#include "../draw/swm341_dma2d/lv_gpu_swm341_dma2d.h"
|
||||
#endif
|
||||
|
||||
#if LV_USE_GPU_NXP_PXP && LV_USE_GPU_NXP_PXP_AUTO_INIT
|
||||
#include "../gpu/lv_gpu_nxp_pxp.h"
|
||||
#include "../gpu/lv_gpu_nxp_pxp_osa.h"
|
||||
#include "../draw/nxp/pxp/lv_gpu_nxp_pxp.h"
|
||||
#endif
|
||||
|
||||
/*********************
|
||||
@ -41,7 +44,6 @@
|
||||
#define MY_CLASS &lv_obj_class
|
||||
#define LV_OBJ_DEF_WIDTH (LV_DPX(100))
|
||||
#define LV_OBJ_DEF_HEIGHT (LV_DPX(50))
|
||||
#define GRID_DEBUG 0 /*Draw rectangles on grid cells*/
|
||||
#define STYLE_TRANSITION_MAX 32
|
||||
|
||||
/**********************
|
||||
@ -117,11 +119,13 @@ void lv_init(void)
|
||||
lv_draw_stm32_dma2d_init();
|
||||
#endif
|
||||
|
||||
#if LV_USE_GPU_SWM341_DMA2D
|
||||
/*Initialize DMA2D GPU*/
|
||||
lv_draw_swm341_dma2d_init();
|
||||
#endif
|
||||
|
||||
#if LV_USE_GPU_NXP_PXP && LV_USE_GPU_NXP_PXP_AUTO_INIT
|
||||
if(lv_gpu_nxp_pxp_init(&pxp_default_cfg) != LV_RES_OK) {
|
||||
LV_LOG_ERROR("PXP init error. STOP.\n");
|
||||
for(; ;) ;
|
||||
}
|
||||
PXP_COND_STOP(!lv_gpu_nxp_pxp_init(), "PXP init failed.");
|
||||
#endif
|
||||
|
||||
_lv_obj_style_init();
|
||||
@ -265,6 +269,7 @@ void lv_obj_clear_flag(lv_obj_t * obj, lv_obj_flag_t f)
|
||||
if((was_on_layout != lv_obj_is_layout_positioned(obj)) || (f & (LV_OBJ_FLAG_LAYOUT_1 | LV_OBJ_FLAG_LAYOUT_2))) {
|
||||
lv_obj_mark_layout_as_dirty(lv_obj_get_parent(obj));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void lv_obj_add_state(lv_obj_t * obj, lv_state_t state)
|
||||
@ -489,17 +494,6 @@ static void lv_obj_draw(lv_event_t * e)
|
||||
return;
|
||||
}
|
||||
|
||||
#if LV_DRAW_COMPLEX
|
||||
if(lv_obj_get_style_blend_mode(obj, LV_PART_MAIN) != LV_BLEND_MODE_NORMAL) {
|
||||
info->res = LV_COVER_RES_NOT_COVER;
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
if(lv_obj_get_style_opa(obj, LV_PART_MAIN) < LV_OPA_MAX) {
|
||||
info->res = LV_COVER_RES_NOT_COVER;
|
||||
return;
|
||||
}
|
||||
|
||||
info->res = LV_COVER_RES_COVER;
|
||||
|
||||
}
|
||||
@ -531,7 +525,6 @@ static void lv_obj_draw(lv_event_t * e)
|
||||
part_dsc.part = LV_PART_MAIN;
|
||||
lv_event_send(obj, LV_EVENT_DRAW_PART_BEGIN, &part_dsc);
|
||||
|
||||
|
||||
#if LV_DRAW_COMPLEX
|
||||
/*With clip corner enabled draw the bg img separately to make it clipped*/
|
||||
bool clip_corner = (lv_obj_get_style_clip_corner(obj, LV_PART_MAIN) && draw_dsc.radius != 0) ? true : false;
|
||||
@ -846,9 +839,8 @@ static void lv_obj_event(const lv_obj_class_t * class_p, lv_event_t * e)
|
||||
}
|
||||
}
|
||||
else if(code == LV_EVENT_REFR_EXT_DRAW_SIZE) {
|
||||
lv_coord_t * s = lv_event_get_param(e);
|
||||
lv_coord_t d = lv_obj_calculate_ext_draw_size(obj, LV_PART_MAIN);
|
||||
*s = LV_MAX(*s, d);
|
||||
lv_event_set_ext_draw_size(e, d);
|
||||
}
|
||||
else if(code == LV_EVENT_DRAW_MAIN || code == LV_EVENT_DRAW_POST || code == LV_EVENT_COVER_CHECK) {
|
||||
lv_obj_draw(e);
|
||||
@ -886,7 +878,7 @@ static void lv_obj_set_state(lv_obj_t * obj, lv_state_t new_state)
|
||||
if(obj_style->is_trans) continue;
|
||||
|
||||
lv_style_value_t v;
|
||||
if(lv_style_get_prop_inlined(obj_style->style, LV_STYLE_TRANSITION, &v) == false) continue;
|
||||
if(lv_style_get_prop_inlined(obj_style->style, LV_STYLE_TRANSITION, &v) != LV_STYLE_RES_FOUND) continue;
|
||||
const lv_style_transition_dsc_t * tr = v.ptr;
|
||||
|
||||
/*Add the props to the set if not added yet or added but with smaller weight*/
|
||||
|
@ -63,7 +63,7 @@ typedef uint16_t 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
|
||||
* Note every part is used by every widget
|
||||
* Not all parts are used by every widget
|
||||
*/
|
||||
enum {
|
||||
LV_PART_MAIN = 0x000000, /**< A background like rectangle*/
|
||||
@ -167,7 +167,8 @@ typedef struct {
|
||||
lv_scroll_snap_t scroll_snap_x : 2; /**< Where to align the snappable children horizontally*/
|
||||
lv_scroll_snap_t scroll_snap_y : 2; /**< Where to align the snappable children vertically*/
|
||||
lv_dir_t scroll_dir : 4; /**< The allowed scroll direction(s)*/
|
||||
uint8_t event_dsc_cnt; /**< Number of event callbacks stored in `event_dsc` array*/
|
||||
uint8_t event_dsc_cnt : 6; /**< Number of event callbacks stored in `event_dsc` array*/
|
||||
uint8_t layer_type : 2; /**< Cache the layer type here. Element of @lv_intermediate_layer_type_t */
|
||||
} _lv_obj_spec_attr_t;
|
||||
|
||||
typedef struct _lv_obj_t {
|
||||
|
@ -56,6 +56,7 @@ lv_obj_t * lv_obj_class_create_obj(const lv_obj_class_t * class_p, lv_obj_t * pa
|
||||
lv_disp_t * disp = lv_disp_get_default();
|
||||
if(!disp) {
|
||||
LV_LOG_WARN("No display created yet. No place to assign the new screen");
|
||||
lv_mem_free(obj);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@ -38,21 +38,23 @@
|
||||
|
||||
void lv_obj_init_draw_rect_dsc(lv_obj_t * obj, uint32_t part, lv_draw_rect_dsc_t * draw_dsc)
|
||||
{
|
||||
|
||||
#if LV_DRAW_COMPLEX
|
||||
draw_dsc->radius = lv_obj_get_style_radius(obj, part);
|
||||
|
||||
lv_opa_t main_opa = part != LV_PART_MAIN ? lv_obj_get_style_opa(obj, part) : LV_OPA_COVER;
|
||||
lv_opa_t opa = lv_obj_get_style_opa(obj, part);
|
||||
if(opa <= LV_OPA_MIN || main_opa <= LV_OPA_MIN) {
|
||||
draw_dsc->bg_opa = LV_OPA_TRANSP;
|
||||
draw_dsc->border_opa = LV_OPA_TRANSP;
|
||||
draw_dsc->shadow_opa = LV_OPA_TRANSP;
|
||||
draw_dsc->outline_opa = LV_OPA_TRANSP;
|
||||
return;
|
||||
lv_opa_t opa = LV_OPA_COVER;
|
||||
if(part != LV_PART_MAIN) {
|
||||
opa = lv_obj_get_style_opa(obj, part);
|
||||
if(opa <= LV_OPA_MIN) {
|
||||
draw_dsc->bg_opa = LV_OPA_TRANSP;
|
||||
draw_dsc->bg_img_opa = LV_OPA_TRANSP;
|
||||
draw_dsc->border_opa = LV_OPA_TRANSP;
|
||||
draw_dsc->outline_opa = LV_OPA_TRANSP;
|
||||
draw_dsc->shadow_opa = LV_OPA_TRANSP;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
draw_dsc->blend_mode = lv_obj_get_style_blend_mode(obj, part);
|
||||
#if LV_DRAW_COMPLEX
|
||||
if(part != LV_PART_MAIN) draw_dsc->blend_mode = lv_obj_get_style_blend_mode(obj, part);
|
||||
|
||||
draw_dsc->radius = lv_obj_get_style_radius(obj, part);
|
||||
|
||||
if(draw_dsc->bg_opa != LV_OPA_TRANSP) {
|
||||
draw_dsc->bg_opa = lv_obj_get_style_bg_opa(obj, part);
|
||||
@ -130,17 +132,6 @@ void lv_obj_init_draw_rect_dsc(lv_obj_t * obj, uint32_t part, lv_draw_rect_dsc_t
|
||||
}
|
||||
}
|
||||
|
||||
if(main_opa < LV_OPA_MAX) {
|
||||
opa = (uint16_t)((uint16_t) main_opa * opa) >> 8;
|
||||
}
|
||||
|
||||
if(opa < LV_OPA_MAX) {
|
||||
draw_dsc->bg_opa = (uint16_t)((uint16_t)draw_dsc->bg_opa * opa) >> 8;
|
||||
draw_dsc->bg_img_opa = (uint16_t)((uint16_t)draw_dsc->bg_img_opa * opa) >> 8;
|
||||
draw_dsc->border_opa = (uint16_t)((uint16_t)draw_dsc->border_opa * opa) >> 8;
|
||||
draw_dsc->shadow_opa = (uint16_t)((uint16_t)draw_dsc->shadow_opa * opa) >> 8;
|
||||
draw_dsc->outline_opa = (uint16_t)((uint16_t)draw_dsc->outline_opa * opa) >> 8;
|
||||
}
|
||||
#else /*LV_DRAW_COMPLEX*/
|
||||
if(draw_dsc->bg_opa != LV_OPA_TRANSP) {
|
||||
draw_dsc->bg_opa = lv_obj_get_style_bg_opa(obj, part);
|
||||
@ -189,6 +180,16 @@ void lv_obj_init_draw_rect_dsc(lv_obj_t * obj, uint32_t part, lv_draw_rect_dsc_t
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
if(part != LV_PART_MAIN) {
|
||||
if(opa < LV_OPA_MAX) {
|
||||
draw_dsc->bg_opa = (opa * draw_dsc->shadow_opa) >> 8;
|
||||
draw_dsc->bg_img_opa = (opa * draw_dsc->shadow_opa) >> 8;
|
||||
draw_dsc->border_opa = (opa * draw_dsc->shadow_opa) >> 8;
|
||||
draw_dsc->outline_opa = (opa * draw_dsc->shadow_opa) >> 8;
|
||||
draw_dsc->shadow_opa = (opa * draw_dsc->shadow_opa) >> 8;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void lv_obj_init_draw_label_dsc(lv_obj_t * obj, uint32_t part, lv_draw_label_dsc_t * draw_dsc)
|
||||
@ -196,18 +197,23 @@ void lv_obj_init_draw_label_dsc(lv_obj_t * obj, uint32_t part, lv_draw_label_dsc
|
||||
draw_dsc->opa = lv_obj_get_style_text_opa(obj, part);
|
||||
if(draw_dsc->opa <= LV_OPA_MIN) return;
|
||||
|
||||
lv_opa_t opa = lv_obj_get_style_opa(obj, part);
|
||||
if(opa < LV_OPA_MAX) {
|
||||
draw_dsc->opa = (uint16_t)((uint16_t)draw_dsc->opa * opa) >> 8;
|
||||
if(part != LV_PART_MAIN) {
|
||||
lv_opa_t opa = lv_obj_get_style_opa(obj, part);
|
||||
if(opa <= LV_OPA_MIN) {
|
||||
draw_dsc->opa = LV_OPA_TRANSP;
|
||||
return;
|
||||
}
|
||||
if(opa < LV_OPA_MAX) {
|
||||
draw_dsc->opa = (opa * draw_dsc->opa) >> 8;
|
||||
}
|
||||
}
|
||||
if(draw_dsc->opa <= LV_OPA_MIN) return;
|
||||
|
||||
draw_dsc->color = lv_obj_get_style_text_color_filtered(obj, part);
|
||||
draw_dsc->letter_space = lv_obj_get_style_text_letter_space(obj, part);
|
||||
draw_dsc->line_space = lv_obj_get_style_text_line_space(obj, part);
|
||||
draw_dsc->decor = lv_obj_get_style_text_decor(obj, part);
|
||||
#if LV_DRAW_COMPLEX
|
||||
draw_dsc->blend_mode = lv_obj_get_style_blend_mode(obj, part);
|
||||
if(part != LV_PART_MAIN) draw_dsc->blend_mode = lv_obj_get_style_blend_mode(obj, part);
|
||||
#endif
|
||||
|
||||
draw_dsc->font = lv_obj_get_style_text_font(obj, part);
|
||||
@ -222,13 +228,18 @@ void lv_obj_init_draw_label_dsc(lv_obj_t * obj, uint32_t part, lv_draw_label_dsc
|
||||
void lv_obj_init_draw_img_dsc(lv_obj_t * obj, uint32_t part, lv_draw_img_dsc_t * draw_dsc)
|
||||
{
|
||||
draw_dsc->opa = lv_obj_get_style_img_opa(obj, part);
|
||||
if(draw_dsc->opa <= LV_OPA_MIN) return;
|
||||
if(draw_dsc->opa <= LV_OPA_MIN) return;
|
||||
|
||||
lv_opa_t opa_scale = lv_obj_get_style_opa(obj, part);
|
||||
if(opa_scale < LV_OPA_MAX) {
|
||||
draw_dsc->opa = (uint16_t)((uint16_t)draw_dsc->opa * opa_scale) >> 8;
|
||||
if(part != LV_PART_MAIN) {
|
||||
lv_opa_t opa = lv_obj_get_style_opa(obj, part);
|
||||
if(opa <= LV_OPA_MIN) {
|
||||
draw_dsc->opa = LV_OPA_TRANSP;
|
||||
return;
|
||||
}
|
||||
if(opa < LV_OPA_MAX) {
|
||||
draw_dsc->opa = (opa * draw_dsc->opa) >> 8;
|
||||
}
|
||||
}
|
||||
if(draw_dsc->opa <= LV_OPA_MIN) return;
|
||||
|
||||
draw_dsc->angle = 0;
|
||||
draw_dsc->zoom = LV_IMG_ZOOM_NONE;
|
||||
@ -240,23 +251,28 @@ void lv_obj_init_draw_img_dsc(lv_obj_t * obj, uint32_t part, lv_draw_img_dsc_t *
|
||||
draw_dsc->recolor = lv_obj_get_style_img_recolor_filtered(obj, part);
|
||||
}
|
||||
#if LV_DRAW_COMPLEX
|
||||
draw_dsc->blend_mode = lv_obj_get_style_blend_mode(obj, part);
|
||||
if(part != LV_PART_MAIN) draw_dsc->blend_mode = lv_obj_get_style_blend_mode(obj, part);
|
||||
#endif
|
||||
}
|
||||
|
||||
void lv_obj_init_draw_line_dsc(lv_obj_t * obj, uint32_t part, lv_draw_line_dsc_t * draw_dsc)
|
||||
{
|
||||
draw_dsc->width = lv_obj_get_style_line_width(obj, part);
|
||||
if(draw_dsc->width == 0) return;
|
||||
|
||||
draw_dsc->opa = lv_obj_get_style_line_opa(obj, part);
|
||||
if(draw_dsc->opa <= LV_OPA_MIN) return;
|
||||
|
||||
lv_opa_t opa = lv_obj_get_style_opa(obj, part);
|
||||
if(opa < LV_OPA_MAX) {
|
||||
draw_dsc->opa = (uint16_t)((uint16_t)draw_dsc->opa * opa) >> 8;
|
||||
if(part != LV_PART_MAIN) {
|
||||
lv_opa_t opa = lv_obj_get_style_opa(obj, part);
|
||||
if(opa <= LV_OPA_MIN) {
|
||||
draw_dsc->opa = LV_OPA_TRANSP;
|
||||
return;
|
||||
}
|
||||
if(opa < LV_OPA_MAX) {
|
||||
draw_dsc->opa = (opa * draw_dsc->opa) >> 8;
|
||||
}
|
||||
}
|
||||
if(draw_dsc->opa <= LV_OPA_MIN) return;
|
||||
|
||||
draw_dsc->width = lv_obj_get_style_line_width(obj, part);
|
||||
if(draw_dsc->width == 0) return;
|
||||
|
||||
draw_dsc->color = lv_obj_get_style_line_color_filtered(obj, part);
|
||||
|
||||
@ -269,7 +285,7 @@ void lv_obj_init_draw_line_dsc(lv_obj_t * obj, uint32_t part, lv_draw_line_dsc_t
|
||||
draw_dsc->round_end = draw_dsc->round_start;
|
||||
|
||||
#if LV_DRAW_COMPLEX
|
||||
draw_dsc->blend_mode = lv_obj_get_style_blend_mode(obj, part);
|
||||
if(part != LV_PART_MAIN) draw_dsc->blend_mode = lv_obj_get_style_blend_mode(obj, part);
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -281,11 +297,16 @@ void lv_obj_init_draw_arc_dsc(lv_obj_t * obj, uint32_t part, lv_draw_arc_dsc_t *
|
||||
draw_dsc->opa = lv_obj_get_style_arc_opa(obj, part);
|
||||
if(draw_dsc->opa <= LV_OPA_MIN) return;
|
||||
|
||||
lv_opa_t opa = lv_obj_get_style_opa(obj, part);
|
||||
if(opa < LV_OPA_MAX) {
|
||||
draw_dsc->opa = (uint16_t)((uint16_t)draw_dsc->opa * opa) >> 8;
|
||||
if(part != LV_PART_MAIN) {
|
||||
lv_opa_t opa = lv_obj_get_style_opa(obj, part);
|
||||
if(opa <= LV_OPA_MIN) {
|
||||
draw_dsc->opa = LV_OPA_TRANSP;
|
||||
return;
|
||||
}
|
||||
if(opa < LV_OPA_MAX) {
|
||||
draw_dsc->opa = (opa * draw_dsc->opa) >> 8;
|
||||
}
|
||||
}
|
||||
if(draw_dsc->opa <= LV_OPA_MIN) return;
|
||||
|
||||
draw_dsc->color = lv_obj_get_style_arc_color_filtered(obj, part);
|
||||
draw_dsc->img_src = lv_obj_get_style_arc_img_src(obj, part);
|
||||
@ -293,7 +314,7 @@ void lv_obj_init_draw_arc_dsc(lv_obj_t * obj, uint32_t part, lv_draw_arc_dsc_t *
|
||||
draw_dsc->rounded = lv_obj_get_style_arc_rounded(obj, part);
|
||||
|
||||
#if LV_DRAW_COMPLEX
|
||||
draw_dsc->blend_mode = lv_obj_get_style_blend_mode(obj, part);
|
||||
if(part != LV_PART_MAIN) draw_dsc->blend_mode = lv_obj_get_style_blend_mode(obj, part);
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -373,6 +394,13 @@ lv_coord_t _lv_obj_get_ext_draw_size(const lv_obj_t * obj)
|
||||
else return 0;
|
||||
}
|
||||
|
||||
lv_layer_type_t _lv_obj_get_layer_type(const lv_obj_t * obj)
|
||||
{
|
||||
|
||||
if(obj->spec_attr) return obj->spec_attr->layer_type;
|
||||
else return LV_LAYER_TYPE_NONE;
|
||||
}
|
||||
|
||||
/**********************
|
||||
* STATIC FUNCTIONS
|
||||
**********************/
|
||||
|
@ -33,6 +33,12 @@ typedef enum {
|
||||
LV_COVER_RES_MASKED = 2,
|
||||
} lv_cover_res_t;
|
||||
|
||||
typedef enum {
|
||||
LV_LAYER_TYPE_NONE,
|
||||
LV_LAYER_TYPE_SIMPLE,
|
||||
LV_LAYER_TYPE_TRANSFORM,
|
||||
} lv_layer_type_t;
|
||||
|
||||
typedef struct {
|
||||
lv_draw_ctx_t * draw_ctx; /**< Draw context*/
|
||||
const struct _lv_obj_class_t * class_p; /**< The class that sent the event */
|
||||
@ -50,14 +56,14 @@ typedef struct {
|
||||
arc_dsc; /**< A draw descriptor that can be modified to changed what LVGL will draw. Set only for arc-like parts*/
|
||||
const lv_point_t *
|
||||
p1; /**< A point calculated during drawing. E.g. a point of chart or the center of an arc.*/
|
||||
const lv_point_t * p2; /**< A point calculated during drawing. E.g. a point of chart.*/
|
||||
const lv_point_t * p2; /**< A point calculated during drawing. E.g. a point of chart.*/
|
||||
char * text; /**< A text calculated during drawing. Can be modified. E.g. tick labels on a chart axis.*/
|
||||
uint32_t text_length; /**< Size of the text buffer containing null-terminated text string calculated during drawing.*/
|
||||
uint32_t part; /**< The current part for which the event is sent*/
|
||||
uint32_t id; /**< The index of the part. E.g. a button's index on button matrix or table cell index.*/
|
||||
lv_coord_t radius; /**< E.g. the radius of an arc (not the corner radius).*/
|
||||
int32_t value; /**< A value calculated during drawing. E.g. Chart's tick line value.*/
|
||||
const void * sub_part_ptr; /**< A pointer the identifies something in the part. E.g. chart series. */
|
||||
uint32_t text_length; /**< Size of the text buffer containing null-terminated text string calculated during drawing.*/
|
||||
uint32_t part; /**< The current part for which the event is sent*/
|
||||
uint32_t id; /**< The index of the part. E.g. a button's index on button matrix or table cell index.*/
|
||||
lv_coord_t radius; /**< E.g. the radius of an arc (not the corner radius).*/
|
||||
int32_t value; /**< A value calculated during drawing. E.g. Chart's tick line value.*/
|
||||
const void * sub_part_ptr; /**< A pointer the identifies something in the part. E.g. chart series. */
|
||||
} lv_obj_draw_part_dsc_t;
|
||||
|
||||
/**********************
|
||||
@ -66,11 +72,11 @@ typedef struct {
|
||||
|
||||
/**
|
||||
* Initialize a rectangle draw descriptor from an object's styles in its current state
|
||||
* @param obj pointer to an object
|
||||
* @param part part of the object. E.g. `LV_PART_MAIN`, `LV_PART_SCROLLBAR`, `LV_PART_KNOB`, etc
|
||||
* @param draw_dsc the descriptor to initialize.
|
||||
* If an `..._opa` field is set to `LV_OPA_TRANSP` the related properties won't be initialized.
|
||||
* Should be initialized with `lv_draw_rect_dsc_init(draw_dsc)`.
|
||||
* @param obj pointer to an object
|
||||
* @param part part of the object, e.g. `LV_PART_MAIN`, `LV_PART_SCROLLBAR`, `LV_PART_KNOB`, etc
|
||||
* @param draw_dsc the descriptor to initialize.
|
||||
* If an `..._opa` field is set to `LV_OPA_TRANSP` the related properties won't be initialized.
|
||||
* Should be initialized with `lv_draw_rect_dsc_init(draw_dsc)`.
|
||||
* @note Only the relevant fields will be set.
|
||||
* E.g. if `border width == 0` the other border properties won't be evaluated.
|
||||
*/
|
||||
@ -78,20 +84,20 @@ void lv_obj_init_draw_rect_dsc(struct _lv_obj_t * obj, uint32_t part, lv_draw_re
|
||||
|
||||
/**
|
||||
* Initialize a label draw descriptor from an object's styles in its current state
|
||||
* @param obj pointer to an object
|
||||
* @param part part of the object. E.g. `LV_PART_MAIN`, `LV_PART_SCROLLBAR`, `LV_PART_KNOB`, etc
|
||||
* @param draw_dsc the descriptor to initialize.
|
||||
* If the `opa` field is set to or the property is equal to `LV_OPA_TRANSP` the rest won't be initialized.
|
||||
* Should be initialized with `lv_draw_label_dsc_init(draw_dsc)`.
|
||||
* @param obj pointer to an object
|
||||
* @param part part of the object, e.g. `LV_PART_MAIN`, `LV_PART_SCROLLBAR`, `LV_PART_KNOB`, etc
|
||||
* @param draw_dsc the descriptor to initialize.
|
||||
* If the `opa` field is set to or the property is equal to `LV_OPA_TRANSP` the rest won't be initialized.
|
||||
* Should be initialized with `lv_draw_label_dsc_init(draw_dsc)`.
|
||||
*/
|
||||
void lv_obj_init_draw_label_dsc(struct _lv_obj_t * obj, uint32_t part, lv_draw_label_dsc_t * draw_dsc);
|
||||
|
||||
/**
|
||||
* Initialize an image draw descriptor from an object's styles in its current state
|
||||
* @param obj pointer to an object
|
||||
* @param part part of the object. E.g. `LV_PART_MAIN`, `LV_PART_SCROLLBAR`, `LV_PART_KNOB`, etc
|
||||
* @param draw_dsc the descriptor to initialize.
|
||||
* Should be initialized with `lv_draw_image_dsc_init(draw_dsc)`.
|
||||
* @param obj pointer to an object
|
||||
* @param part part of the object, e.g. `LV_PART_MAIN`, `LV_PART_SCROLLBAR`, `LV_PART_KNOB`, etc
|
||||
* @param draw_dsc the descriptor to initialize.
|
||||
* Should be initialized with `lv_draw_image_dsc_init(draw_dsc)`.
|
||||
*/
|
||||
void lv_obj_init_draw_img_dsc(struct _lv_obj_t * obj, uint32_t part, lv_draw_img_dsc_t * draw_dsc);
|
||||
|
||||
@ -99,33 +105,33 @@ void lv_obj_init_draw_img_dsc(struct _lv_obj_t * obj, uint32_t part, lv_draw_img
|
||||
/**
|
||||
* Initialize a line draw descriptor from an object's styles in its current state
|
||||
* @param obj pointer to an object
|
||||
* @param part part of the object. E.g. `LV_PART_MAIN`, `LV_PART_SCROLLBAR`, `LV_PART_KNOB`, etc
|
||||
* @param draw_dsc the descriptor to initialize.
|
||||
* Should be initialized with `lv_draw_line_dsc_init(draw_dsc)`.
|
||||
* @param part part of the object, e.g. `LV_PART_MAIN`, `LV_PART_SCROLLBAR`, `LV_PART_KNOB`, etc
|
||||
* @param draw_dsc the descriptor to initialize.
|
||||
* Should be initialized with `lv_draw_line_dsc_init(draw_dsc)`.
|
||||
*/
|
||||
void lv_obj_init_draw_line_dsc(struct _lv_obj_t * obj, uint32_t part, lv_draw_line_dsc_t * draw_dsc);
|
||||
|
||||
/**
|
||||
* Initialize an arc draw descriptor from an object's styles in its current state
|
||||
* @param obj pointer to an object
|
||||
* @param part part of the object. E.g. `LV_PART_MAIN`, `LV_PART_SCROLLBAR`, `LV_PART_KNOB`, etc
|
||||
* @param draw_dsc the descriptor to initialize.
|
||||
* Should be initialized with `lv_draw_arc_dsc_init(draw_dsc)`.
|
||||
* @param obj pointer to an object
|
||||
* @param part part of the object, e.g. `LV_PART_MAIN`, `LV_PART_SCROLLBAR`, `LV_PART_KNOB`, etc
|
||||
* @param draw_dsc the descriptor to initialize.
|
||||
* Should be initialized with `lv_draw_arc_dsc_init(draw_dsc)`.
|
||||
*/
|
||||
void lv_obj_init_draw_arc_dsc(struct _lv_obj_t * obj, uint32_t part, lv_draw_arc_dsc_t * draw_dsc);
|
||||
|
||||
/**
|
||||
* Get the required extra size (around the object's part) to draw shadow, outline, value etc.
|
||||
* @param obj pointer to an object
|
||||
* @param part part of the object
|
||||
* @return the extra size required around the object
|
||||
* @param obj pointer to an object
|
||||
* @param part part of the object
|
||||
* @return the extra size required around the object
|
||||
*/
|
||||
lv_coord_t lv_obj_calculate_ext_draw_size(struct _lv_obj_t * obj, uint32_t part);
|
||||
|
||||
/**
|
||||
* Initialize a draw descriptor used in events.
|
||||
* @param dsc pointer to a descriptor. Later it should be passed as parameter to an `LV_EEVNT_DRAW_PART_BEGIN/END` event.
|
||||
* @param draw the current draw context. (usually returned by `lv_event_get_draw_ctx(e)`)
|
||||
* @param dsc pointer to a descriptor. Later it should be passed as parameter to an `LV_EVENT_DRAW_PART_BEGIN/END` event.
|
||||
* @param draw the current draw context. (usually returned by `lv_event_get_draw_ctx(e)`)
|
||||
*/
|
||||
void lv_obj_draw_dsc_init(lv_obj_draw_part_dsc_t * dsc, lv_draw_ctx_t * draw_ctx);
|
||||
|
||||
@ -141,17 +147,20 @@ bool lv_obj_draw_part_check_type(lv_obj_draw_part_dsc_t * dsc, const struct _lv_
|
||||
/**
|
||||
* Send a 'LV_EVENT_REFR_EXT_DRAW_SIZE' Call the ancestor's event handler to the object to refresh the value of the extended draw size.
|
||||
* The result will be saved in `obj`.
|
||||
* @param obj pointer to an object
|
||||
* @param obj pointer to an object
|
||||
*/
|
||||
void lv_obj_refresh_ext_draw_size(struct _lv_obj_t * obj);
|
||||
|
||||
/**
|
||||
* Get the extended draw area of an object.
|
||||
* @param obj pointer to an object
|
||||
* @return the size extended draw area around the real coordinates
|
||||
* @param obj pointer to an object
|
||||
* @return the size extended draw area around the real coordinates
|
||||
*/
|
||||
lv_coord_t _lv_obj_get_ext_draw_size(const struct _lv_obj_t * obj);
|
||||
|
||||
|
||||
lv_layer_type_t _lv_obj_get_layer_type(const struct _lv_obj_t * obj);
|
||||
|
||||
/**********************
|
||||
* MACROS
|
||||
**********************/
|
||||
|
@ -26,6 +26,7 @@
|
||||
static lv_coord_t calc_content_width(lv_obj_t * obj);
|
||||
static lv_coord_t calc_content_height(lv_obj_t * obj);
|
||||
static void layout_update_core(lv_obj_t * obj);
|
||||
static void transform_point(const lv_obj_t * obj, lv_point_t * p, bool inv);
|
||||
|
||||
/**********************
|
||||
* STATIC VARIABLES
|
||||
@ -206,6 +207,8 @@ bool lv_obj_refr_size(lv_obj_t * obj)
|
||||
bool on2 = _lv_area_is_in(&obj->coords, &parent_fit_area, 0);
|
||||
if(on1 || (!on1 && on2)) lv_obj_scrollbar_invalidate(parent);
|
||||
|
||||
lv_obj_refresh_ext_draw_size(obj);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -627,6 +630,7 @@ void lv_obj_refr_pos(lv_obj_t * obj)
|
||||
{
|
||||
if(lv_obj_is_layout_positioned(obj)) return;
|
||||
|
||||
|
||||
lv_obj_t * parent = lv_obj_get_parent(obj);
|
||||
lv_coord_t x = lv_obj_get_style_x(obj, LV_PART_MAIN);
|
||||
lv_coord_t y = lv_obj_get_style_y(obj, LV_PART_MAIN);
|
||||
@ -791,28 +795,63 @@ void lv_obj_move_children_by(lv_obj_t * obj, lv_coord_t x_diff, lv_coord_t y_dif
|
||||
}
|
||||
}
|
||||
|
||||
void lv_obj_transform_point(const lv_obj_t * obj, lv_point_t * p, bool recursive, bool inv)
|
||||
{
|
||||
if(obj) {
|
||||
lv_layer_type_t layer_type = _lv_obj_get_layer_type(obj);
|
||||
bool do_tranf = layer_type == LV_LAYER_TYPE_TRANSFORM;
|
||||
if(inv) {
|
||||
if(recursive) lv_obj_transform_point(lv_obj_get_parent(obj), p, recursive, inv);
|
||||
if(do_tranf) transform_point(obj, p, inv);
|
||||
}
|
||||
else {
|
||||
if(do_tranf) transform_point(obj, p, inv);
|
||||
if(recursive) lv_obj_transform_point(lv_obj_get_parent(obj), p, recursive, inv);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void lv_obj_get_transformed_area(const lv_obj_t * obj, lv_area_t * area, bool recursive,
|
||||
bool inv)
|
||||
{
|
||||
lv_point_t p[4] = {
|
||||
{area->x1, area->y1},
|
||||
{area->x1, area->y2},
|
||||
{area->x2, area->y1},
|
||||
{area->x2, area->y2},
|
||||
};
|
||||
|
||||
lv_obj_transform_point(obj, &p[0], recursive, inv);
|
||||
lv_obj_transform_point(obj, &p[1], recursive, inv);
|
||||
lv_obj_transform_point(obj, &p[2], recursive, inv);
|
||||
lv_obj_transform_point(obj, &p[3], recursive, inv);
|
||||
|
||||
area->x1 = LV_MIN4(p[0].x, p[1].x, p[2].x, p[3].x);
|
||||
area->x2 = LV_MAX4(p[0].x, p[1].x, p[2].x, p[3].x);
|
||||
area->y1 = LV_MIN4(p[0].y, p[1].y, p[2].y, p[3].y);
|
||||
area->y2 = LV_MAX4(p[0].y, p[1].y, p[2].y, p[3].y);
|
||||
lv_area_increase(area, 5, 5);
|
||||
}
|
||||
|
||||
|
||||
void lv_obj_invalidate_area(const lv_obj_t * obj, const lv_area_t * area)
|
||||
{
|
||||
LV_ASSERT_OBJ(obj, MY_CLASS);
|
||||
|
||||
lv_disp_t * disp = lv_obj_get_disp(obj);
|
||||
if(!lv_disp_is_invalidation_enabled(disp)) return;
|
||||
|
||||
lv_area_t area_tmp;
|
||||
lv_area_copy(&area_tmp, area);
|
||||
bool visible = lv_obj_area_is_visible(obj, &area_tmp);
|
||||
if(!lv_obj_area_is_visible(obj, &area_tmp)) return;
|
||||
|
||||
if(visible) _lv_inv_area(lv_obj_get_disp(obj), &area_tmp);
|
||||
_lv_inv_area(lv_obj_get_disp(obj), &area_tmp);
|
||||
}
|
||||
|
||||
void lv_obj_invalidate(const lv_obj_t * obj)
|
||||
{
|
||||
LV_ASSERT_OBJ(obj, MY_CLASS);
|
||||
|
||||
/*If the object has overflow visible it can be drawn anywhere on its parent
|
||||
*It needs to be checked recursively*/
|
||||
while(lv_obj_get_parent(obj) && lv_obj_has_flag(obj, LV_OBJ_FLAG_OVERFLOW_VISIBLE)) {
|
||||
obj = lv_obj_get_parent(obj);
|
||||
}
|
||||
|
||||
/*Truncate the area to the object*/
|
||||
lv_area_t obj_coords;
|
||||
lv_coord_t ext_size = _lv_obj_get_ext_draw_size(obj);
|
||||
@ -841,7 +880,7 @@ bool lv_obj_area_is_visible(const lv_obj_t * obj, lv_area_t * area)
|
||||
}
|
||||
|
||||
/*Truncate the area to the object*/
|
||||
if(!lv_obj_has_flag(obj, LV_OBJ_FLAG_OVERFLOW_VISIBLE)) {
|
||||
if(!lv_obj_has_flag_any(obj, LV_OBJ_FLAG_OVERFLOW_VISIBLE)) {
|
||||
lv_area_t obj_coords;
|
||||
lv_coord_t ext_size = _lv_obj_get_ext_draw_size(obj);
|
||||
lv_area_copy(&obj_coords, &obj->coords);
|
||||
@ -854,6 +893,9 @@ bool lv_obj_area_is_visible(const lv_obj_t * obj, lv_area_t * area)
|
||||
if(!_lv_area_intersect(area, area, &obj_coords)) return false;
|
||||
}
|
||||
|
||||
lv_obj_get_transformed_area(obj, area, true, false);
|
||||
|
||||
|
||||
/*Truncate recursively to the parents*/
|
||||
lv_obj_t * par = lv_obj_get_parent(obj);
|
||||
while(par != NULL) {
|
||||
@ -861,8 +903,10 @@ bool lv_obj_area_is_visible(const lv_obj_t * obj, lv_area_t * area)
|
||||
if(lv_obj_has_flag(par, LV_OBJ_FLAG_HIDDEN)) return false;
|
||||
|
||||
/*Truncate to the parent and if no common parts break*/
|
||||
if(!lv_obj_has_flag(par, LV_OBJ_FLAG_OVERFLOW_VISIBLE)) {
|
||||
if(!_lv_area_intersect(area, area, &par->coords)) return false;
|
||||
if(!lv_obj_has_flag_any(par, LV_OBJ_FLAG_OVERFLOW_VISIBLE)) {
|
||||
lv_area_t par_area = par->coords;
|
||||
lv_obj_get_transformed_area(par, &par_area, true, false);
|
||||
if(!_lv_area_intersect(area, area, &par_area)) return false;
|
||||
}
|
||||
|
||||
par = lv_obj_get_parent(par);
|
||||
@ -1108,3 +1152,21 @@ static void layout_update_core(lv_obj_t * obj)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void transform_point(const lv_obj_t * obj, lv_point_t * p, bool inv)
|
||||
{
|
||||
int16_t angle = lv_obj_get_style_transform_angle(obj, 0);
|
||||
int16_t zoom = lv_obj_get_style_transform_zoom(obj, 0);
|
||||
|
||||
if(angle == 0 && zoom == LV_IMG_ZOOM_NONE) return;
|
||||
|
||||
lv_point_t pivot;
|
||||
pivot.x = obj->coords.x1 + lv_obj_get_style_transform_pivot_x(obj, 0);
|
||||
pivot.y = obj->coords.y1 + lv_obj_get_style_transform_pivot_y(obj, 0);
|
||||
if(inv) {
|
||||
angle = -angle;
|
||||
zoom = (256 * 256) / zoom;
|
||||
}
|
||||
|
||||
lv_point_transform(p, angle, zoom, &pivot);
|
||||
}
|
||||
|
@ -348,6 +348,24 @@ void lv_obj_move_to(struct _lv_obj_t * obj, lv_coord_t x, lv_coord_t y);
|
||||
|
||||
void lv_obj_move_children_by(struct _lv_obj_t * obj, lv_coord_t x_diff, lv_coord_t y_diff, bool ignore_floating);
|
||||
|
||||
/**
|
||||
* Transform a point using the angle and zoom style properties of an object
|
||||
* @param obj pointer to an object whose style properties should be used
|
||||
* @param p a point to transform, the result will be written back here too
|
||||
* @param recursive consider the transformation properties of the parents too
|
||||
* @param inv do the inverse of the transformation (-angle and 1/zoom)
|
||||
*/
|
||||
void lv_obj_transform_point(const struct _lv_obj_t * obj, lv_point_t * p, bool recursive, bool inv);
|
||||
|
||||
/**
|
||||
* Transform an area using the angle and zoom style properties of an object
|
||||
* @param obj pointer to an object whose style properties should be used
|
||||
* @param area an area to transform, the result will be written back here too
|
||||
* @param recursive consider the transformation properties of the parents too
|
||||
* @param inv do the inverse of the transformation (-angle and 1/zoom)
|
||||
*/
|
||||
void lv_obj_get_transformed_area(const struct _lv_obj_t * obj, lv_area_t * area, bool recursive, bool inv);
|
||||
|
||||
/**
|
||||
* Mark an area of an object as invalid.
|
||||
* The area will be truncated to the object's area and marked for redraw.
|
||||
|
@ -31,7 +31,6 @@
|
||||
/**********************
|
||||
* STATIC PROTOTYPES
|
||||
**********************/
|
||||
static void scroll_by_raw(lv_obj_t * obj, lv_coord_t x, lv_coord_t y);
|
||||
static void scroll_x_anim(void * obj, int32_t v);
|
||||
static void scroll_y_anim(void * obj, int32_t v);
|
||||
static void scroll_anim_ready_cb(lv_anim_t * a);
|
||||
@ -345,14 +344,18 @@ void lv_obj_scroll_by(lv_obj_t * obj, lv_coord_t dx, lv_coord_t dy, lv_anim_enab
|
||||
}
|
||||
else {
|
||||
/*Remove pending animations*/
|
||||
bool y_del = lv_anim_del(obj, scroll_y_anim);
|
||||
bool x_del = lv_anim_del(obj, scroll_x_anim);
|
||||
scroll_by_raw(obj, dx, dy);
|
||||
if(y_del || x_del) {
|
||||
lv_res_t res;
|
||||
res = lv_event_send(obj, LV_EVENT_SCROLL_END, NULL);
|
||||
if(res != LV_RES_OK) return;
|
||||
}
|
||||
lv_anim_del(obj, scroll_y_anim);
|
||||
lv_anim_del(obj, scroll_x_anim);
|
||||
|
||||
lv_res_t res;
|
||||
res = lv_event_send(obj, LV_EVENT_SCROLL_BEGIN, NULL);
|
||||
if(res != LV_RES_OK) return;
|
||||
|
||||
res = _lv_obj_scroll_by_raw(obj, dx, dy);
|
||||
if(res != LV_RES_OK) return;
|
||||
|
||||
res = lv_event_send(obj, LV_EVENT_SCROLL_END, NULL);
|
||||
if(res != LV_RES_OK) return;
|
||||
}
|
||||
}
|
||||
|
||||
@ -406,6 +409,23 @@ void lv_obj_scroll_to_view_recursive(lv_obj_t * obj, lv_anim_enable_t anim_en)
|
||||
}
|
||||
}
|
||||
|
||||
lv_res_t _lv_obj_scroll_by_raw(lv_obj_t * obj, lv_coord_t x, lv_coord_t y)
|
||||
{
|
||||
if(x == 0 && y == 0) return LV_RES_OK;
|
||||
|
||||
lv_obj_allocate_spec_attr(obj);
|
||||
|
||||
obj->spec_attr->scroll.x += x;
|
||||
obj->spec_attr->scroll.y += y;
|
||||
|
||||
lv_obj_move_children_by(obj, x, y, true);
|
||||
lv_res_t res = lv_event_send(obj, LV_EVENT_SCROLL, NULL);
|
||||
if(res != LV_RES_OK) return res;
|
||||
lv_obj_invalidate(obj);
|
||||
return LV_RES_OK;
|
||||
}
|
||||
|
||||
|
||||
bool lv_obj_is_scrolling(const lv_obj_t * obj)
|
||||
{
|
||||
lv_indev_t * indev = lv_indev_get_next(NULL);
|
||||
@ -648,29 +668,15 @@ void lv_obj_readjust_scroll(lv_obj_t * obj, lv_anim_enable_t anim_en)
|
||||
* STATIC FUNCTIONS
|
||||
**********************/
|
||||
|
||||
static void scroll_by_raw(lv_obj_t * obj, lv_coord_t x, lv_coord_t y)
|
||||
{
|
||||
if(x == 0 && y == 0) return;
|
||||
|
||||
lv_obj_allocate_spec_attr(obj);
|
||||
|
||||
obj->spec_attr->scroll.x += x;
|
||||
obj->spec_attr->scroll.y += y;
|
||||
|
||||
lv_obj_move_children_by(obj, x, y, true);
|
||||
lv_res_t res = lv_event_send(obj, LV_EVENT_SCROLL, NULL);
|
||||
if(res != LV_RES_OK) return;
|
||||
lv_obj_invalidate(obj);
|
||||
}
|
||||
|
||||
static void scroll_x_anim(void * obj, int32_t v)
|
||||
{
|
||||
scroll_by_raw(obj, v + lv_obj_get_scroll_x(obj), 0);
|
||||
_lv_obj_scroll_by_raw(obj, v + lv_obj_get_scroll_x(obj), 0);
|
||||
}
|
||||
|
||||
static void scroll_y_anim(void * obj, int32_t v)
|
||||
{
|
||||
scroll_by_raw(obj, 0, v + lv_obj_get_scroll_y(obj));
|
||||
_lv_obj_scroll_by_raw(obj, 0, v + lv_obj_get_scroll_y(obj));
|
||||
}
|
||||
|
||||
static void scroll_anim_ready_cb(lv_anim_t * a)
|
||||
@ -746,7 +752,7 @@ static void scroll_area_into_view(const lv_area_t * area, lv_obj_t * child, lv_p
|
||||
x_scroll = left_diff;
|
||||
/*Do not let scrolling in*/
|
||||
lv_coord_t sl = lv_obj_get_scroll_left(parent);
|
||||
if(sl + x_scroll > 0) x_scroll = 0;
|
||||
if(sl - x_scroll < 0) x_scroll = 0;
|
||||
}
|
||||
else if(right_diff > 0) {
|
||||
x_scroll = -right_diff;
|
||||
|
@ -15,6 +15,7 @@ extern "C" {
|
||||
*********************/
|
||||
#include "../misc/lv_area.h"
|
||||
#include "../misc/lv_anim.h"
|
||||
#include "../misc/lv_types.h"
|
||||
|
||||
/*********************
|
||||
* DEFINES
|
||||
@ -248,6 +249,18 @@ void lv_obj_scroll_to_view(struct _lv_obj_t * obj, lv_anim_enable_t anim_en);
|
||||
*/
|
||||
void lv_obj_scroll_to_view_recursive(struct _lv_obj_t * obj, lv_anim_enable_t anim_en);
|
||||
|
||||
|
||||
/**
|
||||
* Low level function to scroll by given x and y coordinates.
|
||||
* `LV_EVENT_SCROLL` is sent.
|
||||
* @param obj pointer to an object to scroll
|
||||
* @param x pixels to scroll horizontally
|
||||
* @param y pixels to scroll vertically
|
||||
* @return `LV_RES_INV`: to object was deleted in `LV_EVENT_SCROLL`;
|
||||
* `LV_RES_OK`: if the object is still valid
|
||||
*/
|
||||
lv_res_t _lv_obj_scroll_by_raw(struct _lv_obj_t * obj, lv_coord_t x, lv_coord_t y);
|
||||
|
||||
/**
|
||||
* Tell whether an object is being scrolled or not at this moment
|
||||
* @param obj pointer to an object
|
||||
|
@ -44,14 +44,14 @@ typedef enum {
|
||||
**********************/
|
||||
static lv_style_t * get_local_style(lv_obj_t * obj, lv_style_selector_t selector);
|
||||
static _lv_obj_style_t * get_trans_style(lv_obj_t * obj, uint32_t part);
|
||||
static bool get_prop_core(const lv_obj_t * obj, lv_part_t part, lv_style_prop_t prop, lv_style_value_t * v);
|
||||
static lv_style_value_t apply_color_filter(const lv_obj_t * obj, uint32_t part, lv_style_value_t v);
|
||||
static lv_style_res_t get_prop_core(const lv_obj_t * obj, lv_part_t part, lv_style_prop_t prop, lv_style_value_t * v);
|
||||
static void report_style_change_core(void * style, lv_obj_t * obj);
|
||||
static void refresh_children_style(lv_obj_t * obj);
|
||||
static bool trans_del(lv_obj_t * obj, lv_part_t part, lv_style_prop_t prop, trans_t * tr_limit);
|
||||
static void trans_anim_cb(void * _tr, int32_t v);
|
||||
static void trans_anim_start_cb(lv_anim_t * a);
|
||||
static void trans_anim_ready_cb(lv_anim_t * a);
|
||||
static lv_layer_type_t calculate_layer_type(lv_obj_t * obj);
|
||||
static void fade_anim_cb(void * obj, int32_t v);
|
||||
static void fade_in_anim_ready(lv_anim_t * a);
|
||||
|
||||
@ -174,7 +174,12 @@ void lv_obj_refresh_style(lv_obj_t * obj, lv_style_selector_t selector, lv_style
|
||||
|
||||
lv_part_t part = lv_obj_style_get_selector_part(selector);
|
||||
|
||||
if(prop & LV_STYLE_PROP_LAYOUT_REFR) {
|
||||
bool is_layout_refr = lv_style_prop_has_flag(prop, LV_STYLE_PROP_LAYOUT_REFR);
|
||||
bool is_ext_draw = lv_style_prop_has_flag(prop, LV_STYLE_PROP_EXT_DRAW);
|
||||
bool is_inheritable = lv_style_prop_has_flag(prop, LV_STYLE_PROP_INHERIT);
|
||||
bool is_layer_refr = lv_style_prop_has_flag(prop, LV_STYLE_PROP_LAYER_REFR);
|
||||
|
||||
if(is_layout_refr) {
|
||||
if(part == LV_PART_ANY ||
|
||||
part == LV_PART_MAIN ||
|
||||
lv_obj_get_style_height(obj, 0) == LV_SIZE_CONTENT ||
|
||||
@ -183,19 +188,27 @@ void lv_obj_refresh_style(lv_obj_t * obj, lv_style_selector_t selector, lv_style
|
||||
lv_obj_mark_layout_as_dirty(obj);
|
||||
}
|
||||
}
|
||||
if((part == LV_PART_ANY || part == LV_PART_MAIN) && (prop == LV_STYLE_PROP_ANY ||
|
||||
(prop & LV_STYLE_PROP_PARENT_LAYOUT_REFR))) {
|
||||
if((part == LV_PART_ANY || part == LV_PART_MAIN) && (prop == LV_STYLE_PROP_ANY || is_layout_refr)) {
|
||||
lv_obj_t * parent = lv_obj_get_parent(obj);
|
||||
if(parent) lv_obj_mark_layout_as_dirty(parent);
|
||||
}
|
||||
|
||||
if(prop == LV_STYLE_PROP_ANY || (prop & LV_STYLE_PROP_EXT_DRAW)) {
|
||||
/*Cache the layer type*/
|
||||
if((part == LV_PART_ANY || part == LV_PART_MAIN) && is_layer_refr) {
|
||||
lv_layer_type_t layer_type = calculate_layer_type(obj);
|
||||
if(obj->spec_attr) obj->spec_attr->layer_type = layer_type;
|
||||
else if(layer_type != LV_LAYER_TYPE_NONE) {
|
||||
lv_obj_allocate_spec_attr(obj);
|
||||
obj->spec_attr->layer_type = layer_type;
|
||||
}
|
||||
}
|
||||
|
||||
if(prop == LV_STYLE_PROP_ANY || is_ext_draw) {
|
||||
lv_obj_refresh_ext_draw_size(obj);
|
||||
}
|
||||
lv_obj_invalidate(obj);
|
||||
|
||||
if(prop == LV_STYLE_PROP_ANY ||
|
||||
((prop & LV_STYLE_PROP_INHERIT) && ((prop & LV_STYLE_PROP_EXT_DRAW) || (prop & LV_STYLE_PROP_LAYOUT_REFR)))) {
|
||||
if(prop == LV_STYLE_PROP_ANY || (is_inheritable && (is_ext_draw || is_layout_refr))) {
|
||||
if(part != LV_PART_SCROLLBAR) {
|
||||
refresh_children_style(obj);
|
||||
}
|
||||
@ -210,19 +223,15 @@ 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)
|
||||
{
|
||||
lv_style_value_t value_act;
|
||||
bool inherit = prop & LV_STYLE_PROP_INHERIT ? true : false;
|
||||
bool filter = prop & LV_STYLE_PROP_FILTER ? true : false;
|
||||
if(filter) {
|
||||
prop &= ~LV_STYLE_PROP_FILTER;
|
||||
}
|
||||
bool found = false;
|
||||
bool inheritable = lv_style_prop_has_flag(prop, LV_STYLE_PROP_INHERIT);
|
||||
lv_style_res_t found = LV_STYLE_RES_NOT_FOUND;
|
||||
while(obj) {
|
||||
found = get_prop_core(obj, part, prop, &value_act);
|
||||
if(found) break;
|
||||
if(!inherit) break;
|
||||
if(found == LV_STYLE_RES_FOUND) break;
|
||||
if(!inheritable) break;
|
||||
|
||||
/*If not found, check the `MAIN` style first*/
|
||||
if(part != LV_PART_MAIN) {
|
||||
if(found != LV_STYLE_RES_INHERIT && part != LV_PART_MAIN) {
|
||||
part = LV_PART_MAIN;
|
||||
continue;
|
||||
}
|
||||
@ -231,7 +240,7 @@ lv_style_value_t lv_obj_get_style_prop(const lv_obj_t * obj, lv_part_t part, lv_
|
||||
obj = lv_obj_get_parent(obj);
|
||||
}
|
||||
|
||||
if(!found) {
|
||||
if(found != LV_STYLE_RES_FOUND) {
|
||||
if(part == LV_PART_MAIN && (prop == LV_STYLE_WIDTH || prop == LV_STYLE_HEIGHT)) {
|
||||
const lv_obj_class_t * cls = obj->class_p;
|
||||
while(cls) {
|
||||
@ -244,13 +253,17 @@ lv_style_value_t lv_obj_get_style_prop(const lv_obj_t * obj, lv_part_t part, lv_
|
||||
cls = cls->base_class;
|
||||
}
|
||||
|
||||
value_act.num = prop == LV_STYLE_WIDTH ? cls->width_def : cls->height_def;
|
||||
if(cls) {
|
||||
value_act.num = prop == LV_STYLE_WIDTH ? cls->width_def : cls->height_def;
|
||||
}
|
||||
else {
|
||||
value_act.num = 0;
|
||||
}
|
||||
}
|
||||
else {
|
||||
value_act = lv_style_prop_get_default(prop);
|
||||
}
|
||||
}
|
||||
if(filter) value_act = apply_color_filter(obj, part, value_act);
|
||||
return value_act;
|
||||
}
|
||||
|
||||
@ -262,9 +275,17 @@ void lv_obj_set_local_style_prop(lv_obj_t * obj, lv_style_prop_t prop, lv_style_
|
||||
lv_obj_refresh_style(obj, selector, prop);
|
||||
}
|
||||
|
||||
void lv_obj_set_local_style_prop_meta(lv_obj_t * obj, lv_style_prop_t prop, uint16_t meta,
|
||||
lv_style_selector_t selector)
|
||||
{
|
||||
lv_style_t * style = get_local_style(obj, selector);
|
||||
lv_style_set_prop_meta(style, prop, meta);
|
||||
lv_obj_refresh_style(obj, selector, prop);
|
||||
}
|
||||
|
||||
lv_res_t lv_obj_get_local_style_prop(lv_obj_t * obj, lv_style_prop_t prop, lv_style_value_t * value,
|
||||
lv_style_selector_t selector)
|
||||
|
||||
lv_style_res_t lv_obj_get_local_style_prop(lv_obj_t * obj, lv_style_prop_t prop, lv_style_value_t * value,
|
||||
lv_style_selector_t selector)
|
||||
{
|
||||
uint32_t i;
|
||||
for(i = 0; i < obj->style_cnt; i++) {
|
||||
@ -274,7 +295,7 @@ lv_res_t lv_obj_get_local_style_prop(lv_obj_t * obj, lv_style_prop_t prop, lv_st
|
||||
}
|
||||
}
|
||||
|
||||
return LV_RES_INV;
|
||||
return LV_STYLE_RES_NOT_FOUND;
|
||||
}
|
||||
|
||||
bool lv_obj_remove_local_style_prop(lv_obj_t * obj, lv_style_prop_t prop, lv_style_selector_t selector)
|
||||
@ -320,7 +341,7 @@ void _lv_obj_style_create_transition(lv_obj_t * obj, lv_part_t part, lv_state_t
|
||||
if(tr_dsc->prop == LV_STYLE_RADIUS) {
|
||||
if(v1.num == LV_RADIUS_CIRCLE || v2.num == LV_RADIUS_CIRCLE) {
|
||||
lv_coord_t whalf = lv_obj_get_width(obj) / 2;
|
||||
lv_coord_t hhalf = lv_obj_get_width(obj) / 2;
|
||||
lv_coord_t hhalf = lv_obj_get_height(obj) / 2;
|
||||
if(v1.num == LV_RADIUS_CIRCLE) v1.num = LV_MIN(whalf + 1, hhalf + 1);
|
||||
if(v2.num == LV_RADIUS_CIRCLE) v2.num = LV_MIN(whalf + 1, hhalf + 1);
|
||||
}
|
||||
@ -331,28 +352,37 @@ void _lv_obj_style_create_transition(lv_obj_t * obj, lv_part_t part, lv_state_t
|
||||
if(tr == NULL) return;
|
||||
tr->start_value = v1;
|
||||
tr->end_value = v2;
|
||||
tr->obj = obj;
|
||||
tr->prop = tr_dsc->prop;
|
||||
tr->selector = part;
|
||||
|
||||
if(tr) {
|
||||
tr->obj = obj;
|
||||
tr->prop = tr_dsc->prop;
|
||||
tr->selector = part;
|
||||
|
||||
lv_anim_t a;
|
||||
lv_anim_init(&a);
|
||||
lv_anim_set_var(&a, tr);
|
||||
lv_anim_set_exec_cb(&a, trans_anim_cb);
|
||||
lv_anim_set_start_cb(&a, trans_anim_start_cb);
|
||||
lv_anim_set_ready_cb(&a, trans_anim_ready_cb);
|
||||
lv_anim_set_values(&a, 0x00, 0xFF);
|
||||
lv_anim_set_time(&a, tr_dsc->time);
|
||||
lv_anim_set_delay(&a, tr_dsc->delay);
|
||||
lv_anim_set_path_cb(&a, tr_dsc->path_cb);
|
||||
lv_anim_set_early_apply(&a, false);
|
||||
lv_anim_t a;
|
||||
lv_anim_init(&a);
|
||||
lv_anim_set_var(&a, tr);
|
||||
lv_anim_set_exec_cb(&a, trans_anim_cb);
|
||||
lv_anim_set_start_cb(&a, trans_anim_start_cb);
|
||||
lv_anim_set_ready_cb(&a, trans_anim_ready_cb);
|
||||
lv_anim_set_values(&a, 0x00, 0xFF);
|
||||
lv_anim_set_time(&a, tr_dsc->time);
|
||||
lv_anim_set_delay(&a, tr_dsc->delay);
|
||||
lv_anim_set_path_cb(&a, tr_dsc->path_cb);
|
||||
lv_anim_set_early_apply(&a, false);
|
||||
#if LV_USE_USER_DATA
|
||||
a.user_data = tr_dsc->user_data;
|
||||
a.user_data = tr_dsc->user_data;
|
||||
#endif
|
||||
lv_anim_start(&a);
|
||||
lv_anim_start(&a);
|
||||
}
|
||||
|
||||
|
||||
lv_style_value_t _lv_obj_style_apply_color_filter(const lv_obj_t * obj, uint32_t part, lv_style_value_t v)
|
||||
{
|
||||
if(obj == NULL) return v;
|
||||
const lv_color_filter_dsc_t * f = lv_obj_get_style_color_filter_dsc(obj, part);
|
||||
if(f && f->filter_cb) {
|
||||
lv_opa_t f_opa = lv_obj_get_style_color_filter_opa(obj, part);
|
||||
if(f_opa != 0) v.color = f->filter_cb(f, v.color, f_opa);
|
||||
}
|
||||
return v;
|
||||
}
|
||||
|
||||
_lv_style_state_cmp_t _lv_obj_style_state_compare(lv_obj_t * obj, lv_state_t state1, lv_state_t state2)
|
||||
@ -534,7 +564,7 @@ static _lv_obj_style_t * get_trans_style(lv_obj_t * obj, lv_style_selector_t se
|
||||
}
|
||||
|
||||
|
||||
static bool get_prop_core(const lv_obj_t * obj, lv_part_t part, lv_style_prop_t prop, lv_style_value_t * v)
|
||||
static lv_style_res_t get_prop_core(const lv_obj_t * obj, lv_part_t part, lv_style_prop_t prop, lv_style_value_t * v)
|
||||
{
|
||||
uint8_t group = 1 << _lv_style_get_prop_group(prop);
|
||||
int32_t weight = -1;
|
||||
@ -543,7 +573,7 @@ static bool get_prop_core(const lv_obj_t * obj, lv_part_t part, lv_style_prop_t
|
||||
lv_style_value_t value_tmp;
|
||||
bool skip_trans = obj->skip_trans;
|
||||
uint32_t i;
|
||||
bool found;
|
||||
lv_style_res_t found;
|
||||
for(i = 0; i < obj->style_cnt; i++) {
|
||||
_lv_obj_style_t * obj_style = &obj->styles[i];
|
||||
if(obj_style->is_trans == false) break;
|
||||
@ -554,20 +584,22 @@ static bool get_prop_core(const lv_obj_t * obj, lv_part_t part, lv_style_prop_t
|
||||
if(part_act != part) continue;
|
||||
if((obj_style->style->has_group & group) == 0) continue;
|
||||
found = lv_style_get_prop(obj_style->style, prop, &value_tmp);
|
||||
if(found) {
|
||||
if(found == LV_STYLE_RES_FOUND) {
|
||||
*v = value_tmp;
|
||||
return true;
|
||||
return LV_STYLE_RES_FOUND;
|
||||
}
|
||||
else if(found == LV_STYLE_RES_INHERIT) {
|
||||
return LV_STYLE_RES_INHERIT;
|
||||
}
|
||||
}
|
||||
|
||||
for(; i < obj->style_cnt; i++) {
|
||||
if((obj->styles[i].style->has_group & group) == 0) continue;
|
||||
_lv_obj_style_t * obj_style = &obj->styles[i];
|
||||
lv_part_t part_act = lv_obj_style_get_selector_part(obj->styles[i].selector);
|
||||
lv_state_t state_act = lv_obj_style_get_selector_state(obj->styles[i].selector);
|
||||
if(part_act != part) continue;
|
||||
|
||||
if((obj_style->style->has_group & group) == 0) continue;
|
||||
|
||||
/*Be sure the style not specifies other state than the requested.
|
||||
*E.g. For HOVER+PRESS object state, HOVER style only is OK, but HOVER+FOCUS style is not*/
|
||||
if((state_act & state_inv)) continue;
|
||||
@ -577,34 +609,26 @@ static bool get_prop_core(const lv_obj_t * obj, lv_part_t part, lv_style_prop_t
|
||||
|
||||
found = lv_style_get_prop(obj_style->style, prop, &value_tmp);
|
||||
|
||||
if(found) {
|
||||
if(found == LV_STYLE_RES_FOUND) {
|
||||
if(state_act == state) {
|
||||
*v = value_tmp;
|
||||
return true;
|
||||
return LV_STYLE_RES_FOUND;
|
||||
}
|
||||
if(weight < state_act) {
|
||||
weight = state_act;
|
||||
*v = value_tmp;
|
||||
}
|
||||
}
|
||||
else if(found == LV_STYLE_RES_INHERIT) {
|
||||
return LV_STYLE_RES_INHERIT;
|
||||
}
|
||||
}
|
||||
|
||||
if(weight >= 0) {
|
||||
*v = value_tmp;
|
||||
return true;
|
||||
return LV_STYLE_RES_FOUND;
|
||||
}
|
||||
else return false;
|
||||
}
|
||||
|
||||
static lv_style_value_t apply_color_filter(const lv_obj_t * obj, uint32_t part, lv_style_value_t v)
|
||||
{
|
||||
if(obj == NULL) return v;
|
||||
const lv_color_filter_dsc_t * f = lv_obj_get_style_color_filter_dsc(obj, part);
|
||||
if(f && f->filter_cb) {
|
||||
lv_opa_t f_opa = lv_obj_get_style_color_filter_opa(obj, part);
|
||||
if(f_opa != 0) v.color = f->filter_cb(f, v.color, f_opa);
|
||||
}
|
||||
return v;
|
||||
else return LV_STYLE_RES_NOT_FOUND;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -669,19 +693,21 @@ static bool trans_del(lv_obj_t * obj, lv_part_t part, lv_style_prop_t prop, tran
|
||||
tr_prev = _lv_ll_get_prev(&LV_GC_ROOT(_lv_obj_style_trans_ll), tr);
|
||||
|
||||
if(tr->obj == obj && (part == tr->selector || part == LV_PART_ANY) && (prop == tr->prop || prop == LV_STYLE_PROP_ANY)) {
|
||||
/*Remove the transitioned property from trans. style
|
||||
/*Remove any transitioned properties from the trans. style
|
||||
*to allow changing it by normal styles*/
|
||||
uint32_t i;
|
||||
for(i = 0; i < obj->style_cnt; i++) {
|
||||
if(obj->styles[i].is_trans && (part == LV_PART_ANY || obj->styles[i].selector == part)) {
|
||||
lv_style_remove_prop(obj->styles[i].style, tr->prop);
|
||||
lv_anim_del(tr, NULL);
|
||||
_lv_ll_remove(&LV_GC_ROOT(_lv_obj_style_trans_ll), tr);
|
||||
lv_mem_free(tr);
|
||||
removed = true;
|
||||
}
|
||||
}
|
||||
|
||||
/*Free the transition descriptor too*/
|
||||
lv_anim_del(tr, NULL);
|
||||
_lv_ll_remove(&LV_GC_ROOT(_lv_obj_style_trans_ll), tr);
|
||||
lv_mem_free(tr);
|
||||
removed = true;
|
||||
|
||||
}
|
||||
tr = tr_prev;
|
||||
}
|
||||
@ -810,6 +836,18 @@ static void trans_anim_ready_cb(lv_anim_t * a)
|
||||
}
|
||||
}
|
||||
|
||||
static lv_layer_type_t calculate_layer_type(lv_obj_t * obj)
|
||||
{
|
||||
if(lv_obj_get_style_transform_angle(obj, 0) != 0) return LV_LAYER_TYPE_TRANSFORM;
|
||||
if(lv_obj_get_style_transform_zoom(obj, 0) != 256) return LV_LAYER_TYPE_TRANSFORM;
|
||||
if(lv_obj_get_style_opa(obj, 0) != LV_OPA_COVER) return LV_LAYER_TYPE_SIMPLE;
|
||||
|
||||
#if LV_DRAW_COMPLEX
|
||||
if(lv_obj_get_style_blend_mode(obj, 0) != LV_BLEND_MODE_NORMAL) return LV_LAYER_TYPE_SIMPLE;
|
||||
#endif
|
||||
return LV_LAYER_TYPE_NONE;
|
||||
}
|
||||
|
||||
static void fade_anim_cb(void * obj, int32_t v)
|
||||
{
|
||||
lv_obj_set_style_opa(obj, v, 0);
|
||||
|
@ -140,8 +140,11 @@ lv_style_value_t lv_obj_get_style_prop(const struct _lv_obj_t * obj, lv_part_t p
|
||||
void lv_obj_set_local_style_prop(struct _lv_obj_t * obj, lv_style_prop_t prop, lv_style_value_t value,
|
||||
lv_style_selector_t selector);
|
||||
|
||||
lv_res_t lv_obj_get_local_style_prop(struct _lv_obj_t * obj, lv_style_prop_t prop, lv_style_value_t * value,
|
||||
lv_style_selector_t selector);
|
||||
void lv_obj_set_local_style_prop_meta(struct _lv_obj_t * obj, lv_style_prop_t prop, uint16_t meta,
|
||||
lv_style_selector_t selector);
|
||||
|
||||
lv_style_res_t lv_obj_get_local_style_prop(struct _lv_obj_t * obj, lv_style_prop_t prop, lv_style_value_t * value,
|
||||
lv_style_selector_t selector);
|
||||
|
||||
/**
|
||||
* Remove a local style property from a part of an object with a given state.
|
||||
@ -152,6 +155,11 @@ lv_res_t lv_obj_get_local_style_prop(struct _lv_obj_t * obj, lv_style_prop_t pro
|
||||
*/
|
||||
bool lv_obj_remove_local_style_prop(struct _lv_obj_t * obj, lv_style_prop_t prop, lv_style_selector_t selector);
|
||||
|
||||
/**
|
||||
* Used internally for color filtering
|
||||
*/
|
||||
lv_style_value_t _lv_obj_style_apply_color_filter(const struct _lv_obj_t * obj, uint32_t part, lv_style_value_t v);
|
||||
|
||||
/**
|
||||
* Used internally to create a style transition
|
||||
* @param obj
|
||||
|
@ -120,6 +120,22 @@ void lv_obj_set_style_transform_angle(struct _lv_obj_t * obj, lv_coord_t value,
|
||||
lv_obj_set_local_style_prop(obj, LV_STYLE_TRANSFORM_ANGLE, v, selector);
|
||||
}
|
||||
|
||||
void lv_obj_set_style_transform_pivot_x(struct _lv_obj_t * obj, lv_coord_t value, lv_style_selector_t selector)
|
||||
{
|
||||
lv_style_value_t v = {
|
||||
.num = (int32_t)value
|
||||
};
|
||||
lv_obj_set_local_style_prop(obj, LV_STYLE_TRANSFORM_PIVOT_X, v, selector);
|
||||
}
|
||||
|
||||
void lv_obj_set_style_transform_pivot_y(struct _lv_obj_t * obj, lv_coord_t value, lv_style_selector_t selector)
|
||||
{
|
||||
lv_style_value_t v = {
|
||||
.num = (int32_t)value
|
||||
};
|
||||
lv_obj_set_local_style_prop(obj, LV_STYLE_TRANSFORM_PIVOT_Y, v, selector);
|
||||
}
|
||||
|
||||
void lv_obj_set_style_pad_top(struct _lv_obj_t * obj, lv_coord_t value, lv_style_selector_t selector)
|
||||
{
|
||||
lv_style_value_t v = {
|
||||
@ -176,14 +192,6 @@ void lv_obj_set_style_bg_color(struct _lv_obj_t * obj, lv_color_t value, lv_styl
|
||||
lv_obj_set_local_style_prop(obj, LV_STYLE_BG_COLOR, v, selector);
|
||||
}
|
||||
|
||||
void lv_obj_set_style_bg_color_filtered(struct _lv_obj_t * obj, lv_color_t value, lv_style_selector_t selector)
|
||||
{
|
||||
lv_style_value_t v = {
|
||||
.color = value
|
||||
};
|
||||
lv_obj_set_local_style_prop(obj, LV_STYLE_BG_COLOR_FILTERED, v, selector);
|
||||
}
|
||||
|
||||
void lv_obj_set_style_bg_opa(struct _lv_obj_t * obj, lv_opa_t value, lv_style_selector_t selector)
|
||||
{
|
||||
lv_style_value_t v = {
|
||||
@ -200,14 +208,6 @@ void lv_obj_set_style_bg_grad_color(struct _lv_obj_t * obj, lv_color_t value, lv
|
||||
lv_obj_set_local_style_prop(obj, LV_STYLE_BG_GRAD_COLOR, v, selector);
|
||||
}
|
||||
|
||||
void lv_obj_set_style_bg_grad_color_filtered(struct _lv_obj_t * obj, lv_color_t value, lv_style_selector_t selector)
|
||||
{
|
||||
lv_style_value_t v = {
|
||||
.color = value
|
||||
};
|
||||
lv_obj_set_local_style_prop(obj, LV_STYLE_BG_GRAD_COLOR_FILTERED, v, selector);
|
||||
}
|
||||
|
||||
void lv_obj_set_style_bg_grad_dir(struct _lv_obj_t * obj, lv_grad_dir_t value, lv_style_selector_t selector)
|
||||
{
|
||||
lv_style_value_t v = {
|
||||
@ -272,14 +272,6 @@ void lv_obj_set_style_bg_img_recolor(struct _lv_obj_t * obj, lv_color_t value, l
|
||||
lv_obj_set_local_style_prop(obj, LV_STYLE_BG_IMG_RECOLOR, v, selector);
|
||||
}
|
||||
|
||||
void lv_obj_set_style_bg_img_recolor_filtered(struct _lv_obj_t * obj, lv_color_t value, lv_style_selector_t selector)
|
||||
{
|
||||
lv_style_value_t v = {
|
||||
.color = value
|
||||
};
|
||||
lv_obj_set_local_style_prop(obj, LV_STYLE_BG_IMG_RECOLOR_FILTERED, v, selector);
|
||||
}
|
||||
|
||||
void lv_obj_set_style_bg_img_recolor_opa(struct _lv_obj_t * obj, lv_opa_t value, lv_style_selector_t selector)
|
||||
{
|
||||
lv_style_value_t v = {
|
||||
@ -304,14 +296,6 @@ void lv_obj_set_style_border_color(struct _lv_obj_t * obj, lv_color_t value, lv_
|
||||
lv_obj_set_local_style_prop(obj, LV_STYLE_BORDER_COLOR, v, selector);
|
||||
}
|
||||
|
||||
void lv_obj_set_style_border_color_filtered(struct _lv_obj_t * obj, lv_color_t value, lv_style_selector_t selector)
|
||||
{
|
||||
lv_style_value_t v = {
|
||||
.color = value
|
||||
};
|
||||
lv_obj_set_local_style_prop(obj, LV_STYLE_BORDER_COLOR_FILTERED, v, selector);
|
||||
}
|
||||
|
||||
void lv_obj_set_style_border_opa(struct _lv_obj_t * obj, lv_opa_t value, lv_style_selector_t selector)
|
||||
{
|
||||
lv_style_value_t v = {
|
||||
@ -360,14 +344,6 @@ void lv_obj_set_style_outline_color(struct _lv_obj_t * obj, lv_color_t value, lv
|
||||
lv_obj_set_local_style_prop(obj, LV_STYLE_OUTLINE_COLOR, v, selector);
|
||||
}
|
||||
|
||||
void lv_obj_set_style_outline_color_filtered(struct _lv_obj_t * obj, lv_color_t value, lv_style_selector_t selector)
|
||||
{
|
||||
lv_style_value_t v = {
|
||||
.color = value
|
||||
};
|
||||
lv_obj_set_local_style_prop(obj, LV_STYLE_OUTLINE_COLOR_FILTERED, v, selector);
|
||||
}
|
||||
|
||||
void lv_obj_set_style_outline_opa(struct _lv_obj_t * obj, lv_opa_t value, lv_style_selector_t selector)
|
||||
{
|
||||
lv_style_value_t v = {
|
||||
@ -424,14 +400,6 @@ void lv_obj_set_style_shadow_color(struct _lv_obj_t * obj, lv_color_t value, lv_
|
||||
lv_obj_set_local_style_prop(obj, LV_STYLE_SHADOW_COLOR, v, selector);
|
||||
}
|
||||
|
||||
void lv_obj_set_style_shadow_color_filtered(struct _lv_obj_t * obj, lv_color_t value, lv_style_selector_t selector)
|
||||
{
|
||||
lv_style_value_t v = {
|
||||
.color = value
|
||||
};
|
||||
lv_obj_set_local_style_prop(obj, LV_STYLE_SHADOW_COLOR_FILTERED, v, selector);
|
||||
}
|
||||
|
||||
void lv_obj_set_style_shadow_opa(struct _lv_obj_t * obj, lv_opa_t value, lv_style_selector_t selector)
|
||||
{
|
||||
lv_style_value_t v = {
|
||||
@ -456,14 +424,6 @@ void lv_obj_set_style_img_recolor(struct _lv_obj_t * obj, lv_color_t value, lv_s
|
||||
lv_obj_set_local_style_prop(obj, LV_STYLE_IMG_RECOLOR, v, selector);
|
||||
}
|
||||
|
||||
void lv_obj_set_style_img_recolor_filtered(struct _lv_obj_t * obj, lv_color_t value, lv_style_selector_t selector)
|
||||
{
|
||||
lv_style_value_t v = {
|
||||
.color = value
|
||||
};
|
||||
lv_obj_set_local_style_prop(obj, LV_STYLE_IMG_RECOLOR_FILTERED, v, selector);
|
||||
}
|
||||
|
||||
void lv_obj_set_style_img_recolor_opa(struct _lv_obj_t * obj, lv_opa_t value, lv_style_selector_t selector)
|
||||
{
|
||||
lv_style_value_t v = {
|
||||
@ -512,14 +472,6 @@ void lv_obj_set_style_line_color(struct _lv_obj_t * obj, lv_color_t value, lv_st
|
||||
lv_obj_set_local_style_prop(obj, LV_STYLE_LINE_COLOR, v, selector);
|
||||
}
|
||||
|
||||
void lv_obj_set_style_line_color_filtered(struct _lv_obj_t * obj, lv_color_t value, lv_style_selector_t selector)
|
||||
{
|
||||
lv_style_value_t v = {
|
||||
.color = value
|
||||
};
|
||||
lv_obj_set_local_style_prop(obj, LV_STYLE_LINE_COLOR_FILTERED, v, selector);
|
||||
}
|
||||
|
||||
void lv_obj_set_style_line_opa(struct _lv_obj_t * obj, lv_opa_t value, lv_style_selector_t selector)
|
||||
{
|
||||
lv_style_value_t v = {
|
||||
@ -552,14 +504,6 @@ void lv_obj_set_style_arc_color(struct _lv_obj_t * obj, lv_color_t value, lv_sty
|
||||
lv_obj_set_local_style_prop(obj, LV_STYLE_ARC_COLOR, v, selector);
|
||||
}
|
||||
|
||||
void lv_obj_set_style_arc_color_filtered(struct _lv_obj_t * obj, lv_color_t value, lv_style_selector_t selector)
|
||||
{
|
||||
lv_style_value_t v = {
|
||||
.color = value
|
||||
};
|
||||
lv_obj_set_local_style_prop(obj, LV_STYLE_ARC_COLOR_FILTERED, v, selector);
|
||||
}
|
||||
|
||||
void lv_obj_set_style_arc_opa(struct _lv_obj_t * obj, lv_opa_t value, lv_style_selector_t selector)
|
||||
{
|
||||
lv_style_value_t v = {
|
||||
@ -584,14 +528,6 @@ void lv_obj_set_style_text_color(struct _lv_obj_t * obj, lv_color_t value, lv_st
|
||||
lv_obj_set_local_style_prop(obj, LV_STYLE_TEXT_COLOR, v, selector);
|
||||
}
|
||||
|
||||
void lv_obj_set_style_text_color_filtered(struct _lv_obj_t * obj, lv_color_t value, lv_style_selector_t selector)
|
||||
{
|
||||
lv_style_value_t v = {
|
||||
.color = value
|
||||
};
|
||||
lv_obj_set_local_style_prop(obj, LV_STYLE_TEXT_COLOR_FILTERED, v, selector);
|
||||
}
|
||||
|
||||
void lv_obj_set_style_text_opa(struct _lv_obj_t * obj, lv_opa_t value, lv_style_selector_t selector)
|
||||
{
|
||||
lv_style_value_t v = {
|
||||
@ -664,8 +600,7 @@ void lv_obj_set_style_opa(struct _lv_obj_t * obj, lv_opa_t value, lv_style_selec
|
||||
lv_obj_set_local_style_prop(obj, LV_STYLE_OPA, v, selector);
|
||||
}
|
||||
|
||||
void lv_obj_set_style_color_filter_dsc(struct _lv_obj_t * obj, const lv_color_filter_dsc_t * value,
|
||||
lv_style_selector_t selector)
|
||||
void lv_obj_set_style_color_filter_dsc(struct _lv_obj_t * obj, const lv_color_filter_dsc_t * value, lv_style_selector_t selector)
|
||||
{
|
||||
lv_style_value_t v = {
|
||||
.ptr = value
|
||||
@ -681,6 +616,14 @@ void lv_obj_set_style_color_filter_opa(struct _lv_obj_t * obj, lv_opa_t value, l
|
||||
lv_obj_set_local_style_prop(obj, LV_STYLE_COLOR_FILTER_OPA, v, selector);
|
||||
}
|
||||
|
||||
void lv_obj_set_style_anim(struct _lv_obj_t * obj, const lv_anim_t * value, lv_style_selector_t selector)
|
||||
{
|
||||
lv_style_value_t v = {
|
||||
.ptr = value
|
||||
};
|
||||
lv_obj_set_local_style_prop(obj, LV_STYLE_ANIM, v, selector);
|
||||
}
|
||||
|
||||
void lv_obj_set_style_anim_time(struct _lv_obj_t * obj, uint32_t value, lv_style_selector_t selector)
|
||||
{
|
||||
lv_style_value_t v = {
|
||||
@ -697,8 +640,7 @@ void lv_obj_set_style_anim_speed(struct _lv_obj_t * obj, uint32_t value, lv_styl
|
||||
lv_obj_set_local_style_prop(obj, LV_STYLE_ANIM_SPEED, v, selector);
|
||||
}
|
||||
|
||||
void lv_obj_set_style_transition(struct _lv_obj_t * obj, const lv_style_transition_dsc_t * value,
|
||||
lv_style_selector_t selector)
|
||||
void lv_obj_set_style_transition(struct _lv_obj_t * obj, const lv_style_transition_dsc_t * value, lv_style_selector_t selector)
|
||||
{
|
||||
lv_style_value_t v = {
|
||||
.ptr = value
|
||||
|
@ -88,6 +88,18 @@ static inline lv_coord_t lv_obj_get_style_transform_angle(const struct _lv_obj_t
|
||||
return (lv_coord_t)v.num;
|
||||
}
|
||||
|
||||
static inline lv_coord_t lv_obj_get_style_transform_pivot_x(const struct _lv_obj_t * obj, uint32_t part)
|
||||
{
|
||||
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_TRANSFORM_PIVOT_X);
|
||||
return (lv_coord_t)v.num;
|
||||
}
|
||||
|
||||
static inline lv_coord_t lv_obj_get_style_transform_pivot_y(const struct _lv_obj_t * obj, uint32_t part)
|
||||
{
|
||||
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_TRANSFORM_PIVOT_Y);
|
||||
return (lv_coord_t)v.num;
|
||||
}
|
||||
|
||||
static inline lv_coord_t lv_obj_get_style_pad_top(const struct _lv_obj_t * obj, uint32_t part)
|
||||
{
|
||||
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_PAD_TOP);
|
||||
@ -132,7 +144,7 @@ static inline lv_color_t lv_obj_get_style_bg_color(const struct _lv_obj_t * obj,
|
||||
|
||||
static inline lv_color_t lv_obj_get_style_bg_color_filtered(const struct _lv_obj_t * obj, uint32_t part)
|
||||
{
|
||||
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_BG_COLOR_FILTERED);
|
||||
lv_style_value_t v = _lv_obj_style_apply_color_filter(obj, part, lv_obj_get_style_prop(obj, part, LV_STYLE_BG_COLOR));
|
||||
return v.color;
|
||||
}
|
||||
|
||||
@ -150,7 +162,7 @@ static inline lv_color_t lv_obj_get_style_bg_grad_color(const struct _lv_obj_t *
|
||||
|
||||
static inline lv_color_t lv_obj_get_style_bg_grad_color_filtered(const struct _lv_obj_t * obj, uint32_t part)
|
||||
{
|
||||
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_BG_GRAD_COLOR_FILTERED);
|
||||
lv_style_value_t v = _lv_obj_style_apply_color_filter(obj, part, lv_obj_get_style_prop(obj, part, LV_STYLE_BG_GRAD_COLOR));
|
||||
return v.color;
|
||||
}
|
||||
|
||||
@ -204,7 +216,7 @@ static inline lv_color_t lv_obj_get_style_bg_img_recolor(const struct _lv_obj_t
|
||||
|
||||
static inline lv_color_t lv_obj_get_style_bg_img_recolor_filtered(const struct _lv_obj_t * obj, uint32_t part)
|
||||
{
|
||||
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_BG_IMG_RECOLOR_FILTERED);
|
||||
lv_style_value_t v = _lv_obj_style_apply_color_filter(obj, part, lv_obj_get_style_prop(obj, part, LV_STYLE_BG_IMG_RECOLOR));
|
||||
return v.color;
|
||||
}
|
||||
|
||||
@ -228,7 +240,7 @@ static inline lv_color_t lv_obj_get_style_border_color(const struct _lv_obj_t *
|
||||
|
||||
static inline lv_color_t lv_obj_get_style_border_color_filtered(const struct _lv_obj_t * obj, uint32_t part)
|
||||
{
|
||||
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_BORDER_COLOR_FILTERED);
|
||||
lv_style_value_t v = _lv_obj_style_apply_color_filter(obj, part, lv_obj_get_style_prop(obj, part, LV_STYLE_BORDER_COLOR));
|
||||
return v.color;
|
||||
}
|
||||
|
||||
@ -270,7 +282,7 @@ static inline lv_color_t lv_obj_get_style_outline_color(const struct _lv_obj_t *
|
||||
|
||||
static inline lv_color_t lv_obj_get_style_outline_color_filtered(const struct _lv_obj_t * obj, uint32_t part)
|
||||
{
|
||||
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_OUTLINE_COLOR_FILTERED);
|
||||
lv_style_value_t v = _lv_obj_style_apply_color_filter(obj, part, lv_obj_get_style_prop(obj, part, LV_STYLE_OUTLINE_COLOR));
|
||||
return v.color;
|
||||
}
|
||||
|
||||
@ -318,7 +330,7 @@ static inline lv_color_t lv_obj_get_style_shadow_color(const struct _lv_obj_t *
|
||||
|
||||
static inline lv_color_t lv_obj_get_style_shadow_color_filtered(const struct _lv_obj_t * obj, uint32_t part)
|
||||
{
|
||||
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_SHADOW_COLOR_FILTERED);
|
||||
lv_style_value_t v = _lv_obj_style_apply_color_filter(obj, part, lv_obj_get_style_prop(obj, part, LV_STYLE_SHADOW_COLOR));
|
||||
return v.color;
|
||||
}
|
||||
|
||||
@ -342,7 +354,7 @@ static inline lv_color_t lv_obj_get_style_img_recolor(const struct _lv_obj_t * o
|
||||
|
||||
static inline lv_color_t lv_obj_get_style_img_recolor_filtered(const struct _lv_obj_t * obj, uint32_t part)
|
||||
{
|
||||
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_IMG_RECOLOR_FILTERED);
|
||||
lv_style_value_t v = _lv_obj_style_apply_color_filter(obj, part, lv_obj_get_style_prop(obj, part, LV_STYLE_IMG_RECOLOR));
|
||||
return v.color;
|
||||
}
|
||||
|
||||
@ -384,7 +396,7 @@ static inline lv_color_t lv_obj_get_style_line_color(const struct _lv_obj_t * ob
|
||||
|
||||
static inline lv_color_t lv_obj_get_style_line_color_filtered(const struct _lv_obj_t * obj, uint32_t part)
|
||||
{
|
||||
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_LINE_COLOR_FILTERED);
|
||||
lv_style_value_t v = _lv_obj_style_apply_color_filter(obj, part, lv_obj_get_style_prop(obj, part, LV_STYLE_LINE_COLOR));
|
||||
return v.color;
|
||||
}
|
||||
|
||||
@ -414,7 +426,7 @@ static inline lv_color_t lv_obj_get_style_arc_color(const struct _lv_obj_t * obj
|
||||
|
||||
static inline lv_color_t lv_obj_get_style_arc_color_filtered(const struct _lv_obj_t * obj, uint32_t part)
|
||||
{
|
||||
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_ARC_COLOR_FILTERED);
|
||||
lv_style_value_t v = _lv_obj_style_apply_color_filter(obj, part, lv_obj_get_style_prop(obj, part, LV_STYLE_ARC_COLOR));
|
||||
return v.color;
|
||||
}
|
||||
|
||||
@ -438,7 +450,7 @@ static inline lv_color_t lv_obj_get_style_text_color(const struct _lv_obj_t * ob
|
||||
|
||||
static inline lv_color_t lv_obj_get_style_text_color_filtered(const struct _lv_obj_t * obj, uint32_t part)
|
||||
{
|
||||
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_TEXT_COLOR_FILTERED);
|
||||
lv_style_value_t v = _lv_obj_style_apply_color_filter(obj, part, lv_obj_get_style_prop(obj, part, LV_STYLE_TEXT_COLOR));
|
||||
return v.color;
|
||||
}
|
||||
|
||||
@ -496,8 +508,7 @@ static inline lv_opa_t lv_obj_get_style_opa(const struct _lv_obj_t * obj, uint32
|
||||
return (lv_opa_t)v.num;
|
||||
}
|
||||
|
||||
static inline const lv_color_filter_dsc_t * lv_obj_get_style_color_filter_dsc(const struct _lv_obj_t * obj,
|
||||
uint32_t part)
|
||||
static inline const lv_color_filter_dsc_t * lv_obj_get_style_color_filter_dsc(const struct _lv_obj_t * obj, uint32_t part)
|
||||
{
|
||||
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_COLOR_FILTER_DSC);
|
||||
return (const lv_color_filter_dsc_t *)v.ptr;
|
||||
@ -509,6 +520,12 @@ static inline lv_opa_t lv_obj_get_style_color_filter_opa(const struct _lv_obj_t
|
||||
return (lv_opa_t)v.num;
|
||||
}
|
||||
|
||||
static inline const lv_anim_t * lv_obj_get_style_anim(const struct _lv_obj_t * obj, uint32_t part)
|
||||
{
|
||||
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_ANIM);
|
||||
return (const lv_anim_t *)v.ptr;
|
||||
}
|
||||
|
||||
static inline uint32_t lv_obj_get_style_anim_time(const struct _lv_obj_t * obj, uint32_t part)
|
||||
{
|
||||
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_ANIM_TIME);
|
||||
@ -560,6 +577,8 @@ void lv_obj_set_style_translate_x(struct _lv_obj_t * obj, lv_coord_t value, lv_s
|
||||
void lv_obj_set_style_translate_y(struct _lv_obj_t * obj, lv_coord_t value, lv_style_selector_t selector);
|
||||
void lv_obj_set_style_transform_zoom(struct _lv_obj_t * obj, lv_coord_t value, lv_style_selector_t selector);
|
||||
void lv_obj_set_style_transform_angle(struct _lv_obj_t * obj, lv_coord_t value, lv_style_selector_t selector);
|
||||
void lv_obj_set_style_transform_pivot_x(struct _lv_obj_t * obj, lv_coord_t value, lv_style_selector_t selector);
|
||||
void lv_obj_set_style_transform_pivot_y(struct _lv_obj_t * obj, lv_coord_t value, lv_style_selector_t selector);
|
||||
void lv_obj_set_style_pad_top(struct _lv_obj_t * obj, lv_coord_t value, lv_style_selector_t selector);
|
||||
void lv_obj_set_style_pad_bottom(struct _lv_obj_t * obj, lv_coord_t value, lv_style_selector_t selector);
|
||||
void lv_obj_set_style_pad_left(struct _lv_obj_t * obj, lv_coord_t value, lv_style_selector_t selector);
|
||||
@ -567,10 +586,8 @@ void lv_obj_set_style_pad_right(struct _lv_obj_t * obj, lv_coord_t value, lv_sty
|
||||
void lv_obj_set_style_pad_row(struct _lv_obj_t * obj, lv_coord_t value, lv_style_selector_t selector);
|
||||
void lv_obj_set_style_pad_column(struct _lv_obj_t * obj, lv_coord_t value, lv_style_selector_t selector);
|
||||
void lv_obj_set_style_bg_color(struct _lv_obj_t * obj, lv_color_t value, lv_style_selector_t selector);
|
||||
void lv_obj_set_style_bg_color_filtered(struct _lv_obj_t * obj, lv_color_t value, lv_style_selector_t selector);
|
||||
void lv_obj_set_style_bg_opa(struct _lv_obj_t * obj, lv_opa_t value, lv_style_selector_t selector);
|
||||
void lv_obj_set_style_bg_grad_color(struct _lv_obj_t * obj, lv_color_t value, lv_style_selector_t selector);
|
||||
void lv_obj_set_style_bg_grad_color_filtered(struct _lv_obj_t * obj, lv_color_t value, lv_style_selector_t selector);
|
||||
void lv_obj_set_style_bg_grad_dir(struct _lv_obj_t * obj, lv_grad_dir_t value, lv_style_selector_t selector);
|
||||
void lv_obj_set_style_bg_main_stop(struct _lv_obj_t * obj, lv_coord_t value, lv_style_selector_t selector);
|
||||
void lv_obj_set_style_bg_grad_stop(struct _lv_obj_t * obj, lv_coord_t value, lv_style_selector_t selector);
|
||||
@ -579,18 +596,15 @@ void lv_obj_set_style_bg_dither_mode(struct _lv_obj_t * obj, lv_dither_mode_t va
|
||||
void lv_obj_set_style_bg_img_src(struct _lv_obj_t * obj, const void * value, lv_style_selector_t selector);
|
||||
void lv_obj_set_style_bg_img_opa(struct _lv_obj_t * obj, lv_opa_t value, lv_style_selector_t selector);
|
||||
void lv_obj_set_style_bg_img_recolor(struct _lv_obj_t * obj, lv_color_t value, lv_style_selector_t selector);
|
||||
void lv_obj_set_style_bg_img_recolor_filtered(struct _lv_obj_t * obj, lv_color_t value, lv_style_selector_t selector);
|
||||
void lv_obj_set_style_bg_img_recolor_opa(struct _lv_obj_t * obj, lv_opa_t value, lv_style_selector_t selector);
|
||||
void lv_obj_set_style_bg_img_tiled(struct _lv_obj_t * obj, bool value, lv_style_selector_t selector);
|
||||
void lv_obj_set_style_border_color(struct _lv_obj_t * obj, lv_color_t value, lv_style_selector_t selector);
|
||||
void lv_obj_set_style_border_color_filtered(struct _lv_obj_t * obj, lv_color_t value, lv_style_selector_t selector);
|
||||
void lv_obj_set_style_border_opa(struct _lv_obj_t * obj, lv_opa_t value, lv_style_selector_t selector);
|
||||
void lv_obj_set_style_border_width(struct _lv_obj_t * obj, lv_coord_t value, lv_style_selector_t selector);
|
||||
void lv_obj_set_style_border_side(struct _lv_obj_t * obj, lv_border_side_t value, lv_style_selector_t selector);
|
||||
void lv_obj_set_style_border_post(struct _lv_obj_t * obj, bool value, lv_style_selector_t selector);
|
||||
void lv_obj_set_style_outline_width(struct _lv_obj_t * obj, lv_coord_t value, lv_style_selector_t selector);
|
||||
void lv_obj_set_style_outline_color(struct _lv_obj_t * obj, lv_color_t value, lv_style_selector_t selector);
|
||||
void lv_obj_set_style_outline_color_filtered(struct _lv_obj_t * obj, lv_color_t value, lv_style_selector_t selector);
|
||||
void lv_obj_set_style_outline_opa(struct _lv_obj_t * obj, lv_opa_t value, lv_style_selector_t selector);
|
||||
void lv_obj_set_style_outline_pad(struct _lv_obj_t * obj, lv_coord_t value, lv_style_selector_t selector);
|
||||
void lv_obj_set_style_shadow_width(struct _lv_obj_t * obj, lv_coord_t value, lv_style_selector_t selector);
|
||||
@ -598,27 +612,22 @@ void lv_obj_set_style_shadow_ofs_x(struct _lv_obj_t * obj, lv_coord_t value, lv_
|
||||
void lv_obj_set_style_shadow_ofs_y(struct _lv_obj_t * obj, lv_coord_t value, lv_style_selector_t selector);
|
||||
void lv_obj_set_style_shadow_spread(struct _lv_obj_t * obj, lv_coord_t value, lv_style_selector_t selector);
|
||||
void lv_obj_set_style_shadow_color(struct _lv_obj_t * obj, lv_color_t value, lv_style_selector_t selector);
|
||||
void lv_obj_set_style_shadow_color_filtered(struct _lv_obj_t * obj, lv_color_t value, lv_style_selector_t selector);
|
||||
void lv_obj_set_style_shadow_opa(struct _lv_obj_t * obj, lv_opa_t value, lv_style_selector_t selector);
|
||||
void lv_obj_set_style_img_opa(struct _lv_obj_t * obj, lv_opa_t value, lv_style_selector_t selector);
|
||||
void lv_obj_set_style_img_recolor(struct _lv_obj_t * obj, lv_color_t value, lv_style_selector_t selector);
|
||||
void lv_obj_set_style_img_recolor_filtered(struct _lv_obj_t * obj, lv_color_t value, lv_style_selector_t selector);
|
||||
void lv_obj_set_style_img_recolor_opa(struct _lv_obj_t * obj, lv_opa_t value, lv_style_selector_t selector);
|
||||
void lv_obj_set_style_line_width(struct _lv_obj_t * obj, lv_coord_t value, lv_style_selector_t selector);
|
||||
void lv_obj_set_style_line_dash_width(struct _lv_obj_t * obj, lv_coord_t value, lv_style_selector_t selector);
|
||||
void lv_obj_set_style_line_dash_gap(struct _lv_obj_t * obj, lv_coord_t value, lv_style_selector_t selector);
|
||||
void lv_obj_set_style_line_rounded(struct _lv_obj_t * obj, bool value, lv_style_selector_t selector);
|
||||
void lv_obj_set_style_line_color(struct _lv_obj_t * obj, lv_color_t value, lv_style_selector_t selector);
|
||||
void lv_obj_set_style_line_color_filtered(struct _lv_obj_t * obj, lv_color_t value, lv_style_selector_t selector);
|
||||
void lv_obj_set_style_line_opa(struct _lv_obj_t * obj, lv_opa_t value, lv_style_selector_t selector);
|
||||
void lv_obj_set_style_arc_width(struct _lv_obj_t * obj, lv_coord_t value, lv_style_selector_t selector);
|
||||
void lv_obj_set_style_arc_rounded(struct _lv_obj_t * obj, bool value, lv_style_selector_t selector);
|
||||
void lv_obj_set_style_arc_color(struct _lv_obj_t * obj, lv_color_t value, lv_style_selector_t selector);
|
||||
void lv_obj_set_style_arc_color_filtered(struct _lv_obj_t * obj, lv_color_t value, lv_style_selector_t selector);
|
||||
void lv_obj_set_style_arc_opa(struct _lv_obj_t * obj, lv_opa_t value, lv_style_selector_t selector);
|
||||
void lv_obj_set_style_arc_img_src(struct _lv_obj_t * obj, const void * value, lv_style_selector_t selector);
|
||||
void lv_obj_set_style_text_color(struct _lv_obj_t * obj, lv_color_t value, lv_style_selector_t selector);
|
||||
void lv_obj_set_style_text_color_filtered(struct _lv_obj_t * obj, lv_color_t value, lv_style_selector_t selector);
|
||||
void lv_obj_set_style_text_opa(struct _lv_obj_t * obj, lv_opa_t value, lv_style_selector_t selector);
|
||||
void lv_obj_set_style_text_font(struct _lv_obj_t * obj, const lv_font_t * value, lv_style_selector_t selector);
|
||||
void lv_obj_set_style_text_letter_space(struct _lv_obj_t * obj, lv_coord_t value, lv_style_selector_t selector);
|
||||
@ -628,13 +637,12 @@ void lv_obj_set_style_text_align(struct _lv_obj_t * obj, lv_text_align_t value,
|
||||
void lv_obj_set_style_radius(struct _lv_obj_t * obj, lv_coord_t value, lv_style_selector_t selector);
|
||||
void lv_obj_set_style_clip_corner(struct _lv_obj_t * obj, bool value, lv_style_selector_t selector);
|
||||
void lv_obj_set_style_opa(struct _lv_obj_t * obj, lv_opa_t value, lv_style_selector_t selector);
|
||||
void lv_obj_set_style_color_filter_dsc(struct _lv_obj_t * obj, const lv_color_filter_dsc_t * value,
|
||||
lv_style_selector_t selector);
|
||||
void lv_obj_set_style_color_filter_dsc(struct _lv_obj_t * obj, const lv_color_filter_dsc_t * value, lv_style_selector_t selector);
|
||||
void lv_obj_set_style_color_filter_opa(struct _lv_obj_t * obj, lv_opa_t value, lv_style_selector_t selector);
|
||||
void lv_obj_set_style_anim(struct _lv_obj_t * obj, const lv_anim_t * value, lv_style_selector_t selector);
|
||||
void lv_obj_set_style_anim_time(struct _lv_obj_t * obj, uint32_t value, lv_style_selector_t selector);
|
||||
void lv_obj_set_style_anim_speed(struct _lv_obj_t * obj, uint32_t value, lv_style_selector_t selector);
|
||||
void lv_obj_set_style_transition(struct _lv_obj_t * obj, const lv_style_transition_dsc_t * value,
|
||||
lv_style_selector_t selector);
|
||||
void lv_obj_set_style_transition(struct _lv_obj_t * obj, const lv_style_transition_dsc_t * value, lv_style_selector_t selector);
|
||||
void lv_obj_set_style_blend_mode(struct _lv_obj_t * obj, lv_blend_mode_t value, lv_style_selector_t selector);
|
||||
void lv_obj_set_style_layout(struct _lv_obj_t * obj, uint16_t value, lv_style_selector_t selector);
|
||||
void lv_obj_set_style_base_dir(struct _lv_obj_t * obj, lv_base_dir_t value, lv_style_selector_t selector);
|
||||
|
@ -65,6 +65,7 @@ void lv_obj_del(lv_obj_t * obj)
|
||||
|
||||
/*Call the ancestor's event handler to the parent to notify it about the child delete*/
|
||||
if(par) {
|
||||
lv_obj_update_layout(par);
|
||||
lv_obj_readjust_scroll(par, LV_ANIM_OFF);
|
||||
lv_obj_scrollbar_invalidate(par);
|
||||
lv_event_send(par, LV_EVENT_CHILD_CHANGED, NULL);
|
||||
|
@ -17,6 +17,7 @@
|
||||
#include "../misc/lv_gc.h"
|
||||
#include "../draw/lv_draw.h"
|
||||
#include "../font/lv_font_fmt_txt.h"
|
||||
#include "../extra/others/snapshot/lv_snapshot.h"
|
||||
|
||||
#if LV_USE_PERF_MONITOR || LV_USE_MEM_MONITOR
|
||||
#include "../widgets/lv_label.h"
|
||||
@ -51,11 +52,12 @@ typedef struct {
|
||||
* STATIC PROTOTYPES
|
||||
**********************/
|
||||
static void lv_refr_join_area(void);
|
||||
static void lv_refr_areas(void);
|
||||
static void lv_refr_area(const lv_area_t * area_p);
|
||||
static void lv_refr_area_part(lv_draw_ctx_t * draw_ctx);
|
||||
static void refr_invalid_areas(void);
|
||||
static void refr_area(const lv_area_t * area_p);
|
||||
static void refr_area_part(lv_draw_ctx_t * draw_ctx);
|
||||
static lv_obj_t * lv_refr_get_top_obj(const lv_area_t * area_p, lv_obj_t * obj);
|
||||
static void lv_refr_obj_and_children(lv_draw_ctx_t * draw_ctx, lv_obj_t * top_obj);
|
||||
static void refr_obj_and_children(lv_draw_ctx_t * draw_ctx, lv_obj_t * top_obj);
|
||||
static void refr_obj(lv_draw_ctx_t * draw_ctx, lv_obj_t * obj);
|
||||
static uint32_t get_max_row(lv_disp_t * disp, lv_coord_t area_w, lv_coord_t area_h);
|
||||
static void draw_buf_flush(lv_disp_t * disp);
|
||||
static void call_flush_cb(lv_disp_drv_t * drv, const lv_area_t * area, lv_color_t * color_p);
|
||||
@ -124,11 +126,8 @@ void lv_refr_now(lv_disp_t * disp)
|
||||
}
|
||||
}
|
||||
|
||||
void lv_refr_obj(lv_draw_ctx_t * draw_ctx, lv_obj_t * obj)
|
||||
void lv_obj_redraw(lv_draw_ctx_t * draw_ctx, lv_obj_t * obj)
|
||||
{
|
||||
/*Do not refresh hidden objects*/
|
||||
if(lv_obj_has_flag(obj, LV_OBJ_FLAG_HIDDEN)) return;
|
||||
|
||||
const lv_area_t * clip_area_ori = draw_ctx->clip_area;
|
||||
lv_area_t clip_coords_for_obj;
|
||||
|
||||
@ -137,31 +136,33 @@ void lv_refr_obj(lv_draw_ctx_t * draw_ctx, lv_obj_t * obj)
|
||||
lv_obj_get_coords(obj, &obj_coords_ext);
|
||||
lv_coord_t ext_draw_size = _lv_obj_get_ext_draw_size(obj);
|
||||
lv_area_increase(&obj_coords_ext, ext_draw_size, ext_draw_size);
|
||||
if(!_lv_area_intersect(&clip_coords_for_obj, clip_area_ori, &obj_coords_ext)) return;
|
||||
|
||||
draw_ctx->clip_area = &clip_coords_for_obj;
|
||||
|
||||
/*Draw the object*/
|
||||
lv_event_send(obj, LV_EVENT_DRAW_MAIN_BEGIN, draw_ctx);
|
||||
lv_event_send(obj, LV_EVENT_DRAW_MAIN, draw_ctx);
|
||||
lv_event_send(obj, LV_EVENT_DRAW_MAIN_END, draw_ctx);
|
||||
bool com_clip_res = _lv_area_intersect(&clip_coords_for_obj, clip_area_ori, &obj_coords_ext);
|
||||
/*If the object is visible on the current clip area OR has overflow visible draw it.
|
||||
*With overflow visible drawing should happen to apply the masks which might affect children */
|
||||
bool should_draw = com_clip_res || lv_obj_has_flag(obj, LV_OBJ_FLAG_OVERFLOW_VISIBLE);
|
||||
if(should_draw) {
|
||||
draw_ctx->clip_area = &clip_coords_for_obj;
|
||||
|
||||
lv_event_send(obj, LV_EVENT_DRAW_MAIN_BEGIN, draw_ctx);
|
||||
lv_event_send(obj, LV_EVENT_DRAW_MAIN, draw_ctx);
|
||||
lv_event_send(obj, LV_EVENT_DRAW_MAIN_END, draw_ctx);
|
||||
#if LV_USE_REFR_DEBUG
|
||||
lv_color_t debug_color = lv_color_make(lv_rand(0, 0xFF), lv_rand(0, 0xFF), lv_rand(0, 0xFF));
|
||||
lv_draw_rect_dsc_t draw_dsc;
|
||||
lv_draw_rect_dsc_init(&draw_dsc);
|
||||
draw_dsc.bg_color.full = debug_color.full;
|
||||
draw_dsc.bg_opa = LV_OPA_20;
|
||||
draw_dsc.border_width = 1;
|
||||
draw_dsc.border_opa = LV_OPA_30;
|
||||
draw_dsc.border_color = debug_color;
|
||||
lv_draw_rect(draw_ctx, &draw_dsc, &obj_coords_ext);
|
||||
lv_color_t debug_color = lv_color_make(lv_rand(0, 0xFF), lv_rand(0, 0xFF), lv_rand(0, 0xFF));
|
||||
lv_draw_rect_dsc_t draw_dsc;
|
||||
lv_draw_rect_dsc_init(&draw_dsc);
|
||||
draw_dsc.bg_color.full = debug_color.full;
|
||||
draw_dsc.bg_opa = LV_OPA_20;
|
||||
draw_dsc.border_width = 1;
|
||||
draw_dsc.border_opa = LV_OPA_30;
|
||||
draw_dsc.border_color = debug_color;
|
||||
lv_draw_rect(draw_ctx, &draw_dsc, &obj_coords_ext);
|
||||
#endif
|
||||
}
|
||||
|
||||
/*With overflow visible keep the previous clip area to let the children visible out of this object too
|
||||
*With not overflow visible limit the clip are to the object's coordinates to clip the children*/
|
||||
bool refr_children = true;
|
||||
lv_area_t clip_coords_for_children;
|
||||
bool refr_children = true;
|
||||
if(lv_obj_has_flag(obj, LV_OBJ_FLAG_OVERFLOW_VISIBLE)) {
|
||||
clip_coords_for_children = *clip_area_ori;
|
||||
}
|
||||
@ -177,20 +178,24 @@ void lv_refr_obj(lv_draw_ctx_t * draw_ctx, lv_obj_t * obj)
|
||||
uint32_t child_cnt = lv_obj_get_child_cnt(obj);
|
||||
for(i = 0; i < child_cnt; i++) {
|
||||
lv_obj_t * child = obj->spec_attr->children[i];
|
||||
lv_refr_obj(draw_ctx, child);
|
||||
refr_obj(draw_ctx, child);
|
||||
}
|
||||
}
|
||||
|
||||
draw_ctx->clip_area = &clip_coords_for_obj;
|
||||
/*If the object was visible on the clip area call the post draw events too*/
|
||||
if(should_draw) {
|
||||
draw_ctx->clip_area = &clip_coords_for_obj;
|
||||
|
||||
/*If all the children are redrawn make 'post draw' draw*/
|
||||
lv_event_send(obj, LV_EVENT_DRAW_POST_BEGIN, draw_ctx);
|
||||
lv_event_send(obj, LV_EVENT_DRAW_POST, draw_ctx);
|
||||
lv_event_send(obj, LV_EVENT_DRAW_POST_END, draw_ctx);
|
||||
/*If all the children are redrawn make 'post draw' draw*/
|
||||
lv_event_send(obj, LV_EVENT_DRAW_POST_BEGIN, draw_ctx);
|
||||
lv_event_send(obj, LV_EVENT_DRAW_POST, draw_ctx);
|
||||
lv_event_send(obj, LV_EVENT_DRAW_POST_END, draw_ctx);
|
||||
}
|
||||
|
||||
draw_ctx->clip_area = clip_area_ori;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Invalidate an area on display to redraw it
|
||||
* @param area_p pointer to area which should be invalidated (NULL: delete the invalidated areas)
|
||||
@ -201,6 +206,12 @@ void _lv_inv_area(lv_disp_t * disp, const lv_area_t * area_p)
|
||||
{
|
||||
if(!disp) disp = lv_disp_get_default();
|
||||
if(!disp) return;
|
||||
if(!lv_disp_is_invalidation_enabled(disp)) return;
|
||||
|
||||
if(disp->rendering_in_progress) {
|
||||
LV_LOG_ERROR("detected modifying dirty areas in render");
|
||||
return;
|
||||
}
|
||||
|
||||
/*Clear the invalidate buffer if the parameter is NULL*/
|
||||
if(area_p == NULL) {
|
||||
@ -310,7 +321,8 @@ void _lv_disp_refr_timer(lv_timer_t * tmr)
|
||||
|
||||
lv_refr_join_area();
|
||||
|
||||
lv_refr_areas();
|
||||
refr_invalid_areas();
|
||||
|
||||
|
||||
/*If refresh happened ...*/
|
||||
if(disp_refr->inv_p != 0) {
|
||||
@ -327,6 +339,7 @@ void _lv_disp_refr_timer(lv_timer_t * tmr)
|
||||
disp_refr->inv_p = 0;
|
||||
|
||||
elaps = lv_tick_elaps(start);
|
||||
|
||||
/*Call monitor cb if present*/
|
||||
if(disp_refr->driver->monitor_cb) {
|
||||
disp_refr->driver->monitor_cb(disp_refr->driver, elaps, px_num);
|
||||
@ -365,9 +378,16 @@ void _lv_disp_refr_timer(lv_timer_t * tmr)
|
||||
}
|
||||
else {
|
||||
perf_monitor.perf_last_time = lv_tick_get();
|
||||
uint32_t fps_limit = 1000 / disp_refr->refr_timer->period;
|
||||
uint32_t fps_limit;
|
||||
uint32_t fps;
|
||||
|
||||
if(disp_refr->refr_timer) {
|
||||
fps_limit = 1000 / disp_refr->refr_timer->period;
|
||||
}
|
||||
else {
|
||||
fps_limit = 1000 / LV_DISP_DEF_REFR_PERIOD;
|
||||
}
|
||||
|
||||
if(perf_monitor.elaps_sum == 0) {
|
||||
perf_monitor.elaps_sum = 1;
|
||||
}
|
||||
@ -413,8 +433,10 @@ void _lv_disp_refr_timer(lv_timer_t * tmr)
|
||||
uint32_t used_size = mon.total_size - mon.free_size;;
|
||||
uint32_t used_kb = used_size / 1024;
|
||||
uint32_t used_kb_tenth = (used_size - (used_kb * 1024)) / 102;
|
||||
lv_label_set_text_fmt(mem_label, "%" LV_PRIu32 ".%" LV_PRIu32 " kB used (%d %%)\n" \
|
||||
"%d%% frag.", used_kb, used_kb_tenth, mon.used_pct,
|
||||
lv_label_set_text_fmt(mem_label,
|
||||
"%"LV_PRIu32 ".%"LV_PRIu32 " kB used (%d %%)\n"
|
||||
"%d%% frag.",
|
||||
used_kb, used_kb_tenth, mon.used_pct,
|
||||
mon.frag_pct);
|
||||
}
|
||||
#endif
|
||||
@ -483,7 +505,7 @@ static void lv_refr_join_area(void)
|
||||
/**
|
||||
* Refresh the joined areas
|
||||
*/
|
||||
static void lv_refr_areas(void)
|
||||
static void refr_invalid_areas(void)
|
||||
{
|
||||
px_num = 0;
|
||||
|
||||
@ -499,8 +521,14 @@ static void lv_refr_areas(void)
|
||||
}
|
||||
}
|
||||
|
||||
/*Notify the display driven rendering has started*/
|
||||
if(disp_refr->driver->render_start_cb) {
|
||||
disp_refr->driver->render_start_cb(disp_refr->driver);
|
||||
}
|
||||
|
||||
disp_refr->driver->draw_buf->last_area = 0;
|
||||
disp_refr->driver->draw_buf->last_part = 0;
|
||||
disp_refr->rendering_in_progress = true;
|
||||
|
||||
for(i = 0; i < disp_refr->inv_p; i++) {
|
||||
/*Refresh the unjoined areas*/
|
||||
@ -508,18 +536,20 @@ static void lv_refr_areas(void)
|
||||
|
||||
if(i == last_i) disp_refr->driver->draw_buf->last_area = 1;
|
||||
disp_refr->driver->draw_buf->last_part = 0;
|
||||
lv_refr_area(&disp_refr->inv_areas[i]);
|
||||
refr_area(&disp_refr->inv_areas[i]);
|
||||
|
||||
px_num += lv_area_get_size(&disp_refr->inv_areas[i]);
|
||||
}
|
||||
}
|
||||
|
||||
disp_refr->rendering_in_progress = false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Refresh an area if there is Virtual Display Buffer
|
||||
* @param area_p pointer to an area to refresh
|
||||
*/
|
||||
static void lv_refr_area(const lv_area_t * area_p)
|
||||
static void refr_area(const lv_area_t * area_p)
|
||||
{
|
||||
lv_draw_ctx_t * draw_ctx = disp_refr->driver->draw_ctx;
|
||||
draw_ctx->buf = disp_refr->driver->draw_buf->buf_act;
|
||||
@ -534,12 +564,12 @@ static void lv_refr_area(const lv_area_t * area_p)
|
||||
if(disp_refr->driver->full_refresh) {
|
||||
disp_refr->driver->draw_buf->last_part = 1;
|
||||
draw_ctx->clip_area = &disp_area;
|
||||
lv_refr_area_part(draw_ctx);
|
||||
refr_area_part(draw_ctx);
|
||||
}
|
||||
else {
|
||||
disp_refr->driver->draw_buf->last_part = disp_refr->driver->draw_buf->last_area;
|
||||
draw_ctx->clip_area = area_p;
|
||||
lv_refr_area_part(draw_ctx);
|
||||
refr_area_part(draw_ctx);
|
||||
}
|
||||
return;
|
||||
}
|
||||
@ -568,7 +598,7 @@ static void lv_refr_area(const lv_area_t * area_p)
|
||||
if(sub_area.y2 > y2) sub_area.y2 = y2;
|
||||
row_last = sub_area.y2;
|
||||
if(y2 == row_last) disp_refr->driver->draw_buf->last_part = 1;
|
||||
lv_refr_area_part(draw_ctx);
|
||||
refr_area_part(draw_ctx);
|
||||
}
|
||||
|
||||
/*If the last y coordinates are not handled yet ...*/
|
||||
@ -582,11 +612,11 @@ static void lv_refr_area(const lv_area_t * area_p)
|
||||
draw_ctx->clip_area = &sub_area;
|
||||
draw_ctx->buf = disp_refr->driver->draw_buf->buf_act;
|
||||
disp_refr->driver->draw_buf->last_part = 1;
|
||||
lv_refr_area_part(draw_ctx);
|
||||
refr_area_part(draw_ctx);
|
||||
}
|
||||
}
|
||||
|
||||
static void lv_refr_area_part(lv_draw_ctx_t * draw_ctx)
|
||||
static void refr_area_part(lv_draw_ctx_t * draw_ctx)
|
||||
{
|
||||
lv_disp_draw_buf_t * draw_buf = lv_disp_get_draw_buf(disp_refr);
|
||||
|
||||
@ -596,6 +626,18 @@ static void lv_refr_area_part(lv_draw_ctx_t * draw_ctx)
|
||||
while(draw_buf->flushing) {
|
||||
if(disp_refr->driver->wait_cb) disp_refr->driver->wait_cb(disp_refr->driver);
|
||||
}
|
||||
|
||||
/*If the screen is transparent initialize it when the flushing is ready*/
|
||||
#if LV_COLOR_SCREEN_TRANSP
|
||||
if(disp_refr->driver->screen_transp) {
|
||||
if(disp_refr->driver->clear_cb) {
|
||||
disp_refr->driver->clear_cb(disp_refr->driver, disp_refr->driver->draw_buf->buf_act, disp_refr->driver->draw_buf->size);
|
||||
}
|
||||
else {
|
||||
lv_memset_00(disp_refr->driver->draw_buf->buf_act, disp_refr->driver->draw_buf->size * LV_IMG_PX_SIZE_ALPHA_BYTE);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
lv_obj_t * top_act_scr = NULL;
|
||||
@ -609,6 +651,9 @@ static void lv_refr_area_part(lv_draw_ctx_t * draw_ctx)
|
||||
|
||||
/*Draw a display background if there is no top object*/
|
||||
if(top_act_scr == NULL && top_prev_scr == NULL) {
|
||||
lv_area_t a;
|
||||
lv_area_set(&a, 0, 0,
|
||||
lv_disp_get_hor_res(disp_refr) - 1, lv_disp_get_ver_res(disp_refr) - 1);
|
||||
if(draw_ctx->draw_bg) {
|
||||
lv_draw_rect_dsc_t dsc;
|
||||
lv_draw_rect_dsc_init(&dsc);
|
||||
@ -616,15 +661,12 @@ static void lv_refr_area_part(lv_draw_ctx_t * draw_ctx)
|
||||
dsc.bg_img_opa = disp_refr->bg_opa;
|
||||
dsc.bg_color = disp_refr->bg_color;
|
||||
dsc.bg_opa = disp_refr->bg_opa;
|
||||
draw_ctx->draw_bg(draw_ctx, &dsc, draw_ctx->buf_area);
|
||||
draw_ctx->draw_bg(draw_ctx, &dsc, &a);
|
||||
}
|
||||
else if(disp_refr->bg_img) {
|
||||
lv_img_header_t header;
|
||||
lv_res_t res;
|
||||
res = lv_img_decoder_get_info(disp_refr->bg_img, &header);
|
||||
lv_res_t res = lv_img_decoder_get_info(disp_refr->bg_img, &header);
|
||||
if(res == LV_RES_OK) {
|
||||
lv_area_t a;
|
||||
lv_area_set(&a, 0, 0, header.w - 1, header.h - 1);
|
||||
lv_draw_img_dsc_t dsc;
|
||||
lv_draw_img_dsc_init(&dsc);
|
||||
dsc.opa = disp_refr->bg_opa;
|
||||
@ -642,18 +684,31 @@ static void lv_refr_area_part(lv_draw_ctx_t * draw_ctx)
|
||||
lv_draw_rect(draw_ctx, &dsc, draw_ctx->buf_area);
|
||||
}
|
||||
}
|
||||
/*Refresh the previous screen if any*/
|
||||
if(disp_refr->prev_scr) {
|
||||
if(top_prev_scr == NULL) top_prev_scr = disp_refr->prev_scr;
|
||||
lv_refr_obj_and_children(draw_ctx, top_prev_scr);
|
||||
|
||||
if(disp_refr->draw_prev_over_act) {
|
||||
if(top_act_scr == NULL) top_act_scr = disp_refr->act_scr;
|
||||
refr_obj_and_children(draw_ctx, top_act_scr);
|
||||
|
||||
/*Refresh the previous screen if any*/
|
||||
if(disp_refr->prev_scr) {
|
||||
if(top_prev_scr == NULL) top_prev_scr = disp_refr->prev_scr;
|
||||
refr_obj_and_children(draw_ctx, top_prev_scr);
|
||||
}
|
||||
}
|
||||
else {
|
||||
/*Refresh the previous screen if any*/
|
||||
if(disp_refr->prev_scr) {
|
||||
if(top_prev_scr == NULL) top_prev_scr = disp_refr->prev_scr;
|
||||
refr_obj_and_children(draw_ctx, top_prev_scr);
|
||||
}
|
||||
|
||||
if(top_act_scr == NULL) top_act_scr = disp_refr->act_scr;
|
||||
refr_obj_and_children(draw_ctx, top_act_scr);
|
||||
}
|
||||
|
||||
if(top_act_scr == NULL) top_act_scr = disp_refr->act_scr;
|
||||
lv_refr_obj_and_children(draw_ctx, top_act_scr);
|
||||
|
||||
/*Also refresh top and sys layer unconditionally*/
|
||||
lv_refr_obj_and_children(draw_ctx, lv_disp_get_layer_top(disp_refr));
|
||||
lv_refr_obj_and_children(draw_ctx, lv_disp_get_layer_sys(disp_refr));
|
||||
refr_obj_and_children(draw_ctx, lv_disp_get_layer_top(disp_refr));
|
||||
refr_obj_and_children(draw_ctx, lv_disp_get_layer_sys(disp_refr));
|
||||
|
||||
/*In true double buffered mode flush only once when all areas were rendered.
|
||||
*In normal mode flush after every area*/
|
||||
@ -672,32 +727,32 @@ 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 this object is fully cover the draw area then check the children too*/
|
||||
if(_lv_area_is_in(area_p, &obj->coords, 0) && lv_obj_has_flag(obj, LV_OBJ_FLAG_HIDDEN) == false) {
|
||||
lv_cover_check_info_t info;
|
||||
info.res = LV_COVER_RES_COVER;
|
||||
info.area = area_p;
|
||||
lv_event_send(obj, LV_EVENT_COVER_CHECK, &info);
|
||||
if(info.res == LV_COVER_RES_MASKED) return NULL;
|
||||
lv_cover_check_info_t info;
|
||||
info.res = LV_COVER_RES_COVER;
|
||||
info.area = area_p;
|
||||
lv_event_send(obj, LV_EVENT_COVER_CHECK, &info);
|
||||
if(info.res == LV_COVER_RES_MASKED) return NULL;
|
||||
|
||||
uint32_t i;
|
||||
uint32_t child_cnt = lv_obj_get_child_cnt(obj);
|
||||
for(i = 0; i < child_cnt; i++) {
|
||||
lv_obj_t * child = obj->spec_attr->children[i];
|
||||
found_p = lv_refr_get_top_obj(area_p, child);
|
||||
uint32_t i;
|
||||
uint32_t child_cnt = lv_obj_get_child_cnt(obj);
|
||||
for(i = 0; i < child_cnt; 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 a children is ok then break*/
|
||||
if(found_p != NULL) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/*If no better children use this object*/
|
||||
if(found_p == NULL) {
|
||||
if(info.res == LV_COVER_RES_COVER) {
|
||||
found_p = obj;
|
||||
}
|
||||
}
|
||||
/*If no better children use this object*/
|
||||
if(found_p == NULL && info.res == LV_COVER_RES_COVER) {
|
||||
found_p = obj;
|
||||
}
|
||||
|
||||
return found_p;
|
||||
@ -708,7 +763,7 @@ static lv_obj_t * lv_refr_get_top_obj(const lv_area_t * area_p, lv_obj_t * obj)
|
||||
* @param top_p pointer to an objects. Start the drawing from it.
|
||||
* @param mask_p pointer to an area, the objects will be drawn only here
|
||||
*/
|
||||
static void lv_refr_obj_and_children(lv_draw_ctx_t * draw_ctx, lv_obj_t * top_obj)
|
||||
static void refr_obj_and_children(lv_draw_ctx_t * draw_ctx, lv_obj_t * top_obj)
|
||||
{
|
||||
/*Normally always will be a top_obj (at least the screen)
|
||||
*but in special cases (e.g. if the screen has alpha) it won't.
|
||||
@ -717,7 +772,7 @@ static void lv_refr_obj_and_children(lv_draw_ctx_t * draw_ctx, lv_obj_t * top_ob
|
||||
if(top_obj == NULL) return; /*Shouldn't happen*/
|
||||
|
||||
/*Refresh the top object and its children*/
|
||||
lv_refr_obj(draw_ctx, top_obj);
|
||||
refr_obj(draw_ctx, top_obj);
|
||||
|
||||
/*Draw the 'younger' sibling objects because they can be on top_obj*/
|
||||
lv_obj_t * parent;
|
||||
@ -737,7 +792,7 @@ static void lv_refr_obj_and_children(lv_draw_ctx_t * draw_ctx, lv_obj_t * top_ob
|
||||
}
|
||||
else {
|
||||
/*Refresh the objects*/
|
||||
lv_refr_obj(draw_ctx, child);
|
||||
refr_obj(draw_ctx, child);
|
||||
}
|
||||
}
|
||||
|
||||
@ -754,6 +809,160 @@ static void lv_refr_obj_and_children(lv_draw_ctx_t * draw_ctx, lv_obj_t * top_ob
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static lv_res_t layer_get_area(lv_draw_ctx_t * draw_ctx, lv_obj_t * obj, lv_layer_type_t layer_type,
|
||||
lv_area_t * layer_area_out)
|
||||
{
|
||||
lv_coord_t ext_draw_size = _lv_obj_get_ext_draw_size(obj);
|
||||
lv_area_t obj_coords_ext;
|
||||
lv_obj_get_coords(obj, &obj_coords_ext);
|
||||
lv_area_increase(&obj_coords_ext, ext_draw_size, ext_draw_size);
|
||||
|
||||
if(layer_type == LV_LAYER_TYPE_TRANSFORM) {
|
||||
/*Get the transformed area and clip it to the current clip area.
|
||||
*This area needs to be updated on the screen.*/
|
||||
lv_area_t clip_coords_for_obj;
|
||||
lv_area_t tranf_coords = obj_coords_ext;
|
||||
lv_obj_get_transformed_area(obj, &tranf_coords, false, false);
|
||||
if(!_lv_area_intersect(&clip_coords_for_obj, draw_ctx->clip_area, &tranf_coords)) {
|
||||
return LV_RES_INV;
|
||||
}
|
||||
|
||||
/*Transform back (inverse) the transformed area.
|
||||
*It will tell which area of the non-transformed widget needs to be redrawn
|
||||
*in order to cover transformed area after transformation.*/
|
||||
lv_area_t inverse_clip_coords_for_obj = clip_coords_for_obj;
|
||||
lv_obj_get_transformed_area(obj, &inverse_clip_coords_for_obj, false, true);
|
||||
if(!_lv_area_intersect(&inverse_clip_coords_for_obj, &inverse_clip_coords_for_obj, &obj_coords_ext)) {
|
||||
return LV_RES_INV;
|
||||
}
|
||||
|
||||
*layer_area_out = inverse_clip_coords_for_obj;
|
||||
}
|
||||
else if(layer_type == LV_LAYER_TYPE_SIMPLE) {
|
||||
lv_area_t clip_coords_for_obj;
|
||||
if(!_lv_area_intersect(&clip_coords_for_obj, draw_ctx->clip_area, &obj_coords_ext)) {
|
||||
return LV_RES_INV;
|
||||
}
|
||||
*layer_area_out = clip_coords_for_obj;
|
||||
}
|
||||
else {
|
||||
LV_LOG_WARN("Unhandled intermediate layer type");
|
||||
return LV_RES_INV;
|
||||
}
|
||||
|
||||
return LV_RES_OK;
|
||||
}
|
||||
|
||||
static void layer_alpha_test(lv_obj_t * obj, lv_draw_ctx_t * draw_ctx, lv_draw_layer_ctx_t * layer_ctx,
|
||||
lv_draw_layer_flags_t flags)
|
||||
{
|
||||
bool has_alpha;
|
||||
/*If globally the layer has alpha maybe this smaller section has not (e.g. not on a rounded corner)
|
||||
*If turns out that this section has no alpha renderer can choose faster algorithms*/
|
||||
if(flags & LV_DRAW_LAYER_FLAG_HAS_ALPHA) {
|
||||
/*Test for alpha by assuming there is no alpha. If it fails, fall back to rendering with alpha*/
|
||||
has_alpha = true;
|
||||
if(_lv_area_is_in(&layer_ctx->area_act, &obj->coords, 0)) {
|
||||
lv_cover_check_info_t info;
|
||||
info.res = LV_COVER_RES_COVER;
|
||||
info.area = &layer_ctx->area_act;
|
||||
lv_event_send(obj, LV_EVENT_COVER_CHECK, &info);
|
||||
if(info.res == LV_COVER_RES_COVER) has_alpha = false;
|
||||
}
|
||||
|
||||
if(has_alpha) {
|
||||
layer_ctx->area_act.y2 = layer_ctx->area_act.y1 + layer_ctx->max_row_with_alpha - 1;
|
||||
}
|
||||
}
|
||||
else {
|
||||
has_alpha = false;
|
||||
}
|
||||
|
||||
if(layer_ctx->area_act.y2 > layer_ctx->area_full.y2) layer_ctx->area_act.y2 = layer_ctx->area_full.y2;
|
||||
lv_draw_layer_adjust(draw_ctx, layer_ctx, has_alpha ? LV_DRAW_LAYER_FLAG_HAS_ALPHA : LV_DRAW_LAYER_FLAG_NONE);
|
||||
}
|
||||
|
||||
|
||||
void refr_obj(lv_draw_ctx_t * draw_ctx, lv_obj_t * obj)
|
||||
{
|
||||
/*Do not refresh hidden objects*/
|
||||
if(lv_obj_has_flag(obj, LV_OBJ_FLAG_HIDDEN)) return;
|
||||
lv_layer_type_t layer_type = _lv_obj_get_layer_type(obj);
|
||||
if(layer_type == LV_LAYER_TYPE_NONE) {
|
||||
lv_obj_redraw(draw_ctx, obj);
|
||||
}
|
||||
else {
|
||||
lv_opa_t opa = lv_obj_get_style_opa(obj, 0);
|
||||
if(opa < LV_OPA_MIN) return;
|
||||
|
||||
lv_area_t layer_area_full;
|
||||
lv_res_t res = layer_get_area(draw_ctx, obj, layer_type, &layer_area_full);
|
||||
if(res != LV_RES_OK) return;
|
||||
|
||||
lv_draw_layer_flags_t flags = LV_DRAW_LAYER_FLAG_HAS_ALPHA;
|
||||
|
||||
if(_lv_area_is_in(&layer_area_full, &obj->coords, 0)) {
|
||||
lv_cover_check_info_t info;
|
||||
info.res = LV_COVER_RES_COVER;
|
||||
info.area = &layer_area_full;
|
||||
lv_event_send(obj, LV_EVENT_COVER_CHECK, &info);
|
||||
if(info.res == LV_COVER_RES_COVER) flags &= ~LV_DRAW_LAYER_FLAG_HAS_ALPHA;
|
||||
}
|
||||
|
||||
if(layer_type == LV_LAYER_TYPE_SIMPLE) flags |= LV_DRAW_LAYER_FLAG_CAN_SUBDIVIDE;
|
||||
|
||||
lv_draw_layer_ctx_t * layer_ctx = lv_draw_layer_create(draw_ctx, &layer_area_full, flags);
|
||||
if(layer_ctx == NULL) {
|
||||
LV_LOG_WARN("Couldn't create a new layer context");
|
||||
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)
|
||||
};
|
||||
|
||||
lv_draw_img_dsc_t draw_dsc;
|
||||
lv_draw_img_dsc_init(&draw_dsc);
|
||||
draw_dsc.opa = opa;
|
||||
draw_dsc.angle = lv_obj_get_style_transform_angle(obj, 0);
|
||||
if(draw_dsc.angle > 3600) draw_dsc.angle -= 3600;
|
||||
else if(draw_dsc.angle < 0) draw_dsc.angle += 3600;
|
||||
|
||||
draw_dsc.zoom = lv_obj_get_style_transform_zoom(obj, 0);
|
||||
draw_dsc.blend_mode = lv_obj_get_style_blend_mode(obj, 0);
|
||||
draw_dsc.antialias = disp_refr->driver->antialiasing;
|
||||
|
||||
if(flags & LV_DRAW_LAYER_FLAG_CAN_SUBDIVIDE) {
|
||||
layer_ctx->area_act = layer_ctx->area_full;
|
||||
layer_ctx->area_act.y2 = layer_ctx->area_act.y1 + layer_ctx->max_row_with_no_alpha - 1;
|
||||
if(layer_ctx->area_act.y2 > layer_ctx->area_full.y2) layer_ctx->area_act.y2 = layer_ctx->area_full.y2;
|
||||
}
|
||||
|
||||
while(layer_ctx->area_act.y1 <= layer_area_full.y2) {
|
||||
if(flags & LV_DRAW_LAYER_FLAG_CAN_SUBDIVIDE) {
|
||||
layer_alpha_test(obj, draw_ctx, layer_ctx, flags);
|
||||
}
|
||||
|
||||
lv_obj_redraw(draw_ctx, obj);
|
||||
|
||||
draw_dsc.pivot.x = obj->coords.x1 + pivot.x - draw_ctx->buf_area->x1;
|
||||
draw_dsc.pivot.y = obj->coords.y1 + pivot.y - draw_ctx->buf_area->y1;
|
||||
|
||||
/*With LV_DRAW_LAYER_FLAG_CAN_SUBDIVIDE it should also go the next chunk*/
|
||||
lv_draw_layer_blend(draw_ctx, layer_ctx, &draw_dsc);
|
||||
|
||||
if((flags & LV_DRAW_LAYER_FLAG_CAN_SUBDIVIDE) == 0) break;
|
||||
|
||||
layer_ctx->area_act.y1 = layer_ctx->area_act.y2 + 1;
|
||||
layer_ctx->area_act.y2 = layer_ctx->area_act.y1 + layer_ctx->max_row_with_no_alpha - 1;
|
||||
}
|
||||
|
||||
lv_draw_layer_destroy(draw_ctx, layer_ctx);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static uint32_t get_max_row(lv_disp_t * disp, lv_coord_t area_w, lv_coord_t area_h)
|
||||
{
|
||||
int32_t max_row = (uint32_t)disp->driver->draw_buf->size / area_w;
|
||||
@ -986,6 +1195,18 @@ static void draw_buf_flush(lv_disp_t * disp)
|
||||
while(draw_buf->flushing) {
|
||||
if(disp_refr->driver->wait_cb) disp_refr->driver->wait_cb(disp_refr->driver);
|
||||
}
|
||||
|
||||
/*If the screen is transparent initialize it when the flushing is ready*/
|
||||
#if LV_COLOR_SCREEN_TRANSP
|
||||
if(disp_refr->driver->screen_transp) {
|
||||
if(disp_refr->driver->clear_cb) {
|
||||
disp_refr->driver->clear_cb(disp_refr->driver, disp_refr->driver->draw_buf->buf_act, disp_refr->driver->draw_buf->size);
|
||||
}
|
||||
else {
|
||||
lv_memset_00(disp_refr->driver->draw_buf->buf_act, disp_refr->driver->draw_buf->size * LV_IMG_PX_SIZE_ALPHA_BYTE);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
draw_buf->flushing = 1;
|
||||
|
@ -61,7 +61,7 @@ void lv_refr_now(lv_disp_t * disp);
|
||||
* @param draw pointer to an initialized draw context
|
||||
* @param obj the start object from the redraw should start
|
||||
*/
|
||||
void lv_refr_obj(lv_draw_ctx_t * draw_ctx, lv_obj_t * obj);
|
||||
void lv_obj_redraw(lv_draw_ctx_t * draw_ctx, lv_obj_t * obj);
|
||||
|
||||
/**
|
||||
* Invalidate an area on display to redraw it
|
||||
|
6
lib/libesp32_lvgl/lvgl/src/draw/arm2d/lv_draw_arm2d.mk
Normal file
6
lib/libesp32_lvgl/lvgl/src/draw/arm2d/lv_draw_arm2d.mk
Normal file
@ -0,0 +1,6 @@
|
||||
CSRCS += lv_gpu_arm2d.c
|
||||
|
||||
DEPPATH += --dep-path $(LVGL_DIR)/$(LVGL_DIR_NAME)/src/draw/arm2d
|
||||
VPATH += :$(LVGL_DIR)/$(LVGL_DIR_NAME)/src/draw/arm2d
|
||||
|
||||
CFLAGS += "-I$(LVGL_DIR)/$(LVGL_DIR_NAME)/src/draw/arm2d"
|
1376
lib/libesp32_lvgl/lvgl/src/draw/arm2d/lv_gpu_arm2d.c
Normal file
1376
lib/libesp32_lvgl/lvgl/src/draw/arm2d/lv_gpu_arm2d.c
Normal file
File diff suppressed because it is too large
Load Diff
51
lib/libesp32_lvgl/lvgl/src/draw/arm2d/lv_gpu_arm2d.h
Normal file
51
lib/libesp32_lvgl/lvgl/src/draw/arm2d/lv_gpu_arm2d.h
Normal file
@ -0,0 +1,51 @@
|
||||
/**
|
||||
* @file lv_gpu_arm2d.h
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef LV_GPU_ARM2D_H
|
||||
#define LV_GPU_ARM2D_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*********************
|
||||
* INCLUDES
|
||||
*********************/
|
||||
#include "../../misc/lv_color.h"
|
||||
#include "../../hal/lv_hal_disp.h"
|
||||
#include "../sw/lv_draw_sw.h"
|
||||
|
||||
#if LV_USE_GPU_ARM2D
|
||||
|
||||
/*********************
|
||||
* DEFINES
|
||||
*********************/
|
||||
|
||||
/**********************
|
||||
* TYPEDEFS
|
||||
**********************/
|
||||
typedef lv_draw_sw_ctx_t lv_draw_arm2d_ctx_t;
|
||||
|
||||
struct _lv_disp_drv_t;
|
||||
|
||||
/**********************
|
||||
* GLOBAL PROTOTYPES
|
||||
**********************/
|
||||
|
||||
void lv_draw_arm2d_ctx_init(struct _lv_disp_drv_t * drv, lv_draw_ctx_t * draw_ctx);
|
||||
|
||||
void lv_draw_arm2d_ctx_deinit(struct _lv_disp_drv_t * drv, lv_draw_ctx_t * draw_ctx);
|
||||
|
||||
/**********************
|
||||
* MACROS
|
||||
**********************/
|
||||
|
||||
#endif /*LV_USE_GPU_ARM2D*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /*extern "C"*/
|
||||
#endif
|
||||
|
||||
#endif /*LV_GPU_ARM2D_H*/
|
@ -39,12 +39,12 @@
|
||||
|
||||
void lv_draw_init(void)
|
||||
{
|
||||
// backend_head = NULL;
|
||||
// lv_draw_sw_init();
|
||||
//
|
||||
//#if LV_USE_GPU_STM32_DMA2D == 0
|
||||
// lv_gpu_stm32_dma2d_init();
|
||||
//#endif
|
||||
/*Nothing to init now*/
|
||||
}
|
||||
|
||||
void lv_draw_wait_for_finish(lv_draw_ctx_t * draw_ctx)
|
||||
{
|
||||
if(draw_ctx->wait_for_finish) draw_ctx->wait_for_finish(draw_ctx);
|
||||
}
|
||||
|
||||
/**********************
|
||||
|
@ -27,6 +27,8 @@ extern "C" {
|
||||
#include "lv_draw_triangle.h"
|
||||
#include "lv_draw_arc.h"
|
||||
#include "lv_draw_mask.h"
|
||||
#include "lv_draw_transform.h"
|
||||
#include "lv_draw_layer.h"
|
||||
|
||||
/*********************
|
||||
* DEFINES
|
||||
@ -40,6 +42,19 @@ typedef struct {
|
||||
void * user_data;
|
||||
} lv_draw_mask_t;
|
||||
|
||||
typedef struct _lv_draw_layer_ctx_t {
|
||||
lv_area_t area_full;
|
||||
lv_area_t area_act;
|
||||
lv_coord_t max_row_with_alpha;
|
||||
lv_coord_t max_row_with_no_alpha;
|
||||
void * buf;
|
||||
struct {
|
||||
const lv_area_t * clip_area;
|
||||
lv_area_t * buf_area;
|
||||
void * buf;
|
||||
bool screen_transp;
|
||||
} original;
|
||||
} lv_draw_layer_ctx_t;
|
||||
|
||||
typedef struct _lv_draw_ctx_t {
|
||||
/**
|
||||
@ -80,6 +95,24 @@ typedef struct _lv_draw_ctx_t {
|
||||
void (*draw_polygon)(struct _lv_draw_ctx_t * draw_ctx, const lv_draw_rect_dsc_t * draw_dsc,
|
||||
const lv_point_t * points, uint16_t point_cnt);
|
||||
|
||||
|
||||
/**
|
||||
* Get an area of a transformed image (zoomed and/or rotated)
|
||||
* @param draw_ctx pointer to a draw context
|
||||
* @param dest_area get this area of the result image. It assumes that the original image is placed to the 0;0 position.
|
||||
* @param src_buf the source image
|
||||
* @param src_w width of the source image in [px]
|
||||
* @param src_h height of the source image in [px]
|
||||
* @param src_stride the stride in [px].
|
||||
* @param draw_dsc an `lv_draw_img_dsc_t` descriptor containing the transformation parameters
|
||||
* @param cf the color format of `src_buf`
|
||||
* @param cbuf place the colors of the pixels on `dest_area` here in RGB format
|
||||
* @param abuf place the opacity of the pixels on `dest_area` here
|
||||
*/
|
||||
void (*draw_transform)(struct _lv_draw_ctx_t * draw_ctx, const lv_area_t * dest_area, const void * src_buf,
|
||||
lv_coord_t src_w, lv_coord_t src_h, lv_coord_t src_stride,
|
||||
const lv_draw_img_dsc_t * draw_dsc, lv_img_cf_t cf, lv_color_t * cbuf, lv_opa_t * abuf);
|
||||
|
||||
/**
|
||||
* Replace the buffer with a rect without decoration like radius or borders
|
||||
*/
|
||||
@ -88,7 +121,68 @@ typedef struct _lv_draw_ctx_t {
|
||||
/**
|
||||
* Wait until all background operations are finished. (E.g. GPU operations)
|
||||
*/
|
||||
void (*wait_for_finish)(struct _lv_draw_ctx_t * draw);
|
||||
void (*wait_for_finish)(struct _lv_draw_ctx_t * draw_ctx);
|
||||
|
||||
/**
|
||||
* Copy an area from buffer to an other
|
||||
* @param draw_ctx pointer to a draw context
|
||||
* @param dest_buf copy the buffer into this buffer
|
||||
* @param dest_stride the width of the dest_buf in pixels
|
||||
* @param dest_area the destination area
|
||||
* @param src_buf copy from this buffer
|
||||
* @param src_stride the width of src_buf in pixels
|
||||
* @param src_area the source area.
|
||||
*
|
||||
* @note dest_area and src_area must have the same width and height
|
||||
* but can have different x and y position.
|
||||
* @note dest_area and src_area must be clipped to the real dimensions of the buffers
|
||||
*/
|
||||
void (*buffer_copy)(struct _lv_draw_ctx_t * draw_ctx, void * dest_buf, lv_coord_t dest_stride,
|
||||
const lv_area_t * dest_area,
|
||||
void * src_buf, lv_coord_t src_stride, const lv_area_t * src_area);
|
||||
|
||||
/**
|
||||
* Initialize a new layer context.
|
||||
* The original buffer and area data are already saved from `draw_ctx` to `layer_ctx`
|
||||
* @param draw_ctx pointer to the current draw context
|
||||
* @param layer_area the coordinates of the layer
|
||||
* @param flags OR-ed flags from @lv_draw_layer_flags_t
|
||||
* @return pointer to the layer context, or NULL on error
|
||||
*/
|
||||
struct _lv_draw_layer_ctx_t * (*layer_init)(struct _lv_draw_ctx_t * draw_ctx, struct _lv_draw_layer_ctx_t * layer_ctx,
|
||||
lv_draw_layer_flags_t flags);
|
||||
|
||||
/**
|
||||
* Adjust the layer_ctx and/or draw_ctx based on the `layer_ctx->area_act`.
|
||||
* It's called only if flags has `LV_DRAW_LAYER_FLAG_CAN_SUBDIVIDE`
|
||||
* @param draw_ctx pointer to the current draw context
|
||||
* @param layer_ctx pointer to a layer context
|
||||
* @param flags OR-ed flags from @lv_draw_layer_flags_t
|
||||
*/
|
||||
void (*layer_adjust)(struct _lv_draw_ctx_t * draw_ctx, struct _lv_draw_layer_ctx_t * layer_ctx,
|
||||
lv_draw_layer_flags_t flags);
|
||||
|
||||
/**
|
||||
* Blend a rendered layer to `layer_ctx->area_act`
|
||||
* @param draw_ctx pointer to the current draw context
|
||||
* @param layer_ctx pointer to a layer context
|
||||
* @param draw_dsc pointer to an image draw descriptor
|
||||
*/
|
||||
void (*layer_blend)(struct _lv_draw_ctx_t * draw_ctx, struct _lv_draw_layer_ctx_t * layer_ctx,
|
||||
const lv_draw_img_dsc_t * draw_dsc);
|
||||
|
||||
/**
|
||||
* Destroy a layer context. The original buffer and area data of the `draw_ctx` will be restored
|
||||
* and the `layer_ctx` itself will be freed automatically.
|
||||
* @param draw_ctx pointer to the current draw context
|
||||
* @param layer_ctx pointer to a layer context
|
||||
*/
|
||||
void (*layer_destroy)(struct _lv_draw_ctx_t * draw_ctx, lv_draw_layer_ctx_t * layer_ctx);
|
||||
|
||||
/**
|
||||
* Size of a layer context in bytes.
|
||||
*/
|
||||
size_t layer_instance_size;
|
||||
|
||||
#if LV_USE_USER_DATA
|
||||
void * user_data;
|
||||
@ -102,6 +196,9 @@ typedef struct _lv_draw_ctx_t {
|
||||
|
||||
void lv_draw_init(void);
|
||||
|
||||
|
||||
void lv_draw_wait_for_finish(lv_draw_ctx_t * draw_ctx);
|
||||
|
||||
/**********************
|
||||
* GLOBAL VARIABLES
|
||||
**********************/
|
||||
|
@ -5,6 +5,8 @@ CSRCS += lv_draw_label.c
|
||||
CSRCS += lv_draw_line.c
|
||||
CSRCS += lv_draw_mask.c
|
||||
CSRCS += lv_draw_rect.c
|
||||
CSRCS += lv_draw_transform.c
|
||||
CSRCS += lv_draw_layer.c
|
||||
CSRCS += lv_draw_triangle.c
|
||||
CSRCS += lv_img_buf.c
|
||||
CSRCS += lv_img_cache.c
|
||||
@ -15,4 +17,9 @@ VPATH += :$(LVGL_DIR)/$(LVGL_DIR_NAME)/src/draw
|
||||
|
||||
CFLAGS += "-I$(LVGL_DIR)/$(LVGL_DIR_NAME)/src/draw"
|
||||
|
||||
include $(LVGL_DIR)/$(LVGL_DIR_NAME)/src/draw/arm2d/lv_draw_arm2d.mk
|
||||
include $(LVGL_DIR)/$(LVGL_DIR_NAME)/src/draw/nxp/lv_draw_nxp.mk
|
||||
include $(LVGL_DIR)/$(LVGL_DIR_NAME)/src/draw/sdl/lv_draw_sdl.mk
|
||||
include $(LVGL_DIR)/$(LVGL_DIR_NAME)/src/draw/stm32_dma2d/lv_draw_stm32_dma2d.mk
|
||||
include $(LVGL_DIR)/$(LVGL_DIR_NAME)/src/draw/sw/lv_draw_sw.mk
|
||||
include $(LVGL_DIR)/$(LVGL_DIR_NAME)/src/draw/swm341_dma2d/lv_draw_swm341_dma2d.mk
|
||||
|
@ -236,12 +236,21 @@ LV_ATTRIBUTE_FAST_MEM static lv_res_t decode_and_draw(lv_draw_ctx_t * draw_ctx,
|
||||
|
||||
if(cdsc == NULL) return LV_RES_INV;
|
||||
|
||||
|
||||
lv_img_cf_t cf;
|
||||
if(lv_img_cf_is_chroma_keyed(cdsc->dec_dsc.header.cf)) cf = LV_IMG_CF_TRUE_COLOR_CHROMA_KEYED;
|
||||
else if(LV_IMG_CF_ALPHA_8BIT == cdsc->dec_dsc.header.cf) cf = LV_IMG_CF_ALPHA_8BIT;
|
||||
else if(LV_IMG_CF_RGB565A8 == cdsc->dec_dsc.header.cf) cf = LV_IMG_CF_RGB565A8;
|
||||
else if(lv_img_cf_has_alpha(cdsc->dec_dsc.header.cf)) cf = LV_IMG_CF_TRUE_COLOR_ALPHA;
|
||||
else cf = LV_IMG_CF_TRUE_COLOR;
|
||||
|
||||
if(cf == LV_IMG_CF_ALPHA_8BIT) {
|
||||
if(draw_dsc->angle || draw_dsc->zoom != LV_IMG_ZOOM_NONE) {
|
||||
/* resume normal method */
|
||||
cf = LV_IMG_CF_TRUE_COLOR_ALPHA;
|
||||
cdsc->dec_dsc.img_data = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
if(cdsc->dec_dsc.error_msg != NULL) {
|
||||
LV_LOG_WARN("Image draw error");
|
||||
|
||||
|
@ -31,7 +31,7 @@ extern "C" {
|
||||
|
||||
typedef struct {
|
||||
|
||||
uint16_t angle;
|
||||
int16_t angle;
|
||||
uint16_t zoom;
|
||||
lv_point_t pivot;
|
||||
|
||||
|
@ -202,7 +202,7 @@ LV_ATTRIBUTE_FAST_MEM void lv_draw_label(lv_draw_ctx_t * draw_ctx, const lv_draw
|
||||
cmd_state_t cmd_state = CMD_STATE_WAIT;
|
||||
uint32_t i;
|
||||
uint32_t par_start = 0;
|
||||
lv_color_t recolor;
|
||||
lv_color_t recolor = lv_color_black();
|
||||
lv_color_t color = lv_color_black();
|
||||
int32_t letter_w;
|
||||
|
||||
|
93
lib/libesp32_lvgl/lvgl/src/draw/lv_draw_layer.c
Normal file
93
lib/libesp32_lvgl/lvgl/src/draw/lv_draw_layer.c
Normal file
@ -0,0 +1,93 @@
|
||||
/**
|
||||
* @file lv_draw_layer.c
|
||||
*
|
||||
*/
|
||||
|
||||
/*********************
|
||||
* INCLUDES
|
||||
*********************/
|
||||
#include "lv_draw.h"
|
||||
#include "lv_draw_arc.h"
|
||||
#include "../core/lv_refr.h"
|
||||
|
||||
/*********************
|
||||
* DEFINES
|
||||
*********************/
|
||||
|
||||
/**********************
|
||||
* TYPEDEFS
|
||||
**********************/
|
||||
|
||||
/**********************
|
||||
* STATIC PROTOTYPES
|
||||
**********************/
|
||||
|
||||
/**********************
|
||||
* STATIC VARIABLES
|
||||
**********************/
|
||||
|
||||
/**********************
|
||||
* MACROS
|
||||
**********************/
|
||||
|
||||
/**********************
|
||||
* GLOBAL FUNCTIONS
|
||||
**********************/
|
||||
|
||||
lv_draw_layer_ctx_t * lv_draw_layer_create(lv_draw_ctx_t * draw_ctx, const lv_area_t * layer_area,
|
||||
lv_draw_layer_flags_t flags)
|
||||
{
|
||||
if(draw_ctx->layer_init == NULL) return NULL;
|
||||
|
||||
lv_draw_layer_ctx_t * layer_ctx = lv_mem_alloc(draw_ctx->layer_instance_size);
|
||||
LV_ASSERT_MALLOC(layer_ctx);
|
||||
if(layer_ctx == NULL) {
|
||||
LV_LOG_WARN("Couldn't allocate a new layer context");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
lv_memset_00(layer_ctx, draw_ctx->layer_instance_size);
|
||||
|
||||
lv_disp_t * disp_refr = _lv_refr_get_disp_refreshing();
|
||||
layer_ctx->original.buf = draw_ctx->buf;
|
||||
layer_ctx->original.buf_area = draw_ctx->buf_area;
|
||||
layer_ctx->original.clip_area = draw_ctx->clip_area;
|
||||
layer_ctx->original.screen_transp = disp_refr->driver->screen_transp;
|
||||
layer_ctx->area_full = *layer_area;
|
||||
|
||||
lv_draw_layer_ctx_t * init_layer_ctx = draw_ctx->layer_init(draw_ctx, layer_ctx, flags);
|
||||
if(NULL == init_layer_ctx) {
|
||||
lv_mem_free(layer_ctx);
|
||||
}
|
||||
return init_layer_ctx;
|
||||
}
|
||||
|
||||
void lv_draw_layer_adjust(struct _lv_draw_ctx_t * draw_ctx, struct _lv_draw_layer_ctx_t * layer_ctx,
|
||||
lv_draw_layer_flags_t flags)
|
||||
{
|
||||
if(draw_ctx->layer_adjust) draw_ctx->layer_adjust(draw_ctx, layer_ctx, flags);
|
||||
}
|
||||
|
||||
void lv_draw_layer_blend(struct _lv_draw_ctx_t * draw_ctx, struct _lv_draw_layer_ctx_t * layer_ctx,
|
||||
lv_draw_img_dsc_t * draw_dsc)
|
||||
{
|
||||
if(draw_ctx->layer_blend) draw_ctx->layer_blend(draw_ctx, layer_ctx, draw_dsc);
|
||||
}
|
||||
|
||||
void lv_draw_layer_destroy(lv_draw_ctx_t * draw_ctx, lv_draw_layer_ctx_t * layer_ctx)
|
||||
{
|
||||
|
||||
lv_draw_wait_for_finish(draw_ctx);
|
||||
draw_ctx->buf = layer_ctx->original.buf;
|
||||
draw_ctx->buf_area = layer_ctx->original.buf_area;
|
||||
draw_ctx->clip_area = layer_ctx->original.clip_area;
|
||||
lv_disp_t * disp_refr = _lv_refr_get_disp_refreshing();
|
||||
disp_refr->driver->screen_transp = layer_ctx->original.screen_transp;
|
||||
|
||||
if(draw_ctx->layer_destroy) draw_ctx->layer_destroy(draw_ctx, layer_ctx);
|
||||
lv_mem_free(layer_ctx);
|
||||
}
|
||||
|
||||
/**********************
|
||||
* STATIC FUNCTIONS
|
||||
**********************/
|
83
lib/libesp32_lvgl/lvgl/src/draw/lv_draw_layer.h
Normal file
83
lib/libesp32_lvgl/lvgl/src/draw/lv_draw_layer.h
Normal file
@ -0,0 +1,83 @@
|
||||
/**
|
||||
* @file lv_draw_layer.h
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef LV_DRAW_LAYER_H
|
||||
#define LV_DRAW_LAYER_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*********************
|
||||
* INCLUDES
|
||||
*********************/
|
||||
#include "../lv_conf_internal.h"
|
||||
|
||||
/*********************
|
||||
* DEFINES
|
||||
*********************/
|
||||
|
||||
/**********************
|
||||
* TYPEDEFS
|
||||
**********************/
|
||||
struct _lv_draw_ctx_t;
|
||||
struct _lv_draw_layer_ctx_t;
|
||||
|
||||
typedef enum {
|
||||
LV_DRAW_LAYER_FLAG_NONE,
|
||||
LV_DRAW_LAYER_FLAG_HAS_ALPHA,
|
||||
LV_DRAW_LAYER_FLAG_CAN_SUBDIVIDE,
|
||||
} lv_draw_layer_flags_t;
|
||||
|
||||
/**********************
|
||||
* GLOBAL PROTOTYPES
|
||||
**********************/
|
||||
|
||||
/**
|
||||
* Create a new layer context. It is used to start and independent rendering session
|
||||
* with the current draw_ctx
|
||||
* @param draw_ctx pointer to the current draw context
|
||||
* @param layer_area the coordinates of the layer
|
||||
* @param flags OR-ed flags from @lv_draw_layer_flags_t
|
||||
* @return pointer to the layer context, or NULL on error
|
||||
*/
|
||||
struct _lv_draw_layer_ctx_t * lv_draw_layer_create(struct _lv_draw_ctx_t * draw_ctx, const lv_area_t * layer_area,
|
||||
lv_draw_layer_flags_t flags);
|
||||
|
||||
/**
|
||||
* Adjust the layer_ctx and/or draw_ctx based on the `layer_ctx->area_act`.
|
||||
* It's called only if flags has `LV_DRAW_LAYER_FLAG_CAN_SUBDIVIDE`
|
||||
* @param draw_ctx pointer to the current draw context
|
||||
* @param layer_ctx pointer to a layer context
|
||||
* @param flags OR-ed flags from @lv_draw_layer_flags_t
|
||||
*/
|
||||
void lv_draw_layer_adjust(struct _lv_draw_ctx_t * draw_ctx, struct _lv_draw_layer_ctx_t * layer_ctx,
|
||||
lv_draw_layer_flags_t flags);
|
||||
|
||||
/**
|
||||
* Blend a rendered layer to `layer_ctx->area_act`
|
||||
* @param draw_ctx pointer to the current draw context
|
||||
* @param layer_ctx pointer to a layer context
|
||||
* @param draw_dsc pointer to an image draw descriptor
|
||||
*/
|
||||
void lv_draw_layer_blend(struct _lv_draw_ctx_t * draw_ctx, struct _lv_draw_layer_ctx_t * layer_ctx,
|
||||
lv_draw_img_dsc_t * draw_dsc);
|
||||
|
||||
/**
|
||||
* Destroy a layer context.
|
||||
* @param draw_ctx pointer to the current draw context
|
||||
* @param layer_ctx pointer to a layer context
|
||||
*/
|
||||
void lv_draw_layer_destroy(struct _lv_draw_ctx_t * draw_ctx, struct _lv_draw_layer_ctx_t * layer_ctx);
|
||||
|
||||
/**********************
|
||||
* MACROS
|
||||
**********************/
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /*extern "C"*/
|
||||
#endif
|
||||
|
||||
#endif /*LV_DRAW_LAYER_H*/
|
@ -202,7 +202,7 @@ void * lv_draw_mask_remove_custom(void * custom_id)
|
||||
|
||||
/**
|
||||
* Free the data from the parameter.
|
||||
* It's called inside `lv_draw_mask_remove_id` and `lv_draw_mask_remove_custom`
|
||||
* It's called inside `lv_draw_mask_remove_id` and `lv_draw_mask_remove_custom`
|
||||
* Needs to be called only in special cases when the mask is not added by `lv_draw_mask_add`
|
||||
* and not removed by `lv_draw_mask_remove_id` or `lv_draw_mask_remove_custom`
|
||||
* @param p pointer to a mask parameter
|
||||
@ -446,9 +446,6 @@ void lv_draw_mask_angle_init(lv_draw_mask_angle_param_t * param, lv_coord_t vert
|
||||
if(start_angle >= 0 && start_angle < 180) {
|
||||
start_side = LV_DRAW_MASK_LINE_SIDE_LEFT;
|
||||
}
|
||||
else if(start_angle >= 180 && start_angle < 360) {
|
||||
start_side = LV_DRAW_MASK_LINE_SIDE_RIGHT;
|
||||
}
|
||||
else
|
||||
start_side = LV_DRAW_MASK_LINE_SIDE_RIGHT; /*silence compiler*/
|
||||
|
||||
|
@ -280,7 +280,7 @@ void * lv_draw_mask_remove_custom(void * custom_id);
|
||||
|
||||
/**
|
||||
* Free the data from the parameter.
|
||||
* It's called inside `lv_draw_mask_remove_id` and `lv_draw_mask_remove_custom`
|
||||
* It's called inside `lv_draw_mask_remove_id` and `lv_draw_mask_remove_custom`
|
||||
* Needs to be called only in special cases when the mask is not added by `lv_draw_mask_add`
|
||||
* and not removed by `lv_draw_mask_remove_id` or `lv_draw_mask_remove_custom`
|
||||
* @param p pointer to a mask parameter
|
||||
|
@ -38,9 +38,7 @@ LV_ATTRIBUTE_FAST_MEM void lv_draw_rect_dsc_init(lv_draw_rect_dsc_t * dsc)
|
||||
{
|
||||
lv_memset_00(dsc, sizeof(lv_draw_rect_dsc_t));
|
||||
dsc->bg_color = lv_color_white();
|
||||
#if __STDC_VERSION__ < 201112L
|
||||
dsc->bg_grad.stops[0].color = lv_color_white();
|
||||
#endif
|
||||
dsc->bg_grad.stops[1].color = lv_color_black();
|
||||
dsc->bg_grad.stops[1].frac = 0xFF;
|
||||
dsc->bg_grad.stops_count = 2;
|
||||
|
@ -35,14 +35,8 @@ typedef struct {
|
||||
|
||||
/*Background*/
|
||||
lv_opa_t bg_opa;
|
||||
#if __STDC_VERSION__ >= 201112L
|
||||
union {
|
||||
#endif
|
||||
lv_color_t bg_color; /**< First element of a gradient is a color, so it maps well here*/
|
||||
lv_grad_dsc_t bg_grad;
|
||||
#if __STDC_VERSION__ >= 201112L
|
||||
};
|
||||
#endif
|
||||
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_img_src;
|
||||
|
54
lib/libesp32_lvgl/lvgl/src/draw/lv_draw_transform.c
Normal file
54
lib/libesp32_lvgl/lvgl/src/draw/lv_draw_transform.c
Normal file
@ -0,0 +1,54 @@
|
||||
/**
|
||||
* @file lv_draw_transform.c
|
||||
*
|
||||
*/
|
||||
|
||||
/*********************
|
||||
* INCLUDES
|
||||
*********************/
|
||||
#include "lv_draw.h"
|
||||
#include "lv_draw_transform.h"
|
||||
#include "../misc/lv_assert.h"
|
||||
#include "../misc/lv_area.h"
|
||||
|
||||
/*********************
|
||||
* DEFINES
|
||||
*********************/
|
||||
|
||||
/**********************
|
||||
* TYPEDEFS
|
||||
**********************/
|
||||
|
||||
/**********************
|
||||
* STATIC PROTOTYPES
|
||||
**********************/
|
||||
|
||||
/**********************
|
||||
* STATIC VARIABLES
|
||||
**********************/
|
||||
|
||||
/**********************
|
||||
* MACROS
|
||||
**********************/
|
||||
|
||||
/**********************
|
||||
* GLOBAL FUNCTIONS
|
||||
**********************/
|
||||
void lv_draw_transform(lv_draw_ctx_t * draw_ctx, const lv_area_t * dest_area, const void * src_buf, lv_coord_t src_w,
|
||||
lv_coord_t src_h,
|
||||
lv_coord_t src_stride, const lv_draw_img_dsc_t * draw_dsc, lv_img_cf_t cf, lv_color_t * cbuf, lv_opa_t * abuf)
|
||||
{
|
||||
LV_ASSERT_NULL(draw_ctx);
|
||||
if(draw_ctx->draw_transform == NULL) {
|
||||
LV_LOG_WARN("draw_ctx->draw_transform == NULL");
|
||||
return;
|
||||
}
|
||||
|
||||
draw_ctx->draw_transform(draw_ctx, dest_area, src_buf, src_w, src_h, src_stride, draw_dsc, cf, cbuf, abuf);
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**********************
|
||||
* STATIC FUNCTIONS
|
||||
**********************/
|
44
lib/libesp32_lvgl/lvgl/src/draw/lv_draw_transform.h
Normal file
44
lib/libesp32_lvgl/lvgl/src/draw/lv_draw_transform.h
Normal file
@ -0,0 +1,44 @@
|
||||
/**
|
||||
* @file lv_draw_transform.h
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef LV_DRAW_TRANSFORM_H
|
||||
#define LV_DRAW_TRANSFORM_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*********************
|
||||
* INCLUDES
|
||||
*********************/
|
||||
#include "../lv_conf_internal.h"
|
||||
#include "../misc/lv_area.h"
|
||||
|
||||
/*********************
|
||||
* DEFINES
|
||||
*********************/
|
||||
|
||||
/**********************
|
||||
* TYPEDEFS
|
||||
**********************/
|
||||
struct _lv_draw_ctx_t;
|
||||
|
||||
/**********************
|
||||
* GLOBAL PROTOTYPES
|
||||
**********************/
|
||||
|
||||
void lv_draw_transform(struct _lv_draw_ctx_t * draw_ctx, const lv_area_t * dest_area, const void * src_buf,
|
||||
lv_coord_t src_w, lv_coord_t src_h,
|
||||
lv_coord_t src_stride, const lv_draw_img_dsc_t * draw_dsc, lv_img_cf_t cf, lv_color_t * cbuf, lv_opa_t * abuf);
|
||||
|
||||
/**********************
|
||||
* MACROS
|
||||
**********************/
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /*extern "C"*/
|
||||
#endif
|
||||
|
||||
#endif /*LV_DRAW_TRANSFORM_H*/
|
@ -54,7 +54,7 @@ lv_color_t lv_img_buf_get_px_color(lv_img_dsc_t * dsc, lv_coord_t x, lv_coord_t
|
||||
uint8_t * buf_u8 = (uint8_t *)dsc->data;
|
||||
|
||||
if(dsc->header.cf == LV_IMG_CF_TRUE_COLOR || dsc->header.cf == LV_IMG_CF_TRUE_COLOR_CHROMA_KEYED ||
|
||||
dsc->header.cf == LV_IMG_CF_TRUE_COLOR_ALPHA) {
|
||||
dsc->header.cf == LV_IMG_CF_TRUE_COLOR_ALPHA || dsc->header.cf == LV_IMG_CF_RGB565A8) {
|
||||
uint8_t px_size = lv_img_cf_get_px_size(dsc->header.cf) >> 3;
|
||||
uint32_t px = dsc->header.w * y * px_size + x * px_size;
|
||||
lv_memcpy_small(&p_color, &buf_u8[px], sizeof(lv_color_t));
|
||||
@ -386,6 +386,7 @@ uint32_t lv_img_buf_get_img_size(lv_coord_t w, lv_coord_t h, lv_img_cf_t cf)
|
||||
case LV_IMG_CF_TRUE_COLOR:
|
||||
return LV_IMG_BUF_SIZE_TRUE_COLOR(w, h);
|
||||
case LV_IMG_CF_TRUE_COLOR_ALPHA:
|
||||
case LV_IMG_CF_RGB565A8:
|
||||
return LV_IMG_BUF_SIZE_TRUE_COLOR_ALPHA(w, h);
|
||||
case LV_IMG_CF_TRUE_COLOR_CHROMA_KEYED:
|
||||
return LV_IMG_BUF_SIZE_TRUE_COLOR_CHROMA_KEYED(w, h);
|
||||
@ -410,58 +411,6 @@ uint32_t lv_img_buf_get_img_size(lv_coord_t w, lv_coord_t h, lv_img_cf_t cf)
|
||||
}
|
||||
}
|
||||
|
||||
#if LV_DRAW_COMPLEX
|
||||
/**
|
||||
* Initialize a descriptor to transform an image
|
||||
* @param dsc pointer to an `lv_img_transform_dsc_t` variable whose `cfg` field is initialized
|
||||
*/
|
||||
void _lv_img_buf_transform_init(lv_img_transform_dsc_t * dsc)
|
||||
{
|
||||
dsc->tmp.pivot_x_256 = dsc->cfg.pivot_x * 256;
|
||||
dsc->tmp.pivot_y_256 = dsc->cfg.pivot_y * 256;
|
||||
|
||||
int32_t angle_low = dsc->cfg.angle / 10;
|
||||
int32_t angle_high = angle_low + 1;
|
||||
int32_t angle_rem = dsc->cfg.angle - (angle_low * 10);
|
||||
|
||||
int32_t s1 = lv_trigo_sin(-angle_low);
|
||||
int32_t s2 = lv_trigo_sin(-angle_high);
|
||||
|
||||
int32_t c1 = lv_trigo_sin(-angle_low + 90);
|
||||
int32_t c2 = lv_trigo_sin(-angle_high + 90);
|
||||
|
||||
dsc->tmp.sinma = (s1 * (10 - angle_rem) + s2 * angle_rem) / 10;
|
||||
dsc->tmp.cosma = (c1 * (10 - angle_rem) + c2 * angle_rem) / 10;
|
||||
|
||||
/*Use smaller value to avoid overflow*/
|
||||
dsc->tmp.sinma = dsc->tmp.sinma >> (LV_TRIGO_SHIFT - _LV_TRANSFORM_TRIGO_SHIFT);
|
||||
dsc->tmp.cosma = dsc->tmp.cosma >> (LV_TRIGO_SHIFT - _LV_TRANSFORM_TRIGO_SHIFT);
|
||||
|
||||
dsc->tmp.chroma_keyed = lv_img_cf_is_chroma_keyed(dsc->cfg.cf) ? 1 : 0;
|
||||
dsc->tmp.has_alpha = lv_img_cf_has_alpha(dsc->cfg.cf) ? 1 : 0;
|
||||
if(dsc->cfg.cf == LV_IMG_CF_TRUE_COLOR || dsc->cfg.cf == LV_IMG_CF_TRUE_COLOR_ALPHA ||
|
||||
dsc->cfg.cf == LV_IMG_CF_TRUE_COLOR_CHROMA_KEYED) {
|
||||
dsc->tmp.native_color = 1;
|
||||
}
|
||||
else {
|
||||
dsc->tmp.native_color = 0;
|
||||
}
|
||||
|
||||
dsc->tmp.img_dsc.data = dsc->cfg.src;
|
||||
dsc->tmp.img_dsc.header.always_zero = 0;
|
||||
dsc->tmp.img_dsc.header.cf = dsc->cfg.cf;
|
||||
dsc->tmp.img_dsc.header.w = dsc->cfg.src_w;
|
||||
dsc->tmp.img_dsc.header.h = dsc->cfg.src_h;
|
||||
|
||||
/*The inverse of the zoom will be sued during the transformation
|
||||
* + dsc->cfg.zoom / 2 for rounding*/
|
||||
dsc->tmp.zoom_inv = (((256 * 256) << _LV_ZOOM_INV_UPSCALE) + dsc->cfg.zoom / 2) / dsc->cfg.zoom;
|
||||
|
||||
dsc->res.opa = LV_OPA_COVER;
|
||||
dsc->res.color = dsc->cfg.color;
|
||||
}
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Get the area of a rectangle if its rotated and scaled
|
||||
* @param res store the coordinates here
|
||||
@ -483,68 +432,21 @@ void _lv_img_buf_get_transformed_area(lv_area_t * res, lv_coord_t w, lv_coord_t
|
||||
return;
|
||||
}
|
||||
|
||||
res->x1 = (((int32_t)(-pivot->x) * zoom) >> 8) - 1;
|
||||
res->y1 = (((int32_t)(-pivot->y) * zoom) >> 8) - 1;
|
||||
res->x2 = (((int32_t)(w - pivot->x) * zoom) >> 8) + 2;
|
||||
res->y2 = (((int32_t)(h - pivot->y) * zoom) >> 8) + 2;
|
||||
lv_point_t p[4] = {
|
||||
{0, 0},
|
||||
{w, 0},
|
||||
{0, h},
|
||||
{w, h},
|
||||
};
|
||||
lv_point_transform(&p[0], angle, zoom, pivot);
|
||||
lv_point_transform(&p[1], angle, zoom, pivot);
|
||||
lv_point_transform(&p[2], angle, zoom, pivot);
|
||||
lv_point_transform(&p[3], angle, zoom, pivot);
|
||||
res->x1 = LV_MIN4(p[0].x, p[1].x, p[2].x, p[3].x) - 2;
|
||||
res->x2 = LV_MAX4(p[0].x, p[1].x, p[2].x, p[3].x) + 2;
|
||||
res->y1 = LV_MIN4(p[0].y, p[1].y, p[2].y, p[3].y) - 2;
|
||||
res->y2 = LV_MAX4(p[0].y, p[1].y, p[2].y, p[3].y) + 2;
|
||||
|
||||
if(angle == 0) {
|
||||
res->x1 += pivot->x;
|
||||
res->y1 += pivot->y;
|
||||
res->x2 += pivot->x;
|
||||
res->y2 += pivot->y;
|
||||
return;
|
||||
}
|
||||
|
||||
int32_t angle_low = angle / 10;
|
||||
int32_t angle_high = angle_low + 1;
|
||||
int32_t angle_rem = angle - (angle_low * 10);
|
||||
|
||||
int32_t s1 = lv_trigo_sin(angle_low);
|
||||
int32_t s2 = lv_trigo_sin(angle_high);
|
||||
|
||||
int32_t c1 = lv_trigo_sin(angle_low + 90);
|
||||
int32_t c2 = lv_trigo_sin(angle_high + 90);
|
||||
|
||||
int32_t sinma = (s1 * (10 - angle_rem) + s2 * angle_rem) / 10;
|
||||
int32_t cosma = (c1 * (10 - angle_rem) + c2 * angle_rem) / 10;
|
||||
|
||||
/*Use smaller value to avoid overflow*/
|
||||
sinma = sinma >> (LV_TRIGO_SHIFT - _LV_TRANSFORM_TRIGO_SHIFT);
|
||||
cosma = cosma >> (LV_TRIGO_SHIFT - _LV_TRANSFORM_TRIGO_SHIFT);
|
||||
|
||||
lv_point_t lt;
|
||||
lv_point_t rt;
|
||||
lv_point_t lb;
|
||||
lv_point_t rb;
|
||||
|
||||
lv_coord_t xt;
|
||||
lv_coord_t yt;
|
||||
|
||||
xt = res->x1;
|
||||
yt = res->y1;
|
||||
lt.x = ((cosma * xt - sinma * yt) >> _LV_TRANSFORM_TRIGO_SHIFT) + pivot->x;
|
||||
lt.y = ((sinma * xt + cosma * yt) >> _LV_TRANSFORM_TRIGO_SHIFT) + pivot->y;
|
||||
|
||||
xt = res->x2;
|
||||
yt = res->y1;
|
||||
rt.x = ((cosma * xt - sinma * yt) >> _LV_TRANSFORM_TRIGO_SHIFT) + pivot->x;
|
||||
rt.y = ((sinma * xt + cosma * yt) >> _LV_TRANSFORM_TRIGO_SHIFT) + pivot->y;
|
||||
|
||||
xt = res->x1;
|
||||
yt = res->y2;
|
||||
lb.x = ((cosma * xt - sinma * yt) >> _LV_TRANSFORM_TRIGO_SHIFT) + pivot->x;
|
||||
lb.y = ((sinma * xt + cosma * yt) >> _LV_TRANSFORM_TRIGO_SHIFT) + pivot->y;
|
||||
|
||||
xt = res->x2;
|
||||
yt = res->y2;
|
||||
rb.x = ((cosma * xt - sinma * yt) >> _LV_TRANSFORM_TRIGO_SHIFT) + pivot->x;
|
||||
rb.y = ((sinma * xt + cosma * yt) >> _LV_TRANSFORM_TRIGO_SHIFT) + pivot->y;
|
||||
|
||||
res->x1 = LV_MIN4(lb.x, lt.x, rb.x, rt.x);
|
||||
res->x2 = LV_MAX4(lb.x, lt.x, rb.x, rt.x);
|
||||
res->y1 = LV_MIN4(lb.y, lt.y, rb.y, rt.y);
|
||||
res->y2 = LV_MAX4(lb.y, lt.y, rb.y, rt.y);
|
||||
#else
|
||||
LV_UNUSED(angle);
|
||||
LV_UNUSED(zoom);
|
||||
@ -556,217 +458,6 @@ void _lv_img_buf_get_transformed_area(lv_area_t * res, lv_coord_t w, lv_coord_t
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
#if LV_DRAW_COMPLEX
|
||||
/**
|
||||
* Get which color and opa would come to a pixel if it were rotated
|
||||
* @param dsc a descriptor initialized by `lv_img_buf_rotate_init`
|
||||
* @param x the coordinate which color and opa should be get
|
||||
* @param y the coordinate which color and opa should be get
|
||||
* @return true: there is valid pixel on these x/y coordinates; false: the rotated pixel was out of the image
|
||||
* @note the result is written back to `dsc->res_color` and `dsc->res_opa`
|
||||
*/
|
||||
bool _lv_img_buf_transform(lv_img_transform_dsc_t * dsc, lv_coord_t x, lv_coord_t y)
|
||||
{
|
||||
const uint8_t * src_u8 = (const uint8_t *)dsc->cfg.src;
|
||||
|
||||
/*Get the target point relative coordinates to the pivot*/
|
||||
int32_t xt = x - dsc->cfg.pivot_x;
|
||||
int32_t yt = y - dsc->cfg.pivot_y;
|
||||
|
||||
int32_t xs;
|
||||
int32_t ys;
|
||||
if(dsc->cfg.zoom == LV_IMG_ZOOM_NONE) {
|
||||
/*Get the source pixel from the upscaled image*/
|
||||
xs = ((dsc->tmp.cosma * xt - dsc->tmp.sinma * yt) >> (_LV_TRANSFORM_TRIGO_SHIFT - 8)) + dsc->tmp.pivot_x_256;
|
||||
ys = ((dsc->tmp.sinma * xt + dsc->tmp.cosma * yt) >> (_LV_TRANSFORM_TRIGO_SHIFT - 8)) + dsc->tmp.pivot_y_256;
|
||||
}
|
||||
else if(dsc->cfg.angle == 0) {
|
||||
xt = (int32_t)((int32_t)xt * dsc->tmp.zoom_inv) >> _LV_ZOOM_INV_UPSCALE;
|
||||
yt = (int32_t)((int32_t)yt * dsc->tmp.zoom_inv) >> _LV_ZOOM_INV_UPSCALE;
|
||||
xs = xt + dsc->tmp.pivot_x_256;
|
||||
ys = yt + dsc->tmp.pivot_y_256;
|
||||
}
|
||||
else {
|
||||
xt = (int32_t)((int32_t)xt * dsc->tmp.zoom_inv) >> _LV_ZOOM_INV_UPSCALE;
|
||||
yt = (int32_t)((int32_t)yt * dsc->tmp.zoom_inv) >> _LV_ZOOM_INV_UPSCALE;
|
||||
xs = ((dsc->tmp.cosma * xt - dsc->tmp.sinma * yt) >> (_LV_TRANSFORM_TRIGO_SHIFT)) + dsc->tmp.pivot_x_256;
|
||||
ys = ((dsc->tmp.sinma * xt + dsc->tmp.cosma * yt) >> (_LV_TRANSFORM_TRIGO_SHIFT)) + dsc->tmp.pivot_y_256;
|
||||
}
|
||||
|
||||
/*Get the integer part of the source pixel*/
|
||||
int32_t xs_int = xs >> 8;
|
||||
int32_t ys_int = ys >> 8;
|
||||
|
||||
if(xs_int >= dsc->cfg.src_w) return false;
|
||||
else if(xs_int < 0) return false;
|
||||
|
||||
if(ys_int >= dsc->cfg.src_h) return false;
|
||||
else if(ys_int < 0) return false;
|
||||
|
||||
uint8_t px_size;
|
||||
uint32_t pxi;
|
||||
if(dsc->tmp.native_color) {
|
||||
if(dsc->tmp.has_alpha == 0) {
|
||||
px_size = LV_COLOR_SIZE >> 3;
|
||||
|
||||
pxi = dsc->cfg.src_w * ys_int * px_size + xs_int * px_size;
|
||||
lv_memcpy_small(&dsc->res.color, &src_u8[pxi], px_size);
|
||||
}
|
||||
else {
|
||||
px_size = LV_IMG_PX_SIZE_ALPHA_BYTE;
|
||||
pxi = dsc->cfg.src_w * ys_int * px_size + xs_int * px_size;
|
||||
lv_memcpy_small(&dsc->res.color, &src_u8[pxi], px_size - 1);
|
||||
dsc->res.opa = src_u8[pxi + px_size - 1];
|
||||
}
|
||||
}
|
||||
else {
|
||||
pxi = 0; /*unused*/
|
||||
px_size = 0; /*unused*/
|
||||
dsc->res.color = lv_img_buf_get_px_color(&dsc->tmp.img_dsc, xs_int, ys_int, dsc->cfg.color);
|
||||
dsc->res.opa = lv_img_buf_get_px_alpha(&dsc->tmp.img_dsc, xs_int, ys_int);
|
||||
}
|
||||
|
||||
if(dsc->tmp.chroma_keyed) {
|
||||
lv_color_t ct = LV_COLOR_CHROMA_KEY;
|
||||
if(dsc->res.color.full == ct.full) return false;
|
||||
}
|
||||
|
||||
if(dsc->cfg.antialias == false) return true;
|
||||
|
||||
dsc->tmp.xs = xs;
|
||||
dsc->tmp.ys = ys;
|
||||
dsc->tmp.xs_int = xs_int;
|
||||
dsc->tmp.ys_int = ys_int;
|
||||
dsc->tmp.pxi = pxi;
|
||||
dsc->tmp.px_size = px_size;
|
||||
|
||||
bool ret;
|
||||
ret = _lv_img_buf_transform_anti_alias(dsc);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* Continue transformation by taking the neighbors into account
|
||||
* @param dsc pointer to the transformation descriptor
|
||||
*/
|
||||
bool _lv_img_buf_transform_anti_alias(lv_img_transform_dsc_t * dsc)
|
||||
{
|
||||
const uint8_t * src_u8 = dsc->cfg.src;
|
||||
|
||||
/*Get the fractional part of the source pixel*/
|
||||
int xs_fract = dsc->tmp.xs & 0xff;
|
||||
int ys_fract = dsc->tmp.ys & 0xff;
|
||||
int32_t xn; /*x neighbor*/
|
||||
lv_opa_t xr; /*x mix ratio*/
|
||||
|
||||
if(xs_fract < 0x70) {
|
||||
xn = - 1;
|
||||
if(dsc->tmp.xs_int + xn < 0) xn = 0;
|
||||
xr = xs_fract + 0x80;
|
||||
}
|
||||
else if(xs_fract > 0x90) {
|
||||
xn = 1;
|
||||
if(dsc->tmp.xs_int + xn >= dsc->cfg.src_w) xn = 0;
|
||||
xr = (0xFF - xs_fract) + 0x80;
|
||||
}
|
||||
else {
|
||||
xn = 0;
|
||||
xr = 0xFF;
|
||||
}
|
||||
|
||||
int32_t yn; /*x neighbor*/
|
||||
lv_opa_t yr; /*x mix ratio*/
|
||||
|
||||
if(ys_fract < 0x70) {
|
||||
yn = - 1;
|
||||
if(dsc->tmp.ys_int + yn < 0) yn = 0;
|
||||
|
||||
yr = ys_fract + 0x80;
|
||||
}
|
||||
else if(ys_fract > 0x90) {
|
||||
yn = 1;
|
||||
if(dsc->tmp.ys_int + yn >= dsc->cfg.src_h) yn = 0;
|
||||
|
||||
yr = (0xFF - ys_fract) + 0x80;
|
||||
}
|
||||
else {
|
||||
yn = 0;
|
||||
yr = 0xFF;
|
||||
}
|
||||
|
||||
lv_color_t c00 = dsc->res.color;
|
||||
lv_color_t c01;
|
||||
lv_color_t c10;
|
||||
lv_color_t c11;
|
||||
|
||||
lv_opa_t a00 = dsc->res.opa;
|
||||
lv_opa_t a10 = 0;
|
||||
lv_opa_t a01 = 0;
|
||||
lv_opa_t a11 = 0;
|
||||
|
||||
if(dsc->tmp.native_color) {
|
||||
lv_memcpy_small(&c01, &src_u8[dsc->tmp.pxi + dsc->tmp.px_size * xn], sizeof(lv_color_t));
|
||||
lv_memcpy_small(&c10, &src_u8[dsc->tmp.pxi + dsc->cfg.src_w * dsc->tmp.px_size * yn], sizeof(lv_color_t));
|
||||
lv_memcpy_small(&c11, &src_u8[dsc->tmp.pxi + dsc->cfg.src_w * dsc->tmp.px_size * yn + dsc->tmp.px_size * xn],
|
||||
sizeof(lv_color_t));
|
||||
if(dsc->tmp.has_alpha) {
|
||||
a10 = src_u8[dsc->tmp.pxi + dsc->tmp.px_size * xn + dsc->tmp.px_size - 1];
|
||||
a01 = src_u8[dsc->tmp.pxi + dsc->cfg.src_w * dsc->tmp.px_size * yn + dsc->tmp.px_size - 1];
|
||||
a11 = src_u8[dsc->tmp.pxi + dsc->cfg.src_w * dsc->tmp.px_size * yn + dsc->tmp.px_size * xn + dsc->tmp.px_size - 1];
|
||||
}
|
||||
}
|
||||
else {
|
||||
c01 = lv_img_buf_get_px_color(&dsc->tmp.img_dsc, dsc->tmp.xs_int + xn, dsc->tmp.ys_int, dsc->cfg.color);
|
||||
c10 = lv_img_buf_get_px_color(&dsc->tmp.img_dsc, dsc->tmp.xs_int, dsc->tmp.ys_int + yn, dsc->cfg.color);
|
||||
c11 = lv_img_buf_get_px_color(&dsc->tmp.img_dsc, dsc->tmp.xs_int + xn, dsc->tmp.ys_int + yn, dsc->cfg.color);
|
||||
|
||||
if(dsc->tmp.has_alpha) {
|
||||
a10 = lv_img_buf_get_px_alpha(&dsc->tmp.img_dsc, dsc->tmp.xs_int + xn, dsc->tmp.ys_int);
|
||||
a01 = lv_img_buf_get_px_alpha(&dsc->tmp.img_dsc, dsc->tmp.xs_int, dsc->tmp.ys_int + yn);
|
||||
a11 = lv_img_buf_get_px_alpha(&dsc->tmp.img_dsc, dsc->tmp.xs_int + xn, dsc->tmp.ys_int + yn);
|
||||
}
|
||||
}
|
||||
|
||||
lv_opa_t xr0 = xr;
|
||||
lv_opa_t xr1 = xr;
|
||||
if(dsc->tmp.has_alpha) {
|
||||
lv_opa_t a0 = (a00 * xr + (a10 * (255 - xr))) >> 8;
|
||||
lv_opa_t a1 = (a01 * xr + (a11 * (255 - xr))) >> 8;
|
||||
dsc->res.opa = (a0 * yr + (a1 * (255 - yr))) >> 8;
|
||||
|
||||
if(a0 <= LV_OPA_MIN && a1 <= LV_OPA_MIN) return false;
|
||||
if(a0 <= LV_OPA_MIN) yr = LV_OPA_TRANSP;
|
||||
if(a1 <= LV_OPA_MIN) yr = LV_OPA_COVER;
|
||||
if(a00 <= LV_OPA_MIN) xr0 = LV_OPA_TRANSP;
|
||||
if(a10 <= LV_OPA_MIN) xr0 = LV_OPA_COVER;
|
||||
if(a01 <= LV_OPA_MIN) xr1 = LV_OPA_TRANSP;
|
||||
if(a11 <= LV_OPA_MIN) xr1 = LV_OPA_COVER;
|
||||
}
|
||||
else {
|
||||
xr0 = xr;
|
||||
xr1 = xr;
|
||||
dsc->res.opa = LV_OPA_COVER;
|
||||
}
|
||||
|
||||
lv_color_t c0;
|
||||
if(xr0 == LV_OPA_TRANSP) c0 = c01;
|
||||
else if(xr0 == LV_OPA_COVER) c0 = c00;
|
||||
else c0 = lv_color_mix(c00, c01, xr0);
|
||||
|
||||
lv_color_t c1;
|
||||
if(xr1 == LV_OPA_TRANSP) c1 = c11;
|
||||
else if(xr1 == LV_OPA_COVER) c1 = c10;
|
||||
else c1 = lv_color_mix(c10, c11, xr1);
|
||||
|
||||
if(yr == LV_OPA_TRANSP) dsc->res.color = c1;
|
||||
else if(yr == LV_OPA_COVER) dsc->res.color = c0;
|
||||
else dsc->res.color = lv_color_mix(c0, c1, yr);
|
||||
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
/**********************
|
||||
* STATIC FUNCTIONS
|
||||
**********************/
|
||||
|
@ -45,7 +45,6 @@ extern "C" {
|
||||
#define LV_IMG_BUF_SIZE_INDEXED_4BIT(w, h) (LV_IMG_BUF_SIZE_ALPHA_4BIT(w, h) + 4 * 16)
|
||||
#define LV_IMG_BUF_SIZE_INDEXED_8BIT(w, h) (LV_IMG_BUF_SIZE_ALPHA_8BIT(w, h) + 4 * 256)
|
||||
|
||||
#define _LV_TRANSFORM_TRIGO_SHIFT 10
|
||||
#define _LV_ZOOM_INV_UPSCALE 5
|
||||
|
||||
/**********************
|
||||
@ -67,16 +66,23 @@ enum {
|
||||
LV_IMG_CF_TRUE_COLOR_CHROMA_KEYED, /**< Same as `LV_IMG_CF_TRUE_COLOR` but LV_COLOR_TRANSP pixels
|
||||
will be transparent*/
|
||||
|
||||
LV_IMG_CF_INDEXED_1BIT, /**< Can have 2 different colors in a palette (always chroma keyed)*/
|
||||
LV_IMG_CF_INDEXED_2BIT, /**< Can have 4 different colors in a palette (always chroma keyed)*/
|
||||
LV_IMG_CF_INDEXED_4BIT, /**< Can have 16 different colors in a palette (always chroma keyed)*/
|
||||
LV_IMG_CF_INDEXED_8BIT, /**< Can have 256 different colors in a palette (always chroma keyed)*/
|
||||
LV_IMG_CF_INDEXED_1BIT, /**< Can have 2 different colors in a palette (can't be chroma keyed)*/
|
||||
LV_IMG_CF_INDEXED_2BIT, /**< Can have 4 different colors in a palette (can't be chroma keyed)*/
|
||||
LV_IMG_CF_INDEXED_4BIT, /**< Can have 16 different colors in a palette (can't be chroma keyed)*/
|
||||
LV_IMG_CF_INDEXED_8BIT, /**< Can have 256 different colors in a palette (can't be chroma keyed)*/
|
||||
|
||||
LV_IMG_CF_ALPHA_1BIT, /**< Can have one color and it can be drawn or not*/
|
||||
LV_IMG_CF_ALPHA_2BIT, /**< Can have one color but 4 different alpha value*/
|
||||
LV_IMG_CF_ALPHA_4BIT, /**< Can have one color but 16 different alpha value*/
|
||||
LV_IMG_CF_ALPHA_8BIT, /**< Can have one color but 256 different alpha value*/
|
||||
|
||||
LV_IMG_CF_RGB888,
|
||||
LV_IMG_CF_RGBA8888,
|
||||
LV_IMG_CF_RGBX8888,
|
||||
LV_IMG_CF_RGB565,
|
||||
LV_IMG_CF_RGBA5658,
|
||||
LV_IMG_CF_RGB565A8,
|
||||
|
||||
LV_IMG_CF_RESERVED_15, /**< Reserved for further use.*/
|
||||
LV_IMG_CF_RESERVED_16, /**< Reserved for further use.*/
|
||||
LV_IMG_CF_RESERVED_17, /**< Reserved for further use.*/
|
||||
@ -138,49 +144,6 @@ typedef struct {
|
||||
const uint8_t * data; /**< Pointer to the data of the image*/
|
||||
} lv_img_dsc_t;
|
||||
|
||||
typedef struct {
|
||||
struct {
|
||||
const void * src; /*image source (array of pixels)*/
|
||||
lv_coord_t src_w; /*width of the image source*/
|
||||
lv_coord_t src_h; /*height of the image source*/
|
||||
lv_coord_t pivot_x; /*pivot x*/
|
||||
lv_coord_t pivot_y; /*pivot y*/
|
||||
int16_t angle; /*angle to rotate*/
|
||||
uint16_t zoom; /*256 no zoom, 128 half size, 512 double size*/
|
||||
lv_color_t color; /*a color used for `LV_IMG_CF_INDEXED_1/2/4/8BIT` color formats*/
|
||||
lv_img_cf_t cf; /*color format of the image to rotate*/
|
||||
bool antialias;
|
||||
} cfg;
|
||||
|
||||
struct {
|
||||
lv_color_t color;
|
||||
lv_opa_t opa;
|
||||
} res;
|
||||
|
||||
struct {
|
||||
lv_img_dsc_t img_dsc;
|
||||
int32_t pivot_x_256;
|
||||
int32_t pivot_y_256;
|
||||
int32_t sinma;
|
||||
int32_t cosma;
|
||||
|
||||
uint8_t chroma_keyed : 1;
|
||||
uint8_t has_alpha : 1;
|
||||
uint8_t native_color : 1;
|
||||
|
||||
uint32_t zoom_inv;
|
||||
|
||||
/*Runtime data*/
|
||||
lv_coord_t xs;
|
||||
lv_coord_t ys;
|
||||
lv_coord_t xs_int;
|
||||
lv_coord_t ys_int;
|
||||
uint32_t pxi;
|
||||
uint8_t px_size;
|
||||
} tmp;
|
||||
} lv_img_transform_dsc_t;
|
||||
|
||||
|
||||
/**********************
|
||||
* GLOBAL PROTOTYPES
|
||||
**********************/
|
||||
@ -263,30 +226,6 @@ void lv_img_buf_free(lv_img_dsc_t * dsc);
|
||||
*/
|
||||
uint32_t lv_img_buf_get_img_size(lv_coord_t w, lv_coord_t h, lv_img_cf_t cf);
|
||||
|
||||
#if LV_DRAW_COMPLEX
|
||||
/**
|
||||
* Initialize a descriptor to rotate an image
|
||||
* @param dsc pointer to an `lv_img_transform_dsc_t` variable whose `cfg` field is initialized
|
||||
*/
|
||||
void _lv_img_buf_transform_init(lv_img_transform_dsc_t * dsc);
|
||||
|
||||
/**
|
||||
* Continue transformation by taking the neighbors into account
|
||||
* @param dsc pointer to the transformation descriptor
|
||||
*/
|
||||
bool _lv_img_buf_transform_anti_alias(lv_img_transform_dsc_t * dsc);
|
||||
|
||||
/**
|
||||
* Get which color and opa would come to a pixel if it were rotated
|
||||
* @param dsc a descriptor initialized by `lv_img_buf_rotate_init`
|
||||
* @param x the coordinate which color and opa should be get
|
||||
* @param y the coordinate which color and opa should be get
|
||||
* @return true: there is valid pixel on these x/y coordinates; false: the rotated pixel was out of the image
|
||||
* @note the result is written back to `dsc->res_color` and `dsc->res_opa`
|
||||
*/
|
||||
bool _lv_img_buf_transform(lv_img_transform_dsc_t * dsc, lv_coord_t x, lv_coord_t y);
|
||||
|
||||
#endif
|
||||
/**
|
||||
* Get the area of a rectangle if its rotated and scaled
|
||||
* @param res store the coordinates here
|
||||
|
@ -15,8 +15,8 @@
|
||||
/*********************
|
||||
* DEFINES
|
||||
*********************/
|
||||
#define CF_BUILT_IN_FIRST LV_IMG_CF_TRUE_COLOR
|
||||
#define CF_BUILT_IN_LAST LV_IMG_CF_ALPHA_8BIT
|
||||
#define CF_BUILT_IN_FIRST LV_IMG_CF_TRUE_COLOR
|
||||
#define CF_BUILT_IN_LAST LV_IMG_CF_RGB565A8
|
||||
|
||||
/**********************
|
||||
* TYPEDEFS
|
||||
@ -146,7 +146,7 @@ lv_res_t lv_img_decoder_open(lv_img_decoder_dsc_t * dsc, const void * src, lv_co
|
||||
dsc->decoder = decoder;
|
||||
res = decoder->open_cb(decoder, dsc);
|
||||
|
||||
/*Opened successfully. It is a good decoder to for this image source*/
|
||||
/*Opened successfully. It is a good decoder for this image source*/
|
||||
if(res == LV_RES_OK) return res;
|
||||
|
||||
/*Prepare for the next loop*/
|
||||
@ -361,7 +361,9 @@ lv_res_t lv_img_decoder_built_in_open(lv_img_decoder_t * decoder, lv_img_decoder
|
||||
|
||||
lv_img_cf_t cf = dsc->header.cf;
|
||||
/*Process true color formats*/
|
||||
if(cf == LV_IMG_CF_TRUE_COLOR || cf == LV_IMG_CF_TRUE_COLOR_ALPHA || cf == LV_IMG_CF_TRUE_COLOR_CHROMA_KEYED) {
|
||||
if(cf == LV_IMG_CF_TRUE_COLOR || cf == LV_IMG_CF_TRUE_COLOR_ALPHA ||
|
||||
cf == LV_IMG_CF_TRUE_COLOR_CHROMA_KEYED || cf == LV_IMG_CF_RGB565A8 ||
|
||||
cf == LV_IMG_CF_ALPHA_8BIT) {
|
||||
if(dsc->src_type == LV_IMG_SRC_VARIABLE) {
|
||||
/*In case of uncompressed formats the image stored in the ROM/RAM.
|
||||
*So simply give its pointer*/
|
||||
@ -426,8 +428,7 @@ lv_res_t lv_img_decoder_built_in_open(lv_img_decoder_t * decoder, lv_img_decoder
|
||||
return LV_RES_OK;
|
||||
}
|
||||
/*Alpha indexed images.*/
|
||||
else if(cf == LV_IMG_CF_ALPHA_1BIT || cf == LV_IMG_CF_ALPHA_2BIT || cf == LV_IMG_CF_ALPHA_4BIT ||
|
||||
cf == LV_IMG_CF_ALPHA_8BIT) {
|
||||
else if(cf == LV_IMG_CF_ALPHA_1BIT || cf == LV_IMG_CF_ALPHA_2BIT || cf == LV_IMG_CF_ALPHA_4BIT) {
|
||||
return LV_RES_OK; /*Nothing to process*/
|
||||
}
|
||||
/*Unknown format. Can't decode it.*/
|
||||
|
@ -154,8 +154,8 @@ lv_res_t lv_img_decoder_get_info(const void * src, lv_img_header_t * header);
|
||||
|
||||
/**
|
||||
* Open an image.
|
||||
* Try the created image decoder one by one. Once one is able to open the image that decoder is save in `dsc`
|
||||
* @param dsc describe a decoding session. Simply a pointer to an `lv_img_decoder_dsc_t` variable.
|
||||
* Try the created image decoders one by one. Once one is able to open the image that decoder is saved in `dsc`
|
||||
* @param dsc describes a decoding session. Simply a pointer to an `lv_img_decoder_dsc_t` variable.
|
||||
* @param src the image source. Can be
|
||||
* 1) File name: E.g. "S:folder/img1.png" (The drivers needs to registered via `lv_fs_add_drv()`)
|
||||
* 2) Variable: Pointer to an `lv_img_dsc_t` variable
|
||||
|
9
lib/libesp32_lvgl/lvgl/src/draw/nxp/lv_draw_nxp.mk
Normal file
9
lib/libesp32_lvgl/lvgl/src/draw/nxp/lv_draw_nxp.mk
Normal file
@ -0,0 +1,9 @@
|
||||
CSRCS += lv_gpu_nxp.c
|
||||
|
||||
DEPPATH += --dep-path $(LVGL_DIR)/$(LVGL_DIR_NAME)/src/draw/nxp
|
||||
VPATH += :$(LVGL_DIR)/$(LVGL_DIR_NAME)/src/draw/nxp
|
||||
|
||||
CFLAGS += "-I$(LVGL_DIR)/$(LVGL_DIR_NAME)/src/draw/nxp"
|
||||
|
||||
include $(LVGL_DIR)/$(LVGL_DIR_NAME)/src/draw/nxp/pxp/lv_draw_nxp_pxp.mk
|
||||
include $(LVGL_DIR)/$(LVGL_DIR_NAME)/src/draw/nxp/vglite/lv_draw_nxp_vglite.mk
|
418
lib/libesp32_lvgl/lvgl/src/draw/nxp/lv_gpu_nxp.c
Normal file
418
lib/libesp32_lvgl/lvgl/src/draw/nxp/lv_gpu_nxp.c
Normal file
@ -0,0 +1,418 @@
|
||||
/**
|
||||
* @file lv_gpu_nxp.c
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* MIT License
|
||||
*
|
||||
* Copyright 2022 NXP
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights to
|
||||
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||
* the Software, and to permit persons to whom the Software is furnished to do so,
|
||||
* subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice (including the next paragraph)
|
||||
* shall be included in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
|
||||
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
|
||||
* PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
||||
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
|
||||
* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
|
||||
* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
*/
|
||||
|
||||
/*********************
|
||||
* INCLUDES
|
||||
*********************/
|
||||
|
||||
#include "lv_gpu_nxp.h"
|
||||
|
||||
#if LV_USE_GPU_NXP_PXP || LV_USE_GPU_NXP_VG_LITE
|
||||
|
||||
/*
|
||||
* allow to use both PXP and VGLITE
|
||||
|
||||
* both 2D accelerators can be used at the same time:
|
||||
* thus VGLITE can be used to accelerate widget drawing
|
||||
* while PXP accelerates Blit & Fill operations.
|
||||
*/
|
||||
#if LV_USE_GPU_NXP_PXP
|
||||
#include "pxp/lv_draw_pxp_blend.h"
|
||||
#endif
|
||||
#if LV_USE_GPU_NXP_VG_LITE
|
||||
#include "vglite/lv_draw_vglite_blend.h"
|
||||
#include "vglite/lv_draw_vglite_rect.h"
|
||||
#include "vglite/lv_draw_vglite_arc.h"
|
||||
#endif
|
||||
|
||||
#if LV_COLOR_DEPTH != 32
|
||||
#include "../../core/lv_refr.h"
|
||||
#endif
|
||||
|
||||
/*********************
|
||||
* DEFINES
|
||||
*********************/
|
||||
|
||||
/**********************
|
||||
* TYPEDEFS
|
||||
**********************/
|
||||
|
||||
/**********************
|
||||
* STATIC PROTOTYPES
|
||||
**********************/
|
||||
|
||||
static void lv_draw_nxp_img_decoded(lv_draw_ctx_t * draw_ctx, const lv_draw_img_dsc_t * dsc,
|
||||
const lv_area_t * coords, const uint8_t * map_p, lv_img_cf_t cf);
|
||||
|
||||
static void lv_draw_nxp_blend(lv_draw_ctx_t * draw_ctx, const lv_draw_sw_blend_dsc_t * dsc);
|
||||
|
||||
static void lv_draw_nxp_rect(lv_draw_ctx_t * draw_ctx, const lv_draw_rect_dsc_t * dsc, const lv_area_t * coords);
|
||||
|
||||
static lv_res_t draw_nxp_bg(lv_draw_ctx_t * draw_ctx, const lv_draw_rect_dsc_t * dsc, const lv_area_t * coords);
|
||||
|
||||
static void lv_draw_nxp_arc(lv_draw_ctx_t * draw_ctx, const lv_draw_arc_dsc_t * dsc, const lv_point_t * center,
|
||||
uint16_t radius, uint16_t start_angle, uint16_t end_angle);
|
||||
|
||||
/**********************
|
||||
* STATIC VARIABLES
|
||||
**********************/
|
||||
|
||||
/**********************
|
||||
* MACROS
|
||||
**********************/
|
||||
|
||||
/**********************
|
||||
* GLOBAL FUNCTIONS
|
||||
**********************/
|
||||
|
||||
void lv_draw_nxp_ctx_init(lv_disp_drv_t * drv, lv_draw_ctx_t * draw_ctx)
|
||||
{
|
||||
lv_draw_sw_init_ctx(drv, draw_ctx);
|
||||
|
||||
lv_draw_nxp_ctx_t * nxp_draw_ctx = (lv_draw_sw_ctx_t *)draw_ctx;
|
||||
|
||||
nxp_draw_ctx->base_draw.draw_arc = lv_draw_nxp_arc;
|
||||
nxp_draw_ctx->base_draw.draw_rect = lv_draw_nxp_rect;
|
||||
nxp_draw_ctx->base_draw.draw_img_decoded = lv_draw_nxp_img_decoded;
|
||||
nxp_draw_ctx->blend = lv_draw_nxp_blend;
|
||||
//nxp_draw_ctx->base_draw.wait_for_finish = lv_draw_nxp_wait_cb;
|
||||
}
|
||||
|
||||
void lv_draw_nxp_ctx_deinit(lv_disp_drv_t * drv, lv_draw_ctx_t * draw_ctx)
|
||||
{
|
||||
lv_draw_sw_deinit_ctx(drv, draw_ctx);
|
||||
}
|
||||
|
||||
/**********************
|
||||
* STATIC FUNCTIONS
|
||||
**********************/
|
||||
|
||||
/**
|
||||
* During rendering, LVGL might initializes new draw_ctxs and start drawing into
|
||||
* a separate buffer (called layer). If the content to be rendered has "holes",
|
||||
* e.g. rounded corner, LVGL temporarily sets the disp_drv.screen_transp flag.
|
||||
* It means the renderers should draw into an ARGB buffer.
|
||||
* With 32 bit color depth it's not a big problem but with 16 bit color depth
|
||||
* the target pixel format is ARGB8565 which is not supported by the GPU.
|
||||
* In this case, the NXP callbacks should fallback to SW rendering.
|
||||
*/
|
||||
static inline bool need_argb8565_support()
|
||||
{
|
||||
#if LV_COLOR_DEPTH != 32
|
||||
lv_disp_t * disp = _lv_refr_get_disp_refreshing();
|
||||
|
||||
if(disp->driver->screen_transp == 1)
|
||||
return true;
|
||||
#endif
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
static void lv_draw_nxp_blend(lv_draw_ctx_t * draw_ctx, const lv_draw_sw_blend_dsc_t * dsc)
|
||||
{
|
||||
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, dsc->blend_area, draw_ctx->clip_area))
|
||||
return; /*Fully clipped, nothing to do*/
|
||||
|
||||
/*Make the blend area relative to the buffer*/
|
||||
lv_area_move(&blend_area, -draw_ctx->buf_area->x1, -draw_ctx->buf_area->y1);
|
||||
|
||||
bool done = false;
|
||||
|
||||
/*Fill/Blend only non masked, normal blended*/
|
||||
if(dsc->mask_buf == NULL && dsc->blend_mode == LV_BLEND_MODE_NORMAL && !need_argb8565_support()) {
|
||||
lv_color_t * dest_buf = draw_ctx->buf;
|
||||
lv_coord_t dest_stride = lv_area_get_width(draw_ctx->buf_area);
|
||||
#if LV_USE_GPU_NXP_VG_LITE
|
||||
lv_coord_t dest_width = lv_area_get_width(draw_ctx->buf_area);
|
||||
lv_coord_t dest_height = lv_area_get_height(draw_ctx->buf_area);
|
||||
#endif
|
||||
|
||||
const lv_color_t * src_buf = dsc->src_buf;
|
||||
|
||||
if(src_buf == NULL) {
|
||||
#if LV_USE_GPU_NXP_PXP
|
||||
done = (lv_gpu_nxp_pxp_fill(dest_buf, dest_stride, &blend_area,
|
||||
dsc->color, dsc->opa) == LV_RES_OK);
|
||||
if(!done)
|
||||
PXP_LOG_TRACE("PXP fill failed. Fallback.");
|
||||
|
||||
#endif
|
||||
#if LV_USE_GPU_NXP_VG_LITE
|
||||
if(!done) {
|
||||
done = (lv_gpu_nxp_vglite_fill(dest_buf, dest_width, dest_height, &blend_area,
|
||||
dsc->color, dsc->opa) == LV_RES_OK);
|
||||
if(!done)
|
||||
VG_LITE_LOG_TRACE("VG-Lite fill failed. Fallback.");
|
||||
}
|
||||
#endif
|
||||
}
|
||||
else {
|
||||
#if LV_USE_GPU_NXP_PXP
|
||||
done = (lv_gpu_nxp_pxp_blit(dest_buf, &blend_area, dest_stride, src_buf, dsc->blend_area,
|
||||
dsc->opa, LV_DISP_ROT_NONE) == LV_RES_OK);
|
||||
if(!done)
|
||||
PXP_LOG_TRACE("PXP blit failed. Fallback.");
|
||||
#endif
|
||||
#if LV_USE_GPU_NXP_VG_LITE
|
||||
if(!done) {
|
||||
lv_gpu_nxp_vglite_blit_info_t blit;
|
||||
lv_coord_t src_stride = lv_area_get_width(dsc->blend_area);
|
||||
|
||||
blit.src = src_buf;
|
||||
blit.src_width = lv_area_get_width(dsc->blend_area);
|
||||
blit.src_height = lv_area_get_height(dsc->blend_area);
|
||||
blit.src_stride = src_stride * (int32_t)sizeof(lv_color_t);
|
||||
blit.src_area.x1 = (blend_area.x1 - (dsc->blend_area->x1 - draw_ctx->buf_area->x1));
|
||||
blit.src_area.y1 = (blend_area.y1 - (dsc->blend_area->y1 - draw_ctx->buf_area->y1));
|
||||
blit.src_area.x2 = blit.src_area.x1 + blit.src_width - 1;
|
||||
blit.src_area.y2 = blit.src_area.y1 + blit.src_height - 1;
|
||||
|
||||
blit.dst = dest_buf;
|
||||
blit.dst_width = dest_width;
|
||||
blit.dst_height = dest_height;
|
||||
blit.dst_stride = dest_stride * (int32_t)sizeof(lv_color_t);
|
||||
blit.dst_area.x1 = blend_area.x1;
|
||||
blit.dst_area.y1 = blend_area.y1;
|
||||
blit.dst_area.x2 = blend_area.x2;
|
||||
blit.dst_area.y2 = blend_area.y2;
|
||||
|
||||
blit.opa = dsc->opa;
|
||||
blit.zoom = LV_IMG_ZOOM_NONE;
|
||||
blit.angle = 0;
|
||||
|
||||
done = (lv_gpu_nxp_vglite_blit(&blit) == LV_RES_OK);
|
||||
|
||||
if(!done)
|
||||
VG_LITE_LOG_TRACE("VG-Lite blit failed. Fallback.");
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
if(!done)
|
||||
lv_draw_sw_blend_basic(draw_ctx, dsc);
|
||||
}
|
||||
|
||||
static void lv_draw_nxp_img_decoded(lv_draw_ctx_t * draw_ctx, const lv_draw_img_dsc_t * dsc,
|
||||
const lv_area_t * coords, const uint8_t * map_p, lv_img_cf_t cf)
|
||||
{
|
||||
/*Use the clip area as draw area*/
|
||||
lv_area_t draw_area;
|
||||
lv_area_copy(&draw_area, draw_ctx->clip_area);
|
||||
bool mask_any = lv_draw_mask_is_any(&draw_area);
|
||||
#if LV_USE_GPU_NXP_VG_LITE
|
||||
bool recolor = (dsc->recolor_opa != LV_OPA_TRANSP);
|
||||
#endif
|
||||
#if LV_USE_GPU_NXP_PXP
|
||||
bool scale = (dsc->zoom != LV_IMG_ZOOM_NONE);
|
||||
#endif
|
||||
bool done = false;
|
||||
|
||||
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, draw_ctx->clip_area))
|
||||
return; /*Fully clipped, nothing to do*/
|
||||
|
||||
/*Make the blend area relative to the buffer*/
|
||||
lv_area_move(&blend_area, -draw_ctx->buf_area->x1, -draw_ctx->buf_area->y1);
|
||||
|
||||
const lv_color_t * src_buf = (const lv_color_t *)map_p;
|
||||
if(!src_buf) {
|
||||
lv_draw_sw_img_decoded(draw_ctx, dsc, coords, map_p, cf);
|
||||
return;
|
||||
}
|
||||
|
||||
lv_color_t * dest_buf = draw_ctx->buf;
|
||||
lv_coord_t dest_stride = lv_area_get_width(draw_ctx->buf_area);
|
||||
|
||||
#if LV_USE_GPU_NXP_PXP
|
||||
if(!mask_any && !scale && !need_argb8565_support()
|
||||
#if LV_COLOR_DEPTH!=32
|
||||
&& !lv_img_cf_has_alpha(cf)
|
||||
#endif
|
||||
) {
|
||||
done = (lv_gpu_nxp_pxp_blit_transform(dest_buf, &blend_area, dest_stride, src_buf, coords,
|
||||
dsc, cf) == LV_RES_OK);
|
||||
if(!done)
|
||||
PXP_LOG_TRACE("PXP blit transform failed. Fallback.");
|
||||
}
|
||||
#endif
|
||||
|
||||
#if LV_USE_GPU_NXP_VG_LITE
|
||||
if(!done && !mask_any && !need_argb8565_support() &&
|
||||
!lv_img_cf_is_chroma_keyed(cf) && !recolor
|
||||
#if LV_COLOR_DEPTH!=32
|
||||
&& !lv_img_cf_has_alpha(cf)
|
||||
#endif
|
||||
) {
|
||||
lv_gpu_nxp_vglite_blit_info_t blit;
|
||||
lv_coord_t src_stride = lv_area_get_width(coords);
|
||||
|
||||
blit.src = src_buf;
|
||||
blit.src_width = lv_area_get_width(coords);
|
||||
blit.src_height = lv_area_get_height(coords);
|
||||
blit.src_stride = src_stride * (int32_t)sizeof(lv_color_t);
|
||||
blit.src_area.x1 = (blend_area.x1 - (coords->x1 - draw_ctx->buf_area->x1));
|
||||
blit.src_area.y1 = (blend_area.y1 - (coords->y1 - draw_ctx->buf_area->y1));
|
||||
blit.src_area.x2 = blit.src_area.x1 + blit.src_width - 1;
|
||||
blit.src_area.y2 = blit.src_area.y1 + blit.src_height - 1;
|
||||
|
||||
blit.dst = dest_buf;
|
||||
blit.dst_width = lv_area_get_width(draw_ctx->buf_area);
|
||||
blit.dst_height = lv_area_get_height(draw_ctx->buf_area);
|
||||
blit.dst_stride = dest_stride * (int32_t)sizeof(lv_color_t);
|
||||
blit.dst_area.x1 = blend_area.x1;
|
||||
blit.dst_area.y1 = blend_area.y1;
|
||||
blit.dst_area.x2 = blend_area.x2;
|
||||
blit.dst_area.y2 = blend_area.y2;
|
||||
|
||||
blit.opa = dsc->opa;
|
||||
blit.angle = dsc->angle;
|
||||
blit.pivot = dsc->pivot;
|
||||
blit.zoom = dsc->zoom;
|
||||
|
||||
done = (lv_gpu_nxp_vglite_blit_transform(&blit) == LV_RES_OK);
|
||||
|
||||
if(!done)
|
||||
VG_LITE_LOG_TRACE("VG-Lite blit transform failed. Fallback.");
|
||||
}
|
||||
#endif
|
||||
|
||||
if(!done)
|
||||
lv_draw_sw_img_decoded(draw_ctx, dsc, coords, map_p, cf);
|
||||
}
|
||||
|
||||
static void lv_draw_nxp_rect(lv_draw_ctx_t * draw_ctx, const lv_draw_rect_dsc_t * dsc, const lv_area_t * coords)
|
||||
{
|
||||
bool done = false;
|
||||
lv_draw_rect_dsc_t nxp_dsc;
|
||||
|
||||
lv_memcpy(&nxp_dsc, dsc, sizeof(nxp_dsc));
|
||||
#if LV_DRAW_COMPLEX
|
||||
/* Draw only the shadow */
|
||||
nxp_dsc.bg_opa = 0;
|
||||
nxp_dsc.bg_img_opa = 0;
|
||||
nxp_dsc.border_opa = 0;
|
||||
nxp_dsc.outline_opa = 0;
|
||||
|
||||
lv_draw_sw_rect(draw_ctx, &nxp_dsc, coords);
|
||||
|
||||
/* Draw the background */
|
||||
nxp_dsc.shadow_opa = 0;
|
||||
nxp_dsc.bg_opa = dsc->bg_opa;
|
||||
done = (draw_nxp_bg(draw_ctx, &nxp_dsc, coords) == LV_RES_OK);
|
||||
#endif /*LV_DRAW_COMPLEX*/
|
||||
|
||||
/* Draw the remaining parts */
|
||||
nxp_dsc.shadow_opa = 0;
|
||||
if(done)
|
||||
nxp_dsc.bg_opa = 0;
|
||||
nxp_dsc.bg_img_opa = dsc->bg_img_opa;
|
||||
nxp_dsc.border_opa = dsc->border_opa;
|
||||
nxp_dsc.outline_opa = dsc->outline_opa;
|
||||
|
||||
lv_draw_sw_rect(draw_ctx, &nxp_dsc, coords);
|
||||
}
|
||||
|
||||
static lv_res_t draw_nxp_bg(lv_draw_ctx_t * draw_ctx, const lv_draw_rect_dsc_t * dsc, const lv_area_t * coords)
|
||||
{
|
||||
if(dsc->bg_opa <= LV_OPA_MIN)
|
||||
return LV_RES_INV;
|
||||
|
||||
lv_area_t bg_coords;
|
||||
lv_area_copy(&bg_coords, coords);
|
||||
|
||||
/*If the border fully covers make the bg area 1px smaller to avoid artifacts on the corners*/
|
||||
if(dsc->border_width > 1 && dsc->border_opa >= (lv_opa_t)LV_OPA_MAX && dsc->radius != 0) {
|
||||
bg_coords.x1 += (dsc->border_side & LV_BORDER_SIDE_LEFT) ? 1 : 0;
|
||||
bg_coords.y1 += (dsc->border_side & LV_BORDER_SIDE_TOP) ? 1 : 0;
|
||||
bg_coords.x2 -= (dsc->border_side & LV_BORDER_SIDE_RIGHT) ? 1 : 0;
|
||||
bg_coords.y2 -= (dsc->border_side & LV_BORDER_SIDE_BOTTOM) ? 1 : 0;
|
||||
}
|
||||
|
||||
lv_area_t clipped_coords;
|
||||
if(!_lv_area_intersect(&clipped_coords, &bg_coords, draw_ctx->clip_area))
|
||||
return LV_RES_INV;
|
||||
|
||||
lv_grad_dir_t grad_dir = dsc->bg_grad.dir;
|
||||
lv_color_t bg_color = grad_dir == LV_GRAD_DIR_NONE ? dsc->bg_color : dsc->bg_grad.stops[0].color;
|
||||
if(bg_color.full == dsc->bg_grad.stops[1].color.full) grad_dir = LV_GRAD_DIR_NONE;
|
||||
|
||||
bool mask_any = lv_draw_mask_is_any(&bg_coords);
|
||||
|
||||
/*
|
||||
* Most simple case: just a plain rectangle (no mask, no radius, no gradient)
|
||||
* shall fallback to lv_draw_sw_blend().
|
||||
*
|
||||
* Complex case: gradient or radius but no mask.
|
||||
*/
|
||||
if(!mask_any && ((dsc->radius != 0) || (grad_dir != LV_GRAD_DIR_NONE)) && !need_argb8565_support()) {
|
||||
#if LV_USE_GPU_NXP_VG_LITE
|
||||
lv_res_t res = lv_gpu_nxp_vglite_draw_bg(draw_ctx, dsc, &bg_coords);
|
||||
if(res != LV_RES_OK)
|
||||
VG_LITE_LOG_TRACE("VG-Lite draw bg failed. Fallback.");
|
||||
|
||||
return res;
|
||||
#endif
|
||||
}
|
||||
|
||||
return LV_RES_INV;
|
||||
}
|
||||
|
||||
static void lv_draw_nxp_arc(lv_draw_ctx_t * draw_ctx, const lv_draw_arc_dsc_t * dsc, const lv_point_t * center,
|
||||
uint16_t radius, uint16_t start_angle, uint16_t end_angle)
|
||||
{
|
||||
bool done = false;
|
||||
|
||||
#if LV_DRAW_COMPLEX
|
||||
if(dsc->opa <= LV_OPA_MIN)
|
||||
return;
|
||||
if(dsc->width == 0)
|
||||
return;
|
||||
if(start_angle == end_angle)
|
||||
return;
|
||||
|
||||
#if LV_USE_GPU_NXP_VG_LITE
|
||||
if(!need_argb8565_support()) {
|
||||
done = (lv_gpu_nxp_vglite_draw_arc(draw_ctx, dsc, center, (int32_t)radius,
|
||||
(int32_t)start_angle, (int32_t)end_angle) == LV_RES_OK);
|
||||
if(!done)
|
||||
VG_LITE_LOG_TRACE("VG-Lite draw arc failed. Fallback.");
|
||||
}
|
||||
#endif
|
||||
#endif/*LV_DRAW_COMPLEX*/
|
||||
|
||||
if(!done)
|
||||
lv_draw_sw_arc(draw_ctx, dsc, center, radius, start_angle, end_angle);
|
||||
}
|
||||
|
||||
#endif /*LV_USE_GPU_NXP_PXP || LV_USE_GPU_NXP_VG_LITE*/
|
71
lib/libesp32_lvgl/lvgl/src/draw/nxp/lv_gpu_nxp.h
Normal file
71
lib/libesp32_lvgl/lvgl/src/draw/nxp/lv_gpu_nxp.h
Normal file
@ -0,0 +1,71 @@
|
||||
/**
|
||||
* @file lv_gpu_nxp.h
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* MIT License
|
||||
*
|
||||
* Copyright 2022 NXP
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights to
|
||||
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||
* the Software, and to permit persons to whom the Software is furnished to do so,
|
||||
* subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice (including the next paragraph)
|
||||
* shall be included in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
|
||||
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
|
||||
* PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
||||
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
|
||||
* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
|
||||
* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef LV_GPU_NXP_H
|
||||
#define LV_GPU_NXP_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*********************
|
||||
* INCLUDES
|
||||
*********************/
|
||||
|
||||
#include "../../lv_conf_internal.h"
|
||||
#if LV_USE_GPU_NXP_PXP || LV_USE_GPU_NXP_VG_LITE
|
||||
#include "../sw/lv_draw_sw.h"
|
||||
|
||||
/*********************
|
||||
* DEFINES
|
||||
*********************/
|
||||
|
||||
/**********************
|
||||
* TYPEDEFS
|
||||
**********************/
|
||||
typedef lv_draw_sw_ctx_t lv_draw_nxp_ctx_t;
|
||||
|
||||
/**********************
|
||||
* GLOBAL PROTOTYPES
|
||||
**********************/
|
||||
|
||||
void lv_draw_nxp_ctx_init(struct _lv_disp_drv_t * drv, lv_draw_ctx_t * draw_ctx);
|
||||
|
||||
void lv_draw_nxp_ctx_deinit(struct _lv_disp_drv_t * drv, lv_draw_ctx_t * draw_ctx);
|
||||
|
||||
/**********************
|
||||
* MACROS
|
||||
**********************/
|
||||
#endif /*LV_USE_GPU_NXP_PXP || LV_USE_GPU_NXP_VG_LITE*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /*extern "C"*/
|
||||
#endif
|
||||
|
||||
#endif /*LV_GPU_NXP_H*/
|
@ -0,0 +1,8 @@
|
||||
CSRCS += lv_draw_pxp_blend.c
|
||||
CSRCS += lv_gpu_nxp_pxp_osa.c
|
||||
CSRCS += lv_gpu_nxp_pxp.c
|
||||
|
||||
DEPPATH += --dep-path $(LVGL_DIR)/$(LVGL_DIR_NAME)/src/draw/nxp/pxp
|
||||
VPATH += :$(LVGL_DIR)/$(LVGL_DIR_NAME)/src/draw/nxp/pxp
|
||||
|
||||
CFLAGS += "-I$(LVGL_DIR)/$(LVGL_DIR_NAME)/src/draw/nxp/pxp"
|
632
lib/libesp32_lvgl/lvgl/src/draw/nxp/pxp/lv_draw_pxp_blend.c
Normal file
632
lib/libesp32_lvgl/lvgl/src/draw/nxp/pxp/lv_draw_pxp_blend.c
Normal file
@ -0,0 +1,632 @@
|
||||
/**
|
||||
* @file lv_draw_pxp_blend.c
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* MIT License
|
||||
*
|
||||
* Copyright 2020-2022 NXP
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights to
|
||||
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||
* the Software, and to permit persons to whom the Software is furnished to do so,
|
||||
* subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice (including the next paragraph)
|
||||
* shall be included in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
|
||||
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
|
||||
* PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
||||
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
|
||||
* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
|
||||
* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
*/
|
||||
|
||||
/*********************
|
||||
* INCLUDES
|
||||
*********************/
|
||||
|
||||
#include "lv_draw_pxp_blend.h"
|
||||
|
||||
#if LV_USE_GPU_NXP_PXP
|
||||
|
||||
/*********************
|
||||
* DEFINES
|
||||
*********************/
|
||||
|
||||
#if LV_COLOR_16_SWAP
|
||||
#error Color swap not implemented. Disable LV_COLOR_16_SWAP feature.
|
||||
#endif
|
||||
|
||||
#if LV_COLOR_DEPTH==16
|
||||
#define PXP_OUT_PIXEL_FORMAT kPXP_OutputPixelFormatRGB565
|
||||
#define PXP_AS_PIXEL_FORMAT kPXP_AsPixelFormatRGB565
|
||||
#define PXP_PS_PIXEL_FORMAT kPXP_PsPixelFormatRGB565
|
||||
#elif LV_COLOR_DEPTH==32
|
||||
#define PXP_OUT_PIXEL_FORMAT kPXP_OutputPixelFormatARGB8888
|
||||
#define PXP_AS_PIXEL_FORMAT kPXP_AsPixelFormatARGB8888
|
||||
#define PXP_PS_PIXEL_FORMAT kPXP_PsPixelFormatRGB888
|
||||
#elif
|
||||
#error Only 16bit and 32bit color depth are supported. Set LV_COLOR_DEPTH to 16 or 32.
|
||||
#endif
|
||||
|
||||
#if defined (__alpha__) || defined (__ia64__) || defined (__x86_64__) \
|
||||
|| defined (_WIN64) || defined (__LP64__) || defined (__LLP64__)
|
||||
#define ALIGN_SIZE 8
|
||||
#else
|
||||
#define ALIGN_SIZE 4
|
||||
#endif
|
||||
|
||||
/**********************
|
||||
* TYPEDEFS
|
||||
**********************/
|
||||
|
||||
/**********************
|
||||
* STATIC PROTOTYPES
|
||||
**********************/
|
||||
|
||||
/**
|
||||
* BLock Image Transfer - copy rectangular image from src buffer to dst buffer
|
||||
* with combination of transformation (rotation, scale, recolor) and opacity, alpha channel
|
||||
* or color keying. This requires two steps. First step is used for transformation into
|
||||
* a temporary buffer and the second one will handle the color format or opacity.
|
||||
*
|
||||
* @param[in/out] dest_buf destination buffer
|
||||
* @param[in] dest_area area to be copied from src_buf to dst_buf
|
||||
* @param[in] dest_stride width (stride) of destination buffer in pixels
|
||||
* @param[in] src_buf source buffer
|
||||
* @param[in] src_area source area with absolute coordinates to draw on destination buffer
|
||||
* @param[in] dsc image descriptor
|
||||
* @param[in] cf color format
|
||||
* @retval LV_RES_OK Fill completed
|
||||
* @retval LV_RES_INV Error occurred (\see LV_GPU_NXP_PXP_LOG_ERRORS)
|
||||
*/
|
||||
static lv_res_t lv_gpu_nxp_pxp_blit_opa(lv_color_t * dest_buf, const lv_area_t * dest_area, lv_coord_t dest_stride,
|
||||
const lv_color_t * src_buf, const lv_area_t * src_area,
|
||||
const lv_draw_img_dsc_t * dsc, lv_img_cf_t cf);
|
||||
|
||||
/**
|
||||
* BLock Image Transfer - copy rectangular image from src buffer to dst buffer
|
||||
* with transformation and full opacity.
|
||||
*
|
||||
* @param[in/out] dest_buf destination buffer
|
||||
* @param[in] dest_area area to be copied from src_buf to dst_buf
|
||||
* @param[in] dest_stride width (stride) of destination buffer in pixels
|
||||
* @param[in] src_buf source buffer
|
||||
* @param[in] src_area source area with absolute coordinates to draw on destination buffer
|
||||
* @param[in] dsc image descriptor
|
||||
* @param[in] cf color format
|
||||
* @retval LV_RES_OK Fill completed
|
||||
* @retval LV_RES_INV Error occurred (\see LV_GPU_NXP_PXP_LOG_ERRORS)
|
||||
*/
|
||||
static lv_res_t lv_gpu_nxp_pxp_blit_cover(lv_color_t * dest_buf, const lv_area_t * dest_area,
|
||||
lv_coord_t dest_stride,
|
||||
const lv_color_t * src_buf, const lv_area_t * src_area,
|
||||
const lv_draw_img_dsc_t * dsc, lv_img_cf_t cf);
|
||||
|
||||
/**
|
||||
* BLock Image Transfer - copy rectangular image from src buffer to dst buffer
|
||||
* without transformation but handling color format or opacity.
|
||||
*
|
||||
* @param[in/out] dest_buf destination buffer
|
||||
* @param[in] dest_area area to be copied from src_buf to dst_buf
|
||||
* @param[in] dest_stride width (stride) of destination buffer in pixels
|
||||
* @param[in] src_buf source buffer
|
||||
* @param[in] src_area source area with absolute coordinates to draw on destination buffer
|
||||
* @param[in] dsc image descriptor
|
||||
* @param[in] cf color format
|
||||
* @retval LV_RES_OK Fill completed
|
||||
* @retval LV_RES_INV Error occurred (\see LV_GPU_NXP_PXP_LOG_ERRORS)
|
||||
*/
|
||||
static lv_res_t lv_gpu_nxp_pxp_blit_cf(lv_color_t * dest_buf, const lv_area_t * dest_area,
|
||||
lv_coord_t dest_stride,
|
||||
const lv_color_t * src_buf, const lv_area_t * src_area,
|
||||
const lv_draw_img_dsc_t * dsc, lv_img_cf_t cf);
|
||||
|
||||
/**********************
|
||||
* STATIC VARIABLES
|
||||
**********************/
|
||||
|
||||
/**********************
|
||||
* MACROS
|
||||
**********************/
|
||||
|
||||
#define ROUND_UP(x, align) ((x + (align - 1)) & ~(align - 1))
|
||||
|
||||
/**********************
|
||||
* GLOBAL FUNCTIONS
|
||||
**********************/
|
||||
|
||||
lv_res_t lv_gpu_nxp_pxp_fill(lv_color_t * dest_buf, lv_coord_t dest_stride, const lv_area_t * fill_area,
|
||||
lv_color_t color, lv_opa_t opa)
|
||||
{
|
||||
uint32_t area_size = lv_area_get_size(fill_area);
|
||||
lv_coord_t area_w = lv_area_get_width(fill_area);
|
||||
lv_coord_t area_h = lv_area_get_height(fill_area);
|
||||
|
||||
if(opa >= (lv_opa_t)LV_OPA_MAX) {
|
||||
if(area_size < LV_GPU_NXP_PXP_FILL_SIZE_LIMIT) {
|
||||
PXP_LOG_TRACE("Area size %d smaller than limit %d.", area_size, LV_GPU_NXP_PXP_FILL_SIZE_LIMIT);
|
||||
return LV_RES_INV;
|
||||
}
|
||||
}
|
||||
else {
|
||||
if(area_size < LV_GPU_NXP_PXP_FILL_OPA_SIZE_LIMIT) {
|
||||
PXP_LOG_TRACE("Area size %d smaller than limit %d.", area_size, LV_GPU_NXP_PXP_FILL_OPA_SIZE_LIMIT);
|
||||
return LV_RES_INV;
|
||||
}
|
||||
}
|
||||
|
||||
PXP_Init(LV_GPU_NXP_PXP_ID);
|
||||
PXP_EnableCsc1(LV_GPU_NXP_PXP_ID, false); /*Disable CSC1, it is enabled by default.*/
|
||||
PXP_SetProcessBlockSize(LV_GPU_NXP_PXP_ID, kPXP_BlockSize16); /*Block size 16x16 for higher performance*/
|
||||
|
||||
/*OUT buffer configure*/
|
||||
pxp_output_buffer_config_t outputConfig = {
|
||||
.pixelFormat = PXP_OUT_PIXEL_FORMAT,
|
||||
.interlacedMode = kPXP_OutputProgressive,
|
||||
.buffer0Addr = (uint32_t)(dest_buf + dest_stride * fill_area->y1 + fill_area->x1),
|
||||
.buffer1Addr = (uint32_t)NULL,
|
||||
.pitchBytes = dest_stride * sizeof(lv_color_t),
|
||||
.width = area_w,
|
||||
.height = area_h
|
||||
};
|
||||
|
||||
PXP_SetOutputBufferConfig(LV_GPU_NXP_PXP_ID, &outputConfig);
|
||||
|
||||
if(opa >= (lv_opa_t)LV_OPA_MAX) {
|
||||
/*Simple color fill without opacity - AS disabled*/
|
||||
PXP_SetAlphaSurfacePosition(LV_GPU_NXP_PXP_ID, 0xFFFFU, 0xFFFFU, 0U, 0U);
|
||||
|
||||
}
|
||||
else {
|
||||
/*Fill with opacity - AS used as source (same as OUT)*/
|
||||
pxp_as_buffer_config_t asBufferConfig = {
|
||||
.pixelFormat = PXP_AS_PIXEL_FORMAT,
|
||||
.bufferAddr = (uint32_t)outputConfig.buffer0Addr,
|
||||
.pitchBytes = outputConfig.pitchBytes
|
||||
};
|
||||
|
||||
PXP_SetAlphaSurfaceBufferConfig(LV_GPU_NXP_PXP_ID, &asBufferConfig);
|
||||
PXP_SetAlphaSurfacePosition(LV_GPU_NXP_PXP_ID, 0U, 0U, area_w, area_h);
|
||||
}
|
||||
|
||||
/*Disable PS, use as color generator*/
|
||||
PXP_SetProcessSurfacePosition(LV_GPU_NXP_PXP_ID, 0xFFFFU, 0xFFFFU, 0U, 0U);
|
||||
PXP_SetProcessSurfaceBackGroundColor(LV_GPU_NXP_PXP_ID, lv_color_to32(color));
|
||||
|
||||
/**
|
||||
* Configure Porter-Duff blending - src settings are unused for fill without opacity (opa = 0xff).
|
||||
*
|
||||
* Note: srcFactorMode and dstFactorMode are inverted in fsl_pxp.h:
|
||||
* srcFactorMode is actually applied on PS alpha value
|
||||
* dstFactorMode is actually applied on AS alpha value
|
||||
*/
|
||||
pxp_porter_duff_config_t pdConfig = {
|
||||
.enable = 1,
|
||||
.dstColorMode = kPXP_PorterDuffColorNoAlpha,
|
||||
.srcColorMode = kPXP_PorterDuffColorNoAlpha,
|
||||
.dstGlobalAlphaMode = kPXP_PorterDuffGlobalAlpha,
|
||||
.srcGlobalAlphaMode = kPXP_PorterDuffGlobalAlpha,
|
||||
.dstFactorMode = kPXP_PorterDuffFactorStraight,
|
||||
.srcFactorMode = (opa >= (lv_opa_t)LV_OPA_MAX) ? kPXP_PorterDuffFactorStraight : kPXP_PorterDuffFactorInversed,
|
||||
.dstGlobalAlpha = opa,
|
||||
.srcGlobalAlpha = opa,
|
||||
.dstAlphaMode = kPXP_PorterDuffAlphaStraight, /*don't care*/
|
||||
.srcAlphaMode = kPXP_PorterDuffAlphaStraight /*don't care*/
|
||||
};
|
||||
|
||||
PXP_SetPorterDuffConfig(LV_GPU_NXP_PXP_ID, &pdConfig);
|
||||
|
||||
lv_gpu_nxp_pxp_run(); /*Start PXP task*/
|
||||
|
||||
return LV_RES_OK;
|
||||
}
|
||||
|
||||
lv_res_t lv_gpu_nxp_pxp_blit(lv_color_t * dest_buf, const lv_area_t * dest_area, lv_coord_t dest_stride,
|
||||
const lv_color_t * src_buf, const lv_area_t * src_area, lv_opa_t opa, lv_disp_rot_t angle)
|
||||
{
|
||||
uint32_t dest_size = lv_area_get_size(dest_area);
|
||||
lv_coord_t dest_w = lv_area_get_width(dest_area);
|
||||
lv_coord_t dest_h = lv_area_get_height(dest_area);
|
||||
|
||||
if(opa >= (lv_opa_t)LV_OPA_MAX) {
|
||||
if(dest_size < LV_GPU_NXP_PXP_BLIT_SIZE_LIMIT) {
|
||||
PXP_LOG_TRACE("Area size %d smaller than limit %d.", dest_size, LV_GPU_NXP_PXP_BLIT_SIZE_LIMIT);
|
||||
return LV_RES_INV;
|
||||
}
|
||||
}
|
||||
else {
|
||||
if(dest_size < LV_GPU_NXP_PXP_BLIT_OPA_SIZE_LIMIT) {
|
||||
PXP_LOG_TRACE("Area size %d smaller than limit %d.", dest_size, LV_GPU_NXP_PXP_BLIT_OPA_SIZE_LIMIT);
|
||||
return LV_RES_INV;
|
||||
}
|
||||
}
|
||||
|
||||
PXP_Init(LV_GPU_NXP_PXP_ID);
|
||||
PXP_EnableCsc1(LV_GPU_NXP_PXP_ID, false); /*Disable CSC1, it is enabled by default.*/
|
||||
PXP_SetProcessBlockSize(LV_GPU_NXP_PXP_ID, kPXP_BlockSize16); /*block size 16x16 for higher performance*/
|
||||
|
||||
/* convert rotation angle */
|
||||
pxp_rotate_degree_t pxp_rot;
|
||||
switch(angle) {
|
||||
case LV_DISP_ROT_NONE:
|
||||
pxp_rot = kPXP_Rotate0;
|
||||
break;
|
||||
case LV_DISP_ROT_90:
|
||||
pxp_rot = kPXP_Rotate90;
|
||||
break;
|
||||
case LV_DISP_ROT_180:
|
||||
pxp_rot = kPXP_Rotate180;
|
||||
break;
|
||||
case LV_DISP_ROT_270:
|
||||
pxp_rot = kPXP_Rotate270;
|
||||
break;
|
||||
default:
|
||||
pxp_rot = kPXP_Rotate0;
|
||||
break;
|
||||
}
|
||||
PXP_SetRotateConfig(LV_GPU_NXP_PXP_ID, kPXP_RotateOutputBuffer, pxp_rot, kPXP_FlipDisable);
|
||||
|
||||
pxp_as_blend_config_t asBlendConfig = {
|
||||
.alpha = opa,
|
||||
.invertAlpha = false,
|
||||
.alphaMode = kPXP_AlphaRop,
|
||||
.ropMode = kPXP_RopMergeAs
|
||||
};
|
||||
|
||||
if(opa >= (lv_opa_t)LV_OPA_MAX) {
|
||||
/*Simple blit, no effect - Disable PS buffer*/
|
||||
PXP_SetProcessSurfacePosition(LV_GPU_NXP_PXP_ID, 0xFFFFU, 0xFFFFU, 0U, 0U);
|
||||
}
|
||||
else {
|
||||
pxp_ps_buffer_config_t psBufferConfig = {
|
||||
.pixelFormat = PXP_PS_PIXEL_FORMAT,
|
||||
.swapByte = false,
|
||||
.bufferAddr = (uint32_t)(dest_buf + dest_stride * dest_area->y1 + dest_area->x1),
|
||||
.bufferAddrU = 0U,
|
||||
.bufferAddrV = 0U,
|
||||
.pitchBytes = dest_stride * sizeof(lv_color_t)
|
||||
};
|
||||
|
||||
asBlendConfig.alphaMode = kPXP_AlphaOverride;
|
||||
|
||||
PXP_SetProcessSurfaceBufferConfig(LV_GPU_NXP_PXP_ID, &psBufferConfig);
|
||||
PXP_SetProcessSurfacePosition(LV_GPU_NXP_PXP_ID, 0U, 0U, dest_w - 1, dest_h - 1);
|
||||
}
|
||||
|
||||
lv_coord_t src_stride = lv_area_get_width(src_area);
|
||||
|
||||
/*AS buffer - source image*/
|
||||
pxp_as_buffer_config_t asBufferConfig = {
|
||||
.pixelFormat = PXP_AS_PIXEL_FORMAT,
|
||||
.bufferAddr = (uint32_t)src_buf,
|
||||
.pitchBytes = src_stride * sizeof(lv_color_t)
|
||||
};
|
||||
PXP_SetAlphaSurfaceBufferConfig(LV_GPU_NXP_PXP_ID, &asBufferConfig);
|
||||
PXP_SetAlphaSurfacePosition(LV_GPU_NXP_PXP_ID, 0U, 0U, dest_w - 1U, dest_h - 1U);
|
||||
PXP_SetAlphaSurfaceBlendConfig(LV_GPU_NXP_PXP_ID, &asBlendConfig);
|
||||
PXP_EnableAlphaSurfaceOverlayColorKey(LV_GPU_NXP_PXP_ID, false);
|
||||
|
||||
/*Output buffer.*/
|
||||
pxp_output_buffer_config_t outputBufferConfig = {
|
||||
.pixelFormat = (pxp_output_pixel_format_t)PXP_OUT_PIXEL_FORMAT,
|
||||
.interlacedMode = kPXP_OutputProgressive,
|
||||
.buffer0Addr = (uint32_t)(dest_buf + dest_stride * dest_area->y1 + dest_area->x1),
|
||||
.buffer1Addr = (uint32_t)0U,
|
||||
.pitchBytes = dest_stride * sizeof(lv_color_t),
|
||||
.width = dest_w,
|
||||
.height = dest_h
|
||||
};
|
||||
PXP_SetOutputBufferConfig(LV_GPU_NXP_PXP_ID, &outputBufferConfig);
|
||||
|
||||
lv_gpu_nxp_pxp_run(); /* Start PXP task */
|
||||
|
||||
return LV_RES_OK;
|
||||
}
|
||||
|
||||
lv_res_t lv_gpu_nxp_pxp_blit_transform(lv_color_t * dest_buf, const lv_area_t * dest_area, lv_coord_t dest_stride,
|
||||
const lv_color_t * src_buf, const lv_area_t * src_area,
|
||||
const lv_draw_img_dsc_t * dsc, lv_img_cf_t cf)
|
||||
{
|
||||
uint32_t dest_size = lv_area_get_size(dest_area);
|
||||
|
||||
if(dsc->opa >= (lv_opa_t)LV_OPA_MAX) {
|
||||
if(dest_size < LV_GPU_NXP_PXP_BLIT_SIZE_LIMIT) {
|
||||
PXP_LOG_TRACE("Area size %d smaller than limit %d.", dest_size, LV_GPU_NXP_PXP_BLIT_SIZE_LIMIT);
|
||||
return LV_RES_INV;
|
||||
}
|
||||
}
|
||||
else {
|
||||
if(dest_size < LV_GPU_NXP_PXP_BLIT_OPA_SIZE_LIMIT) {
|
||||
PXP_LOG_TRACE("Area size %d smaller than limit %d.", dest_size, LV_GPU_NXP_PXP_BLIT_OPA_SIZE_LIMIT);
|
||||
return LV_RES_INV;
|
||||
}
|
||||
}
|
||||
|
||||
bool recolor = (dsc->recolor_opa != LV_OPA_TRANSP);
|
||||
bool rotation = (dsc->angle != 0);
|
||||
|
||||
if(rotation) {
|
||||
if(dsc->angle != 0 && dsc->angle != 900 && dsc->angle != 1800 && dsc->angle != 2700) {
|
||||
PXP_LOG_TRACE("Rotation angle %d is not supported. PXP can rotate only 90x angle.", dsc->angle);
|
||||
return LV_RES_INV;
|
||||
}
|
||||
}
|
||||
|
||||
if(recolor || rotation) {
|
||||
if(dsc->opa >= (lv_opa_t)LV_OPA_MAX && !lv_img_cf_has_alpha(cf) && !lv_img_cf_is_chroma_keyed(cf))
|
||||
return lv_gpu_nxp_pxp_blit_cover(dest_buf, dest_area, dest_stride, src_buf, src_area, dsc, cf);
|
||||
else
|
||||
/*Recolor and/or rotation with alpha or opacity is done in two steps.*/
|
||||
return lv_gpu_nxp_pxp_blit_opa(dest_buf, dest_area, dest_stride, src_buf, src_area, dsc, cf);
|
||||
}
|
||||
|
||||
return lv_gpu_nxp_pxp_blit_cf(dest_buf, dest_area, dest_stride, src_buf, src_area, dsc, cf);
|
||||
}
|
||||
|
||||
/**********************
|
||||
* STATIC FUNCTIONS
|
||||
**********************/
|
||||
|
||||
static lv_res_t lv_gpu_nxp_pxp_blit_opa(lv_color_t * dest_buf, const lv_area_t * dest_area, lv_coord_t dest_stride,
|
||||
const lv_color_t * src_buf, const lv_area_t * src_area,
|
||||
const lv_draw_img_dsc_t * dsc, lv_img_cf_t cf)
|
||||
{
|
||||
lv_coord_t dest_w = lv_area_get_width(dest_area);
|
||||
lv_coord_t dest_h = lv_area_get_height(dest_area);
|
||||
lv_res_t res;
|
||||
uint32_t size = dest_w * dest_h * sizeof(lv_color_t);
|
||||
|
||||
if(ROUND_UP(size, ALIGN_SIZE) >= LV_MEM_SIZE)
|
||||
PXP_RETURN_INV("Insufficient memory for temporary buffer. Please increase LV_MEM_SIZE.");
|
||||
|
||||
lv_color_t * tmp_buf = (lv_color_t *)lv_mem_buf_get(size);
|
||||
if(!tmp_buf)
|
||||
PXP_RETURN_INV("Allocating temporary buffer failed.");
|
||||
|
||||
const lv_area_t tmp_area = {
|
||||
.x1 = 0,
|
||||
.y1 = 0,
|
||||
.x2 = dest_w - 1,
|
||||
.y2 = dest_h - 1
|
||||
};
|
||||
|
||||
/*Step 1: Transform with full opacity to temporary buffer*/
|
||||
res = lv_gpu_nxp_pxp_blit_cover(tmp_buf, &tmp_area, dest_w, src_buf, src_area, dsc, cf);
|
||||
if(res != LV_RES_OK) {
|
||||
PXP_LOG_TRACE("Blit cover with full opacity failed.");
|
||||
lv_mem_buf_release(tmp_buf);
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
/*Step 2: Blit temporary results with required opacity to output*/
|
||||
res = lv_gpu_nxp_pxp_blit_cf(dest_buf, dest_area, dest_stride, tmp_buf, &tmp_area, dsc, cf);
|
||||
|
||||
/*Clean-up memory*/
|
||||
lv_mem_buf_release(tmp_buf);
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
static lv_res_t lv_gpu_nxp_pxp_blit_cover(lv_color_t * dest_buf, const lv_area_t * dest_area,
|
||||
lv_coord_t dest_stride,
|
||||
const lv_color_t * src_buf, const lv_area_t * src_area,
|
||||
const lv_draw_img_dsc_t * dsc, lv_img_cf_t cf)
|
||||
{
|
||||
lv_coord_t dest_w = lv_area_get_width(dest_area);
|
||||
lv_coord_t dest_h = lv_area_get_height(dest_area);
|
||||
|
||||
bool recolor = (dsc->recolor_opa != LV_OPA_TRANSP);
|
||||
bool rotation = (dsc->angle != 0);
|
||||
|
||||
PXP_Init(LV_GPU_NXP_PXP_ID);
|
||||
PXP_EnableCsc1(LV_GPU_NXP_PXP_ID, false); /*Disable CSC1, it is enabled by default.*/
|
||||
PXP_SetProcessBlockSize(LV_GPU_NXP_PXP_ID, kPXP_BlockSize16); /*block size 16x16 for higher performance*/
|
||||
|
||||
if(rotation) {
|
||||
/*
|
||||
* PXP is set to process 16x16 blocks to optimize the system for memory
|
||||
* bandwidth and image processing time.
|
||||
* The output engine essentially truncates any output pixels after the
|
||||
* desired number of pixels has been written.
|
||||
* When rotating a source image and the output is not divisible by the block
|
||||
* size, the incorrect pixels could be truncated and the final output image
|
||||
* can look shifted.
|
||||
*/
|
||||
if(lv_area_get_width(src_area) % 16 || lv_area_get_height(src_area) % 16) {
|
||||
PXP_LOG_TRACE("Rotation is not supported for image w/o alignment to block size 16x16.");
|
||||
return LV_RES_INV;
|
||||
}
|
||||
|
||||
/*Convert rotation angle*/
|
||||
pxp_rotate_degree_t pxp_rot;
|
||||
switch(dsc->angle) {
|
||||
case 0:
|
||||
pxp_rot = kPXP_Rotate0;
|
||||
break;
|
||||
case 900:
|
||||
pxp_rot = kPXP_Rotate90;
|
||||
break;
|
||||
case 1800:
|
||||
pxp_rot = kPXP_Rotate180;
|
||||
break;
|
||||
case 2700:
|
||||
pxp_rot = kPXP_Rotate270;
|
||||
break;
|
||||
default:
|
||||
PXP_LOG_TRACE("Rotation angle %d is not supported. PXP can rotate only 90x angle.", dsc->angle);
|
||||
return LV_RES_INV;
|
||||
}
|
||||
PXP_SetRotateConfig(LV_GPU_NXP_PXP_ID, kPXP_RotateOutputBuffer, pxp_rot, kPXP_FlipDisable);
|
||||
}
|
||||
|
||||
lv_coord_t src_stride = lv_area_get_width(src_area);
|
||||
|
||||
/*AS buffer - source image*/
|
||||
pxp_as_buffer_config_t asBufferConfig = {
|
||||
.pixelFormat = PXP_AS_PIXEL_FORMAT,
|
||||
.bufferAddr = (uint32_t)src_buf,
|
||||
.pitchBytes = src_stride * sizeof(lv_color_t)
|
||||
};
|
||||
PXP_SetAlphaSurfaceBufferConfig(LV_GPU_NXP_PXP_ID, &asBufferConfig);
|
||||
PXP_SetAlphaSurfacePosition(LV_GPU_NXP_PXP_ID, 0U, 0U, dest_w - 1U, dest_h - 1U);
|
||||
|
||||
/*Disable PS buffer*/
|
||||
PXP_SetProcessSurfacePosition(LV_GPU_NXP_PXP_ID, 0xFFFFU, 0xFFFFU, 0U, 0U);
|
||||
if(recolor)
|
||||
/*Use as color generator*/
|
||||
PXP_SetProcessSurfaceBackGroundColor(LV_GPU_NXP_PXP_ID, lv_color_to32(dsc->recolor));
|
||||
|
||||
/*Output buffer*/
|
||||
pxp_output_buffer_config_t outputBufferConfig = {
|
||||
.pixelFormat = (pxp_output_pixel_format_t)PXP_OUT_PIXEL_FORMAT,
|
||||
.interlacedMode = kPXP_OutputProgressive,
|
||||
.buffer0Addr = (uint32_t)(dest_buf + dest_stride * dest_area->y1 + dest_area->x1),
|
||||
.buffer1Addr = (uint32_t)0U,
|
||||
.pitchBytes = dest_stride * sizeof(lv_color_t),
|
||||
.width = dest_w,
|
||||
.height = dest_h
|
||||
};
|
||||
PXP_SetOutputBufferConfig(LV_GPU_NXP_PXP_ID, &outputBufferConfig);
|
||||
|
||||
if(recolor || lv_img_cf_has_alpha(cf)) {
|
||||
/**
|
||||
* Configure Porter-Duff blending.
|
||||
*
|
||||
* Note: srcFactorMode and dstFactorMode are inverted in fsl_pxp.h:
|
||||
* srcFactorMode is actually applied on PS alpha value
|
||||
* dstFactorMode is actually applied on AS alpha value
|
||||
*/
|
||||
pxp_porter_duff_config_t pdConfig = {
|
||||
.enable = 1,
|
||||
.dstColorMode = kPXP_PorterDuffColorWithAlpha,
|
||||
.srcColorMode = kPXP_PorterDuffColorNoAlpha,
|
||||
.dstGlobalAlphaMode = kPXP_PorterDuffGlobalAlpha,
|
||||
.srcGlobalAlphaMode = lv_img_cf_has_alpha(cf) ? kPXP_PorterDuffLocalAlpha : kPXP_PorterDuffGlobalAlpha,
|
||||
.dstFactorMode = kPXP_PorterDuffFactorStraight,
|
||||
.srcFactorMode = kPXP_PorterDuffFactorInversed,
|
||||
.dstGlobalAlpha = recolor ? dsc->recolor_opa : 0x00,
|
||||
.srcGlobalAlpha = 0xff,
|
||||
.dstAlphaMode = kPXP_PorterDuffAlphaStraight, /*don't care*/
|
||||
.srcAlphaMode = kPXP_PorterDuffAlphaStraight
|
||||
};
|
||||
PXP_SetPorterDuffConfig(LV_GPU_NXP_PXP_ID, &pdConfig);
|
||||
}
|
||||
|
||||
lv_gpu_nxp_pxp_run(); /*Start PXP task*/
|
||||
|
||||
return LV_RES_OK;
|
||||
}
|
||||
|
||||
static lv_res_t lv_gpu_nxp_pxp_blit_cf(lv_color_t * dest_buf, const lv_area_t * dest_area,
|
||||
lv_coord_t dest_stride,
|
||||
const lv_color_t * src_buf, const lv_area_t * src_area,
|
||||
const lv_draw_img_dsc_t * dsc, lv_img_cf_t cf)
|
||||
{
|
||||
lv_coord_t dest_w = lv_area_get_width(dest_area);
|
||||
lv_coord_t dest_h = lv_area_get_height(dest_area);
|
||||
|
||||
PXP_Init(LV_GPU_NXP_PXP_ID);
|
||||
PXP_EnableCsc1(LV_GPU_NXP_PXP_ID, false); /*Disable CSC1, it is enabled by default.*/
|
||||
PXP_SetProcessBlockSize(LV_GPU_NXP_PXP_ID, kPXP_BlockSize16); /*block size 16x16 for higher performance*/
|
||||
|
||||
pxp_as_blend_config_t asBlendConfig = {
|
||||
.alpha = dsc->opa,
|
||||
.invertAlpha = false,
|
||||
.alphaMode = kPXP_AlphaRop,
|
||||
.ropMode = kPXP_RopMergeAs
|
||||
};
|
||||
|
||||
if(dsc->opa >= (lv_opa_t)LV_OPA_MAX && !lv_img_cf_is_chroma_keyed(cf) && !lv_img_cf_has_alpha(cf)) {
|
||||
/*Simple blit, no effect - Disable PS buffer*/
|
||||
PXP_SetProcessSurfacePosition(LV_GPU_NXP_PXP_ID, 0xFFFFU, 0xFFFFU, 0U, 0U);
|
||||
}
|
||||
else {
|
||||
/*PS must be enabled to fetch background pixels.
|
||||
PS and OUT buffers are the same, blend will be done in-place*/
|
||||
pxp_ps_buffer_config_t psBufferConfig = {
|
||||
.pixelFormat = PXP_PS_PIXEL_FORMAT,
|
||||
.swapByte = false,
|
||||
.bufferAddr = (uint32_t)(dest_buf + dest_stride * dest_area->y1 + dest_area->x1),
|
||||
.bufferAddrU = 0U,
|
||||
.bufferAddrV = 0U,
|
||||
.pitchBytes = dest_stride * sizeof(lv_color_t)
|
||||
};
|
||||
if(dsc->opa >= (lv_opa_t)LV_OPA_MAX) {
|
||||
asBlendConfig.alphaMode = lv_img_cf_has_alpha(cf) ? kPXP_AlphaEmbedded : kPXP_AlphaOverride;
|
||||
}
|
||||
else {
|
||||
asBlendConfig.alphaMode = lv_img_cf_has_alpha(cf) ? kPXP_AlphaMultiply : kPXP_AlphaOverride;
|
||||
}
|
||||
PXP_SetProcessSurfaceBufferConfig(LV_GPU_NXP_PXP_ID, &psBufferConfig);
|
||||
PXP_SetProcessSurfacePosition(LV_GPU_NXP_PXP_ID, 0U, 0U, dest_w - 1, dest_h - 1);
|
||||
}
|
||||
|
||||
lv_coord_t src_stride = lv_area_get_width(src_area);
|
||||
|
||||
/*AS buffer - source image*/
|
||||
pxp_as_buffer_config_t asBufferConfig = {
|
||||
.pixelFormat = PXP_AS_PIXEL_FORMAT,
|
||||
.bufferAddr = (uint32_t)src_buf,
|
||||
.pitchBytes = src_stride * sizeof(lv_color_t)
|
||||
};
|
||||
PXP_SetAlphaSurfaceBufferConfig(LV_GPU_NXP_PXP_ID, &asBufferConfig);
|
||||
PXP_SetAlphaSurfacePosition(LV_GPU_NXP_PXP_ID, 0U, 0U, dest_w - 1U, dest_h - 1U);
|
||||
PXP_SetAlphaSurfaceBlendConfig(LV_GPU_NXP_PXP_ID, &asBlendConfig);
|
||||
|
||||
if(lv_img_cf_is_chroma_keyed(cf)) {
|
||||
lv_color_t colorKeyLow = LV_COLOR_CHROMA_KEY;
|
||||
lv_color_t colorKeyHigh = LV_COLOR_CHROMA_KEY;
|
||||
|
||||
bool recolor = (dsc->recolor_opa != LV_OPA_TRANSP);
|
||||
|
||||
if(recolor) {
|
||||
/* New color key after recoloring */
|
||||
lv_color_t colorKey = lv_color_mix(dsc->recolor, LV_COLOR_CHROMA_KEY, dsc->recolor_opa);
|
||||
|
||||
LV_COLOR_SET_R(colorKeyLow, colorKey.ch.red != 0 ? colorKey.ch.red - 1 : 0);
|
||||
LV_COLOR_SET_G(colorKeyLow, colorKey.ch.green != 0 ? colorKey.ch.green - 1 : 0);
|
||||
LV_COLOR_SET_B(colorKeyLow, colorKey.ch.blue != 0 ? colorKey.ch.blue - 1 : 0);
|
||||
|
||||
#if LV_COLOR_DEPTH==16
|
||||
LV_COLOR_SET_R(colorKeyHigh, colorKey.ch.red != 0x1f ? colorKey.ch.red + 1 : 0x1f);
|
||||
LV_COLOR_SET_G(colorKeyHigh, colorKey.ch.green != 0x3f ? colorKey.ch.green + 1 : 0x3f);
|
||||
LV_COLOR_SET_B(colorKeyHigh, colorKey.ch.blue != 0x1f ? colorKey.ch.blue + 1 : 0x1f);
|
||||
#else /*LV_COLOR_DEPTH==32*/
|
||||
LV_COLOR_SET_R(colorKeyHigh, colorKey.ch.red != 0xff ? colorKey.ch.red + 1 : 0xff);
|
||||
LV_COLOR_SET_G(colorKeyHigh, colorKey.ch.green != 0xff ? colorKey.ch.green + 1 : 0xff);
|
||||
LV_COLOR_SET_B(colorKeyHigh, colorKey.ch.blue != 0xff ? colorKey.ch.blue + 1 : 0xff);
|
||||
#endif
|
||||
}
|
||||
|
||||
PXP_SetAlphaSurfaceOverlayColorKey(LV_GPU_NXP_PXP_ID, lv_color_to32(colorKeyLow),
|
||||
lv_color_to32(colorKeyHigh));
|
||||
}
|
||||
|
||||
PXP_EnableAlphaSurfaceOverlayColorKey(LV_GPU_NXP_PXP_ID, lv_img_cf_is_chroma_keyed(cf));
|
||||
|
||||
/*Output buffer.*/
|
||||
pxp_output_buffer_config_t outputBufferConfig = {
|
||||
.pixelFormat = (pxp_output_pixel_format_t)PXP_OUT_PIXEL_FORMAT,
|
||||
.interlacedMode = kPXP_OutputProgressive,
|
||||
.buffer0Addr = (uint32_t)(dest_buf + dest_stride * dest_area->y1 + dest_area->x1),
|
||||
.buffer1Addr = (uint32_t)0U,
|
||||
.pitchBytes = dest_stride * sizeof(lv_color_t),
|
||||
.width = dest_w,
|
||||
.height = dest_h
|
||||
};
|
||||
PXP_SetOutputBufferConfig(LV_GPU_NXP_PXP_ID, &outputBufferConfig);
|
||||
|
||||
lv_gpu_nxp_pxp_run(); /* Start PXP task */
|
||||
|
||||
return LV_RES_OK;
|
||||
}
|
||||
|
||||
#endif /*LV_USE_GPU_NXP_PXP*/
|
143
lib/libesp32_lvgl/lvgl/src/draw/nxp/pxp/lv_draw_pxp_blend.h
Normal file
143
lib/libesp32_lvgl/lvgl/src/draw/nxp/pxp/lv_draw_pxp_blend.h
Normal file
@ -0,0 +1,143 @@
|
||||
/**
|
||||
* @file lv_draw_pxp_blend.h
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* MIT License
|
||||
*
|
||||
* Copyright 2020-2022 NXP
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights to
|
||||
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||
* the Software, and to permit persons to whom the Software is furnished to do so,
|
||||
* subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice (including the next paragraph)
|
||||
* shall be included in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
|
||||
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
|
||||
* PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
||||
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
|
||||
* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
|
||||
* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef LV_DRAW_PXP_BLEND_H
|
||||
#define LV_DRAW_PXP_BLEND_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*********************
|
||||
* INCLUDES
|
||||
*********************/
|
||||
|
||||
#include "../../../lv_conf_internal.h"
|
||||
|
||||
#if LV_USE_GPU_NXP_PXP
|
||||
#include "lv_gpu_nxp_pxp.h"
|
||||
#include "../../sw/lv_draw_sw.h"
|
||||
|
||||
/*********************
|
||||
* DEFINES
|
||||
*********************/
|
||||
|
||||
#ifndef LV_GPU_NXP_PXP_BLIT_SIZE_LIMIT
|
||||
/** Minimum area (in pixels) for image copy with 100% opacity to be handled by PXP*/
|
||||
#define LV_GPU_NXP_PXP_BLIT_SIZE_LIMIT 5000
|
||||
#endif
|
||||
|
||||
#ifndef LV_GPU_NXP_PXP_BLIT_OPA_SIZE_LIMIT
|
||||
/** Minimum area (in pixels) for image copy with transparency to be handled by PXP*/
|
||||
#define LV_GPU_NXP_PXP_BLIT_OPA_SIZE_LIMIT 5000
|
||||
#endif
|
||||
|
||||
#ifndef LV_GPU_NXP_PXP_BUFF_SYNC_BLIT_SIZE_LIMIT
|
||||
/** Minimum invalidated area (in pixels) to be synchronized by PXP during buffer sync */
|
||||
#define LV_GPU_NXP_PXP_BUFF_SYNC_BLIT_SIZE_LIMIT 5000
|
||||
#endif
|
||||
|
||||
#ifndef LV_GPU_NXP_PXP_FILL_SIZE_LIMIT
|
||||
/** Minimum area (in pixels) to be filled by PXP with 100% opacity*/
|
||||
#define LV_GPU_NXP_PXP_FILL_SIZE_LIMIT 5000
|
||||
#endif
|
||||
|
||||
#ifndef LV_GPU_NXP_PXP_FILL_OPA_SIZE_LIMIT
|
||||
/** Minimum area (in pixels) to be filled by PXP with transparency*/
|
||||
#define LV_GPU_NXP_PXP_FILL_OPA_SIZE_LIMIT 5000
|
||||
#endif
|
||||
|
||||
/**********************
|
||||
* TYPEDEFS
|
||||
**********************/
|
||||
|
||||
/**********************
|
||||
* GLOBAL PROTOTYPES
|
||||
**********************/
|
||||
|
||||
/**
|
||||
* Fill area, with optional opacity.
|
||||
*
|
||||
* @param[in/out] dest_buf destination buffer
|
||||
* @param[in] dest_stride width (stride) of destination buffer in pixels
|
||||
* @param[in] fill_area area to fill
|
||||
* @param[in] color color
|
||||
* @param[in] opa transparency of the color
|
||||
* @retval LV_RES_OK Fill completed
|
||||
* @retval LV_RES_INV Error occurred (\see LV_GPU_NXP_PXP_LOG_ERRORS)
|
||||
*/
|
||||
lv_res_t lv_gpu_nxp_pxp_fill(lv_color_t * dest_buf, lv_coord_t dest_stride, const lv_area_t * fill_area,
|
||||
lv_color_t color, lv_opa_t opa);
|
||||
|
||||
/**
|
||||
* BLock Image Transfer - copy rectangular image from src_buf to dst_buf with effects.
|
||||
* By default, image is copied directly, with optional opacity. This function can also
|
||||
* rotate the display output buffer to a specified angle (90x step).
|
||||
*
|
||||
* @param[in/out] dest_buf destination buffer
|
||||
* @param[in] dest_area destination area
|
||||
* @param[in] dest_stride width (stride) of destination buffer in pixels
|
||||
* @param[in] src_buf source buffer
|
||||
* @param[in] src_area source area with absolute coordinates to draw on destination buffer
|
||||
* @param[in] opa opacity of the result
|
||||
* @param[in] angle display rotation angle (90x)
|
||||
* @retval LV_RES_OK Fill completed
|
||||
* @retval LV_RES_INV Error occurred (\see LV_GPU_NXP_PXP_LOG_ERRORS)
|
||||
*/
|
||||
lv_res_t lv_gpu_nxp_pxp_blit(lv_color_t * dest_buf, const lv_area_t * dest_area, lv_coord_t dest_stride,
|
||||
const lv_color_t * src_buf, const lv_area_t * src_area, lv_opa_t opa, lv_disp_rot_t angle);
|
||||
|
||||
/**
|
||||
* BLock Image Transfer - copy rectangular image from src_buf to dst_buf with transformation.
|
||||
*
|
||||
*
|
||||
* @param[in/out] dest_buf destination buffer
|
||||
* @param[in] dest_area destination area
|
||||
* @param[in] dest_stride width (stride) of destination buffer in pixels
|
||||
* @param[in] src_buf source buffer
|
||||
* @param[in] src_area source area with absolute coordinates to draw on destination buffer
|
||||
* @param[in] dsc image descriptor
|
||||
* @param[in] cf color format
|
||||
* @retval LV_RES_OK Fill completed
|
||||
* @retval LV_RES_INV Error occurred (\see LV_GPU_NXP_PXP_LOG_ERRORS)
|
||||
*/
|
||||
lv_res_t lv_gpu_nxp_pxp_blit_transform(lv_color_t * dest_buf, const lv_area_t * dest_area, lv_coord_t dest_stride,
|
||||
const lv_color_t * src_buf, const lv_area_t * src_area, const lv_draw_img_dsc_t * dsc, lv_img_cf_t cf);
|
||||
|
||||
/**********************
|
||||
* MACROS
|
||||
**********************/
|
||||
|
||||
#endif /*LV_USE_GPU_NXP_PXP*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /*extern "C"*/
|
||||
#endif
|
||||
|
||||
#endif /*LV_DRAW_PXP_BLEND_H*/
|
116
lib/libesp32_lvgl/lvgl/src/draw/nxp/pxp/lv_gpu_nxp_pxp.c
Normal file
116
lib/libesp32_lvgl/lvgl/src/draw/nxp/pxp/lv_gpu_nxp_pxp.c
Normal file
@ -0,0 +1,116 @@
|
||||
/**
|
||||
* @file lv_gpu_nxp_pxp.c
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* MIT License
|
||||
*
|
||||
* Copyright 2020-2022 NXP
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights to
|
||||
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||
* the Software, and to permit persons to whom the Software is furnished to do so,
|
||||
* subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice (including the next paragraph)
|
||||
* shall be included in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
|
||||
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
|
||||
* PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
||||
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
|
||||
* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
|
||||
* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
*/
|
||||
|
||||
/*********************
|
||||
* INCLUDES
|
||||
*********************/
|
||||
|
||||
#include "lv_gpu_nxp_pxp.h"
|
||||
|
||||
#if LV_USE_GPU_NXP_PXP
|
||||
#include "lv_gpu_nxp_pxp_osa.h"
|
||||
#include "../../../core/lv_refr.h"
|
||||
|
||||
/*********************
|
||||
* DEFINES
|
||||
*********************/
|
||||
|
||||
/**********************
|
||||
* TYPEDEFS
|
||||
**********************/
|
||||
|
||||
/**********************
|
||||
* STATIC PROTOTYPES
|
||||
**********************/
|
||||
|
||||
/**
|
||||
* Clean & invalidate cache.
|
||||
*/
|
||||
static void invalidate_cache(void);
|
||||
|
||||
/**********************
|
||||
* STATIC VARIABLES
|
||||
**********************/
|
||||
|
||||
static lv_nxp_pxp_cfg_t * pxp_cfg;
|
||||
|
||||
/**********************
|
||||
* MACROS
|
||||
**********************/
|
||||
|
||||
/**********************
|
||||
* GLOBAL FUNCTIONS
|
||||
**********************/
|
||||
|
||||
lv_res_t lv_gpu_nxp_pxp_init(void)
|
||||
{
|
||||
pxp_cfg = lv_gpu_nxp_pxp_get_cfg();
|
||||
|
||||
if(!pxp_cfg || !pxp_cfg->pxp_interrupt_deinit || !pxp_cfg->pxp_interrupt_init || !pxp_cfg->pxp_run)
|
||||
PXP_RETURN_INV("PXP configuration error.");
|
||||
|
||||
PXP_Init(LV_GPU_NXP_PXP_ID);
|
||||
PXP_EnableCsc1(LV_GPU_NXP_PXP_ID, false); /*Disable CSC1, it is enabled by default.*/
|
||||
PXP_EnableInterrupts(LV_GPU_NXP_PXP_ID, kPXP_CompleteInterruptEnable);
|
||||
|
||||
if(pxp_cfg->pxp_interrupt_init() != LV_RES_OK) {
|
||||
PXP_Deinit(LV_GPU_NXP_PXP_ID);
|
||||
PXP_RETURN_INV("PXP interrupt init failed.");
|
||||
}
|
||||
|
||||
return LV_RES_OK;
|
||||
}
|
||||
|
||||
void lv_gpu_nxp_pxp_deinit(void)
|
||||
{
|
||||
pxp_cfg->pxp_interrupt_deinit();
|
||||
PXP_DisableInterrupts(PXP, kPXP_CompleteInterruptEnable);
|
||||
PXP_Deinit(LV_GPU_NXP_PXP_ID);
|
||||
}
|
||||
|
||||
void lv_gpu_nxp_pxp_run(void)
|
||||
{
|
||||
/*Clean & invalidate cache*/
|
||||
invalidate_cache();
|
||||
|
||||
pxp_cfg->pxp_run();
|
||||
}
|
||||
|
||||
/**********************
|
||||
* STATIC FUNCTIONS
|
||||
**********************/
|
||||
|
||||
static void invalidate_cache(void)
|
||||
{
|
||||
lv_disp_t * disp = _lv_refr_get_disp_refreshing();
|
||||
if(disp->driver->clean_dcache_cb)
|
||||
disp->driver->clean_dcache_cb(disp->driver);
|
||||
}
|
||||
|
||||
#endif /*LV_USE_GPU_NXP_PXP*/
|
153
lib/libesp32_lvgl/lvgl/src/draw/nxp/pxp/lv_gpu_nxp_pxp.h
Normal file
153
lib/libesp32_lvgl/lvgl/src/draw/nxp/pxp/lv_gpu_nxp_pxp.h
Normal file
@ -0,0 +1,153 @@
|
||||
/**
|
||||
* @file lv_gpu_nxp_pxp.h
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* MIT License
|
||||
*
|
||||
* Copyright 2020-2022 NXP
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights to
|
||||
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||
* the Software, and to permit persons to whom the Software is furnished to do so,
|
||||
* subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice (including the next paragraph)
|
||||
* shall be included in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
|
||||
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
|
||||
* PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
||||
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
|
||||
* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
|
||||
* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef LV_GPU_NXP_PXP_H
|
||||
#define LV_GPU_NXP_PXP_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*********************
|
||||
* INCLUDES
|
||||
*********************/
|
||||
|
||||
#include "../../../lv_conf_internal.h"
|
||||
|
||||
#if LV_USE_GPU_NXP_PXP
|
||||
#include "fsl_cache.h"
|
||||
#include "fsl_pxp.h"
|
||||
|
||||
#include "../../../misc/lv_log.h"
|
||||
|
||||
/*********************
|
||||
* DEFINES
|
||||
*********************/
|
||||
|
||||
/** PXP module instance to use*/
|
||||
#define LV_GPU_NXP_PXP_ID PXP
|
||||
|
||||
/** PXP interrupt line ID*/
|
||||
#define LV_GPU_NXP_PXP_IRQ_ID PXP_IRQn
|
||||
|
||||
#ifndef LV_GPU_NXP_PXP_LOG_ERRORS
|
||||
/** Enable logging of PXP errors (\see LV_LOG_ERROR)*/
|
||||
#define LV_GPU_NXP_PXP_LOG_ERRORS 1
|
||||
#endif
|
||||
|
||||
#ifndef LV_GPU_NXP_PXP_LOG_TRACES
|
||||
/** Enable logging of PXP errors (\see LV_LOG_ERROR)*/
|
||||
#define LV_GPU_NXP_PXP_LOG_TRACES 0
|
||||
#endif
|
||||
|
||||
/**********************
|
||||
* TYPEDEFS
|
||||
**********************/
|
||||
|
||||
/**
|
||||
* NXP PXP device configuration - call-backs used for
|
||||
* interrupt init/wait/deinit.
|
||||
*/
|
||||
typedef struct {
|
||||
/** Callback for PXP interrupt initialization*/
|
||||
lv_res_t (*pxp_interrupt_init)(void);
|
||||
|
||||
/** Callback for PXP interrupt de-initialization*/
|
||||
void (*pxp_interrupt_deinit)(void);
|
||||
|
||||
/** Callback that should start PXP and wait for operation complete*/
|
||||
void (*pxp_run)(void);
|
||||
} lv_nxp_pxp_cfg_t;
|
||||
|
||||
/**********************
|
||||
* GLOBAL PROTOTYPES
|
||||
**********************/
|
||||
|
||||
/**
|
||||
* Reset and initialize PXP device. This function should be called as a part
|
||||
* of display init sequence.
|
||||
*
|
||||
* @retval LV_RES_OK PXP init completed
|
||||
* @retval LV_RES_INV Error occurred (\see LV_GPU_NXP_PXP_LOG_ERRORS)
|
||||
*/
|
||||
lv_res_t lv_gpu_nxp_pxp_init(void);
|
||||
|
||||
/**
|
||||
* Disable PXP device. Should be called during display deinit sequence.
|
||||
*/
|
||||
void lv_gpu_nxp_pxp_deinit(void);
|
||||
|
||||
/**
|
||||
* Start PXP job and wait for completion.
|
||||
*/
|
||||
void lv_gpu_nxp_pxp_run(void);
|
||||
|
||||
/**********************
|
||||
* MACROS
|
||||
**********************/
|
||||
|
||||
#define PXP_COND_STOP(cond, txt) \
|
||||
do { \
|
||||
if (cond) { \
|
||||
LV_LOG_ERROR("%s. STOP!", txt); \
|
||||
for ( ; ; ); \
|
||||
} \
|
||||
} while(0)
|
||||
|
||||
#if LV_GPU_NXP_PXP_LOG_ERRORS
|
||||
#define PXP_RETURN_INV(fmt, ...) \
|
||||
do { \
|
||||
LV_LOG_ERROR(fmt, ##__VA_ARGS__); \
|
||||
return LV_RES_INV; \
|
||||
} while (0)
|
||||
#else
|
||||
#define PXP_RETURN_INV(fmt, ...) \
|
||||
do { \
|
||||
return LV_RES_INV; \
|
||||
}while(0)
|
||||
#endif /*LV_GPU_NXP_PXP_LOG_ERRORS*/
|
||||
|
||||
#if LV_GPU_NXP_PXP_LOG_TRACES
|
||||
#define PXP_LOG_TRACE(fmt, ...) \
|
||||
do { \
|
||||
LV_LOG_ERROR(fmt, ##__VA_ARGS__); \
|
||||
} while (0)
|
||||
#else
|
||||
#define PXP_LOG_TRACE(fmt, ...) \
|
||||
do { \
|
||||
} while (0)
|
||||
#endif /*LV_GPU_NXP_PXP_LOG_TRACES*/
|
||||
|
||||
#endif /*LV_USE_GPU_NXP_PXP*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /*extern "C"*/
|
||||
#endif
|
||||
|
||||
#endif /*LV_GPU_NXP_PXP_H*/
|
@ -6,7 +6,7 @@
|
||||
/**
|
||||
* MIT License
|
||||
*
|
||||
* Copyright (c) 2020 NXP
|
||||
* Copyright 2020, 2022 NXP
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
@ -32,11 +32,9 @@
|
||||
*********************/
|
||||
|
||||
#include "lv_gpu_nxp_pxp_osa.h"
|
||||
|
||||
#if LV_USE_GPU_NXP_PXP && LV_USE_GPU_NXP_PXP_AUTO_INIT
|
||||
#include "../misc/lv_log.h"
|
||||
|
||||
|
||||
#include "lv_gpu_nxp_pxp.h"
|
||||
#include "../../../misc/lv_log.h"
|
||||
#include "fsl_pxp.h"
|
||||
|
||||
#if defined(SDK_OS_FREE_RTOS)
|
||||
@ -55,8 +53,20 @@
|
||||
/**********************
|
||||
* STATIC PROTOTYPES
|
||||
**********************/
|
||||
|
||||
/**
|
||||
* PXP interrupt initialization.
|
||||
*/
|
||||
static lv_res_t _lv_gpu_nxp_pxp_interrupt_init(void);
|
||||
|
||||
/**
|
||||
* PXP interrupt de-initialization.
|
||||
*/
|
||||
static void _lv_gpu_nxp_pxp_interrupt_deinit(void);
|
||||
|
||||
/**
|
||||
* Start the PXP job and wait for task completion.
|
||||
*/
|
||||
static void _lv_gpu_nxp_pxp_run(void);
|
||||
|
||||
/**********************
|
||||
@ -69,6 +79,12 @@ static void _lv_gpu_nxp_pxp_run(void);
|
||||
static volatile bool s_pxpIdle;
|
||||
#endif
|
||||
|
||||
static lv_nxp_pxp_cfg_t pxp_default_cfg = {
|
||||
.pxp_interrupt_init = _lv_gpu_nxp_pxp_interrupt_init,
|
||||
.pxp_interrupt_deinit = _lv_gpu_nxp_pxp_interrupt_deinit,
|
||||
.pxp_run = _lv_gpu_nxp_pxp_run
|
||||
};
|
||||
|
||||
/**********************
|
||||
* MACROS
|
||||
**********************/
|
||||
@ -77,9 +93,6 @@ static void _lv_gpu_nxp_pxp_run(void);
|
||||
* GLOBAL FUNCTIONS
|
||||
**********************/
|
||||
|
||||
/**
|
||||
* PXP device interrupt handler. Used to check PXP task completion status.
|
||||
*/
|
||||
void PXP_IRQHandler(void)
|
||||
{
|
||||
#if defined(SDK_OS_FREE_RTOS)
|
||||
@ -94,24 +107,24 @@ void PXP_IRQHandler(void)
|
||||
#else
|
||||
s_pxpIdle = true;
|
||||
#endif
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
lv_nxp_pxp_cfg_t * lv_gpu_nxp_pxp_get_cfg(void)
|
||||
{
|
||||
return &pxp_default_cfg;
|
||||
}
|
||||
|
||||
/**********************
|
||||
* STATIC FUNCTIONS
|
||||
**********************/
|
||||
|
||||
/**
|
||||
* PXP interrupt initialization.
|
||||
*/
|
||||
static lv_res_t _lv_gpu_nxp_pxp_interrupt_init(void)
|
||||
{
|
||||
#if defined(SDK_OS_FREE_RTOS)
|
||||
s_pxpIdle = xSemaphoreCreateBinary();
|
||||
if(s_pxpIdle == NULL) {
|
||||
if(s_pxpIdle == NULL)
|
||||
return LV_RES_INV;
|
||||
}
|
||||
|
||||
NVIC_SetPriority(LV_GPU_NXP_PXP_IRQ_ID, configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY + 1);
|
||||
#else
|
||||
@ -123,9 +136,6 @@ static lv_res_t _lv_gpu_nxp_pxp_interrupt_init(void)
|
||||
return LV_RES_OK;
|
||||
}
|
||||
|
||||
/**
|
||||
* PXP interrupt de-initialization.
|
||||
*/
|
||||
static void _lv_gpu_nxp_pxp_interrupt_deinit(void)
|
||||
{
|
||||
NVIC_DisableIRQ(LV_GPU_NXP_PXP_IRQ_ID);
|
||||
@ -134,9 +144,6 @@ static void _lv_gpu_nxp_pxp_interrupt_deinit(void)
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
* Function to start PXP job. This function must wait for task complete.
|
||||
*/
|
||||
static void _lv_gpu_nxp_pxp_run(void)
|
||||
{
|
||||
#if !defined(SDK_OS_FREE_RTOS)
|
||||
@ -147,20 +154,11 @@ static void _lv_gpu_nxp_pxp_run(void)
|
||||
PXP_Start(LV_GPU_NXP_PXP_ID);
|
||||
|
||||
#if defined(SDK_OS_FREE_RTOS)
|
||||
if(xSemaphoreTake(s_pxpIdle, portMAX_DELAY) != pdTRUE) {
|
||||
LV_LOG_ERROR("xSemaphoreTake error. Task halted.");
|
||||
for(; ;) ;
|
||||
}
|
||||
PXP_COND_STOP(!xSemaphoreTake(s_pxpIdle, portMAX_DELAY), "xSemaphoreTake failed.");
|
||||
#else
|
||||
while(s_pxpIdle == false) {
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
lv_nxp_pxp_cfg_t pxp_default_cfg = {
|
||||
.pxp_interrupt_init = _lv_gpu_nxp_pxp_interrupt_init,
|
||||
.pxp_interrupt_deinit = _lv_gpu_nxp_pxp_interrupt_deinit,
|
||||
.pxp_run = _lv_gpu_nxp_pxp_run
|
||||
};
|
||||
|
||||
#endif /*LV_USE_GPU_NXP_PXP && LV_USE_GPU_NXP_PXP_AUTO_INIT*/
|
@ -6,7 +6,7 @@
|
||||
/**
|
||||
* MIT License
|
||||
*
|
||||
* Copyright (c) 2020 NXP
|
||||
* Copyright 2020, 2022 NXP
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
@ -27,21 +27,52 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef LV_SRC_LV_GPU_LV_GPU_NXP_PXP_OSA_H_
|
||||
#define LV_SRC_LV_GPU_LV_GPU_NXP_PXP_OSA_H_
|
||||
#ifndef LV_GPU_NXP_PXP_OSA_H
|
||||
#define LV_GPU_NXP_PXP_OSA_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include "../../lv_conf_internal.h"
|
||||
/*********************
|
||||
* INCLUDES
|
||||
*********************/
|
||||
|
||||
#include "../../../lv_conf_internal.h"
|
||||
|
||||
#if LV_USE_GPU_NXP_PXP && LV_USE_GPU_NXP_PXP_AUTO_INIT
|
||||
extern lv_nxp_pxp_cfg_t pxp_default_cfg;
|
||||
#endif
|
||||
#include "lv_gpu_nxp_pxp.h"
|
||||
|
||||
/*********************
|
||||
* DEFINES
|
||||
*********************/
|
||||
|
||||
/**********************
|
||||
* TYPEDEFS
|
||||
**********************/
|
||||
|
||||
/**********************
|
||||
* GLOBAL PROTOTYPES
|
||||
**********************/
|
||||
|
||||
/**
|
||||
* PXP device interrupt handler. Used to check PXP task completion status.
|
||||
*/
|
||||
void PXP_IRQHandler(void);
|
||||
|
||||
/**
|
||||
* Helper function to get the PXP default configuration.
|
||||
*/
|
||||
lv_nxp_pxp_cfg_t * lv_gpu_nxp_pxp_get_cfg(void);
|
||||
|
||||
/**********************
|
||||
* MACROS
|
||||
**********************/
|
||||
|
||||
#endif /*LV_USE_GPU_NXP_PXP && LV_USE_GPU_NXP_PXP_AUTO_INIT*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /*extern "C"*/
|
||||
#endif
|
||||
|
||||
#endif /*LV_SRC_LV_GPU_LV_GPU_NXP_PXP_OSA_H_*/
|
||||
#endif /*LV_GPU_NXP_PXP_OSA_H*/
|
@ -0,0 +1,9 @@
|
||||
CSRCS += lv_draw_vglite_arc.c
|
||||
CSRCS += lv_draw_vglite_blend.c
|
||||
CSRCS += lv_draw_vglite_rect.c
|
||||
CSRCS += lv_gpu_nxp_vglite.c
|
||||
|
||||
DEPPATH += --dep-path $(LVGL_DIR)/$(LVGL_DIR_NAME)/src/draw/nxp/vglite
|
||||
VPATH += :$(LVGL_DIR)/$(LVGL_DIR_NAME)/src/draw/nxp/vglite
|
||||
|
||||
CFLAGS += "-I$(LVGL_DIR)/$(LVGL_DIR_NAME)/src/draw/nxp/vglite"
|
699
lib/libesp32_lvgl/lvgl/src/draw/nxp/vglite/lv_draw_vglite_arc.c
Normal file
699
lib/libesp32_lvgl/lvgl/src/draw/nxp/vglite/lv_draw_vglite_arc.c
Normal file
@ -0,0 +1,699 @@
|
||||
/**
|
||||
* @file lv_draw_vglite_arc.c
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* MIT License
|
||||
*
|
||||
* Copyright 2021, 2022 NXP
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights to
|
||||
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||
* the Software, and to permit persons to whom the Software is furnished to do so,
|
||||
* subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice (including the next paragraph)
|
||||
* shall be included in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
|
||||
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
|
||||
* PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
||||
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
|
||||
* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
|
||||
* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
*/
|
||||
|
||||
/*********************
|
||||
* INCLUDES
|
||||
*********************/
|
||||
|
||||
#include "lv_draw_vglite_arc.h"
|
||||
|
||||
#if LV_USE_GPU_NXP_VG_LITE
|
||||
#include "math.h"
|
||||
|
||||
/*********************
|
||||
* DEFINES
|
||||
*********************/
|
||||
|
||||
#define T_FRACTION 16384.0f
|
||||
|
||||
#define DICHOTO_ITER 5
|
||||
|
||||
static const uint16_t TperDegree[90] = {
|
||||
0, 174, 348, 522, 697, 873, 1049, 1226, 1403, 1581,
|
||||
1759, 1938, 2117, 2297, 2477, 2658, 2839, 3020, 3202, 3384,
|
||||
3567, 3749, 3933, 4116, 4300, 4484, 4668, 4852, 5037, 5222,
|
||||
5407, 5592, 5777, 5962, 6148, 6334, 6519, 6705, 6891, 7077,
|
||||
7264, 7450, 7636, 7822, 8008, 8193, 8378, 8564, 8750, 8936,
|
||||
9122, 9309, 9495, 9681, 9867, 10052, 10238, 10424, 10609, 10794,
|
||||
10979, 11164, 11349, 11534, 11718, 11902, 12086, 12270, 12453, 12637,
|
||||
12819, 13002, 13184, 13366, 13547, 13728, 13909, 14089, 14269, 14448,
|
||||
14627, 14805, 14983, 15160, 15337, 15513, 15689, 15864, 16038, 16212
|
||||
};
|
||||
|
||||
/**********************
|
||||
* TYPEDEFS
|
||||
**********************/
|
||||
|
||||
/* intermediate arc params */
|
||||
typedef struct _vg_arc {
|
||||
int32_t angle; /* angle <90deg */
|
||||
int32_t quarter; /* 0-3 counter-clockwise */
|
||||
int32_t rad; /* radius */
|
||||
int32_t p0x; /* point P0 */
|
||||
int32_t p0y;
|
||||
int32_t p1x; /* point P1 */
|
||||
int32_t p1y;
|
||||
int32_t p2x; /* point P2 */
|
||||
int32_t p2y;
|
||||
int32_t p3x; /* point P3 */
|
||||
int32_t p3y;
|
||||
} vg_arc;
|
||||
|
||||
typedef struct _cubic_cont_pt {
|
||||
float p0;
|
||||
float p1;
|
||||
float p2;
|
||||
float p3;
|
||||
} cubic_cont_pt;
|
||||
|
||||
/**********************
|
||||
* STATIC PROTOTYPES
|
||||
**********************/
|
||||
|
||||
static void rotate_point(int32_t angle, int32_t * x, int32_t * y);
|
||||
static void add_arc_path(int32_t * arc_path, int * pidx, int32_t radius,
|
||||
int32_t start_angle, int32_t end_angle, lv_point_t center, bool cw);
|
||||
|
||||
/**********************
|
||||
* STATIC VARIABLES
|
||||
**********************/
|
||||
|
||||
/**********************
|
||||
* MACROS
|
||||
**********************/
|
||||
|
||||
/**********************
|
||||
* GLOBAL FUNCTIONS
|
||||
**********************/
|
||||
|
||||
lv_res_t lv_gpu_nxp_vglite_draw_arc(lv_draw_ctx_t * draw_ctx, const lv_draw_arc_dsc_t * dsc, const lv_point_t * center,
|
||||
int32_t radius, int32_t start_angle, int32_t end_angle)
|
||||
{
|
||||
|
||||
vg_lite_buffer_t vgbuf;
|
||||
vg_lite_error_t err = VG_LITE_SUCCESS;
|
||||
lv_color32_t col32 = {.full = lv_color_to32(dsc->color)}; /*Convert color to RGBA8888*/
|
||||
lv_coord_t dest_width = lv_area_get_width(draw_ctx->buf_area);
|
||||
lv_coord_t dest_height = lv_area_get_height(draw_ctx->buf_area);
|
||||
vg_lite_path_t path;
|
||||
vg_lite_color_t vgcol; /* vglite takes ABGR */
|
||||
vg_lite_matrix_t matrix;
|
||||
lv_opa_t opa = dsc->opa;
|
||||
bool donut = ((end_angle - start_angle) % 360 == 0) ? true : false;
|
||||
lv_point_t clip_center = {center->x - draw_ctx->buf_area->x1, center->y - draw_ctx->buf_area->y1};
|
||||
|
||||
/* path: max size = 16 cubic bezier (7 words each) */
|
||||
int32_t arc_path[16 * 7];
|
||||
lv_memset_00(arc_path, sizeof(arc_path));
|
||||
|
||||
/*** Init destination buffer ***/
|
||||
if(lv_vglite_init_buf(&vgbuf, (uint32_t)dest_width, (uint32_t)dest_height, (uint32_t)dest_width * sizeof(lv_color_t),
|
||||
(const lv_color_t *)draw_ctx->buf, false) != LV_RES_OK)
|
||||
VG_LITE_RETURN_INV("Init buffer failed.");
|
||||
|
||||
/*** Init path ***/
|
||||
lv_coord_t width = dsc->width; /* inner arc radius = outer arc radius - width */
|
||||
if(width > (lv_coord_t)radius)
|
||||
width = radius;
|
||||
|
||||
int pidx = 0;
|
||||
int32_t cp_x, cp_y; /* control point coords */
|
||||
|
||||
/* first control point of curve */
|
||||
cp_x = radius;
|
||||
cp_y = 0;
|
||||
rotate_point(start_angle, &cp_x, &cp_y);
|
||||
arc_path[pidx++] = VLC_OP_MOVE;
|
||||
arc_path[pidx++] = clip_center.x + cp_x;
|
||||
arc_path[pidx++] = clip_center.y + cp_y;
|
||||
|
||||
/* draw 1-5 outer quarters */
|
||||
add_arc_path(arc_path, &pidx, radius, start_angle, end_angle, clip_center, true);
|
||||
|
||||
if(donut) {
|
||||
/* close outer circle */
|
||||
cp_x = radius;
|
||||
cp_y = 0;
|
||||
rotate_point(start_angle, &cp_x, &cp_y);
|
||||
arc_path[pidx++] = VLC_OP_LINE;
|
||||
arc_path[pidx++] = clip_center.x + cp_x;
|
||||
arc_path[pidx++] = clip_center.y + cp_y;
|
||||
/* start inner circle */
|
||||
cp_x = radius - width;
|
||||
cp_y = 0;
|
||||
rotate_point(start_angle, &cp_x, &cp_y);
|
||||
arc_path[pidx++] = VLC_OP_MOVE;
|
||||
arc_path[pidx++] = clip_center.x + cp_x;
|
||||
arc_path[pidx++] = clip_center.y + cp_y;
|
||||
|
||||
}
|
||||
else if(dsc->rounded != 0U) { /* 1st rounded arc ending */
|
||||
cp_x = radius - width / 2;
|
||||
cp_y = 0;
|
||||
rotate_point(end_angle, &cp_x, &cp_y);
|
||||
lv_point_t round_center = {clip_center.x + cp_x, clip_center.y + cp_y};
|
||||
add_arc_path(arc_path, &pidx, width / 2, end_angle, (end_angle + 180),
|
||||
round_center, true);
|
||||
|
||||
}
|
||||
else { /* 1st flat ending */
|
||||
cp_x = radius - width;
|
||||
cp_y = 0;
|
||||
rotate_point(end_angle, &cp_x, &cp_y);
|
||||
arc_path[pidx++] = VLC_OP_LINE;
|
||||
arc_path[pidx++] = clip_center.x + cp_x;
|
||||
arc_path[pidx++] = clip_center.y + cp_y;
|
||||
}
|
||||
|
||||
/* draw 1-5 inner quarters */
|
||||
add_arc_path(arc_path, &pidx, radius - width, start_angle, end_angle, clip_center, false);
|
||||
|
||||
/* last control point of curve */
|
||||
if(donut) { /* close the loop */
|
||||
cp_x = radius - width;
|
||||
cp_y = 0;
|
||||
rotate_point(start_angle, &cp_x, &cp_y);
|
||||
arc_path[pidx++] = VLC_OP_LINE;
|
||||
arc_path[pidx++] = clip_center.x + cp_x;
|
||||
arc_path[pidx++] = clip_center.y + cp_y;
|
||||
|
||||
}
|
||||
else if(dsc->rounded != 0U) { /* 2nd rounded arc ending */
|
||||
cp_x = radius - width / 2;
|
||||
cp_y = 0;
|
||||
rotate_point(start_angle, &cp_x, &cp_y);
|
||||
lv_point_t round_center = {clip_center.x + cp_x, clip_center.y + cp_y};
|
||||
add_arc_path(arc_path, &pidx, width / 2, (start_angle + 180), (start_angle + 360),
|
||||
round_center, true);
|
||||
|
||||
}
|
||||
else { /* 2nd flat ending */
|
||||
cp_x = radius;
|
||||
cp_y = 0;
|
||||
rotate_point(start_angle, &cp_x, &cp_y);
|
||||
arc_path[pidx++] = VLC_OP_LINE;
|
||||
arc_path[pidx++] = clip_center.x + cp_x;
|
||||
arc_path[pidx++] = clip_center.y + cp_y;
|
||||
}
|
||||
|
||||
arc_path[pidx++] = VLC_OP_END;
|
||||
|
||||
err = vg_lite_init_path(&path, VG_LITE_S32, VG_LITE_HIGH, (uint32_t)pidx * sizeof(int32_t), arc_path,
|
||||
(vg_lite_float_t) draw_ctx->clip_area->x1, (vg_lite_float_t) draw_ctx->clip_area->y1,
|
||||
((vg_lite_float_t) draw_ctx->clip_area->x2) + 1.0f, ((vg_lite_float_t) draw_ctx->clip_area->y2) + 1.0f);
|
||||
VG_LITE_ERR_RETURN_INV(err, "Init path failed.");
|
||||
|
||||
/* set rotation angle */
|
||||
vg_lite_identity(&matrix);
|
||||
|
||||
if(opa <= (lv_opa_t)LV_OPA_MAX) {
|
||||
/* Only pre-multiply color if hardware pre-multiplication is not present */
|
||||
if(!vg_lite_query_feature(gcFEATURE_BIT_VG_PE_PREMULTIPLY)) {
|
||||
col32.ch.red = (uint8_t)(((uint16_t)col32.ch.red * opa) >> 8);
|
||||
col32.ch.green = (uint8_t)(((uint16_t)col32.ch.green * opa) >> 8);
|
||||
col32.ch.blue = (uint8_t)(((uint16_t)col32.ch.blue * opa) >> 8);
|
||||
}
|
||||
col32.ch.alpha = opa;
|
||||
}
|
||||
|
||||
#if LV_COLOR_DEPTH==16
|
||||
vgcol = col32.full;
|
||||
#else /*LV_COLOR_DEPTH==32*/
|
||||
vgcol = ((uint32_t)col32.ch.alpha << 24) | ((uint32_t)col32.ch.blue << 16) | ((uint32_t)col32.ch.green << 8) |
|
||||
(uint32_t)col32.ch.red;
|
||||
#endif
|
||||
|
||||
/*Clean & invalidate cache*/
|
||||
lv_vglite_invalidate_cache();
|
||||
|
||||
/*** Draw arc ***/
|
||||
err = vg_lite_draw(&vgbuf, &path, VG_LITE_FILL_NON_ZERO, &matrix, VG_LITE_BLEND_SRC_OVER, vgcol);
|
||||
VG_LITE_ERR_RETURN_INV(err, "Draw arc failed.");
|
||||
|
||||
err = vg_lite_finish();
|
||||
VG_LITE_ERR_RETURN_INV(err, "Finish failed.");
|
||||
|
||||
err = vg_lite_clear_path(&path);
|
||||
VG_LITE_ERR_RETURN_INV(err, "Clear path failed.");
|
||||
|
||||
return LV_RES_OK;
|
||||
}
|
||||
|
||||
/**********************
|
||||
* STATIC FUNCTIONS
|
||||
**********************/
|
||||
|
||||
static void copy_arc(vg_arc * dst, vg_arc * src)
|
||||
{
|
||||
dst->quarter = src->quarter;
|
||||
dst->rad = src->rad;
|
||||
dst->angle = src->angle;
|
||||
dst->p0x = src->p0x;
|
||||
dst->p1x = src->p1x;
|
||||
dst->p2x = src->p2x;
|
||||
dst->p3x = src->p3x;
|
||||
dst->p0y = src->p0y;
|
||||
dst->p1y = src->p1y;
|
||||
dst->p2y = src->p2y;
|
||||
dst->p3y = src->p3y;
|
||||
}
|
||||
|
||||
/**
|
||||
* Rotate the point according given rotation angle rotation center is 0,0
|
||||
*/
|
||||
static void rotate_point(int32_t angle, int32_t * x, int32_t * y)
|
||||
{
|
||||
int32_t ori_x = *x;
|
||||
int32_t ori_y = *y;
|
||||
int16_t alpha = (int16_t)angle;
|
||||
*x = ((lv_trigo_cos(alpha) * ori_x) / LV_TRIGO_SIN_MAX) - ((lv_trigo_sin(alpha) * ori_y) / LV_TRIGO_SIN_MAX);
|
||||
*y = ((lv_trigo_sin(alpha) * ori_x) / LV_TRIGO_SIN_MAX) + ((lv_trigo_cos(alpha) * ori_y) / LV_TRIGO_SIN_MAX);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set full arc control points depending on quarter.
|
||||
* Control points match the best approximation of a circle.
|
||||
* Arc Quarter position is:
|
||||
* Q2 | Q3
|
||||
* ---+---
|
||||
* Q1 | Q0
|
||||
*/
|
||||
static void set_full_arc(vg_arc * fullarc)
|
||||
{
|
||||
/* the tangent lenght for the bezier circle approx */
|
||||
float tang = ((float)fullarc->rad) * BEZIER_OPTIM_CIRCLE;
|
||||
switch(fullarc->quarter) {
|
||||
case 0:
|
||||
/* first quarter */
|
||||
fullarc->p0x = fullarc->rad;
|
||||
fullarc->p0y = 0;
|
||||
fullarc->p1x = fullarc->rad;
|
||||
fullarc->p1y = (int32_t)tang;
|
||||
fullarc->p2x = (int32_t)tang;
|
||||
fullarc->p2y = fullarc->rad;
|
||||
fullarc->p3x = 0;
|
||||
fullarc->p3y = fullarc->rad;
|
||||
break;
|
||||
case 1:
|
||||
/* second quarter */
|
||||
fullarc->p0x = 0;
|
||||
fullarc->p0y = fullarc->rad;
|
||||
fullarc->p1x = 0 - (int32_t)tang;
|
||||
fullarc->p1y = fullarc->rad;
|
||||
fullarc->p2x = 0 - fullarc->rad;
|
||||
fullarc->p2y = (int32_t)tang;
|
||||
fullarc->p3x = 0 - fullarc->rad;
|
||||
fullarc->p3y = 0;
|
||||
break;
|
||||
case 2:
|
||||
/* third quarter */
|
||||
fullarc->p0x = 0 - fullarc->rad;
|
||||
fullarc->p0y = 0;
|
||||
fullarc->p1x = 0 - fullarc->rad;
|
||||
fullarc->p1y = 0 - (int32_t)tang;
|
||||
fullarc->p2x = 0 - (int32_t)tang;
|
||||
fullarc->p2y = 0 - fullarc->rad;
|
||||
fullarc->p3x = 0;
|
||||
fullarc->p3y = 0 - fullarc->rad;
|
||||
break;
|
||||
case 3:
|
||||
/* fourth quarter */
|
||||
fullarc->p0x = 0;
|
||||
fullarc->p0y = 0 - fullarc->rad;
|
||||
fullarc->p1x = (int32_t)tang;
|
||||
fullarc->p1y = 0 - fullarc->rad;
|
||||
fullarc->p2x = fullarc->rad;
|
||||
fullarc->p2y = 0 - (int32_t)tang;
|
||||
fullarc->p3x = fullarc->rad;
|
||||
fullarc->p3y = 0;
|
||||
break;
|
||||
default:
|
||||
LV_LOG_ERROR("Invalid arc quarter value.");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Linear interpolation between two points 'a' and 'b'
|
||||
* 't' parameter is the proportion ratio expressed in range [0 ; T_FRACTION ]
|
||||
*/
|
||||
static inline float lerp(float coord_a, float coord_b, uint16_t t)
|
||||
{
|
||||
float tf = (float)t;
|
||||
return ((T_FRACTION - tf) * coord_a + tf * coord_b) / T_FRACTION;
|
||||
}
|
||||
|
||||
/**
|
||||
* Computes a point of bezier curve given 't' param
|
||||
*/
|
||||
static inline float comp_bezier_point(float t, cubic_cont_pt cp)
|
||||
{
|
||||
float t_sq = t * t;
|
||||
float inv_t_sq = (1.0f - t) * (1.0f - t);
|
||||
float apt = (1.0f - t) * inv_t_sq * cp.p0 + 3.0f * inv_t_sq * t * cp.p1 + 3.0f * (1.0f - t) * t_sq * cp.p2 + t * t_sq *
|
||||
cp.p3;
|
||||
return apt;
|
||||
}
|
||||
|
||||
/**
|
||||
* Find parameter 't' in curve at point 'pt'
|
||||
* proceed by dichotomy on only 1 dimension,
|
||||
* works only if the curve is monotonic
|
||||
* bezier curve is defined by control points [p0 p1 p2 p3]
|
||||
* 'dec' tells if curve is decreasing (true) or increasing (false)
|
||||
*/
|
||||
static uint16_t get_bez_t_from_pos(float pt, cubic_cont_pt cp, bool dec)
|
||||
{
|
||||
/* initialize dichotomy with boundary 't' values */
|
||||
float t_low = 0.0f;
|
||||
float t_mid = 0.5f;
|
||||
float t_hig = 1.0f;
|
||||
float a_pt;
|
||||
/* dichotomy loop */
|
||||
for(int i = 0; i < DICHOTO_ITER; i++) {
|
||||
a_pt = comp_bezier_point(t_mid, cp);
|
||||
/* check mid-point position on bezier curve versus targeted point */
|
||||
if((a_pt > pt) != dec) {
|
||||
t_hig = t_mid;
|
||||
}
|
||||
else {
|
||||
t_low = t_mid;
|
||||
}
|
||||
/* define new 't' param for mid-point */
|
||||
t_mid = (t_low + t_hig) / 2.0f;
|
||||
}
|
||||
/* return parameter 't' in integer range [0 ; T_FRACTION] */
|
||||
return (uint16_t)floorf(t_mid * T_FRACTION + 0.5f);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gives relative coords of the control points
|
||||
* for the sub-arc starting at angle with given angle span
|
||||
*/
|
||||
static void get_subarc_control_points(vg_arc * arc, int32_t span)
|
||||
{
|
||||
vg_arc fullarc;
|
||||
fullarc.angle = arc->angle;
|
||||
fullarc.quarter = arc->quarter;
|
||||
fullarc.rad = arc->rad;
|
||||
set_full_arc(&fullarc);
|
||||
|
||||
/* special case of full arc */
|
||||
if(arc->angle == 90) {
|
||||
copy_arc(arc, &fullarc);
|
||||
return;
|
||||
}
|
||||
|
||||
/* compute 1st arc using the geometric construction of curve */
|
||||
uint16_t t2 = TperDegree[arc->angle + span];
|
||||
|
||||
/* lerp for A */
|
||||
float a2x = lerp((float)fullarc.p0x, (float)fullarc.p1x, t2);
|
||||
float a2y = lerp((float)fullarc.p0y, (float)fullarc.p1y, t2);
|
||||
/* lerp for B */
|
||||
float b2x = lerp((float)fullarc.p1x, (float)fullarc.p2x, t2);
|
||||
float b2y = lerp((float)fullarc.p1y, (float)fullarc.p2y, t2);
|
||||
/* lerp for C */
|
||||
float c2x = lerp((float)fullarc.p2x, (float)fullarc.p3x, t2);
|
||||
float c2y = lerp((float)fullarc.p2y, (float)fullarc.p3y, t2);
|
||||
|
||||
/* lerp for D */
|
||||
float d2x = lerp(a2x, b2x, t2);
|
||||
float d2y = lerp(a2y, b2y, t2);
|
||||
/* lerp for E */
|
||||
float e2x = lerp(b2x, c2x, t2);
|
||||
float e2y = lerp(b2y, c2y, t2);
|
||||
|
||||
float pt2x = lerp(d2x, e2x, t2);
|
||||
float pt2y = lerp(d2y, e2y, t2);
|
||||
|
||||
/* compute sub-arc using the geometric construction of curve */
|
||||
uint16_t t1 = TperDegree[arc->angle];
|
||||
|
||||
/* lerp for A */
|
||||
float a1x = lerp((float)fullarc.p0x, (float)fullarc.p1x, t1);
|
||||
float a1y = lerp((float)fullarc.p0y, (float)fullarc.p1y, t1);
|
||||
/* lerp for B */
|
||||
float b1x = lerp((float)fullarc.p1x, (float)fullarc.p2x, t1);
|
||||
float b1y = lerp((float)fullarc.p1y, (float)fullarc.p2y, t1);
|
||||
/* lerp for C */
|
||||
float c1x = lerp((float)fullarc.p2x, (float)fullarc.p3x, t1);
|
||||
float c1y = lerp((float)fullarc.p2y, (float)fullarc.p3y, t1);
|
||||
|
||||
/* lerp for D */
|
||||
float d1x = lerp(a1x, b1x, t1);
|
||||
float d1y = lerp(a1y, b1y, t1);
|
||||
/* lerp for E */
|
||||
float e1x = lerp(b1x, c1x, t1);
|
||||
float e1y = lerp(b1y, c1y, t1);
|
||||
|
||||
float pt1x = lerp(d1x, e1x, t1);
|
||||
float pt1y = lerp(d1y, e1y, t1);
|
||||
|
||||
/* find the 't3' parameter for point P(t1) on the sub-arc [P0 A2 D2 P(t2)] using dichotomy
|
||||
* use position of x axis only */
|
||||
uint16_t t3;
|
||||
t3 = get_bez_t_from_pos(pt1x,
|
||||
(cubic_cont_pt) {
|
||||
.p0 = ((float)fullarc.p0x), .p1 = a2x, .p2 = d2x, .p3 = pt2x
|
||||
},
|
||||
(bool)(pt2x < (float)fullarc.p0x));
|
||||
|
||||
/* lerp for B */
|
||||
float b3x = lerp(a2x, d2x, t3);
|
||||
float b3y = lerp(a2y, d2y, t3);
|
||||
/* lerp for C */
|
||||
float c3x = lerp(d2x, pt2x, t3);
|
||||
float c3y = lerp(d2y, pt2y, t3);
|
||||
|
||||
/* lerp for E */
|
||||
float e3x = lerp(b3x, c3x, t3);
|
||||
float e3y = lerp(b3y, c3y, t3);
|
||||
|
||||
arc->p0x = (int32_t)floorf(0.5f + pt1x);
|
||||
arc->p0y = (int32_t)floorf(0.5f + pt1y);
|
||||
arc->p1x = (int32_t)floorf(0.5f + e3x);
|
||||
arc->p1y = (int32_t)floorf(0.5f + e3y);
|
||||
arc->p2x = (int32_t)floorf(0.5f + c3x);
|
||||
arc->p2y = (int32_t)floorf(0.5f + c3y);
|
||||
arc->p3x = (int32_t)floorf(0.5f + pt2x);
|
||||
arc->p3y = (int32_t)floorf(0.5f + pt2y);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gives relative coords of the control points
|
||||
*/
|
||||
static void get_arc_control_points(vg_arc * arc, bool start)
|
||||
{
|
||||
vg_arc fullarc;
|
||||
fullarc.angle = arc->angle;
|
||||
fullarc.quarter = arc->quarter;
|
||||
fullarc.rad = arc->rad;
|
||||
set_full_arc(&fullarc);
|
||||
|
||||
/* special case of full arc */
|
||||
if(arc->angle == 90) {
|
||||
copy_arc(arc, &fullarc);
|
||||
return;
|
||||
}
|
||||
|
||||
/* compute sub-arc using the geometric construction of curve */
|
||||
uint16_t t = TperDegree[arc->angle];
|
||||
/* lerp for A */
|
||||
float ax = lerp((float)fullarc.p0x, (float)fullarc.p1x, t);
|
||||
float ay = lerp((float)fullarc.p0y, (float)fullarc.p1y, t);
|
||||
/* lerp for B */
|
||||
float bx = lerp((float)fullarc.p1x, (float)fullarc.p2x, t);
|
||||
float by = lerp((float)fullarc.p1y, (float)fullarc.p2y, t);
|
||||
/* lerp for C */
|
||||
float cx = lerp((float)fullarc.p2x, (float)fullarc.p3x, t);
|
||||
float cy = lerp((float)fullarc.p2y, (float)fullarc.p3y, t);
|
||||
|
||||
/* lerp for D */
|
||||
float dx = lerp(ax, bx, t);
|
||||
float dy = lerp(ay, by, t);
|
||||
/* lerp for E */
|
||||
float ex = lerp(bx, cx, t);
|
||||
float ey = lerp(by, cy, t);
|
||||
|
||||
/* sub-arc's control points are tangents of DeCasteljau's algorithm */
|
||||
if(start) {
|
||||
arc->p0x = (int32_t)floorf(0.5f + lerp(dx, ex, t));
|
||||
arc->p0y = (int32_t)floorf(0.5f + lerp(dy, ey, t));
|
||||
arc->p1x = (int32_t)floorf(0.5f + ex);
|
||||
arc->p1y = (int32_t)floorf(0.5f + ey);
|
||||
arc->p2x = (int32_t)floorf(0.5f + cx);
|
||||
arc->p2y = (int32_t)floorf(0.5f + cy);
|
||||
arc->p3x = fullarc.p3x;
|
||||
arc->p3y = fullarc.p3y;
|
||||
}
|
||||
else {
|
||||
arc->p0x = fullarc.p0x;
|
||||
arc->p0y = fullarc.p0y;
|
||||
arc->p1x = (int32_t)floorf(0.5f + ax);
|
||||
arc->p1y = (int32_t)floorf(0.5f + ay);
|
||||
arc->p2x = (int32_t)floorf(0.5f + dx);
|
||||
arc->p2y = (int32_t)floorf(0.5f + dy);
|
||||
arc->p3x = (int32_t)floorf(0.5f + lerp(dx, ex, t));
|
||||
arc->p3y = (int32_t)floorf(0.5f + lerp(dy, ey, t));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Add the arc control points into the path data for vglite,
|
||||
* taking into account the real center of the arc (translation).
|
||||
* arc_path: (in/out) the path data array for vglite
|
||||
* pidx: (in/out) index of last element added in arc_path
|
||||
* q_arc: (in) the arc data containing control points
|
||||
* center: (in) the center of the circle in draw coordinates
|
||||
* cw: (in) true if arc is clockwise
|
||||
*/
|
||||
static void add_split_arc_path(int32_t * arc_path, int * pidx, vg_arc * q_arc, lv_point_t center, bool cw)
|
||||
{
|
||||
/* assumes first control point already in array arc_path[] */
|
||||
int idx = *pidx;
|
||||
if(cw) {
|
||||
#if BEZIER_DBG_CONTROL_POINTS
|
||||
arc_path[idx++] = VLC_OP_LINE;
|
||||
arc_path[idx++] = q_arc->p1x + center.x;
|
||||
arc_path[idx++] = q_arc->p1y + center.y;
|
||||
arc_path[idx++] = VLC_OP_LINE;
|
||||
arc_path[idx++] = q_arc->p2x + center.x;
|
||||
arc_path[idx++] = q_arc->p2y + center.y;
|
||||
arc_path[idx++] = VLC_OP_LINE;
|
||||
arc_path[idx++] = q_arc->p3x + center.x;
|
||||
arc_path[idx++] = q_arc->p3y + center.y;
|
||||
#else
|
||||
arc_path[idx++] = VLC_OP_CUBIC;
|
||||
arc_path[idx++] = q_arc->p1x + center.x;
|
||||
arc_path[idx++] = q_arc->p1y + center.y;
|
||||
arc_path[idx++] = q_arc->p2x + center.x;
|
||||
arc_path[idx++] = q_arc->p2y + center.y;
|
||||
arc_path[idx++] = q_arc->p3x + center.x;
|
||||
arc_path[idx++] = q_arc->p3y + center.y;
|
||||
#endif
|
||||
}
|
||||
else { /* reverse points order when counter-clockwise */
|
||||
#if BEZIER_DBG_CONTROL_POINTS
|
||||
arc_path[idx++] = VLC_OP_LINE;
|
||||
arc_path[idx++] = q_arc->p2x + center.x;
|
||||
arc_path[idx++] = q_arc->p2y + center.y;
|
||||
arc_path[idx++] = VLC_OP_LINE;
|
||||
arc_path[idx++] = q_arc->p1x + center.x;
|
||||
arc_path[idx++] = q_arc->p1y + center.y;
|
||||
arc_path[idx++] = VLC_OP_LINE;
|
||||
arc_path[idx++] = q_arc->p0x + center.x;
|
||||
arc_path[idx++] = q_arc->p0y + center.y;
|
||||
#else
|
||||
arc_path[idx++] = VLC_OP_CUBIC;
|
||||
arc_path[idx++] = q_arc->p2x + center.x;
|
||||
arc_path[idx++] = q_arc->p2y + center.y;
|
||||
arc_path[idx++] = q_arc->p1x + center.x;
|
||||
arc_path[idx++] = q_arc->p1y + center.y;
|
||||
arc_path[idx++] = q_arc->p0x + center.x;
|
||||
arc_path[idx++] = q_arc->p0y + center.y;
|
||||
#endif
|
||||
}
|
||||
/* update index i n path array*/
|
||||
*pidx = idx;
|
||||
}
|
||||
|
||||
static void add_arc_path(int32_t * arc_path, int * pidx, int32_t radius,
|
||||
int32_t start_angle, int32_t end_angle, lv_point_t center, bool cw)
|
||||
{
|
||||
/* set number of arcs to draw */
|
||||
vg_arc q_arc;
|
||||
int32_t start_arc_angle = start_angle % 90;
|
||||
int32_t end_arc_angle = end_angle % 90;
|
||||
int32_t inv_start_arc_angle = (start_arc_angle > 0) ? (90 - start_arc_angle) : 0;
|
||||
int32_t nbarc = (end_angle - start_angle - inv_start_arc_angle - end_arc_angle) / 90;
|
||||
q_arc.rad = radius;
|
||||
|
||||
/* handle special case of start & end point in the same quarter */
|
||||
if(((start_angle / 90) == (end_angle / 90)) && (nbarc <= 0)) {
|
||||
q_arc.quarter = (start_angle / 90) % 4;
|
||||
q_arc.angle = start_arc_angle;
|
||||
get_subarc_control_points(&q_arc, end_arc_angle - start_arc_angle);
|
||||
add_split_arc_path(arc_path, pidx, &q_arc, center, cw);
|
||||
return;
|
||||
}
|
||||
|
||||
if(cw) {
|
||||
/* partial starting arc */
|
||||
if(start_arc_angle > 0) {
|
||||
q_arc.quarter = (start_angle / 90) % 4;
|
||||
q_arc.angle = start_arc_angle;
|
||||
/* get cubic points relative to center */
|
||||
get_arc_control_points(&q_arc, true);
|
||||
/* put cubic points in arc_path */
|
||||
add_split_arc_path(arc_path, pidx, &q_arc, center, cw);
|
||||
}
|
||||
/* full arcs */
|
||||
for(int32_t q = 0; q < nbarc ; q++) {
|
||||
q_arc.quarter = (q + ((start_angle + 89) / 90)) % 4;
|
||||
q_arc.angle = 90;
|
||||
/* get cubic points relative to center */
|
||||
get_arc_control_points(&q_arc, true); /* 2nd parameter 'start' ignored */
|
||||
/* put cubic points in arc_path */
|
||||
add_split_arc_path(arc_path, pidx, &q_arc, center, cw);
|
||||
}
|
||||
/* partial ending arc */
|
||||
if(end_arc_angle > 0) {
|
||||
q_arc.quarter = (end_angle / 90) % 4;
|
||||
q_arc.angle = end_arc_angle;
|
||||
/* get cubic points relative to center */
|
||||
get_arc_control_points(&q_arc, false);
|
||||
/* put cubic points in arc_path */
|
||||
add_split_arc_path(arc_path, pidx, &q_arc, center, cw);
|
||||
}
|
||||
|
||||
}
|
||||
else { /* counter clockwise */
|
||||
|
||||
/* partial ending arc */
|
||||
if(end_arc_angle > 0) {
|
||||
q_arc.quarter = (end_angle / 90) % 4;
|
||||
q_arc.angle = end_arc_angle;
|
||||
/* get cubic points relative to center */
|
||||
get_arc_control_points(&q_arc, false);
|
||||
/* put cubic points in arc_path */
|
||||
add_split_arc_path(arc_path, pidx, &q_arc, center, cw);
|
||||
}
|
||||
/* full arcs */
|
||||
for(int32_t q = nbarc - 1; q >= 0; q--) {
|
||||
q_arc.quarter = (q + ((start_angle + 89) / 90)) % 4;
|
||||
q_arc.angle = 90;
|
||||
/* get cubic points relative to center */
|
||||
get_arc_control_points(&q_arc, true); /* 2nd parameter 'start' ignored */
|
||||
/* put cubic points in arc_path */
|
||||
add_split_arc_path(arc_path, pidx, &q_arc, center, cw);
|
||||
}
|
||||
/* partial starting arc */
|
||||
if(start_arc_angle > 0) {
|
||||
q_arc.quarter = (start_angle / 90) % 4;
|
||||
q_arc.angle = start_arc_angle;
|
||||
/* get cubic points relative to center */
|
||||
get_arc_control_points(&q_arc, true);
|
||||
/* put cubic points in arc_path */
|
||||
add_split_arc_path(arc_path, pidx, &q_arc, center, cw);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif /*LV_USE_GPU_NXP_VG_LITE*/
|
@ -0,0 +1,79 @@
|
||||
/**
|
||||
* @file lv_draw_vglite_arc.h
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* MIT License
|
||||
*
|
||||
* Copyright 2021, 2022 NXP
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights to
|
||||
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||
* the Software, and to permit persons to whom the Software is furnished to do so,
|
||||
* subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice (including the next paragraph)
|
||||
* shall be included in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
|
||||
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
|
||||
* PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
||||
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
|
||||
* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
|
||||
* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef LV_DRAW_VGLITE_ARC_H
|
||||
#define LV_DRAW_VGLITE_ARC_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*********************
|
||||
* INCLUDES
|
||||
*********************/
|
||||
#include "../../../lv_conf_internal.h"
|
||||
|
||||
#if LV_USE_GPU_NXP_VG_LITE
|
||||
#include "lv_gpu_nxp_vglite.h"
|
||||
|
||||
/*********************
|
||||
* DEFINES
|
||||
*********************/
|
||||
|
||||
/**********************
|
||||
* TYPEDEFS
|
||||
**********************/
|
||||
|
||||
/**********************
|
||||
* GLOBAL PROTOTYPES
|
||||
**********************/
|
||||
|
||||
/***
|
||||
* Draw arc shape with effects
|
||||
* @param draw_ctx drawing context
|
||||
* @param dsc the arc description structure (width, rounded ending, opacity)
|
||||
* @param center the coordinates of the arc center
|
||||
* @param radius the radius of external arc
|
||||
* @param start_angle the starting angle in degrees
|
||||
* @param end_angle the ending angle in degrees
|
||||
*/
|
||||
lv_res_t lv_gpu_nxp_vglite_draw_arc(lv_draw_ctx_t * draw_ctx, const lv_draw_arc_dsc_t * dsc, const lv_point_t * center,
|
||||
int32_t radius, int32_t start_angle, int32_t end_angle);
|
||||
|
||||
/**********************
|
||||
* MACROS
|
||||
**********************/
|
||||
|
||||
#endif /*LV_USE_GPU_NXP_VG_LITE*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /*extern "C"*/
|
||||
#endif
|
||||
|
||||
#endif /*LV_DRAW_VGLITE_ARC_H*/
|
@ -0,0 +1,618 @@
|
||||
/**
|
||||
* @file lv_draw_vglite_blend.c
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* MIT License
|
||||
*
|
||||
* Copyright 2020-2022 NXP
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights to
|
||||
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||
* the Software, and to permit persons to whom the Software is furnished to do so,
|
||||
* subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice (including the next paragraph)
|
||||
* shall be included in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
|
||||
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
|
||||
* PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
||||
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
|
||||
* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
|
||||
* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
*/
|
||||
|
||||
/*********************
|
||||
* INCLUDES
|
||||
*********************/
|
||||
|
||||
#include "lv_draw_vglite_blend.h"
|
||||
|
||||
#if LV_USE_GPU_NXP_VG_LITE
|
||||
|
||||
/*********************
|
||||
* DEFINES
|
||||
*********************/
|
||||
|
||||
/* Enable BLIT quality degradation workaround for RT595, recommended for screen's dimension > 352 pixels */
|
||||
#define RT595_BLIT_WRKRND_ENABLED 1
|
||||
|
||||
/* Internal compound symbol */
|
||||
#if (defined(CPU_MIMXRT595SFFOB) || defined(CPU_MIMXRT595SFFOB_cm33) || \
|
||||
defined(CPU_MIMXRT595SFFOC) || defined(CPU_MIMXRT595SFFOC_cm33)) && \
|
||||
RT595_BLIT_WRKRND_ENABLED
|
||||
#define VG_LITE_BLIT_SPLIT_ENABLED 1
|
||||
#else
|
||||
#define VG_LITE_BLIT_SPLIT_ENABLED 0
|
||||
#endif
|
||||
|
||||
/**
|
||||
* BLIT split threshold - BLITs with width or height higher than this value will be done
|
||||
* in multiple steps. Value must be 16-aligned. Don't change.
|
||||
*/
|
||||
#define LV_GPU_NXP_VG_LITE_BLIT_SPLIT_THR 352
|
||||
|
||||
|
||||
/**********************
|
||||
* TYPEDEFS
|
||||
**********************/
|
||||
|
||||
/**********************
|
||||
* STATIC PROTOTYPES
|
||||
**********************/
|
||||
|
||||
/**
|
||||
* BLock Image Transfer - single direct BLIT.
|
||||
*
|
||||
* @param[in] blit Description of the transfer
|
||||
* @retval LV_RES_OK Transfer complete
|
||||
* @retval LV_RES_INV Error occurred (\see LV_GPU_NXP_VG_LITE_LOG_ERRORS)
|
||||
*/
|
||||
static lv_res_t _lv_gpu_nxp_vglite_blit_single(lv_gpu_nxp_vglite_blit_info_t * blit);
|
||||
|
||||
#if VG_LITE_BLIT_SPLIT_ENABLED
|
||||
|
||||
/**
|
||||
* Move buffer pointer as close as possible to area, but with respect to alignment requirements. X-axis only.
|
||||
*
|
||||
* @param[in,out] area Area to be updated
|
||||
* @param[in,out] buf Pointer to be updated
|
||||
*/
|
||||
static void _align_x(lv_area_t * area, lv_color_t ** buf);
|
||||
|
||||
/**
|
||||
* Move buffer pointer to the area start and update variables, Y-axis only.
|
||||
*
|
||||
* @param[in,out] area Area to be updated
|
||||
* @param[in,out] buf Pointer to be updated
|
||||
* @param[in] stridePx Buffer stride in pixels
|
||||
*/
|
||||
static void _align_y(lv_area_t * area, lv_color_t ** buf, uint32_t stridePx);
|
||||
|
||||
/**
|
||||
* Software BLIT as a fall-back scenario.
|
||||
*
|
||||
* @param[in] blit BLIT configuration
|
||||
*/
|
||||
static void _sw_blit(lv_gpu_nxp_vglite_blit_info_t * blit);
|
||||
|
||||
/**
|
||||
* Verify BLIT structure - widths, stride, pointer alignment
|
||||
*
|
||||
* @param[in] blit BLIT configuration
|
||||
* @retval LV_RES_OK
|
||||
* @retval LV_RES_INV Error occurred (\see LV_GPU_NXP_VG_LITE_LOG_ERRORS)
|
||||
*/
|
||||
static lv_res_t _lv_gpu_nxp_vglite_check_blit(lv_gpu_nxp_vglite_blit_info_t * blit);
|
||||
|
||||
/**
|
||||
* BLock Image Transfer - split BLIT.
|
||||
*
|
||||
* @param[in] blit BLIT configuration
|
||||
* @retval LV_RES_OK Transfer complete
|
||||
* @retval LV_RES_INV Error occurred (\see LV_GPU_NXP_VG_LITE_LOG_ERRORS)
|
||||
*/
|
||||
static lv_res_t _lv_gpu_nxp_vglite_blit_split(lv_gpu_nxp_vglite_blit_info_t * blit);
|
||||
#endif
|
||||
|
||||
/**********************
|
||||
* STATIC VARIABLES
|
||||
**********************/
|
||||
|
||||
/**********************
|
||||
* MACROS
|
||||
**********************/
|
||||
|
||||
/**********************
|
||||
* GLOBAL FUNCTIONS
|
||||
**********************/
|
||||
|
||||
lv_res_t lv_gpu_nxp_vglite_fill(lv_color_t * dest_buf, lv_coord_t dest_width, lv_coord_t dest_height,
|
||||
const lv_area_t * fill_area, lv_color_t color, lv_opa_t opa)
|
||||
{
|
||||
uint32_t area_size = lv_area_get_size(fill_area);
|
||||
lv_coord_t area_w = lv_area_get_width(fill_area);
|
||||
lv_coord_t area_h = lv_area_get_height(fill_area);
|
||||
|
||||
if(opa >= (lv_opa_t)LV_OPA_MAX) {
|
||||
if(area_size < LV_GPU_NXP_VG_LITE_FILL_SIZE_LIMIT)
|
||||
VG_LITE_RETURN_INV("Area size %d smaller than limit %d.", area_size, LV_GPU_NXP_VG_LITE_FILL_SIZE_LIMIT);
|
||||
}
|
||||
else {
|
||||
if(area_size < LV_GPU_NXP_VG_LITE_FILL_OPA_SIZE_LIMIT)
|
||||
VG_LITE_RETURN_INV("Area size %d smaller than limit %d.", area_size, LV_GPU_NXP_VG_LITE_FILL_OPA_SIZE_LIMIT);
|
||||
}
|
||||
|
||||
vg_lite_buffer_t vgbuf;
|
||||
vg_lite_rectangle_t rect;
|
||||
vg_lite_error_t err = VG_LITE_SUCCESS;
|
||||
lv_color32_t col32 = {.full = lv_color_to32(color)}; /*Convert color to RGBA8888*/
|
||||
vg_lite_color_t vgcol; /* vglite takes ABGR */
|
||||
|
||||
if(lv_vglite_init_buf(&vgbuf, (uint32_t)dest_width, (uint32_t)dest_height, (uint32_t)dest_width * sizeof(lv_color_t),
|
||||
(const lv_color_t *)dest_buf, false) != LV_RES_OK)
|
||||
VG_LITE_RETURN_INV("Init buffer failed.");
|
||||
|
||||
if(opa >= (lv_opa_t)LV_OPA_MAX) { /*Opaque fill*/
|
||||
rect.x = fill_area->x1;
|
||||
rect.y = fill_area->y1;
|
||||
rect.width = area_w;
|
||||
rect.height = area_h;
|
||||
|
||||
/*Clean & invalidate cache*/
|
||||
lv_vglite_invalidate_cache();
|
||||
|
||||
#if LV_COLOR_DEPTH==16
|
||||
vgcol = col32.full;
|
||||
#else /*LV_COLOR_DEPTH==32*/
|
||||
vgcol = ((uint32_t)col32.ch.alpha << 24) | ((uint32_t)col32.ch.blue << 16) | ((uint32_t)col32.ch.green << 8) |
|
||||
(uint32_t)col32.ch.red;
|
||||
#endif
|
||||
|
||||
err = vg_lite_clear(&vgbuf, &rect, vgcol);
|
||||
VG_LITE_ERR_RETURN_INV(err, "Clear failed.");
|
||||
|
||||
err = vg_lite_finish();
|
||||
VG_LITE_ERR_RETURN_INV(err, "Finish failed.");
|
||||
}
|
||||
else { /*fill with transparency*/
|
||||
|
||||
vg_lite_path_t path;
|
||||
int32_t path_data[] = { /*VG rectangular path*/
|
||||
VLC_OP_MOVE, fill_area->x1, fill_area->y1,
|
||||
VLC_OP_LINE, fill_area->x2 + 1, fill_area->y1,
|
||||
VLC_OP_LINE, fill_area->x2 + 1, fill_area->y2 + 1,
|
||||
VLC_OP_LINE, fill_area->x1, fill_area->y2 + 1,
|
||||
VLC_OP_LINE, fill_area->x1, fill_area->y1,
|
||||
VLC_OP_END
|
||||
};
|
||||
|
||||
err = vg_lite_init_path(&path, VG_LITE_S32, VG_LITE_LOW, sizeof(path_data), path_data,
|
||||
(vg_lite_float_t) fill_area->x1, (vg_lite_float_t) fill_area->y1,
|
||||
((vg_lite_float_t) fill_area->x2) + 1.0f, ((vg_lite_float_t) fill_area->y2) + 1.0f);
|
||||
VG_LITE_ERR_RETURN_INV(err, "Init path failed.");
|
||||
|
||||
/* Only pre-multiply color if hardware pre-multiplication is not present */
|
||||
if(!vg_lite_query_feature(gcFEATURE_BIT_VG_PE_PREMULTIPLY)) {
|
||||
col32.ch.red = (uint8_t)(((uint16_t)col32.ch.red * opa) >> 8);
|
||||
col32.ch.green = (uint8_t)(((uint16_t)col32.ch.green * opa) >> 8);
|
||||
col32.ch.blue = (uint8_t)(((uint16_t)col32.ch.blue * opa) >> 8);
|
||||
}
|
||||
col32.ch.alpha = opa;
|
||||
|
||||
#if LV_COLOR_DEPTH==16
|
||||
vgcol = col32.full;
|
||||
#else /*LV_COLOR_DEPTH==32*/
|
||||
vgcol = ((uint32_t)col32.ch.alpha << 24) | ((uint32_t)col32.ch.blue << 16) | ((uint32_t)col32.ch.green << 8) |
|
||||
(uint32_t)col32.ch.red;
|
||||
#endif
|
||||
|
||||
/*Clean & invalidate cache*/
|
||||
lv_vglite_invalidate_cache();
|
||||
|
||||
vg_lite_matrix_t matrix;
|
||||
vg_lite_identity(&matrix);
|
||||
|
||||
/*Draw rectangle*/
|
||||
err = vg_lite_draw(&vgbuf, &path, VG_LITE_FILL_EVEN_ODD, &matrix, VG_LITE_BLEND_SRC_OVER, vgcol);
|
||||
VG_LITE_ERR_RETURN_INV(err, "Draw rectangle failed.");
|
||||
|
||||
err = vg_lite_finish();
|
||||
VG_LITE_ERR_RETURN_INV(err, "Finish failed.");
|
||||
|
||||
err = vg_lite_clear_path(&path);
|
||||
VG_LITE_ERR_RETURN_INV(err, "Clear path failed.");
|
||||
}
|
||||
|
||||
return LV_RES_OK;
|
||||
}
|
||||
|
||||
lv_res_t lv_gpu_nxp_vglite_blit(lv_gpu_nxp_vglite_blit_info_t * blit)
|
||||
{
|
||||
uint32_t dest_size = lv_area_get_size(&blit->dst_area);
|
||||
|
||||
if(blit->opa >= (lv_opa_t)LV_OPA_MAX) {
|
||||
if(dest_size < LV_GPU_NXP_VG_LITE_BLIT_SIZE_LIMIT)
|
||||
VG_LITE_RETURN_INV("Area size %d smaller than limit %d.", dest_size, LV_GPU_NXP_VG_LITE_BLIT_SIZE_LIMIT);
|
||||
}
|
||||
else {
|
||||
if(dest_size < LV_GPU_NXP_VG_LITE_BLIT_OPA_SIZE_LIMIT)
|
||||
VG_LITE_RETURN_INV("Area size %d smaller than limit %d.", dest_size, LV_GPU_NXP_VG_LITE_BLIT_OPA_SIZE_LIMIT);
|
||||
}
|
||||
|
||||
#if VG_LITE_BLIT_SPLIT_ENABLED
|
||||
return _lv_gpu_nxp_vglite_blit_split(blit);
|
||||
#endif /* non RT595 */
|
||||
|
||||
/* Just pass down */
|
||||
return _lv_gpu_nxp_vglite_blit_single(blit);
|
||||
}
|
||||
|
||||
lv_res_t lv_gpu_nxp_vglite_blit_transform(lv_gpu_nxp_vglite_blit_info_t * blit)
|
||||
{
|
||||
uint32_t dest_size = lv_area_get_size(&blit->dst_area);
|
||||
|
||||
if(blit->opa >= (lv_opa_t)LV_OPA_MAX) {
|
||||
if(dest_size < LV_GPU_NXP_VG_LITE_BLIT_SIZE_LIMIT)
|
||||
VG_LITE_RETURN_INV("Area size %d smaller than limit %d.", dest_size, LV_GPU_NXP_VG_LITE_BLIT_SIZE_LIMIT);
|
||||
}
|
||||
else {
|
||||
if(dest_size < LV_GPU_NXP_VG_LITE_BLIT_OPA_SIZE_LIMIT)
|
||||
VG_LITE_RETURN_INV("Area size %d smaller than limit %d.", dest_size, LV_GPU_NXP_VG_LITE_BLIT_OPA_SIZE_LIMIT);
|
||||
}
|
||||
|
||||
return _lv_gpu_nxp_vglite_blit_single(blit);
|
||||
}
|
||||
|
||||
/**********************
|
||||
* STATIC FUNCTIONS
|
||||
**********************/
|
||||
|
||||
#if VG_LITE_BLIT_SPLIT_ENABLED
|
||||
static lv_res_t _lv_gpu_nxp_vglite_blit_split(lv_gpu_nxp_vglite_blit_info_t * blit)
|
||||
{
|
||||
lv_res_t rv = LV_RES_INV;
|
||||
|
||||
if(_lv_gpu_nxp_vglite_check_blit(blit) != LV_RES_OK) {
|
||||
PRINT_BLT("Blit check failed\n");
|
||||
return LV_RES_INV;
|
||||
}
|
||||
|
||||
PRINT_BLT("BLIT from: "
|
||||
"Area: %03d,%03d - %03d,%03d "
|
||||
"Addr: %d\n\n",
|
||||
blit->src_area.x1, blit->src_area.y1,
|
||||
blit->src_area.x2, blit->src_area.y2,
|
||||
(uintptr_t) blit->src);
|
||||
|
||||
PRINT_BLT("BLIT to: "
|
||||
"Area: %03d,%03d - %03d,%03d "
|
||||
"Addr: %d\n\n",
|
||||
blit->dst_area.x1, blit->dst_area.y1,
|
||||
blit->dst_area.x2, blit->dst_area.y2,
|
||||
(uintptr_t) blit->src);
|
||||
|
||||
/* Stage 1: Move starting pointers as close as possible to [x1, y1], so coordinates are as small as possible. */
|
||||
_align_x(&blit->src_area, (lv_color_t **)&blit->src);
|
||||
_align_y(&blit->src_area, (lv_color_t **)&blit->src, blit->src_stride / sizeof(lv_color_t));
|
||||
_align_x(&blit->dst_area, (lv_color_t **)&blit->dst);
|
||||
_align_y(&blit->dst_area, (lv_color_t **)&blit->dst, blit->dst_stride / sizeof(lv_color_t));
|
||||
|
||||
/* Stage 2: If we're in limit, do a single BLIT */
|
||||
if((blit->src_area.x2 < LV_GPU_NXP_VG_LITE_BLIT_SPLIT_THR) &&
|
||||
(blit->src_area.y2 < LV_GPU_NXP_VG_LITE_BLIT_SPLIT_THR)) {
|
||||
PRINT_BLT("Simple blit!\n");
|
||||
return _lv_gpu_nxp_vglite_blit_single(blit);
|
||||
};
|
||||
|
||||
/* Stage 3: Split the BLIT into multiple tiles */
|
||||
PRINT_BLT("Split blit!\n");
|
||||
|
||||
PRINT_BLT("Blit "
|
||||
"([%03d,%03d], [%03d,%03d]) -> "
|
||||
"([%03d,%03d], [%03d,%03d]) | "
|
||||
"([%03dx%03d] -> [%03dx%03d]) | "
|
||||
"A:(%d -> %d)\n",
|
||||
blit->src_area.x1, blit->src_area.y1, blit->src_area.x2, blit->src_area.y2,
|
||||
blit->dst_area.x1, blit->dst_area.y1, blit->dst_area.x2, blit->dst_area.y2,
|
||||
lv_area_get_width(&blit->src_area), lv_area_get_height(&blit->src_area),
|
||||
lv_area_get_width(&blit->dst_area), lv_area_get_height(&blit->dst_area),
|
||||
(uintptr_t) blit->src, (uintptr_t) blit->dst);
|
||||
|
||||
|
||||
lv_coord_t totalWidth = lv_area_get_width(&blit->src_area);
|
||||
lv_coord_t totalHeight = lv_area_get_height(&blit->src_area);
|
||||
|
||||
lv_gpu_nxp_vglite_blit_info_t tileBlit;
|
||||
|
||||
/* Number of tiles needed */
|
||||
int totalTilesX = (blit->src_area.x1 + totalWidth + LV_GPU_NXP_VG_LITE_BLIT_SPLIT_THR - 1) /
|
||||
LV_GPU_NXP_VG_LITE_BLIT_SPLIT_THR;
|
||||
int totalTilesY = (blit->src_area.y1 + totalHeight + LV_GPU_NXP_VG_LITE_BLIT_SPLIT_THR - 1) /
|
||||
LV_GPU_NXP_VG_LITE_BLIT_SPLIT_THR;
|
||||
|
||||
/* src and dst buffer shift against each other. Src buffer real data [0,0] may start actually at [3,0] in buffer, as
|
||||
* the buffer pointer has to be aligned, while dst buffer real data [0,0] may start at [1,0] in buffer. alignment may be
|
||||
* different */
|
||||
int shiftSrcX = (blit->src_area.x1 > blit->dst_area.x1) ? (blit->src_area.x1 - blit->dst_area.x1) : 0;
|
||||
int shiftDstX = (blit->src_area.x1 < blit->dst_area.x1) ? (blit->dst_area.x1 - blit->src_area.x1) : 0;
|
||||
|
||||
PRINT_BLT("\n");
|
||||
PRINT_BLT("Align shift: src: %d, dst: %d\n", shiftSrcX, shiftDstX);
|
||||
|
||||
tileBlit = *blit;
|
||||
|
||||
for(int tileY = 0; tileY < totalTilesY; tileY++) {
|
||||
|
||||
tileBlit.src_area.y1 = 0; /* no vertical alignment, always start from 0 */
|
||||
tileBlit.src_area.y2 = totalHeight - tileY * LV_GPU_NXP_VG_LITE_BLIT_SPLIT_THR - 1;
|
||||
if(tileBlit.src_area.y2 >= LV_GPU_NXP_VG_LITE_BLIT_SPLIT_THR) {
|
||||
tileBlit.src_area.y2 = LV_GPU_NXP_VG_LITE_BLIT_SPLIT_THR - 1; /* Should never happen */
|
||||
}
|
||||
tileBlit.src = blit->src + tileY * LV_GPU_NXP_VG_LITE_BLIT_SPLIT_THR * blit->src_stride / sizeof(
|
||||
lv_color_t); /* stride in px! */
|
||||
|
||||
tileBlit.dst_area.y1 = tileBlit.src_area.y1; /* y has no alignment, always in sync with src */
|
||||
tileBlit.dst_area.y2 = tileBlit.src_area.y2;
|
||||
|
||||
tileBlit.dst = blit->dst + tileY * LV_GPU_NXP_VG_LITE_BLIT_SPLIT_THR * blit->dst_stride / sizeof(
|
||||
lv_color_t); /* stride in px! */
|
||||
|
||||
for(int tileX = 0; tileX < totalTilesX; tileX++) {
|
||||
|
||||
if(tileX == 0) {
|
||||
/* 1st tile is special - there may be a gap between buffer start pointer
|
||||
* and area.x1 value, as the pointer has to be aligned.
|
||||
* tileBlit.src pointer - keep init value from Y-loop.
|
||||
* Also, 1st tile start is not shifted! shift is applied from 2nd tile */
|
||||
tileBlit.src_area.x1 = blit->src_area.x1;
|
||||
tileBlit.dst_area.x1 = blit->dst_area.x1;
|
||||
}
|
||||
else {
|
||||
/* subsequent tiles always starts from 0, but shifted*/
|
||||
tileBlit.src_area.x1 = 0 + shiftSrcX;
|
||||
tileBlit.dst_area.x1 = 0 + shiftDstX;
|
||||
/* and advance start pointer + 1 tile size */
|
||||
tileBlit.src += LV_GPU_NXP_VG_LITE_BLIT_SPLIT_THR;
|
||||
tileBlit.dst += LV_GPU_NXP_VG_LITE_BLIT_SPLIT_THR;
|
||||
}
|
||||
|
||||
/* Clip tile end coordinates */
|
||||
tileBlit.src_area.x2 = totalWidth + blit->src_area.x1 - tileX * LV_GPU_NXP_VG_LITE_BLIT_SPLIT_THR - 1;
|
||||
if(tileBlit.src_area.x2 >= LV_GPU_NXP_VG_LITE_BLIT_SPLIT_THR) {
|
||||
tileBlit.src_area.x2 = LV_GPU_NXP_VG_LITE_BLIT_SPLIT_THR - 1;
|
||||
}
|
||||
|
||||
tileBlit.dst_area.x2 = totalWidth + blit->dst_area.x1 - tileX * LV_GPU_NXP_VG_LITE_BLIT_SPLIT_THR - 1;
|
||||
if(tileBlit.dst_area.x2 >= LV_GPU_NXP_VG_LITE_BLIT_SPLIT_THR) {
|
||||
tileBlit.dst_area.x2 = LV_GPU_NXP_VG_LITE_BLIT_SPLIT_THR - 1;
|
||||
}
|
||||
|
||||
if(tileX < (totalTilesX - 1)) {
|
||||
/* And adjust end coords if shifted, but not for last tile! */
|
||||
tileBlit.src_area.x2 += shiftSrcX;
|
||||
tileBlit.dst_area.x2 += shiftDstX;
|
||||
}
|
||||
|
||||
rv = _lv_gpu_nxp_vglite_blit_single(&tileBlit);
|
||||
|
||||
#if BLIT_DBG_AREAS
|
||||
lv_vglite_dbg_draw_rectangle((lv_color_t *) tileBlit.dst, tileBlit.dst_width, tileBlit.dst_height, &tileBlit.dst_area,
|
||||
LV_COLOR_RED);
|
||||
lv_vglite_dbg_draw_rectangle((lv_color_t *) tileBlit.src, tileBlit.src_width, tileBlit.src_height, &tileBlit.src_area,
|
||||
LV_COLOR_GREEN);
|
||||
#endif
|
||||
|
||||
PRINT_BLT("Tile [%d, %d]: "
|
||||
"([%d,%d], [%d,%d]) -> "
|
||||
"([%d,%d], [%d,%d]) | "
|
||||
"([%dx%d] -> [%dx%d]) | "
|
||||
"A:(0x%8X -> 0x%8X) %s\n",
|
||||
tileX, tileY,
|
||||
tileBlit.src_area.x1, tileBlit.src_area.y1, tileBlit.src_area.x2, tileBlit.src_area.y2,
|
||||
tileBlit.dst_area.x1, tileBlit.dst_area.y1, tileBlit.dst_area.x2, tileBlit.dst_area.y2,
|
||||
lv_area_get_width(&tileBlit.src_area), lv_area_get_height(&tileBlit.src_area),
|
||||
lv_area_get_width(&tileBlit.dst_area), lv_area_get_height(&tileBlit.dst_area),
|
||||
(uintptr_t) tileBlit.src, (uintptr_t) tileBlit.dst,
|
||||
rv == LV_RES_OK ? "OK!" : "!!! FAILED !!!");
|
||||
|
||||
if(rv != LV_RES_OK) { /* if anything goes wrong... */
|
||||
#if LV_GPU_NXP_VG_LITE_LOG_ERRORS
|
||||
LV_LOG_ERROR("Split blit failed. Trying SW blit instead.");
|
||||
#endif
|
||||
_sw_blit(&tileBlit);
|
||||
rv = LV_RES_OK; /* Don't report error, as SW BLIT was performed */
|
||||
}
|
||||
|
||||
}
|
||||
PRINT_BLT(" \n");
|
||||
}
|
||||
|
||||
return rv; /* should never fail */
|
||||
}
|
||||
#endif /* VG_LITE_BLIT_SPLIT_ENABLED */
|
||||
|
||||
static lv_res_t _lv_gpu_nxp_vglite_blit_single(lv_gpu_nxp_vglite_blit_info_t * blit)
|
||||
{
|
||||
vg_lite_buffer_t src_vgbuf, dst_vgbuf;
|
||||
vg_lite_error_t err = VG_LITE_SUCCESS;
|
||||
uint32_t rect[4];
|
||||
vg_lite_float_t scale = 1.0;
|
||||
|
||||
if(blit == NULL) {
|
||||
/*Wrong parameter*/
|
||||
return LV_RES_INV;
|
||||
}
|
||||
|
||||
if(blit->opa < (lv_opa_t) LV_OPA_MIN) {
|
||||
return LV_RES_OK; /*Nothing to BLIT*/
|
||||
}
|
||||
|
||||
/*Wrap src/dst buffer into VG-Lite buffer*/
|
||||
if(lv_vglite_init_buf(&src_vgbuf, (uint32_t)blit->src_width, (uint32_t)blit->src_height, (uint32_t)blit->src_stride,
|
||||
blit->src, true) != LV_RES_OK)
|
||||
VG_LITE_RETURN_INV("Init buffer failed.");
|
||||
|
||||
if(lv_vglite_init_buf(&dst_vgbuf, (uint32_t)blit->dst_width, (uint32_t)blit->dst_height, (uint32_t)blit->dst_stride,
|
||||
blit->dst, false) != LV_RES_OK)
|
||||
VG_LITE_RETURN_INV("Init buffer failed.");
|
||||
|
||||
rect[0] = (uint32_t)blit->src_area.x1; /* start x */
|
||||
rect[1] = (uint32_t)blit->src_area.y1; /* start y */
|
||||
rect[2] = (uint32_t)blit->src_area.x2 - (uint32_t)blit->src_area.x1 + 1U; /* width */
|
||||
rect[3] = (uint32_t)blit->src_area.y2 - (uint32_t)blit->src_area.y1 + 1U; /* height */
|
||||
|
||||
vg_lite_matrix_t matrix;
|
||||
vg_lite_identity(&matrix);
|
||||
vg_lite_translate((vg_lite_float_t)blit->dst_area.x1, (vg_lite_float_t)blit->dst_area.y1, &matrix);
|
||||
|
||||
if((blit->angle != 0) || (blit->zoom != LV_IMG_ZOOM_NONE)) {
|
||||
vg_lite_translate(blit->pivot.x, blit->pivot.y, &matrix);
|
||||
vg_lite_rotate(blit->angle / 10.0f, &matrix); /* angle is 1/10 degree */
|
||||
scale = 1.0f * blit->zoom / LV_IMG_ZOOM_NONE;
|
||||
vg_lite_scale(scale, scale, &matrix);
|
||||
vg_lite_translate(0.0f - blit->pivot.x, 0.0f - blit->pivot.y, &matrix);
|
||||
}
|
||||
|
||||
/*Clean & invalidate cache*/
|
||||
lv_vglite_invalidate_cache();
|
||||
|
||||
uint32_t color;
|
||||
vg_lite_blend_t blend;
|
||||
if(blit->opa >= (lv_opa_t)LV_OPA_MAX) {
|
||||
color = 0xFFFFFFFFU;
|
||||
blend = VG_LITE_BLEND_SRC_OVER;
|
||||
src_vgbuf.transparency_mode = VG_LITE_IMAGE_TRANSPARENT;
|
||||
}
|
||||
else {
|
||||
uint32_t opa = (uint32_t)blit->opa;
|
||||
if(vg_lite_query_feature(gcFEATURE_BIT_VG_PE_PREMULTIPLY)) {
|
||||
color = (opa << 24) | 0x00FFFFFFU;
|
||||
}
|
||||
else {
|
||||
color = (opa << 24) | (opa << 16) | (opa << 8) | opa;
|
||||
}
|
||||
blend = VG_LITE_BLEND_SRC_OVER;
|
||||
src_vgbuf.image_mode = VG_LITE_MULTIPLY_IMAGE_MODE;
|
||||
src_vgbuf.transparency_mode = VG_LITE_IMAGE_TRANSPARENT;
|
||||
}
|
||||
|
||||
err = vg_lite_blit_rect(&dst_vgbuf, &src_vgbuf, rect, &matrix, blend, color, VG_LITE_FILTER_POINT);
|
||||
VG_LITE_ERR_RETURN_INV(err, "Blit rectangle failed.");
|
||||
|
||||
err = vg_lite_finish();
|
||||
VG_LITE_ERR_RETURN_INV(err, "Finish failed.");
|
||||
|
||||
return LV_RES_OK;
|
||||
}
|
||||
|
||||
#if VG_LITE_BLIT_SPLIT_ENABLED
|
||||
|
||||
static void _sw_blit(lv_gpu_nxp_vglite_blit_info_t * blit)
|
||||
{
|
||||
int x, y;
|
||||
|
||||
lv_coord_t w = lv_area_get_width(&blit->src_area);
|
||||
lv_coord_t h = lv_area_get_height(&blit->src_area);
|
||||
|
||||
int32_t srcStridePx = blit->src_stride / (int32_t)sizeof(lv_color_t);
|
||||
int32_t dstStridePx = blit->dst_stride / (int32_t)sizeof(lv_color_t);
|
||||
|
||||
lv_color_t * src = (lv_color_t *)blit->src + blit->src_area.y1 * srcStridePx + blit->src_area.x1;
|
||||
lv_color_t * dst = (lv_color_t *)blit->dst + blit->dst_area.y1 * dstStridePx + blit->dst_area.x1;
|
||||
|
||||
if(blit->opa >= (lv_opa_t)LV_OPA_MAX) {
|
||||
/* simple copy */
|
||||
for(y = 0; y < h; y++) {
|
||||
lv_memcpy(dst, src, (uint32_t)w * sizeof(lv_color_t));
|
||||
src += srcStridePx;
|
||||
dst += dstStridePx;
|
||||
}
|
||||
}
|
||||
else if(blit->opa >= LV_OPA_MIN) {
|
||||
/* alpha blending */
|
||||
for(y = 0; y < h; y++) {
|
||||
for(x = 0; x < w; x++) {
|
||||
dst[x] = lv_color_mix(src[x], dst[x], blit->opa);
|
||||
}
|
||||
src += srcStridePx;
|
||||
dst += dstStridePx;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static lv_res_t _lv_gpu_nxp_vglite_check_blit(lv_gpu_nxp_vglite_blit_info_t * blit)
|
||||
{
|
||||
|
||||
/* Test for minimal width */
|
||||
if(lv_area_get_width(&blit->src_area) < (lv_coord_t)LV_GPU_NXP_VG_LITE_STRIDE_ALIGN_PX)
|
||||
VG_LITE_RETURN_INV("Src area width (%d) is smaller than required (%d).", lv_area_get_width(&blit->src_area),
|
||||
LV_GPU_NXP_VG_LITE_STRIDE_ALIGN_PX);
|
||||
|
||||
/* Test for minimal width */
|
||||
if(lv_area_get_width(&blit->dst_area) < (lv_coord_t)LV_GPU_NXP_VG_LITE_STRIDE_ALIGN_PX)
|
||||
VG_LITE_RETURN_INV("Dest area width (%d) is smaller than required (%d).", lv_area_get_width(&blit->dst_area),
|
||||
LV_GPU_NXP_VG_LITE_STRIDE_ALIGN_PX);
|
||||
|
||||
/* Test for pointer alignment */
|
||||
if((((uintptr_t) blit->src) % LV_ATTRIBUTE_MEM_ALIGN_SIZE) != 0x0)
|
||||
VG_LITE_RETURN_INV("Src buffer ptr (0x%X) not aligned to %d.", (size_t) blit->src, LV_ATTRIBUTE_MEM_ALIGN_SIZE);
|
||||
|
||||
/* No alignment requirement for destination pixel buffer when using mode VG_LITE_LINEAR */
|
||||
|
||||
/* Test for stride alignment */
|
||||
if((blit->src_stride % (LV_GPU_NXP_VG_LITE_STRIDE_ALIGN_PX * LV_COLOR_DEPTH / 8)) != 0x0)
|
||||
VG_LITE_RETURN_INV("Src buffer stride (%d px) not aligned to %d px.", blit->src_stride,
|
||||
LV_GPU_NXP_VG_LITE_STRIDE_ALIGN_PX);
|
||||
|
||||
/* Test for stride alignment */
|
||||
if((blit->dst_stride % (LV_GPU_NXP_VG_LITE_STRIDE_ALIGN_PX * LV_COLOR_DEPTH / 8)) != 0x0)
|
||||
VG_LITE_RETURN_INV("Dest buffer stride (%d px) not aligned to %d px.", blit->dst_stride,
|
||||
LV_GPU_NXP_VG_LITE_STRIDE_ALIGN_PX);
|
||||
|
||||
if((lv_area_get_width(&blit->src_area) != lv_area_get_width(&blit->dst_area)) ||
|
||||
(lv_area_get_height(&blit->src_area) != lv_area_get_height(&blit->dst_area)))
|
||||
VG_LITE_RETURN_INV("Src and dest buffer areas are not equal.");
|
||||
|
||||
return LV_RES_OK;
|
||||
}
|
||||
|
||||
static void _align_x(lv_area_t * area, lv_color_t ** buf)
|
||||
{
|
||||
|
||||
int alignedAreaStartPx = area->x1 - (area->x1 % (LV_ATTRIBUTE_MEM_ALIGN_SIZE * 8 / LV_COLOR_DEPTH));
|
||||
VG_LITE_COND_STOP(alignedAreaStartPx < 0, "Negative X alignment.");
|
||||
|
||||
area->x1 -= alignedAreaStartPx;
|
||||
area->x2 -= alignedAreaStartPx;
|
||||
*buf += alignedAreaStartPx;
|
||||
}
|
||||
|
||||
static void _align_y(lv_area_t * area, lv_color_t ** buf, uint32_t stridePx)
|
||||
{
|
||||
int LineToAlignMem;
|
||||
int alignedAreaStartPy;
|
||||
/* find how many lines of pixels will respect memory alignment requirement */
|
||||
if(stridePx % (uint32_t)LV_ATTRIBUTE_MEM_ALIGN_SIZE == 0U) {
|
||||
alignedAreaStartPy = area->y1;
|
||||
}
|
||||
else {
|
||||
LineToAlignMem = LV_ATTRIBUTE_MEM_ALIGN_SIZE / (sizeof(lv_color_t) * LV_GPU_NXP_VG_LITE_STRIDE_ALIGN_PX);
|
||||
VG_LITE_COND_STOP(LV_ATTRIBUTE_MEM_ALIGN_SIZE % (sizeof(lv_color_t) * LV_GPU_NXP_VG_LITE_STRIDE_ALIGN_PX),
|
||||
"Complex case: need gcd function.");
|
||||
alignedAreaStartPy = area->y1 - (area->y1 % LineToAlignMem);
|
||||
VG_LITE_COND_STOP(alignedAreaStartPy < 0, "Negative Y alignment.");
|
||||
}
|
||||
|
||||
area->y1 -= alignedAreaStartPy;
|
||||
area->y2 -= alignedAreaStartPy;
|
||||
*buf += (uint32_t)alignedAreaStartPy * stridePx;
|
||||
}
|
||||
#endif /*VG_LITE_BLIT_SPLIT_ENABLED*/
|
||||
|
||||
#endif /*LV_USE_GPU_NXP_VG_LITE*/
|
@ -1,12 +1,12 @@
|
||||
/**
|
||||
* @file lv_gpu_nxp_vglite.h
|
||||
* @file lv_draw_vglite_blend.h
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* MIT License
|
||||
*
|
||||
* Copyright (c) 2020 NXP
|
||||
* Copyright 2020-2022 NXP
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
@ -27,8 +27,8 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef LV_SRC_LV_GPU_LV_GPU_NXP_VGLITE_H_
|
||||
#define LV_SRC_LV_GPU_LV_GPU_NXP_VGLITE_H_
|
||||
#ifndef LV_DRAW_VGLITE_BLEND_H
|
||||
#define LV_DRAW_VGLITE_BLEND_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
@ -37,48 +37,39 @@ extern "C" {
|
||||
/*********************
|
||||
* INCLUDES
|
||||
*********************/
|
||||
#include "../../lv_conf_internal.h"
|
||||
|
||||
#include "../../../lv_conf_internal.h"
|
||||
|
||||
#if LV_USE_GPU_NXP_VG_LITE
|
||||
#include "lv_gpu_nxp_vglite.h"
|
||||
|
||||
/*********************
|
||||
* DEFINES
|
||||
*********************/
|
||||
|
||||
/** Use this symbol as limit to disable feature (value has to be larger than supported resolution) */
|
||||
#define LV_GPU_NXP_VG_LITE_FEATURE_DISABLED (1920*1080+1)
|
||||
|
||||
/** Stride in px required by VG-Lite HW. Don't change this. */
|
||||
#define LV_GPU_NXP_VG_LITE_STRIDE_ALIGN_PX 16U
|
||||
|
||||
#ifndef LV_GPU_NXP_VG_LITE_FILL_SIZE_LIMIT
|
||||
/** Minimum area (in pixels) to be filled by VG-Lite with 100% opacity*/
|
||||
#define LV_GPU_NXP_VG_LITE_FILL_SIZE_LIMIT 32
|
||||
#define LV_GPU_NXP_VG_LITE_FILL_SIZE_LIMIT 5000
|
||||
#endif
|
||||
|
||||
#ifndef LV_GPU_NXP_VG_LITE_FILL_OPA_SIZE_LIMIT
|
||||
/** Minimum area (in pixels) to be filled by VG-Lite with transparency*/
|
||||
#define LV_GPU_NXP_VG_LITE_FILL_OPA_SIZE_LIMIT 32
|
||||
#define LV_GPU_NXP_VG_LITE_FILL_OPA_SIZE_LIMIT 5000
|
||||
#endif
|
||||
|
||||
#ifndef LV_GPU_NXP_VG_LITE_BLIT_SIZE_LIMIT
|
||||
/** Minimum area (in pixels) for image copy with 100% opacity to be handled by VG-Lite*/
|
||||
#define LV_GPU_NXP_VG_LITE_BLIT_SIZE_LIMIT 32
|
||||
#define LV_GPU_NXP_VG_LITE_BLIT_SIZE_LIMIT 5000
|
||||
#endif
|
||||
|
||||
#ifndef LV_GPU_NXP_VG_LITE_BUFF_SYNC_BLIT_SIZE_LIMIT
|
||||
/** Minimum invalidated area (in pixels) to be synchronized by VG-Lite during buffer sync */
|
||||
#define LV_GPU_NXP_VG_LITE_BUFF_SYNC_BLIT_SIZE_LIMIT 32
|
||||
#define LV_GPU_NXP_VG_LITE_BUFF_SYNC_BLIT_SIZE_LIMIT 5000
|
||||
#endif
|
||||
|
||||
#ifndef LV_GPU_NXP_VG_LITE_BLIT_OPA_SIZE_LIMIT
|
||||
/** Minimum area (in pixels) for image copy with transparency to be handled by VG-Lite*/
|
||||
#define LV_GPU_NXP_VG_LITE_BLIT_OPA_SIZE_LIMIT 32
|
||||
#endif
|
||||
|
||||
#ifndef LV_GPU_NXP_VG_LITE_LOG_ERRORS
|
||||
/** Enable logging of VG-Lite errors (\see LV_LOG_ERROR)*/
|
||||
#define LV_GPU_NXP_VG_LITE_LOG_ERRORS 1
|
||||
#define LV_GPU_NXP_VG_LITE_BLIT_OPA_SIZE_LIMIT 5000
|
||||
#endif
|
||||
|
||||
/**********************
|
||||
@ -94,30 +85,29 @@ typedef struct {
|
||||
lv_area_t src_area; /**< Area to be copied from source*/
|
||||
lv_coord_t src_width; /**< Source buffer width*/
|
||||
lv_coord_t src_height; /**< Source buffer height*/
|
||||
uint32_t src_stride; /**< Source buffer stride in bytes (must be aligned on 16 px)*/
|
||||
int32_t src_stride; /**< Source buffer stride in bytes (must be aligned on 16 px)*/
|
||||
|
||||
const lv_color_t * dst; /**< Destination buffer pointer (must be aligned on 32 bytes)*/
|
||||
lv_area_t dst_area; /**< Target area in destination buffer (must be the same as src_area)*/
|
||||
lv_coord_t dst_width; /**< Destination buffer width*/
|
||||
lv_coord_t dst_height; /**< Destination buffer height*/
|
||||
uint32_t dst_stride; /**< Destination buffer stride in bytes (must be aligned on 16 px)*/
|
||||
int32_t dst_stride; /**< Destination buffer stride in bytes (must be aligned on 16 px)*/
|
||||
|
||||
lv_opa_t opa; /**< Opacity - alpha mix (0 = source not copied, 255 = 100% opaque)*/
|
||||
|
||||
uint32_t angle; /**< Rotation angle (1/10 of degree)*/
|
||||
uint32_t zoom; /**< 256 = no zoom (1:1 scale ratio)*/
|
||||
lv_point_t pivot; /**< The coordinates of rotation pivot in source image buffer*/
|
||||
} lv_gpu_nxp_vglite_blit_info_t;
|
||||
|
||||
/**********************
|
||||
* MACROS
|
||||
* GLOBAL PROTOTYPES
|
||||
**********************/
|
||||
|
||||
/**********************
|
||||
* GLOBAL FUNCTIONS
|
||||
**********************/
|
||||
|
||||
/***
|
||||
* Fills rectangular area in buffer.
|
||||
* @param[in] dest_buf Destination buffer pointer (must be aligned on 32 bytes)
|
||||
* @param[in] dest_width Destination buffer width in pixels ((must be aligned on 16 px)
|
||||
/**
|
||||
* Fill area, with optional opacity.
|
||||
*
|
||||
* @param[in/out] dest_buf Destination buffer pointer (must be aligned on 32 bytes)
|
||||
* @param[in] dest_width Destination buffer width in pixels (must be aligned on 16 px)
|
||||
* @param[in] dest_height Destination buffer height in pixels
|
||||
* @param[in] fill_area Area to be filled
|
||||
* @param[in] color Fill color
|
||||
@ -128,18 +118,32 @@ typedef struct {
|
||||
lv_res_t lv_gpu_nxp_vglite_fill(lv_color_t * dest_buf, lv_coord_t dest_width, lv_coord_t dest_height,
|
||||
const lv_area_t * fill_area, lv_color_t color, lv_opa_t opa);
|
||||
|
||||
/***
|
||||
/**
|
||||
* BLock Image Transfer.
|
||||
*
|
||||
* @param[in] blit Description of the transfer
|
||||
* @retval LV_RES_OK Transfer complete
|
||||
* @retval LV_RES_INV Error occurred (\see LV_GPU_NXP_VG_LITE_LOG_ERRORS)
|
||||
*/
|
||||
lv_res_t lv_gpu_nxp_vglite_blit(lv_gpu_nxp_vglite_blit_info_t * blit);
|
||||
|
||||
/**
|
||||
* BLock Image Transfer with transformation.
|
||||
*
|
||||
* @param[in] blit Description of the transfer
|
||||
* @retval LV_RES_OK Transfer complete
|
||||
* @retval LV_RES_INV Error occurred (\see LV_GPU_NXP_VG_LITE_LOG_ERRORS)
|
||||
*/
|
||||
lv_res_t lv_gpu_nxp_vglite_blit_transform(lv_gpu_nxp_vglite_blit_info_t * blit);
|
||||
|
||||
/**********************
|
||||
* MACROS
|
||||
**********************/
|
||||
|
||||
#endif /*LV_USE_GPU_NXP_VG_LITE*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /*extern "C"*/
|
||||
#endif
|
||||
|
||||
#endif /*LV_SRC_LV_GPU_LV_GPU_NXP_VGLITE_H_*/
|
||||
#endif /*LV_DRAW_VGLITE_BLEND_H*/
|
244
lib/libesp32_lvgl/lvgl/src/draw/nxp/vglite/lv_draw_vglite_rect.c
Normal file
244
lib/libesp32_lvgl/lvgl/src/draw/nxp/vglite/lv_draw_vglite_rect.c
Normal file
@ -0,0 +1,244 @@
|
||||
/**
|
||||
* @file lv_draw_vglite_rect.c
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* MIT License
|
||||
*
|
||||
* Copyright 2021, 2022 NXP
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights to
|
||||
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||
* the Software, and to permit persons to whom the Software is furnished to do so,
|
||||
* subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice (including the next paragraph)
|
||||
* shall be included in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
|
||||
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
|
||||
* PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
||||
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
|
||||
* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
|
||||
* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
*/
|
||||
|
||||
/*********************
|
||||
* INCLUDES
|
||||
*********************/
|
||||
|
||||
#include "lv_draw_vglite_rect.h"
|
||||
|
||||
#if LV_USE_GPU_NXP_VG_LITE
|
||||
|
||||
/*********************
|
||||
* DEFINES
|
||||
*********************/
|
||||
|
||||
/**********************
|
||||
* TYPEDEFS
|
||||
**********************/
|
||||
|
||||
/**********************
|
||||
* STATIC PROTOTYPES
|
||||
**********************/
|
||||
|
||||
/**********************
|
||||
* STATIC VARIABLES
|
||||
**********************/
|
||||
|
||||
/**********************
|
||||
* MACROS
|
||||
**********************/
|
||||
|
||||
/**********************
|
||||
* GLOBAL FUNCTIONS
|
||||
**********************/
|
||||
|
||||
lv_res_t lv_gpu_nxp_vglite_draw_bg(lv_draw_ctx_t * draw_ctx, const lv_draw_rect_dsc_t * dsc, const lv_area_t * coords)
|
||||
{
|
||||
vg_lite_buffer_t vgbuf;
|
||||
vg_lite_error_t err = VG_LITE_SUCCESS;
|
||||
lv_coord_t dest_width = lv_area_get_width(draw_ctx->buf_area);
|
||||
lv_coord_t dest_height = lv_area_get_height(draw_ctx->buf_area);
|
||||
vg_lite_path_t path;
|
||||
vg_lite_color_t vgcol; /* vglite takes ABGR */
|
||||
vg_lite_matrix_t matrix;
|
||||
lv_coord_t width = lv_area_get_width(coords);
|
||||
lv_coord_t height = lv_area_get_height(coords);
|
||||
vg_lite_linear_gradient_t gradient;
|
||||
vg_lite_matrix_t * grad_matrix;
|
||||
|
||||
if(dsc->radius < 0)
|
||||
return LV_RES_INV;
|
||||
|
||||
/* Make areas relative to draw buffer */
|
||||
lv_area_t rel_coords;
|
||||
lv_area_copy(&rel_coords, coords);
|
||||
lv_area_move(&rel_coords, -draw_ctx->buf_area->x1, -draw_ctx->buf_area->y1);
|
||||
|
||||
lv_area_t rel_clip;
|
||||
lv_area_copy(&rel_clip, draw_ctx->clip_area);
|
||||
lv_area_move(&rel_clip, -draw_ctx->buf_area->x1, -draw_ctx->buf_area->y1);
|
||||
|
||||
/*** Init destination buffer ***/
|
||||
if(lv_vglite_init_buf(&vgbuf, (uint32_t)dest_width, (uint32_t)dest_height, (uint32_t)dest_width * sizeof(lv_color_t),
|
||||
(const lv_color_t *)draw_ctx->buf, false) != LV_RES_OK)
|
||||
VG_LITE_RETURN_INV("Init buffer failed.");
|
||||
|
||||
/*** Init path ***/
|
||||
int32_t rad = dsc->radius;
|
||||
if(dsc->radius == LV_RADIUS_CIRCLE) {
|
||||
rad = (width > height) ? height / 2 : width / 2;
|
||||
}
|
||||
|
||||
if((dsc->radius == LV_RADIUS_CIRCLE) && (width == height)) {
|
||||
float tang = ((float)rad * BEZIER_OPTIM_CIRCLE);
|
||||
int32_t cpoff = (int32_t)tang;
|
||||
int32_t circle_path[] = { /*VG circle path*/
|
||||
VLC_OP_MOVE, rel_coords.x1 + rad, rel_coords.y1,
|
||||
VLC_OP_CUBIC_REL, cpoff, 0, rad, rad - cpoff, rad, rad, /* top-right */
|
||||
VLC_OP_CUBIC_REL, 0, cpoff, cpoff - rad, rad, 0 - rad, rad, /* bottom-right */
|
||||
VLC_OP_CUBIC_REL, 0 - cpoff, 0, 0 - rad, cpoff - rad, 0 - rad, 0 - rad, /* bottom-left */
|
||||
VLC_OP_CUBIC_REL, 0, 0 - cpoff, rad - cpoff, 0 - rad, rad, 0 - rad, /* top-left */
|
||||
VLC_OP_END
|
||||
};
|
||||
err = vg_lite_init_path(&path, VG_LITE_S32, VG_LITE_HIGH, sizeof(circle_path), circle_path,
|
||||
(vg_lite_float_t) rel_clip.x1, (vg_lite_float_t) rel_clip.y1,
|
||||
((vg_lite_float_t) rel_clip.x2) + 1.0f, ((vg_lite_float_t) rel_clip.y2) + 1.0f);
|
||||
}
|
||||
else if(dsc->radius > 0) {
|
||||
float tang = ((float)rad * BEZIER_OPTIM_CIRCLE);
|
||||
int32_t cpoff = (int32_t)tang;
|
||||
int32_t rounded_path[] = { /*VG rounded rectangular path*/
|
||||
VLC_OP_MOVE, rel_coords.x1 + rad, rel_coords.y1,
|
||||
VLC_OP_LINE, rel_coords.x2 - rad + 1, rel_coords.y1, /* top */
|
||||
VLC_OP_CUBIC_REL, cpoff, 0, rad, rad - cpoff, rad, rad, /* top-right */
|
||||
VLC_OP_LINE, rel_coords.x2 + 1, rel_coords.y2 - rad + 1, /* right */
|
||||
VLC_OP_CUBIC_REL, 0, cpoff, cpoff - rad, rad, 0 - rad, rad, /* bottom-right */
|
||||
VLC_OP_LINE, rel_coords.x1 + rad, rel_coords.y2 + 1, /* bottom */
|
||||
VLC_OP_CUBIC_REL, 0 - cpoff, 0, 0 - rad, cpoff - rad, 0 - rad, 0 - rad, /* bottom-left */
|
||||
VLC_OP_LINE, rel_coords.x1, rel_coords.y1 + rad, /* left */
|
||||
VLC_OP_CUBIC_REL, 0, 0 - cpoff, rad - cpoff, 0 - rad, rad, 0 - rad, /* top-left */
|
||||
VLC_OP_END
|
||||
};
|
||||
err = vg_lite_init_path(&path, VG_LITE_S32, VG_LITE_HIGH, sizeof(rounded_path), rounded_path,
|
||||
(vg_lite_float_t) rel_clip.x1, (vg_lite_float_t) rel_clip.y1,
|
||||
((vg_lite_float_t) rel_clip.x2) + 1.0f, ((vg_lite_float_t) rel_clip.y2) + 1.0f);
|
||||
}
|
||||
else {
|
||||
int32_t rect_path[] = { /*VG rectangular path*/
|
||||
VLC_OP_MOVE, rel_coords.x1, rel_coords.y1,
|
||||
VLC_OP_LINE, rel_coords.x2 + 1, rel_coords.y1,
|
||||
VLC_OP_LINE, rel_coords.x2 + 1, rel_coords.y2 + 1,
|
||||
VLC_OP_LINE, rel_coords.x1, rel_coords.y2 + 1,
|
||||
VLC_OP_LINE, rel_coords.x1, rel_coords.y1,
|
||||
VLC_OP_END
|
||||
};
|
||||
err = vg_lite_init_path(&path, VG_LITE_S32, VG_LITE_LOW, sizeof(rect_path), rect_path,
|
||||
(vg_lite_float_t) rel_clip.x1, (vg_lite_float_t) rel_clip.y1,
|
||||
((vg_lite_float_t) rel_clip.x2) + 1.0f, ((vg_lite_float_t) rel_clip.y2) + 1.0f);
|
||||
}
|
||||
|
||||
VG_LITE_ERR_RETURN_INV(err, "Init path failed.");
|
||||
vg_lite_identity(&matrix);
|
||||
|
||||
/*** Init Color/Gradient ***/
|
||||
if(dsc->bg_grad.dir != (lv_grad_dir_t)LV_GRAD_DIR_NONE) {
|
||||
uint32_t colors[2];
|
||||
uint32_t stops[2];
|
||||
lv_color32_t col32[2];
|
||||
|
||||
/* Gradient setup */
|
||||
uint8_t cnt = MAX(dsc->bg_grad.stops_count, 2);
|
||||
for(uint8_t i = 0; i < cnt; i++) {
|
||||
col32[i].full = lv_color_to32(dsc->bg_grad.stops[i].color); /*Convert color to RGBA8888*/
|
||||
stops[i] = dsc->bg_grad.stops[i].frac;
|
||||
#if LV_COLOR_DEPTH==16
|
||||
colors[i] = ((uint32_t)col32[i].ch.alpha << 24) | ((uint32_t)col32[i].ch.blue << 16) |
|
||||
((uint32_t)col32[i].ch.green << 8) | (uint32_t)col32[i].ch.red;
|
||||
#else /*LV_COLOR_DEPTH==32*/
|
||||
/* watchout: red and blue color components are inverted versus vg_lite_color_t order */
|
||||
colors[i] = ((uint32_t)col32[i].ch.alpha << 24) | ((uint32_t)col32[i].ch.red << 16) |
|
||||
((uint32_t)col32[i].ch.green << 8) | (uint32_t)col32[i].ch.blue;
|
||||
#endif
|
||||
}
|
||||
|
||||
lv_memset_00(&gradient, sizeof(vg_lite_linear_gradient_t));
|
||||
|
||||
err = vg_lite_init_grad(&gradient);
|
||||
VG_LITE_ERR_RETURN_INV(err, "Init gradient failed");
|
||||
|
||||
err = vg_lite_set_grad(&gradient, cnt, colors, stops);
|
||||
VG_LITE_ERR_RETURN_INV(err, "Set gradient failed.");
|
||||
|
||||
err = vg_lite_update_grad(&gradient);
|
||||
VG_LITE_ERR_RETURN_INV(err, "Update gradient failed.");
|
||||
|
||||
grad_matrix = vg_lite_get_grad_matrix(&gradient);
|
||||
vg_lite_identity(grad_matrix);
|
||||
vg_lite_translate((float)rel_coords.x1, (float)rel_coords.y1, grad_matrix);
|
||||
|
||||
if(dsc->bg_grad.dir == (lv_grad_dir_t)LV_GRAD_DIR_VER) {
|
||||
vg_lite_scale(1.0f, (float)height / 256.0f, grad_matrix);
|
||||
vg_lite_rotate(90.0f, grad_matrix);
|
||||
}
|
||||
else { /*LV_GRAD_DIR_HOR*/
|
||||
vg_lite_scale((float)width / 256.0f, 1.0f, grad_matrix);
|
||||
}
|
||||
}
|
||||
|
||||
lv_opa_t bg_opa = dsc->bg_opa;
|
||||
lv_color32_t bg_col32 = {.full = lv_color_to32(dsc->bg_color)}; /*Convert color to RGBA8888*/
|
||||
if(bg_opa <= (lv_opa_t)LV_OPA_MAX) {
|
||||
/* Only pre-multiply color if hardware pre-multiplication is not present */
|
||||
if(!vg_lite_query_feature(gcFEATURE_BIT_VG_PE_PREMULTIPLY)) {
|
||||
bg_col32.ch.red = (uint8_t)(((uint16_t)bg_col32.ch.red * bg_opa) >> 8);
|
||||
bg_col32.ch.green = (uint8_t)(((uint16_t)bg_col32.ch.green * bg_opa) >> 8);
|
||||
bg_col32.ch.blue = (uint8_t)(((uint16_t)bg_col32.ch.blue * bg_opa) >> 8);
|
||||
}
|
||||
bg_col32.ch.alpha = bg_opa;
|
||||
}
|
||||
|
||||
#if LV_COLOR_DEPTH==16
|
||||
vgcol = bg_col32.full;
|
||||
#else /*LV_COLOR_DEPTH==32*/
|
||||
vgcol = ((uint32_t)bg_col32.ch.alpha << 24) | ((uint32_t)bg_col32.ch.blue << 16) |
|
||||
((uint32_t)bg_col32.ch.green << 8) | (uint32_t)bg_col32.ch.red;
|
||||
#endif
|
||||
|
||||
/*Clean & invalidate cache*/
|
||||
lv_vglite_invalidate_cache();
|
||||
|
||||
/*** Draw rectangle ***/
|
||||
if(dsc->bg_grad.dir == (lv_grad_dir_t)LV_GRAD_DIR_NONE) {
|
||||
err = vg_lite_draw(&vgbuf, &path, VG_LITE_FILL_EVEN_ODD, &matrix, VG_LITE_BLEND_SRC_OVER, vgcol);
|
||||
}
|
||||
else {
|
||||
err = vg_lite_draw_gradient(&vgbuf, &path, VG_LITE_FILL_EVEN_ODD, &matrix, &gradient, VG_LITE_BLEND_SRC_OVER);
|
||||
}
|
||||
VG_LITE_ERR_RETURN_INV(err, "Draw gradient failed.");
|
||||
|
||||
err = vg_lite_finish();
|
||||
VG_LITE_ERR_RETURN_INV(err, "Finish failed.");
|
||||
|
||||
err = vg_lite_clear_path(&path);
|
||||
VG_LITE_ERR_RETURN_INV(err, "Clear path failed.");
|
||||
|
||||
if(dsc->bg_grad.dir != (lv_grad_dir_t)LV_GRAD_DIR_NONE) {
|
||||
err = vg_lite_clear_grad(&gradient);
|
||||
VG_LITE_ERR_RETURN_INV(err, "Clear gradient failed.");
|
||||
}
|
||||
|
||||
return LV_RES_OK;
|
||||
}
|
||||
|
||||
/**********************
|
||||
* STATIC FUNCTIONS
|
||||
**********************/
|
||||
|
||||
#endif /*LV_USE_GPU_NXP_VG_LITE*/
|
@ -0,0 +1,77 @@
|
||||
/**
|
||||
* @file lv_draw_vglite_rect.h
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* MIT License
|
||||
*
|
||||
* Copyright 2021, 2022 NXP
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights to
|
||||
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||
* the Software, and to permit persons to whom the Software is furnished to do so,
|
||||
* subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice (including the next paragraph)
|
||||
* shall be included in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
|
||||
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
|
||||
* PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
||||
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
|
||||
* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
|
||||
* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef LV_DRAW_VGLITE_RECT_H
|
||||
#define LV_DRAW_VGLITE_RECT_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*********************
|
||||
* INCLUDES
|
||||
*********************/
|
||||
#include "../../../lv_conf_internal.h"
|
||||
|
||||
#if LV_USE_GPU_NXP_VG_LITE
|
||||
#include "lv_gpu_nxp_vglite.h"
|
||||
#include "../../lv_draw_rect.h"
|
||||
|
||||
/*********************
|
||||
* DEFINES
|
||||
*********************/
|
||||
|
||||
/**********************
|
||||
* TYPEDEFS
|
||||
**********************/
|
||||
|
||||
/**********************
|
||||
* GLOBAL PROTOTYPES
|
||||
**********************/
|
||||
|
||||
/**
|
||||
* Draw rectangle shape with effects (rounded corners, gradient)
|
||||
*
|
||||
* @param draw_ctx drawing context
|
||||
* @param dsc description of the rectangle
|
||||
* @param coords the area where rectangle is clipped
|
||||
*/
|
||||
lv_res_t lv_gpu_nxp_vglite_draw_bg(lv_draw_ctx_t * draw_ctx, const lv_draw_rect_dsc_t * dsc, const lv_area_t * coords);
|
||||
|
||||
/**********************
|
||||
* MACROS
|
||||
**********************/
|
||||
|
||||
#endif /*LV_USE_GPU_NXP_VG_LITE*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /*extern "C"*/
|
||||
#endif
|
||||
|
||||
#endif /*LV_DRAW_VGLITE_RECT_H*/
|
153
lib/libesp32_lvgl/lvgl/src/draw/nxp/vglite/lv_gpu_nxp_vglite.c
Normal file
153
lib/libesp32_lvgl/lvgl/src/draw/nxp/vglite/lv_gpu_nxp_vglite.c
Normal file
@ -0,0 +1,153 @@
|
||||
/**
|
||||
* @file lv_gpu_nxp_vglite.c
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* MIT License
|
||||
*
|
||||
* Copyright 2020-2022 NXP
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights to
|
||||
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||
* the Software, and to permit persons to whom the Software is furnished to do so,
|
||||
* subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice (including the next paragraph)
|
||||
* shall be included in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
|
||||
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
|
||||
* PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
||||
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
|
||||
* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
|
||||
* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
*/
|
||||
|
||||
/*********************
|
||||
* INCLUDES
|
||||
*********************/
|
||||
|
||||
#include "lv_gpu_nxp_vglite.h"
|
||||
|
||||
#if LV_USE_GPU_NXP_VG_LITE
|
||||
#include "../../../core/lv_refr.h"
|
||||
#if BLIT_DBG_AREAS
|
||||
#include "lv_draw_vglite_blend.h"
|
||||
#endif
|
||||
|
||||
/*********************
|
||||
* DEFINES
|
||||
*********************/
|
||||
|
||||
#if LV_COLOR_DEPTH==16
|
||||
#define VG_LITE_PX_FMT VG_LITE_RGB565
|
||||
#elif LV_COLOR_DEPTH==32
|
||||
#define VG_LITE_PX_FMT VG_LITE_BGRA8888
|
||||
#else
|
||||
#error Only 16bit and 32bit color depth are supported. Set LV_COLOR_DEPTH to 16 or 32.
|
||||
#endif
|
||||
|
||||
/**********************
|
||||
* TYPEDEFS
|
||||
**********************/
|
||||
|
||||
/**********************
|
||||
* STATIC PROTOTYPES
|
||||
**********************/
|
||||
|
||||
/**********************
|
||||
* STATIC VARIABLES
|
||||
**********************/
|
||||
|
||||
/**********************
|
||||
* MACROS
|
||||
**********************/
|
||||
|
||||
/**********************
|
||||
* GLOBAL FUNCTIONS
|
||||
**********************/
|
||||
|
||||
lv_res_t lv_vglite_init_buf(vg_lite_buffer_t * vgbuf, uint32_t width, uint32_t height, uint32_t stride,
|
||||
const lv_color_t * ptr, bool source)
|
||||
{
|
||||
/*Test for memory alignment*/
|
||||
if((((uintptr_t)ptr) % (uintptr_t)LV_ATTRIBUTE_MEM_ALIGN_SIZE) != (uintptr_t)0x0U)
|
||||
VG_LITE_RETURN_INV("%s buffer (0x%x) not aligned to %d.", source ? "Src" : "Dest",
|
||||
(size_t) ptr, LV_ATTRIBUTE_MEM_ALIGN_SIZE);
|
||||
|
||||
/*Test for stride alignment*/
|
||||
if(source && (stride % (LV_GPU_NXP_VG_LITE_STRIDE_ALIGN_PX * sizeof(lv_color_t))) != 0x0U)
|
||||
VG_LITE_RETURN_INV("Src buffer stride (%d bytes) not aligned to %d bytes.", stride,
|
||||
LV_GPU_NXP_VG_LITE_STRIDE_ALIGN_PX * sizeof(lv_color_t));
|
||||
|
||||
vgbuf->format = VG_LITE_PX_FMT;
|
||||
vgbuf->tiled = VG_LITE_LINEAR;
|
||||
vgbuf->image_mode = VG_LITE_NORMAL_IMAGE_MODE;
|
||||
vgbuf->transparency_mode = VG_LITE_IMAGE_OPAQUE;
|
||||
|
||||
vgbuf->width = (int32_t)width;
|
||||
vgbuf->height = (int32_t)height;
|
||||
vgbuf->stride = (int32_t)stride;
|
||||
|
||||
lv_memset_00(&vgbuf->yuv, sizeof(vgbuf->yuv));
|
||||
|
||||
vgbuf->memory = (void *)ptr;
|
||||
vgbuf->address = (uint32_t)vgbuf->memory;
|
||||
vgbuf->handle = NULL;
|
||||
|
||||
return LV_RES_OK;
|
||||
}
|
||||
|
||||
#if BLIT_DBG_AREAS
|
||||
void lv_vglite_dbg_draw_rectangle(lv_color_t * dest_buf, lv_coord_t dest_width, lv_coord_t dest_height,
|
||||
lv_area_t * fill_area, lv_color_t color)
|
||||
{
|
||||
lv_area_t a;
|
||||
|
||||
/* top line */
|
||||
a.x1 = fill_area->x1;
|
||||
a.x2 = fill_area->x2;
|
||||
a.y1 = fill_area->y1;
|
||||
a.y2 = fill_area->y1;
|
||||
lv_gpu_nxp_vglite_fill(dest_buf, dest_width, dest_height, &a, color, LV_OPA_COVER);
|
||||
|
||||
|
||||
/* bottom line */
|
||||
a.x1 = fill_area->x1;
|
||||
a.x2 = fill_area->x2;
|
||||
a.y1 = fill_area->y2;
|
||||
a.y2 = fill_area->y2;
|
||||
lv_gpu_nxp_vglite_fill(dest_buf, dest_width, dest_height, &a, color, LV_OPA_COVER);
|
||||
|
||||
/* left line */
|
||||
a.x1 = fill_area->x1;
|
||||
a.x2 = fill_area->x1;
|
||||
a.y1 = fill_area->y1;
|
||||
a.y2 = fill_area->y2;
|
||||
lv_gpu_nxp_vglite_fill(dest_buf, dest_width, dest_height, &a, color, LV_OPA_COVER);
|
||||
|
||||
/* right line */
|
||||
a.x1 = fill_area->x2;
|
||||
a.x2 = fill_area->x2;
|
||||
a.y1 = fill_area->y1;
|
||||
a.y2 = fill_area->y2;
|
||||
lv_gpu_nxp_vglite_fill(dest_buf, dest_width, dest_height, &a, color, LV_OPA_COVER);
|
||||
}
|
||||
#endif /* BLIT_DBG_AREAS */
|
||||
|
||||
void lv_vglite_invalidate_cache(void)
|
||||
{
|
||||
lv_disp_t * disp = _lv_refr_get_disp_refreshing();
|
||||
if(disp->driver->clean_dcache_cb)
|
||||
disp->driver->clean_dcache_cb(disp->driver);
|
||||
}
|
||||
|
||||
/**********************
|
||||
* STATIC FUNCTIONS
|
||||
**********************/
|
||||
|
||||
#endif /*LV_USE_GPU_NXP_VG_LITE*/
|
185
lib/libesp32_lvgl/lvgl/src/draw/nxp/vglite/lv_gpu_nxp_vglite.h
Normal file
185
lib/libesp32_lvgl/lvgl/src/draw/nxp/vglite/lv_gpu_nxp_vglite.h
Normal file
@ -0,0 +1,185 @@
|
||||
/**
|
||||
* @file lv_gpu_nxp_vglite.h
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* MIT License
|
||||
*
|
||||
* Copyright 2020-2022 NXP
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights to
|
||||
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||
* the Software, and to permit persons to whom the Software is furnished to do so,
|
||||
* subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice (including the next paragraph)
|
||||
* shall be included in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
|
||||
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
|
||||
* PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
||||
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
|
||||
* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
|
||||
* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef LV_GPU_NXP_VGLITE_H
|
||||
#define LV_GPU_NXP_VGLITE_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*********************
|
||||
* INCLUDES
|
||||
*********************/
|
||||
#include "../../../lv_conf_internal.h"
|
||||
|
||||
#if LV_USE_GPU_NXP_VG_LITE
|
||||
#include "vg_lite.h"
|
||||
#include "../../sw/lv_draw_sw.h"
|
||||
#include "../../../misc/lv_log.h"
|
||||
#include "fsl_debug_console.h"
|
||||
|
||||
/*********************
|
||||
* DEFINES
|
||||
*********************/
|
||||
|
||||
/** Use this symbol as limit to disable feature (value has to be larger than supported resolution) */
|
||||
#define LV_GPU_NXP_VG_LITE_FEATURE_DISABLED (1920*1080+1)
|
||||
|
||||
/** Stride in px required by VG-Lite HW. Don't change this. */
|
||||
#define LV_GPU_NXP_VG_LITE_STRIDE_ALIGN_PX 16U
|
||||
|
||||
#ifndef LV_GPU_NXP_VG_LITE_LOG_ERRORS
|
||||
/** Enable logging of VG-Lite errors (\see LV_LOG_ERROR)*/
|
||||
#define LV_GPU_NXP_VG_LITE_LOG_ERRORS 1
|
||||
#endif
|
||||
|
||||
#ifndef LV_GPU_NXP_VG_LITE_LOG_TRACES
|
||||
/** Enable logging of VG-Lite errors (\see LV_LOG_ERROR)*/
|
||||
#define LV_GPU_NXP_VG_LITE_LOG_TRACES 0
|
||||
#endif
|
||||
|
||||
/* Draw rectangles around BLIT tiles */
|
||||
#define BLIT_DBG_AREAS 0
|
||||
|
||||
/* Print detailed info to SDK console (NOT to LVGL log system) */
|
||||
#define BLIT_DBG_VERBOSE 0
|
||||
|
||||
/* Verbose debug print */
|
||||
#if BLIT_DBG_VERBOSE
|
||||
#define PRINT_BLT PRINTF
|
||||
#else
|
||||
#define PRINT_BLT(...)
|
||||
#endif
|
||||
|
||||
/* The optimal Bezier control point offset for radial unit
|
||||
* see: https://spencermortensen.com/articles/bezier-circle/
|
||||
**/
|
||||
#define BEZIER_OPTIM_CIRCLE 0.551915024494f
|
||||
|
||||
/* Draw lines for control points of Bezier curves */
|
||||
#define BEZIER_DBG_CONTROL_POINTS 0
|
||||
|
||||
/**********************
|
||||
* TYPEDEFS
|
||||
**********************/
|
||||
|
||||
/**********************
|
||||
* GLOBAL PROTOTYPES
|
||||
**********************/
|
||||
|
||||
/**
|
||||
* Fills vg_lite_buffer_t structure according given parameters.
|
||||
*
|
||||
* @param[in/out] vgbuf Buffer structure to be filled
|
||||
* @param[in] width Width of buffer in pixels
|
||||
* @param[in] height Height of buffer in pixels
|
||||
* @param[in] stride Stride of the buffer in bytes
|
||||
* @param[in] ptr Pointer to the buffer (must be aligned according VG-Lite requirements)
|
||||
* @param[in] source Boolean to check if this is a source buffer
|
||||
*/
|
||||
lv_res_t lv_vglite_init_buf(vg_lite_buffer_t * vgbuf, uint32_t width, uint32_t height, uint32_t stride,
|
||||
const lv_color_t * ptr, bool source);
|
||||
|
||||
#if BLIT_DBG_AREAS
|
||||
/**
|
||||
* Draw a simple rectangle, 1 px line width.
|
||||
*
|
||||
* @param dest_buf Destination buffer
|
||||
* @param dest_width Destination buffer width (must be aligned on 16px)
|
||||
* @param dest_height Destination buffer height
|
||||
* @param fill_area Rectangle coordinates
|
||||
* @param color Rectangle color
|
||||
*/
|
||||
void lv_vglite_dbg_draw_rectangle(lv_color_t * dest_buf, lv_coord_t dest_width, lv_coord_t dest_height,
|
||||
lv_area_t * fill_area, lv_color_t color);
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Clean & invalidate cache.
|
||||
*/
|
||||
void lv_vglite_invalidate_cache(void);
|
||||
|
||||
/**********************
|
||||
* MACROS
|
||||
**********************/
|
||||
|
||||
#define VG_LITE_COND_STOP(cond, txt) \
|
||||
do { \
|
||||
if (cond) { \
|
||||
LV_LOG_ERROR("%s. STOP!", txt); \
|
||||
for ( ; ; ); \
|
||||
} \
|
||||
} while(0)
|
||||
|
||||
#if LV_GPU_NXP_VG_LITE_LOG_ERRORS
|
||||
#define VG_LITE_ERR_RETURN_INV(err, fmt, ...) \
|
||||
do { \
|
||||
if(err != VG_LITE_SUCCESS) { \
|
||||
LV_LOG_ERROR(fmt, ##__VA_ARGS__); \
|
||||
return LV_RES_INV; \
|
||||
} \
|
||||
} while (0)
|
||||
#else
|
||||
#define VG_LITE_ERR_RETURN_INV(err, fmt, ...) \
|
||||
do { \
|
||||
if(err != VG_LITE_SUCCESS) { \
|
||||
return LV_RES_INV; \
|
||||
} \
|
||||
}while(0)
|
||||
#endif /*LV_GPU_NXP_VG_LITE_LOG_ERRORS*/
|
||||
|
||||
#if LV_GPU_NXP_VG_LITE_LOG_TRACES
|
||||
#define VG_LITE_LOG_TRACE(fmt, ...) \
|
||||
do { \
|
||||
LV_LOG_ERROR(fmt, ##__VA_ARGS__); \
|
||||
} while (0)
|
||||
|
||||
#define VG_LITE_RETURN_INV(fmt, ...) \
|
||||
do { \
|
||||
LV_LOG_ERROR(fmt, ##__VA_ARGS__); \
|
||||
return LV_RES_INV; \
|
||||
} while (0)
|
||||
#else
|
||||
#define VG_LITE_LOG_TRACE(fmt, ...) \
|
||||
do { \
|
||||
} while (0)
|
||||
#define VG_LITE_RETURN_INV(fmt, ...) \
|
||||
do { \
|
||||
return LV_RES_INV; \
|
||||
}while(0)
|
||||
#endif /*LV_GPU_NXP_VG_LITE_LOG_TRACES*/
|
||||
|
||||
#endif /*LV_USE_GPU_NXP_VG_LITE*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /*extern "C"*/
|
||||
#endif
|
||||
|
||||
#endif /*LV_GPU_NXP_VGLITE_H*/
|
@ -1,446 +0,0 @@
|
||||
/**
|
||||
* @file lv_gpu_nxp_pxp.c
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* MIT License
|
||||
*
|
||||
* Copyright (c) 2020 NXP
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights to
|
||||
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||
* the Software, and to permit persons to whom the Software is furnished to do so,
|
||||
* subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice (including the next paragraph)
|
||||
* shall be included in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
|
||||
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
|
||||
* PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
||||
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
|
||||
* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
|
||||
* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
*/
|
||||
|
||||
/*********************
|
||||
* INCLUDES
|
||||
*********************/
|
||||
|
||||
#include "lv_gpu_nxp_pxp.h"
|
||||
|
||||
#if LV_USE_GPU_NXP_PXP
|
||||
|
||||
#include "../misc/lv_mem.h"
|
||||
#include "../misc/lv_log.h"
|
||||
|
||||
#include "fsl_pxp.h"
|
||||
#include "fsl_cache.h"
|
||||
|
||||
/*********************
|
||||
* DEFINES
|
||||
*********************/
|
||||
|
||||
#if LV_COLOR_16_SWAP
|
||||
#error Color swap not implemented. Disable LV_COLOR_16_SWAP feature.
|
||||
#endif
|
||||
|
||||
#if LV_COLOR_DEPTH==16
|
||||
#define PXP_OUT_PIXEL_FORMAT kPXP_OutputPixelFormatRGB565
|
||||
#define PXP_AS_PIXEL_FORMAT kPXP_AsPixelFormatRGB565
|
||||
#define PXP_PS_PIXEL_FORMAT kPXP_PsPixelFormatRGB565
|
||||
#else
|
||||
#error Only 16bit color depth is supported. Set LV_COLOR_DEPTH to 16.
|
||||
#endif
|
||||
|
||||
/**********************
|
||||
* TYPEDEFS
|
||||
**********************/
|
||||
|
||||
/**********************
|
||||
* STATIC PROTOTYPES
|
||||
**********************/
|
||||
|
||||
static void lv_gpu_nxp_pxp_run(void);
|
||||
static void lv_gpu_nxp_pxp_blit_recolor(lv_color_t * dest, lv_coord_t dest_width, const lv_color_t * src,
|
||||
lv_coord_t src_width,
|
||||
lv_coord_t copy_width, lv_coord_t copy_height, lv_opa_t opa, lv_color_t recolor, lv_opa_t recolorOpa);
|
||||
|
||||
/**********************
|
||||
* STATIC VARIABLES
|
||||
**********************/
|
||||
|
||||
static bool colorKeyEnabled = false;
|
||||
static uint32_t colorKey = 0x0;
|
||||
|
||||
static bool recolorEnabled = false;
|
||||
static lv_color_t recolor = {.full = 0x0};
|
||||
static lv_opa_t recolorOpa = 0x0;
|
||||
|
||||
static lv_nxp_pxp_cfg_t pxp_cfg;
|
||||
|
||||
/**********************
|
||||
* MACROS
|
||||
**********************/
|
||||
|
||||
/**********************
|
||||
* GLOBAL FUNCTIONS
|
||||
**********************/
|
||||
|
||||
/**
|
||||
* Reset and initialize PXP device. This function should be called as a part
|
||||
* of display init sequence.
|
||||
*
|
||||
* @return LV_RES_OK: PXP init ok; LV_RES_INV: init error. See error log for more information.
|
||||
*/
|
||||
lv_res_t lv_gpu_nxp_pxp_init(lv_nxp_pxp_cfg_t * cfg)
|
||||
{
|
||||
if(!cfg || !cfg->pxp_interrupt_deinit || !cfg->pxp_interrupt_init || !cfg->pxp_run) {
|
||||
LV_LOG_ERROR("PXP configuration error. Check callback pointers.");
|
||||
return LV_RES_INV;
|
||||
}
|
||||
|
||||
PXP_Init(PXP);
|
||||
PXP_EnableCsc1(PXP, false); /*Disable CSC1, it is enabled by default.*/
|
||||
PXP_EnableInterrupts(PXP, kPXP_CompleteInterruptEnable);
|
||||
|
||||
pxp_cfg = *cfg;
|
||||
if(pxp_cfg.pxp_interrupt_init() != LV_RES_OK) {
|
||||
PXP_Deinit(PXP);
|
||||
LV_LOG_ERROR("PXP interrupt init error. Check pxp_interrupt_init callback.");
|
||||
return LV_RES_INV;
|
||||
}
|
||||
|
||||
colorKey = lv_color_to32(LV_COLOR_CHROMA_KEY);
|
||||
|
||||
return LV_RES_OK;
|
||||
}
|
||||
|
||||
/**
|
||||
* Disable PXP device. Should be called during display deinit sequence.
|
||||
*/
|
||||
void lv_gpu_nxp_pxp_deinit(void)
|
||||
{
|
||||
pxp_cfg.pxp_interrupt_deinit();
|
||||
PXP_DisableInterrupts(PXP, kPXP_CompleteInterruptEnable);
|
||||
PXP_Deinit(LV_GPU_NXP_PXP_ID);
|
||||
}
|
||||
|
||||
/**
|
||||
* Fill area, with optional opacity.
|
||||
*
|
||||
* @param[in/out] dest_buf destination buffer
|
||||
* @param[in] dest_width width (stride) of destination buffer in pixels
|
||||
* @param[in] fill_area area to fill
|
||||
* @param[in] color color
|
||||
* @param[in] opa transparency of the color
|
||||
*/
|
||||
void lv_gpu_nxp_pxp_fill(lv_color_t * dest_buf, lv_coord_t dest_width, const lv_area_t * fill_area, lv_color_t color,
|
||||
lv_opa_t opa)
|
||||
{
|
||||
PXP_Init(LV_GPU_NXP_PXP_ID);
|
||||
PXP_EnableCsc1(LV_GPU_NXP_PXP_ID, false); /*Disable CSC1, it is enabled by default.*/
|
||||
PXP_SetProcessBlockSize(PXP, kPXP_BlockSize16); /*Block size 16x16 for higher performance*/
|
||||
|
||||
/*OUT buffer configure*/
|
||||
pxp_output_buffer_config_t outputConfig = {
|
||||
.pixelFormat = PXP_OUT_PIXEL_FORMAT,
|
||||
.interlacedMode = kPXP_OutputProgressive,
|
||||
.buffer0Addr = (uint32_t)(dest_buf + dest_width * fill_area->y1 + fill_area->x1),
|
||||
.buffer1Addr = (uint32_t)NULL,
|
||||
.pitchBytes = dest_width * sizeof(lv_color_t),
|
||||
.width = fill_area->x2 - fill_area->x1 + 1,
|
||||
.height = fill_area->y2 - fill_area->y1 + 1,
|
||||
};
|
||||
|
||||
PXP_SetOutputBufferConfig(LV_GPU_NXP_PXP_ID, &outputConfig);
|
||||
|
||||
if(opa > LV_OPA_MAX) {
|
||||
/*Simple color fill without opacity - AS disabled, PS as color generator*/
|
||||
PXP_SetAlphaSurfacePosition(LV_GPU_NXP_PXP_ID, 0xFFFFU, 0xFFFFU, 0U, 0U); /*Disable AS.*/
|
||||
PXP_SetProcessSurfacePosition(LV_GPU_NXP_PXP_ID, 0xFFFFU, 0xFFFFU, 0U, 0U); /*Disable PS.*/
|
||||
PXP_SetProcessSurfaceBackGroundColor(LV_GPU_NXP_PXP_ID, lv_color_to32(color));
|
||||
}
|
||||
else {
|
||||
/*Fill with opacity - AS used as source (same as OUT), PS used as color generator, blended together*/
|
||||
pxp_as_buffer_config_t asBufferConfig;
|
||||
pxp_porter_duff_config_t pdConfig;
|
||||
|
||||
/*Set AS to OUT*/
|
||||
asBufferConfig.pixelFormat = PXP_AS_PIXEL_FORMAT;
|
||||
asBufferConfig.bufferAddr = (uint32_t)outputConfig.buffer0Addr;
|
||||
asBufferConfig.pitchBytes = outputConfig.pitchBytes;
|
||||
|
||||
PXP_SetAlphaSurfaceBufferConfig(LV_GPU_NXP_PXP_ID, &asBufferConfig);
|
||||
PXP_SetAlphaSurfacePosition(LV_GPU_NXP_PXP_ID, 0U, 0U, fill_area->x2 - fill_area->x1 + 1,
|
||||
fill_area->y2 - fill_area->y1 + 1);
|
||||
|
||||
/*Disable PS, use as color generator*/
|
||||
PXP_SetProcessSurfacePosition(LV_GPU_NXP_PXP_ID, 0xFFFFU, 0xFFFFU, 0U, 0U);
|
||||
PXP_SetProcessSurfaceBackGroundColor(LV_GPU_NXP_PXP_ID, lv_color_to32(color));
|
||||
|
||||
/*Configure Porter-Duff blending - For RGB 565 only!*/
|
||||
pdConfig.enable = 1;
|
||||
pdConfig.dstColorMode = kPXP_PorterDuffColorStraight;
|
||||
pdConfig.srcColorMode = kPXP_PorterDuffColorStraight;
|
||||
pdConfig.dstGlobalAlphaMode = kPXP_PorterDuffGlobalAlpha;
|
||||
pdConfig.srcGlobalAlphaMode = kPXP_PorterDuffGlobalAlpha;
|
||||
pdConfig.srcFactorMode = kPXP_PorterDuffFactorStraight;
|
||||
pdConfig.dstFactorMode = kPXP_PorterDuffFactorStraight;
|
||||
pdConfig.srcGlobalAlpha = opa;
|
||||
pdConfig.dstGlobalAlpha = 255 - opa;
|
||||
pdConfig.srcAlphaMode = kPXP_PorterDuffAlphaStraight; /*don't care*/
|
||||
pdConfig.dstAlphaMode = kPXP_PorterDuffAlphaStraight; /*don't care*/
|
||||
PXP_SetPorterDuffConfig(LV_GPU_NXP_PXP_ID, &pdConfig);
|
||||
}
|
||||
|
||||
lv_gpu_nxp_pxp_run(); /*Start PXP task*/
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief BLock Image Transfer - copy rectangular image from src buffer to dst buffer with effects.
|
||||
*
|
||||
* By default, image is copied directly, with optional opacity configured by \p opa.
|
||||
* Color keying can be enabled by calling lv_gpu_nxp_pxp_enable_color_key() before calling this function.
|
||||
* Recoloring can be enabled by calling lv_gpu_nxp_pxp_enable_recolor() before calling this function.
|
||||
* Note that color keying and recoloring at the same time is not supported and black rectangle is rendered.
|
||||
*
|
||||
* @param[in/out] dest destination buffer
|
||||
* @param[in] dest_width width (stride) of destination buffer in pixels
|
||||
* @param[in] src source buffer
|
||||
* @param[in] src_with width (stride) of source buffer in pixels
|
||||
* @param[in] copy_w width of area to be copied from src to dest
|
||||
* @param[in] copy_h height of area to be copied from src to dest
|
||||
* @param[in] opa opacity of the result
|
||||
*/
|
||||
void lv_gpu_nxp_pxp_blit(lv_color_t * dest, lv_coord_t dest_width, const lv_color_t * src, lv_coord_t src_width,
|
||||
lv_coord_t copy_width, lv_coord_t copy_height, lv_opa_t opa)
|
||||
{
|
||||
|
||||
if(recolorEnabled) { /*switch to recolor version of blit*/
|
||||
lv_gpu_nxp_pxp_blit_recolor(dest, dest_width, src, src_width, copy_width, copy_height, opa, recolor, recolorOpa);
|
||||
return;
|
||||
};
|
||||
|
||||
PXP_Init(PXP);
|
||||
PXP_EnableCsc1(PXP, false); /*Disable CSC1, it is enabled by default.*/
|
||||
PXP_SetProcessBlockSize(PXP, kPXP_BlockSize16); /*block size 16x16 for higher performance*/
|
||||
|
||||
pxp_output_buffer_config_t outputBufferConfig;
|
||||
pxp_as_buffer_config_t asBufferConfig;
|
||||
pxp_as_blend_config_t asBlendConfig;
|
||||
|
||||
asBlendConfig.alpha = opa;
|
||||
asBlendConfig.invertAlpha = false;
|
||||
asBlendConfig.alphaMode = kPXP_AlphaRop;
|
||||
asBlendConfig.ropMode = kPXP_RopMergeAs;
|
||||
|
||||
if(opa >= LV_OPA_MAX && !colorKeyEnabled) {
|
||||
/*Simple blit, no effect - Disable PS buffer*/
|
||||
PXP_SetProcessSurfacePosition(LV_GPU_NXP_PXP_ID, 0xFFFFU, 0xFFFFU, 0U, 0U);
|
||||
}
|
||||
else {
|
||||
/*Alpha blending or color keying enabled - PS must be enabled to fetch background pixels
|
||||
PS and OUT buffers are the same, blend will be done in-place*/
|
||||
pxp_ps_buffer_config_t psBufferConfig = {
|
||||
.pixelFormat = PXP_PS_PIXEL_FORMAT,
|
||||
.swapByte = false,
|
||||
.bufferAddr = (uint32_t)dest,
|
||||
.bufferAddrU = 0U,
|
||||
.bufferAddrV = 0U,
|
||||
.pitchBytes = dest_width * sizeof(lv_color_t)
|
||||
};
|
||||
asBlendConfig.alphaMode = kPXP_AlphaOverride;
|
||||
PXP_SetProcessSurfaceBufferConfig(LV_GPU_NXP_PXP_ID, &psBufferConfig);
|
||||
PXP_SetProcessSurfacePosition(LV_GPU_NXP_PXP_ID, 0U, 0U, copy_width - 1, copy_height - 1);
|
||||
}
|
||||
|
||||
/*AS buffer - source image*/
|
||||
asBufferConfig.pixelFormat = PXP_AS_PIXEL_FORMAT;
|
||||
asBufferConfig.bufferAddr = (uint32_t)src;
|
||||
asBufferConfig.pitchBytes = src_width * sizeof(lv_color_t);
|
||||
PXP_SetAlphaSurfaceBufferConfig(LV_GPU_NXP_PXP_ID, &asBufferConfig);
|
||||
PXP_SetAlphaSurfacePosition(LV_GPU_NXP_PXP_ID, 0U, 0U, copy_width - 1U, copy_height - 1U);
|
||||
PXP_SetAlphaSurfaceBlendConfig(LV_GPU_NXP_PXP_ID, &asBlendConfig);
|
||||
|
||||
if(colorKeyEnabled) {
|
||||
PXP_SetAlphaSurfaceOverlayColorKey(LV_GPU_NXP_PXP_ID, colorKey, colorKey);
|
||||
}
|
||||
PXP_EnableAlphaSurfaceOverlayColorKey(LV_GPU_NXP_PXP_ID, colorKeyEnabled);
|
||||
|
||||
/*Output buffer.*/
|
||||
outputBufferConfig.pixelFormat = (pxp_output_pixel_format_t)PXP_OUT_PIXEL_FORMAT;
|
||||
outputBufferConfig.interlacedMode = kPXP_OutputProgressive;
|
||||
outputBufferConfig.buffer0Addr = (uint32_t)dest;
|
||||
outputBufferConfig.buffer1Addr = (uint32_t)0U;
|
||||
outputBufferConfig.pitchBytes = dest_width * sizeof(lv_color_t);
|
||||
outputBufferConfig.width = copy_width;
|
||||
outputBufferConfig.height = copy_height;
|
||||
PXP_SetOutputBufferConfig(LV_GPU_NXP_PXP_ID, &outputBufferConfig);
|
||||
|
||||
lv_gpu_nxp_pxp_run(); /* Start PXP task */
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Enable color keying for subsequent calls to lv_gpu_nxp_pxp_blit()
|
||||
*
|
||||
* Color key is defined by symbol in lv_conf.h
|
||||
*/
|
||||
void lv_gpu_nxp_pxp_enable_color_key(void)
|
||||
{
|
||||
colorKeyEnabled = true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Disable color keying for subsequent calls to lv_gpu_nxp_pxp_blit()
|
||||
*
|
||||
*/
|
||||
void lv_gpu_nxp_pxp_disable_color_key(void)
|
||||
{
|
||||
colorKeyEnabled = false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Enable recolor feature for subsequent calls to lv_gpu_nxp_pxp_blit()
|
||||
*
|
||||
* @param[in] color recolor value
|
||||
* @param[in] opa effect opacity
|
||||
*/
|
||||
void lv_gpu_nxp_pxp_enable_recolor(lv_color_t color, lv_opa_t opa)
|
||||
{
|
||||
recolorEnabled = true;
|
||||
recolor = color;
|
||||
recolorOpa = opa;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Disable recolor feature for subsequent calls to lv_gpu_nxp_pxp_blit()
|
||||
*/
|
||||
void lv_gpu_nxp_pxp_disable_recolor(void)
|
||||
{
|
||||
recolorEnabled = false;
|
||||
}
|
||||
|
||||
/**********************
|
||||
* STATIC FUNCTIONS
|
||||
**********************/
|
||||
|
||||
/**
|
||||
* @brief Start PXP job and wait for results
|
||||
*
|
||||
* Function used internally to start PXP task according current device
|
||||
* configuration.
|
||||
*/
|
||||
static void lv_gpu_nxp_pxp_run(void)
|
||||
{
|
||||
lv_disp_t * disp = _lv_refr_get_disp_refreshing();
|
||||
|
||||
if(disp && disp->driver->clean_dcache_cb) { /* Clean & invalidate cache */
|
||||
disp->driver->clean_dcache_cb(disp->driver);
|
||||
}
|
||||
|
||||
pxp_cfg.pxp_run();
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief BLock Image Transfer - copy rectangular image from src buffer to dst buffer with recoloring.
|
||||
*
|
||||
* Note that color keying and recoloring at the same time is not supported and black rectangle is rendered.
|
||||
*
|
||||
* @param[in/out] dest destination buffer
|
||||
* @param[in] dest_width width (stride) of destination buffer in pixels
|
||||
* @param[in] src source buffer
|
||||
* @param[in] src_with width (stride) of source buffer in pixels
|
||||
* @param[in] copy_w width of area to be copied from src to dest
|
||||
* @param[in] copy_h height of area to be copied from src to dest
|
||||
* @param[in] opa opacity of the result
|
||||
* @param[in] recolor recolor value
|
||||
* @param[in] recolorOpa effect opacity
|
||||
*/
|
||||
static void lv_gpu_nxp_pxp_blit_recolor(lv_color_t * dest, lv_coord_t dest_width, const lv_color_t * src,
|
||||
lv_coord_t src_width,
|
||||
lv_coord_t copy_width, lv_coord_t copy_height, lv_opa_t opa, lv_color_t recolor, lv_opa_t recolorOpa)
|
||||
{
|
||||
pxp_output_buffer_config_t outputBufferConfig;
|
||||
pxp_as_buffer_config_t asBufferConfig;
|
||||
|
||||
if(colorKeyEnabled) {
|
||||
/*should never get here, recolor & color keying not supported. Draw black box instead.*/
|
||||
const lv_area_t fill_area = {.x1 = 0, .y1 = 0, .x2 = copy_width - 1, .y2 = copy_height - 1};
|
||||
lv_gpu_nxp_pxp_fill(dest, dest_width, &fill_area, lv_color_black(), LV_OPA_MAX);
|
||||
LV_LOG_WARN("Recoloring and color keying is not supported. Black rectangle rendered.");
|
||||
return ;
|
||||
}
|
||||
else {
|
||||
/*Recoloring without color keying*/
|
||||
if(opa > LV_OPA_MAX) {
|
||||
/*Recolor with full opacity - AS source image, PS color generator, OUT destination*/
|
||||
PXP_Init(PXP);
|
||||
PXP_EnableCsc1(PXP, false); /*Disable CSC1, it is enabled by default.*/
|
||||
PXP_SetProcessBlockSize(PXP, kPXP_BlockSize16); /*block size 16x16 for higher performance*/
|
||||
|
||||
/*AS buffer - source image*/
|
||||
asBufferConfig.pixelFormat = PXP_AS_PIXEL_FORMAT;
|
||||
asBufferConfig.bufferAddr = (uint32_t)src;
|
||||
asBufferConfig.pitchBytes = src_width * sizeof(lv_color_t);
|
||||
PXP_SetAlphaSurfaceBufferConfig(LV_GPU_NXP_PXP_ID, &asBufferConfig);
|
||||
PXP_SetAlphaSurfacePosition(LV_GPU_NXP_PXP_ID, 0U, 0U, copy_width - 1U, copy_height - 1U);
|
||||
|
||||
/*Disable PS buffer, use as color generator*/
|
||||
PXP_SetProcessSurfacePosition(LV_GPU_NXP_PXP_ID, 0xFFFFU, 0xFFFFU, 0U, 0U);
|
||||
PXP_SetProcessSurfaceBackGroundColor(LV_GPU_NXP_PXP_ID, lv_color_to32(recolor));
|
||||
|
||||
/*Output buffer*/
|
||||
outputBufferConfig.pixelFormat = (pxp_output_pixel_format_t)PXP_OUT_PIXEL_FORMAT;
|
||||
outputBufferConfig.interlacedMode = kPXP_OutputProgressive;
|
||||
outputBufferConfig.buffer0Addr = (uint32_t)dest;
|
||||
outputBufferConfig.buffer1Addr = (uint32_t)0U;
|
||||
outputBufferConfig.pitchBytes = dest_width * sizeof(lv_color_t);
|
||||
outputBufferConfig.width = copy_width;
|
||||
outputBufferConfig.height = copy_height;
|
||||
PXP_SetOutputBufferConfig(LV_GPU_NXP_PXP_ID, &outputBufferConfig);
|
||||
|
||||
pxp_porter_duff_config_t pdConfig;
|
||||
|
||||
/*Configure Porter-Duff blending - For RGB 565 only!*/
|
||||
pdConfig.enable = 1;
|
||||
pdConfig.dstColorMode = kPXP_PorterDuffColorStraight;
|
||||
pdConfig.srcColorMode = kPXP_PorterDuffColorStraight;
|
||||
pdConfig.dstGlobalAlphaMode = kPXP_PorterDuffGlobalAlpha;
|
||||
pdConfig.srcGlobalAlphaMode = kPXP_PorterDuffGlobalAlpha;
|
||||
pdConfig.srcFactorMode = kPXP_PorterDuffFactorStraight;
|
||||
pdConfig.dstFactorMode = kPXP_PorterDuffFactorStraight;
|
||||
pdConfig.srcGlobalAlpha = recolorOpa;
|
||||
pdConfig.dstGlobalAlpha = 255 - recolorOpa;
|
||||
pdConfig.srcAlphaMode = kPXP_PorterDuffAlphaStraight; /*don't care*/
|
||||
pdConfig.dstAlphaMode = kPXP_PorterDuffAlphaStraight; /*don't care*/
|
||||
PXP_SetPorterDuffConfig(LV_GPU_NXP_PXP_ID, &pdConfig);
|
||||
|
||||
lv_gpu_nxp_pxp_run(); /*Start PXP task*/
|
||||
|
||||
}
|
||||
else {
|
||||
/*Recolor with transparency*/
|
||||
|
||||
/*Step 1: Recolor with full opacity to temporary buffer*/
|
||||
lv_color_t * tmpBuf = (lv_color_t *)lv_mem_buf_get(copy_width * copy_height * sizeof(lv_color_t));
|
||||
lv_gpu_nxp_pxp_blit_recolor(tmpBuf, copy_width, src, src_width, copy_width, copy_height, LV_OPA_COVER, recolor,
|
||||
recolorOpa);
|
||||
|
||||
/*Step 2: BLIT temporary results with required opacity to output*/
|
||||
lv_gpu_nxp_pxp_disable_recolor(); /*make sure to take BLIT path, not the recolor*/
|
||||
lv_gpu_nxp_pxp_blit(dest, dest_width, tmpBuf, copy_width, copy_width, copy_height, opa);
|
||||
lv_gpu_nxp_pxp_enable_recolor(recolor, recolorOpa); /*restore state*/
|
||||
|
||||
/*Step 3: Clean-up memory*/
|
||||
lv_mem_buf_release(tmpBuf);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif /* LV_USE_GPU_NXP_PXP */
|
@ -1,193 +0,0 @@
|
||||
/**
|
||||
* @file lv_gpu_nxp_pxp.h
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* MIT License
|
||||
*
|
||||
* Copyright (c) 2020 NXP
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights to
|
||||
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||
* the Software, and to permit persons to whom the Software is furnished to do so,
|
||||
* subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice (including the next paragraph)
|
||||
* shall be included in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
|
||||
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
|
||||
* PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
||||
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
|
||||
* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
|
||||
* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef LV_SRC_LV_GPU_LV_GPU_NXP_PXP_H_
|
||||
#define LV_SRC_LV_GPU_LV_GPU_NXP_PXP_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*********************
|
||||
* INCLUDES
|
||||
*********************/
|
||||
|
||||
#include "../../lv_conf_internal.h"
|
||||
|
||||
#if LV_USE_GPU_NXP_PXP
|
||||
|
||||
#include "../misc/lv_area.h"
|
||||
#include "../misc/lv_color.h"
|
||||
|
||||
/*********************
|
||||
* DEFINES
|
||||
*********************/
|
||||
|
||||
/** PXP module instance to use*/
|
||||
#define LV_GPU_NXP_PXP_ID PXP
|
||||
|
||||
/** PXP interrupt line I*/
|
||||
#define LV_GPU_NXP_PXP_IRQ_ID PXP_IRQn
|
||||
|
||||
#ifndef LV_GPU_NXP_PXP_BLIT_SIZE_LIMIT
|
||||
/** Minimum area (in pixels) for image copy with 100% opacity to be handled by PXP*/
|
||||
#define LV_GPU_NXP_PXP_BLIT_SIZE_LIMIT 32
|
||||
#endif
|
||||
|
||||
#ifndef LV_GPU_NXP_PXP_BLIT_OPA_SIZE_LIMIT
|
||||
/** Minimum area (in pixels) for image copy with transparency to be handled by PXP*/
|
||||
#define LV_GPU_NXP_PXP_BLIT_OPA_SIZE_LIMIT 16
|
||||
#endif
|
||||
|
||||
#ifndef LV_GPU_NXP_PXP_BUFF_SYNC_BLIT_SIZE_LIMIT
|
||||
/** Minimum invalidated area (in pixels) to be synchronized by PXP during buffer sync */
|
||||
#define LV_GPU_NXP_PXP_BUFF_SYNC_BLIT_SIZE_LIMIT 32
|
||||
#endif
|
||||
|
||||
#ifndef LV_GPU_NXP_PXP_FILL_SIZE_LIMIT
|
||||
/** Minimum area (in pixels) to be filled by PXP with 100% opacity*/
|
||||
#define LV_GPU_NXP_PXP_FILL_SIZE_LIMIT 64
|
||||
#endif
|
||||
|
||||
#ifndef LV_GPU_NXP_PXP_FILL_OPA_SIZE_LIMIT
|
||||
/** Minimum area (in pixels) to be filled by PXP with transparency*/
|
||||
#define LV_GPU_NXP_PXP_FILL_OPA_SIZE_LIMIT 32
|
||||
#endif
|
||||
|
||||
/**********************
|
||||
* TYPEDEFS
|
||||
**********************/
|
||||
/**
|
||||
* NXP PXP device configuration - call-backs used for
|
||||
* interrupt init/wait/deinit.
|
||||
*/
|
||||
typedef struct {
|
||||
/** Callback for PXP interrupt initialization*/
|
||||
lv_res_t (*pxp_interrupt_init)(void);
|
||||
|
||||
/** Callback for PXP interrupt de-initialization*/
|
||||
void (*pxp_interrupt_deinit)(void);
|
||||
|
||||
/** Callback that should start PXP and wait for operation complete*/
|
||||
void (*pxp_run)(void);
|
||||
} lv_nxp_pxp_cfg_t;
|
||||
|
||||
/**********************
|
||||
* STATIC VARIABLES
|
||||
**********************/
|
||||
|
||||
/**********************
|
||||
* MACROS
|
||||
**********************/
|
||||
|
||||
/**********************
|
||||
* GLOBAL FUNCTIONS
|
||||
**********************/
|
||||
|
||||
/**
|
||||
* Reset and initialize PXP device. This function should be called as a part
|
||||
* of display init sequence.
|
||||
*
|
||||
* @return LV_RES_OK: PXP init ok; LV_RES_INV: init error. See error log for more information.
|
||||
*/
|
||||
lv_res_t lv_gpu_nxp_pxp_init(lv_nxp_pxp_cfg_t * cfg);
|
||||
|
||||
/**
|
||||
* Disable PXP device. Should be called during display deinit sequence.
|
||||
*/
|
||||
void lv_gpu_nxp_pxp_deinit(void);
|
||||
|
||||
/**
|
||||
* Fill area, with optional opacity.
|
||||
*
|
||||
* @param[in/out] dest_buf destination buffer
|
||||
* @param[in] dest_width width (stride) of destination buffer in pixels
|
||||
* @param[in] fill_area area to fill
|
||||
* @param[in] color color
|
||||
* @param[in] opa transparency of the color
|
||||
*/
|
||||
void lv_gpu_nxp_pxp_fill(lv_color_t * dest_buf, lv_coord_t dest_width, const lv_area_t * fill_area, lv_color_t color,
|
||||
lv_opa_t opa);
|
||||
|
||||
/**
|
||||
* @brief BLock Image Transfer - copy rectangular image from src buffer to dst buffer with effects.
|
||||
*
|
||||
* By default, image is copied directly, with optional opacity configured by \p opa.
|
||||
* Color keying can be enabled by calling lv_gpu_nxp_pxp_enable_color_key() before calling this function.
|
||||
* Recoloring can be enabled by calling lv_gpu_nxp_pxp_enable_recolor() before calling this function.
|
||||
* Note that color keying and recoloring at the same time is not supported and black rectangle is rendered.
|
||||
*
|
||||
* @param[in/out] dest destination buffer
|
||||
* @param[in] dest_width width (stride) of destination buffer in pixels
|
||||
* @param[in] src source buffer
|
||||
* @param[in] src_with width (stride) of source buffer in pixels
|
||||
* @param[in] copy_w width of area to be copied from src to dest
|
||||
* @param[in] copy_h height of area to be copied from src to dest
|
||||
* @param[in] opa opacity of the result
|
||||
*/
|
||||
void lv_gpu_nxp_pxp_blit(lv_color_t * dest, lv_coord_t dest_width, const lv_color_t * src, lv_coord_t src_width,
|
||||
lv_coord_t copy_width, lv_coord_t copy_height, lv_opa_t opa);
|
||||
|
||||
/**
|
||||
* @brief Enable color keying for subsequent calls to lv_gpu_nxp_pxp_blit()
|
||||
*
|
||||
* Color key is defined by LV_COLOR_TRANSP symbol in lv_conf.h
|
||||
*/
|
||||
void lv_gpu_nxp_pxp_enable_color_key(void);
|
||||
|
||||
/**
|
||||
* @brief Disable color keying for subsequent calls to lv_gpu_nxp_pxp_blit()
|
||||
*
|
||||
*/
|
||||
void lv_gpu_nxp_pxp_disable_color_key(void);
|
||||
|
||||
/**
|
||||
* @brief Enable recolor feature for subsequent calls to lv_gpu_nxp_pxp_blit()
|
||||
*
|
||||
* @param[in] color recolor value
|
||||
* @param[in] opa effect opacity
|
||||
*/
|
||||
void lv_gpu_nxp_pxp_enable_recolor(lv_color_t color, lv_opa_t opa);
|
||||
|
||||
/**
|
||||
* @brief Disable recolor feature for subsequent calls to lv_gpu_nxp_pxp_blit()
|
||||
*/
|
||||
void lv_gpu_nxp_pxp_disable_recolor(void);
|
||||
|
||||
/**********************
|
||||
* STATIC FUNCTIONS
|
||||
**********************/
|
||||
|
||||
#endif /*LV_USE_GPU_NXP_PXP*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /*extern "C"*/
|
||||
#endif
|
||||
|
||||
#endif /*LV_SRC_LV_GPU_LV_GPU_NXP_PXP_H_*/
|
@ -1,770 +0,0 @@
|
||||
/**
|
||||
* @file lv_gpu_nxp_vglite.c
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* MIT License
|
||||
*
|
||||
* Copyright (c) 2020 NXP
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights to
|
||||
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||
* the Software, and to permit persons to whom the Software is furnished to do so,
|
||||
* subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice (including the next paragraph)
|
||||
* shall be included in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
|
||||
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
|
||||
* PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
||||
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
|
||||
* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
|
||||
* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
*/
|
||||
|
||||
/*********************
|
||||
* INCLUDES
|
||||
*********************/
|
||||
|
||||
#include "lv_gpu_nxp_vglite.h"
|
||||
|
||||
#if LV_USE_GPU_NXP_VG_LITE
|
||||
|
||||
#include "lvgl.h"
|
||||
#include "../misc/lv_log.h"
|
||||
#include "fsl_cache.h"
|
||||
#include "vg_lite.h"
|
||||
#include "fsl_debug_console.h"
|
||||
|
||||
/*********************
|
||||
* DEFINES
|
||||
*********************/
|
||||
|
||||
#if LV_COLOR_DEPTH==16
|
||||
#define VGLITE_PX_FMT VG_LITE_RGB565
|
||||
#else
|
||||
#error Only 16bit color depth is supported. Set LV_COLOR_DEPTH to 16.
|
||||
#endif
|
||||
|
||||
/* Enable BLIT quality degradation workaround for RT595 */
|
||||
#define RT595_BLIT_WRKRND_ENABLED 1
|
||||
|
||||
/* If LV_HOR_RES_MAX/LV_VER_RES_MAX is higher than this value, workaround will be enabled */
|
||||
#define RT595_BLIT_WRKRND_THR 352
|
||||
|
||||
/* Print detailed info to SDK console (NOT to LVGL log system) */
|
||||
#define BLIT_DBG_VERBOSE 0
|
||||
|
||||
/* Draw rectangles around BLIT tiles */
|
||||
#define BLIT_DBG_AREAS 0
|
||||
|
||||
/* Redirect PRINT to SDK PRINTF */
|
||||
#define PRINT PRINTF
|
||||
|
||||
/* Verbose debug print */
|
||||
#if BLIT_DBG_VERBOSE
|
||||
#define PRINT_BLT PRINTF
|
||||
#else
|
||||
#define PRINT_BLT(...)
|
||||
#endif
|
||||
|
||||
/* Internal compound symbol */
|
||||
#if (defined(CPU_MIMXRT595SFFOB) || defined(CPU_MIMXRT595SFFOB_cm33) || \
|
||||
defined(CPU_MIMXRT595SFFOC) || defined(CPU_MIMXRT595SFFOC_cm33)) && \
|
||||
((LV_HOR_RES_MAX > RT595_BLIT_WRKRND_THR) || (LV_VER_RES_MAX > RT595_BLIT_WRKRND_THR)) && \
|
||||
RT595_BLIT_WRKRND_ENABLED
|
||||
#define _BLIT_SPLIT_ENABLED 1
|
||||
#else
|
||||
#define _BLIT_SPLIT_ENABLED 0
|
||||
#endif
|
||||
|
||||
/* BLIT split threshold - BLITs with width or height higher than this value will be done
|
||||
* in multiple steps. Value must be 16-aligned. Don't change.
|
||||
* */
|
||||
#define LV_GPU_NXP_VG_LITE_BLIT_SPLIT_THR 352
|
||||
|
||||
|
||||
/**********************
|
||||
* TYPEDEFS
|
||||
**********************/
|
||||
|
||||
/**********************
|
||||
* STATIC PROTOTYPES
|
||||
**********************/
|
||||
|
||||
static lv_res_t _init_vg_buf(vg_lite_buffer_t * dst, uint32_t width, uint32_t height, uint32_t stride,
|
||||
const lv_color_t * ptr, bool source);
|
||||
|
||||
static lv_res_t _lv_gpu_nxp_vglite_blit_single(lv_gpu_nxp_vglite_blit_info_t * blit);
|
||||
#if _BLIT_SPLIT_ENABLED
|
||||
static void _align_x(lv_area_t * area, lv_color_t ** buf);
|
||||
static void _align_y(lv_area_t * area, lv_color_t ** buf, uint32_t stridePx);
|
||||
static void _sw_blit(lv_gpu_nxp_vglite_blit_info_t * blit);
|
||||
#if BLIT_DBG_AREAS
|
||||
static void _draw_rectangle(lv_color_t * dest_buf, lv_coord_t dest_width, lv_coord_t dest_height,
|
||||
lv_area_t * fill_area, lv_color_t color);
|
||||
#endif
|
||||
static lv_res_t _lv_gpu_nxp_vglite_check_blit(lv_gpu_nxp_vglite_blit_info_t * blit);
|
||||
#endif
|
||||
|
||||
/**********************
|
||||
* STATIC VARIABLES
|
||||
**********************/
|
||||
|
||||
/**********************
|
||||
* MACROS
|
||||
**********************/
|
||||
|
||||
#define CHECK(cond, txt) \
|
||||
do { \
|
||||
if (cond) { \
|
||||
PRINT("%s. STOP!\n", txt); \
|
||||
for ( ; ; ); \
|
||||
} \
|
||||
} while(0)
|
||||
|
||||
/**********************
|
||||
* GLOBAL FUNCTIONS
|
||||
**********************/
|
||||
|
||||
/***
|
||||
* Fills rectangular area in buffer.
|
||||
* @param[in] dest_buf Destination buffer pointer (must be aligned on 32 bytes)
|
||||
* @param[in] dest_width Destination buffer width in pixels (must be aligned on 16 px)
|
||||
* @param[in] dest_height Destination buffer height in pixels
|
||||
* @param[in] fill_area Area to be filled
|
||||
* @param[in] color Fill color
|
||||
* @param[in] opa Opacity (255 = full, 128 = 50% background/50% color, 0 = no fill)
|
||||
* @retval LV_RES_OK Fill completed
|
||||
* @retval LV_RES_INV Error occurred (\see LV_GPU_NXP_VG_LITE_LOG_ERRORS)
|
||||
*/
|
||||
lv_res_t lv_gpu_nxp_vglite_fill(lv_color_t * dest_buf, lv_coord_t dest_width, lv_coord_t dest_height,
|
||||
const lv_area_t * fill_area, lv_color_t color, lv_opa_t opa)
|
||||
{
|
||||
vg_lite_buffer_t rt;
|
||||
vg_lite_rectangle_t rect;
|
||||
vg_lite_error_t err = VG_LITE_SUCCESS;
|
||||
lv_color32_t col32 = {.full = lv_color_to32(color)}; /*Convert color to RGBA8888*/
|
||||
lv_disp_t * disp = _lv_refr_get_disp_refreshing();
|
||||
|
||||
if(_init_vg_buf(&rt, (uint32_t) dest_width, (uint32_t) dest_height, (uint32_t) dest_width * sizeof(lv_color_t),
|
||||
(const lv_color_t *) dest_buf, false) != LV_RES_OK) {
|
||||
#if LV_GPU_NXP_VG_LITE_LOG_ERRORS
|
||||
LV_LOG_ERROR("init_vg_buf reported error. Fill failed.");
|
||||
#endif
|
||||
return LV_RES_INV;
|
||||
}
|
||||
|
||||
if(opa >= (lv_opa_t) LV_OPA_MAX) { /*Opaque fill*/
|
||||
rect.x = fill_area->x1;
|
||||
rect.y = fill_area->y1;
|
||||
rect.width = (int32_t) fill_area->x2 - (int32_t) fill_area->x1 + 1;
|
||||
rect.height = (int32_t) fill_area->y2 - (int32_t) fill_area->y1 + 1;
|
||||
|
||||
if(disp != NULL && disp->driver->clean_dcache_cb != NULL) { /*Clean & invalidate cache*/
|
||||
disp->driver->clean_dcache_cb(disp->driver);
|
||||
}
|
||||
|
||||
err = vg_lite_clear(&rt, &rect, col32.full);
|
||||
if(err != VG_LITE_SUCCESS) {
|
||||
#if LV_GPU_NXP_VG_LITE_LOG_ERRORS
|
||||
LV_LOG_ERROR("vg_lite_clear reported error. Fill failed.");
|
||||
#endif
|
||||
return LV_RES_INV;
|
||||
}
|
||||
err = vg_lite_finish();
|
||||
if(err != VG_LITE_SUCCESS) {
|
||||
#if LV_GPU_NXP_VG_LITE_LOG_ERRORS
|
||||
LV_LOG_ERROR("vg_lite_finish reported error. Fill failed.");
|
||||
#endif
|
||||
return LV_RES_INV;
|
||||
}
|
||||
}
|
||||
else { /*fill with transparency*/
|
||||
|
||||
vg_lite_path_t path;
|
||||
lv_color32_t colMix;
|
||||
int16_t path_data[] = { /*VG rectangular path*/
|
||||
VLC_OP_MOVE, fill_area->x1, fill_area->y1,
|
||||
VLC_OP_LINE, fill_area->x2 + 1, fill_area->y1,
|
||||
VLC_OP_LINE, fill_area->x2 + 1, fill_area->y2 + 1,
|
||||
VLC_OP_LINE, fill_area->x1, fill_area->y2 + 1,
|
||||
VLC_OP_LINE, fill_area->x1, fill_area->y1,
|
||||
VLC_OP_END
|
||||
};
|
||||
|
||||
err = vg_lite_init_path(&path, VG_LITE_S16, VG_LITE_LOW, sizeof(path_data), path_data,
|
||||
(vg_lite_float_t) fill_area->x1, (vg_lite_float_t) fill_area->y1, ((vg_lite_float_t) fill_area->x2) + 1.0f,
|
||||
((vg_lite_float_t) fill_area->y2) + 1.0f);
|
||||
if(err != VG_LITE_SUCCESS) {
|
||||
#if LV_GPU_NXP_VG_LITE_LOG_ERRORS
|
||||
LV_LOG_ERROR("vg_lite_init_path() failed.");
|
||||
#endif
|
||||
return LV_RES_INV;
|
||||
}
|
||||
|
||||
colMix.ch.red = (uint8_t)(((uint16_t)col32.ch.red * opa) >> 8); /*Pre-multiply color*/
|
||||
colMix.ch.green = (uint8_t)(((uint16_t)col32.ch.green * opa) >> 8);
|
||||
colMix.ch.blue = (uint8_t)(((uint16_t)col32.ch.blue * opa) >> 8);
|
||||
colMix.ch.alpha = opa;
|
||||
|
||||
if((disp != NULL) && (disp->driver->clean_dcache_cb != NULL)) { /*Clean & invalidate cache*/
|
||||
disp->driver->clean_dcache_cb(disp->driver);
|
||||
}
|
||||
|
||||
vg_lite_matrix_t matrix;
|
||||
vg_lite_identity(&matrix);
|
||||
|
||||
/*Draw rectangle*/
|
||||
err = vg_lite_draw(&rt, &path, VG_LITE_FILL_EVEN_ODD, &matrix, VG_LITE_BLEND_SRC_OVER, colMix.full);
|
||||
if(err != VG_LITE_SUCCESS) {
|
||||
#if LV_GPU_NXP_VG_LITE_LOG_ERRORS
|
||||
LV_LOG_ERROR("vg_lite_draw() failed.");
|
||||
#endif
|
||||
vg_lite_clear_path(&path);
|
||||
return LV_RES_INV;
|
||||
}
|
||||
|
||||
err = vg_lite_finish();
|
||||
if(err != VG_LITE_SUCCESS) {
|
||||
#if LV_GPU_NXP_VG_LITE_LOG_ERRORS
|
||||
LV_LOG_ERROR("vg_lite_finish() failed.");
|
||||
#endif
|
||||
return LV_RES_INV;
|
||||
}
|
||||
|
||||
err = vg_lite_clear_path(&path);
|
||||
if(err != VG_LITE_SUCCESS) {
|
||||
#if LV_GPU_NXP_VG_LITE_LOG_ERRORS
|
||||
LV_LOG_ERROR("vg_lite_clear_path() failed.");
|
||||
#endif
|
||||
return LV_RES_INV;
|
||||
}
|
||||
}
|
||||
|
||||
if(err == VG_LITE_SUCCESS) {
|
||||
return LV_RES_OK;
|
||||
}
|
||||
else {
|
||||
#if LV_GPU_NXP_VG_LITE_LOG_ERRORS
|
||||
LV_LOG_ERROR("VG Lite Fill failed.");
|
||||
#endif
|
||||
return LV_RES_INV;
|
||||
}
|
||||
}
|
||||
|
||||
/***
|
||||
* BLock Image Transfer.
|
||||
* @param[in] blit Description of the transfer
|
||||
* @retval LV_RES_OK Transfer complete
|
||||
* @retval LV_RES_INV Error occurred (\see LV_GPU_NXP_VG_LITE_LOG_ERRORS)
|
||||
*/
|
||||
lv_res_t lv_gpu_nxp_vglite_blit(lv_gpu_nxp_vglite_blit_info_t * blit)
|
||||
{
|
||||
#if _BLIT_SPLIT_ENABLED
|
||||
|
||||
lv_res_t rv = LV_RES_INV;
|
||||
|
||||
if(_lv_gpu_nxp_vglite_check_blit(blit) != LV_RES_OK) {
|
||||
PRINT_BLT("Blit check failed\n");
|
||||
return LV_RES_INV;
|
||||
}
|
||||
|
||||
PRINT_BLT("BLIT from: "
|
||||
"Area: %03d,%03d - %03d,%03d "
|
||||
"Addr: %d\n\n",
|
||||
blit->src_area.x1, blit->src_area.y1,
|
||||
blit->src_area.x2, blit->src_area.y2,
|
||||
(uintptr_t) blit->src);
|
||||
|
||||
PRINT_BLT("BLIT to: "
|
||||
"Area: %03d,%03d - %03d,%03d "
|
||||
"Addr: %d\n\n",
|
||||
blit->dst_area.x1, blit->dst_area.y1,
|
||||
blit->dst_area.x2, blit->dst_area.y2,
|
||||
(uintptr_t) blit->src);
|
||||
|
||||
/* Stage 1: Move starting pointers as close as possible to [x1, y1], so coordinates are as small as possible. */
|
||||
_align_x(&blit->src_area, (lv_color_t **)&blit->src);
|
||||
_align_y(&blit->src_area, (lv_color_t **)&blit->src, blit->src_stride / sizeof(lv_color_t));
|
||||
_align_x(&blit->dst_area, (lv_color_t **)&blit->dst);
|
||||
_align_y(&blit->dst_area, (lv_color_t **)&blit->dst, blit->dst_stride / sizeof(lv_color_t));
|
||||
|
||||
/* Stage 2: If we're in limit, do a single BLIT */
|
||||
if((blit->src_area.x2 < LV_GPU_NXP_VG_LITE_BLIT_SPLIT_THR) &&
|
||||
(blit->src_area.y2 < LV_GPU_NXP_VG_LITE_BLIT_SPLIT_THR)) {
|
||||
PRINT_BLT("Simple blit!\n");
|
||||
return _lv_gpu_nxp_vglite_blit_single(blit);
|
||||
};
|
||||
|
||||
/* Stage 3: Split the BLIT into multiple tiles */
|
||||
PRINT_BLT("Split blit!\n");
|
||||
|
||||
PRINT_BLT("Blit "
|
||||
"([%03d,%03d], [%03d,%03d]) -> "
|
||||
"([%03d,%03d], [%03d,%03d]) | "
|
||||
"([%03dx%03d] -> [%03dx%03d]) | "
|
||||
"A:(%d -> %d)\n",
|
||||
blit->src_area.x1, blit->src_area.y1, blit->src_area.x2, blit->src_area.y2,
|
||||
blit->dst_area.x1, blit->dst_area.y1, blit->dst_area.x2, blit->dst_area.y2,
|
||||
lv_area_get_width(&blit->src_area), lv_area_get_height(&blit->src_area),
|
||||
lv_area_get_width(&blit->dst_area), lv_area_get_height(&blit->dst_area),
|
||||
(uintptr_t) blit->src, (uintptr_t) blit->dst);
|
||||
|
||||
|
||||
uint32_t totalWidth = lv_area_get_width(&blit->src_area);
|
||||
uint32_t totalHeight = lv_area_get_height(&blit->src_area);
|
||||
|
||||
lv_gpu_nxp_vglite_blit_info_t tileBlit;
|
||||
|
||||
/* Number of tiles needed */
|
||||
int totalTilesX = (blit->src_area.x1 + totalWidth + LV_GPU_NXP_VG_LITE_BLIT_SPLIT_THR - 1) /
|
||||
LV_GPU_NXP_VG_LITE_BLIT_SPLIT_THR;
|
||||
int totalTilesY = (blit->src_area.y1 + totalHeight + LV_GPU_NXP_VG_LITE_BLIT_SPLIT_THR - 1) /
|
||||
LV_GPU_NXP_VG_LITE_BLIT_SPLIT_THR;
|
||||
|
||||
/* src and dst buffer shift against each other. Src buffer real data [0,0] may start actually at [3,0] in buffer, as
|
||||
* the buffer pointer has to be aligned, while dst buffer real data [0,0] may start at [1,0] in buffer. alignment may be
|
||||
* different */
|
||||
int shiftSrcX = (blit->src_area.x1 > blit->dst_area.x1) ? (blit->src_area.x1 - blit->dst_area.x1) : 0;
|
||||
int shiftDstX = (blit->src_area.x1 < blit->dst_area.x1) ? (blit->dst_area.x1 - blit->src_area.x1) : 0;
|
||||
|
||||
PRINT_BLT("\n");
|
||||
PRINT_BLT("Align shift: src: %d, dst: %d\n", shiftSrcX, shiftDstX);
|
||||
|
||||
tileBlit = *blit;
|
||||
|
||||
for(int tileY = 0; tileY < totalTilesY; tileY++) {
|
||||
|
||||
tileBlit.src_area.y1 = 0; /* no vertical alignment, always start from 0 */
|
||||
tileBlit.src_area.y2 = totalHeight - tileY * LV_GPU_NXP_VG_LITE_BLIT_SPLIT_THR - 1;
|
||||
if(tileBlit.src_area.y2 >= LV_GPU_NXP_VG_LITE_BLIT_SPLIT_THR) {
|
||||
tileBlit.src_area.y2 = LV_GPU_NXP_VG_LITE_BLIT_SPLIT_THR - 1; /* Should never happen */
|
||||
}
|
||||
tileBlit.src = blit->src + tileY * LV_GPU_NXP_VG_LITE_BLIT_SPLIT_THR * blit->src_stride / sizeof(
|
||||
lv_color_t); /* stride in px! */
|
||||
|
||||
tileBlit.dst_area.y1 = tileBlit.src_area.y1; /* y has no alignment, always in sync with src */
|
||||
tileBlit.dst_area.y2 = tileBlit.src_area.y2;
|
||||
|
||||
tileBlit.dst = blit->dst + tileY * LV_GPU_NXP_VG_LITE_BLIT_SPLIT_THR * blit->dst_stride / sizeof(
|
||||
lv_color_t); /* stride in px! */
|
||||
|
||||
for(int tileX = 0; tileX < totalTilesX; tileX++) {
|
||||
|
||||
if(tileX == 0) {
|
||||
/* 1st tile is special - there may be a gap between buffer start pointer
|
||||
* and area.x1 value, as the pointer has to be aligned.
|
||||
* tileBlit.src pointer - keep init value from Y-loop.
|
||||
* Also, 1st tile start is not shifted! shift is applied from 2nd tile */
|
||||
tileBlit.src_area.x1 = blit->src_area.x1;
|
||||
tileBlit.dst_area.x1 = blit->dst_area.x1;
|
||||
}
|
||||
else {
|
||||
/* subsequent tiles always starts from 0, but shifted*/
|
||||
tileBlit.src_area.x1 = 0 + shiftSrcX;
|
||||
tileBlit.dst_area.x1 = 0 + shiftDstX;
|
||||
/* and advance start pointer + 1 tile size */
|
||||
tileBlit.src += LV_GPU_NXP_VG_LITE_BLIT_SPLIT_THR;
|
||||
tileBlit.dst += LV_GPU_NXP_VG_LITE_BLIT_SPLIT_THR;
|
||||
}
|
||||
|
||||
/* Clip tile end coordinates */
|
||||
tileBlit.src_area.x2 = totalWidth + blit->src_area.x1 - tileX * LV_GPU_NXP_VG_LITE_BLIT_SPLIT_THR - 1;
|
||||
if(tileBlit.src_area.x2 >= LV_GPU_NXP_VG_LITE_BLIT_SPLIT_THR) {
|
||||
tileBlit.src_area.x2 = LV_GPU_NXP_VG_LITE_BLIT_SPLIT_THR - 1;
|
||||
}
|
||||
|
||||
tileBlit.dst_area.x2 = totalWidth + blit->dst_area.x1 - tileX * LV_GPU_NXP_VG_LITE_BLIT_SPLIT_THR - 1;
|
||||
if(tileBlit.dst_area.x2 >= LV_GPU_NXP_VG_LITE_BLIT_SPLIT_THR) {
|
||||
tileBlit.dst_area.x2 = LV_GPU_NXP_VG_LITE_BLIT_SPLIT_THR - 1;
|
||||
}
|
||||
|
||||
if(tileX < (totalTilesX - 1)) {
|
||||
/* And adjust end coords if shifted, but not for last tile! */
|
||||
tileBlit.src_area.x2 += shiftSrcX;
|
||||
tileBlit.dst_area.x2 += shiftDstX;
|
||||
}
|
||||
|
||||
rv = _lv_gpu_nxp_vglite_blit_single(&tileBlit);
|
||||
|
||||
#if BLIT_DBG_AREAS
|
||||
_draw_rectangle((lv_color_t *) tileBlit.dst, tileBlit.dst_width, tileBlit.dst_height, &tileBlit.dst_area, LV_COLOR_RED);
|
||||
_draw_rectangle((lv_color_t *) tileBlit.src, tileBlit.src_width, tileBlit.src_height, &tileBlit.src_area,
|
||||
LV_COLOR_GREEN);
|
||||
#endif
|
||||
|
||||
PRINT_BLT("Tile [%d, %d]: "
|
||||
"([%d,%d], [%d,%d]) -> "
|
||||
"([%d,%d], [%d,%d]) | "
|
||||
"([%dx%d] -> [%dx%d]) | "
|
||||
"A:(0x%8X -> 0x%8X) %s\n",
|
||||
tileX, tileY,
|
||||
tileBlit.src_area.x1, tileBlit.src_area.y1, tileBlit.src_area.x2, tileBlit.src_area.y2,
|
||||
tileBlit.dst_area.x1, tileBlit.dst_area.y1, tileBlit.dst_area.x2, tileBlit.dst_area.y2,
|
||||
lv_area_get_width(&tileBlit.src_area), lv_area_get_height(&tileBlit.src_area),
|
||||
lv_area_get_width(&tileBlit.dst_area), lv_area_get_height(&tileBlit.dst_area),
|
||||
(uintptr_t) tileBlit.src, (uintptr_t) tileBlit.dst,
|
||||
rv == LV_RES_OK ? "OK!" : "!!! FAILED !!!");
|
||||
|
||||
if(rv != LV_RES_OK) { /* if anything goes wrong... */
|
||||
#if LV_GPU_NXP_VG_LITE_LOG_ERRORS
|
||||
LV_LOG_ERROR("Split BLIT failed. Trying SW BLIT instead.");
|
||||
#endif
|
||||
_sw_blit(&tileBlit);
|
||||
rv = LV_RES_OK; /* Don't report error, as SW BLIT was performed */
|
||||
}
|
||||
|
||||
}
|
||||
PRINT_BLT(" \n");
|
||||
}
|
||||
|
||||
return rv; /* should never fail */
|
||||
|
||||
#else /* non RT595 */
|
||||
/* Just pass down */
|
||||
return _lv_gpu_nxp_vglite_blit_single(blit);
|
||||
#endif
|
||||
}
|
||||
|
||||
/**********************
|
||||
* STATIC FUNCTIONS
|
||||
**********************/
|
||||
|
||||
/***
|
||||
* BLock Image Transfer - single direct BLIT.
|
||||
* @param[in] blit Description of the transfer
|
||||
* @retval LV_RES_OK Transfer complete
|
||||
* @retval LV_RES_INV Error occurred (\see LV_GPU_NXP_VG_LITE_LOG_ERRORS)
|
||||
*/
|
||||
static lv_res_t _lv_gpu_nxp_vglite_blit_single(lv_gpu_nxp_vglite_blit_info_t * blit)
|
||||
{
|
||||
vg_lite_buffer_t src_vgbuf, dst_vgbuf;
|
||||
vg_lite_error_t err = VG_LITE_SUCCESS;
|
||||
uint32_t rect[4];
|
||||
lv_disp_t * disp = _lv_refr_get_disp_refreshing();
|
||||
|
||||
if(blit == NULL) {
|
||||
/*Wrong parameter*/
|
||||
return LV_RES_INV;
|
||||
}
|
||||
|
||||
if(blit->opa < (lv_opa_t) LV_OPA_MIN) {
|
||||
return LV_RES_OK; /*Nothing to BLIT*/
|
||||
}
|
||||
|
||||
/*Wrap src/dst buffer into VG-Lite buffer*/
|
||||
if(_init_vg_buf(&src_vgbuf, (uint32_t) blit->src_width, (uint32_t) blit->src_height, (uint32_t) blit->src_stride,
|
||||
blit->src, true) != LV_RES_OK) {
|
||||
#if LV_GPU_NXP_VG_LITE_LOG_ERRORS
|
||||
LV_LOG_ERROR("init_vg_buf reported error. BLIT failed.");
|
||||
#endif
|
||||
return LV_RES_INV;
|
||||
}
|
||||
|
||||
if(_init_vg_buf(&dst_vgbuf, (uint32_t) blit->dst_width, (uint32_t) blit->dst_height, (uint32_t) blit->dst_stride,
|
||||
blit->dst, false) != LV_RES_OK) {
|
||||
#if LV_GPU_NXP_VG_LITE_LOG_ERRORS
|
||||
LV_LOG_ERROR("init_vg_buf reported error. BLIT failed.");
|
||||
#endif
|
||||
return LV_RES_INV;
|
||||
}
|
||||
|
||||
rect[0] = (uint32_t) blit->src_area.x1; /* start x */
|
||||
rect[1] = (uint32_t) blit->src_area.y1; /* start y */
|
||||
rect[2] = (uint32_t) blit->src_area.x2 - (uint32_t) blit->src_area.x1 + 1U; /* width */
|
||||
rect[3] = (uint32_t) blit->src_area.y2 - (uint32_t) blit->src_area.y1 + 1U; /* height */
|
||||
|
||||
vg_lite_matrix_t matrix;
|
||||
vg_lite_identity(&matrix);
|
||||
vg_lite_translate((vg_lite_float_t)blit->dst_area.x1, (vg_lite_float_t)blit->dst_area.y1, &matrix);
|
||||
|
||||
if((disp != NULL) && (disp->driver->clean_dcache_cb != NULL)) { /*Clean & invalidate cache*/
|
||||
disp->driver->clean_dcache_cb(disp->driver);
|
||||
}
|
||||
|
||||
uint32_t color;
|
||||
vg_lite_blend_t blend;
|
||||
if(blit->opa >= (uint8_t) LV_OPA_MAX) {
|
||||
color = 0x0;
|
||||
blend = VG_LITE_BLEND_NONE;
|
||||
}
|
||||
else {
|
||||
uint32_t opa = (uint32_t) blit->opa;
|
||||
color = (opa << 24) | (opa << 16) | (opa << 8) | opa;
|
||||
blend = VG_LITE_BLEND_SRC_OVER;
|
||||
src_vgbuf.image_mode = VG_LITE_MULTIPLY_IMAGE_MODE;
|
||||
}
|
||||
|
||||
err = vg_lite_blit_rect(&dst_vgbuf, &src_vgbuf, rect, &matrix, blend, color, VG_LITE_FILTER_POINT);
|
||||
if(err != VG_LITE_SUCCESS) {
|
||||
#if LV_GPU_NXP_VG_LITE_LOG_ERRORS
|
||||
LV_LOG_ERROR("vg_lite_blit_rect() failed.");
|
||||
#endif
|
||||
return LV_RES_INV;
|
||||
}
|
||||
|
||||
err = vg_lite_finish();
|
||||
if(err != VG_LITE_SUCCESS) {
|
||||
#if LV_GPU_NXP_VG_LITE_LOG_ERRORS
|
||||
LV_LOG_ERROR("vg_lite_finish() failed.");
|
||||
#endif
|
||||
return LV_RES_INV;
|
||||
}
|
||||
|
||||
if(err == VG_LITE_SUCCESS) {
|
||||
return LV_RES_OK;
|
||||
}
|
||||
else {
|
||||
#if LV_GPU_NXP_VG_LITE_LOG_ERRORS
|
||||
LV_LOG_ERROR("vg_lite_blit_rect or vg_lite_finish reported error. BLIT failed.");
|
||||
#endif
|
||||
return LV_RES_INV;
|
||||
}
|
||||
}
|
||||
|
||||
/***
|
||||
* Fills vg_lite_buffer_t structure according given parameters.
|
||||
* @param[out] dst Buffer structure to be filled
|
||||
* @param[in] width Width of buffer in pixels
|
||||
* @param[in] height Height of buffer in pixels
|
||||
* @param[in] stride Stride of the buffer in bytes
|
||||
* @param[in] ptr Pointer to the buffer (must be aligned according VG-Lite requirements)
|
||||
*/
|
||||
static lv_res_t _init_vg_buf(vg_lite_buffer_t * dst, uint32_t width, uint32_t height, uint32_t stride,
|
||||
const lv_color_t * ptr, bool source)
|
||||
{
|
||||
if((((uintptr_t)ptr) % (uintptr_t)LV_ATTRIBUTE_MEM_ALIGN_SIZE) != 0x0U) { /*Test for alignment*/
|
||||
#if LV_GPU_NXP_VG_LITE_LOG_ERRORS
|
||||
LV_LOG_ERROR("ptr (0x%X) not aligned to %d.", (size_t) ptr, LV_ATTRIBUTE_MEM_ALIGN_SIZE);
|
||||
#endif
|
||||
return LV_RES_INV;
|
||||
}
|
||||
|
||||
if(source &&
|
||||
(stride % (LV_GPU_NXP_VG_LITE_STRIDE_ALIGN_PX * sizeof(lv_color_t))) != 0x0U) { /*Test for stride alignment*/
|
||||
#if LV_GPU_NXP_VG_LITE_LOG_ERRORS
|
||||
LV_LOG_ERROR("Buffer stride (%d px) not aligned to %d bytes.", stride,
|
||||
LV_GPU_NXP_VG_LITE_STRIDE_ALIGN_PX * sizeof(lv_color_t));
|
||||
#endif
|
||||
return LV_RES_INV;
|
||||
}
|
||||
|
||||
dst->format = VGLITE_PX_FMT;
|
||||
dst->tiled = VG_LITE_LINEAR;
|
||||
dst->image_mode = VG_LITE_NORMAL_IMAGE_MODE;
|
||||
dst->transparency_mode = VG_LITE_IMAGE_OPAQUE;
|
||||
|
||||
dst->width = (int32_t) width;
|
||||
dst->height = (int32_t) height;
|
||||
dst->stride = (int32_t) stride;
|
||||
|
||||
void * r_ptr = memset(&dst->yuv, 0, sizeof(dst->yuv));
|
||||
if(r_ptr == NULL) {
|
||||
return LV_RES_INV;
|
||||
}
|
||||
|
||||
dst->memory = (void *)ptr;
|
||||
dst->address = (uint32_t) dst->memory;
|
||||
dst->handle = NULL;
|
||||
|
||||
return LV_RES_OK;
|
||||
}
|
||||
|
||||
#if _BLIT_SPLIT_ENABLED
|
||||
|
||||
/**
|
||||
* Software BLIT as a fall-back scenario
|
||||
* @param[in] blit BLIT configuration
|
||||
*/
|
||||
static void _sw_blit(lv_gpu_nxp_vglite_blit_info_t * blit)
|
||||
{
|
||||
int x, y;
|
||||
|
||||
lv_coord_t w = lv_area_get_width(&blit->src_area);
|
||||
lv_coord_t h = lv_area_get_height(&blit->src_area);
|
||||
|
||||
uint32_t srcStridePx = blit->src_stride / sizeof(lv_color_t);
|
||||
uint32_t dstStridePx = blit->dst_stride / sizeof(lv_color_t);
|
||||
|
||||
lv_color_t * src = (lv_color_t *)blit->src + blit->src_area.y1 * srcStridePx + blit->src_area.x1;
|
||||
lv_color_t * dst = (lv_color_t *)blit->dst + blit->dst_area.y1 * dstStridePx + blit->dst_area.x1;
|
||||
|
||||
if(blit->opa >= LV_OPA_MAX) {
|
||||
/* simple copy */
|
||||
for(y = 0; y < h; y++) {
|
||||
_lv_memcpy(dst, src, w * sizeof(lv_color_t));
|
||||
src += srcStridePx;
|
||||
dst += dstStridePx;
|
||||
}
|
||||
}
|
||||
else if(blit->opa >= LV_OPA_MIN) {
|
||||
/* alpha blending */
|
||||
for(y = 0; y < h; y++) {
|
||||
for(x = 0; x < w; x++) {
|
||||
dst[x] = lv_color_mix(src[x], dst[x], blit->opa);
|
||||
}
|
||||
src += srcStridePx;
|
||||
dst += dstStridePx;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Verify BLIT structure - widths, stride, pointer alignment
|
||||
* @param[in] blit
|
||||
* @return
|
||||
*/
|
||||
static lv_res_t _lv_gpu_nxp_vglite_check_blit(lv_gpu_nxp_vglite_blit_info_t * blit)
|
||||
{
|
||||
|
||||
if(lv_area_get_width(&blit->src_area) < LV_GPU_NXP_VG_LITE_STRIDE_ALIGN_PX) { /* Test for minimal width */
|
||||
#if LV_GPU_NXP_VG_LITE_LOG_ERRORS
|
||||
LV_LOG_ERROR("source area width (%d) is smaller than required (%d).", lv_area_get_width(&blit->src_area),
|
||||
LV_GPU_NXP_VG_LITE_STRIDE_ALIGN_PX);
|
||||
#endif
|
||||
return LV_RES_INV;
|
||||
}
|
||||
|
||||
if(lv_area_get_width(&blit->dst_area) < LV_GPU_NXP_VG_LITE_STRIDE_ALIGN_PX) { /* Test for minimal width */
|
||||
#if LV_GPU_NXP_VG_LITE_LOG_ERRORS
|
||||
LV_LOG_ERROR("destination area width (%d) is smaller than required (%d).", lv_area_get_width(&blit->dst_area),
|
||||
LV_GPU_NXP_VG_LITE_STRIDE_ALIGN_PX);
|
||||
#endif
|
||||
return LV_RES_INV;
|
||||
}
|
||||
|
||||
if((((uintptr_t) blit->src) % LV_ATTRIBUTE_MEM_ALIGN_SIZE) != 0x0) { /* Test for pointer alignment */
|
||||
#if LV_GPU_NXP_VG_LITE_LOG_ERRORS
|
||||
LV_LOG_ERROR("source buffer ptr (0x%X) not aligned to %d.", (size_t) blit->src, LV_ATTRIBUTE_MEM_ALIGN_SIZE);
|
||||
#endif
|
||||
return LV_RES_INV;
|
||||
}
|
||||
/* No alignment requirement for destination pixel buffer when using mode VG_LITE_LINEAR */
|
||||
|
||||
if((blit->src_stride % (LV_GPU_NXP_VG_LITE_STRIDE_ALIGN_PX * LV_COLOR_DEPTH / 8)) !=
|
||||
0x0) { /* Test for stride alignment */
|
||||
#if LV_GPU_NXP_VG_LITE_LOG_ERRORS
|
||||
LV_LOG_ERROR("source buffer stride (%d px) not aligned to %d px.", blit->src_stride,
|
||||
LV_GPU_NXP_VG_LITE_STRIDE_ALIGN_PX);
|
||||
#endif
|
||||
return LV_RES_INV;
|
||||
}
|
||||
|
||||
if((blit->dst_stride % (LV_GPU_NXP_VG_LITE_STRIDE_ALIGN_PX * LV_COLOR_DEPTH / 8)) !=
|
||||
0x0) { /* Test for stride alignment */
|
||||
#if LV_GPU_NXP_VG_LITE_LOG_ERRORS
|
||||
LV_LOG_ERROR("destination buffer stride (%d px) not aligned to %d px.", blit->dst_stride,
|
||||
LV_GPU_NXP_VG_LITE_STRIDE_ALIGN_PX);
|
||||
#endif
|
||||
return LV_RES_INV;
|
||||
}
|
||||
|
||||
if((lv_area_get_width(&blit->src_area) != lv_area_get_width(&blit->dst_area)) ||
|
||||
(lv_area_get_height(&blit->src_area) != lv_area_get_height(&blit->dst_area))) {
|
||||
#if LV_GPU_NXP_VG_LITE_LOG_ERRORS
|
||||
LV_LOG_ERROR("source and destination buffer areas are not equal.");
|
||||
#endif
|
||||
return LV_RES_INV;
|
||||
}
|
||||
|
||||
return LV_RES_OK;
|
||||
}
|
||||
|
||||
/***
|
||||
* Move buffer pointer as close as possible to area, but with respect to alignment requirements. X-axis only.
|
||||
* @param[in,out] area Area to be updated
|
||||
* @param[in,out] buf Pointer to be updated
|
||||
*/
|
||||
static void _align_x(lv_area_t * area, lv_color_t ** buf)
|
||||
{
|
||||
|
||||
int alignedAreaStartPx = area->x1 - (area->x1 % (LV_ATTRIBUTE_MEM_ALIGN_SIZE * 8 / LV_COLOR_DEPTH));
|
||||
CHECK(alignedAreaStartPx < 0, "Should never happen.");
|
||||
|
||||
area->x1 -= alignedAreaStartPx;
|
||||
area->x2 -= alignedAreaStartPx;
|
||||
*buf += alignedAreaStartPx;
|
||||
}
|
||||
|
||||
/***
|
||||
* Move buffer pointer to the area start and update variables, Y-axis only.
|
||||
* @param[in,out] area Area to be updated
|
||||
* @param[in,out] buf Pointer to be updated
|
||||
* @param[in] stridePx Buffer stride in pixels
|
||||
*/
|
||||
static void _align_y(lv_area_t * area, lv_color_t ** buf, uint32_t stridePx)
|
||||
{
|
||||
int LineToAlignMem;
|
||||
int alignedAreaStartPy;
|
||||
/* find how many lines of pixels will respect memory alignment requirement */
|
||||
if(stridePx % LV_ATTRIBUTE_MEM_ALIGN_SIZE == 0) {
|
||||
alignedAreaStartPy = area->y1;
|
||||
}
|
||||
else {
|
||||
LineToAlignMem = LV_ATTRIBUTE_MEM_ALIGN_SIZE / (sizeof(lv_color_t) * LV_GPU_NXP_VG_LITE_STRIDE_ALIGN_PX);
|
||||
CHECK(LV_ATTRIBUTE_MEM_ALIGN_SIZE % (sizeof(lv_color_t) * LV_GPU_NXP_VG_LITE_STRIDE_ALIGN_PX) != 0,
|
||||
"Complex case: need gcd function.");
|
||||
alignedAreaStartPy = area->y1 - (area->y1 % LineToAlignMem);
|
||||
CHECK(alignedAreaStartPy < 0, "Should never happen.");
|
||||
}
|
||||
|
||||
area->y1 -= alignedAreaStartPy;
|
||||
area->y2 -= alignedAreaStartPy;
|
||||
*buf += alignedAreaStartPy * stridePx;
|
||||
}
|
||||
|
||||
#if BLIT_DBG_AREAS
|
||||
/***
|
||||
* Draws a simple rectangle, 1 px line width.
|
||||
* @param dest_buf Destination buffer
|
||||
* @param dest_width Destination buffer width (must be aligned on 16px)
|
||||
* @param dest_height Destination buffer height
|
||||
* @param fill_area Rectangle coordinates
|
||||
* @param color Rectangle color
|
||||
*/
|
||||
static void _draw_rectangle(lv_color_t * dest_buf, lv_coord_t dest_width, lv_coord_t dest_height,
|
||||
lv_area_t * fill_area, lv_color_t color)
|
||||
{
|
||||
|
||||
lv_area_t a;
|
||||
|
||||
/* top line */
|
||||
a.x1 = fill_area->x1;
|
||||
a.x2 = fill_area->x2;
|
||||
a.y1 = fill_area->y1;
|
||||
a.y2 = fill_area->y1;
|
||||
lv_gpu_nxp_vglite_fill(dest_buf, dest_width, dest_height, &a, color, LV_OPA_COVER);
|
||||
|
||||
|
||||
/* bottom line */
|
||||
a.x1 = fill_area->x1;
|
||||
a.x2 = fill_area->x2;
|
||||
a.y1 = fill_area->y2;
|
||||
a.y2 = fill_area->y2;
|
||||
lv_gpu_nxp_vglite_fill(dest_buf, dest_width, dest_height, &a, color, LV_OPA_COVER);
|
||||
|
||||
/* left line */
|
||||
a.x1 = fill_area->x1;
|
||||
a.x2 = fill_area->x1;
|
||||
a.y1 = fill_area->y1;
|
||||
a.y2 = fill_area->y2;
|
||||
lv_gpu_nxp_vglite_fill(dest_buf, dest_width, dest_height, &a, color, LV_OPA_COVER);
|
||||
|
||||
/* right line */
|
||||
a.x1 = fill_area->x2;
|
||||
a.x2 = fill_area->x2;
|
||||
a.y1 = fill_area->y1;
|
||||
a.y2 = fill_area->y2;
|
||||
lv_gpu_nxp_vglite_fill(dest_buf, dest_width, dest_height, &a, color, LV_OPA_COVER);
|
||||
}
|
||||
#endif /* BLIT_DBG_AREAS */
|
||||
|
||||
#endif /* _BLIT_SPLIT_ENABLED */
|
||||
|
||||
#endif /*LV_USE_GPU_NXP_VG_LITE*/
|
@ -15,6 +15,7 @@
|
||||
#include "lv_draw_sdl.h"
|
||||
#include "lv_draw_sdl_utils.h"
|
||||
#include "lv_draw_sdl_texture_cache.h"
|
||||
#include "lv_draw_sdl_layer.h"
|
||||
|
||||
/*********************
|
||||
* DEFINES
|
||||
@ -69,6 +70,10 @@ void lv_draw_sdl_init_ctx(lv_disp_drv_t * disp_drv, lv_draw_ctx_t * draw_ctx)
|
||||
draw_ctx->draw_arc = lv_draw_sdl_draw_arc;
|
||||
draw_ctx->draw_polygon = lv_draw_sdl_polygon;
|
||||
draw_ctx->draw_bg = lv_draw_sdl_draw_bg;
|
||||
draw_ctx->layer_init = lv_draw_sdl_layer_init;
|
||||
draw_ctx->layer_blend = lv_draw_sdl_layer_blend;
|
||||
draw_ctx->layer_destroy = lv_draw_sdl_layer_destroy;
|
||||
draw_ctx->layer_instance_size = sizeof(lv_draw_sdl_layer_ctx_t);
|
||||
lv_draw_sdl_ctx_t * draw_ctx_sdl = (lv_draw_sdl_ctx_t *) draw_ctx;
|
||||
draw_ctx_sdl->renderer = ((lv_draw_sdl_drv_param_t *) disp_drv->user_data)->renderer;
|
||||
draw_ctx_sdl->internals = lv_mem_alloc(sizeof(lv_draw_sdl_context_internals_t));
|
||||
|
@ -11,6 +11,7 @@ CSRCS += lv_draw_sdl_rect.c
|
||||
CSRCS += lv_draw_sdl_stack_blur.c
|
||||
CSRCS += lv_draw_sdl_texture_cache.c
|
||||
CSRCS += lv_draw_sdl_utils.c
|
||||
CSRCS += lv_draw_sdl_layer.c
|
||||
|
||||
DEPPATH += --dep-path $(LVGL_DIR)/$(LVGL_DIR_NAME)/src/draw/sdl
|
||||
VPATH += :$(LVGL_DIR)/$(LVGL_DIR_NAME)/src/draw/sdl
|
||||
|
@ -13,7 +13,6 @@
|
||||
#include "../../misc/lv_gc.h"
|
||||
#include "../../core/lv_refr.h"
|
||||
#include "lv_draw_sdl_composite.h"
|
||||
#include "lv_draw_sdl_mask.h"
|
||||
#include "lv_draw_sdl_utils.h"
|
||||
#include "lv_draw_sdl_priv.h"
|
||||
#include "lv_draw_sdl_texture_cache.h"
|
||||
@ -84,15 +83,16 @@ bool lv_draw_sdl_composite_begin(lv_draw_sdl_ctx_t * ctx, const lv_area_t * coor
|
||||
const bool draw_blend = blend_mode != LV_BLEND_MODE_NORMAL;
|
||||
if(draw_mask || draw_blend) {
|
||||
lv_draw_sdl_context_internals_t * internals = ctx->internals;
|
||||
LV_ASSERT(internals->mask == NULL && internals->composition == NULL);
|
||||
LV_ASSERT(internals->mask == NULL && internals->composition == NULL && internals->target_backup == NULL);
|
||||
|
||||
lv_coord_t w = lv_area_get_width(apply_area), h = lv_area_get_height(apply_area);
|
||||
internals->composition = lv_draw_sdl_composite_texture_obtain(ctx, LV_DRAW_SDL_COMPOSITE_TEXTURE_ID_TARGET0, w, h);
|
||||
/* Don't need to worry about overflow */
|
||||
/* Don't need to worry about integral overflow */
|
||||
lv_coord_t ofs_x = (lv_coord_t) - apply_area->x1, ofs_y = (lv_coord_t) - apply_area->y1;
|
||||
/* Offset draw area to start with (0,0) of coords */
|
||||
lv_area_move(coords_out, ofs_x, ofs_y);
|
||||
lv_area_move(clip_out, ofs_x, ofs_y);
|
||||
internals->target_backup = SDL_GetRenderTarget(ctx->renderer);
|
||||
SDL_SetRenderTarget(ctx->renderer, internals->composition);
|
||||
SDL_SetRenderDrawColor(ctx->renderer, 255, 255, 255, 0);
|
||||
SDL_RenderClear(ctx->renderer);
|
||||
@ -140,7 +140,7 @@ void lv_draw_sdl_composite_end(lv_draw_sdl_ctx_t * ctx, const lv_area_t * apply_
|
||||
SDL_Rect dst_rect;
|
||||
lv_area_to_sdl_rect(apply_area, &dst_rect);
|
||||
|
||||
SDL_SetRenderTarget(ctx->renderer, ctx->base_draw.buf);
|
||||
SDL_SetRenderTarget(ctx->renderer, internals->target_backup);
|
||||
switch(blend_mode) {
|
||||
case LV_BLEND_MODE_NORMAL:
|
||||
SDL_SetTextureBlendMode(internals->composition, SDL_BLENDMODE_BLEND);
|
||||
@ -173,7 +173,7 @@ void lv_draw_sdl_composite_end(lv_draw_sdl_ctx_t * ctx, const lv_area_t * apply_
|
||||
SDL_RenderCopy(ctx->renderer, internals->composition, &src_rect, &dst_rect);
|
||||
}
|
||||
|
||||
internals->mask = internals->composition = NULL;
|
||||
internals->mask = internals->composition = internals->target_backup = NULL;
|
||||
}
|
||||
|
||||
SDL_Texture * lv_draw_sdl_composite_texture_obtain(lv_draw_sdl_ctx_t * ctx, lv_draw_sdl_composite_texture_id_t id,
|
||||
@ -186,7 +186,10 @@ SDL_Texture * lv_draw_sdl_composite_texture_obtain(lv_draw_sdl_ctx_t * ctx, lv_d
|
||||
if(!result || tex_size->x < w || tex_size->y < h) {
|
||||
lv_coord_t size = next_pow_of_2(LV_MAX(w, h));
|
||||
int access = SDL_TEXTUREACCESS_STREAMING;
|
||||
if(id >= LV_DRAW_SDL_COMPOSITE_TEXTURE_ID_TARGET0) {
|
||||
if(id >= LV_DRAW_SDL_COMPOSITE_TEXTURE_ID_TRANSFORM0) {
|
||||
access = SDL_TEXTUREACCESS_TARGET;
|
||||
}
|
||||
else if(id >= LV_DRAW_SDL_COMPOSITE_TEXTURE_ID_TARGET0) {
|
||||
access = SDL_TEXTUREACCESS_TARGET;
|
||||
}
|
||||
result = SDL_CreateTexture(ctx->renderer, LV_DRAW_SDL_TEXTURE_FORMAT, access, size, size);
|
||||
|
@ -35,6 +35,7 @@ typedef enum lv_draw_sdl_composite_texture_id_t {
|
||||
LV_DRAW_SDL_COMPOSITE_TEXTURE_ID_STREAM1,
|
||||
LV_DRAW_SDL_COMPOSITE_TEXTURE_ID_TARGET0,
|
||||
LV_DRAW_SDL_COMPOSITE_TEXTURE_ID_TARGET1,
|
||||
LV_DRAW_SDL_COMPOSITE_TEXTURE_ID_TRANSFORM0,
|
||||
} lv_draw_sdl_composite_texture_id_t;
|
||||
|
||||
/**********************
|
||||
|
@ -22,6 +22,7 @@
|
||||
#include "lv_draw_sdl_texture_cache.h"
|
||||
#include "lv_draw_sdl_composite.h"
|
||||
#include "lv_draw_sdl_rect.h"
|
||||
#include "lv_draw_sdl_layer.h"
|
||||
|
||||
/*********************
|
||||
* DEFINES
|
||||
@ -123,11 +124,15 @@ lv_res_t lv_draw_sdl_img_core(lv_draw_ctx_t * draw_ctx, const lv_draw_img_dsc_t
|
||||
/* Coords will be translated so coords will start at (0,0) */
|
||||
lv_area_t t_coords = zoomed_cords, t_clip = *clip, apply_area;
|
||||
|
||||
bool has_composite = false;
|
||||
|
||||
if(!check_mask_simple_radius(&t_coords, &radius)) {
|
||||
lv_draw_sdl_composite_begin(ctx, &zoomed_cords, clip, NULL, draw_dsc->blend_mode,
|
||||
&t_coords, &t_clip, &apply_area);
|
||||
has_composite = lv_draw_sdl_composite_begin(ctx, &zoomed_cords, clip, NULL, draw_dsc->blend_mode,
|
||||
&t_coords, &t_clip, &apply_area);
|
||||
}
|
||||
|
||||
lv_draw_sdl_transform_areas_offset(ctx, has_composite, &apply_area, &t_coords, &t_clip);
|
||||
|
||||
SDL_Rect clip_rect, coords_rect;
|
||||
lv_area_to_sdl_rect(&t_clip, &clip_rect);
|
||||
lv_area_to_sdl_rect(&t_coords, &coords_rect);
|
||||
|
@ -19,6 +19,7 @@
|
||||
#include "lv_draw_sdl_utils.h"
|
||||
#include "lv_draw_sdl_texture_cache.h"
|
||||
#include "lv_draw_sdl_composite.h"
|
||||
#include "lv_draw_sdl_layer.h"
|
||||
|
||||
/*********************
|
||||
* DEFINES
|
||||
@ -77,6 +78,21 @@ void lv_draw_sdl_draw_letter(lv_draw_ctx_t * draw_ctx, const lv_draw_label_dsc_t
|
||||
letter != 0xf8ff && /*LV_SYMBOL_DUMMY*/
|
||||
letter != 0x200c) { /*ZERO WIDTH NON-JOINER*/
|
||||
LV_LOG_WARN("lv_draw_letter: glyph dsc. not found for U+%X", letter);
|
||||
|
||||
/* draw placeholder */
|
||||
lv_area_t glyph_coords;
|
||||
lv_draw_rect_dsc_t glyph_dsc;
|
||||
lv_coord_t begin_x = pos_p->x + g.ofs_x;
|
||||
lv_coord_t begin_y = pos_p->y + g.ofs_y;
|
||||
lv_area_set(&glyph_coords, begin_x, begin_y, begin_x + g.box_w, begin_y + g.box_h);
|
||||
lv_draw_rect_dsc_init(&glyph_dsc);
|
||||
glyph_dsc.bg_opa = LV_OPA_MIN;
|
||||
glyph_dsc.outline_opa = LV_OPA_MIN;
|
||||
glyph_dsc.shadow_opa = LV_OPA_MIN;
|
||||
glyph_dsc.bg_img_opa = LV_OPA_MIN;
|
||||
glyph_dsc.border_color = dsc->color;
|
||||
glyph_dsc.border_width = 1;
|
||||
draw_ctx->draw_rect(draw_ctx, &glyph_dsc, &glyph_coords);
|
||||
}
|
||||
return;
|
||||
}
|
||||
@ -119,8 +135,10 @@ void lv_draw_sdl_draw_letter(lv_draw_ctx_t * draw_ctx, const lv_draw_label_dsc_t
|
||||
}
|
||||
|
||||
lv_area_t t_letter = letter_area, t_clip = *clip_area, apply_area;
|
||||
bool has_mask = lv_draw_sdl_composite_begin(ctx, &letter_area, clip_area, NULL, dsc->blend_mode, &t_letter, &t_clip,
|
||||
&apply_area);
|
||||
bool has_composite = lv_draw_sdl_composite_begin(ctx, &letter_area, clip_area, NULL, dsc->blend_mode, &t_letter,
|
||||
&t_clip, &apply_area);
|
||||
|
||||
lv_draw_sdl_transform_areas_offset(ctx, has_composite, &apply_area, &t_letter, &t_clip);
|
||||
|
||||
/*If the letter is completely out of mask don't draw it*/
|
||||
if(!_lv_area_intersect(&draw_area, &t_letter, &t_clip)) {
|
||||
|
132
lib/libesp32_lvgl/lvgl/src/draw/sdl/lv_draw_sdl_layer.c
Normal file
132
lib/libesp32_lvgl/lvgl/src/draw/sdl/lv_draw_sdl_layer.c
Normal file
@ -0,0 +1,132 @@
|
||||
/**
|
||||
* @file lv_draw_sdl_refr.c
|
||||
*
|
||||
*/
|
||||
|
||||
/*********************
|
||||
* INCLUDES
|
||||
*********************/
|
||||
#include "../../lv_conf_internal.h"
|
||||
|
||||
#if LV_USE_GPU_SDL
|
||||
|
||||
#include "../../core/lv_refr.h"
|
||||
|
||||
#include "lv_draw_sdl.h"
|
||||
#include "lv_draw_sdl_priv.h"
|
||||
#include "lv_draw_sdl_composite.h"
|
||||
#include "lv_draw_sdl_utils.h"
|
||||
#include "lv_draw_sdl_layer.h"
|
||||
|
||||
/*********************
|
||||
* DEFINES
|
||||
*********************/
|
||||
|
||||
/**********************
|
||||
* TYPEDEFS
|
||||
**********************/
|
||||
|
||||
/**********************
|
||||
* STATIC PROTOTYPES
|
||||
**********************/
|
||||
|
||||
/**********************
|
||||
* STATIC VARIABLES
|
||||
**********************/
|
||||
|
||||
/**********************
|
||||
* MACROS
|
||||
**********************/
|
||||
|
||||
/**********************
|
||||
* GLOBAL FUNCTIONS
|
||||
**********************/
|
||||
|
||||
lv_draw_layer_ctx_t * lv_draw_sdl_layer_init(lv_draw_ctx_t * draw_ctx, lv_draw_layer_ctx_t * layer_ctx,
|
||||
lv_draw_layer_flags_t flags)
|
||||
{
|
||||
lv_draw_sdl_ctx_t * ctx = (lv_draw_sdl_ctx_t *) draw_ctx;
|
||||
SDL_Renderer * renderer = ctx->renderer;
|
||||
|
||||
lv_draw_sdl_layer_ctx_t * transform_ctx = (lv_draw_sdl_layer_ctx_t *) layer_ctx;
|
||||
|
||||
transform_ctx->flags = flags;
|
||||
transform_ctx->orig_target = SDL_GetRenderTarget(renderer);
|
||||
|
||||
lv_coord_t target_w = lv_area_get_width(&layer_ctx->area_full);
|
||||
lv_coord_t target_h = lv_area_get_height(&layer_ctx->area_full);
|
||||
|
||||
enum lv_draw_sdl_composite_texture_id_t texture_id = LV_DRAW_SDL_COMPOSITE_TEXTURE_ID_TRANSFORM0 +
|
||||
ctx->internals->transform_count;
|
||||
transform_ctx->target = lv_draw_sdl_composite_texture_obtain(ctx, texture_id, target_w, target_h);
|
||||
transform_ctx->target_rect.x = 0;
|
||||
transform_ctx->target_rect.y = 0;
|
||||
transform_ctx->target_rect.w = target_w;
|
||||
transform_ctx->target_rect.h = target_h;
|
||||
|
||||
SDL_SetTextureBlendMode(transform_ctx->target, SDL_BLENDMODE_BLEND);
|
||||
SDL_SetRenderTarget(renderer, transform_ctx->target);
|
||||
SDL_RenderClear(renderer);
|
||||
|
||||
/* Set proper drawing context for transform layer */
|
||||
ctx->internals->transform_count += 1;
|
||||
draw_ctx->buf_area = &layer_ctx->area_full;
|
||||
draw_ctx->clip_area = &layer_ctx->area_full;
|
||||
|
||||
return layer_ctx;
|
||||
}
|
||||
|
||||
void lv_draw_sdl_layer_blend(lv_draw_ctx_t * draw_ctx, lv_draw_layer_ctx_t * layer_ctx,
|
||||
const lv_draw_img_dsc_t * draw_dsc)
|
||||
{
|
||||
lv_draw_sdl_ctx_t * ctx = (lv_draw_sdl_ctx_t *) draw_ctx;
|
||||
lv_draw_sdl_layer_ctx_t * transform_ctx = (lv_draw_sdl_layer_ctx_t *) layer_ctx;
|
||||
|
||||
SDL_Renderer * renderer = ctx->renderer;
|
||||
|
||||
SDL_Rect trans_rect;
|
||||
|
||||
if(transform_ctx->flags & LV_DRAW_LAYER_FLAG_CAN_SUBDIVIDE) {
|
||||
lv_area_zoom_to_sdl_rect(&layer_ctx->area_act, &trans_rect, draw_dsc->zoom, &draw_dsc->pivot);
|
||||
}
|
||||
else {
|
||||
lv_area_zoom_to_sdl_rect(&layer_ctx->area_full, &trans_rect, draw_dsc->zoom, &draw_dsc->pivot);
|
||||
}
|
||||
|
||||
SDL_SetRenderTarget(renderer, transform_ctx->orig_target);
|
||||
|
||||
/*Render off-screen texture, transformed*/
|
||||
SDL_Rect clip_rect;
|
||||
lv_area_to_sdl_rect(layer_ctx->original.clip_area, &clip_rect);
|
||||
SDL_Point center = {.x = draw_dsc->pivot.x, .y = draw_dsc->pivot.y};
|
||||
SDL_RenderSetClipRect(renderer, &clip_rect);
|
||||
SDL_RenderCopyEx(renderer, transform_ctx->target, &transform_ctx->target_rect, &trans_rect,
|
||||
draw_dsc->angle, ¢er, SDL_FLIP_NONE);
|
||||
SDL_RenderSetClipRect(renderer, NULL);
|
||||
}
|
||||
|
||||
void lv_draw_sdl_layer_destroy(lv_draw_ctx_t * draw_ctx, lv_draw_layer_ctx_t * layer_ctx)
|
||||
{
|
||||
lv_draw_sdl_ctx_t * ctx = (lv_draw_sdl_ctx_t *) draw_ctx;
|
||||
ctx->internals->transform_count -= 1;
|
||||
}
|
||||
|
||||
void lv_draw_sdl_transform_areas_offset(lv_draw_sdl_ctx_t * ctx, bool has_composite, lv_area_t * apply_area,
|
||||
lv_area_t * coords, lv_area_t * clip)
|
||||
{
|
||||
if(ctx->internals->transform_count == 0) {
|
||||
return;
|
||||
}
|
||||
lv_area_t * area = ctx->base_draw.buf_area;
|
||||
lv_area_move(coords, -area->x1, -area->y1);
|
||||
lv_area_move(clip, -area->x1, -area->y1);
|
||||
if(has_composite) {
|
||||
lv_area_move(apply_area, -area->x1, -area->y1);
|
||||
}
|
||||
}
|
||||
|
||||
/**********************
|
||||
* STATIC FUNCTIONS
|
||||
**********************/
|
||||
|
||||
#endif /*LV_USE_GPU_SDL*/
|
55
lib/libesp32_lvgl/lvgl/src/draw/sdl/lv_draw_sdl_layer.h
Normal file
55
lib/libesp32_lvgl/lvgl/src/draw/sdl/lv_draw_sdl_layer.h
Normal file
@ -0,0 +1,55 @@
|
||||
/**
|
||||
* @file lv_draw_sdl_refr.h
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef LV_TEMPL_H
|
||||
#define LV_TEMPL_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*********************
|
||||
* INCLUDES
|
||||
*********************/
|
||||
#include "lv_draw_sdl.h"
|
||||
|
||||
/*********************
|
||||
* DEFINES
|
||||
*********************/
|
||||
|
||||
/**********************
|
||||
* TYPEDEFS
|
||||
**********************/
|
||||
typedef struct _lv_draw_sdl_layer_ctx_t {
|
||||
lv_draw_layer_ctx_t base;
|
||||
|
||||
SDL_Texture * orig_target;
|
||||
SDL_Texture * target;
|
||||
SDL_Rect target_rect;
|
||||
lv_draw_layer_flags_t flags;
|
||||
} lv_draw_sdl_layer_ctx_t;
|
||||
/**********************
|
||||
* GLOBAL PROTOTYPES
|
||||
**********************/
|
||||
|
||||
lv_draw_layer_ctx_t * lv_draw_sdl_layer_init(lv_draw_ctx_t * draw_ctx, lv_draw_layer_ctx_t * layer_ctx,
|
||||
lv_draw_layer_flags_t flags);
|
||||
|
||||
void lv_draw_sdl_layer_blend(lv_draw_ctx_t * draw_ctx, lv_draw_layer_ctx_t * transform_ctx,
|
||||
const lv_draw_img_dsc_t * draw_dsc);
|
||||
|
||||
void lv_draw_sdl_layer_destroy(lv_draw_ctx_t * draw_ctx, lv_draw_layer_ctx_t * layer_ctx);
|
||||
|
||||
void lv_draw_sdl_transform_areas_offset(lv_draw_sdl_ctx_t * ctx, bool has_composite, lv_area_t * apply_area,
|
||||
lv_area_t * coords, lv_area_t * clip);
|
||||
/**********************
|
||||
* MACROS
|
||||
**********************/
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /*extern "C"*/
|
||||
#endif
|
||||
|
||||
#endif /*LV_TEMPL_H*/
|
@ -35,6 +35,8 @@ typedef struct lv_draw_sdl_context_internals_t {
|
||||
lv_lru_t * texture_cache;
|
||||
SDL_Texture * mask;
|
||||
SDL_Texture * composition;
|
||||
SDL_Texture * target_backup;
|
||||
uint8_t transform_count;
|
||||
} lv_draw_sdl_context_internals_t;
|
||||
|
||||
/**********************
|
||||
|
@ -21,7 +21,7 @@
|
||||
#include "lv_draw_sdl_composite.h"
|
||||
#include "lv_draw_sdl_mask.h"
|
||||
#include "lv_draw_sdl_stack_blur.h"
|
||||
#include "lv_draw_sdl_img.h"
|
||||
#include "lv_draw_sdl_layer.h"
|
||||
|
||||
/*********************
|
||||
* DEFINES
|
||||
@ -124,7 +124,11 @@ void lv_draw_sdl_draw_rect(lv_draw_ctx_t * draw_ctx, const lv_draw_rect_dsc_t *
|
||||
}
|
||||
/* Coords will be translated so coords will start at (0,0) */
|
||||
lv_area_t t_coords = *coords, t_clip = *clip, apply_area, t_area;
|
||||
lv_draw_sdl_composite_begin(ctx, coords, clip, &extension, dsc->blend_mode, &t_coords, &t_clip, &apply_area);
|
||||
bool has_composite = lv_draw_sdl_composite_begin(ctx, coords, clip, &extension, dsc->blend_mode, &t_coords, &t_clip,
|
||||
&apply_area);
|
||||
|
||||
lv_draw_sdl_transform_areas_offset(ctx, has_composite, &apply_area, &t_coords, &t_clip);
|
||||
|
||||
bool has_content = _lv_area_intersect(&t_area, &t_coords, &t_clip);
|
||||
|
||||
SDL_Rect clip_rect;
|
||||
|
@ -102,7 +102,7 @@ void lv_draw_sdl_texture_cache_put_advanced(lv_draw_sdl_ctx_t * ctx, const void
|
||||
}
|
||||
if(flags & LV_DRAW_SDL_CACHE_FLAG_MANAGED) {
|
||||
/* Managed texture doesn't count into cache size */
|
||||
LV_LOG_INFO("cache texture %p, %d*%d@%dbpp", texture, width, height, SDL_BITSPERPIXEL(format));
|
||||
LV_LOG_INFO("cache texture %p", texture);
|
||||
lv_lru_set(lru, key, key_length, value, 1);
|
||||
return;
|
||||
}
|
||||
|
@ -0,0 +1,6 @@
|
||||
CSRCS += lv_gpu_stm32_dma2d.c
|
||||
|
||||
DEPPATH += --dep-path $(LVGL_DIR)/$(LVGL_DIR_NAME)/src/draw/stm32_dma2d
|
||||
VPATH += :$(LVGL_DIR)/$(LVGL_DIR_NAME)/src/draw/stm32_dma2d
|
||||
|
||||
CFLAGS += "-I$(LVGL_DIR)/$(LVGL_DIR_NAME)/src/draw/stm32_dma2d"
|
@ -103,6 +103,7 @@ void lv_draw_stm32_dma2d_ctx_init(lv_disp_drv_t * drv, lv_draw_ctx_t * draw_ctx)
|
||||
dma2d_draw_ctx->blend = lv_draw_stm32_dma2d_blend;
|
||||
// dma2d_draw_ctx->base_draw.draw_img_decoded = lv_draw_stm32_dma2d_img_decoded;
|
||||
dma2d_draw_ctx->base_draw.wait_for_finish = lv_gpu_stm32_dma2d_wait_cb;
|
||||
dma2d_draw_ctx->base_draw.buffer_copy = lv_draw_stm32_dma2d_buffer_copy;
|
||||
|
||||
}
|
||||
|
||||
@ -146,6 +147,14 @@ void lv_draw_stm32_dma2d_blend(lv_draw_ctx_t * draw_ctx, const lv_draw_sw_blend_
|
||||
if(!done) lv_draw_sw_blend_basic(draw_ctx, dsc);
|
||||
}
|
||||
|
||||
void lv_draw_stm32_dma2d_buffer_copy(lv_draw_ctx_t * draw_ctx,
|
||||
void * dest_buf, lv_coord_t dest_stride, const lv_area_t * dest_area,
|
||||
void * src_buf, lv_coord_t src_stride, const lv_area_t * src_area)
|
||||
{
|
||||
LV_UNUSED(draw_ctx);
|
||||
lv_draw_stm32_dma2d_blend_map(dest_buf, dest_area, dest_stride, src_buf, src_stride, LV_OPA_MAX);
|
||||
}
|
||||
|
||||
|
||||
static void lv_draw_stm32_dma2d_img_decoded(lv_draw_ctx_t * draw_ctx, const lv_draw_img_dsc_t * dsc,
|
||||
const lv_area_t * coords, const uint8_t * map_p, lv_img_cf_t color_format)
|
||||
@ -213,8 +222,8 @@ static void lv_draw_stm32_dma2d_blend_map(lv_color_t * dest_buf, const lv_area_t
|
||||
DMA2D->FGMAR = (uint32_t)src_buf;
|
||||
DMA2D->FGOR = src_stride - dest_w;
|
||||
|
||||
DMA2D->OMAR = (uint32_t)src_buf;
|
||||
DMA2D->OOR = src_stride - dest_w;
|
||||
DMA2D->OMAR = (uint32_t)dest_buf;
|
||||
DMA2D->OOR = dest_stride - dest_w;
|
||||
DMA2D->NLR = (dest_w << DMA2D_NLR_PL_Pos) | (dest_h << DMA2D_NLR_NL_Pos);
|
||||
|
||||
/*start transfer*/
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user