mirror of https://github.com/arendst/Tasmota.git
LVGL library from 8.1.0 to 8.2.0 (#14815)
This commit is contained in:
parent
246efd9539
commit
33a779f105
|
@ -145,6 +145,7 @@ BERRY_LOCAL const bntvmodule* const be_module_table[] = {
|
|||
|
||||
#ifdef ESP32
|
||||
extern void be_load_tasmota_ntvlib(bvm *vm);
|
||||
extern void be_load_tasmota_log_reader_class(bvm *vm);
|
||||
extern void be_load_light_state_class(bvm *vm);
|
||||
extern void be_load_wirelib(bvm *vm);
|
||||
extern void be_load_onewirelib(bvm *vm);
|
||||
|
@ -193,6 +194,7 @@ BERRY_API void be_load_custom_libs(bvm *vm)
|
|||
#endif
|
||||
be_load_Timer_class(vm);
|
||||
be_load_tasmota_ntvlib(vm);
|
||||
be_load_tasmota_log_reader_class(vm);
|
||||
be_load_Driver_class(vm);
|
||||
be_load_md5_lib(vm);
|
||||
be_load_serial_lib(vm);
|
||||
|
|
|
@ -232,6 +232,7 @@ extern const bcstring be_const_str_allocated;
|
|||
extern const bcstring be_const_str_alternate;
|
||||
extern const bcstring be_const_str_animate;
|
||||
extern const bcstring be_const_str_animators;
|
||||
extern const bcstring be_const_str_arc_dsc;
|
||||
extern const bcstring be_const_str_arch;
|
||||
extern const bcstring be_const_str_area;
|
||||
extern const bcstring be_const_str_arg;
|
||||
|
@ -350,6 +351,9 @@ extern const bcstring be_const_str_display;
|
|||
extern const bcstring be_const_str_display_X2Eini;
|
||||
extern const bcstring be_const_str_do;
|
||||
extern const bcstring be_const_str_draw_arc;
|
||||
extern const bcstring be_const_str_draw_arc_dsc;
|
||||
extern const bcstring be_const_str_draw_arc_dsc_init;
|
||||
extern const bcstring be_const_str_draw_ctx;
|
||||
extern const bcstring be_const_str_draw_line;
|
||||
extern const bcstring be_const_str_draw_line_dsc;
|
||||
extern const bcstring be_const_str_draw_line_dsc_init;
|
||||
|
@ -393,6 +397,7 @@ extern const bcstring be_const_str_find_op;
|
|||
extern const bcstring be_const_str_finish;
|
||||
extern const bcstring be_const_str_floor;
|
||||
extern const bcstring be_const_str_flush;
|
||||
extern const bcstring be_const_str_font_embedded;
|
||||
extern const bcstring be_const_str_font_montserrat;
|
||||
extern const bcstring be_const_str_font_seg7;
|
||||
extern const bcstring be_const_str_for;
|
||||
|
@ -424,6 +429,7 @@ extern const bcstring be_const_str_get_free_heap;
|
|||
extern const bcstring be_const_str_get_height;
|
||||
extern const bcstring be_const_str_get_input_power_status;
|
||||
extern const bcstring be_const_str_get_light;
|
||||
extern const bcstring be_const_str_get_log;
|
||||
extern const bcstring be_const_str_get_object_from_ptr;
|
||||
extern const bcstring be_const_str_get_option;
|
||||
extern const bcstring be_const_str_get_percentage;
|
||||
|
@ -462,6 +468,7 @@ extern const bcstring be_const_str_imax;
|
|||
extern const bcstring be_const_str_imin;
|
||||
extern const bcstring be_const_str_import;
|
||||
extern const bcstring be_const_str_init;
|
||||
extern const bcstring be_const_str_init_draw_arc_dsc;
|
||||
extern const bcstring be_const_str_init_draw_line_dsc;
|
||||
extern const bcstring be_const_str_input;
|
||||
extern const bcstring be_const_str_ins_goto;
|
||||
|
@ -638,6 +645,7 @@ extern const bcstring be_const_str_reverse_gamma10;
|
|||
extern const bcstring be_const_str_rotate;
|
||||
extern const bcstring be_const_str_round_end;
|
||||
extern const bcstring be_const_str_round_start;
|
||||
extern const bcstring be_const_str_rounded;
|
||||
extern const bcstring be_const_str_rtc;
|
||||
extern const bcstring be_const_str_rule;
|
||||
extern const bcstring be_const_str_run;
|
||||
|
@ -734,6 +742,7 @@ extern const bcstring be_const_str_target_search;
|
|||
extern const bcstring be_const_str_tasmota;
|
||||
extern const bcstring be_const_str_tasmota_X2Eget_light_X28_X29_X20is_X20deprecated_X2C_X20use_X20light_X2Eget_X28_X29;
|
||||
extern const bcstring be_const_str_tasmota_X2Eset_light_X28_X29_X20is_X20deprecated_X2C_X20use_X20light_X2Eset_X28_X29;
|
||||
extern const bcstring be_const_str_tasmota_log_reader;
|
||||
extern const bcstring be_const_str_tcpclient;
|
||||
extern const bcstring be_const_str_tele;
|
||||
extern const bcstring be_const_str_the_X20second_X20argument_X20is_X20not_X20a_X20function;
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,19 @@
|
|||
#include "be_constobj.h"
|
||||
|
||||
static be_define_const_map_slots(be_class_tasmota_log_reader_map) {
|
||||
{ be_const_key(get_log, 1), be_const_ctype_func(tlr_get_log) },
|
||||
{ be_const_key(init, -1), be_const_ctype_func(tlr_init) },
|
||||
{ be_const_key(_p, -1), be_const_var(0) },
|
||||
};
|
||||
|
||||
static be_define_const_map(
|
||||
be_class_tasmota_log_reader_map,
|
||||
3
|
||||
);
|
||||
|
||||
BE_EXPORT_VARIABLE be_define_const_class(
|
||||
be_class_tasmota_log_reader,
|
||||
1,
|
||||
NULL,
|
||||
tasmota_log_reader
|
||||
);
|
|
@ -1,20 +1,21 @@
|
|||
#include "be_constobj.h"
|
||||
|
||||
static be_define_const_map_slots(m_liblv_tasmota_map) {
|
||||
{ be_const_key(seg7_font, -1), be_const_func(lv0_load_seg7_font) },
|
||||
{ be_const_key(font_seg7, -1), be_const_func(lv0_load_seg7_font) },
|
||||
{ be_const_key(start, -1), be_const_func(lv0_start) },
|
||||
{ be_const_key(font_montserrat, -1), be_const_func(lv0_load_montserrat_font) },
|
||||
{ be_const_key(montserrat_font, -1), be_const_func(lv0_load_montserrat_font) },
|
||||
{ be_const_key(load_freetype_font, -1), be_const_func(lv0_load_freetype_font) },
|
||||
{ be_const_key(init, 0), be_const_closure(lv_tasmota_init_closure) },
|
||||
{ be_const_key(screenshot, 1), be_const_func(lv0_screenshot) },
|
||||
{ be_const_key(register_button_encoder, -1), be_const_func(lv0_register_button_encoder) },
|
||||
{ be_const_key(screenshot, 6), be_const_func(lv0_screenshot) },
|
||||
{ be_const_key(load_freetype_font, 8), be_const_func(lv0_load_freetype_font) },
|
||||
{ be_const_key(font_embedded, -1), be_const_func(lv0_load_font_embedded) },
|
||||
{ be_const_key(montserrat_font, -1), be_const_func(lv0_load_montserrat_font) },
|
||||
{ be_const_key(init, 7), be_const_closure(lv_tasmota_init_closure) },
|
||||
{ be_const_key(start, -1), be_const_func(lv0_start) },
|
||||
{ be_const_key(font_seg7, -1), be_const_func(lv0_load_seg7_font) },
|
||||
{ be_const_key(font_montserrat, -1), be_const_func(lv0_load_montserrat_font) },
|
||||
{ be_const_key(seg7_font, -1), be_const_func(lv0_load_seg7_font) },
|
||||
};
|
||||
|
||||
static be_define_const_map(
|
||||
m_liblv_tasmota_map,
|
||||
9
|
||||
10
|
||||
);
|
||||
|
||||
static be_define_const_module(
|
||||
|
|
|
@ -142,6 +142,7 @@ int be_find_global_or_module_member(bvm *vm, const char * name) {
|
|||
* 'f' be_real (float)
|
||||
* 'b' be_bool
|
||||
* 's' be_str
|
||||
* '$' be_str but the buffer must be `free()`ed
|
||||
* '&' bytes() object, pointer to buffer returned, and size passed with an additional (size_t*) argument
|
||||
*
|
||||
* - arg_type: optionally check the types of input arguments, or throw an error
|
||||
|
@ -469,7 +470,8 @@ int be_call_c_func(bvm *vm, const void * func, const char * return_type, const c
|
|||
case 'f': be_pushreal(vm, intasreal(ret)); break;
|
||||
case 'b': be_pushbool(vm, ret); break;
|
||||
case 'c': be_pushcomptr(vm, (void*) ret); break;
|
||||
case 's': be_pushstring(vm, (const char*) ret); break;
|
||||
case 's': if (ret) {be_pushstring(vm, (const char*) ret);} else {be_pushnil(vm);} break; // push `nil` if no string
|
||||
case '$': if (ret) {be_pushstring(vm, (const char*) ret); free((void*)ret);} else {be_pushnil(vm);} break;
|
||||
case '&': be_pushbytes(vm, (void*) ret, return_len); break;
|
||||
default: be_raise(vm, "internal_error", "Unsupported return type"); break;
|
||||
}
|
||||
|
|
|
@ -12,6 +12,7 @@ extern int lv0_register_button_encoder(bvm *vm); // add buttons with encoder lo
|
|||
extern int lv0_load_montserrat_font(bvm *vm);
|
||||
extern int lv0_load_seg7_font(bvm *vm);
|
||||
extern int lv0_load_robotocondensed_latin1_font(bvm *vm);
|
||||
extern int lv0_load_font_embedded(bvm *vm);
|
||||
|
||||
extern int lv0_screenshot(bvm *vm);
|
||||
extern int lv0_load_freetype_font(bvm *vm);
|
||||
|
@ -29,34 +30,35 @@ be_local_closure(lv_tasmota_init, /* name */
|
|||
0, /* has sup protos */
|
||||
NULL, /* no sub protos */
|
||||
1, /* has constants */
|
||||
( &(const bvalue[23]) { /* constants */
|
||||
( &(const bvalue[24]) { /* constants */
|
||||
/* K0 */ be_nested_str(lv),
|
||||
/* K1 */ be_nested_str(start),
|
||||
/* K2 */ be_nested_str(font_montserrat),
|
||||
/* K3 */ be_nested_str(montserrat_font),
|
||||
/* K4 */ be_nested_str(font_seg7),
|
||||
/* K5 */ be_nested_str(seg7_font),
|
||||
/* K6 */ be_nested_str(load_freetype_font),
|
||||
/* K7 */ be_nested_str(register_button_encoder),
|
||||
/* K8 */ be_nested_str(screenshot),
|
||||
/* K9 */ be_nested_str(clock_icon),
|
||||
/* K10 */ be_nested_str(lv_clock_icon),
|
||||
/* K11 */ be_nested_str(signal_arcs),
|
||||
/* K12 */ be_nested_str(lv_signal_arcs),
|
||||
/* K13 */ be_nested_str(signal_bars),
|
||||
/* K14 */ be_nested_str(lv_signal_bars),
|
||||
/* K15 */ be_nested_str(wifi_arcs_icon),
|
||||
/* K16 */ be_nested_str(lv_wifi_arcs_icon),
|
||||
/* K17 */ be_nested_str(wifi_arcs),
|
||||
/* K18 */ be_nested_str(lv_wifi_arcs),
|
||||
/* K19 */ be_nested_str(wifi_bars_icon),
|
||||
/* K20 */ be_nested_str(lv_wifi_bars_icon),
|
||||
/* K21 */ be_nested_str(wifi_bars),
|
||||
/* K22 */ be_nested_str(lv_wifi_bars),
|
||||
/* K6 */ be_nested_str(font_embedded),
|
||||
/* K7 */ be_nested_str(load_freetype_font),
|
||||
/* K8 */ be_nested_str(register_button_encoder),
|
||||
/* K9 */ be_nested_str(screenshot),
|
||||
/* K10 */ be_nested_str(clock_icon),
|
||||
/* K11 */ be_nested_str(lv_clock_icon),
|
||||
/* K12 */ be_nested_str(signal_arcs),
|
||||
/* K13 */ be_nested_str(lv_signal_arcs),
|
||||
/* K14 */ be_nested_str(signal_bars),
|
||||
/* K15 */ be_nested_str(lv_signal_bars),
|
||||
/* K16 */ be_nested_str(wifi_arcs_icon),
|
||||
/* K17 */ be_nested_str(lv_wifi_arcs_icon),
|
||||
/* K18 */ be_nested_str(wifi_arcs),
|
||||
/* K19 */ be_nested_str(lv_wifi_arcs),
|
||||
/* K20 */ be_nested_str(wifi_bars_icon),
|
||||
/* K21 */ be_nested_str(lv_wifi_bars_icon),
|
||||
/* K22 */ be_nested_str(wifi_bars),
|
||||
/* K23 */ be_nested_str(lv_wifi_bars),
|
||||
}),
|
||||
&be_const_str_init,
|
||||
&be_const_str_solidified,
|
||||
( &(const binstruction[33]) { /* code */
|
||||
( &(const binstruction[35]) { /* code */
|
||||
0xA4060000, // 0000 IMPORT R1 K0
|
||||
0x88080101, // 0001 GETMBR R2 R0 K1
|
||||
0x90060202, // 0002 SETMBR R1 K1 R2
|
||||
|
@ -74,22 +76,24 @@ be_local_closure(lv_tasmota_init, /* name */
|
|||
0x90060E02, // 000E SETMBR R1 K7 R2
|
||||
0x88080108, // 000F GETMBR R2 R0 K8
|
||||
0x90061002, // 0010 SETMBR R1 K8 R2
|
||||
0xB80A1400, // 0011 GETNGBL R2 K10
|
||||
0x88080109, // 0011 GETMBR R2 R0 K9
|
||||
0x90061202, // 0012 SETMBR R1 K9 R2
|
||||
0xB80A1800, // 0013 GETNGBL R2 K12
|
||||
0x90061602, // 0014 SETMBR R1 K11 R2
|
||||
0xB80A1C00, // 0015 GETNGBL R2 K14
|
||||
0x90061A02, // 0016 SETMBR R1 K13 R2
|
||||
0xB80A2000, // 0017 GETNGBL R2 K16
|
||||
0x90061E02, // 0018 SETMBR R1 K15 R2
|
||||
0xB80A2400, // 0019 GETNGBL R2 K18
|
||||
0x90062202, // 001A SETMBR R1 K17 R2
|
||||
0xB80A2800, // 001B GETNGBL R2 K20
|
||||
0x90062602, // 001C SETMBR R1 K19 R2
|
||||
0xB80A2C00, // 001D GETNGBL R2 K22
|
||||
0x90062A02, // 001E SETMBR R1 K21 R2
|
||||
0x4C080000, // 001F LDNIL R2
|
||||
0x80040400, // 0020 RET 1 R2
|
||||
0xB80A1600, // 0013 GETNGBL R2 K11
|
||||
0x90061402, // 0014 SETMBR R1 K10 R2
|
||||
0xB80A1A00, // 0015 GETNGBL R2 K13
|
||||
0x90061802, // 0016 SETMBR R1 K12 R2
|
||||
0xB80A1E00, // 0017 GETNGBL R2 K15
|
||||
0x90061C02, // 0018 SETMBR R1 K14 R2
|
||||
0xB80A2200, // 0019 GETNGBL R2 K17
|
||||
0x90062002, // 001A SETMBR R1 K16 R2
|
||||
0xB80A2600, // 001B GETNGBL R2 K19
|
||||
0x90062402, // 001C SETMBR R1 K18 R2
|
||||
0xB80A2A00, // 001D GETNGBL R2 K21
|
||||
0x90062802, // 001E SETMBR R1 K20 R2
|
||||
0xB80A2E00, // 001F GETNGBL R2 K23
|
||||
0x90062C02, // 0020 SETMBR R1 K22 R2
|
||||
0x4C080000, // 0021 LDNIL R2
|
||||
0x80040400, // 0022 RET 1 R2
|
||||
})
|
||||
)
|
||||
);
|
||||
|
@ -105,6 +109,7 @@ module lv_tasmota (scope: global) {
|
|||
montserrat_font, func(lv0_load_montserrat_font)
|
||||
font_seg7, func(lv0_load_seg7_font)
|
||||
seg7_font, func(lv0_load_seg7_font)
|
||||
font_embedded, func(lv0_load_font_embedded)
|
||||
register_button_encoder, func(lv0_register_button_encoder)
|
||||
screenshot, func(lv0_screenshot)
|
||||
|
||||
|
|
|
@ -14,7 +14,7 @@ be_local_closure(lv_signal_arcs_set_percentage, /* name */
|
|||
be_nested_proto(
|
||||
5, /* nstack */
|
||||
2, /* argc */
|
||||
0, /* varg */
|
||||
2, /* varg */
|
||||
0, /* has upvals */
|
||||
NULL, /* no upvals */
|
||||
0, /* has sup protos */
|
||||
|
@ -59,7 +59,7 @@ be_local_closure(lv_signal_arcs_init, /* name */
|
|||
be_nested_proto(
|
||||
6, /* nstack */
|
||||
2, /* argc */
|
||||
0, /* varg */
|
||||
2, /* varg */
|
||||
0, /* has upvals */
|
||||
NULL, /* no upvals */
|
||||
0, /* has sup protos */
|
||||
|
@ -74,8 +74,8 @@ be_local_closure(lv_signal_arcs_init, /* name */
|
|||
/* K5 */ be_nested_str(point),
|
||||
/* K6 */ be_nested_str(p2),
|
||||
/* K7 */ be_nested_str(area),
|
||||
/* K8 */ be_nested_str(line_dsc),
|
||||
/* K9 */ be_nested_str(draw_line_dsc),
|
||||
/* K8 */ be_nested_str(arc_dsc),
|
||||
/* K9 */ be_nested_str(draw_arc_dsc),
|
||||
}),
|
||||
&be_const_str_init,
|
||||
&be_const_str_solidified,
|
||||
|
@ -115,9 +115,9 @@ be_local_closure(lv_signal_arcs_init, /* name */
|
|||
********************************************************************/
|
||||
be_local_closure(lv_signal_arcs_widget_event, /* name */
|
||||
be_nested_proto(
|
||||
28, /* nstack */
|
||||
27, /* nstack */
|
||||
3, /* argc */
|
||||
0, /* varg */
|
||||
2, /* varg */
|
||||
0, /* has upvals */
|
||||
NULL, /* no upvals */
|
||||
1, /* has sup protos */
|
||||
|
@ -158,18 +158,18 @@ be_local_closure(lv_signal_arcs_widget_event, /* name */
|
|||
/* K7 */ be_const_int(2),
|
||||
/* K8 */ be_const_int(3),
|
||||
/* K9 */ be_nested_str(EVENT_DRAW_MAIN),
|
||||
/* K10 */ be_nested_str(area),
|
||||
/* K10 */ be_nested_str(draw_ctx),
|
||||
/* K11 */ be_nested_str(param),
|
||||
/* K12 */ be_nested_str(get_coords),
|
||||
/* K13 */ be_nested_str(x1),
|
||||
/* K14 */ be_nested_str(y1),
|
||||
/* K15 */ be_nested_str(draw_line_dsc_init),
|
||||
/* K16 */ be_nested_str(line_dsc),
|
||||
/* K17 */ be_nested_str(init_draw_line_dsc),
|
||||
/* K18 */ be_nested_str(PART_MAIN),
|
||||
/* K19 */ be_nested_str(round_start),
|
||||
/* K20 */ be_const_int(1),
|
||||
/* K21 */ be_nested_str(round_end),
|
||||
/* K13 */ be_nested_str(area),
|
||||
/* K14 */ be_nested_str(x1),
|
||||
/* K15 */ be_nested_str(y1),
|
||||
/* K16 */ be_nested_str(draw_arc_dsc_init),
|
||||
/* K17 */ be_nested_str(arc_dsc),
|
||||
/* K18 */ be_nested_str(init_draw_arc_dsc),
|
||||
/* K19 */ be_nested_str(PART_MAIN),
|
||||
/* K20 */ be_nested_str(rounded),
|
||||
/* K21 */ be_const_int(1),
|
||||
/* K22 */ be_nested_str(width),
|
||||
/* K23 */ be_nested_str(get_style_line_color),
|
||||
/* K24 */ be_nested_str(STATE_DEFAULT),
|
||||
|
@ -186,7 +186,7 @@ be_local_closure(lv_signal_arcs_widget_event, /* name */
|
|||
}),
|
||||
&be_const_str_widget_event,
|
||||
&be_const_str_solidified,
|
||||
( &(const binstruction[182]) { /* code */
|
||||
( &(const binstruction[171]) { /* code */
|
||||
0xB80E0000, // 0000 GETNGBL R3 K0
|
||||
0x8C0C0701, // 0001 GETMET R3 R3 K1
|
||||
0x5C140200, // 0002 MOVE R5 R1
|
||||
|
@ -217,158 +217,147 @@ be_local_closure(lv_signal_arcs_widget_event, /* name */
|
|||
0xB82E0000, // 001B GETNGBL R11 K0
|
||||
0x882C1709, // 001C GETMBR R11 R11 K9
|
||||
0x1C2C060B, // 001D EQ R11 R3 R11
|
||||
0x782E0095, // 001E JMPF R11 #00B5
|
||||
0x782E008A, // 001E JMPF R11 #00AA
|
||||
0xB82E0000, // 001F GETNGBL R11 K0
|
||||
0x8C2C170A, // 0020 GETMET R11 R11 K10
|
||||
0x8834050B, // 0021 GETMBR R13 R2 K11
|
||||
0x7C2C0400, // 0022 CALL R11 2
|
||||
0x8C30010C, // 0023 GETMET R12 R0 K12
|
||||
0x8838010A, // 0024 GETMBR R14 R0 K10
|
||||
0x8838010D, // 0024 GETMBR R14 R0 K13
|
||||
0x7C300400, // 0025 CALL R12 2
|
||||
0x8830010A, // 0026 GETMBR R12 R0 K10
|
||||
0x8830190D, // 0027 GETMBR R12 R12 K13
|
||||
0x8834010A, // 0028 GETMBR R13 R0 K10
|
||||
0x88341B0E, // 0029 GETMBR R13 R13 K14
|
||||
0x8830010D, // 0026 GETMBR R12 R0 K13
|
||||
0x8830190E, // 0027 GETMBR R12 R12 K14
|
||||
0x8834010D, // 0028 GETMBR R13 R0 K13
|
||||
0x88341B0F, // 0029 GETMBR R13 R13 K15
|
||||
0xB83A0000, // 002A GETNGBL R14 K0
|
||||
0x8C381D0F, // 002B GETMET R14 R14 K15
|
||||
0x88400110, // 002C GETMBR R16 R0 K16
|
||||
0x8C381D10, // 002B GETMET R14 R14 K16
|
||||
0x88400111, // 002C GETMBR R16 R0 K17
|
||||
0x7C380400, // 002D CALL R14 2
|
||||
0x8C380111, // 002E GETMET R14 R0 K17
|
||||
0x8C380112, // 002E GETMET R14 R0 K18
|
||||
0xB8420000, // 002F GETNGBL R16 K0
|
||||
0x88402112, // 0030 GETMBR R16 R16 K18
|
||||
0x88440110, // 0031 GETMBR R17 R0 K16
|
||||
0x88402113, // 0030 GETMBR R16 R16 K19
|
||||
0x88440111, // 0031 GETMBR R17 R0 K17
|
||||
0x7C380600, // 0032 CALL R14 3
|
||||
0x88380110, // 0033 GETMBR R14 R0 K16
|
||||
0x903A2714, // 0034 SETMBR R14 K19 K20
|
||||
0x88380110, // 0035 GETMBR R14 R0 K16
|
||||
0x903A2B14, // 0036 SETMBR R14 K21 K20
|
||||
0x88380110, // 0037 GETMBR R14 R0 K16
|
||||
0x083C1308, // 0038 MUL R15 R9 K8
|
||||
0x003C1F14, // 0039 ADD R15 R15 K20
|
||||
0x54420003, // 003A LDINT R16 4
|
||||
0x0C3C1E10, // 003B DIV R15 R15 R16
|
||||
0x903A2C0F, // 003C SETMBR R14 K22 R15
|
||||
0x8C380117, // 003D GETMET R14 R0 K23
|
||||
0xB8420000, // 003E GETNGBL R16 K0
|
||||
0x88402112, // 003F GETMBR R16 R16 K18
|
||||
0xB8460000, // 0040 GETNGBL R17 K0
|
||||
0x88442318, // 0041 GETMBR R17 R17 K24
|
||||
0x30402011, // 0042 OR R16 R16 R17
|
||||
0x7C380400, // 0043 CALL R14 2
|
||||
0x8C3C0119, // 0044 GETMET R15 R0 K25
|
||||
0xB8460000, // 0045 GETNGBL R17 K0
|
||||
0x88442312, // 0046 GETMBR R17 R17 K18
|
||||
0xB84A0000, // 0047 GETNGBL R18 K0
|
||||
0x88482518, // 0048 GETMBR R18 R18 K24
|
||||
0x30442212, // 0049 OR R17 R17 R18
|
||||
0x7C3C0400, // 004A CALL R15 2
|
||||
0x04400C09, // 004B SUB R16 R6 R9
|
||||
0x0C440F07, // 004C DIV R17 R7 K7
|
||||
0x0444220A, // 004D SUB R17 R17 R10
|
||||
0x60480009, // 004E GETGBL R18 G9
|
||||
0x544E0059, // 004F LDINT R19 90
|
||||
0x8C50091A, // 0050 GETMET R20 R4 K26
|
||||
0x8C58091B, // 0051 GETMET R22 R4 K27
|
||||
0x6060000A, // 0052 GETGBL R24 G10
|
||||
0x5C642200, // 0053 MOVE R25 R17
|
||||
0x7C600200, // 0054 CALL R24 1
|
||||
0x6064000A, // 0055 GETGBL R25 G10
|
||||
0x5C682000, // 0056 MOVE R26 R16
|
||||
0x7C640200, // 0057 CALL R25 1
|
||||
0x0C603019, // 0058 DIV R24 R24 R25
|
||||
0x7C580400, // 0059 CALL R22 2
|
||||
0x7C500400, // 005A CALL R20 2
|
||||
0x044C2614, // 005B SUB R19 R19 R20
|
||||
0x7C480200, // 005C CALL R18 1
|
||||
0x544E002C, // 005D LDINT R19 45
|
||||
0x244C2413, // 005E GT R19 R18 R19
|
||||
0x784E0000, // 005F JMPF R19 #0061
|
||||
0x544A002C, // 0060 LDINT R18 45
|
||||
0x884C011C, // 0061 GETMBR R19 R0 K28
|
||||
0x0C500F07, // 0062 DIV R20 R7 K7
|
||||
0x00501814, // 0063 ADD R20 R12 R20
|
||||
0x904E3A14, // 0064 SETMBR R19 K29 R20
|
||||
0x884C011C, // 0065 GETMBR R19 R0 K28
|
||||
0x00501A06, // 0066 ADD R20 R13 R6
|
||||
0x04502914, // 0067 SUB R20 R20 K20
|
||||
0x0450280A, // 0068 SUB R20 R20 R10
|
||||
0x904E3C14, // 0069 SETMBR R19 K30 R20
|
||||
0x884C0110, // 006A GETMBR R19 R0 K16
|
||||
0x88500120, // 006B GETMBR R20 R0 K32
|
||||
0x54560018, // 006C LDINT R21 25
|
||||
0x28502815, // 006D GE R20 R20 R21
|
||||
0x78520001, // 006E JMPF R20 #0071
|
||||
0x5C501C00, // 006F MOVE R20 R14
|
||||
0x70020000, // 0070 JMP #0072
|
||||
0x5C501E00, // 0071 MOVE R20 R15
|
||||
0x904E3E14, // 0072 SETMBR R19 K31 R20
|
||||
0xB84E0000, // 0073 GETNGBL R19 K0
|
||||
0x8C4C2721, // 0074 GETMET R19 R19 K33
|
||||
0x8854011C, // 0075 GETMBR R21 R0 K28
|
||||
0x88542B1D, // 0076 GETMBR R21 R21 K29
|
||||
0x8858011C, // 0077 GETMBR R22 R0 K28
|
||||
0x88582D1E, // 0078 GETMBR R22 R22 K30
|
||||
0x005C1208, // 0079 ADD R23 R9 R8
|
||||
0x085E4417, // 007A MUL R23 K34 R23
|
||||
0x005C2E0A, // 007B ADD R23 R23 R10
|
||||
0x58600022, // 007C LDCONST R24 K34
|
||||
0x54660167, // 007D LDINT R25 360
|
||||
0x5C681600, // 007E MOVE R26 R11
|
||||
0x886C0110, // 007F GETMBR R27 R0 K16
|
||||
0x7C4C1000, // 0080 CALL R19 8
|
||||
0x884C0110, // 0081 GETMBR R19 R0 K16
|
||||
0x88500120, // 0082 GETMBR R20 R0 K32
|
||||
0x54560031, // 0083 LDINT R21 50
|
||||
0x28502815, // 0084 GE R20 R20 R21
|
||||
0x78520001, // 0085 JMPF R20 #0088
|
||||
0x5C501C00, // 0086 MOVE R20 R14
|
||||
0x70020000, // 0087 JMP #0089
|
||||
0x5C501E00, // 0088 MOVE R20 R15
|
||||
0x904E3E14, // 0089 SETMBR R19 K31 R20
|
||||
0xB84E0000, // 008A GETNGBL R19 K0
|
||||
0x8C4C2721, // 008B GETMET R19 R19 K33
|
||||
0x8854011C, // 008C GETMBR R21 R0 K28
|
||||
0x88542B1D, // 008D GETMBR R21 R21 K29
|
||||
0x8858011C, // 008E GETMBR R22 R0 K28
|
||||
0x88582D1E, // 008F GETMBR R22 R22 K30
|
||||
0x005C1208, // 0090 ADD R23 R9 R8
|
||||
0x085E2817, // 0091 MUL R23 K20 R23
|
||||
0x005C2E0A, // 0092 ADD R23 R23 R10
|
||||
0x045C2F14, // 0093 SUB R23 R23 K20
|
||||
0x5462010D, // 0094 LDINT R24 270
|
||||
0x04603012, // 0095 SUB R24 R24 R18
|
||||
0x5466010D, // 0096 LDINT R25 270
|
||||
0x00643212, // 0097 ADD R25 R25 R18
|
||||
0x5C681600, // 0098 MOVE R26 R11
|
||||
0x886C0110, // 0099 GETMBR R27 R0 K16
|
||||
0x7C4C1000, // 009A CALL R19 8
|
||||
0x884C0110, // 009B GETMBR R19 R0 K16
|
||||
0x88500120, // 009C GETMBR R20 R0 K32
|
||||
0x5456004A, // 009D LDINT R21 75
|
||||
0x28502815, // 009E GE R20 R20 R21
|
||||
0x78520001, // 009F JMPF R20 #00A2
|
||||
0x5C501C00, // 00A0 MOVE R20 R14
|
||||
0x70020000, // 00A1 JMP #00A3
|
||||
0x5C501E00, // 00A2 MOVE R20 R15
|
||||
0x904E3E14, // 00A3 SETMBR R19 K31 R20
|
||||
0xB84E0000, // 00A4 GETNGBL R19 K0
|
||||
0x8C4C2721, // 00A5 GETMET R19 R19 K33
|
||||
0x8854011C, // 00A6 GETMBR R21 R0 K28
|
||||
0x88542B1D, // 00A7 GETMBR R21 R21 K29
|
||||
0x8858011C, // 00A8 GETMBR R22 R0 K28
|
||||
0x88582D1E, // 00A9 GETMBR R22 R22 K30
|
||||
0x005C1208, // 00AA ADD R23 R9 R8
|
||||
0x085E0E17, // 00AB MUL R23 K7 R23
|
||||
0x005C2E0A, // 00AC ADD R23 R23 R10
|
||||
0x045C2F07, // 00AD SUB R23 R23 K7
|
||||
0x5462010D, // 00AE LDINT R24 270
|
||||
0x04603012, // 00AF SUB R24 R24 R18
|
||||
0x5466010D, // 00B0 LDINT R25 270
|
||||
0x00643212, // 00B1 ADD R25 R25 R18
|
||||
0x5C681600, // 00B2 MOVE R26 R11
|
||||
0x886C0110, // 00B3 GETMBR R27 R0 K16
|
||||
0x7C4C1000, // 00B4 CALL R19 8
|
||||
0x80000000, // 00B5 RET 0
|
||||
0x88380111, // 0033 GETMBR R14 R0 K17
|
||||
0x903A2915, // 0034 SETMBR R14 K20 K21
|
||||
0x88380111, // 0035 GETMBR R14 R0 K17
|
||||
0x083C1308, // 0036 MUL R15 R9 K8
|
||||
0x003C1F15, // 0037 ADD R15 R15 K21
|
||||
0x54420003, // 0038 LDINT R16 4
|
||||
0x0C3C1E10, // 0039 DIV R15 R15 R16
|
||||
0x903A2C0F, // 003A SETMBR R14 K22 R15
|
||||
0x8C380117, // 003B GETMET R14 R0 K23
|
||||
0xB8420000, // 003C GETNGBL R16 K0
|
||||
0x88402113, // 003D GETMBR R16 R16 K19
|
||||
0xB8460000, // 003E GETNGBL R17 K0
|
||||
0x88442318, // 003F GETMBR R17 R17 K24
|
||||
0x30402011, // 0040 OR R16 R16 R17
|
||||
0x7C380400, // 0041 CALL R14 2
|
||||
0x8C3C0119, // 0042 GETMET R15 R0 K25
|
||||
0xB8460000, // 0043 GETNGBL R17 K0
|
||||
0x88442313, // 0044 GETMBR R17 R17 K19
|
||||
0xB84A0000, // 0045 GETNGBL R18 K0
|
||||
0x88482518, // 0046 GETMBR R18 R18 K24
|
||||
0x30442212, // 0047 OR R17 R17 R18
|
||||
0x7C3C0400, // 0048 CALL R15 2
|
||||
0x04400C09, // 0049 SUB R16 R6 R9
|
||||
0x0C440F07, // 004A DIV R17 R7 K7
|
||||
0x0444220A, // 004B SUB R17 R17 R10
|
||||
0x60480009, // 004C GETGBL R18 G9
|
||||
0x544E0059, // 004D LDINT R19 90
|
||||
0x8C50091A, // 004E GETMET R20 R4 K26
|
||||
0x8C58091B, // 004F GETMET R22 R4 K27
|
||||
0x6060000A, // 0050 GETGBL R24 G10
|
||||
0x5C642200, // 0051 MOVE R25 R17
|
||||
0x7C600200, // 0052 CALL R24 1
|
||||
0x6064000A, // 0053 GETGBL R25 G10
|
||||
0x5C682000, // 0054 MOVE R26 R16
|
||||
0x7C640200, // 0055 CALL R25 1
|
||||
0x0C603019, // 0056 DIV R24 R24 R25
|
||||
0x7C580400, // 0057 CALL R22 2
|
||||
0x7C500400, // 0058 CALL R20 2
|
||||
0x044C2614, // 0059 SUB R19 R19 R20
|
||||
0x7C480200, // 005A CALL R18 1
|
||||
0x544E002C, // 005B LDINT R19 45
|
||||
0x244C2413, // 005C GT R19 R18 R19
|
||||
0x784E0000, // 005D JMPF R19 #005F
|
||||
0x544A002C, // 005E LDINT R18 45
|
||||
0x884C011C, // 005F GETMBR R19 R0 K28
|
||||
0x0C500F07, // 0060 DIV R20 R7 K7
|
||||
0x00501814, // 0061 ADD R20 R12 R20
|
||||
0x904E3A14, // 0062 SETMBR R19 K29 R20
|
||||
0x884C011C, // 0063 GETMBR R19 R0 K28
|
||||
0x00501A06, // 0064 ADD R20 R13 R6
|
||||
0x04502915, // 0065 SUB R20 R20 K21
|
||||
0x0450280A, // 0066 SUB R20 R20 R10
|
||||
0x904E3C14, // 0067 SETMBR R19 K30 R20
|
||||
0x884C0111, // 0068 GETMBR R19 R0 K17
|
||||
0x88500120, // 0069 GETMBR R20 R0 K32
|
||||
0x54560018, // 006A LDINT R21 25
|
||||
0x28502815, // 006B GE R20 R20 R21
|
||||
0x78520001, // 006C JMPF R20 #006F
|
||||
0x5C501C00, // 006D MOVE R20 R14
|
||||
0x70020000, // 006E JMP #0070
|
||||
0x5C501E00, // 006F MOVE R20 R15
|
||||
0x904E3E14, // 0070 SETMBR R19 K31 R20
|
||||
0xB84E0000, // 0071 GETNGBL R19 K0
|
||||
0x8C4C2721, // 0072 GETMET R19 R19 K33
|
||||
0x5C541600, // 0073 MOVE R21 R11
|
||||
0x88580111, // 0074 GETMBR R22 R0 K17
|
||||
0x885C011C, // 0075 GETMBR R23 R0 K28
|
||||
0x00601208, // 0076 ADD R24 R9 R8
|
||||
0x08624418, // 0077 MUL R24 K34 R24
|
||||
0x0060300A, // 0078 ADD R24 R24 R10
|
||||
0x58640022, // 0079 LDCONST R25 K34
|
||||
0x546A0167, // 007A LDINT R26 360
|
||||
0x7C4C0E00, // 007B CALL R19 7
|
||||
0x884C0111, // 007C GETMBR R19 R0 K17
|
||||
0x88500120, // 007D GETMBR R20 R0 K32
|
||||
0x54560031, // 007E LDINT R21 50
|
||||
0x28502815, // 007F GE R20 R20 R21
|
||||
0x78520001, // 0080 JMPF R20 #0083
|
||||
0x5C501C00, // 0081 MOVE R20 R14
|
||||
0x70020000, // 0082 JMP #0084
|
||||
0x5C501E00, // 0083 MOVE R20 R15
|
||||
0x904E3E14, // 0084 SETMBR R19 K31 R20
|
||||
0xB84E0000, // 0085 GETNGBL R19 K0
|
||||
0x8C4C2721, // 0086 GETMET R19 R19 K33
|
||||
0x5C541600, // 0087 MOVE R21 R11
|
||||
0x88580111, // 0088 GETMBR R22 R0 K17
|
||||
0x885C011C, // 0089 GETMBR R23 R0 K28
|
||||
0x00601208, // 008A ADD R24 R9 R8
|
||||
0x08622A18, // 008B MUL R24 K21 R24
|
||||
0x0060300A, // 008C ADD R24 R24 R10
|
||||
0x04603115, // 008D SUB R24 R24 K21
|
||||
0x5466010D, // 008E LDINT R25 270
|
||||
0x04643212, // 008F SUB R25 R25 R18
|
||||
0x546A010D, // 0090 LDINT R26 270
|
||||
0x00683412, // 0091 ADD R26 R26 R18
|
||||
0x7C4C0E00, // 0092 CALL R19 7
|
||||
0x884C0111, // 0093 GETMBR R19 R0 K17
|
||||
0x88500120, // 0094 GETMBR R20 R0 K32
|
||||
0x5456004A, // 0095 LDINT R21 75
|
||||
0x28502815, // 0096 GE R20 R20 R21
|
||||
0x78520001, // 0097 JMPF R20 #009A
|
||||
0x5C501C00, // 0098 MOVE R20 R14
|
||||
0x70020000, // 0099 JMP #009B
|
||||
0x5C501E00, // 009A MOVE R20 R15
|
||||
0x904E3E14, // 009B SETMBR R19 K31 R20
|
||||
0xB84E0000, // 009C GETNGBL R19 K0
|
||||
0x8C4C2721, // 009D GETMET R19 R19 K33
|
||||
0x5C541600, // 009E MOVE R21 R11
|
||||
0x88580111, // 009F GETMBR R22 R0 K17
|
||||
0x885C011C, // 00A0 GETMBR R23 R0 K28
|
||||
0x00601208, // 00A1 ADD R24 R9 R8
|
||||
0x08620E18, // 00A2 MUL R24 K7 R24
|
||||
0x0060300A, // 00A3 ADD R24 R24 R10
|
||||
0x04603107, // 00A4 SUB R24 R24 K7
|
||||
0x5466010D, // 00A5 LDINT R25 270
|
||||
0x04643212, // 00A6 SUB R25 R25 R18
|
||||
0x546A010D, // 00A7 LDINT R26 270
|
||||
0x00683412, // 00A8 ADD R26 R26 R18
|
||||
0x7C4C0E00, // 00A9 CALL R19 7
|
||||
0x80000000, // 00AA RET 0
|
||||
})
|
||||
)
|
||||
);
|
||||
|
@ -382,7 +371,7 @@ be_local_closure(lv_signal_arcs_get_percentage, /* name */
|
|||
be_nested_proto(
|
||||
2, /* nstack */
|
||||
1, /* argc */
|
||||
0, /* varg */
|
||||
2, /* varg */
|
||||
0, /* has upvals */
|
||||
NULL, /* no upvals */
|
||||
0, /* has sup protos */
|
||||
|
@ -411,15 +400,15 @@ be_local_class(lv_signal_arcs,
|
|||
&be_class_lv_obj,
|
||||
be_nested_map(9,
|
||||
( (struct bmapnode*) &(const bmapnode[]) {
|
||||
{ be_const_key(percentage, 4), be_const_var(0) },
|
||||
{ be_const_key(p1, 3), be_const_var(1) },
|
||||
{ be_const_key(percentage, -1), be_const_var(0) },
|
||||
{ be_const_key(area, 4), be_const_var(3) },
|
||||
{ be_const_key(p2, -1), be_const_var(2) },
|
||||
{ be_const_key(area, -1), be_const_var(3) },
|
||||
{ be_const_key(line_dsc, -1), be_const_var(4) },
|
||||
{ be_const_key(set_percentage, -1), be_const_closure(lv_signal_arcs_set_percentage_closure) },
|
||||
{ be_const_key(init, -1), be_const_closure(lv_signal_arcs_init_closure) },
|
||||
{ be_const_key(get_percentage, -1), be_const_closure(lv_signal_arcs_get_percentage_closure) },
|
||||
{ be_const_key(p1, -1), be_const_var(1) },
|
||||
{ be_const_key(arc_dsc, -1), be_const_var(4) },
|
||||
{ be_const_key(init, 5), be_const_closure(lv_signal_arcs_init_closure) },
|
||||
{ be_const_key(widget_event, -1), be_const_closure(lv_signal_arcs_widget_event_closure) },
|
||||
{ be_const_key(get_percentage, 5), be_const_closure(lv_signal_arcs_get_percentage_closure) },
|
||||
{ be_const_key(set_percentage, 3), be_const_closure(lv_signal_arcs_set_percentage_closure) },
|
||||
})),
|
||||
be_str_literal("lv_signal_arcs")
|
||||
);
|
||||
|
|
|
@ -14,7 +14,7 @@ be_local_closure(lv_signal_bars_set_percentage, /* name */
|
|||
be_nested_proto(
|
||||
5, /* nstack */
|
||||
2, /* argc */
|
||||
0, /* varg */
|
||||
2, /* varg */
|
||||
0, /* has upvals */
|
||||
NULL, /* no upvals */
|
||||
0, /* has sup protos */
|
||||
|
@ -59,7 +59,7 @@ be_local_closure(lv_signal_bars_init, /* name */
|
|||
be_nested_proto(
|
||||
6, /* nstack */
|
||||
2, /* argc */
|
||||
0, /* varg */
|
||||
2, /* varg */
|
||||
0, /* has upvals */
|
||||
NULL, /* no upvals */
|
||||
0, /* has sup protos */
|
||||
|
@ -117,7 +117,7 @@ be_local_closure(lv_signal_bars_widget_event, /* name */
|
|||
be_nested_proto(
|
||||
23, /* nstack */
|
||||
3, /* argc */
|
||||
0, /* varg */
|
||||
2, /* varg */
|
||||
0, /* has upvals */
|
||||
NULL, /* no upvals */
|
||||
1, /* has sup protos */
|
||||
|
@ -147,7 +147,7 @@ be_local_closure(lv_signal_bars_widget_event, /* name */
|
|||
),
|
||||
}),
|
||||
1, /* has constants */
|
||||
( &(const bvalue[37]) { /* constants */
|
||||
( &(const bvalue[38]) { /* constants */
|
||||
/* K0 */ be_nested_str(lv),
|
||||
/* K1 */ be_nested_str(obj_event_base),
|
||||
/* K2 */ be_nested_str(RES_OK),
|
||||
|
@ -157,34 +157,35 @@ be_local_closure(lv_signal_bars_widget_event, /* name */
|
|||
/* K6 */ be_const_int(3),
|
||||
/* K7 */ be_const_int(2),
|
||||
/* K8 */ be_nested_str(EVENT_DRAW_MAIN),
|
||||
/* K9 */ be_nested_str(area),
|
||||
/* K9 */ be_nested_str(draw_ctx),
|
||||
/* K10 */ be_nested_str(param),
|
||||
/* K11 */ be_nested_str(get_coords),
|
||||
/* K12 */ be_nested_str(x1),
|
||||
/* K13 */ be_nested_str(y1),
|
||||
/* K14 */ be_nested_str(draw_line_dsc_init),
|
||||
/* K15 */ be_nested_str(line_dsc),
|
||||
/* K16 */ be_nested_str(init_draw_line_dsc),
|
||||
/* K17 */ be_nested_str(PART_MAIN),
|
||||
/* K18 */ be_nested_str(round_start),
|
||||
/* K19 */ be_const_int(1),
|
||||
/* K20 */ be_nested_str(round_end),
|
||||
/* K21 */ be_nested_str(width),
|
||||
/* K22 */ be_nested_str(get_style_line_color),
|
||||
/* K23 */ be_nested_str(STATE_DEFAULT),
|
||||
/* K24 */ be_nested_str(get_style_bg_color),
|
||||
/* K25 */ be_nested_str(event_send),
|
||||
/* K26 */ be_nested_str(EVENT_DRAW_PART_BEGIN),
|
||||
/* K27 */ be_const_int(0),
|
||||
/* K28 */ be_nested_str(color),
|
||||
/* K29 */ be_nested_str(percentage),
|
||||
/* K30 */ be_nested_str(p1),
|
||||
/* K31 */ be_nested_str(y),
|
||||
/* K32 */ be_nested_str(x),
|
||||
/* K33 */ be_nested_str(p2),
|
||||
/* K34 */ be_nested_str(draw_line),
|
||||
/* K35 */ be_nested_str(stop_iteration),
|
||||
/* K36 */ be_nested_str(EVENT_DRAW_PART_END),
|
||||
/* K12 */ be_nested_str(area),
|
||||
/* K13 */ be_nested_str(x1),
|
||||
/* K14 */ be_nested_str(y1),
|
||||
/* K15 */ be_nested_str(draw_line_dsc_init),
|
||||
/* K16 */ be_nested_str(line_dsc),
|
||||
/* K17 */ be_nested_str(init_draw_line_dsc),
|
||||
/* K18 */ be_nested_str(PART_MAIN),
|
||||
/* K19 */ be_nested_str(round_start),
|
||||
/* K20 */ be_const_int(1),
|
||||
/* K21 */ be_nested_str(round_end),
|
||||
/* K22 */ be_nested_str(width),
|
||||
/* K23 */ be_nested_str(get_style_line_color),
|
||||
/* K24 */ be_nested_str(STATE_DEFAULT),
|
||||
/* K25 */ be_nested_str(get_style_bg_color),
|
||||
/* K26 */ be_nested_str(event_send),
|
||||
/* K27 */ be_nested_str(EVENT_DRAW_PART_BEGIN),
|
||||
/* K28 */ be_const_int(0),
|
||||
/* K29 */ be_nested_str(color),
|
||||
/* K30 */ be_nested_str(percentage),
|
||||
/* K31 */ be_nested_str(p1),
|
||||
/* K32 */ be_nested_str(y),
|
||||
/* K33 */ be_nested_str(x),
|
||||
/* K34 */ be_nested_str(p2),
|
||||
/* K35 */ be_nested_str(draw_line),
|
||||
/* K36 */ be_nested_str(stop_iteration),
|
||||
/* K37 */ be_nested_str(EVENT_DRAW_PART_END),
|
||||
}),
|
||||
&be_const_str_widget_event,
|
||||
&be_const_str_solidified,
|
||||
|
@ -225,57 +226,57 @@ be_local_closure(lv_signal_bars_widget_event, /* name */
|
|||
0x8830050A, // 0021 GETMBR R12 R2 K10
|
||||
0x7C280400, // 0022 CALL R10 2
|
||||
0x8C2C010B, // 0023 GETMET R11 R0 K11
|
||||
0x88340109, // 0024 GETMBR R13 R0 K9
|
||||
0x8834010C, // 0024 GETMBR R13 R0 K12
|
||||
0x7C2C0400, // 0025 CALL R11 2
|
||||
0x882C0109, // 0026 GETMBR R11 R0 K9
|
||||
0x882C170C, // 0027 GETMBR R11 R11 K12
|
||||
0x88300109, // 0028 GETMBR R12 R0 K9
|
||||
0x8830190D, // 0029 GETMBR R12 R12 K13
|
||||
0x882C010C, // 0026 GETMBR R11 R0 K12
|
||||
0x882C170D, // 0027 GETMBR R11 R11 K13
|
||||
0x8830010C, // 0028 GETMBR R12 R0 K12
|
||||
0x8830190E, // 0029 GETMBR R12 R12 K14
|
||||
0xB8360000, // 002A GETNGBL R13 K0
|
||||
0x8C341B0E, // 002B GETMET R13 R13 K14
|
||||
0x883C010F, // 002C GETMBR R15 R0 K15
|
||||
0x8C341B0F, // 002B GETMET R13 R13 K15
|
||||
0x883C0110, // 002C GETMBR R15 R0 K16
|
||||
0x7C340400, // 002D CALL R13 2
|
||||
0x8C340110, // 002E GETMET R13 R0 K16
|
||||
0x8C340111, // 002E GETMET R13 R0 K17
|
||||
0xB83E0000, // 002F GETNGBL R15 K0
|
||||
0x883C1F11, // 0030 GETMBR R15 R15 K17
|
||||
0x8840010F, // 0031 GETMBR R16 R0 K15
|
||||
0x883C1F12, // 0030 GETMBR R15 R15 K18
|
||||
0x88400110, // 0031 GETMBR R16 R0 K16
|
||||
0x7C340600, // 0032 CALL R13 3
|
||||
0x8834010F, // 0033 GETMBR R13 R0 K15
|
||||
0x90362513, // 0034 SETMBR R13 K18 K19
|
||||
0x8834010F, // 0035 GETMBR R13 R0 K15
|
||||
0x90362913, // 0036 SETMBR R13 K20 K19
|
||||
0x8834010F, // 0037 GETMBR R13 R0 K15
|
||||
0x90362A08, // 0038 SETMBR R13 K21 R8
|
||||
0x8C340116, // 0039 GETMET R13 R0 K22
|
||||
0x88340110, // 0033 GETMBR R13 R0 K16
|
||||
0x90362714, // 0034 SETMBR R13 K19 K20
|
||||
0x88340110, // 0035 GETMBR R13 R0 K16
|
||||
0x90362B14, // 0036 SETMBR R13 K21 K20
|
||||
0x88340110, // 0037 GETMBR R13 R0 K16
|
||||
0x90362C08, // 0038 SETMBR R13 K22 R8
|
||||
0x8C340117, // 0039 GETMET R13 R0 K23
|
||||
0xB83E0000, // 003A GETNGBL R15 K0
|
||||
0x883C1F11, // 003B GETMBR R15 R15 K17
|
||||
0x883C1F12, // 003B GETMBR R15 R15 K18
|
||||
0xB8420000, // 003C GETNGBL R16 K0
|
||||
0x88402117, // 003D GETMBR R16 R16 K23
|
||||
0x88402118, // 003D GETMBR R16 R16 K24
|
||||
0x303C1E10, // 003E OR R15 R15 R16
|
||||
0x7C340400, // 003F CALL R13 2
|
||||
0x8C380118, // 0040 GETMET R14 R0 K24
|
||||
0x8C380119, // 0040 GETMET R14 R0 K25
|
||||
0xB8420000, // 0041 GETNGBL R16 K0
|
||||
0x88402111, // 0042 GETMBR R16 R16 K17
|
||||
0x88402112, // 0042 GETMBR R16 R16 K18
|
||||
0xB8460000, // 0043 GETNGBL R17 K0
|
||||
0x88442317, // 0044 GETMBR R17 R17 K23
|
||||
0x88442318, // 0044 GETMBR R17 R17 K24
|
||||
0x30402011, // 0045 OR R16 R16 R17
|
||||
0x7C380400, // 0046 CALL R14 2
|
||||
0xB83E0000, // 0047 GETNGBL R15 K0
|
||||
0x8C3C1F19, // 0048 GETMET R15 R15 K25
|
||||
0x8C3C1F1A, // 0048 GETMET R15 R15 K26
|
||||
0x5C440000, // 0049 MOVE R17 R0
|
||||
0xB84A0000, // 004A GETNGBL R18 K0
|
||||
0x8848251A, // 004B GETMBR R18 R18 K26
|
||||
0x884C010F, // 004C GETMBR R19 R0 K15
|
||||
0x8848251B, // 004B GETMBR R18 R18 K27
|
||||
0x884C0110, // 004C GETMBR R19 R0 K16
|
||||
0x7C3C0800, // 004D CALL R15 4
|
||||
0x603C0010, // 004E GETGBL R15 G16
|
||||
0x40423706, // 004F CONNECT R16 K27 K6
|
||||
0x40423906, // 004F CONNECT R16 K28 K6
|
||||
0x7C3C0200, // 0050 CALL R15 1
|
||||
0xA802002C, // 0051 EXBLK 0 #007F
|
||||
0x5C401E00, // 0052 MOVE R16 R15
|
||||
0x7C400000, // 0053 CALL R16 0
|
||||
0x8844010F, // 0054 GETMBR R17 R0 K15
|
||||
0x8848011D, // 0055 GETMBR R18 R0 K29
|
||||
0x004C2113, // 0056 ADD R19 R16 K19
|
||||
0x88440110, // 0054 GETMBR R17 R0 K16
|
||||
0x8848011E, // 0055 GETMBR R18 R0 K30
|
||||
0x004C2114, // 0056 ADD R19 R16 K20
|
||||
0x54520013, // 0057 LDINT R20 20
|
||||
0x084C2614, // 0058 MUL R19 R19 R20
|
||||
0x28482413, // 0059 GE R18 R18 R19
|
||||
|
@ -283,19 +284,19 @@ be_local_closure(lv_signal_bars_widget_event, /* name */
|
|||
0x5C481A00, // 005B MOVE R18 R13
|
||||
0x70020000, // 005C JMP #005E
|
||||
0x5C481C00, // 005D MOVE R18 R14
|
||||
0x90463812, // 005E SETMBR R17 K28 R18
|
||||
0x8844011E, // 005F GETMBR R17 R0 K30
|
||||
0x90463A12, // 005E SETMBR R17 K29 R18
|
||||
0x8844011F, // 005F GETMBR R17 R0 K31
|
||||
0x00481805, // 0060 ADD R18 R12 R5
|
||||
0x04482513, // 0061 SUB R18 R18 K19
|
||||
0x04482514, // 0061 SUB R18 R18 K20
|
||||
0x04482409, // 0062 SUB R18 R18 R9
|
||||
0x90463E12, // 0063 SETMBR R17 K31 R18
|
||||
0x8844011E, // 0064 GETMBR R17 R0 K30
|
||||
0x90464012, // 0063 SETMBR R17 K32 R18
|
||||
0x8844011F, // 0064 GETMBR R17 R0 K31
|
||||
0x00481007, // 0065 ADD R18 R8 R7
|
||||
0x08482012, // 0066 MUL R18 R16 R18
|
||||
0x00481612, // 0067 ADD R18 R11 R18
|
||||
0x00482409, // 0068 ADD R18 R18 R9
|
||||
0x90464012, // 0069 SETMBR R17 K32 R18
|
||||
0x88440121, // 006A GETMBR R17 R0 K33
|
||||
0x90464212, // 0069 SETMBR R17 K33 R18
|
||||
0x88440122, // 006A GETMBR R17 R0 K34
|
||||
0x044A0C10, // 006B SUB R18 K6 R16
|
||||
0x044C0A08, // 006C SUB R19 R5 R8
|
||||
0x08482413, // 006D MUL R18 R18 R19
|
||||
|
@ -303,28 +304,28 @@ be_local_closure(lv_signal_bars_widget_event, /* name */
|
|||
0x0C482413, // 006F DIV R18 R18 R19
|
||||
0x00481812, // 0070 ADD R18 R12 R18
|
||||
0x00482409, // 0071 ADD R18 R18 R9
|
||||
0x90463E12, // 0072 SETMBR R17 K31 R18
|
||||
0x88440121, // 0073 GETMBR R17 R0 K33
|
||||
0x8848011E, // 0074 GETMBR R18 R0 K30
|
||||
0x88482520, // 0075 GETMBR R18 R18 K32
|
||||
0x90464012, // 0076 SETMBR R17 K32 R18
|
||||
0x90464012, // 0072 SETMBR R17 K32 R18
|
||||
0x88440122, // 0073 GETMBR R17 R0 K34
|
||||
0x8848011F, // 0074 GETMBR R18 R0 K31
|
||||
0x88482521, // 0075 GETMBR R18 R18 K33
|
||||
0x90464212, // 0076 SETMBR R17 K33 R18
|
||||
0xB8460000, // 0077 GETNGBL R17 K0
|
||||
0x8C442322, // 0078 GETMET R17 R17 K34
|
||||
0x884C011E, // 0079 GETMBR R19 R0 K30
|
||||
0x88500121, // 007A GETMBR R20 R0 K33
|
||||
0x5C541400, // 007B MOVE R21 R10
|
||||
0x8858010F, // 007C GETMBR R22 R0 K15
|
||||
0x8C442323, // 0078 GETMET R17 R17 K35
|
||||
0x5C4C1400, // 0079 MOVE R19 R10
|
||||
0x88500110, // 007A GETMBR R20 R0 K16
|
||||
0x8854011F, // 007B GETMBR R21 R0 K31
|
||||
0x88580122, // 007C GETMBR R22 R0 K34
|
||||
0x7C440A00, // 007D CALL R17 5
|
||||
0x7001FFD2, // 007E JMP #0052
|
||||
0x583C0023, // 007F LDCONST R15 K35
|
||||
0x583C0024, // 007F LDCONST R15 K36
|
||||
0xAC3C0200, // 0080 CATCH R15 1 0
|
||||
0xB0080000, // 0081 RAISE 2 R0 R0
|
||||
0xB83E0000, // 0082 GETNGBL R15 K0
|
||||
0x8C3C1F19, // 0083 GETMET R15 R15 K25
|
||||
0x8C3C1F1A, // 0083 GETMET R15 R15 K26
|
||||
0x5C440000, // 0084 MOVE R17 R0
|
||||
0xB84A0000, // 0085 GETNGBL R18 K0
|
||||
0x88482524, // 0086 GETMBR R18 R18 K36
|
||||
0x884C010F, // 0087 GETMBR R19 R0 K15
|
||||
0x88482525, // 0086 GETMBR R18 R18 K37
|
||||
0x884C0110, // 0087 GETMBR R19 R0 K16
|
||||
0x7C3C0800, // 0088 CALL R15 4
|
||||
0x80000000, // 0089 RET 0
|
||||
})
|
||||
|
@ -340,7 +341,7 @@ be_local_closure(lv_signal_bars_get_percentage, /* name */
|
|||
be_nested_proto(
|
||||
2, /* nstack */
|
||||
1, /* argc */
|
||||
0, /* varg */
|
||||
2, /* varg */
|
||||
0, /* has upvals */
|
||||
NULL, /* no upvals */
|
||||
0, /* has sup protos */
|
||||
|
@ -370,14 +371,14 @@ be_local_class(lv_signal_bars,
|
|||
be_nested_map(9,
|
||||
( (struct bmapnode*) &(const bmapnode[]) {
|
||||
{ be_const_key(percentage, 4), be_const_var(0) },
|
||||
{ be_const_key(p1, 3), be_const_var(1) },
|
||||
{ be_const_key(p1, 5), be_const_var(1) },
|
||||
{ be_const_key(p2, -1), be_const_var(2) },
|
||||
{ be_const_key(area, -1), be_const_var(3) },
|
||||
{ be_const_key(get_percentage, -1), be_const_closure(lv_signal_bars_get_percentage_closure) },
|
||||
{ be_const_key(line_dsc, -1), be_const_var(4) },
|
||||
{ be_const_key(set_percentage, -1), be_const_closure(lv_signal_bars_set_percentage_closure) },
|
||||
{ be_const_key(area, -1), be_const_var(3) },
|
||||
{ be_const_key(init, -1), be_const_closure(lv_signal_bars_init_closure) },
|
||||
{ be_const_key(widget_event, -1), be_const_closure(lv_signal_bars_widget_event_closure) },
|
||||
{ be_const_key(get_percentage, 5), be_const_closure(lv_signal_bars_get_percentage_closure) },
|
||||
{ be_const_key(set_percentage, 3), be_const_closure(lv_signal_bars_set_percentage_closure) },
|
||||
})),
|
||||
be_str_literal("lv_signal_bars")
|
||||
);
|
||||
|
|
|
@ -0,0 +1,25 @@
|
|||
/********************************************************************
|
||||
* Tasmota Log Reader class
|
||||
*
|
||||
*******************************************************************/
|
||||
#include "be_constobj.h"
|
||||
#include "be_mapping.h"
|
||||
|
||||
extern uint32_t* tlr_init(void); BE_FUNC_CTYPE_DECLARE(tlr_init, "+_p", "")
|
||||
extern char* tlr_get_log(uint32_t* idx, int32_t log_level); BE_FUNC_CTYPE_DECLARE(tlr_get_log, "s", ".i")
|
||||
|
||||
#include "be_fixed_be_class_tasmota_log_reader.h"
|
||||
|
||||
extern "C" void be_load_tasmota_log_reader_class(bvm *vm) {
|
||||
be_pushntvclass(vm, &be_class_tasmota_log_reader);
|
||||
be_setglobal(vm, "tasmota_log_reader");
|
||||
be_pop(vm, 1);
|
||||
}
|
||||
/* @const_object_info_begin
|
||||
|
||||
class be_class_tasmota_log_reader (scope: global, name: tasmota_log_reader) {
|
||||
_p, var
|
||||
init, ctype_func(tlr_init)
|
||||
get_log, ctype_func(tlr_get_log)
|
||||
}
|
||||
@const_object_info_end */
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
class lv_signal_arcs : lv.obj
|
||||
var percentage # value to display, range 0..100
|
||||
var p1, p2, area, line_dsc # instances of objects kept to avoid re-instanciating at each call
|
||||
var p1, p2, area, arc_dsc # instances of objects kept to avoid re-instanciating at each call
|
||||
|
||||
def init(parent)
|
||||
# init custom widget (don't call super constructor)
|
||||
|
@ -15,7 +15,7 @@ class lv_signal_arcs : lv.obj
|
|||
self.p1 = lv.point()
|
||||
self.p2 = lv.point()
|
||||
self.area = lv.area()
|
||||
self.line_dsc = lv.draw_line_dsc()
|
||||
self.arc_dsc = lv.draw_arc_dsc()
|
||||
end
|
||||
|
||||
def widget_event(cl, event)
|
||||
|
@ -35,19 +35,18 @@ class lv_signal_arcs : lv.obj
|
|||
#print("inter_bar", inter_bar, "bar", bar, "bar_offset", bar_offset)
|
||||
|
||||
if code == lv.EVENT_DRAW_MAIN
|
||||
var clip_area = lv.area(event.param)
|
||||
var draw_ctx = lv.draw_ctx(event.param)
|
||||
|
||||
# get coordinates of object
|
||||
self.get_coords(self.area)
|
||||
var x_ofs = self.area.x1
|
||||
var y_ofs = self.area.y1
|
||||
|
||||
lv.draw_line_dsc_init(self.line_dsc) # initialize lv.draw_line_dsc structure
|
||||
self.init_draw_line_dsc(lv.PART_MAIN, self.line_dsc) # copy the current values
|
||||
lv.draw_arc_dsc_init(self.arc_dsc) # initialize lv.draw_line_dsc structure
|
||||
self.init_draw_arc_dsc(lv.PART_MAIN, self.arc_dsc) # copy the current values
|
||||
|
||||
self.line_dsc.round_start = 1
|
||||
self.line_dsc.round_end = 1
|
||||
self.line_dsc.width = (bar * 3 + 1) / 4
|
||||
self.arc_dsc.rounded = 1
|
||||
self.arc_dsc.width = (bar * 3 + 1) / 4
|
||||
var on_color = self.get_style_line_color(lv.PART_MAIN | lv.STATE_DEFAULT)
|
||||
var off_color = self.get_style_bg_color(lv.PART_MAIN | lv.STATE_DEFAULT)
|
||||
|
||||
|
@ -64,12 +63,12 @@ class lv_signal_arcs : lv.obj
|
|||
self.p1.x = x_ofs + width / 2
|
||||
self.p1.y = y_ofs + height - 1 - bar_offset
|
||||
|
||||
self.line_dsc.color = self.percentage >= 25 ? on_color : off_color
|
||||
lv.draw_arc(self.p1.x, self.p1.y, 0 * (bar + inter_bar) + bar_offset, 0, 360, clip_area, self.line_dsc)
|
||||
self.line_dsc.color = self.percentage >= 50 ? on_color : off_color
|
||||
lv.draw_arc(self.p1.x, self.p1.y, 1 * (bar + inter_bar) + bar_offset - 1, 270 - angle, 270 + angle, clip_area, self.line_dsc)
|
||||
self.line_dsc.color = self.percentage >= 75 ? on_color : off_color
|
||||
lv.draw_arc(self.p1.x, self.p1.y, 2 * (bar + inter_bar) + bar_offset - 2, 270 - angle, 270 + angle, clip_area, self.line_dsc)
|
||||
self.arc_dsc.color = self.percentage >= 25 ? on_color : off_color
|
||||
lv.draw_arc(draw_ctx, self.arc_dsc, self.p1, 0 * (bar + inter_bar) + bar_offset, 0, 360)
|
||||
self.arc_dsc.color = self.percentage >= 50 ? on_color : off_color
|
||||
lv.draw_arc(draw_ctx, self.arc_dsc, self.p1, 1 * (bar + inter_bar) + bar_offset - 1, 270 - angle, 270 + angle)
|
||||
self.arc_dsc.color = self.percentage >= 75 ? on_color : off_color
|
||||
lv.draw_arc(draw_ctx, self.arc_dsc, self.p1, 2 * (bar + inter_bar) + bar_offset - 2, 270 - angle, 270 + angle)
|
||||
|
||||
#elif mode == lv.DESIGN_DRAW_POST # commented since we don't want a frame around this object
|
||||
# self.ancestor_design.call(self, clip_area, mode)
|
||||
|
|
|
@ -33,7 +33,7 @@ class lv_signal_bars : lv.obj
|
|||
var bar_offset = bar / 2
|
||||
|
||||
if code == lv.EVENT_DRAW_MAIN
|
||||
var clip_area = lv.area(event.param)
|
||||
var draw_ctx = lv.draw_ctx(event.param)
|
||||
|
||||
# get coordinates of object
|
||||
self.get_coords(self.area)
|
||||
|
@ -56,7 +56,7 @@ class lv_signal_bars : lv.obj
|
|||
self.p1.x = x_ofs + i * (bar + inter_bar) + bar_offset
|
||||
self.p2.y = y_ofs + ((3 - i) * (height - bar)) / 4 + bar_offset
|
||||
self.p2.x = self.p1.x
|
||||
lv.draw_line(self.p1, self.p2, clip_area, self.line_dsc)
|
||||
lv.draw_line(draw_ctx, self.line_dsc, self.p1, self.p2)
|
||||
end
|
||||
lv.event_send(self, lv.EVENT_DRAW_PART_END, self.line_dsc)
|
||||
end
|
||||
|
|
|
@ -13,6 +13,7 @@ def init(lv_tasmota)
|
|||
|
||||
lv.font_seg7 = lv_tasmota.font_seg7
|
||||
lv.seg7_font = lv_tasmota.font_seg7
|
||||
lv.font_embedded = lv_tasmota.font_embedded
|
||||
|
||||
lv.load_freetype_font = lv_tasmota.load_freetype_font
|
||||
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
#define DARK_COLOR_TEXT lv_color_hex(0xefefef)
|
||||
#define DARK_COLOR_GREY lv_color_hex(0x2f3237)
|
||||
|
||||
#define TRANSITION_TIME LV_THEME_DEFAULT_TRANSITON_TIME
|
||||
#define TRANSITION_TIME LV_THEME_DEFAULT_TRANSITION_TIME
|
||||
#define BORDER_WIDTH lv_disp_dpx(theme.disp, 2)
|
||||
#define OUTLINE_WIDTH lv_disp_dpx(theme.disp, 3)
|
||||
|
||||
|
|
|
@ -15,6 +15,7 @@
|
|||
"+<base/ftsystem.c>",
|
||||
"+<base/ftinit.c>",
|
||||
"+<base/ftdebug.c>",
|
||||
"+<base/ftbitmap.c>",
|
||||
|
||||
"+<base/ftbase.c>",
|
||||
|
||||
|
|
|
@ -29,6 +29,8 @@ const be_ntv_func_def_t lv_style_func[] = {
|
|||
{ "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" } },
|
||||
|
@ -216,6 +218,7 @@ const be_ntv_func_def_t lv_obj_func[] = {
|
|||
{ "get_content_width", { (const void*) &lv_obj_get_content_width, "i", "(lv.lv_obj)" } },
|
||||
{ "get_coords", { (const void*) &lv_obj_get_coords, "", "(lv.lv_obj)(lv.lv_area)" } },
|
||||
{ "get_disp", { (const void*) &lv_obj_get_disp, "lv.lv_disp", "(lv.lv_obj)" } },
|
||||
{ "get_event_user_data", { (const void*) &lv_obj_get_event_user_data, ".", "(lv.lv_obj)^lv_event_cb^" } },
|
||||
{ "get_group", { (const void*) &lv_obj_get_group, ".", "(lv.lv_obj)" } },
|
||||
{ "get_height", { (const void*) &lv_obj_get_height, "i", "(lv.lv_obj)" } },
|
||||
{ "get_index", { (const void*) &lv_obj_get_index, "i", "(lv.lv_obj)" } },
|
||||
|
@ -249,6 +252,8 @@ const be_ntv_func_def_t lv_obj_func[] = {
|
|||
{ "get_style_base_dir", { (const void*) &lv_obj_get_style_base_dir, "i", "(lv.lv_obj)i" } },
|
||||
{ "get_style_bg_color", { (const void*) &lv_obj_get_style_bg_color, "lv.lv_color", "(lv.lv_obj)i" } },
|
||||
{ "get_style_bg_color_filtered", { (const void*) &lv_obj_get_style_bg_color_filtered, "lv.lv_color", "(lv.lv_obj)i" } },
|
||||
{ "get_style_bg_dither_mode", { (const void*) &lv_obj_get_style_bg_dither_mode, "i", "(lv.lv_obj)i" } },
|
||||
{ "get_style_bg_grad", { (const void*) &lv_obj_get_style_bg_grad, "lv.lv_grad_dsc", "(lv.lv_obj)i" } },
|
||||
{ "get_style_bg_grad_color", { (const void*) &lv_obj_get_style_bg_grad_color, "lv.lv_color", "(lv.lv_obj)i" } },
|
||||
{ "get_style_bg_grad_color_filtered", { (const void*) &lv_obj_get_style_bg_grad_color_filtered, "lv.lv_color", "(lv.lv_obj)i" } },
|
||||
{ "get_style_bg_grad_dir", { (const void*) &lv_obj_get_style_bg_grad_dir, "i", "(lv.lv_obj)i" } },
|
||||
|
@ -387,6 +392,7 @@ const be_ntv_func_def_t lv_obj_func[] = {
|
|||
{ "remove_style", { (const void*) &lv_obj_remove_style, "", "(lv.lv_obj)(lv.lv_style)i" } },
|
||||
{ "remove_style_all", { (const void*) &lv_obj_remove_style_all, "", "(lv.lv_obj)" } },
|
||||
{ "scroll_by", { (const void*) &lv_obj_scroll_by, "", "(lv.lv_obj)ii(lv.lv_anim_enable)" } },
|
||||
{ "scroll_by_bounded", { (const void*) &lv_obj_scroll_by_bounded, "", "(lv.lv_obj)ii(lv.lv_anim_enable)" } },
|
||||
{ "scroll_to", { (const void*) &lv_obj_scroll_to, "", "(lv.lv_obj)ii(lv.lv_anim_enable)" } },
|
||||
{ "scroll_to_view", { (const void*) &lv_obj_scroll_to_view, "", "(lv.lv_obj)(lv.lv_anim_enable)" } },
|
||||
{ "scroll_to_view_recursive", { (const void*) &lv_obj_scroll_to_view_recursive, "", "(lv.lv_obj)(lv.lv_anim_enable)" } },
|
||||
|
@ -425,6 +431,8 @@ const be_ntv_func_def_t lv_obj_func[] = {
|
|||
{ "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" } },
|
||||
|
@ -822,6 +830,7 @@ const be_ntv_func_def_t lv_dropdown_func[] = {
|
|||
{ "get_selected_str", { (const void*) &lv_dropdown_get_selected_str, "", "(lv.lv_obj)si" } },
|
||||
{ "get_symbol", { (const void*) &lv_dropdown_get_symbol, "s", "(lv.lv_obj)" } },
|
||||
{ "get_text", { (const void*) &lv_dropdown_get_text, "s", "(lv.lv_obj)" } },
|
||||
{ "is_open", { (const void*) &lv_dropdown_is_open, "b", "(lv.lv_obj)" } },
|
||||
{ "open", { (const void*) &lv_dropdown_open, "", "(lv.lv_obj)" } },
|
||||
{ "set_dir", { (const void*) &lv_dropdown_set_dir, "", "(lv.lv_obj)i" } },
|
||||
{ "set_options", { (const void*) &lv_dropdown_set_options, "", "(lv.lv_obj)s" } },
|
||||
|
|
|
@ -53,15 +53,17 @@ const be_ntv_func_def_t lv_func[] = {
|
|||
{ "color_to_hsv", { (const void*) &lv_color_to_hsv, "i", "(lv.lv_color)" } },
|
||||
{ "color_white", { (const void*) &lv_color_white, "lv.lv_color", "" } },
|
||||
{ "dpx", { (const void*) &lv_dpx, "i", "i" } },
|
||||
{ "draw_arc", { (const void*) &lv_draw_arc, "", "iiiii(lv.lv_area)(lv.lv_draw_arc_dsc)" } },
|
||||
{ "draw_arc", { (const void*) &lv_draw_arc, "", "(lv.lv_draw_ctx)(lv.lv_draw_arc_dsc)(lv.lv_point)iii" } },
|
||||
{ "draw_arc_dsc_init", { (const void*) &lv_draw_arc_dsc_init, "", "(lv.lv_draw_arc_dsc)" } },
|
||||
{ "draw_arc_get_area", { (const void*) &lv_draw_arc_get_area, "", "iiiiiib(lv.lv_area)" } },
|
||||
{ "draw_img", { (const void*) &lv_draw_img, "", "(lv.lv_area)(lv.lv_area).(lv.lv_draw_img_dsc)" } },
|
||||
{ "draw_img", { (const void*) &lv_draw_img, "", "(lv.lv_draw_ctx)(lv.lv_draw_img_dsc)(lv.lv_area)." } },
|
||||
{ "draw_img_decoded", { (const void*) &lv_draw_img_decoded, "", "(lv.lv_draw_ctx)(lv.lv_draw_img_dsc)(lv.lv_area)(lv.uint8)i" } },
|
||||
{ "draw_img_dsc_init", { (const void*) &lv_draw_img_dsc_init, "", "(lv.lv_draw_img_dsc)" } },
|
||||
{ "draw_label", { (const void*) &lv_draw_label, "", "(lv.lv_area)(lv.lv_area)(lv.lv_draw_label_dsc)s(lv.lv_draw_label_hint)" } },
|
||||
{ "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_letter", { (const void*) &lv_draw_letter, "", "(lv.lv_point)(lv.lv_area)(lv.lv_font)i(lv.lv_color)ii" } },
|
||||
{ "draw_line", { (const void*) &lv_draw_line, "", "(lv.lv_point)(lv.lv_point)(lv.lv_area)(lv.lv_draw_line_dsc)" } },
|
||||
{ "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)" } },
|
||||
{ "draw_mask_add", { (const void*) &lv_draw_mask_add, "i", ".." } },
|
||||
{ "draw_mask_angle_init", { (const void*) &lv_draw_mask_angle_init, "", "(lv.lv_draw_mask_angle_param)iiii" } },
|
||||
|
@ -74,17 +76,20 @@ const be_ntv_func_def_t lv_func[] = {
|
|||
{ "draw_mask_line_angle_init", { (const void*) &lv_draw_mask_line_angle_init, "", "(lv.lv_draw_mask_line_param)iiii" } },
|
||||
{ "draw_mask_line_points_init", { (const void*) &lv_draw_mask_line_points_init, "", "(lv.lv_draw_mask_line_param)iiiii" } },
|
||||
{ "draw_mask_map_init", { (const void*) &lv_draw_mask_map_init, "", "(lv.lv_draw_mask_map_param)(lv.lv_area)(lv.lv_opa)" } },
|
||||
{ "draw_mask_polygon_init", { (const void*) &lv_draw_mask_polygon_init, "", "(lv.lv_draw_mask_polygon_param)(lv.lv_point)i" } },
|
||||
{ "draw_mask_radius_init", { (const void*) &lv_draw_mask_radius_init, "", "(lv.lv_draw_mask_radius_param)(lv.lv_area)ib" } },
|
||||
{ "draw_mask_remove_custom", { (const void*) &lv_draw_mask_remove_custom, ".", "." } },
|
||||
{ "draw_mask_remove_id", { (const void*) &lv_draw_mask_remove_id, ".", "i" } },
|
||||
{ "draw_polygon", { (const void*) &lv_draw_polygon, "", "(lv.lv_point_arr)i(lv.lv_area)(lv.lv_draw_rect_dsc)" } },
|
||||
{ "draw_rect", { (const void*) &lv_draw_rect, "", "(lv.lv_area)(lv.lv_area)(lv.lv_draw_rect_dsc)" } },
|
||||
{ "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_triangle", { (const void*) &lv_draw_triangle, "", "(lv.lv_point_arr)(lv.lv_area)(lv.lv_draw_rect_dsc)" } },
|
||||
{ "draw_triangle", { (const void*) &lv_draw_triangle, "", "(lv.lv_draw_ctx)(lv.lv_draw_rect_dsc)(lv.lv_point_arr)" } },
|
||||
{ "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)" } },
|
||||
{ "event_set_ext_draw_size", { (const void*) &lv_event_set_ext_draw_size, "", "(lv.lv_event)i" } },
|
||||
{ "event_stop_bubbling", { (const void*) &lv_event_stop_bubbling, "", "(lv.lv_event)" } },
|
||||
{ "event_stop_processing", { (const void*) &lv_event_stop_processing, "", "(lv.lv_event)" } },
|
||||
{ "flex_init", { (const void*) &lv_flex_init, "", "" } },
|
||||
{ "get_hor_res", { (const void*) &lv_get_hor_res, "i", "" } },
|
||||
{ "get_ts_calibration", { (const void*) &lv_get_ts_calibration, "lv.lv_ts_calibration", "" } },
|
||||
|
@ -103,7 +108,7 @@ const be_ntv_func_def_t lv_func[] = {
|
|||
{ "layout_register", { (const void*) &lv_layout_register, "i", "^lv_layout_update_cb^." } },
|
||||
{ "obj_class_create_obj", { (const void*) &lv_obj_class_create_obj, "lv.lv_obj", "(lv._lv_obj_class)(lv.lv_obj)" } },
|
||||
{ "obj_del_anim_ready_cb", { (const void*) &lv_obj_del_anim_ready_cb, "", "(lv.lv_anim)" } },
|
||||
{ "obj_draw_dsc_init", { (const void*) &lv_obj_draw_dsc_init, "", "(lv.lv_obj_draw_part_dsc)(lv.lv_area)" } },
|
||||
{ "obj_draw_dsc_init", { (const void*) &lv_obj_draw_dsc_init, "", "(lv.lv_obj_draw_part_dsc)(lv.lv_draw_ctx)" } },
|
||||
{ "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)" } },
|
||||
|
@ -113,7 +118,11 @@ const be_ntv_func_def_t lv_func[] = {
|
|||
{ "palette_darken", { (const void*) &lv_palette_darken, "lv.lv_color", "ii" } },
|
||||
{ "palette_lighten", { (const void*) &lv_palette_lighten, "lv.lv_color", "ii" } },
|
||||
{ "palette_main", { (const void*) &lv_palette_main, "lv.lv_color", "i" } },
|
||||
{ "qrcode_create", { (const void*) &lv_qrcode_create, "lv.lv_obj", "(lv.lv_obj)i(lv.lv_color)(lv.lv_color)" } },
|
||||
{ "qrcode_delete", { (const void*) &lv_qrcode_delete, "", "(lv.lv_obj)" } },
|
||||
{ "qrcode_update", { (const void*) &lv_qrcode_update, "i", "(lv.lv_obj).i" } },
|
||||
{ "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" } },
|
||||
|
@ -188,6 +197,7 @@ const be_const_member_t lv0_constants[] = {
|
|||
{ "BLEND_MODE_ADDITIVE", be_cconst_int(LV_BLEND_MODE_ADDITIVE) },
|
||||
{ "BLEND_MODE_MULTIPLY", be_cconst_int(LV_BLEND_MODE_MULTIPLY) },
|
||||
{ "BLEND_MODE_NORMAL", be_cconst_int(LV_BLEND_MODE_NORMAL) },
|
||||
{ "BLEND_MODE_REPLACE", be_cconst_int(LV_BLEND_MODE_REPLACE) },
|
||||
{ "BLEND_MODE_SUBTRACTIVE", be_cconst_int(LV_BLEND_MODE_SUBTRACTIVE) },
|
||||
{ "BORDER_SIDE_BOTTOM", be_cconst_int(LV_BORDER_SIDE_BOTTOM) },
|
||||
{ "BORDER_SIDE_FULL", be_cconst_int(LV_BORDER_SIDE_FULL) },
|
||||
|
@ -260,6 +270,9 @@ const be_const_member_t lv0_constants[] = {
|
|||
{ "DISP_ROT_270", be_cconst_int(LV_DISP_ROT_270) },
|
||||
{ "DISP_ROT_90", be_cconst_int(LV_DISP_ROT_90) },
|
||||
{ "DISP_ROT_NONE", be_cconst_int(LV_DISP_ROT_NONE) },
|
||||
{ "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_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) },
|
||||
|
@ -272,6 +285,7 @@ const be_const_member_t lv0_constants[] = {
|
|||
{ "DRAW_MASK_TYPE_FADE", be_cconst_int(LV_DRAW_MASK_TYPE_FADE) },
|
||||
{ "DRAW_MASK_TYPE_LINE", be_cconst_int(LV_DRAW_MASK_TYPE_LINE) },
|
||||
{ "DRAW_MASK_TYPE_MAP", be_cconst_int(LV_DRAW_MASK_TYPE_MAP) },
|
||||
{ "DRAW_MASK_TYPE_POLYGON", be_cconst_int(LV_DRAW_MASK_TYPE_POLYGON) },
|
||||
{ "DRAW_MASK_TYPE_RADIUS", be_cconst_int(LV_DRAW_MASK_TYPE_RADIUS) },
|
||||
{ "EVENT_ALL", be_cconst_int(LV_EVENT_ALL) },
|
||||
{ "EVENT_CANCEL", be_cconst_int(LV_EVENT_CANCEL) },
|
||||
|
@ -300,6 +314,7 @@ const be_const_member_t lv0_constants[] = {
|
|||
{ "EVENT_LEAVE", be_cconst_int(LV_EVENT_LEAVE) },
|
||||
{ "EVENT_LONG_PRESSED", be_cconst_int(LV_EVENT_LONG_PRESSED) },
|
||||
{ "EVENT_LONG_PRESSED_REPEAT", be_cconst_int(LV_EVENT_LONG_PRESSED_REPEAT) },
|
||||
{ "EVENT_PREPROCESS", be_cconst_int(LV_EVENT_PREPROCESS) },
|
||||
{ "EVENT_PRESSED", be_cconst_int(LV_EVENT_PRESSED) },
|
||||
{ "EVENT_PRESSING", be_cconst_int(LV_EVENT_PRESSING) },
|
||||
{ "EVENT_PRESS_LOST", be_cconst_int(LV_EVENT_PRESS_LOST) },
|
||||
|
@ -420,6 +435,11 @@ const be_const_member_t lv0_constants[] = {
|
|||
{ "LABEL_LONG_SCROLL_CIRCULAR", be_cconst_int(LV_LABEL_LONG_SCROLL_CIRCULAR) },
|
||||
{ "LABEL_LONG_WRAP", be_cconst_int(LV_LABEL_LONG_WRAP) },
|
||||
{ "LED_DRAW_PART_RECTANGLE", be_cconst_int(LV_LED_DRAW_PART_RECTANGLE) },
|
||||
{ "MENU_HEADER_BOTTOM_FIXED", be_cconst_int(LV_MENU_HEADER_BOTTOM_FIXED) },
|
||||
{ "MENU_HEADER_TOP_FIXED", be_cconst_int(LV_MENU_HEADER_TOP_FIXED) },
|
||||
{ "MENU_HEADER_TOP_UNFIXED", be_cconst_int(LV_MENU_HEADER_TOP_UNFIXED) },
|
||||
{ "MENU_ROOT_BACK_BTN_DISABLED", be_cconst_int(LV_MENU_ROOT_BACK_BTN_DISABLED) },
|
||||
{ "MENU_ROOT_BACK_BTN_ENABLED", be_cconst_int(LV_MENU_ROOT_BACK_BTN_ENABLED) },
|
||||
{ "METER_DRAW_PART_ARC", be_cconst_int(LV_METER_DRAW_PART_ARC) },
|
||||
{ "METER_DRAW_PART_NEEDLE_IMG", be_cconst_int(LV_METER_DRAW_PART_NEEDLE_IMG) },
|
||||
{ "METER_DRAW_PART_NEEDLE_LINE", be_cconst_int(LV_METER_DRAW_PART_NEEDLE_LINE) },
|
||||
|
@ -449,13 +469,17 @@ const be_const_member_t lv0_constants[] = {
|
|||
{ "OBJ_FLAG_IGNORE_LAYOUT", be_cconst_int(LV_OBJ_FLAG_IGNORE_LAYOUT) },
|
||||
{ "OBJ_FLAG_LAYOUT_1", be_cconst_int(LV_OBJ_FLAG_LAYOUT_1) },
|
||||
{ "OBJ_FLAG_LAYOUT_2", be_cconst_int(LV_OBJ_FLAG_LAYOUT_2) },
|
||||
{ "OBJ_FLAG_OVERFLOW_VISIBLE", be_cconst_int(LV_OBJ_FLAG_OVERFLOW_VISIBLE) },
|
||||
{ "OBJ_FLAG_PRESS_LOCK", be_cconst_int(LV_OBJ_FLAG_PRESS_LOCK) },
|
||||
{ "OBJ_FLAG_SCROLLABLE", be_cconst_int(LV_OBJ_FLAG_SCROLLABLE) },
|
||||
{ "OBJ_FLAG_SCROLL_CHAIN", be_cconst_int(LV_OBJ_FLAG_SCROLL_CHAIN) },
|
||||
{ "OBJ_FLAG_SCROLL_CHAIN_HOR", be_cconst_int(LV_OBJ_FLAG_SCROLL_CHAIN_HOR) },
|
||||
{ "OBJ_FLAG_SCROLL_CHAIN_VER", be_cconst_int(LV_OBJ_FLAG_SCROLL_CHAIN_VER) },
|
||||
{ "OBJ_FLAG_SCROLL_ELASTIC", be_cconst_int(LV_OBJ_FLAG_SCROLL_ELASTIC) },
|
||||
{ "OBJ_FLAG_SCROLL_MOMENTUM", be_cconst_int(LV_OBJ_FLAG_SCROLL_MOMENTUM) },
|
||||
{ "OBJ_FLAG_SCROLL_ONE", be_cconst_int(LV_OBJ_FLAG_SCROLL_ONE) },
|
||||
{ "OBJ_FLAG_SCROLL_ON_FOCUS", be_cconst_int(LV_OBJ_FLAG_SCROLL_ON_FOCUS) },
|
||||
{ "OBJ_FLAG_SCROLL_WITH_ARROW", be_cconst_int(LV_OBJ_FLAG_SCROLL_WITH_ARROW) },
|
||||
{ "OBJ_FLAG_SNAPPABLE", be_cconst_int(LV_OBJ_FLAG_SNAPPABLE) },
|
||||
{ "OBJ_FLAG_USER_1", be_cconst_int(LV_OBJ_FLAG_USER_1) },
|
||||
{ "OBJ_FLAG_USER_2", be_cconst_int(LV_OBJ_FLAG_USER_2) },
|
||||
|
@ -570,6 +594,8 @@ const be_const_member_t lv0_constants[] = {
|
|||
{ "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) },
|
||||
|
|
|
@ -50,11 +50,11 @@ extern int lvbe_style_set_prop(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);
|
||||
extern int lvbe_style_set_size(bvm *vm);
|
||||
extern int lvbe_style_set_pad_all(bvm *vm);
|
||||
extern int lvbe_style_set_pad_hor(bvm *vm);
|
||||
extern int lvbe_style_set_pad_ver(bvm *vm);
|
||||
extern int lvbe_style_set_pad_gap(bvm *vm);
|
||||
extern int lvbe_style_set_size(bvm *vm);
|
||||
extern int lvbe_style_set_width(bvm *vm);
|
||||
extern int lvbe_style_set_min_width(bvm *vm);
|
||||
extern int lvbe_style_set_max_width(bvm *vm);
|
||||
|
@ -76,17 +76,6 @@ extern int lvbe_style_set_pad_left(bvm *vm);
|
|||
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_radius(bvm *vm);
|
||||
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_time(bvm *vm);
|
||||
extern int lvbe_style_set_anim_speed(bvm *vm);
|
||||
extern int lvbe_style_set_transition(bvm *vm);
|
||||
extern int lvbe_style_set_blend_mode(bvm *vm);
|
||||
extern int lvbe_style_set_layout(bvm *vm);
|
||||
extern int lvbe_style_set_base_dir(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);
|
||||
|
@ -95,6 +84,8 @@ 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);
|
||||
extern int lvbe_style_set_bg_grad(bvm *vm);
|
||||
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);
|
||||
|
@ -107,18 +98,6 @@ 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_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);
|
||||
extern int lvbe_style_set_text_line_space(bvm *vm);
|
||||
extern int lvbe_style_set_text_decor(bvm *vm);
|
||||
extern int lvbe_style_set_text_align(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_outline_width(bvm *vm);
|
||||
extern int lvbe_style_set_outline_color(bvm *vm);
|
||||
extern int lvbe_style_set_outline_color_filtered(bvm *vm);
|
||||
|
@ -131,6 +110,10 @@ 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);
|
||||
|
@ -144,6 +127,25 @@ 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);
|
||||
extern int lvbe_style_set_text_line_space(bvm *vm);
|
||||
extern int lvbe_style_set_text_decor(bvm *vm);
|
||||
extern int lvbe_style_set_text_align(bvm *vm);
|
||||
extern int lvbe_style_set_radius(bvm *vm);
|
||||
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_time(bvm *vm);
|
||||
extern int lvbe_style_set_anim_speed(bvm *vm);
|
||||
extern int lvbe_style_set_transition(bvm *vm);
|
||||
extern int lvbe_style_set_blend_mode(bvm *vm);
|
||||
extern int lvbe_style_set_layout(bvm *vm);
|
||||
extern int lvbe_style_set_base_dir(bvm *vm);
|
||||
|
||||
/* `lv_font` external functions definitions */
|
||||
|
||||
|
@ -192,6 +194,7 @@ extern int lvbe_obj_add_event_cb(bvm *vm);
|
|||
extern int lvbe_obj_remove_event_cb(bvm *vm);
|
||||
extern int lvbe_obj_remove_event_cb_with_user_data(bvm *vm);
|
||||
extern int lvbe_obj_remove_event_dsc(bvm *vm);
|
||||
extern int lvbe_obj_get_event_user_data(bvm *vm);
|
||||
extern int lvbe_obj_create(bvm *vm);
|
||||
extern int lvbe_obj_add_flag(bvm *vm);
|
||||
extern int lvbe_obj_clear_flag(bvm *vm);
|
||||
|
@ -242,6 +245,8 @@ extern int lvbe_obj_get_x(bvm *vm);
|
|||
extern int lvbe_obj_get_x2(bvm *vm);
|
||||
extern int lvbe_obj_get_y(bvm *vm);
|
||||
extern int lvbe_obj_get_y2(bvm *vm);
|
||||
extern int lvbe_obj_get_x_aligned(bvm *vm);
|
||||
extern int lvbe_obj_get_y_aligned(bvm *vm);
|
||||
extern int lvbe_obj_get_width(bvm *vm);
|
||||
extern int lvbe_obj_get_height(bvm *vm);
|
||||
extern int lvbe_obj_get_content_width(bvm *vm);
|
||||
|
@ -276,6 +281,7 @@ extern int lvbe_obj_get_scroll_left(bvm *vm);
|
|||
extern int lvbe_obj_get_scroll_right(bvm *vm);
|
||||
extern int lvbe_obj_get_scroll_end(bvm *vm);
|
||||
extern int lvbe_obj_scroll_by(bvm *vm);
|
||||
extern int lvbe_obj_scroll_by_bounded(bvm *vm);
|
||||
extern int lvbe_obj_scroll_to(bvm *vm);
|
||||
extern int lvbe_obj_scroll_to_x(bvm *vm);
|
||||
extern int lvbe_obj_scroll_to_y(bvm *vm);
|
||||
|
@ -302,8 +308,6 @@ extern int lvbe_obj_set_style_pad_ver(bvm *vm);
|
|||
extern int lvbe_obj_set_style_pad_gap(bvm *vm);
|
||||
extern int lvbe_obj_set_style_size(bvm *vm);
|
||||
extern int lvbe_obj_calculate_style_text_align(bvm *vm);
|
||||
extern int lvbe_obj_get_x_aligned(bvm *vm);
|
||||
extern int lvbe_obj_get_y_aligned(bvm *vm);
|
||||
extern int lvbe_obj_get_style_width(bvm *vm);
|
||||
extern int lvbe_obj_get_style_min_width(bvm *vm);
|
||||
extern int lvbe_obj_get_style_max_width(bvm *vm);
|
||||
|
@ -325,17 +329,6 @@ extern int lvbe_obj_get_style_pad_left(bvm *vm);
|
|||
extern int lvbe_obj_get_style_pad_right(bvm *vm);
|
||||
extern int lvbe_obj_get_style_pad_row(bvm *vm);
|
||||
extern int lvbe_obj_get_style_pad_column(bvm *vm);
|
||||
extern int lvbe_obj_get_style_radius(bvm *vm);
|
||||
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_time(bvm *vm);
|
||||
extern int lvbe_obj_get_style_anim_speed(bvm *vm);
|
||||
extern int lvbe_obj_get_style_transition(bvm *vm);
|
||||
extern int lvbe_obj_get_style_blend_mode(bvm *vm);
|
||||
extern int lvbe_obj_get_style_layout(bvm *vm);
|
||||
extern int lvbe_obj_get_style_base_dir(bvm *vm);
|
||||
extern int lvbe_obj_get_style_bg_color(bvm *vm);
|
||||
extern int lvbe_obj_get_style_bg_color_filtered(bvm *vm);
|
||||
extern int lvbe_obj_get_style_bg_opa(bvm *vm);
|
||||
|
@ -344,6 +337,8 @@ extern int lvbe_obj_get_style_bg_grad_color_filtered(bvm *vm);
|
|||
extern int lvbe_obj_get_style_bg_grad_dir(bvm *vm);
|
||||
extern int lvbe_obj_get_style_bg_main_stop(bvm *vm);
|
||||
extern int lvbe_obj_get_style_bg_grad_stop(bvm *vm);
|
||||
extern int lvbe_obj_get_style_bg_grad(bvm *vm);
|
||||
extern int lvbe_obj_get_style_bg_dither_mode(bvm *vm);
|
||||
extern int lvbe_obj_get_style_bg_img_src(bvm *vm);
|
||||
extern int lvbe_obj_get_style_bg_img_opa(bvm *vm);
|
||||
extern int lvbe_obj_get_style_bg_img_recolor(bvm *vm);
|
||||
|
@ -356,18 +351,6 @@ extern int lvbe_obj_get_style_border_opa(bvm *vm);
|
|||
extern int lvbe_obj_get_style_border_width(bvm *vm);
|
||||
extern int lvbe_obj_get_style_border_side(bvm *vm);
|
||||
extern int lvbe_obj_get_style_border_post(bvm *vm);
|
||||
extern int lvbe_obj_get_style_text_color(bvm *vm);
|
||||
extern int lvbe_obj_get_style_text_color_filtered(bvm *vm);
|
||||
extern int lvbe_obj_get_style_text_opa(bvm *vm);
|
||||
extern int lvbe_obj_get_style_text_font(bvm *vm);
|
||||
extern int lvbe_obj_get_style_text_letter_space(bvm *vm);
|
||||
extern int lvbe_obj_get_style_text_line_space(bvm *vm);
|
||||
extern int lvbe_obj_get_style_text_decor(bvm *vm);
|
||||
extern int lvbe_obj_get_style_text_align(bvm *vm);
|
||||
extern int lvbe_obj_get_style_img_opa(bvm *vm);
|
||||
extern int lvbe_obj_get_style_img_recolor(bvm *vm);
|
||||
extern int lvbe_obj_get_style_img_recolor_filtered(bvm *vm);
|
||||
extern int lvbe_obj_get_style_img_recolor_opa(bvm *vm);
|
||||
extern int lvbe_obj_get_style_outline_width(bvm *vm);
|
||||
extern int lvbe_obj_get_style_outline_color(bvm *vm);
|
||||
extern int lvbe_obj_get_style_outline_color_filtered(bvm *vm);
|
||||
|
@ -380,6 +363,10 @@ extern int lvbe_obj_get_style_shadow_spread(bvm *vm);
|
|||
extern int lvbe_obj_get_style_shadow_color(bvm *vm);
|
||||
extern int lvbe_obj_get_style_shadow_color_filtered(bvm *vm);
|
||||
extern int lvbe_obj_get_style_shadow_opa(bvm *vm);
|
||||
extern int lvbe_obj_get_style_img_opa(bvm *vm);
|
||||
extern int lvbe_obj_get_style_img_recolor(bvm *vm);
|
||||
extern int lvbe_obj_get_style_img_recolor_filtered(bvm *vm);
|
||||
extern int lvbe_obj_get_style_img_recolor_opa(bvm *vm);
|
||||
extern int lvbe_obj_get_style_line_width(bvm *vm);
|
||||
extern int lvbe_obj_get_style_line_dash_width(bvm *vm);
|
||||
extern int lvbe_obj_get_style_line_dash_gap(bvm *vm);
|
||||
|
@ -393,6 +380,25 @@ extern int lvbe_obj_get_style_arc_color(bvm *vm);
|
|||
extern int lvbe_obj_get_style_arc_color_filtered(bvm *vm);
|
||||
extern int lvbe_obj_get_style_arc_opa(bvm *vm);
|
||||
extern int lvbe_obj_get_style_arc_img_src(bvm *vm);
|
||||
extern int lvbe_obj_get_style_text_color(bvm *vm);
|
||||
extern int lvbe_obj_get_style_text_color_filtered(bvm *vm);
|
||||
extern int lvbe_obj_get_style_text_opa(bvm *vm);
|
||||
extern int lvbe_obj_get_style_text_font(bvm *vm);
|
||||
extern int lvbe_obj_get_style_text_letter_space(bvm *vm);
|
||||
extern int lvbe_obj_get_style_text_line_space(bvm *vm);
|
||||
extern int lvbe_obj_get_style_text_decor(bvm *vm);
|
||||
extern int lvbe_obj_get_style_text_align(bvm *vm);
|
||||
extern int lvbe_obj_get_style_radius(bvm *vm);
|
||||
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_time(bvm *vm);
|
||||
extern int lvbe_obj_get_style_anim_speed(bvm *vm);
|
||||
extern int lvbe_obj_get_style_transition(bvm *vm);
|
||||
extern int lvbe_obj_get_style_blend_mode(bvm *vm);
|
||||
extern int lvbe_obj_get_style_layout(bvm *vm);
|
||||
extern int lvbe_obj_get_style_base_dir(bvm *vm);
|
||||
extern int lvbe_obj_set_style_width(bvm *vm);
|
||||
extern int lvbe_obj_set_style_min_width(bvm *vm);
|
||||
extern int lvbe_obj_set_style_max_width(bvm *vm);
|
||||
|
@ -414,17 +420,6 @@ extern int lvbe_obj_set_style_pad_left(bvm *vm);
|
|||
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_radius(bvm *vm);
|
||||
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_time(bvm *vm);
|
||||
extern int lvbe_obj_set_style_anim_speed(bvm *vm);
|
||||
extern int lvbe_obj_set_style_transition(bvm *vm);
|
||||
extern int lvbe_obj_set_style_blend_mode(bvm *vm);
|
||||
extern int lvbe_obj_set_style_layout(bvm *vm);
|
||||
extern int lvbe_obj_set_style_base_dir(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);
|
||||
|
@ -433,6 +428,8 @@ 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);
|
||||
extern int lvbe_obj_set_style_bg_grad(bvm *vm);
|
||||
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);
|
||||
|
@ -445,18 +442,6 @@ 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_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);
|
||||
extern int lvbe_obj_set_style_text_line_space(bvm *vm);
|
||||
extern int lvbe_obj_set_style_text_decor(bvm *vm);
|
||||
extern int lvbe_obj_set_style_text_align(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_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);
|
||||
|
@ -469,6 +454,10 @@ 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);
|
||||
|
@ -482,6 +471,25 @@ 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);
|
||||
extern int lvbe_obj_set_style_text_line_space(bvm *vm);
|
||||
extern int lvbe_obj_set_style_text_decor(bvm *vm);
|
||||
extern int lvbe_obj_set_style_text_align(bvm *vm);
|
||||
extern int lvbe_obj_set_style_radius(bvm *vm);
|
||||
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_time(bvm *vm);
|
||||
extern int lvbe_obj_set_style_anim_speed(bvm *vm);
|
||||
extern int lvbe_obj_set_style_transition(bvm *vm);
|
||||
extern int lvbe_obj_set_style_blend_mode(bvm *vm);
|
||||
extern int lvbe_obj_set_style_layout(bvm *vm);
|
||||
extern int lvbe_obj_set_style_base_dir(bvm *vm);
|
||||
extern int lvbe_obj_del(bvm *vm);
|
||||
extern int lvbe_obj_clean(bvm *vm);
|
||||
extern int lvbe_obj_del_delayed(bvm *vm);
|
||||
|
@ -788,6 +796,7 @@ extern int lvbe_dropdown_get_selected_highlight(bvm *vm);
|
|||
extern int lvbe_dropdown_get_dir(bvm *vm);
|
||||
extern int lvbe_dropdown_open(bvm *vm);
|
||||
extern int lvbe_dropdown_close(bvm *vm);
|
||||
extern int lvbe_dropdown_is_open(bvm *vm);
|
||||
|
||||
/* `lv_label` external functions definitions */
|
||||
extern int lvbe_label_create(bvm *vm);
|
||||
|
|
|
@ -173,6 +173,8 @@ LV_EVENT_SIZE_CHANGED
|
|||
LV_EVENT_STYLE_CHANGED
|
||||
LV_EVENT_LAYOUT_CHANGED
|
||||
LV_EVENT_GET_SELF_SIZE
|
||||
LV_EVENT_PREPROCESS
|
||||
|
||||
// File: ../../lvgl/src/core/lv_group.h
|
||||
LV_KEY_UP
|
||||
LV_KEY_DOWN
|
||||
|
@ -226,8 +228,11 @@ LV_OBJ_FLAG_SCROLLABLE
|
|||
LV_OBJ_FLAG_SCROLL_ELASTIC
|
||||
LV_OBJ_FLAG_SCROLL_MOMENTUM
|
||||
LV_OBJ_FLAG_SCROLL_ONE
|
||||
LV_OBJ_FLAG_SCROLL_CHAIN_HOR
|
||||
LV_OBJ_FLAG_SCROLL_CHAIN_VER
|
||||
LV_OBJ_FLAG_SCROLL_CHAIN
|
||||
LV_OBJ_FLAG_SCROLL_ON_FOCUS
|
||||
LV_OBJ_FLAG_SCROLL_WITH_ARROW
|
||||
LV_OBJ_FLAG_SNAPPABLE
|
||||
LV_OBJ_FLAG_PRESS_LOCK
|
||||
LV_OBJ_FLAG_EVENT_BUBBLE
|
||||
|
@ -235,6 +240,7 @@ LV_OBJ_FLAG_GESTURE_BUBBLE
|
|||
LV_OBJ_FLAG_ADV_HITTEST
|
||||
LV_OBJ_FLAG_IGNORE_LAYOUT
|
||||
LV_OBJ_FLAG_FLOATING
|
||||
LV_OBJ_FLAG_OVERFLOW_VISIBLE
|
||||
LV_OBJ_FLAG_LAYOUT_1
|
||||
LV_OBJ_FLAG_LAYOUT_2
|
||||
LV_OBJ_FLAG_WIDGET_1
|
||||
|
@ -285,7 +291,6 @@ LV_OBJ_TREE_WALK_END
|
|||
// File: ../../lvgl/src/core/lv_theme.h
|
||||
// File: ../../lvgl/src/draw/lv_draw.h
|
||||
// File: ../../lvgl/src/draw/lv_draw_arc.h
|
||||
// File: ../../lvgl/src/draw/lv_draw_blend.h
|
||||
// File: ../../lvgl/src/draw/lv_draw_img.h
|
||||
// File: ../../lvgl/src/draw/lv_draw_label.h
|
||||
// File: ../../lvgl/src/draw/lv_draw_line.h
|
||||
|
@ -299,6 +304,7 @@ LV_DRAW_MASK_TYPE_ANGLE
|
|||
LV_DRAW_MASK_TYPE_RADIUS
|
||||
LV_DRAW_MASK_TYPE_FADE
|
||||
LV_DRAW_MASK_TYPE_MAP
|
||||
LV_DRAW_MASK_TYPE_POLYGON
|
||||
|
||||
LV_DRAW_MASK_LINE_SIDE_LEFT
|
||||
LV_DRAW_MASK_LINE_SIDE_RIGHT
|
||||
|
@ -404,6 +410,12 @@ LV_LED_DRAW_PART_RECTANGLE
|
|||
|
||||
// File: ../../lvgl/src/extra/widgets/list/lv_list.h
|
||||
// File: ../../lvgl/src/extra/widgets/lv_widgets.h
|
||||
// File: ../../lvgl/src/extra/widgets/menu/lv_menu.h
|
||||
LV_MENU_HEADER_TOP_FIXED
|
||||
LV_MENU_HEADER_TOP_UNFIXED
|
||||
LV_MENU_HEADER_BOTTOM_FIXED
|
||||
LV_MENU_ROOT_BACK_BTN_DISABLED
|
||||
LV_MENU_ROOT_BACK_BTN_ENABLED
|
||||
// File: ../../lvgl/src/extra/widgets/meter/lv_meter.h
|
||||
LV_METER_INDICATOR_TYPE_NEEDLE_IMG
|
||||
LV_METER_INDICATOR_TYPE_NEEDLE_LINE
|
||||
|
@ -553,6 +565,7 @@ LV_FS_SEEK_END
|
|||
// File: ../../lvgl/src/misc/lv_gc.h
|
||||
// File: ../../lvgl/src/misc/lv_ll.h
|
||||
// File: ../../lvgl/src/misc/lv_log.h
|
||||
// File: ../../lvgl/src/misc/lv_lru.h
|
||||
// File: ../../lvgl/src/misc/lv_math.h
|
||||
// File: ../../lvgl/src/misc/lv_mem.h
|
||||
// File: ../../lvgl/src/misc/lv_printf.h
|
||||
|
@ -561,6 +574,7 @@ LV_BLEND_MODE_NORMAL
|
|||
LV_BLEND_MODE_ADDITIVE
|
||||
LV_BLEND_MODE_SUBTRACTIVE
|
||||
LV_BLEND_MODE_MULTIPLY
|
||||
LV_BLEND_MODE_REPLACE
|
||||
|
||||
LV_TEXT_DECOR_NONE
|
||||
LV_TEXT_DECOR_UNDERLINE
|
||||
|
@ -578,6 +592,10 @@ LV_GRAD_DIR_NONE
|
|||
LV_GRAD_DIR_VER
|
||||
LV_GRAD_DIR_HOR
|
||||
|
||||
LV_DITHER_NONE
|
||||
LV_DITHER_ORDERED
|
||||
LV_DITHER_ERR_DIFF
|
||||
|
||||
LV_STYLE_PROP_INV
|
||||
LV_STYLE_WIDTH
|
||||
LV_STYLE_MIN_WIDTH
|
||||
|
@ -608,6 +626,8 @@ LV_STYLE_BG_GRAD_COLOR_FILTERED
|
|||
LV_STYLE_BG_GRAD_DIR
|
||||
LV_STYLE_BG_MAIN_STOP
|
||||
LV_STYLE_BG_GRAD_STOP
|
||||
LV_STYLE_BG_GRAD
|
||||
LV_STYLE_BG_DITHER_MODE
|
||||
LV_STYLE_BG_IMG_SRC
|
||||
LV_STYLE_BG_IMG_OPA
|
||||
LV_STYLE_BG_IMG_RECOLOR
|
||||
|
|
|
@ -54,11 +54,14 @@ static inline lv_coord_t lv_disp_dpx(const lv_disp_t * disp, lv_coord_t n)
|
|||
// ../../lvgl/src/core/lv_event.h
|
||||
lv_res_t lv_event_send(struct _lv_obj_t * obj, lv_event_code_t event_code, void * param)
|
||||
lv_res_t lv_obj_event_base(const lv_obj_class_t * class_p, lv_event_t * e)
|
||||
void lv_event_stop_bubbling(lv_event_t * e)
|
||||
void lv_event_stop_processing(lv_event_t * e)
|
||||
uint32_t lv_event_register_id(void)
|
||||
struct _lv_event_dsc_t * lv_obj_add_event_cb(struct _lv_obj_t * obj, lv_event_cb_t event_cb, lv_event_code_t filter, void * user_data)
|
||||
bool lv_obj_remove_event_cb(struct _lv_obj_t * obj, lv_event_cb_t event_cb)
|
||||
bool lv_obj_remove_event_cb_with_user_data(struct _lv_obj_t * obj, lv_event_cb_t event_cb, const void * event_user_data)
|
||||
bool lv_obj_remove_event_dsc(struct _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)
|
||||
void lv_event_set_ext_draw_size(lv_event_t * e, lv_coord_t size)
|
||||
void lv_event_set_cover_res(lv_event_t * e, lv_cover_res_t res)
|
||||
|
||||
|
@ -143,7 +146,7 @@ void lv_obj_init_draw_img_dsc(struct _lv_obj_t * obj, uint32_t part, lv_draw_img
|
|||
void lv_obj_init_draw_line_dsc(struct _lv_obj_t * obj, uint32_t part, lv_draw_line_dsc_t * draw_dsc)
|
||||
void lv_obj_init_draw_arc_dsc(struct _lv_obj_t * obj, uint32_t part, lv_draw_arc_dsc_t * draw_dsc)
|
||||
lv_coord_t lv_obj_calculate_ext_draw_size(struct _lv_obj_t * obj, uint32_t part)
|
||||
void lv_obj_draw_dsc_init(lv_obj_draw_part_dsc_t * dsc, const lv_area_t * clip_area)
|
||||
void lv_obj_draw_dsc_init(lv_obj_draw_part_dsc_t * dsc, lv_draw_ctx_t * draw_ctx)
|
||||
bool lv_obj_draw_part_check_type(lv_obj_draw_part_dsc_t * dsc, const struct _lv_obj_class_t * class_p, uint32_t type)
|
||||
void lv_obj_refresh_ext_draw_size(struct _lv_obj_t * obj)
|
||||
|
||||
|
@ -171,6 +174,8 @@ lv_coord_t lv_obj_get_x(const struct _lv_obj_t * obj)
|
|||
lv_coord_t lv_obj_get_x2(const struct _lv_obj_t * obj)
|
||||
lv_coord_t lv_obj_get_y(const struct _lv_obj_t * obj)
|
||||
lv_coord_t lv_obj_get_y2(const struct _lv_obj_t * obj)
|
||||
lv_coord_t lv_obj_get_x_aligned(const struct _lv_obj_t * obj)
|
||||
lv_coord_t lv_obj_get_y_aligned(const struct _lv_obj_t * obj)
|
||||
lv_coord_t lv_obj_get_width(const struct _lv_obj_t * obj)
|
||||
lv_coord_t lv_obj_get_height(const struct _lv_obj_t * obj)
|
||||
lv_coord_t lv_obj_get_content_width(const struct _lv_obj_t * obj)
|
||||
|
@ -209,6 +214,7 @@ lv_coord_t lv_obj_get_scroll_left(struct _lv_obj_t * obj)
|
|||
lv_coord_t lv_obj_get_scroll_right(struct _lv_obj_t * obj)
|
||||
void lv_obj_get_scroll_end(struct _lv_obj_t * obj, lv_point_t * end)
|
||||
void lv_obj_scroll_by(struct _lv_obj_t * obj, lv_coord_t x, lv_coord_t y, lv_anim_enable_t anim_en)
|
||||
void lv_obj_scroll_by_bounded(struct _lv_obj_t * obj, lv_coord_t dx, lv_coord_t dy, lv_anim_enable_t anim_en)
|
||||
void lv_obj_scroll_to(struct _lv_obj_t * obj, lv_coord_t x, lv_coord_t y, lv_anim_enable_t anim_en)
|
||||
void lv_obj_scroll_to_x(struct _lv_obj_t * obj, lv_coord_t x, lv_anim_enable_t anim_en)
|
||||
void lv_obj_scroll_to_y(struct _lv_obj_t * obj, lv_coord_t y, lv_anim_enable_t anim_en)
|
||||
|
@ -241,8 +247,6 @@ static inline void lv_obj_set_style_pad_ver(struct _lv_obj_t * obj, lv_coord_t v
|
|||
static inline void lv_obj_set_style_pad_gap(struct _lv_obj_t * obj, lv_coord_t value, lv_style_selector_t selector)
|
||||
static inline void lv_obj_set_style_size(struct _lv_obj_t * obj, lv_coord_t value, lv_style_selector_t selector)
|
||||
lv_text_align_t lv_obj_calculate_style_text_align(const struct _lv_obj_t * obj, lv_part_t part, const char * txt)
|
||||
static inline lv_coord_t lv_obj_get_x_aligned(const struct _lv_obj_t * obj)
|
||||
static inline lv_coord_t lv_obj_get_y_aligned(const struct _lv_obj_t * obj)
|
||||
|
||||
// ../../lvgl/src/core/lv_obj_style_gen.h
|
||||
static inline lv_coord_t lv_obj_get_style_width(const struct _lv_obj_t * obj, uint32_t part)
|
||||
|
@ -266,17 +270,6 @@ static inline lv_coord_t lv_obj_get_style_pad_left(const struct _lv_obj_t * obj,
|
|||
static inline lv_coord_t lv_obj_get_style_pad_right(const struct _lv_obj_t * obj, uint32_t part)
|
||||
static inline lv_coord_t lv_obj_get_style_pad_row(const struct _lv_obj_t * obj, uint32_t part)
|
||||
static inline lv_coord_t lv_obj_get_style_pad_column(const struct _lv_obj_t * obj, uint32_t part)
|
||||
static inline lv_coord_t lv_obj_get_style_radius(const struct _lv_obj_t * obj, uint32_t part)
|
||||
static inline bool lv_obj_get_style_clip_corner(const struct _lv_obj_t * obj, uint32_t part)
|
||||
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 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)
|
||||
static inline lv_blend_mode_t lv_obj_get_style_blend_mode(const struct _lv_obj_t * obj, uint32_t part)
|
||||
static inline uint16_t lv_obj_get_style_layout(const struct _lv_obj_t * obj, uint32_t part)
|
||||
static inline lv_base_dir_t lv_obj_get_style_base_dir(const struct _lv_obj_t * obj, uint32_t part)
|
||||
static inline lv_color_t lv_obj_get_style_bg_color(const struct _lv_obj_t * obj, uint32_t part)
|
||||
static inline lv_color_t lv_obj_get_style_bg_color_filtered(const struct _lv_obj_t * obj, uint32_t part)
|
||||
static inline lv_opa_t lv_obj_get_style_bg_opa(const struct _lv_obj_t * obj, uint32_t part)
|
||||
|
@ -285,6 +278,8 @@ static inline lv_color_t lv_obj_get_style_bg_grad_color_filtered(const struct _l
|
|||
static inline lv_grad_dir_t lv_obj_get_style_bg_grad_dir(const struct _lv_obj_t * obj, uint32_t part)
|
||||
static inline lv_coord_t lv_obj_get_style_bg_main_stop(const struct _lv_obj_t * obj, uint32_t part)
|
||||
static inline lv_coord_t lv_obj_get_style_bg_grad_stop(const struct _lv_obj_t * obj, uint32_t part)
|
||||
static inline const lv_grad_dsc_t * lv_obj_get_style_bg_grad(const struct _lv_obj_t * obj, uint32_t part)
|
||||
static inline lv_dither_mode_t lv_obj_get_style_bg_dither_mode(const struct _lv_obj_t * obj, uint32_t part)
|
||||
static inline const void * lv_obj_get_style_bg_img_src(const struct _lv_obj_t * obj, uint32_t part)
|
||||
static inline lv_opa_t lv_obj_get_style_bg_img_opa(const struct _lv_obj_t * obj, uint32_t part)
|
||||
static inline lv_color_t lv_obj_get_style_bg_img_recolor(const struct _lv_obj_t * obj, uint32_t part)
|
||||
|
@ -297,18 +292,6 @@ static inline lv_opa_t lv_obj_get_style_border_opa(const struct _lv_obj_t * obj,
|
|||
static inline lv_coord_t lv_obj_get_style_border_width(const struct _lv_obj_t * obj, uint32_t part)
|
||||
static inline lv_border_side_t lv_obj_get_style_border_side(const struct _lv_obj_t * obj, uint32_t part)
|
||||
static inline bool lv_obj_get_style_border_post(const struct _lv_obj_t * obj, uint32_t part)
|
||||
static inline lv_color_t lv_obj_get_style_text_color(const struct _lv_obj_t * obj, uint32_t part)
|
||||
static inline lv_color_t lv_obj_get_style_text_color_filtered(const struct _lv_obj_t * obj, uint32_t part)
|
||||
static inline lv_opa_t lv_obj_get_style_text_opa(const struct _lv_obj_t * obj, uint32_t part)
|
||||
static inline const lv_font_t * lv_obj_get_style_text_font(const struct _lv_obj_t * obj, uint32_t part)
|
||||
static inline lv_coord_t lv_obj_get_style_text_letter_space(const struct _lv_obj_t * obj, uint32_t part)
|
||||
static inline lv_coord_t lv_obj_get_style_text_line_space(const struct _lv_obj_t * obj, uint32_t part)
|
||||
static inline lv_text_decor_t lv_obj_get_style_text_decor(const struct _lv_obj_t * obj, uint32_t part)
|
||||
static inline lv_text_align_t lv_obj_get_style_text_align(const struct _lv_obj_t * obj, uint32_t part)
|
||||
static inline lv_opa_t lv_obj_get_style_img_opa(const struct _lv_obj_t * obj, uint32_t part)
|
||||
static inline lv_color_t lv_obj_get_style_img_recolor(const struct _lv_obj_t * obj, uint32_t part)
|
||||
static inline lv_color_t lv_obj_get_style_img_recolor_filtered(const struct _lv_obj_t * obj, uint32_t part)
|
||||
static inline lv_opa_t lv_obj_get_style_img_recolor_opa(const struct _lv_obj_t * obj, uint32_t part)
|
||||
static inline lv_coord_t lv_obj_get_style_outline_width(const struct _lv_obj_t * obj, uint32_t part)
|
||||
static inline lv_color_t lv_obj_get_style_outline_color(const struct _lv_obj_t * obj, uint32_t part)
|
||||
static inline lv_color_t lv_obj_get_style_outline_color_filtered(const struct _lv_obj_t * obj, uint32_t part)
|
||||
|
@ -321,6 +304,10 @@ static inline lv_coord_t lv_obj_get_style_shadow_spread(const struct _lv_obj_t *
|
|||
static inline lv_color_t lv_obj_get_style_shadow_color(const struct _lv_obj_t * obj, uint32_t part)
|
||||
static inline lv_color_t lv_obj_get_style_shadow_color_filtered(const struct _lv_obj_t * obj, uint32_t part)
|
||||
static inline lv_opa_t lv_obj_get_style_shadow_opa(const struct _lv_obj_t * obj, uint32_t part)
|
||||
static inline lv_opa_t lv_obj_get_style_img_opa(const struct _lv_obj_t * obj, uint32_t part)
|
||||
static inline lv_color_t lv_obj_get_style_img_recolor(const struct _lv_obj_t * obj, uint32_t part)
|
||||
static inline lv_color_t lv_obj_get_style_img_recolor_filtered(const struct _lv_obj_t * obj, uint32_t part)
|
||||
static inline lv_opa_t lv_obj_get_style_img_recolor_opa(const struct _lv_obj_t * obj, uint32_t part)
|
||||
static inline lv_coord_t lv_obj_get_style_line_width(const struct _lv_obj_t * obj, uint32_t part)
|
||||
static inline lv_coord_t lv_obj_get_style_line_dash_width(const struct _lv_obj_t * obj, uint32_t part)
|
||||
static inline lv_coord_t lv_obj_get_style_line_dash_gap(const struct _lv_obj_t * obj, uint32_t part)
|
||||
|
@ -334,6 +321,25 @@ 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)
|
||||
static inline lv_opa_t lv_obj_get_style_arc_opa(const struct _lv_obj_t * obj, uint32_t part)
|
||||
static inline const void * lv_obj_get_style_arc_img_src(const struct _lv_obj_t * obj, uint32_t part)
|
||||
static inline lv_color_t lv_obj_get_style_text_color(const struct _lv_obj_t * obj, uint32_t part)
|
||||
static inline lv_color_t lv_obj_get_style_text_color_filtered(const struct _lv_obj_t * obj, uint32_t part)
|
||||
static inline lv_opa_t lv_obj_get_style_text_opa(const struct _lv_obj_t * obj, uint32_t part)
|
||||
static inline const lv_font_t * lv_obj_get_style_text_font(const struct _lv_obj_t * obj, uint32_t part)
|
||||
static inline lv_coord_t lv_obj_get_style_text_letter_space(const struct _lv_obj_t * obj, uint32_t part)
|
||||
static inline lv_coord_t lv_obj_get_style_text_line_space(const struct _lv_obj_t * obj, uint32_t part)
|
||||
static inline lv_text_decor_t lv_obj_get_style_text_decor(const struct _lv_obj_t * obj, uint32_t part)
|
||||
static inline lv_text_align_t lv_obj_get_style_text_align(const struct _lv_obj_t * obj, uint32_t part)
|
||||
static inline lv_coord_t lv_obj_get_style_radius(const struct _lv_obj_t * obj, uint32_t part)
|
||||
static inline bool lv_obj_get_style_clip_corner(const struct _lv_obj_t * obj, uint32_t part)
|
||||
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 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)
|
||||
static inline lv_blend_mode_t lv_obj_get_style_blend_mode(const struct _lv_obj_t * obj, uint32_t part)
|
||||
static inline uint16_t lv_obj_get_style_layout(const struct _lv_obj_t * obj, uint32_t part)
|
||||
static inline lv_base_dir_t lv_obj_get_style_base_dir(const struct _lv_obj_t * obj, uint32_t part)
|
||||
void lv_obj_set_style_width(struct _lv_obj_t * obj, lv_coord_t value, lv_style_selector_t selector)
|
||||
void lv_obj_set_style_min_width(struct _lv_obj_t * obj, lv_coord_t value, lv_style_selector_t selector)
|
||||
void lv_obj_set_style_max_width(struct _lv_obj_t * obj, lv_coord_t value, lv_style_selector_t selector)
|
||||
|
@ -355,17 +361,6 @@ void lv_obj_set_style_pad_left(struct _lv_obj_t * obj, lv_coord_t value, lv_styl
|
|||
void lv_obj_set_style_pad_right(struct _lv_obj_t * obj, lv_coord_t value, lv_style_selector_t selector)
|
||||
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_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_opa(struct _lv_obj_t * obj, lv_opa_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_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)
|
||||
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)
|
||||
|
@ -374,6 +369,8 @@ void lv_obj_set_style_bg_grad_color_filtered(struct _lv_obj_t * obj, lv_color_t
|
|||
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)
|
||||
void lv_obj_set_style_bg_grad(struct _lv_obj_t * obj, const lv_grad_dsc_t * value, lv_style_selector_t selector)
|
||||
void lv_obj_set_style_bg_dither_mode(struct _lv_obj_t * obj, lv_dither_mode_t value, lv_style_selector_t selector)
|
||||
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)
|
||||
|
@ -386,18 +383,6 @@ void lv_obj_set_style_border_opa(struct _lv_obj_t * obj, lv_opa_t value, lv_styl
|
|||
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_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)
|
||||
void lv_obj_set_style_text_line_space(struct _lv_obj_t * obj, lv_coord_t value, lv_style_selector_t selector)
|
||||
void lv_obj_set_style_text_decor(struct _lv_obj_t * obj, lv_text_decor_t value, lv_style_selector_t selector)
|
||||
void lv_obj_set_style_text_align(struct _lv_obj_t * obj, lv_text_align_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_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)
|
||||
|
@ -410,6 +395,10 @@ void lv_obj_set_style_shadow_spread(struct _lv_obj_t * obj, lv_coord_t value, lv
|
|||
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)
|
||||
|
@ -423,6 +412,25 @@ void lv_obj_set_style_arc_color(struct _lv_obj_t * obj, lv_color_t value, lv_sty
|
|||
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)
|
||||
void lv_obj_set_style_text_line_space(struct _lv_obj_t * obj, lv_coord_t value, lv_style_selector_t selector)
|
||||
void lv_obj_set_style_text_decor(struct _lv_obj_t * obj, lv_text_decor_t value, lv_style_selector_t selector)
|
||||
void lv_obj_set_style_text_align(struct _lv_obj_t * obj, lv_text_align_t value, lv_style_selector_t selector)
|
||||
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_opa(struct _lv_obj_t * obj, lv_opa_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_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)
|
||||
|
||||
// ../../lvgl/src/core/lv_obj_tree.h
|
||||
void lv_obj_del(struct _lv_obj_t * obj)
|
||||
|
@ -443,6 +451,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)
|
||||
|
||||
// ../../lvgl/src/core/lv_theme.h
|
||||
lv_theme_t * lv_theme_get_from_obj(lv_obj_t * obj)
|
||||
|
@ -456,34 +465,34 @@ lv_color_t lv_theme_get_color_primary(lv_obj_t * obj)
|
|||
lv_color_t lv_theme_get_color_secondary(lv_obj_t * obj)
|
||||
|
||||
// ../../lvgl/src/draw/lv_draw.h
|
||||
void lv_draw_init(void)
|
||||
|
||||
// ../../lvgl/src/draw/lv_draw_arc.h
|
||||
void lv_draw_arc_dsc_init(lv_draw_arc_dsc_t * dsc)
|
||||
void lv_draw_arc(lv_coord_t center_x, lv_coord_t center_y, uint16_t radius, uint16_t start_angle, uint16_t end_angle, const lv_area_t * clip_area, const lv_draw_arc_dsc_t * dsc)
|
||||
void lv_draw_arc(struct _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)
|
||||
void lv_draw_arc_get_area(lv_coord_t x, lv_coord_t y, uint16_t radius, uint16_t start_angle, uint16_t end_angle, lv_coord_t w, bool rounded, lv_area_t * area)
|
||||
|
||||
// ../../lvgl/src/draw/lv_draw_blend.h
|
||||
|
||||
// ../../lvgl/src/draw/lv_draw_img.h
|
||||
void lv_draw_img_dsc_init(lv_draw_img_dsc_t * dsc)
|
||||
void lv_draw_img(const lv_area_t * coords, const lv_area_t * mask, const void * src, const lv_draw_img_dsc_t * dsc)
|
||||
void lv_draw_img(struct _lv_draw_ctx_t * draw_ctx, const lv_draw_img_dsc_t * dsc, const lv_area_t * coords, const void * src)
|
||||
void lv_draw_img_decoded(struct _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)
|
||||
lv_img_src_t lv_img_src_get_type(const void * src)
|
||||
|
||||
// ../../lvgl/src/draw/lv_draw_label.h
|
||||
void lv_draw_label_dsc_init(lv_draw_label_dsc_t * dsc)
|
||||
void lv_draw_label(const lv_area_t * coords, const lv_area_t * mask, const lv_draw_label_dsc_t * dsc, const char * txt, lv_draw_label_hint_t * hint)
|
||||
void lv_draw_letter(const lv_point_t * pos_p, const lv_area_t * clip_area, const lv_font_t * font_p, uint32_t letter, lv_color_t color, lv_opa_t opa, lv_blend_mode_t blend_mode)
|
||||
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_line.h
|
||||
void lv_draw_line(const lv_point_t * point1, const lv_point_t * point2, const lv_area_t * clip, const lv_draw_line_dsc_t * dsc)
|
||||
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)
|
||||
|
||||
// ../../lvgl/src/draw/lv_draw_mask.h
|
||||
static inline uint8_t lv_draw_mask_get_cnt(void)
|
||||
static inline bool lv_draw_mask_is_any(const lv_area_t * a)
|
||||
int16_t lv_draw_mask_add(void * param, void * custom_id)
|
||||
lv_draw_mask_res_t lv_draw_mask_apply(lv_opa_t * mask_buf, lv_coord_t abs_x, lv_coord_t abs_y, lv_coord_t len)
|
||||
lv_draw_mask_res_t lv_draw_mask_apply_ids(lv_opa_t * mask_buf, lv_coord_t abs_x, lv_coord_t abs_y, lv_coord_t len, const int16_t *ids, int16_t ids_count)
|
||||
lv_draw_mask_res_t lv_draw_mask_apply_ids(lv_opa_t * mask_buf, lv_coord_t abs_x, lv_coord_t abs_y, lv_coord_t len, const int16_t * ids, int16_t ids_count)
|
||||
void * lv_draw_mask_remove_id(int16_t id)
|
||||
void * lv_draw_mask_remove_custom(void * custom_id)
|
||||
void lv_draw_mask_free_param(void * p)
|
||||
|
@ -495,14 +504,15 @@ void lv_draw_mask_angle_init(lv_draw_mask_angle_param_t * param, lv_coord_t vert
|
|||
void lv_draw_mask_radius_init(lv_draw_mask_radius_param_t * param, const lv_area_t * rect, lv_coord_t radius, bool inv)
|
||||
void lv_draw_mask_fade_init(lv_draw_mask_fade_param_t * param, const lv_area_t * coords, lv_opa_t opa_top, lv_coord_t y_top, lv_opa_t opa_bottom, lv_coord_t y_bottom)
|
||||
void lv_draw_mask_map_init(lv_draw_mask_map_param_t * param, const lv_area_t * coords, const lv_opa_t * map)
|
||||
void lv_draw_mask_polygon_init(lv_draw_mask_polygon_param_t * param, const lv_point_t * points, uint16_t point_cnt)
|
||||
|
||||
// ../../lvgl/src/draw/lv_draw_rect.h
|
||||
void lv_draw_rect_dsc_init(lv_draw_rect_dsc_t * dsc)
|
||||
void lv_draw_rect(const lv_area_t * coords, const lv_area_t * clip, const 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_triangle.h
|
||||
void lv_draw_triangle(const lv_point_t points[], const lv_area_t * clip, const lv_draw_rect_dsc_t * draw_dsc)
|
||||
void lv_draw_polygon(const lv_point_t points[], uint16_t point_cnt, const lv_area_t * mask, const lv_draw_rect_dsc_t * draw_dsc)
|
||||
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[])
|
||||
|
||||
// ../../lvgl/src/draw/lv_img_buf.h
|
||||
|
||||
|
@ -570,6 +580,11 @@ static inline lv_coord_t lv_obj_get_style_grid_cell_y_align(const lv_obj_t * obj
|
|||
|
||||
// ../../lvgl/src/extra/layouts/lv_layouts.h
|
||||
|
||||
// ../../lvgl/src/extra/libs/qrcode/lv_qrcode.h
|
||||
lv_obj_t * lv_qrcode_create(lv_obj_t * parent, lv_coord_t size, lv_color_t dark_color, lv_color_t light_color)
|
||||
lv_res_t lv_qrcode_update(lv_obj_t * qrcode, const void * data, uint32_t data_len)
|
||||
void lv_qrcode_delete(lv_obj_t * qrcode)
|
||||
|
||||
// ../../lvgl/src/extra/themes/default/lv_theme_default.h
|
||||
lv_theme_t * lv_theme_default_init(lv_disp_t * disp, lv_color_t color_primary, lv_color_t color_secondary, bool dark, const lv_font_t * font)
|
||||
lv_theme_t * lv_theme_default_get(void)
|
||||
|
@ -676,7 +691,7 @@ 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_digit_step_direction(lv_obj_t * obj, lv_dir_t direction)
|
||||
bool lv_spinbox_get_rollover(lv_obj_t *obj)
|
||||
bool lv_spinbox_get_rollover(lv_obj_t * obj)
|
||||
int32_t lv_spinbox_get_value(lv_obj_t * obj)
|
||||
int32_t lv_spinbox_get_step(lv_obj_t * obj)
|
||||
void lv_spinbox_step_next(lv_obj_t * obj)
|
||||
|
@ -727,16 +742,16 @@ void lv_style_reset(lv_style_t * style)
|
|||
lv_style_prop_t lv_style_register_prop(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(lv_style_t * style, lv_style_prop_t prop, lv_style_value_t * value)
|
||||
static inline lv_res_t lv_style_get_prop_inlined(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_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)
|
||||
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 void lv_style_set_size(lv_style_t * style, lv_coord_t value)
|
||||
|
||||
// ../../lvgl/src/misc/lv_style_gen.h
|
||||
void lv_style_set_width(lv_style_t * style, lv_coord_t value)
|
||||
|
@ -760,17 +775,6 @@ void lv_style_set_pad_left(lv_style_t * style, lv_coord_t value)
|
|||
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_radius(lv_style_t * style, lv_coord_t value)
|
||||
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_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)
|
||||
void lv_style_set_blend_mode(lv_style_t * style, lv_blend_mode_t value)
|
||||
void lv_style_set_layout(lv_style_t * style, uint16_t value)
|
||||
void lv_style_set_base_dir(lv_style_t * style, lv_base_dir_t value)
|
||||
void lv_style_set_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)
|
||||
|
@ -779,6 +783,8 @@ 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)
|
||||
void lv_style_set_bg_grad(lv_style_t * style, const lv_grad_dsc_t * value)
|
||||
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)
|
||||
|
@ -791,18 +797,6 @@ 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_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)
|
||||
void lv_style_set_text_line_space(lv_style_t * style, lv_coord_t value)
|
||||
void lv_style_set_text_decor(lv_style_t * style, lv_text_decor_t value)
|
||||
void lv_style_set_text_align(lv_style_t * style, lv_text_align_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_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)
|
||||
|
@ -815,6 +809,10 @@ 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)
|
||||
|
@ -828,6 +826,25 @@ 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)
|
||||
void lv_style_set_text_line_space(lv_style_t * style, lv_coord_t value)
|
||||
void lv_style_set_text_decor(lv_style_t * style, lv_text_decor_t value)
|
||||
void lv_style_set_text_align(lv_style_t * style, lv_text_align_t value)
|
||||
void lv_style_set_radius(lv_style_t * style, lv_coord_t value)
|
||||
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_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)
|
||||
void lv_style_set_blend_mode(lv_style_t * style, lv_blend_mode_t value)
|
||||
void lv_style_set_layout(lv_style_t * style, uint16_t value)
|
||||
void lv_style_set_base_dir(lv_style_t * style, lv_base_dir_t value)
|
||||
|
||||
// ../../lvgl/src/widgets/lv_arc.h
|
||||
lv_obj_t * lv_arc_create(lv_obj_t * parent)
|
||||
|
@ -932,6 +949,7 @@ bool lv_dropdown_get_selected_highlight(lv_obj_t * obj)
|
|||
lv_dir_t lv_dropdown_get_dir(const lv_obj_t * obj)
|
||||
void lv_dropdown_open(lv_obj_t * dropdown_obj)
|
||||
void lv_dropdown_close(lv_obj_t * obj)
|
||||
bool lv_dropdown_is_open(lv_obj_t * obj)
|
||||
|
||||
// ../../lvgl/src/widgets/lv_img.h
|
||||
lv_obj_t * lv_img_create(lv_obj_t * parent)
|
||||
|
|
|
@ -32,40 +32,66 @@ const be_ctypes_structure_t be_lv_area = {
|
|||
{ "y2", 6, 0, 0, ctypes_i16, 0 },
|
||||
}};
|
||||
|
||||
const be_ctypes_structure_t be_lv_draw_rect_dsc = {
|
||||
51, /* size in bytes */
|
||||
29, /* number of elements */
|
||||
const be_ctypes_structure_t be_lv_gradient_stop = {
|
||||
3, /* size in bytes */
|
||||
2, /* number of elements */
|
||||
be_ctypes_instance_mappings,
|
||||
(const be_ctypes_structure_item_t[29]) {
|
||||
(const be_ctypes_structure_item_t[2]) {
|
||||
{ "color", 0, 0, 0, ctypes_u16, 1 },
|
||||
{ "frac", 2, 0, 0, ctypes_u8, 0 },
|
||||
}};
|
||||
|
||||
const be_ctypes_structure_t be_lv_grad_dsc = {
|
||||
9, /* size in bytes */
|
||||
7, /* number of elements */
|
||||
be_ctypes_instance_mappings,
|
||||
(const be_ctypes_structure_item_t[7]) {
|
||||
{ "dir", 8, 0, 3, ctypes_bf, 0 },
|
||||
{ "dither", 8, 3, 3, ctypes_bf, 0 },
|
||||
{ "stops_0_color", 0, 0, 0, ctypes_u16, 1 },
|
||||
{ "stops_0_frac", 2, 0, 0, ctypes_u8, 0 },
|
||||
{ "stops_1_color", 4, 0, 0, ctypes_u16, 1 },
|
||||
{ "stops_1_frac", 6, 0, 0, ctypes_u8, 0 },
|
||||
{ "stops_count", 7, 0, 0, ctypes_u8, 0 },
|
||||
}};
|
||||
|
||||
const be_ctypes_structure_t be_lv_draw_rect_dsc = {
|
||||
59, /* size in bytes */
|
||||
32, /* number of elements */
|
||||
be_ctypes_instance_mappings,
|
||||
(const be_ctypes_structure_item_t[32]) {
|
||||
{ "bg_color", 4, 0, 0, ctypes_u16, 1 },
|
||||
{ "bg_grad_color", 6, 0, 0, ctypes_u16, 1 },
|
||||
{ "bg_grad_color_stop", 9, 0, 0, ctypes_u8, 0 },
|
||||
{ "bg_grad_dir", 11, 0, 3, ctypes_bf, 0 },
|
||||
{ "bg_img_opa", 22, 0, 0, ctypes_u8, 0 },
|
||||
{ "bg_img_recolor", 20, 0, 0, ctypes_u16, 1 },
|
||||
{ "bg_img_recolor_opa", 23, 0, 0, ctypes_u8, 0 },
|
||||
{ "bg_img_src", 12, 0, 0, ctypes_ptr32, 0 },
|
||||
{ "bg_img_symbol_font", 16, 0, 0, ctypes_ptr32, 0 },
|
||||
{ "bg_img_tiled", 24, 0, 0, ctypes_u8, 0 },
|
||||
{ "bg_main_color_stop", 8, 0, 0, ctypes_u8, 0 },
|
||||
{ "bg_opa", 10, 0, 0, ctypes_u8, 0 },
|
||||
{ "bg_grad_dir", 16, 0, 3, ctypes_bf, 0 },
|
||||
{ "bg_grad_dither", 16, 3, 3, ctypes_bf, 0 },
|
||||
{ "bg_grad_stops_0_color", 8, 0, 0, ctypes_u16, 1 },
|
||||
{ "bg_grad_stops_0_frac", 10, 0, 0, ctypes_u8, 0 },
|
||||
{ "bg_grad_stops_1_color", 12, 0, 0, ctypes_u16, 1 },
|
||||
{ "bg_grad_stops_1_frac", 14, 0, 0, ctypes_u8, 0 },
|
||||
{ "bg_grad_stops_count", 15, 0, 0, ctypes_u8, 0 },
|
||||
{ "bg_img_opa", 30, 0, 0, ctypes_u8, 0 },
|
||||
{ "bg_img_recolor", 28, 0, 0, ctypes_u16, 1 },
|
||||
{ "bg_img_recolor_opa", 31, 0, 0, ctypes_u8, 0 },
|
||||
{ "bg_img_src", 20, 0, 0, ctypes_ptr32, 0 },
|
||||
{ "bg_img_symbol_font", 24, 0, 0, ctypes_ptr32, 0 },
|
||||
{ "bg_img_tiled", 32, 0, 0, ctypes_u8, 0 },
|
||||
{ "bg_opa", 3, 0, 0, ctypes_u8, 0 },
|
||||
{ "blend_mode", 2, 0, 0, ctypes_u8, 0 },
|
||||
{ "border_color", 26, 0, 0, ctypes_u16, 1 },
|
||||
{ "border_opa", 30, 0, 0, ctypes_u8, 0 },
|
||||
{ "border_post", 31, 0, 1, ctypes_bf, 0 },
|
||||
{ "border_side", 31, 1, 5, ctypes_bf, 0 },
|
||||
{ "border_width", 28, 0, 0, ctypes_i16, 0 },
|
||||
{ "outline_color", 32, 0, 0, ctypes_u16, 1 },
|
||||
{ "outline_opa", 38, 0, 0, ctypes_u8, 0 },
|
||||
{ "outline_pad", 36, 0, 0, ctypes_i16, 0 },
|
||||
{ "outline_width", 34, 0, 0, ctypes_i16, 0 },
|
||||
{ "border_color", 34, 0, 0, ctypes_u16, 1 },
|
||||
{ "border_opa", 38, 0, 0, ctypes_u8, 0 },
|
||||
{ "border_post", 39, 0, 1, ctypes_bf, 0 },
|
||||
{ "border_side", 39, 1, 5, ctypes_bf, 0 },
|
||||
{ "border_width", 36, 0, 0, ctypes_i16, 0 },
|
||||
{ "outline_color", 40, 0, 0, ctypes_u16, 1 },
|
||||
{ "outline_opa", 46, 0, 0, ctypes_u8, 0 },
|
||||
{ "outline_pad", 44, 0, 0, ctypes_i16, 0 },
|
||||
{ "outline_width", 42, 0, 0, ctypes_i16, 0 },
|
||||
{ "radius", 0, 0, 0, ctypes_i16, 0 },
|
||||
{ "shadow_color", 40, 0, 0, ctypes_u16, 1 },
|
||||
{ "shadow_ofs_x", 44, 0, 0, ctypes_i16, 0 },
|
||||
{ "shadow_ofs_y", 46, 0, 0, ctypes_i16, 0 },
|
||||
{ "shadow_opa", 50, 0, 0, ctypes_u8, 0 },
|
||||
{ "shadow_spread", 48, 0, 0, ctypes_i16, 0 },
|
||||
{ "shadow_width", 42, 0, 0, ctypes_i16, 0 },
|
||||
{ "shadow_color", 48, 0, 0, ctypes_u16, 1 },
|
||||
{ "shadow_ofs_x", 52, 0, 0, ctypes_i16, 0 },
|
||||
{ "shadow_ofs_y", 54, 0, 0, ctypes_i16, 0 },
|
||||
{ "shadow_opa", 58, 0, 0, ctypes_u8, 0 },
|
||||
{ "shadow_spread", 56, 0, 0, ctypes_i16, 0 },
|
||||
{ "shadow_width", 50, 0, 0, ctypes_i16, 0 },
|
||||
}};
|
||||
|
||||
const be_ctypes_structure_t be_lv_draw_line_dsc = {
|
||||
|
@ -84,6 +110,21 @@ const be_ctypes_structure_t be_lv_draw_line_dsc = {
|
|||
{ "width", 2, 0, 0, ctypes_i16, 0 },
|
||||
}};
|
||||
|
||||
const be_ctypes_structure_t be_lv_draw_arc_dsc = {
|
||||
14, /* size in bytes */
|
||||
8, /* number of elements */
|
||||
be_ctypes_instance_mappings,
|
||||
(const be_ctypes_structure_item_t[8]) {
|
||||
{ "blend_mode", 13, 0, 2, ctypes_bf, 0 },
|
||||
{ "color", 0, 0, 0, ctypes_u16, 1 },
|
||||
{ "end_angle", 6, 0, 0, ctypes_u16, 0 },
|
||||
{ "img_src", 8, 0, 0, ctypes_ptr32, 0 },
|
||||
{ "opa", 12, 0, 0, ctypes_u8, 0 },
|
||||
{ "rounded", 13, 2, 1, ctypes_bf, 0 },
|
||||
{ "start_angle", 4, 0, 0, ctypes_u16, 0 },
|
||||
{ "width", 2, 0, 0, ctypes_i16, 0 },
|
||||
}};
|
||||
|
||||
const be_ctypes_structure_t be_lv_draw_img_dsc = {
|
||||
21, /* size in bytes */
|
||||
10, /* number of elements */
|
||||
|
@ -212,31 +253,40 @@ const be_ctypes_structure_t be_lv_draw_mask_radius_param_cfg = {
|
|||
{ "rect_y2", 6, 0, 0, ctypes_i16, 0 },
|
||||
}};
|
||||
|
||||
const be_ctypes_structure_t be_lv_sqrt_res = {
|
||||
4, /* size in bytes */
|
||||
2, /* number of elements */
|
||||
const be_ctypes_structure_t be_lv_draw_mask_radius_circle_dsc = {
|
||||
26, /* size in bytes */
|
||||
7, /* number of elements */
|
||||
be_ctypes_instance_mappings,
|
||||
(const be_ctypes_structure_item_t[2]) {
|
||||
{ "f", 2, 0, 0, ctypes_u16, 0 },
|
||||
{ "i", 0, 0, 0, ctypes_u16, 0 },
|
||||
(const be_ctypes_structure_item_t[7]) {
|
||||
{ "buf", 0, 0, 0, ctypes_ptr32, 0 },
|
||||
{ "cir_opa", 4, 0, 0, ctypes_ptr32, 0 },
|
||||
{ "life", 16, 0, 0, ctypes_i32, 0 },
|
||||
{ "opa_start_on_y", 12, 0, 0, ctypes_ptr32, 0 },
|
||||
{ "radius", 24, 0, 0, ctypes_i16, 0 },
|
||||
{ "used_cnt", 20, 0, 0, ctypes_u32, 0 },
|
||||
{ "x_start_on_y", 8, 0, 0, ctypes_ptr32, 0 },
|
||||
}};
|
||||
|
||||
const be_ctypes_structure_t be_lv_draw_mask_radius_param = {
|
||||
28, /* size in bytes */
|
||||
11, /* number of elements */
|
||||
46, /* size in bytes */
|
||||
15, /* number of elements */
|
||||
be_ctypes_instance_mappings,
|
||||
(const be_ctypes_structure_item_t[11]) {
|
||||
(const be_ctypes_structure_item_t[15]) {
|
||||
{ "cfg_outer", 18, 0, 1, ctypes_bf, 0 },
|
||||
{ "cfg_radius", 16, 0, 0, ctypes_i16, 0 },
|
||||
{ "cfg_rect_x1", 8, 0, 0, ctypes_i16, 0 },
|
||||
{ "cfg_rect_x2", 12, 0, 0, ctypes_i16, 0 },
|
||||
{ "cfg_rect_y1", 10, 0, 0, ctypes_i16, 0 },
|
||||
{ "cfg_rect_y2", 14, 0, 0, ctypes_i16, 0 },
|
||||
{ "circle_buf", 20, 0, 0, ctypes_ptr32, 0 },
|
||||
{ "circle_cir_opa", 24, 0, 0, ctypes_ptr32, 0 },
|
||||
{ "circle_life", 36, 0, 0, ctypes_i32, 0 },
|
||||
{ "circle_opa_start_on_y", 32, 0, 0, ctypes_ptr32, 0 },
|
||||
{ "circle_radius", 44, 0, 0, ctypes_i16, 0 },
|
||||
{ "circle_used_cnt", 40, 0, 0, ctypes_u32, 0 },
|
||||
{ "circle_x_start_on_y", 28, 0, 0, ctypes_ptr32, 0 },
|
||||
{ "dsc_cb", 0, 0, 0, ctypes_ptr32, 0 },
|
||||
{ "dsc_type", 4, 0, 0, ctypes_u8, 0 },
|
||||
{ "y_prev", 20, 0, 0, ctypes_i32, 0 },
|
||||
{ "y_prev_x_f", 26, 0, 0, ctypes_u16, 0 },
|
||||
{ "y_prev_x_i", 24, 0, 0, ctypes_u16, 0 },
|
||||
}};
|
||||
|
||||
const be_ctypes_structure_t be_lv_draw_mask_fade_param_cfg = {
|
||||
|
@ -297,6 +347,26 @@ const be_ctypes_structure_t be_lv_draw_mask_map_param = {
|
|||
{ "dsc_type", 4, 0, 0, ctypes_u8, 0 },
|
||||
}};
|
||||
|
||||
const be_ctypes_structure_t be_lv_draw_mask_polygon_param_cfg = {
|
||||
6, /* size in bytes */
|
||||
2, /* number of elements */
|
||||
be_ctypes_instance_mappings,
|
||||
(const be_ctypes_structure_item_t[2]) {
|
||||
{ "point_cnt", 4, 0, 0, ctypes_u16, 0 },
|
||||
{ "points", 0, 0, 0, ctypes_ptr32, 0 },
|
||||
}};
|
||||
|
||||
const be_ctypes_structure_t be_lv_draw_mask_polygon_param = {
|
||||
14, /* size in bytes */
|
||||
4, /* number of elements */
|
||||
be_ctypes_instance_mappings,
|
||||
(const be_ctypes_structure_item_t[4]) {
|
||||
{ "cfg_point_cnt", 12, 0, 0, ctypes_u16, 0 },
|
||||
{ "cfg_points", 8, 0, 0, ctypes_ptr32, 0 },
|
||||
{ "dsc_cb", 0, 0, 0, ctypes_ptr32, 0 },
|
||||
{ "dsc_type", 4, 0, 0, ctypes_u8, 0 },
|
||||
}};
|
||||
|
||||
const be_ctypes_structure_t be_lv_draw_mask_saved = {
|
||||
8, /* size in bytes */
|
||||
2, /* number of elements */
|
||||
|
@ -329,10 +399,13 @@ const be_ctypes_structure_t be_lv_meter_scale = {
|
|||
}};
|
||||
|
||||
const be_ctypes_structure_t be_lv_meter_indicator = {
|
||||
16, /* size in bytes */
|
||||
5, /* number of elements */
|
||||
28, /* size in bytes */
|
||||
8, /* number of elements */
|
||||
be_ctypes_instance_mappings,
|
||||
(const be_ctypes_structure_item_t[5]) {
|
||||
(const be_ctypes_structure_item_t[8]) {
|
||||
{ "data0", 16, 0, 0, ctypes_ptr32, 0 },
|
||||
{ "data1", 20, 0, 0, ctypes_ptr32, 0 },
|
||||
{ "data2", 24, 0, 0, ctypes_ptr32, 0 },
|
||||
{ "end_value", 12, 0, 0, ctypes_i32, 0 },
|
||||
{ "opa", 5, 0, 0, ctypes_u8, 0 },
|
||||
{ "scale", 0, 0, 0, ctypes_ptr32, 0 },
|
||||
|
@ -432,6 +505,19 @@ const be_ctypes_structure_t be_lv_chart_cursor = {
|
|||
{ "ser", 8, 0, 0, ctypes_ptr32, 0 },
|
||||
}};
|
||||
|
||||
const be_ctypes_structure_t be_lv_chart_tick_dsc = {
|
||||
10, /* size in bytes */
|
||||
6, /* number of elements */
|
||||
be_ctypes_instance_mappings,
|
||||
(const be_ctypes_structure_item_t[6]) {
|
||||
{ "draw_size", 4, 0, 0, ctypes_i16, 0 },
|
||||
{ "label_en", 9, 6, 1, ctypes_bf, 0 },
|
||||
{ "major_cnt", 7, 7, 15, ctypes_bf, 0 },
|
||||
{ "major_len", 0, 0, 0, ctypes_i16, 0 },
|
||||
{ "minor_cnt", 6, 0, 15, ctypes_bf, 0 },
|
||||
{ "minor_len", 2, 0, 0, ctypes_i16, 0 },
|
||||
}};
|
||||
|
||||
const be_ctypes_structure_t be_lv_obj_class = {
|
||||
27, /* size in bytes */
|
||||
10, /* number of elements */
|
||||
|
@ -451,14 +537,16 @@ const be_ctypes_structure_t be_lv_obj_class = {
|
|||
|
||||
const be_ctypes_structure_t be_lv_event = {
|
||||
25, /* size in bytes */
|
||||
7, /* number of elements */
|
||||
9, /* number of elements */
|
||||
be_ctypes_instance_mappings,
|
||||
(const be_ctypes_structure_item_t[7]) {
|
||||
(const be_ctypes_structure_item_t[9]) {
|
||||
{ "code", 8, 0, 0, ctypes_i32, 0 },
|
||||
{ "current_target", 4, 0, 0, ctypes_ptr32, 0 },
|
||||
{ "deleted", 24, 0, 1, ctypes_bf, 0 },
|
||||
{ "param", 16, 0, 0, ctypes_ptr32, 0 },
|
||||
{ "prev", 20, 0, 0, ctypes_ptr32, 0 },
|
||||
{ "stop_bubbling", 24, 2, 1, ctypes_bf, 0 },
|
||||
{ "stop_processing", 24, 1, 1, ctypes_bf, 0 },
|
||||
{ "target", 0, 0, 0, ctypes_ptr32, 0 },
|
||||
{ "user_data", 12, 0, 0, ctypes_ptr32, 0 },
|
||||
}};
|
||||
|
@ -524,6 +612,32 @@ const be_ctypes_structure_t be_lv_timer = {
|
|||
{ "user_data", 12, 0, 0, ctypes_ptr32, 0 },
|
||||
}};
|
||||
|
||||
const be_ctypes_structure_t be_lv_draw_ctx = {
|
||||
60, /* size in bytes */
|
||||
19, /* number of elements */
|
||||
be_ctypes_instance_mappings,
|
||||
(const be_ctypes_structure_item_t[19]) {
|
||||
{ "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 },
|
||||
{ "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_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 },
|
||||
}};
|
||||
|
||||
const be_ctypes_structure_t be_lv_ts_calibration = {
|
||||
12, /* size in bytes */
|
||||
5, /* number of elements */
|
||||
|
@ -544,7 +658,10 @@ static const char * be_ctypes_instance_mappings[] = {
|
|||
static be_define_ctypes_class(lv_area, &be_lv_area, &be_class_ctypes, "lv_area");
|
||||
static be_define_ctypes_class(lv_chart_cursor, &be_lv_chart_cursor, &be_class_ctypes, "lv_chart_cursor");
|
||||
static be_define_ctypes_class(lv_chart_series, &be_lv_chart_series, &be_class_ctypes, "lv_chart_series");
|
||||
static be_define_ctypes_class(lv_chart_tick_dsc, &be_lv_chart_tick_dsc, &be_class_ctypes, "lv_chart_tick_dsc");
|
||||
static be_define_ctypes_class(lv_color_filter_dsc, &be_lv_color_filter_dsc, &be_class_ctypes, "lv_color_filter_dsc");
|
||||
static be_define_ctypes_class(lv_draw_arc_dsc, &be_lv_draw_arc_dsc, &be_class_ctypes, "lv_draw_arc_dsc");
|
||||
static be_define_ctypes_class(lv_draw_ctx, &be_lv_draw_ctx, &be_class_ctypes, "lv_draw_ctx");
|
||||
static be_define_ctypes_class(lv_draw_img_dsc, &be_lv_draw_img_dsc, &be_class_ctypes, "lv_draw_img_dsc");
|
||||
static be_define_ctypes_class(lv_draw_line_dsc, &be_lv_draw_line_dsc, &be_class_ctypes, "lv_draw_line_dsc");
|
||||
static be_define_ctypes_class(lv_draw_mask_angle_param, &be_lv_draw_mask_angle_param, &be_class_ctypes, "lv_draw_mask_angle_param");
|
||||
|
@ -556,11 +673,16 @@ static be_define_ctypes_class(lv_draw_mask_line_param, &be_lv_draw_mask_line_par
|
|||
static be_define_ctypes_class(lv_draw_mask_line_param_cfg, &be_lv_draw_mask_line_param_cfg, &be_class_ctypes, "lv_draw_mask_line_param_cfg");
|
||||
static be_define_ctypes_class(lv_draw_mask_map_param, &be_lv_draw_mask_map_param, &be_class_ctypes, "lv_draw_mask_map_param");
|
||||
static be_define_ctypes_class(lv_draw_mask_map_param_cfg, &be_lv_draw_mask_map_param_cfg, &be_class_ctypes, "lv_draw_mask_map_param_cfg");
|
||||
static be_define_ctypes_class(lv_draw_mask_polygon_param, &be_lv_draw_mask_polygon_param, &be_class_ctypes, "lv_draw_mask_polygon_param");
|
||||
static be_define_ctypes_class(lv_draw_mask_polygon_param_cfg, &be_lv_draw_mask_polygon_param_cfg, &be_class_ctypes, "lv_draw_mask_polygon_param_cfg");
|
||||
static be_define_ctypes_class(lv_draw_mask_radius_circle_dsc, &be_lv_draw_mask_radius_circle_dsc, &be_class_ctypes, "lv_draw_mask_radius_circle_dsc");
|
||||
static be_define_ctypes_class(lv_draw_mask_radius_param, &be_lv_draw_mask_radius_param, &be_class_ctypes, "lv_draw_mask_radius_param");
|
||||
static be_define_ctypes_class(lv_draw_mask_radius_param_cfg, &be_lv_draw_mask_radius_param_cfg, &be_class_ctypes, "lv_draw_mask_radius_param_cfg");
|
||||
static be_define_ctypes_class(lv_draw_mask_saved, &be_lv_draw_mask_saved, &be_class_ctypes, "lv_draw_mask_saved");
|
||||
static be_define_ctypes_class(lv_draw_rect_dsc, &be_lv_draw_rect_dsc, &be_class_ctypes, "lv_draw_rect_dsc");
|
||||
static be_define_ctypes_class(lv_event, &be_lv_event, &be_class_ctypes, "lv_event");
|
||||
static be_define_ctypes_class(lv_grad_dsc, &be_lv_grad_dsc, &be_class_ctypes, "lv_grad_dsc");
|
||||
static be_define_ctypes_class(lv_gradient_stop, &be_lv_gradient_stop, &be_class_ctypes, "lv_gradient_stop");
|
||||
static be_define_ctypes_class(lv_img_dsc, &be_lv_img_dsc, &be_class_ctypes, "lv_img_dsc");
|
||||
static be_define_ctypes_class(lv_img_header, &be_lv_img_header, &be_class_ctypes, "lv_img_header");
|
||||
static be_define_ctypes_class(lv_meter_indicator, &be_lv_meter_indicator, &be_class_ctypes, "lv_meter_indicator");
|
||||
|
@ -571,7 +693,6 @@ static be_define_ctypes_class(lv_meter_indicator_scale_lines, &be_lv_meter_indic
|
|||
static be_define_ctypes_class(lv_meter_scale, &be_lv_meter_scale, &be_class_ctypes, "lv_meter_scale");
|
||||
static be_define_ctypes_class(lv_obj_class, &be_lv_obj_class, &be_class_ctypes, "lv_obj_class");
|
||||
static be_define_ctypes_class(lv_point, &be_lv_point, &be_class_ctypes, "lv_point");
|
||||
static be_define_ctypes_class(lv_sqrt_res, &be_lv_sqrt_res, &be_class_ctypes, "lv_sqrt_res");
|
||||
static be_define_ctypes_class(lv_style_transition_dsc, &be_lv_style_transition_dsc, &be_class_ctypes, "lv_style_transition_dsc");
|
||||
static be_define_ctypes_class(lv_timer, &be_lv_timer, &be_class_ctypes, "lv_timer");
|
||||
static be_define_ctypes_class(lv_ts_calibration, &be_lv_ts_calibration, &be_class_ctypes, "lv_ts_calibration");
|
||||
|
@ -580,7 +701,10 @@ void be_load_ctypes_lvgl_definitions_lib(bvm *vm) {
|
|||
ctypes_register_class(vm, &be_class_lv_area, &be_lv_area);
|
||||
ctypes_register_class(vm, &be_class_lv_chart_cursor, &be_lv_chart_cursor);
|
||||
ctypes_register_class(vm, &be_class_lv_chart_series, &be_lv_chart_series);
|
||||
ctypes_register_class(vm, &be_class_lv_chart_tick_dsc, &be_lv_chart_tick_dsc);
|
||||
ctypes_register_class(vm, &be_class_lv_color_filter_dsc, &be_lv_color_filter_dsc);
|
||||
ctypes_register_class(vm, &be_class_lv_draw_arc_dsc, &be_lv_draw_arc_dsc);
|
||||
ctypes_register_class(vm, &be_class_lv_draw_ctx, &be_lv_draw_ctx);
|
||||
ctypes_register_class(vm, &be_class_lv_draw_img_dsc, &be_lv_draw_img_dsc);
|
||||
ctypes_register_class(vm, &be_class_lv_draw_line_dsc, &be_lv_draw_line_dsc);
|
||||
ctypes_register_class(vm, &be_class_lv_draw_mask_angle_param, &be_lv_draw_mask_angle_param);
|
||||
|
@ -592,11 +716,16 @@ void be_load_ctypes_lvgl_definitions_lib(bvm *vm) {
|
|||
ctypes_register_class(vm, &be_class_lv_draw_mask_line_param_cfg, &be_lv_draw_mask_line_param_cfg);
|
||||
ctypes_register_class(vm, &be_class_lv_draw_mask_map_param, &be_lv_draw_mask_map_param);
|
||||
ctypes_register_class(vm, &be_class_lv_draw_mask_map_param_cfg, &be_lv_draw_mask_map_param_cfg);
|
||||
ctypes_register_class(vm, &be_class_lv_draw_mask_polygon_param, &be_lv_draw_mask_polygon_param);
|
||||
ctypes_register_class(vm, &be_class_lv_draw_mask_polygon_param_cfg, &be_lv_draw_mask_polygon_param_cfg);
|
||||
ctypes_register_class(vm, &be_class_lv_draw_mask_radius_circle_dsc, &be_lv_draw_mask_radius_circle_dsc);
|
||||
ctypes_register_class(vm, &be_class_lv_draw_mask_radius_param, &be_lv_draw_mask_radius_param);
|
||||
ctypes_register_class(vm, &be_class_lv_draw_mask_radius_param_cfg, &be_lv_draw_mask_radius_param_cfg);
|
||||
ctypes_register_class(vm, &be_class_lv_draw_mask_saved, &be_lv_draw_mask_saved);
|
||||
ctypes_register_class(vm, &be_class_lv_draw_rect_dsc, &be_lv_draw_rect_dsc);
|
||||
ctypes_register_class(vm, &be_class_lv_event, &be_lv_event);
|
||||
ctypes_register_class(vm, &be_class_lv_grad_dsc, &be_lv_grad_dsc);
|
||||
ctypes_register_class(vm, &be_class_lv_gradient_stop, &be_lv_gradient_stop);
|
||||
ctypes_register_class(vm, &be_class_lv_img_dsc, &be_lv_img_dsc);
|
||||
ctypes_register_class(vm, &be_class_lv_img_header, &be_lv_img_header);
|
||||
ctypes_register_class(vm, &be_class_lv_meter_indicator, &be_lv_meter_indicator);
|
||||
|
@ -607,7 +736,6 @@ void be_load_ctypes_lvgl_definitions_lib(bvm *vm) {
|
|||
ctypes_register_class(vm, &be_class_lv_meter_scale, &be_lv_meter_scale);
|
||||
ctypes_register_class(vm, &be_class_lv_obj_class, &be_lv_obj_class);
|
||||
ctypes_register_class(vm, &be_class_lv_point, &be_lv_point);
|
||||
ctypes_register_class(vm, &be_class_lv_sqrt_res, &be_lv_sqrt_res);
|
||||
ctypes_register_class(vm, &be_class_lv_style_transition_dsc, &be_lv_style_transition_dsc);
|
||||
ctypes_register_class(vm, &be_class_lv_timer, &be_lv_timer);
|
||||
ctypes_register_class(vm, &be_class_lv_ts_calibration, &be_lv_ts_calibration);
|
||||
|
@ -617,7 +745,10 @@ be_ctypes_class_by_name_t be_ctypes_lvgl_classes[] = {
|
|||
{ "lv_area", &be_class_lv_area },
|
||||
{ "lv_chart_cursor", &be_class_lv_chart_cursor },
|
||||
{ "lv_chart_series", &be_class_lv_chart_series },
|
||||
{ "lv_chart_tick_dsc", &be_class_lv_chart_tick_dsc },
|
||||
{ "lv_color_filter_dsc", &be_class_lv_color_filter_dsc },
|
||||
{ "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_line_dsc", &be_class_lv_draw_line_dsc },
|
||||
{ "lv_draw_mask_angle_param", &be_class_lv_draw_mask_angle_param },
|
||||
|
@ -629,11 +760,16 @@ be_ctypes_class_by_name_t be_ctypes_lvgl_classes[] = {
|
|||
{ "lv_draw_mask_line_param_cfg", &be_class_lv_draw_mask_line_param_cfg },
|
||||
{ "lv_draw_mask_map_param", &be_class_lv_draw_mask_map_param },
|
||||
{ "lv_draw_mask_map_param_cfg", &be_class_lv_draw_mask_map_param_cfg },
|
||||
{ "lv_draw_mask_polygon_param", &be_class_lv_draw_mask_polygon_param },
|
||||
{ "lv_draw_mask_polygon_param_cfg", &be_class_lv_draw_mask_polygon_param_cfg },
|
||||
{ "lv_draw_mask_radius_circle_dsc", &be_class_lv_draw_mask_radius_circle_dsc },
|
||||
{ "lv_draw_mask_radius_param", &be_class_lv_draw_mask_radius_param },
|
||||
{ "lv_draw_mask_radius_param_cfg", &be_class_lv_draw_mask_radius_param_cfg },
|
||||
{ "lv_draw_mask_saved", &be_class_lv_draw_mask_saved },
|
||||
{ "lv_draw_rect_dsc", &be_class_lv_draw_rect_dsc },
|
||||
{ "lv_event", &be_class_lv_event },
|
||||
{ "lv_grad_dsc", &be_class_lv_grad_dsc },
|
||||
{ "lv_gradient_stop", &be_class_lv_gradient_stop },
|
||||
{ "lv_img_dsc", &be_class_lv_img_dsc },
|
||||
{ "lv_img_header", &be_class_lv_img_header },
|
||||
{ "lv_meter_indicator", &be_class_lv_meter_indicator },
|
||||
|
@ -644,7 +780,6 @@ be_ctypes_class_by_name_t be_ctypes_lvgl_classes[] = {
|
|||
{ "lv_meter_scale", &be_class_lv_meter_scale },
|
||||
{ "lv_obj_class", &be_class_lv_obj_class },
|
||||
{ "lv_point", &be_class_lv_point },
|
||||
{ "lv_sqrt_res", &be_class_lv_sqrt_res },
|
||||
{ "lv_style_transition_dsc", &be_class_lv_style_transition_dsc },
|
||||
{ "lv_timer", &be_class_lv_timer },
|
||||
{ "lv_ts_calibration", &be_class_lv_ts_calibration },
|
||||
|
|
|
@ -34,6 +34,7 @@ uint8_t_11 = ctypes.bf_11
|
|||
uint8_t = ctypes.u8
|
||||
int16_t = ctypes.i16
|
||||
uint16_t = ctypes.u16
|
||||
uint16_t_15 = ctypes.bf_15
|
||||
uint16_t_16 = ctypes.bf_16
|
||||
uint32_t = ctypes.u32
|
||||
int32_t = ctypes.i32
|
||||
|
@ -53,17 +54,31 @@ lv_area = [ # valid LVGL8
|
|||
]
|
||||
lv_area = ctypes.structure(lv_area, "lv_area")
|
||||
|
||||
lv_draw_rect_dsc = [ # valid LVGL8
|
||||
#######################################################################
|
||||
# lv_grad_dsc
|
||||
lv_gradient_stop = [
|
||||
[lv_color, "color"],
|
||||
[uint8_t, "frac"],
|
||||
]
|
||||
lv_gradient_stop = ctypes.structure(lv_gradient_stop, "lv_gradient_stop")
|
||||
|
||||
lv_grad_dsc = [
|
||||
[lv_gradient_stop, "stops_0"],
|
||||
[lv_gradient_stop, "stops_1"],
|
||||
[uint8_t, "stops_count"],
|
||||
[uint8_t_3, "dir"],
|
||||
[uint8_t_3, "dither"],
|
||||
]
|
||||
lv_grad_dsc = ctypes.structure(lv_grad_dsc, "lv_grad_dsc")
|
||||
|
||||
lv_draw_rect_dsc = [ # valid LVGL8.2
|
||||
[lv_coord, "radius"],
|
||||
[lv_blend_mode, "blend_mode"],
|
||||
|
||||
#/*Background*/
|
||||
[lv_color, "bg_color"],
|
||||
[lv_color, "bg_grad_color"],
|
||||
[uint8_t, "bg_main_color_stop"],
|
||||
[uint8_t, "bg_grad_color_stop"],
|
||||
[lv_opa, "bg_opa"],
|
||||
[uint8_t_3, "bg_grad_dir"],
|
||||
[lv_color, "bg_color"],
|
||||
[lv_grad_dsc, "bg_grad"],
|
||||
|
||||
#/*Background img*/
|
||||
[ptr, "bg_img_src"],
|
||||
|
@ -96,7 +111,7 @@ lv_draw_rect_dsc = [ # valid LVGL8
|
|||
]
|
||||
lv_draw_rect_dsc = ctypes.structure(lv_draw_rect_dsc, "lv_draw_rect_dsc")
|
||||
|
||||
lv_draw_line_dsc = [ # valid LVGL8
|
||||
lv_draw_line_dsc = [ # valid LVGL8.2
|
||||
[lv_color, "color"],
|
||||
[lv_coord, "width"],
|
||||
[lv_coord, "dash_width"],
|
||||
|
@ -109,7 +124,19 @@ lv_draw_line_dsc = [ # valid LVGL8
|
|||
]
|
||||
lv_draw_line_dsc = ctypes.structure(lv_draw_line_dsc, "lv_draw_line_dsc")
|
||||
|
||||
lv_draw_img_dsc = [ # valid LVGL8
|
||||
lv_draw_arc_dsc = [ # valid LVGL8.2
|
||||
[lv_color, "color"],
|
||||
[lv_coord, "width"],
|
||||
[uint16_t, "start_angle"],
|
||||
[uint16_t, "end_angle"],
|
||||
[ptr, "img_src"],
|
||||
[lv_opa, "opa"],
|
||||
[uint8_t_2, "blend_mode"],
|
||||
[uint8_t_1, "rounded"],
|
||||
]
|
||||
lv_draw_arc_dsc = ctypes.structure(lv_draw_arc_dsc, "lv_draw_arc_dsc")
|
||||
|
||||
lv_draw_img_dsc = [ # valid LVGL8.2
|
||||
[uint16_t, "angle"],
|
||||
[uint16_t, "zoom"],
|
||||
[lv_point, "pivot"],
|
||||
|
@ -130,13 +157,13 @@ lv_draw_mask_xcb = ptr # callback
|
|||
lv_draw_mask_type = ctypes.u8
|
||||
lv_draw_mask_line_side = ctypes.u8
|
||||
|
||||
lv_draw_mask_common_dsc = [ # valid LVGL8
|
||||
lv_draw_mask_common_dsc = [ # valid LVGL8.2
|
||||
[lv_draw_mask_xcb, "cb"],
|
||||
[lv_draw_mask_type, "type"],
|
||||
]
|
||||
lv_draw_mask_common_dsc = ctypes.structure(lv_draw_mask_common_dsc, "lv_draw_mask_common_dsc")
|
||||
|
||||
lv_draw_mask_line_param_cfg = [ # valid LVGL8
|
||||
lv_draw_mask_line_param_cfg = [ # valid LVGL8.2
|
||||
#/*First point */
|
||||
[lv_point, "p1"],
|
||||
|
||||
|
@ -148,7 +175,7 @@ lv_draw_mask_line_param_cfg = [ # valid LVGL8
|
|||
]
|
||||
lv_draw_mask_line_param_cfg = ctypes.structure(lv_draw_mask_line_param_cfg, "lv_draw_mask_line_param_cfg")
|
||||
|
||||
lv_draw_mask_line_param = [ # valid LVGL8
|
||||
lv_draw_mask_line_param = [ # valid LVGL8.2
|
||||
#/*The first element must be the common descriptor*/
|
||||
[lv_draw_mask_common_dsc, "dsc"],
|
||||
[lv_draw_mask_line_param_cfg, "cfg"],
|
||||
|
@ -170,14 +197,14 @@ lv_draw_mask_line_param = [ # valid LVGL8
|
|||
]
|
||||
lv_draw_mask_line_param = ctypes.structure(lv_draw_mask_line_param, "lv_draw_mask_line_param")
|
||||
|
||||
lv_draw_mask_angle_param_cfg = [ # valid LVGL8
|
||||
lv_draw_mask_angle_param_cfg = [ # valid LVGL8.2
|
||||
[lv_point, "vertex_p"],
|
||||
[lv_coord, "start_angle"],
|
||||
[lv_coord, "end_angle"],
|
||||
]
|
||||
lv_draw_mask_angle_param_cfg = ctypes.structure(lv_draw_mask_angle_param_cfg, "lv_draw_mask_angle_param_cfg")
|
||||
|
||||
lv_draw_mask_angle_param = [ # valid LVGL8
|
||||
lv_draw_mask_angle_param = [ # valid LVGL8.2
|
||||
#/*The first element must be the common descriptor*/
|
||||
[lv_draw_mask_common_dsc, "dsc"],
|
||||
[lv_draw_mask_angle_param_cfg, "cfg"],
|
||||
|
@ -189,30 +216,34 @@ lv_draw_mask_angle_param = [ # valid LVGL8
|
|||
lv_draw_mask_angle_param = ctypes.structure(lv_draw_mask_angle_param, "lv_draw_mask_angle_param")
|
||||
|
||||
|
||||
lv_draw_mask_radius_param_cfg = [ # valid LVGL8
|
||||
lv_draw_mask_radius_param_cfg = [ # valid LVGL8.2
|
||||
[lv_area, "rect"],
|
||||
[lv_coord, "radius"],
|
||||
[uint8_t_1, "outer"],
|
||||
]
|
||||
lv_draw_mask_radius_param_cfg = ctypes.structure(lv_draw_mask_radius_param_cfg, "lv_draw_mask_radius_param_cfg")
|
||||
|
||||
lv_sqrt_res = [ # valid LVGL8
|
||||
[uint16_t, "i"],
|
||||
[uint16_t, "f"],
|
||||
lv_draw_mask_radius_circle_dsc = [ # valid LVGL8.2
|
||||
[ptr, "buf"],
|
||||
[ptr, "cir_opa"],
|
||||
[ptr, "x_start_on_y"],
|
||||
[ptr, "opa_start_on_y"],
|
||||
[int32_t, "life"],
|
||||
[uint32_t, "used_cnt"],
|
||||
[lv_coord, "radius"],
|
||||
]
|
||||
lv_sqrt_res = ctypes.structure(lv_sqrt_res, "lv_sqrt_res")
|
||||
lv_draw_mask_radius_circle_dsc = ctypes.structure(lv_draw_mask_radius_circle_dsc, "lv_draw_mask_radius_circle_dsc")
|
||||
|
||||
lv_draw_mask_radius_param = [ # valid LVGL8
|
||||
lv_draw_mask_radius_param = [ # valid LVGL8.2
|
||||
#/*The first element must be the common descriptor*/
|
||||
[lv_draw_mask_common_dsc, "dsc"],
|
||||
[lv_draw_mask_radius_param_cfg, "cfg"],
|
||||
[int32_t, "y_prev"],
|
||||
[lv_sqrt_res, "y_prev_x"],
|
||||
[lv_draw_mask_radius_circle_dsc, "circle"],
|
||||
]
|
||||
lv_draw_mask_radius_param = ctypes.structure(lv_draw_mask_radius_param, "lv_draw_mask_radius_param")
|
||||
|
||||
|
||||
lv_draw_mask_fade_param_cfg = [ # valid LVGL8
|
||||
lv_draw_mask_fade_param_cfg = [ # valid LVGL8.2
|
||||
[lv_area, "coords"],
|
||||
[lv_coord, "y_top"],
|
||||
[lv_coord, "y_bottom"],
|
||||
|
@ -221,7 +252,7 @@ lv_draw_mask_fade_param_cfg = [ # valid LVGL8
|
|||
]
|
||||
lv_draw_mask_fade_param_cfg = ctypes.structure(lv_draw_mask_fade_param_cfg, "lv_draw_mask_fade_param_cfg")
|
||||
|
||||
lv_draw_mask_fade_param = [ # valid LVGL8
|
||||
lv_draw_mask_fade_param = [ # valid LVGL8.2
|
||||
# /*The first element must be the common descriptor*/
|
||||
[lv_draw_mask_common_dsc, "dsc"],
|
||||
[lv_draw_mask_fade_param_cfg, "cfg"],
|
||||
|
@ -229,20 +260,33 @@ lv_draw_mask_fade_param = [ # valid LVGL8
|
|||
lv_draw_mask_fade_param = ctypes.structure(lv_draw_mask_fade_param, "lv_draw_mask_fade_param")
|
||||
|
||||
|
||||
lv_draw_mask_map_param_cfg = [ # valid LVGL8
|
||||
lv_draw_mask_map_param_cfg = [ # valid LVGL8.2
|
||||
[lv_area, "coords"],
|
||||
[ptr, "map"],
|
||||
]
|
||||
lv_draw_mask_map_param_cfg = ctypes.structure(lv_draw_mask_map_param_cfg, "lv_draw_mask_map_param_cfg")
|
||||
|
||||
lv_draw_mask_map_param = [ # valid LVGL8
|
||||
#/*The first element must be the common descriptor*/
|
||||
lv_draw_mask_map_param = [ # valid LVGL8.2
|
||||
[lv_draw_mask_common_dsc, "dsc"],
|
||||
[lv_draw_mask_map_param_cfg, "cfg"],
|
||||
]
|
||||
lv_draw_mask_map_param = ctypes.structure(lv_draw_mask_map_param, "lv_draw_mask_map_param")
|
||||
|
||||
lv_draw_mask_saved = [ # valid LVGL8
|
||||
|
||||
lv_draw_mask_polygon_param_cfg = [ # valid LVGL8.2
|
||||
[ptr, "points"],
|
||||
[uint16_t, "point_cnt"],
|
||||
]
|
||||
lv_draw_mask_polygon_param_cfg = ctypes.structure(lv_draw_mask_polygon_param_cfg, "lv_draw_mask_polygon_param_cfg")
|
||||
|
||||
lv_draw_mask_polygon_param = [ # valid LVGL8.2
|
||||
[lv_draw_mask_common_dsc, "dsc"],
|
||||
[lv_draw_mask_polygon_param_cfg, "cfg"],
|
||||
]
|
||||
lv_draw_mask_polygon_param = ctypes.structure(lv_draw_mask_polygon_param, "lv_draw_mask_polygon_param")
|
||||
|
||||
|
||||
lv_draw_mask_saved = [ # valid LVGL8.2
|
||||
[ptr, "param"],
|
||||
[ptr, "custom_id"],
|
||||
]
|
||||
|
@ -251,7 +295,7 @@ lv_draw_mask_saved = ctypes.structure(lv_draw_mask_saved, "lv_draw_mask_saved")
|
|||
# lv_meter
|
||||
|
||||
# lv_meter_scale_t
|
||||
lv_meter_scale = [ # valid LVGL8
|
||||
lv_meter_scale = [ # valid LVGL8.2
|
||||
[lv_color, "tick_color"],
|
||||
[uint16_t, "tick_cnt"],
|
||||
[uint16_t, "tick_length"],
|
||||
|
@ -274,17 +318,21 @@ lv_meter_scale = [ # valid LVGL8
|
|||
lv_meter_scale = ctypes.structure(lv_meter_scale, "lv_meter_scale")
|
||||
|
||||
# lv_meter_indicator_t
|
||||
lv_meter_indicator = [ # valid LVGL8
|
||||
lv_meter_indicator = [ # valid LVGL8.2
|
||||
[ptr, "scale"],
|
||||
[lv_meter_indicator_type_t, "type"],
|
||||
[lv_opa, "opa"],
|
||||
[int32_t, "start_value"],
|
||||
[int32_t, "end_value"],
|
||||
# more unions here that we can hardly manage simply
|
||||
[ptr, "data0"],
|
||||
[ptr, "data1"],
|
||||
[ptr, "data2"],
|
||||
]
|
||||
lv_meter_indicator = ctypes.structure(lv_meter_indicator, "lv_meter_indicator")
|
||||
|
||||
# variants
|
||||
lv_meter_indicator_needle_img = [ # valid LVGL8
|
||||
lv_meter_indicator_needle_img = [ # valid LVGL8.2
|
||||
[ptr, "scale"],
|
||||
[lv_meter_indicator_type_t, "type"],
|
||||
[lv_opa, "opa"],
|
||||
|
@ -296,7 +344,7 @@ lv_meter_indicator_needle_img = [ # valid LVGL8
|
|||
]
|
||||
lv_meter_indicator_needle_img = ctypes.structure(lv_meter_indicator_needle_img, "lv_meter_indicator_needle_img")
|
||||
|
||||
lv_meter_indicator_needle_line = [ # valid LVGL8
|
||||
lv_meter_indicator_needle_line = [ # valid LVGL8.2
|
||||
[ptr, "scale"],
|
||||
[lv_meter_indicator_type_t, "type"],
|
||||
[lv_opa, "opa"],
|
||||
|
@ -309,7 +357,7 @@ lv_meter_indicator_needle_line = [ # valid LVGL8
|
|||
]
|
||||
lv_meter_indicator_needle_line = ctypes.structure(lv_meter_indicator_needle_line, "lv_meter_indicator_needle_line")
|
||||
|
||||
lv_meter_indicator_arc = [ # valid LVGL8
|
||||
lv_meter_indicator_arc = [ # valid LVGL8.2
|
||||
[ptr, "scale"],
|
||||
[lv_meter_indicator_type_t, "type"],
|
||||
[lv_opa, "opa"],
|
||||
|
@ -323,7 +371,7 @@ lv_meter_indicator_arc = [ # valid LVGL8
|
|||
]
|
||||
lv_meter_indicator_arc = ctypes.structure(lv_meter_indicator_arc, "lv_meter_indicator_arc")
|
||||
|
||||
lv_meter_indicator_scale_lines = [ # valid LVGL8
|
||||
lv_meter_indicator_scale_lines = [ # valid LVGL8.2
|
||||
[ptr, "scale"],
|
||||
[lv_meter_indicator_type_t, "type"],
|
||||
[lv_opa, "opa"],
|
||||
|
@ -337,7 +385,7 @@ lv_meter_indicator_scale_lines = [ # valid LVGL8
|
|||
]
|
||||
lv_meter_indicator_scale_lines = ctypes.structure(lv_meter_indicator_scale_lines, "lv_meter_indicator_scale_lines")
|
||||
|
||||
lv_chart_series = [
|
||||
lv_chart_series = [ # valid LVGL8.2
|
||||
[ptr, "x_points"],
|
||||
[ptr, "y_points"],
|
||||
[lv_color, "color"],
|
||||
|
@ -350,7 +398,7 @@ lv_chart_series = [
|
|||
]
|
||||
lv_chart_series = ctypes.structure(lv_chart_series, "lv_chart_series")
|
||||
|
||||
lv_chart_cursor = [
|
||||
lv_chart_cursor = [ # valid LVGL8.2
|
||||
[lv_point, "pos"],
|
||||
[uint16_t, "point_id"],
|
||||
[lv_color, "color"],
|
||||
|
@ -360,6 +408,17 @@ lv_chart_cursor = [
|
|||
]
|
||||
lv_chart_cursor = ctypes.structure(lv_chart_cursor, "lv_chart_cursor")
|
||||
|
||||
lv_chart_tick_dsc = [ # valid LVGL8.2
|
||||
[lv_coord, "major_len"],
|
||||
[lv_coord, "minor_len"],
|
||||
[lv_coord, "draw_size"],
|
||||
[uint16_t_15, "minor_cnt"],
|
||||
[uint16_t_15, "major_cnt"],
|
||||
[uint8_t_1, "label_en"],
|
||||
]
|
||||
lv_chart_tick_dsc = ctypes.structure(lv_chart_tick_dsc, "lv_chart_tick_dsc")
|
||||
|
||||
|
||||
#- --------- class system --------- -#
|
||||
lv_obj_class_ptr = ptr
|
||||
lv_obj_ptr = ptr
|
||||
|
@ -369,7 +428,7 @@ destructor_cb = ptr # callback
|
|||
event_cb = ptr # callback
|
||||
lv_event_code = ctypes.i32
|
||||
|
||||
lv_obj_class = [ # valid LVGL8
|
||||
lv_obj_class = [ # valid LVGL8.2
|
||||
[lv_obj_class_ptr, "base_class"],
|
||||
[constructor_cb, "constructor_cb"],
|
||||
[destructor_cb, "destructor_cb"],
|
||||
|
@ -383,7 +442,7 @@ lv_obj_class = [ # valid LVGL8
|
|||
]
|
||||
lv_obj_class = ctypes.structure(lv_obj_class, "lv_obj_class")
|
||||
|
||||
lv_event = [ # valid LVGL8
|
||||
lv_event = [ # valid LVGL8.2
|
||||
[lv_obj_ptr, "target"],
|
||||
[lv_obj_ptr, "current_target"],
|
||||
[lv_event_code, "code"],
|
||||
|
@ -391,12 +450,14 @@ lv_event = [ # valid LVGL8
|
|||
[ptr, "param"],
|
||||
[lv_event_ptr, "prev"],
|
||||
[uint8_t_1, "deleted"],
|
||||
[uint8_t_1, "stop_processing"],
|
||||
[uint8_t_1, "stop_bubbling"],
|
||||
]
|
||||
lv_event = ctypes.structure(lv_event, "lv_event")
|
||||
|
||||
#######################################################################
|
||||
# lv_img structures
|
||||
lv_img_header = [ # valid LVGL8
|
||||
lv_img_header = [ # valid LVGL8.2
|
||||
[uint8_t_5, "cf"],
|
||||
[uint8_t_3, "always_zero"],
|
||||
[uint8_t_2, "reserved"],
|
||||
|
@ -405,9 +466,8 @@ lv_img_header = [ # valid LVGL8
|
|||
]
|
||||
lv_img_header = ctypes.structure(lv_img_header, "lv_img_header")
|
||||
|
||||
lv_img_dsc = [ # valid LVGL8
|
||||
lv_img_dsc = [ # valid LVGL8.2
|
||||
[lv_img_header, "header"],
|
||||
[uint8_t_5, "cf"],
|
||||
[uint32_t, "data_size"],
|
||||
[ptr, "data"],
|
||||
]
|
||||
|
@ -415,7 +475,7 @@ lv_img_dsc = ctypes.structure(lv_img_dsc, "lv_img_dsc")
|
|||
|
||||
#######################################################################
|
||||
# lv_style
|
||||
lv_style_transition_dsc = [ # valid LVGL8
|
||||
lv_style_transition_dsc = [ # valid LVGL8.2
|
||||
[ptr, "props"],
|
||||
[ptr, "user_data"],
|
||||
[ptr, "path_xcb"],
|
||||
|
@ -433,7 +493,7 @@ lv_style_transition_dsc = ctypes.structure(lv_style_transition_dsc, "lv_style_tr
|
|||
# ]
|
||||
# lv_color_hsv = ctypes.structure(lv_color_hsv, "lv_color_hsv")
|
||||
|
||||
lv_color_filter_dsc = [ # valid LVGL8
|
||||
lv_color_filter_dsc = [ # valid LVGL8.2
|
||||
[ptr, "filter_cb"],
|
||||
[ptr, "user_data"],
|
||||
]
|
||||
|
@ -441,7 +501,7 @@ lv_color_filter_dsc = ctypes.structure(lv_color_filter_dsc, "lv_color_filter_dsc
|
|||
|
||||
#######################################################################
|
||||
# lv_timer
|
||||
lv_timer = [ # valid LVGL8
|
||||
lv_timer = [ # valid LVGL8.2
|
||||
[uint32_t, "period"],
|
||||
[uint32_t, "last_run"],
|
||||
[ptr, "timer_cb"],
|
||||
|
@ -451,6 +511,25 @@ lv_timer = [ # valid LVGL8
|
|||
]
|
||||
lv_timer = ctypes.structure(lv_timer, "lv_timer")
|
||||
|
||||
#######################################################################
|
||||
# lv_draw_ctc
|
||||
lv_draw_ctx = [ # valid LVGL8.2
|
||||
[ptr, "buf"],
|
||||
[lv_area, "buf_area"],
|
||||
[lv_area, "clip_area"],
|
||||
[ptr, "draw_rect"],
|
||||
[ptr, "draw_arc"],
|
||||
[ptr, "draw_img_decoded"],
|
||||
[ptr, "draw_img"],
|
||||
[ptr, "draw_letter"],
|
||||
[ptr, "draw_line"],
|
||||
[ptr, "draw_polygon"],
|
||||
[ptr, "draw_bg"],
|
||||
[ptr, "wait_for_finish"],
|
||||
[ptr, "user_data"],
|
||||
]
|
||||
lv_draw_ctx = ctypes.structure(lv_draw_ctx, "lv_draw_ctx")
|
||||
|
||||
#######################################################################
|
||||
# Special structure used to calibrate resistive touchscreens
|
||||
#######################################################################
|
||||
|
|
|
@ -102,6 +102,7 @@ return_types = {
|
|||
"lv_img_size_mode_t": "i",
|
||||
"lv_palette_t": "i",
|
||||
"lv_style_prop_t": "i",
|
||||
"lv_dither_mode_t": "i",
|
||||
# layouts
|
||||
"lv_flex_align_t": "i",
|
||||
"lv_flex_flow_t": "i",
|
||||
|
@ -140,6 +141,9 @@ return_types = {
|
|||
"lv_img_dsc_t *": "lv_img_dsc",
|
||||
"lv_ts_calibration_t *": "lv_ts_calibration",
|
||||
"lv_style_transition_dsc_t *": "lv_style_transition_dsc",
|
||||
"lv_draw_ctx_t *": "lv_draw_ctx",
|
||||
"_lv_draw_ctx_t *": "lv_draw_ctx",
|
||||
"lv_grad_dsc_t *": "lv_grad_dsc",
|
||||
# "lv_color_hsv_t *": "lv_color_hsv",
|
||||
"lv_color_filter_dsc_t *": "lv_color_filter_dsc",
|
||||
"lv_timer_t *": "lv_timer",
|
||||
|
|
|
@ -64,6 +64,7 @@ lv_fun_globs = [
|
|||
"extra/themes/default/*.h",
|
||||
"extra/themes/mono/*.h",
|
||||
"extra/layouts/**/*.h",
|
||||
"extra/libs/qrcode/lv_qrcode.h",
|
||||
"core/*.h",
|
||||
"draw/*.h",
|
||||
"misc/lv_style_gen.h",
|
||||
|
@ -163,6 +164,8 @@ for header_name in headers_names:
|
|||
"^lv_indev_scroll_",
|
||||
"^lv_keyboard_def_event_cb", # need to fix conditional include
|
||||
"^lv_event_get_", # event_getters not needed
|
||||
"^lv_refr_reset_fps_counter",
|
||||
"^lv_refr_get_fps_avg",
|
||||
]:
|
||||
if re.search(exclude_pattern, fun_name): exclude = True
|
||||
if exclude: continue
|
||||
|
@ -329,7 +332,8 @@ for header_name in headers_names:
|
|||
# item is ready
|
||||
exclude = False
|
||||
for exclude_prefix in ["_", "LV_BIDI_DIR_", "LV_FONT_", "LV_IMG_CF_RESERVED_", "LV_IMG_CF_USER_",
|
||||
"LV_SIGNAL_", "LV_TEMPL_", "LV_TASK_PRIO_", "LV_THEME_", "LV_KEYBOARD_"]:
|
||||
"LV_SIGNAL_", "LV_TEMPL_", "LV_TASK_PRIO_", "LV_THEME_", "LV_KEYBOARD_",
|
||||
"LV_LRU_"]:
|
||||
if enum_item.startswith(exclude_prefix): exclude = True
|
||||
if exclude: continue
|
||||
|
||||
|
|
|
@ -2,14 +2,6 @@
|
|||
|
||||
menu "LVGL configuration"
|
||||
|
||||
config LV_ATTRIBUTE_FAST_MEM_USE_IRAM
|
||||
bool "Set IRAM as LV_ATTRIBUTE_FAST_MEM"
|
||||
help
|
||||
Set this option to configure IRAM as LV_ATTRIBUTE_FAST_MEM
|
||||
|
||||
config LV_CONF_MINIMAL
|
||||
bool "LVGL minimal configuration."
|
||||
|
||||
# Define CONFIG_LV_CONF_SKIP so we can use LVGL
|
||||
# without lv_conf.h file, the lv_conf_internal.h and
|
||||
# lv_conf_kconfig.h files are used instead.
|
||||
|
@ -17,8 +9,11 @@ menu "LVGL configuration"
|
|||
bool
|
||||
default y
|
||||
|
||||
config LV_CONF_MINIMAL
|
||||
bool "LVGL minimal configuration."
|
||||
|
||||
menu "Color settings"
|
||||
choice
|
||||
choice LV_COLOR_DEPTH
|
||||
prompt "Color depth."
|
||||
default LV_COLOR_DEPTH_16
|
||||
help
|
||||
|
@ -42,7 +37,7 @@ menu "LVGL configuration"
|
|||
default 32 if LV_COLOR_DEPTH_32
|
||||
|
||||
config LV_COLOR_16_SWAP
|
||||
bool "Swap the 2 bytes of RGB565 color. Useful if the display has a 8 bit interface (e.g. SPI)."
|
||||
bool "Swap the 2 bytes of RGB565 color. Useful if the display has an 8-bit interface (e.g. SPI)."
|
||||
depends on LV_COLOR_DEPTH_16
|
||||
|
||||
config LV_COLOR_SCREEN_TRANSP
|
||||
|
@ -53,6 +48,18 @@ menu "LVGL configuration"
|
|||
Requires `LV_COLOR_DEPTH = 32` colors and the screen's `bg_opa` should be set to
|
||||
non LV_OPA_COVER value
|
||||
|
||||
config LV_COLOR_MIX_ROUND_OFS
|
||||
int "Adjust color mix functions rounding"
|
||||
default 128 if !LV_COLOR_DEPTH_32
|
||||
default 0 if LV_COLOR_DEPTH_32
|
||||
range 0 254
|
||||
help
|
||||
0: no adjustment, get the integer part of the result (round down)
|
||||
64: round up from x.75
|
||||
128: round up from half
|
||||
192: round up from x.25
|
||||
254: round up
|
||||
|
||||
config LV_COLOR_CHROMA_KEY_HEX
|
||||
hex "Images pixels with this color will not be drawn (if they are chroma keyed)."
|
||||
range 0x000000 0xFFFFFF
|
||||
|
@ -71,11 +78,24 @@ menu "LVGL configuration"
|
|||
default 32
|
||||
depends on !LV_MEM_CUSTOM
|
||||
|
||||
config LV_MEM_ADDR
|
||||
hex "Address for the memory pool instead of allocating it as a normal array"
|
||||
default 0x0
|
||||
depends on !LV_MEM_CUSTOM
|
||||
|
||||
config LV_MEM_CUSTOM_INCLUDE
|
||||
string "Header to include for the custom memory function"
|
||||
default "stdlib.h"
|
||||
depends on LV_MEM_CUSTOM
|
||||
|
||||
config LV_MEM_BUF_MAX_NUM
|
||||
int "Number of the memory buffer"
|
||||
default 16
|
||||
help
|
||||
Number of the intermediate memory buffer used during rendering and other
|
||||
internal processing mechanisms. You will see an error log message if
|
||||
there wasn't enough buffers.
|
||||
|
||||
config LV_MEMCPY_MEMSET_STD
|
||||
bool "Use the standard memcpy and memset instead of LVGL's own functions"
|
||||
endmenu
|
||||
|
@ -92,12 +112,10 @@ menu "LVGL configuration"
|
|||
default 30
|
||||
|
||||
config LV_TICK_CUSTOM
|
||||
bool
|
||||
prompt "Use a custom tick source"
|
||||
bool "Use a custom tick source"
|
||||
|
||||
config LV_TICK_CUSTOM_INCLUDE
|
||||
string
|
||||
prompt "Header for the system time function"
|
||||
string "Header for the system time function"
|
||||
default "Arduino.h"
|
||||
depends on LV_TICK_CUSTOM
|
||||
|
||||
|
@ -128,6 +146,16 @@ menu "LVGL configuration"
|
|||
shadow size is `shadow_width + radius`.
|
||||
Caching has LV_SHADOW_CACHE_SIZE^2 RAM cost.
|
||||
|
||||
config LV_CIRCLE_CACHE_SIZE
|
||||
int "Set number of maximally cached circle data"
|
||||
depends on LV_DRAW_COMPLEX
|
||||
default 4
|
||||
help
|
||||
The circumference of 1/4 circle are saved for anti-aliasing
|
||||
radius * 4 bytes are used per circle (the most often used
|
||||
radiuses are saved).
|
||||
Set to 0 to disable caching.
|
||||
|
||||
config LV_IMG_CACHE_DEF_SIZE
|
||||
int "Default image cache size. 0 to disable caching."
|
||||
default 0
|
||||
|
@ -139,6 +167,36 @@ menu "LVGL configuration"
|
|||
save the continuous open/decode of images.
|
||||
However the opened images might consume additional RAM.
|
||||
|
||||
config LV_GRADIENT_MAX_STOPS
|
||||
int "Number of stops allowed per gradient."
|
||||
default 2
|
||||
help
|
||||
Increase this to allow more stops.
|
||||
This adds (sizeof(lv_color_t) + 1) bytes per additional stop
|
||||
|
||||
config LV_GRAD_CACHE_DEF_SIZE
|
||||
int "Default gradient buffer size."
|
||||
default 0
|
||||
help
|
||||
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.
|
||||
|
||||
config LV_DITHER_GRADIENT
|
||||
bool "Allow dithering the gradients"
|
||||
help
|
||||
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
|
||||
|
||||
config LV_DITHER_ERROR_DIFFUSION
|
||||
bool "Add support for error diffusion dithering"
|
||||
depends on LV_DITHER_GRADIENT
|
||||
help
|
||||
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)
|
||||
|
||||
config LV_DISP_ROT_MAX_BUF
|
||||
int "Maximum buffer size to allocate for rotation"
|
||||
default 10240
|
||||
|
@ -147,6 +205,9 @@ menu "LVGL configuration"
|
|||
endmenu
|
||||
|
||||
menu "GPU"
|
||||
config LV_USE_EXTERNAL_RENDERER
|
||||
bool
|
||||
|
||||
config LV_USE_GPU_STM32_DMA2D
|
||||
bool "Enable STM32 DMA2D (aka Chrom Art) GPU."
|
||||
config LV_GPU_DMA2D_CMSIS_INCLUDE
|
||||
|
@ -171,8 +232,18 @@ menu "LVGL configuration"
|
|||
selected.
|
||||
0: lv_gpu_nxp_pxp_init() has to be called manually before
|
||||
lv_init().
|
||||
|
||||
config LV_USE_GPU_NXP_VG_LITE
|
||||
bool "Use NXP's VG-Lite GPU iMX RTxxx platforms."
|
||||
|
||||
config LV_USE_GPU_SDL
|
||||
bool "Use SDL renderer API"
|
||||
select LV_USE_EXTERNAL_RENDERER
|
||||
default n
|
||||
config LV_GPU_SDL_INCLUDE_PATH
|
||||
string "include path of SDL header"
|
||||
depends on LV_USE_GPU_SDL
|
||||
default "SDL2/SDL.h"
|
||||
endmenu
|
||||
|
||||
menu "Logging"
|
||||
|
@ -272,14 +343,69 @@ menu "LVGL configuration"
|
|||
|
||||
config LV_USE_ASSERT_OBJ
|
||||
bool "Check NULL, the object's type and existence (e.g. not deleted). (Slow)."
|
||||
|
||||
config LV_ASSERT_HANDLER_INCLUDE
|
||||
string "Header to include for the custom assert function"
|
||||
default "assert.h"
|
||||
endmenu
|
||||
|
||||
menu "Others"
|
||||
config LV_USE_PERF_MONITOR
|
||||
bool "Show CPU usage and FPS count in the right bottom corner."
|
||||
bool "Show CPU usage and FPS count."
|
||||
|
||||
choice
|
||||
prompt "Performance monitor position."
|
||||
depends on LV_USE_PERF_MONITOR
|
||||
default LV_PERF_MONITOR_ALIGN_BOTTOM_RIGHT
|
||||
|
||||
config LV_PERF_MONITOR_ALIGN_TOP_LEFT
|
||||
bool "Top left"
|
||||
config LV_PERF_MONITOR_ALIGN_TOP_MID
|
||||
bool "Top middle"
|
||||
config LV_PERF_MONITOR_ALIGN_TOP_RIGHT
|
||||
bool "Top right"
|
||||
config LV_PERF_MONITOR_ALIGN_BOTTOM_LEFT
|
||||
bool "Bottom left"
|
||||
config LV_PERF_MONITOR_ALIGN_BOTTOM_MID
|
||||
bool "Bottom middle"
|
||||
config LV_PERF_MONITOR_ALIGN_BOTTOM_RIGHT
|
||||
bool "Bottom right"
|
||||
config LV_PERF_MONITOR_ALIGN_LEFT_MID
|
||||
bool "Left middle"
|
||||
config LV_PERF_MONITOR_ALIGN_RIGHT_MID
|
||||
bool "Right middle"
|
||||
config LV_PERF_MONITOR_ALIGN_BOTTOM_CENTER
|
||||
bool "Center"
|
||||
endchoice
|
||||
|
||||
config LV_USE_MEM_MONITOR
|
||||
bool "Show the used memory and the memory fragmentation in the left bottom corner. Requires LV_MEM_CUSTOM = 0"
|
||||
bool "Show the used memory and the memory fragmentation."
|
||||
depends on !LV_MEM_CUSTOM
|
||||
|
||||
choice
|
||||
prompt "Memory monitor position."
|
||||
depends on LV_USE_MEM_MONITOR
|
||||
default LV_MEM_MONITOR_ALIGN_BOTTOM_LEFT
|
||||
|
||||
config LV_MEM_MONITOR_ALIGN_TOP_LEFT
|
||||
bool "Top left"
|
||||
config LV_MEM_MONITOR_ALIGN_TOP_MID
|
||||
bool "Top middle"
|
||||
config LV_MEM_MONITOR_ALIGN_TOP_RIGHT
|
||||
bool "Top right"
|
||||
config LV_MEM_MONITOR_ALIGN_BOTTOM_LEFT
|
||||
bool "Bottom left"
|
||||
config LV_MEM_MONITOR_ALIGN_BOTTOM_MID
|
||||
bool "Bottom middle"
|
||||
config LV_MEM_MONITOR_ALIGN_BOTTOM_RIGHT
|
||||
bool "Bottom right"
|
||||
config LV_MEM_MONITOR_ALIGN_LEFT_MID
|
||||
bool "Left middle"
|
||||
config LV_MEM_MONITOR_ALIGN_RIGHT_MID
|
||||
bool "Right middle"
|
||||
config LV_MEM_MONITOR_ALIGN_BOTTOM_CENTER
|
||||
bool "Center"
|
||||
endchoice
|
||||
|
||||
config LV_USE_REFR_DEBUG
|
||||
bool "Draw random colored rectangles over the redrawn areas."
|
||||
|
@ -287,6 +413,11 @@ menu "LVGL configuration"
|
|||
config LV_SPRINTF_CUSTOM
|
||||
bool "Change the built-in (v)snprintf functions"
|
||||
|
||||
config LV_SPRINTF_INCLUDE
|
||||
string "Header to include for the custom sprintf function"
|
||||
depends on LV_SPRINTF_CUSTOM
|
||||
default "stdio.h"
|
||||
|
||||
config LV_SPRINTF_USE_FLOAT
|
||||
bool "Enable float in built-in (v)snprintf functions"
|
||||
depends on !LV_SPRINTF_CUSTOM
|
||||
|
@ -294,33 +425,32 @@ menu "LVGL configuration"
|
|||
config LV_USE_USER_DATA
|
||||
bool "Add a 'user_data' to drivers and objects."
|
||||
default y
|
||||
|
||||
config LV_ENABLE_GC
|
||||
bool "Enable garbage collector"
|
||||
|
||||
config LV_GC_INCLUDE
|
||||
string "Header to include for the garbage collector related things"
|
||||
depends on LV_ENABLE_GC
|
||||
default "gc.h"
|
||||
endmenu
|
||||
|
||||
menu "Compiler settings"
|
||||
config LV_BIG_ENDIAN_SYSTEM
|
||||
bool "For big endian systems set to 1"
|
||||
|
||||
config LV_ATTRIBUTE_MEM_ALIGN_SIZE
|
||||
int "Required alignment size for buffers"
|
||||
default 1
|
||||
|
||||
config LV_ATTRIBUTE_FAST_MEM_USE_IRAM
|
||||
bool "Set IRAM as LV_ATTRIBUTE_FAST_MEM"
|
||||
help
|
||||
Set this option to configure IRAM as LV_ATTRIBUTE_FAST_MEM
|
||||
|
||||
config LV_USE_LARGE_COORD
|
||||
bool "Extend the default -32k..32k coordinate range to -4M..4M by using int32_t for coordinates instead of int16_t"
|
||||
endmenu
|
||||
|
||||
config LV_USE_USER_DATA_FREE
|
||||
bool "Free the user data field upon object deletion"
|
||||
depends on LV_USE_USER_DATA
|
||||
config LV_USER_DATA_FREE_INCLUDE
|
||||
string "Header for user data free function"
|
||||
default "something.h"
|
||||
depends on LV_USE_USER_DATA_FREE
|
||||
config LV_USER_DATA_FREE
|
||||
string "Invoking for user data free function. It has the lv_obj_t pointer as single parameter."
|
||||
default "(user_data_free)"
|
||||
depends on LV_USE_USER_DATA_FREE
|
||||
config LV_USE_API_EXTENSION_V6
|
||||
bool "Use the functions and types from the older (v6) API if possible."
|
||||
default y if !LV_CONF_MINIMAL
|
||||
config LV_USE_API_EXTENSION_V7
|
||||
bool "Use the functions and types from the older (v7) API if possible."
|
||||
default y if !LV_CONF_MINIMAL
|
||||
endmenu
|
||||
|
||||
menu "Font usage"
|
||||
|
@ -369,46 +499,31 @@ menu "LVGL configuration"
|
|||
config LV_FONT_MONTSERRAT_48
|
||||
bool "Enable Montserrat 48"
|
||||
|
||||
config LV_FONT_MONTSERRAT_12_SUBPX
|
||||
bool "Enable Montserrat 12 sub-pixel"
|
||||
config LV_FONT_MONTSERRAT_28_COMPRESSED
|
||||
bool "Enable Montserrat 28 compressed"
|
||||
config LV_FONT_DEJAVU_16_PERSIAN_HEBREW
|
||||
bool "Enable Dejavu 16 Persian, Hebrew, Arabic letters"
|
||||
config LV_FONT_SIMSUN_16_CJK
|
||||
bool "Enable Simsun 16 CJK"
|
||||
|
||||
config LV_FONT_UNSCII_8
|
||||
bool "Enable UNSCII 8 (Perfect monospace font)"
|
||||
default y if LV_CONF_MINIMAL
|
||||
config LV_FONT_UNSCII_16
|
||||
bool "Enable UNSCII 16 (Perfect monospace font)"
|
||||
|
||||
config LV_FONT_MONTSERRAT12SUBPX
|
||||
bool "Enable Montserrat 12 sub-pixel"
|
||||
config LV_FONT_MONTSERRAT28COMPRESSED
|
||||
bool "Enable Montserrat 28 compressed"
|
||||
config LV_FONT_DEJAVU_16_PERSIAN_HEBREW
|
||||
bool "Enable Dejavu 16 Persian, Hebrew, Arabic letters"
|
||||
config LV_FONT_SIMSUN_16_CJK
|
||||
bool "Enable Simsun 16 CJK"
|
||||
config LV_FONT_CUSTOM
|
||||
bool "Enable the custom font"
|
||||
config LV_FONT_CUSTOM_DECLARE
|
||||
string "Header to include for the custom font"
|
||||
depends on LV_FONT_CUSTOM
|
||||
endmenu
|
||||
|
||||
config LV_FONT_FMT_TXT_LARGE
|
||||
bool "Enable it if you have fonts with a lot of characters."
|
||||
help
|
||||
The limit depends on the font size, font face and bpp
|
||||
but with > 10,000 characters if you see issues probably you
|
||||
need to enable it.
|
||||
|
||||
config LV_USE_FONT_COMPRESSED
|
||||
bool "Sets support for compressed fonts."
|
||||
|
||||
config LV_USE_FONT_SUBPX
|
||||
bool "Enable subpixel rendering."
|
||||
|
||||
config LV_FONT_SUBPX_BGR
|
||||
bool "Use BGR instead RGB for sub-pixel rendering."
|
||||
depends on LV_USE_FONT_SUBPX
|
||||
help
|
||||
Set the pixel order of the display.
|
||||
Important only if "subpx fonts" are used.
|
||||
With "normal" font it doesn't matter.
|
||||
|
||||
choice LV_FONT_DEFAULT
|
||||
prompt "Select theme default title font"
|
||||
default LV_FONT_DEFAULT_MONTSERRAT_16 if !LV_CONF_MINIMAL
|
||||
default LV_FONT_DEFAULT_MONTSERRAT_14 if !LV_CONF_MINIMAL
|
||||
default LV_FONT_DEFAULT_UNSCII_8 if LV_CONF_MINIMAL
|
||||
help
|
||||
Select theme default title font
|
||||
|
@ -473,46 +588,46 @@ menu "LVGL configuration"
|
|||
config LV_FONT_DEFAULT_MONTSERRAT_48
|
||||
bool "Montserrat 48"
|
||||
select LV_FONT_MONTSERRAT_48
|
||||
config LV_FONT_DEFAULT_UNSCII_8
|
||||
bool "UNSCII 8 (Perfect monospace font)"
|
||||
select LV_FONT_UNSCII_8
|
||||
config LV_FONT_DEFAULT_UNSCII_16
|
||||
bool "UNSCII 16 (Perfect monospace font)"
|
||||
select LV_FONT_UNSCII_16
|
||||
config LV_FONT_DEFAULT_MONTSERRAT12SUBPX
|
||||
config LV_FONT_DEFAULT_MONTSERRAT_12_SUBPX
|
||||
bool "Montserrat 12 sub-pixel"
|
||||
select LV_FONT_MONTSERRAT12SUBPX
|
||||
config LV_FONT_DEFAULT_MONTSERRAT28COMPRESSED
|
||||
select LV_FONT_MONTSERRAT_12_SUBPX
|
||||
config LV_FONT_DEFAULT_MONTSERRAT_28_COMPRESSED
|
||||
bool "Montserrat 28 compressed"
|
||||
select LV_FONT_MONTSERRAT28COMPRESSED
|
||||
select LV_FONT_MONTSERRAT_28_COMPRESSED
|
||||
config LV_FONT_DEFAULT_DEJAVU_16_PERSIAN_HEBREW
|
||||
bool "Dejavu 16 Persian, Hebrew, Arabic letters"
|
||||
select LV_FONT_DEJAVU_16_PERSIAN_HEBREW
|
||||
config LV_FONT_DEFAULT_SIMSUN_16_CJK
|
||||
bool "Simsun 16 CJK"
|
||||
select LV_FONT_SIMSUN_16_CJK
|
||||
config LV_FONT_DEFAULT_UNSCII_8
|
||||
bool "UNSCII 8 (Perfect monospace font)"
|
||||
select LV_FONT_UNSCII_8
|
||||
config LV_FONT_DEFAULT_UNSCII_16
|
||||
bool "UNSCII 16 (Perfect monospace font)"
|
||||
select LV_FONT_UNSCII_16
|
||||
endchoice
|
||||
endmenu
|
||||
|
||||
menu "Themes"
|
||||
config LV_USE_THEME_DEFAULT
|
||||
bool "A simple, impressive and very complete theme"
|
||||
default y
|
||||
config LV_THEME_DEFAULT_PALETTE_LIGHT
|
||||
bool "Yes to set light mode, No to set dark mode"
|
||||
default y
|
||||
depends on LV_USE_THEME_DEFAULT
|
||||
config LV_THEME_DEFAULT_GROW
|
||||
bool "Enable grow on press"
|
||||
default y
|
||||
depends on LV_USE_THEME_DEFAULT
|
||||
config LV_THEME_DEFAULT_TRANSITION_TIME
|
||||
int "Default transition time in [ms]"
|
||||
default 80
|
||||
depends on LV_USE_THEME_DEFAULT
|
||||
config LV_USE_THEME_BASIC
|
||||
bool "A very simple theme that is a good starting point for a custom theme"
|
||||
default y
|
||||
config LV_FONT_FMT_TXT_LARGE
|
||||
bool "Enable it if you have fonts with a lot of characters."
|
||||
help
|
||||
The limit depends on the font size, font face and bpp
|
||||
but with > 10,000 characters if you see issues probably you
|
||||
need to enable it.
|
||||
|
||||
config LV_USE_FONT_COMPRESSED
|
||||
bool "Sets support for compressed fonts."
|
||||
|
||||
config LV_USE_FONT_SUBPX
|
||||
bool "Enable subpixel rendering."
|
||||
|
||||
config LV_FONT_SUBPX_BGR
|
||||
bool "Use BGR instead RGB for sub-pixel rendering."
|
||||
depends on LV_USE_FONT_SUBPX
|
||||
help
|
||||
Set the pixel order of the display.
|
||||
Important only if "subpx fonts" are used.
|
||||
With "normal" font it doesn't matter.
|
||||
endmenu
|
||||
|
||||
menu "Text Settings"
|
||||
|
@ -604,9 +719,6 @@ menu "LVGL configuration"
|
|||
config LV_USE_CHECKBOX
|
||||
bool "Check Box"
|
||||
default y if !LV_CONF_MINIMAL
|
||||
config LV_USE_CHART
|
||||
bool "Chart."
|
||||
default y if !LV_CONF_MINIMAL
|
||||
config LV_USE_DROPDOWN
|
||||
bool "Drop down list. Requires: lv_label."
|
||||
select LV_USE_LABEL
|
||||
|
@ -618,18 +730,17 @@ menu "LVGL configuration"
|
|||
config LV_USE_LABEL
|
||||
bool "Label."
|
||||
default y if !LV_CONF_MINIMAL
|
||||
config LV_LABEL_TEXT_SEL
|
||||
config LV_LABEL_TEXT_SELECTION
|
||||
bool "Enable selecting text of the label."
|
||||
depends on LV_USE_LABEL
|
||||
default y
|
||||
config LV_LABEL_LONG_TXT_HINT
|
||||
bool "Store extra some info in labels (12 bytes) to speed up drawing of very long texts."
|
||||
depends on LV_USE_LABEL
|
||||
default y
|
||||
config LV_USE_LINE
|
||||
bool "Line."
|
||||
default y if !LV_CONF_MINIMAL
|
||||
config LV_USE_METER
|
||||
bool "Meter."
|
||||
default y if !LV_CONF_MINIMAL
|
||||
config LV_USE_ROLLER
|
||||
bool "Roller. Requires: lv_label."
|
||||
select LV_USE_LABEL
|
||||
|
@ -643,15 +754,14 @@ menu "LVGL configuration"
|
|||
select LV_USE_BAR
|
||||
default y if !LV_CONF_MINIMAL
|
||||
config LV_USE_SWITCH
|
||||
bool "Switch. Dependencies: lv_slider."
|
||||
select LV_USE_SLIDER
|
||||
bool "Switch."
|
||||
default y if !LV_CONF_MINIMAL
|
||||
config LV_USE_TEXTAREA
|
||||
bool "Text area. Requires: lv_label."
|
||||
select LV_USE_LABEL
|
||||
default y if !LV_CONF_MINIMAL
|
||||
config LV_TEXTAREA_DEF_PWN_SHOW_TIME
|
||||
int "Text area def. pwn show time [ms]."
|
||||
config LV_TEXTAREA_DEF_PWD_SHOW_TIME
|
||||
int "Text area def. pwd show time [ms]."
|
||||
default 1500
|
||||
depends on LV_USE_TEXTAREA
|
||||
config LV_USE_TABLE
|
||||
|
@ -659,10 +769,9 @@ menu "LVGL configuration"
|
|||
default y if !LV_CONF_MINIMAL
|
||||
endmenu
|
||||
|
||||
menu "Extra components"
|
||||
menu "Extra Widgets"
|
||||
config LV_USE_ANIMIMG
|
||||
bool "Anim image."
|
||||
select LV_USE_IMG
|
||||
default y if !LV_CONF_MINIMAL
|
||||
config LV_USE_CALENDAR
|
||||
bool "Calendar."
|
||||
|
@ -672,43 +781,251 @@ menu "LVGL configuration"
|
|||
depends on LV_USE_CALENDAR
|
||||
config LV_USE_CALENDAR_HEADER_ARROW
|
||||
bool "Use calendar header arrow"
|
||||
depends on LV_USE_CALENDAR
|
||||
default y
|
||||
config LV_USE_CALENDAR_HEADER_DROPDOWN
|
||||
bool "Use calendar header dropdown"
|
||||
depends on LV_USE_CALENDAR
|
||||
default y
|
||||
config LV_USE_CHART
|
||||
bool "Chart."
|
||||
default y if !LV_CONF_MINIMAL
|
||||
config LV_USE_COLORWHEEL
|
||||
bool "Colorwheel."
|
||||
default y if !LV_CONF_MINIMAL
|
||||
config LV_USE_IMGBTN
|
||||
bool "Imgbtn."
|
||||
default y if !LV_CONF_MINIMAL
|
||||
config LV_USE_KEYBOARD
|
||||
bool "Keyboard."
|
||||
default y if !LV_CONF_MINIMAL
|
||||
config LV_USE_LED
|
||||
bool "LED."
|
||||
default y if !LV_CONF_MINIMAL
|
||||
config LV_USE_LIST
|
||||
bool "List."
|
||||
default y if !LV_CONF_MINIMAL
|
||||
config LV_USE_MENU
|
||||
bool "Menu."
|
||||
default y if !LV_CONF_MINIMAL
|
||||
config LV_USE_METER
|
||||
bool "Meter."
|
||||
default y if !LV_CONF_MINIMAL
|
||||
config LV_USE_MSGBOX
|
||||
bool "Msgbox."
|
||||
default y if !LV_CONF_MINIMAL
|
||||
config LV_USE_SPINBOX
|
||||
bool "Spinbox."
|
||||
default y if !LV_CONF_MINIMAL
|
||||
config LV_USE_SPINNER
|
||||
bool "Spinner."
|
||||
default y if !LV_CONF_MINIMAL
|
||||
config LV_USE_TABVIEW
|
||||
bool "Tabview."
|
||||
default y if !LV_CONF_MINIMAL
|
||||
config LV_USE_TILEVIEW
|
||||
bool "Tileview"
|
||||
default y if !LV_CONF_MINIMAL
|
||||
config LV_USE_WIN
|
||||
bool "Win"
|
||||
default y if !LV_CONF_MINIMAL
|
||||
config LV_USE_SPAN
|
||||
bool "span"
|
||||
default y if !LV_CONF_MINIMAL
|
||||
config LV_SPAN_SNIPPET_STACK_SIZE
|
||||
int "Maximum number of span descriptor"
|
||||
default 64
|
||||
depends on LV_USE_SPAN
|
||||
endmenu
|
||||
|
||||
menu "Themes"
|
||||
config LV_USE_THEME_DEFAULT
|
||||
bool "A simple, impressive and very complete theme"
|
||||
default y if !LV_CONF_MINIMAL
|
||||
config LV_THEME_DEFAULT_DARK
|
||||
bool "Yes to set dark mode, No to set light mode"
|
||||
depends on LV_USE_THEME_DEFAULT
|
||||
config LV_THEME_DEFAULT_GROW
|
||||
bool "Enable grow on press"
|
||||
default y
|
||||
depends on LV_USE_THEME_DEFAULT
|
||||
config LV_THEME_DEFAULT_TRANSITION_TIME
|
||||
int "Default transition time in [ms]"
|
||||
default 80
|
||||
depends on LV_USE_THEME_DEFAULT
|
||||
config LV_USE_THEME_BASIC
|
||||
bool "A very simple theme that is a good starting point for a custom theme"
|
||||
default y if !LV_CONF_MINIMAL
|
||||
endmenu
|
||||
|
||||
menu "Layouts"
|
||||
config LV_USE_FLEX
|
||||
bool "A layout similar to Flexbox in CSS."
|
||||
default y
|
||||
default y if !LV_CONF_MINIMAL
|
||||
config LV_USE_GRID
|
||||
bool "A layout similar to Grid in CSS."
|
||||
default y
|
||||
default y if !LV_CONF_MINIMAL
|
||||
endmenu
|
||||
|
||||
menu "3rd Party Libraries"
|
||||
config LV_USE_FS_STDIO
|
||||
bool "File system on top of stdio API"
|
||||
config LV_FS_STDIO_LETTER
|
||||
string "Set an upper cased letter on which the drive will accessible (e.g. 'A' i.e. 65 )"
|
||||
depends on LV_USE_FS_STDIO != 0
|
||||
config LV_FS_STDIO_PATH
|
||||
string "Set the working directory"
|
||||
depends on LV_USE_FS_STDIO != 0
|
||||
config LV_FS_STDIO_CACHE_SIZE
|
||||
string ">0 to cache this number of bytes in lv_fs_read()"
|
||||
depends on LV_USE_FS_STDIO != 0
|
||||
|
||||
config LV_USE_FS_POSIX
|
||||
bool "File system on top of posix API"
|
||||
config LV_FS_POSIX_LETTER
|
||||
int "Set an upper cased letter on which the drive will accessible (e.g. 'A' i.e. 65)"
|
||||
default 0
|
||||
depends on LV_USE_FS_POSIX != 0
|
||||
config LV_FS_POSIX_PATH
|
||||
string "Set the working directory"
|
||||
depends on LV_USE_FS_POSIX != 0
|
||||
config LV_FS_POSIX_CACHE_SIZE
|
||||
int ">0 to cache this number of bytes in lv_fs_read()"
|
||||
default 0
|
||||
depends on LV_USE_FS_POSIX != 0
|
||||
|
||||
config LV_USE_FS_WIN32
|
||||
bool "File system on top of Win32 API"
|
||||
config LV_FS_WIN32_LETTER
|
||||
int "Set an upper cased letter on which the drive will accessible (e.g. 'A' i.e. 65)"
|
||||
default 0
|
||||
depends on LV_USE_FS_WIN32 != 0
|
||||
config LV_FS_WIN32_PATH
|
||||
string "Set the working directory"
|
||||
depends on LV_USE_FS_WIN32 != 0
|
||||
config LV_FS_WIN32_CACHE_SIZE
|
||||
int ">0 to cache this number of bytes in lv_fs_read()"
|
||||
default 0
|
||||
depends on LV_USE_FS_WIN32 != 0
|
||||
|
||||
config LV_USE_FS_FATFS
|
||||
bool "File system on top of FatFS"
|
||||
config LV_FS_FATFS_LETTER
|
||||
int "Set an upper cased letter on which the drive will accessible (e.g. 'A' i.e. 65)"
|
||||
default 0
|
||||
depends on LV_USE_FS_FATFS != 0
|
||||
config LV_FS_FATFS_CACHE_SIZE
|
||||
int ">0 to cache this number of bytes in lv_fs_read()"
|
||||
default 0
|
||||
depends on LV_USE_FS_FATFS != 0
|
||||
|
||||
config LV_USE_PNG
|
||||
bool "PNG decoder library"
|
||||
|
||||
config LV_USE_BMP
|
||||
bool "BMP decoder library"
|
||||
|
||||
config LV_USE_SJPG
|
||||
bool "JPG + split JPG decoder library"
|
||||
|
||||
config LV_USE_GIF
|
||||
bool "GIF decoder library"
|
||||
|
||||
config LV_USE_QRCODE
|
||||
bool "QR code library"
|
||||
|
||||
config LV_USE_FREETYPE
|
||||
bool "FreeType library"
|
||||
if LV_USE_FREETYPE
|
||||
menu "FreeType cache config"
|
||||
config LV_FREETYPE_CACHE_SIZE
|
||||
int "Memory used by FreeType to cache characters [bytes] (-1: no caching)"
|
||||
default 16384
|
||||
if LV_FREETYPE_CACHE_SIZE >= 0
|
||||
config LV_FREETYPE_SBIT_CACHE
|
||||
bool "enable sbit cache"
|
||||
default n
|
||||
config LV_FREETYPE_CACHE_FT_FACES
|
||||
int "The maximum number of FT_Face(0: use defaults)"
|
||||
default 0
|
||||
config LV_FREETYPE_CACHE_FT_SIZES
|
||||
int "The maximum number of FT_Size(0: use defaults)"
|
||||
default 0
|
||||
endif
|
||||
endmenu
|
||||
endif
|
||||
|
||||
config LV_USE_RLOTTIE
|
||||
bool "Lottie library"
|
||||
|
||||
config LV_USE_FFMPEG
|
||||
bool "FFmpeg library"
|
||||
config LV_FFMPEG_AV_DUMP_FORMAT
|
||||
bool "Dump av format"
|
||||
depends on LV_USE_FFMPEG
|
||||
default n
|
||||
endmenu
|
||||
|
||||
menu "Others"
|
||||
config LV_USE_SNAPSHOT
|
||||
bool "Enable API to take snapshot"
|
||||
default y if !LV_CONF_MINIMAL
|
||||
|
||||
config LV_USE_MONKEY
|
||||
bool "Enable Monkey test"
|
||||
default n
|
||||
endmenu
|
||||
|
||||
menu "Examples"
|
||||
config LV_BUILD_EXAMPLES
|
||||
bool "Enable the examples to be built"
|
||||
default y if !LV_CONF_MINIMAL
|
||||
endmenu
|
||||
|
||||
menu "Demos"
|
||||
config LV_USE_DEMO_WIDGETS
|
||||
bool "Show some widget"
|
||||
default n
|
||||
config LV_DEMO_WIDGETS_SLIDESHOW
|
||||
bool "Enable slide show"
|
||||
depends on LV_USE_DEMO_WIDGETS
|
||||
default n
|
||||
|
||||
config LV_USE_DEMO_KEYPAD_AND_ENCODER
|
||||
bool "Demonstrate the usage of encoder and keyboard"
|
||||
default n
|
||||
|
||||
config LV_USE_DEMO_BENCHMARK
|
||||
bool "Benchmark your system"
|
||||
default n
|
||||
|
||||
config LV_USE_DEMO_STRESS
|
||||
bool "Stress test for LVGL"
|
||||
default n
|
||||
|
||||
config LV_USE_DEMO_MUSIC
|
||||
bool "Music player demo"
|
||||
default n
|
||||
config LV_DEMO_MUSIC_SQUARE
|
||||
bool "Enable Square"
|
||||
depends on LV_USE_DEMO_MUSIC
|
||||
default n
|
||||
config LV_DEMO_MUSIC_LANDSCAPE
|
||||
bool "Enable Landscape"
|
||||
depends on LV_USE_DEMO_MUSIC
|
||||
default n
|
||||
config LV_DEMO_MUSIC_ROUND
|
||||
bool "Enable Round"
|
||||
depends on LV_USE_DEMO_MUSIC
|
||||
default n
|
||||
config LV_DEMO_MUSIC_LARGE
|
||||
bool "Enable Large"
|
||||
depends on LV_USE_DEMO_MUSIC
|
||||
default n
|
||||
config LV_DEMO_MUSIC_AUTO_PLAY
|
||||
bool "Enable Auto play"
|
||||
depends on LV_USE_DEMO_MUSIC
|
||||
default n
|
||||
endmenu
|
||||
|
||||
endmenu
|
||||
|
|
|
@ -16,6 +16,10 @@ LVGL provides everything you need to create an embedded GUI with easy-to-use gra
|
|||
<a href="https://docs.lvgl.io/master/examples.html">Interactive examples</a>
|
||||
</h4>
|
||||
|
||||
|
||||
**English** | [中文](./README_zh.md) |
|
||||
|
||||
|
||||
---
|
||||
|
||||
#### Table of content
|
||||
|
@ -25,7 +29,6 @@ LVGL provides everything you need to create an embedded GUI with easy-to-use gra
|
|||
- [Services](#services)
|
||||
- [Contributing](#contributing)
|
||||
|
||||
|
||||
## Overview
|
||||
### Features
|
||||
* Powerful [building blocks](https://docs.lvgl.io/master/widgets/index.html): buttons, charts, lists, sliders, images, etc.
|
||||
|
@ -39,7 +42,7 @@ LVGL provides everything you need to create an embedded GUI with easy-to-use gra
|
|||
* 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)
|
||||
* Smooth rendering even with a [single frame buffer](https://docs.lvgl.io/master/porting/display.html)
|
||||
* Written in C and compatibile with C++
|
||||
* 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
|
||||
* 100+ simple [Examples](https://github.com/lvgl/lvgl/tree/master/examples)
|
||||
|
@ -102,13 +105,14 @@ Just to mention some platforms:
|
|||
- Nordic NRF52 Bluetooth modules
|
||||
- Quectel modems
|
||||
|
||||
LVGL is also avaiable as:
|
||||
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)
|
||||
- [Zephyr library](https://docs.zephyrproject.org/latest/reference/kconfig/CONFIG_LVGL.html)
|
||||
- [ESP32 component](https://docs.lvgl.io/master/get-started/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)
|
||||
|
||||
|
||||
## Get started
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "lvgl",
|
||||
"version": "8.1.0",
|
||||
"version": "8.2.0",
|
||||
"keywords": "graphics, gui, embedded, tft, lvgl",
|
||||
"description": "Graphics library to create embedded GUI with easy-to-use graphical elements, beautiful visual effects and low memory footprint. It offers anti-aliasing, opacity, and animations using only one frame buffer.",
|
||||
"repository": {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
name=lvgl
|
||||
version=8.1.0
|
||||
version=8.2.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.1.0
|
||||
* Configuration file for v8.2.0
|
||||
*/
|
||||
|
||||
/*
|
||||
|
@ -48,22 +48,22 @@
|
|||
/*1: use custom malloc/free, 0: use the built-in `lv_mem_alloc()` and `lv_mem_free()`*/
|
||||
#define LV_MEM_CUSTOM 0
|
||||
#if LV_MEM_CUSTOM == 0
|
||||
/*Size of the memory available for `lv_mem_alloc()` in bytes (>= 2kB)*/
|
||||
# define LV_MEM_SIZE (32U * 1024U) /*[bytes]*/
|
||||
/*Size of the memory available for `lv_mem_alloc()` in bytes (>= 2kB)*/
|
||||
#define LV_MEM_SIZE (48U * 1024U) /*[bytes]*/
|
||||
|
||||
/*Set an address for the memory pool instead of allocating it as a normal array. Can be in external SRAM too.*/
|
||||
# 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*/
|
||||
#endif
|
||||
/*Set an address for the memory pool instead of allocating it as a normal array. Can be in external SRAM too.*/
|
||||
#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*/
|
||||
#endif
|
||||
|
||||
#else /*LV_MEM_CUSTOM*/
|
||||
# define LV_MEM_CUSTOM_INCLUDE <stdlib.h> /*Header for the dynamic memory function*/
|
||||
# define LV_MEM_CUSTOM_ALLOC malloc
|
||||
# define LV_MEM_CUSTOM_FREE free
|
||||
# define LV_MEM_CUSTOM_REALLOC realloc
|
||||
#define LV_MEM_CUSTOM_INCLUDE <stdlib.h> /*Header for the dynamic memory function*/
|
||||
#define LV_MEM_CUSTOM_ALLOC malloc
|
||||
#define LV_MEM_CUSTOM_FREE free
|
||||
#define LV_MEM_CUSTOM_REALLOC realloc
|
||||
#endif /*LV_MEM_CUSTOM*/
|
||||
|
||||
/*Number of the intermediate memory buffer used during rendering and other internal processing mechanisms.
|
||||
|
@ -87,8 +87,8 @@
|
|||
*It removes the need to manually update the tick with `lv_tick_inc()`)*/
|
||||
#define LV_TICK_CUSTOM 0
|
||||
#if LV_TICK_CUSTOM
|
||||
#define LV_TICK_CUSTOM_INCLUDE "Arduino.h" /*Header for the system time function*/
|
||||
#define LV_TICK_CUSTOM_SYS_TIME_EXPR (millis()) /*Expression evaluating to current system time in ms*/
|
||||
#define LV_TICK_CUSTOM_INCLUDE "Arduino.h" /*Header for the system time function*/
|
||||
#define LV_TICK_CUSTOM_SYS_TIME_EXPR (millis()) /*Expression evaluating to current system time in ms*/
|
||||
#endif /*LV_TICK_CUSTOM*/
|
||||
|
||||
/*Default Dot Per Inch. Used to initialize default sizes such as widgets sized, style paddings.
|
||||
|
@ -108,17 +108,16 @@
|
|||
#define LV_DRAW_COMPLEX 1
|
||||
#if LV_DRAW_COMPLEX != 0
|
||||
|
||||
/*Allow buffering some shadow calculation.
|
||||
/*Allow buffering some shadow calculation.
|
||||
*LV_SHADOW_CACHE_SIZE is the max. shadow size to buffer, where shadow size is `shadow_width + radius`
|
||||
*Caching has LV_SHADOW_CACHE_SIZE^2 RAM cost*/
|
||||
#define LV_SHADOW_CACHE_SIZE 0
|
||||
#define LV_SHADOW_CACHE_SIZE 0
|
||||
|
||||
/* Set number of maximally cached circle data.
|
||||
/* Set number of maximally cached circle data.
|
||||
* The circumference of 1/4 circle are saved for anti-aliasing
|
||||
* radius * 4 bytes are used per circle (the most often used radiuses are saved)
|
||||
* 0: to disable caching */
|
||||
#define LV_CIRCLE_CACHE_SIZE 4
|
||||
|
||||
#define LV_CIRCLE_CACHE_SIZE 4
|
||||
#endif /*LV_DRAW_COMPLEX*/
|
||||
|
||||
/*Default image cache size. Image caching keeps the images opened.
|
||||
|
@ -128,7 +127,30 @@
|
|||
*0: to disable caching*/
|
||||
#define LV_IMG_CACHE_DEF_SIZE 0
|
||||
|
||||
/*Maximum buffer size to allocate for rotation. Only used if software rotation is enabled in the display driver.*/
|
||||
/*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
|
||||
|
||||
/*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
|
||||
|
||||
/*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
|
||||
#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
|
||||
#endif
|
||||
|
||||
/*Maximum buffer size to allocate for rotation.
|
||||
*Only used if software rotation is enabled in the display driver.*/
|
||||
#define LV_DISP_ROT_MAX_BUF (10*1024)
|
||||
|
||||
/*-------------
|
||||
|
@ -138,32 +160,33 @@
|
|||
/*Use STM32's DMA2D (aka Chrom Art) GPU*/
|
||||
#define LV_USE_GPU_STM32_DMA2D 0
|
||||
#if LV_USE_GPU_STM32_DMA2D
|
||||
/*Must be defined to include path of CMSIS header of target processor
|
||||
e.g. "stm32f769xx.h" or "stm32f429xx.h"*/
|
||||
#define LV_GPU_DMA2D_CMSIS_INCLUDE
|
||||
/*Must be defined to include path of CMSIS header of target processor
|
||||
e.g. "stm32f769xx.h" or "stm32f429xx.h"*/
|
||||
#define LV_GPU_DMA2D_CMSIS_INCLUDE
|
||||
#endif
|
||||
|
||||
/*Use NXP's PXP GPU iMX RTxxx platforms*/
|
||||
#define LV_USE_GPU_NXP_PXP 0
|
||||
#if LV_USE_GPU_NXP_PXP
|
||||
/*1: Add default bare metal and FreeRTOS interrupt handling routines for PXP (lv_gpu_nxp_pxp_osa.c)
|
||||
/*1: Add default bare metal and FreeRTOS interrupt handling routines for PXP (lv_gpu_nxp_pxp_osa.c)
|
||||
* and call lv_gpu_nxp_pxp_init() automatically during lv_init(). Note that symbol SDK_OS_FREE_RTOS
|
||||
* has to be defined in order to use FreeRTOS OSA, otherwise bare-metal implementation is selected.
|
||||
*0: lv_gpu_nxp_pxp_init() has to be called manually before lv_init()
|
||||
*/
|
||||
#define LV_USE_GPU_NXP_PXP_AUTO_INIT 0
|
||||
#define LV_USE_GPU_NXP_PXP_AUTO_INIT 0
|
||||
#endif
|
||||
|
||||
/*Use NXP's VG-Lite GPU iMX RTxxx platforms*/
|
||||
#define LV_USE_GPU_NXP_VG_LITE 0
|
||||
|
||||
/*Use exnternal renderer*/
|
||||
#define LV_USE_EXTERNAL_RENDERER 0
|
||||
|
||||
/*Use SDL renderer API. Requires LV_USE_EXTERNAL_RENDERER*/
|
||||
/*Use SDL renderer API*/
|
||||
#define LV_USE_GPU_SDL 0
|
||||
#if LV_USE_GPU_SDL
|
||||
# define LV_GPU_SDL_INCLUDE_PATH <SDL2/SDL.h>
|
||||
#define LV_GPU_SDL_INCLUDE_PATH <SDL2/SDL.h>
|
||||
/*Texture cache size, 8MB by default*/
|
||||
#define LV_GPU_SDL_LRU_SIZE (1024 * 1024 * 8)
|
||||
/*Custom blend mode for mask drawing, disable if you need to link with older SDL2 lib*/
|
||||
#define LV_GPU_SDL_CUSTOM_BLEND_MODE (SDL_VERSION_ATLEAST(2, 0, 6))
|
||||
#endif
|
||||
|
||||
/*-------------
|
||||
|
@ -174,28 +197,28 @@ e.g. "stm32f769xx.h" or "stm32f429xx.h"*/
|
|||
#define LV_USE_LOG 0
|
||||
#if LV_USE_LOG
|
||||
|
||||
/*How important log should be added:
|
||||
/*How important log should be added:
|
||||
*LV_LOG_LEVEL_TRACE A lot of logs to give detailed information
|
||||
*LV_LOG_LEVEL_INFO Log important events
|
||||
*LV_LOG_LEVEL_WARN Log if something unwanted happened but didn't cause a problem
|
||||
*LV_LOG_LEVEL_ERROR Only critical issue, when the system may fail
|
||||
*LV_LOG_LEVEL_USER Only logs added by the user
|
||||
*LV_LOG_LEVEL_NONE Do not log anything*/
|
||||
# define LV_LOG_LEVEL LV_LOG_LEVEL_WARN
|
||||
#define LV_LOG_LEVEL LV_LOG_LEVEL_WARN
|
||||
|
||||
/*1: Print the log with 'printf';
|
||||
/*1: Print the log with 'printf';
|
||||
*0: User need to register a callback with `lv_log_register_print_cb()`*/
|
||||
# define LV_LOG_PRINTF 0
|
||||
#define LV_LOG_PRINTF 0
|
||||
|
||||
/*Enable/disable LV_LOG_TRACE in modules that produces a huge number of logs*/
|
||||
# define LV_LOG_TRACE_MEM 1
|
||||
# define LV_LOG_TRACE_TIMER 1
|
||||
# define LV_LOG_TRACE_INDEV 1
|
||||
# define LV_LOG_TRACE_DISP_REFR 1
|
||||
# define LV_LOG_TRACE_EVENT 1
|
||||
# define LV_LOG_TRACE_OBJ_CREATE 1
|
||||
# define LV_LOG_TRACE_LAYOUT 1
|
||||
# define LV_LOG_TRACE_ANIM 1
|
||||
/*Enable/disable LV_LOG_TRACE in modules that produces a huge number of logs*/
|
||||
#define LV_LOG_TRACE_MEM 1
|
||||
#define LV_LOG_TRACE_TIMER 1
|
||||
#define LV_LOG_TRACE_INDEV 1
|
||||
#define LV_LOG_TRACE_DISP_REFR 1
|
||||
#define LV_LOG_TRACE_EVENT 1
|
||||
#define LV_LOG_TRACE_OBJ_CREATE 1
|
||||
#define LV_LOG_TRACE_LAYOUT 1
|
||||
#define LV_LOG_TRACE_ANIM 1
|
||||
|
||||
#endif /*LV_USE_LOG*/
|
||||
|
||||
|
@ -219,17 +242,17 @@ e.g. "stm32f769xx.h" or "stm32f429xx.h"*/
|
|||
* Others
|
||||
*-----------*/
|
||||
|
||||
/*1: Show CPU usage and FPS count in the right bottom corner*/
|
||||
/*1: Show CPU usage and FPS count*/
|
||||
#define LV_USE_PERF_MONITOR 0
|
||||
#if LV_USE_PERF_MONITOR
|
||||
#define LV_USE_PERF_MONITOR_POS LV_ALIGN_BOTTOM_RIGHT
|
||||
#define LV_USE_PERF_MONITOR_POS LV_ALIGN_BOTTOM_RIGHT
|
||||
#endif
|
||||
|
||||
/*1: Show the used memory and the memory fragmentation in the left bottom corner
|
||||
/*1: Show the used memory and the memory fragmentation
|
||||
* Requires LV_MEM_CUSTOM = 0*/
|
||||
#define LV_USE_MEM_MONITOR 0
|
||||
#if LV_USE_PERF_MONITOR
|
||||
#define LV_USE_MEM_MONITOR_POS LV_ALIGN_BOTTOM_LEFT
|
||||
#if LV_USE_MEM_MONITOR
|
||||
#define LV_USE_MEM_MONITOR_POS LV_ALIGN_BOTTOM_LEFT
|
||||
#endif
|
||||
|
||||
/*1: Draw random colored rectangles over the redrawn areas*/
|
||||
|
@ -238,11 +261,11 @@ e.g. "stm32f769xx.h" or "stm32f429xx.h"*/
|
|||
/*Change the built in (v)snprintf functions*/
|
||||
#define LV_SPRINTF_CUSTOM 0
|
||||
#if LV_SPRINTF_CUSTOM
|
||||
# define LV_SPRINTF_INCLUDE <stdio.h>
|
||||
# define lv_snprintf snprintf
|
||||
# define lv_vsnprintf vsnprintf
|
||||
#define LV_SPRINTF_INCLUDE <stdio.h>
|
||||
#define lv_snprintf snprintf
|
||||
#define lv_vsnprintf vsnprintf
|
||||
#else /*LV_SPRINTF_CUSTOM*/
|
||||
# define LV_SPRINTF_USE_FLOAT 0
|
||||
#define LV_SPRINTF_USE_FLOAT 0
|
||||
#endif /*LV_SPRINTF_CUSTOM*/
|
||||
|
||||
#define LV_USE_USER_DATA 1
|
||||
|
@ -251,7 +274,7 @@ e.g. "stm32f769xx.h" or "stm32f429xx.h"*/
|
|||
*Used if lvgl is bound to higher level language and the memory is managed by that language*/
|
||||
#define LV_ENABLE_GC 0
|
||||
#if LV_ENABLE_GC != 0
|
||||
# define LV_GC_INCLUDE "gc.h" /*Include Garbage Collector related things*/
|
||||
#define LV_GC_INCLUDE "gc.h" /*Include Garbage Collector related things*/
|
||||
#endif /*LV_ENABLE_GC*/
|
||||
|
||||
/*=====================
|
||||
|
@ -280,7 +303,7 @@ e.g. "stm32f769xx.h" or "stm32f429xx.h"*/
|
|||
/*Attribute to mark large constant arrays for example font's bitmaps*/
|
||||
#define LV_ATTRIBUTE_LARGE_CONST
|
||||
|
||||
/*Complier prefix for a big array declaration in RAM*/
|
||||
/*Compiler prefix for a big array declaration in RAM*/
|
||||
#define LV_ATTRIBUTE_LARGE_RAM_ARRAY
|
||||
|
||||
/*Place performance critical functions into a faster memory (e.g RAM)*/
|
||||
|
@ -327,7 +350,7 @@ e.g. "stm32f769xx.h" or "stm32f429xx.h"*/
|
|||
/*Demonstrate special features*/
|
||||
#define LV_FONT_MONTSERRAT_12_SUBPX 0
|
||||
#define LV_FONT_MONTSERRAT_28_COMPRESSED 0 /*bpp = 3*/
|
||||
#define LV_FONT_DEJAVU_16_PERSIAN_HEBREW 0 /*Hebrew, Arabic, Perisan letters and all their forms*/
|
||||
#define LV_FONT_DEJAVU_16_PERSIAN_HEBREW 0 /*Hebrew, Arabic, Persian letters and all their forms*/
|
||||
#define LV_FONT_SIMSUN_16_CJK 0 /*1000 most common CJK radicals*/
|
||||
|
||||
/*Pixel perfect monospace fonts*/
|
||||
|
@ -353,8 +376,8 @@ e.g. "stm32f769xx.h" or "stm32f429xx.h"*/
|
|||
/*Enable subpixel rendering*/
|
||||
#define LV_USE_FONT_SUBPX 0
|
||||
#if LV_USE_FONT_SUBPX
|
||||
/*Set the pixel order of the display. Physical order of RGB channels. Doesn't matter with "normal" fonts.*/
|
||||
#define LV_FONT_SUBPX_BGR 0 /*0: RGB; 1:BGR order*/
|
||||
/*Set the pixel order of the display. Physical order of RGB channels. Doesn't matter with "normal" fonts.*/
|
||||
#define LV_FONT_SUBPX_BGR 0 /*0: RGB; 1:BGR order*/
|
||||
#endif
|
||||
|
||||
/*=================
|
||||
|
@ -369,7 +392,7 @@ e.g. "stm32f769xx.h" or "stm32f429xx.h"*/
|
|||
*/
|
||||
#define LV_TXT_ENC LV_TXT_ENC_UTF8
|
||||
|
||||
/*Can break (wrap) texts on these chars*/
|
||||
/*Can break (wrap) texts on these chars*/
|
||||
#define LV_TXT_BREAK_CHARS " ,.;:-_"
|
||||
|
||||
/*If a word is at least this long, will break wherever "prettiest"
|
||||
|
@ -392,11 +415,11 @@ e.g. "stm32f769xx.h" or "stm32f429xx.h"*/
|
|||
*https://www.w3.org/International/articles/inline-bidi-markup/uba-basics*/
|
||||
#define LV_USE_BIDI 0
|
||||
#if LV_USE_BIDI
|
||||
/*Set the default direction. Supported values:
|
||||
/*Set the default direction. Supported values:
|
||||
*`LV_BASE_DIR_LTR` Left-to-Right
|
||||
*`LV_BASE_DIR_RTL` Right-to-Left
|
||||
*`LV_BASE_DIR_AUTO` detect texts base direction*/
|
||||
#define LV_BIDI_BASE_DIR_DEF LV_BASE_DIR_AUTO
|
||||
#define LV_BIDI_BASE_DIR_DEF LV_BASE_DIR_AUTO
|
||||
#endif
|
||||
|
||||
/*Enable Arabic/Persian processing
|
||||
|
@ -429,15 +452,15 @@ e.g. "stm32f769xx.h" or "stm32f429xx.h"*/
|
|||
|
||||
#define LV_USE_LABEL 1
|
||||
#if LV_USE_LABEL
|
||||
# define LV_LABEL_TEXT_SELECTION 1 /*Enable selecting text of the label*/
|
||||
# define LV_LABEL_LONG_TXT_HINT 1 /*Store some extra info in labels to speed up drawing of very long texts*/
|
||||
#define LV_LABEL_TEXT_SELECTION 1 /*Enable selecting text of the label*/
|
||||
#define LV_LABEL_LONG_TXT_HINT 1 /*Store some extra info in labels to speed up drawing of very long texts*/
|
||||
#endif
|
||||
|
||||
#define LV_USE_LINE 1
|
||||
|
||||
#define LV_USE_ROLLER 1 /*Requires: lv_label*/
|
||||
#if LV_USE_ROLLER
|
||||
# define LV_ROLLER_INF_PAGES 7 /*Number of extra "pages" when the roller is infinite*/
|
||||
#define LV_ROLLER_INF_PAGES 7 /*Number of extra "pages" when the roller is infinite*/
|
||||
#endif
|
||||
|
||||
#define LV_USE_SLIDER 1 /*Requires: lv_bar*/
|
||||
|
@ -446,7 +469,7 @@ e.g. "stm32f769xx.h" or "stm32f429xx.h"*/
|
|||
|
||||
#define LV_USE_TEXTAREA 1 /*Requires: lv_label*/
|
||||
#if LV_USE_TEXTAREA != 0
|
||||
# define LV_TEXTAREA_DEF_PWD_SHOW_TIME 1500 /*ms*/
|
||||
#define LV_TEXTAREA_DEF_PWD_SHOW_TIME 1500 /*ms*/
|
||||
#endif
|
||||
|
||||
#define LV_USE_TABLE 1
|
||||
|
@ -460,16 +483,16 @@ e.g. "stm32f769xx.h" or "stm32f429xx.h"*/
|
|||
*----------*/
|
||||
#define LV_USE_CALENDAR 1
|
||||
#if LV_USE_CALENDAR
|
||||
# define LV_CALENDAR_WEEK_STARTS_MONDAY 0
|
||||
# if LV_CALENDAR_WEEK_STARTS_MONDAY
|
||||
# define LV_CALENDAR_DEFAULT_DAY_NAMES {"Mo", "Tu", "We", "Th", "Fr", "Sa", "Su"}
|
||||
# else
|
||||
# define LV_CALENDAR_DEFAULT_DAY_NAMES {"Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"}
|
||||
# endif
|
||||
#define LV_CALENDAR_WEEK_STARTS_MONDAY 0
|
||||
#if LV_CALENDAR_WEEK_STARTS_MONDAY
|
||||
#define LV_CALENDAR_DEFAULT_DAY_NAMES {"Mo", "Tu", "We", "Th", "Fr", "Sa", "Su"}
|
||||
#else
|
||||
#define LV_CALENDAR_DEFAULT_DAY_NAMES {"Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"}
|
||||
#endif
|
||||
|
||||
# define LV_CALENDAR_DEFAULT_MONTH_NAMES {"January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"}
|
||||
# define LV_USE_CALENDAR_HEADER_ARROW 1
|
||||
# define LV_USE_CALENDAR_HEADER_DROPDOWN 1
|
||||
#define LV_CALENDAR_DEFAULT_MONTH_NAMES {"January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"}
|
||||
#define LV_USE_CALENDAR_HEADER_ARROW 1
|
||||
#define LV_USE_CALENDAR_HEADER_DROPDOWN 1
|
||||
#endif /*LV_USE_CALENDAR*/
|
||||
|
||||
#define LV_USE_CHART 1
|
||||
|
@ -484,6 +507,8 @@ e.g. "stm32f769xx.h" or "stm32f429xx.h"*/
|
|||
|
||||
#define LV_USE_LIST 1
|
||||
|
||||
#define LV_USE_MENU 1
|
||||
|
||||
#define LV_USE_METER 1
|
||||
|
||||
#define LV_USE_MSGBOX 1
|
||||
|
@ -500,8 +525,8 @@ e.g. "stm32f769xx.h" or "stm32f429xx.h"*/
|
|||
|
||||
#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
|
||||
/*A line text can contain maximum num of span descriptor */
|
||||
#define LV_SPAN_SNIPPET_STACK_SIZE 64
|
||||
#endif
|
||||
|
||||
/*-----------
|
||||
|
@ -512,18 +537,18 @@ e.g. "stm32f769xx.h" or "stm32f429xx.h"*/
|
|||
#define LV_USE_THEME_DEFAULT 1
|
||||
#if LV_USE_THEME_DEFAULT
|
||||
|
||||
/*0: Light mode; 1: Dark mode*/
|
||||
# define LV_THEME_DEFAULT_DARK 0
|
||||
/*0: Light mode; 1: Dark mode*/
|
||||
#define LV_THEME_DEFAULT_DARK 0
|
||||
|
||||
/*1: Enable grow on press*/
|
||||
# define LV_THEME_DEFAULT_GROW 1
|
||||
/*1: Enable grow on press*/
|
||||
#define LV_THEME_DEFAULT_GROW 1
|
||||
|
||||
/*Default transition time in [ms]*/
|
||||
# define LV_THEME_DEFAULT_TRANSITION_TIME 80
|
||||
/*Default transition time in [ms]*/
|
||||
#define LV_THEME_DEFAULT_TRANSITION_TIME 80
|
||||
#endif /*LV_USE_THEME_DEFAULT*/
|
||||
|
||||
/*A very simple theme that is a good starting point for a custom theme*/
|
||||
#define LV_USE_THEME_BASIC 1
|
||||
#define LV_USE_THEME_BASIC 1
|
||||
|
||||
/*A theme designed for monochrome displays*/
|
||||
#define LV_USE_THEME_MONO 1
|
||||
|
@ -542,18 +567,38 @@ e.g. "stm32f769xx.h" or "stm32f429xx.h"*/
|
|||
* 3rd party libraries
|
||||
*--------------------*/
|
||||
|
||||
/*File system interfaces for common APIs
|
||||
*To enable set a driver letter for that API*/
|
||||
#define LV_USE_FS_STDIO '\0' /*Uses fopen, fread, etc*/
|
||||
//#define LV_FS_STDIO_PATH "/home/john/" /*Set the working directory. If commented it will be "./" */
|
||||
/*File system interfaces for common APIs */
|
||||
|
||||
#define LV_USE_FS_POSIX '\0' /*Uses open, read, etc*/
|
||||
//#define LV_FS_POSIX_PATH "/home/john/" /*Set the working directory. If commented it will be "./" */
|
||||
/*API for fopen, fread, etc*/
|
||||
#define LV_USE_FS_STDIO 0
|
||||
#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()*/
|
||||
#endif
|
||||
|
||||
#define LV_USE_FS_WIN32 '\0' /*Uses CreateFile, ReadFile, etc*/
|
||||
//#define LV_FS_WIN32_PATH "C:\\Users\\john\\" /*Set the working directory. If commented it will be ".\\" */
|
||||
/*API for open, read, etc*/
|
||||
#define LV_USE_FS_POSIX 0
|
||||
#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()*/
|
||||
#endif
|
||||
|
||||
#define LV_USE_FS_FATFS '\0' /*Uses f_open, f_read, etc*/
|
||||
/*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_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
|
||||
#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()*/
|
||||
#endif
|
||||
|
||||
/*PNG decoder library*/
|
||||
#define LV_USE_PNG 0
|
||||
|
@ -574,20 +619,43 @@ e.g. "stm32f769xx.h" or "stm32f429xx.h"*/
|
|||
/*FreeType library*/
|
||||
#define LV_USE_FREETYPE 0
|
||||
#if LV_USE_FREETYPE
|
||||
/*Memory used by FreeType to cache characters [bytes] (-1: no caching)*/
|
||||
# define LV_FREETYPE_CACHE_SIZE (16 * 1024)
|
||||
/*Memory used by FreeType to cache characters [bytes] (-1: no caching)*/
|
||||
#define LV_FREETYPE_CACHE_SIZE (16 * 1024)
|
||||
#if LV_FREETYPE_CACHE_SIZE >= 0
|
||||
/* 1: bitmap cache use the sbit cache, 0:bitmap cache use the image cache. */
|
||||
/* sbit cache:it is much more memory efficient for small bitmaps(font size < 256) */
|
||||
/* if font size >= 256, must be configured as image cache */
|
||||
#define LV_FREETYPE_SBIT_CACHE 0
|
||||
/* Maximum number of opened FT_Face/FT_Size objects managed by this cache instance. */
|
||||
/* (0:use system defaults) */
|
||||
#define LV_FREETYPE_CACHE_FT_FACES 0
|
||||
#define LV_FREETYPE_CACHE_FT_SIZES 0
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/*Rlottie library*/
|
||||
#define LV_USE_RLOTTIE 0
|
||||
|
||||
/*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
|
||||
#if LV_USE_FFMPEG
|
||||
/*Dump input information to stderr*/
|
||||
#define LV_FFMPEG_AV_DUMP_FORMAT 0
|
||||
#endif
|
||||
|
||||
/*-----------
|
||||
* Others
|
||||
*----------*/
|
||||
|
||||
/*1: Enable API to take snapshot for object*/
|
||||
#define LV_USE_SNAPSHOT 1
|
||||
#define LV_USE_SNAPSHOT 0
|
||||
|
||||
/*1: Enable Monkey test*/
|
||||
#define LV_USE_MONKEY 0
|
||||
|
||||
/*1: Enable grid navigation*/
|
||||
#define LV_USE_GRIDNAV 0
|
||||
|
||||
/*==================
|
||||
* EXAMPLES
|
||||
|
@ -596,6 +664,35 @@ e.g. "stm32f769xx.h" or "stm32f429xx.h"*/
|
|||
/*Enable the examples to be built with the library*/
|
||||
#define LV_BUILD_EXAMPLES 1
|
||||
|
||||
/*===================
|
||||
* DEMO USAGE
|
||||
====================*/
|
||||
|
||||
/*Show some widget. It might be required to increase `LV_MEM_SIZE` */
|
||||
#define LV_USE_DEMO_WIDGETS 0
|
||||
#if LV_USE_DEMO_WIDGETS
|
||||
#define LV_DEMO_WIDGETS_SLIDESHOW 0
|
||||
#endif
|
||||
|
||||
/*Demonstrate the usage of encoder and keyboard*/
|
||||
#define LV_USE_DEMO_KEYPAD_AND_ENCODER 0
|
||||
|
||||
/*Benchmark your system*/
|
||||
#define LV_USE_DEMO_BENCHMARK 0
|
||||
|
||||
/*Stress test for LVGL*/
|
||||
#define LV_USE_DEMO_STRESS 0
|
||||
|
||||
/*Music player demo*/
|
||||
#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
|
||||
#endif
|
||||
|
||||
/*--END OF LV_CONF_H--*/
|
||||
|
||||
#endif /*LV_CONF_H*/
|
||||
|
|
|
@ -14,7 +14,7 @@ extern "C" {
|
|||
* CURRENT VERSION OF LVGL
|
||||
***************************/
|
||||
#define LVGL_VERSION_MAJOR 8
|
||||
#define LVGL_VERSION_MINOR 1
|
||||
#define LVGL_VERSION_MINOR 2
|
||||
#define LVGL_VERSION_PATCH 0
|
||||
#define LVGL_VERSION_INFO ""
|
||||
|
||||
|
|
|
@ -1,9 +1,10 @@
|
|||
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/gpu/lv_gpu.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
|
||||
|
|
|
@ -62,10 +62,11 @@ lv_res_t lv_event_send(lv_obj_t * obj, lv_event_code_t event_code, void * param)
|
|||
e.user_data = NULL;
|
||||
e.param = param;
|
||||
e.deleted = 0;
|
||||
|
||||
e.stop_bubbling = 0;
|
||||
e.stop_processing = 0;
|
||||
|
||||
/*Build a simple linked list from the objects used in the events
|
||||
*It's important to know if an this object was deleted by a nested event
|
||||
*It's important to know if this object was deleted by a nested event
|
||||
*called from this `event_cb`.*/
|
||||
e.prev = event_head;
|
||||
event_head = &e;
|
||||
|
@ -86,7 +87,7 @@ lv_res_t lv_obj_event_base(const lv_obj_class_t * class_p, lv_event_t * e)
|
|||
if(class_p == NULL) base = e->current_target->class_p;
|
||||
else base = class_p->base_class;
|
||||
|
||||
/*Find a base in which Call the ancestor's event handler_cb is set*/
|
||||
/*Find a base in which call the ancestor's event handler_cb if set*/
|
||||
while(base && base->event_cb == NULL) base = base->base_class;
|
||||
|
||||
if(base == NULL) return LV_RES_OK;
|
||||
|
@ -116,7 +117,7 @@ lv_obj_t * lv_event_get_current_target(lv_event_t * e)
|
|||
|
||||
lv_event_code_t lv_event_get_code(lv_event_t * e)
|
||||
{
|
||||
return e->code;
|
||||
return e->code & ~LV_EVENT_PREPROCESS;
|
||||
}
|
||||
|
||||
void * lv_event_get_param(lv_event_t * e)
|
||||
|
@ -129,6 +130,16 @@ void * lv_event_get_user_data(lv_event_t * e)
|
|||
return e->user_data;
|
||||
}
|
||||
|
||||
void lv_event_stop_bubbling(lv_event_t * e)
|
||||
{
|
||||
e->stop_bubbling = 1;
|
||||
}
|
||||
|
||||
void lv_event_stop_processing(lv_event_t * e)
|
||||
{
|
||||
e->stop_processing = 1;
|
||||
}
|
||||
|
||||
|
||||
uint32_t lv_event_register_id(void)
|
||||
{
|
||||
|
@ -240,6 +251,18 @@ bool lv_obj_remove_event_dsc(lv_obj_t * obj, struct _lv_event_dsc_t * event_dsc)
|
|||
return false;
|
||||
}
|
||||
|
||||
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;
|
||||
|
||||
int32_t i = 0;
|
||||
for(i = 0; i < obj->spec_attr->event_dsc_cnt; i++) {
|
||||
if(event_cb == obj->spec_attr->event_dsc[i].cb) return obj->spec_attr->event_dsc[i].user_data;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
lv_indev_t * lv_event_get_indev(lv_event_t * e)
|
||||
{
|
||||
|
||||
|
@ -279,7 +302,7 @@ lv_obj_draw_part_dsc_t * lv_event_get_draw_part_dsc(lv_event_t * e)
|
|||
}
|
||||
}
|
||||
|
||||
const lv_area_t * lv_event_get_clip_area(lv_event_t * e)
|
||||
lv_draw_ctx_t * lv_event_get_draw_ctx(lv_event_t * e)
|
||||
{
|
||||
if(e->code == LV_EVENT_DRAW_MAIN ||
|
||||
e->code == LV_EVENT_DRAW_MAIN_BEGIN ||
|
||||
|
@ -408,18 +431,22 @@ static lv_res_t event_send_core(lv_event_t * e)
|
|||
lv_indev_t * indev_act = lv_indev_get_act();
|
||||
if(indev_act) {
|
||||
if(indev_act->driver->feedback_cb) indev_act->driver->feedback_cb(indev_act->driver, e->code);
|
||||
if(e->stop_processing) return LV_RES_OK;
|
||||
if(e->deleted) return LV_RES_INV;
|
||||
}
|
||||
|
||||
lv_event_dsc_t * event_dsc = lv_obj_get_event_dsc(e->current_target, 0);
|
||||
lv_res_t res = LV_RES_OK;
|
||||
res = lv_obj_event_base(NULL, e);
|
||||
lv_event_dsc_t * event_dsc = res == LV_RES_INV ? NULL : lv_obj_get_event_dsc(e->current_target, 0);
|
||||
|
||||
uint32_t i = 0;
|
||||
while(event_dsc && res == LV_RES_OK) {
|
||||
if(event_dsc->cb && (event_dsc->filter == LV_EVENT_ALL || event_dsc->filter == e->code)) {
|
||||
if(event_dsc->cb && ((event_dsc->filter & LV_EVENT_PREPROCESS) == LV_EVENT_PREPROCESS)
|
||||
&& (event_dsc->filter == (LV_EVENT_ALL | LV_EVENT_PREPROCESS) ||
|
||||
(event_dsc->filter & ~LV_EVENT_PREPROCESS) == e->code)) {
|
||||
e->user_data = event_dsc->user_data;
|
||||
event_dsc->cb(e);
|
||||
|
||||
if(e->stop_processing) return LV_RES_OK;
|
||||
/*Stop if the object is deleted*/
|
||||
if(e->deleted) return LV_RES_INV;
|
||||
}
|
||||
|
@ -428,12 +455,30 @@ static lv_res_t event_send_core(lv_event_t * e)
|
|||
event_dsc = lv_obj_get_event_dsc(e->current_target, i);
|
||||
}
|
||||
|
||||
if(res == LV_RES_OK && e->current_target->parent && event_is_bubbled(e))
|
||||
{
|
||||
res = lv_obj_event_base(NULL, e);
|
||||
|
||||
event_dsc = res == LV_RES_INV ? NULL : lv_obj_get_event_dsc(e->current_target, 0);
|
||||
|
||||
i = 0;
|
||||
while(event_dsc && res == LV_RES_OK) {
|
||||
if(event_dsc->cb && ((event_dsc->filter & LV_EVENT_PREPROCESS) == 0)
|
||||
&& (event_dsc->filter == LV_EVENT_ALL || event_dsc->filter == e->code)) {
|
||||
e->user_data = event_dsc->user_data;
|
||||
event_dsc->cb(e);
|
||||
|
||||
if(e->stop_processing) return LV_RES_OK;
|
||||
/*Stop if the object is deleted*/
|
||||
if(e->deleted) return LV_RES_INV;
|
||||
}
|
||||
|
||||
i++;
|
||||
event_dsc = lv_obj_get_event_dsc(e->current_target, i);
|
||||
}
|
||||
|
||||
if(res == LV_RES_OK && e->current_target->parent && event_is_bubbled(e)) {
|
||||
e->current_target = e->current_target->parent;
|
||||
res = event_send_core(e);
|
||||
if(res != LV_RES_OK) return LV_RES_INV;
|
||||
|
||||
}
|
||||
|
||||
return res;
|
||||
|
@ -441,6 +486,8 @@ static lv_res_t event_send_core(lv_event_t * e)
|
|||
|
||||
static bool event_is_bubbled(lv_event_t * e)
|
||||
{
|
||||
if(e->stop_bubbling) return false;
|
||||
|
||||
/*Event codes that always bubble*/
|
||||
switch(e->code) {
|
||||
case LV_EVENT_CHILD_CREATED:
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/**
|
||||
* @file lv_templ.h
|
||||
* @file lv_event.h
|
||||
*
|
||||
*/
|
||||
|
||||
|
@ -84,7 +84,11 @@ typedef enum {
|
|||
LV_EVENT_LAYOUT_CHANGED, /**< The children position has changed due to a layout recalculation*/
|
||||
LV_EVENT_GET_SELF_SIZE, /**< Get the internal size of a widget*/
|
||||
|
||||
_LV_EVENT_LAST /** Number of default events*/
|
||||
_LV_EVENT_LAST, /** Number of default events*/
|
||||
|
||||
|
||||
LV_EVENT_PREPROCESS = 0x80, /** This is a flag that can be set with an event so it's processed
|
||||
before the class default event processing */
|
||||
} lv_event_code_t;
|
||||
|
||||
typedef struct _lv_event_t {
|
||||
|
@ -95,6 +99,8 @@ typedef struct _lv_event_t {
|
|||
void * param;
|
||||
struct _lv_event_t * prev;
|
||||
uint8_t deleted : 1;
|
||||
uint8_t stop_processing : 1;
|
||||
uint8_t stop_bubbling : 1;
|
||||
} lv_event_t;
|
||||
|
||||
/**
|
||||
|
@ -143,7 +149,7 @@ lv_res_t lv_event_send(struct _lv_obj_t * obj, lv_event_code_t event_code, void
|
|||
* Used by the widgets internally to call the ancestor widget types's event handler
|
||||
* @param class_p pointer to the class of the widget (NOT the ancestor class)
|
||||
* @param e pointer to the event descriptor
|
||||
* @return LV_RES_OK: the taget object was not deleted in the event; LV_RES_INV: it was deleted in the event_code
|
||||
* @return LV_RES_OK: the target object was not deleted in the event; LV_RES_INV: it was deleted in the event_code
|
||||
*/
|
||||
lv_res_t lv_obj_event_base(const lv_obj_class_t * class_p, lv_event_t * e);
|
||||
|
||||
|
@ -183,6 +189,19 @@ void * lv_event_get_param(lv_event_t * e);
|
|||
*/
|
||||
void * lv_event_get_user_data(lv_event_t * e);
|
||||
|
||||
/**
|
||||
* Stop the event from bubbling.
|
||||
* This is only valid when called in the middle of an event processing chain.
|
||||
* @param e pointer to the event descriptor
|
||||
*/
|
||||
void lv_event_stop_bubbling(lv_event_t * e);
|
||||
|
||||
/**
|
||||
* Stop processing this event.
|
||||
* This is only valid when called in the middle of an event processing chain.
|
||||
* @param e pointer to the event descriptor
|
||||
*/
|
||||
void lv_event_stop_processing(lv_event_t * e);
|
||||
|
||||
/**
|
||||
* Register a new, custom event ID.
|
||||
|
@ -221,7 +240,7 @@ struct _lv_event_dsc_t * lv_obj_add_event_cb(struct _lv_obj_t * obj, lv_event_cb
|
|||
/**
|
||||
* Remove an event handler function for an object.
|
||||
* @param obj pointer to an object
|
||||
* @param event_cb the event function to remove, or `NULL` to remove the the firstly added event callback
|
||||
* @param event_cb the event function to remove, or `NULL` to remove the firstly added event callback
|
||||
* @return true if any event handlers were removed
|
||||
*/
|
||||
bool lv_obj_remove_event_cb(struct _lv_obj_t * obj, lv_event_cb_t event_cb);
|
||||
|
@ -237,7 +256,7 @@ bool lv_obj_remove_event_cb_with_user_data(struct _lv_obj_t * obj, lv_event_cb_t
|
|||
const void * event_user_data);
|
||||
|
||||
/**
|
||||
* DEPRACTED because doesn't work if multiple event handlers are added to an object.
|
||||
* DEPRECATED because doesn't work if multiple event handlers are added to an object.
|
||||
* Remove an event handler function for an object.
|
||||
* @param obj pointer to an object
|
||||
* @param event_dsc pointer to an event descriptor to remove (returned by ::lv_obj_add_event_cb)
|
||||
|
@ -245,6 +264,14 @@ bool lv_obj_remove_event_cb_with_user_data(struct _lv_obj_t * obj, lv_event_cb_t
|
|||
*/
|
||||
bool lv_obj_remove_event_dsc(struct _lv_obj_t * obj, struct _lv_event_dsc_t * event_dsc);
|
||||
|
||||
/**
|
||||
* The user data of an event object event callback. Always the first match with `event_cb` will be returned.
|
||||
* @param obj pointer to an object
|
||||
* @param event_cb the event function
|
||||
* @return the user_data
|
||||
*/
|
||||
void * lv_obj_get_event_user_data(struct _lv_obj_t * obj, lv_event_cb_t event_cb);
|
||||
|
||||
/**
|
||||
* Get the input device passed as parameter to indev related events.
|
||||
* @param e pointer to an event
|
||||
|
@ -260,12 +287,12 @@ lv_indev_t * lv_event_get_indev(lv_event_t * e);
|
|||
lv_obj_draw_part_dsc_t * lv_event_get_draw_part_dsc(lv_event_t * e);
|
||||
|
||||
/**
|
||||
* Get the clip area passed as parameter to draw events events.
|
||||
* Get the draw context which should be the first parameter of the draw functions.
|
||||
* Namely: `LV_EVENT_DRAW_MAIN/POST`, `LV_EVENT_DRAW_MAIN/POST_BEGIN`, `LV_EVENT_DRAW_MAIN/POST_END`
|
||||
* @param e pointer to an event
|
||||
* @return the clip area to use during drawing or NULL if called on an unrelated event
|
||||
* @return pointer to a draw context or NULL if called on an unrelated event
|
||||
*/
|
||||
const lv_area_t * lv_event_get_clip_area(lv_event_t * e);
|
||||
lv_draw_ctx_t * lv_event_get_draw_ctx(lv_event_t * e);
|
||||
|
||||
/**
|
||||
* Get the old area of the object before its size was changed. Can be used in `LV_EVENT_SIZE_CHANGED`
|
||||
|
|
|
@ -82,6 +82,15 @@ void lv_group_del(lv_group_t * group)
|
|||
if((*obj)->spec_attr)(*obj)->spec_attr->group_p = NULL;
|
||||
}
|
||||
|
||||
/*Remove the group from any indev devices */
|
||||
lv_indev_t * indev = lv_indev_get_next(NULL);
|
||||
while(indev) {
|
||||
if(indev->group == group) {
|
||||
lv_indev_set_group(indev, NULL);
|
||||
}
|
||||
indev = lv_indev_get_next(indev);
|
||||
}
|
||||
|
||||
_lv_ll_clear(&(group->obj_ll));
|
||||
_lv_ll_remove(&LV_GC_ROOT(_lv_group_ll), group);
|
||||
lv_mem_free(group);
|
||||
|
|
|
@ -290,32 +290,27 @@ lv_obj_t * lv_indev_search_obj(lv_obj_t * obj, lv_point_t * point)
|
|||
{
|
||||
lv_obj_t * found_p = NULL;
|
||||
|
||||
/*If the point is on this object check its children too*/
|
||||
if(lv_obj_hit_test(obj, 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);
|
||||
|
||||
/*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)) {
|
||||
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);
|
||||
|
||||
/*If a child was found then break*/
|
||||
if(found_p != NULL) break;
|
||||
}
|
||||
|
||||
/*If then the children was not ok, and this obj is clickable
|
||||
* and it or its parent is not hidden then save this object*/
|
||||
if(found_p == NULL && lv_obj_has_flag(obj, LV_OBJ_FLAG_CLICKABLE)) {
|
||||
lv_obj_t * hidden_i = obj;
|
||||
while(hidden_i != NULL) {
|
||||
if(lv_obj_has_flag(hidden_i, LV_OBJ_FLAG_HIDDEN) == true) break;
|
||||
hidden_i = lv_obj_get_parent(hidden_i);
|
||||
}
|
||||
/*No parent found with hidden == true*/
|
||||
if(hidden_i == NULL && (lv_obj_get_state(obj) & LV_STATE_DISABLED) == false) found_p = obj;
|
||||
if(found_p) return found_p;
|
||||
}
|
||||
}
|
||||
|
||||
return found_p;
|
||||
/*If not return earlier for a clicked child and this obj's hittest was ok use it
|
||||
*else return NULL*/
|
||||
if(hit_test_ok) return obj;
|
||||
else return NULL;
|
||||
}
|
||||
|
||||
/**********************
|
||||
|
@ -345,12 +340,18 @@ static void indev_pointer_proc(lv_indev_t * i, lv_indev_data_t * data)
|
|||
}
|
||||
|
||||
/*Simple sanity check*/
|
||||
if(data->point.x < 0) LV_LOG_WARN("X is %d which is smaller than zero", data->point.x);
|
||||
if(data->point.x >= lv_disp_get_hor_res(i->driver->disp)) LV_LOG_WARN("X is %d which is greater than hor. res",
|
||||
data->point.x);
|
||||
if(data->point.y < 0) LV_LOG_WARN("Y is %d which is smaller than zero", data->point.y);
|
||||
if(data->point.y >= lv_disp_get_ver_res(i->driver->disp)) LV_LOG_WARN("Y is %d which is greater than hor. res",
|
||||
data->point.y);
|
||||
if(data->point.x < 0) {
|
||||
LV_LOG_WARN("X is %d which is smaller than zero", data->point.x);
|
||||
}
|
||||
if(data->point.x >= lv_disp_get_hor_res(i->driver->disp)) {
|
||||
LV_LOG_WARN("X is %d which is greater than hor. res", data->point.x);
|
||||
}
|
||||
if(data->point.y < 0) {
|
||||
LV_LOG_WARN("Y is %d which is smaller than zero", data->point.y);
|
||||
}
|
||||
if(data->point.y >= lv_disp_get_ver_res(i->driver->disp)) {
|
||||
LV_LOG_WARN("Y is %d which is greater than ver. res", data->point.y);
|
||||
}
|
||||
|
||||
/*Move the cursor if set and moved*/
|
||||
if(i->cursor != NULL &&
|
||||
|
@ -723,7 +724,7 @@ static void indev_encoder_proc(lv_indev_t * i, lv_indev_data_t * data)
|
|||
}
|
||||
|
||||
/**
|
||||
* Process new points from a input device. indev->state.pressed has to be set
|
||||
* Process new points from an input device. indev->state.pressed has to be set
|
||||
* @param indev pointer to an input device state
|
||||
* @param x x coordinate of the next point
|
||||
* @param y y coordinate of the next point
|
||||
|
@ -994,8 +995,7 @@ static void indev_click_focus(_lv_indev_proc_t * proc)
|
|||
{
|
||||
/*Handle click focus*/
|
||||
if(lv_obj_has_flag(indev_obj_act, LV_OBJ_FLAG_CLICK_FOCUSABLE) == false ||
|
||||
proc->types.pointer.last_pressed == indev_obj_act)
|
||||
{
|
||||
proc->types.pointer.last_pressed == indev_obj_act) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -1058,7 +1058,7 @@ static void indev_click_focus(_lv_indev_proc_t * proc)
|
|||
|
||||
/**
|
||||
* Handle the gesture of indev_proc_p->types.pointer.act_obj
|
||||
* @param indev pointer to a input device state
|
||||
* @param indev pointer to an input device state
|
||||
*/
|
||||
void indev_gesture(_lv_indev_proc_t * proc)
|
||||
{
|
||||
|
|
|
@ -31,7 +31,7 @@ extern "C" {
|
|||
|
||||
/**
|
||||
* Called periodically to read the input devices
|
||||
* @param param pointer to and input device to read
|
||||
* @param timer pointer to a timer to read
|
||||
*/
|
||||
void lv_indev_read_timer_cb(lv_timer_t * timer);
|
||||
|
||||
|
|
|
@ -254,13 +254,6 @@ static lv_obj_t * find_scroll_obj(_lv_indev_proc_t * proc)
|
|||
* 4. If can be scrolled on the current axis (hor/ver) save it as candidate (at least show an elastic scroll effect)
|
||||
* 5. Use the last candidate. Always the "deepest" parent or the object from point 3*/
|
||||
lv_obj_t * obj_act = proc->types.pointer.act_obj;
|
||||
while(obj_act) {
|
||||
if(lv_obj_has_flag(obj_act, LV_OBJ_FLAG_SCROLLABLE) == false) {
|
||||
/*If this object don't want to chain the scroll ot the parent stop searching*/
|
||||
if(lv_obj_has_flag(obj_act, LV_OBJ_FLAG_SCROLL_CHAIN) == false) break;
|
||||
obj_act = lv_obj_get_parent(obj_act);
|
||||
continue;
|
||||
}
|
||||
|
||||
/*Decide if it's a horizontal or vertical scroll*/
|
||||
bool hor_en = false;
|
||||
|
@ -272,6 +265,16 @@ static lv_obj_t * find_scroll_obj(_lv_indev_proc_t * proc)
|
|||
ver_en = true;
|
||||
}
|
||||
|
||||
while(obj_act) {
|
||||
if(lv_obj_has_flag(obj_act, LV_OBJ_FLAG_SCROLLABLE) == false) {
|
||||
/*If this object don't want to chain the scroll to the parent stop searching*/
|
||||
if(lv_obj_has_flag(obj_act, LV_OBJ_FLAG_SCROLL_CHAIN_HOR) == false && hor_en) break;
|
||||
if(lv_obj_has_flag(obj_act, LV_OBJ_FLAG_SCROLL_CHAIN_VER) == false && ver_en) break;
|
||||
|
||||
obj_act = lv_obj_get_parent(obj_act);
|
||||
continue;
|
||||
}
|
||||
|
||||
/*Consider both up-down or left/right scrollable according to the current direction*/
|
||||
bool up_en = ver_en;
|
||||
bool down_en = ver_en;
|
||||
|
@ -323,8 +326,9 @@ static lv_obj_t * find_scroll_obj(_lv_indev_proc_t * proc)
|
|||
break;
|
||||
}
|
||||
|
||||
/*If this object don't want to chain the scroll ot the parent stop searching*/
|
||||
if(lv_obj_has_flag(obj_act, LV_OBJ_FLAG_SCROLL_CHAIN) == false) break;
|
||||
/*If this object don't want to chain the scroll to the parent stop searching*/
|
||||
if(lv_obj_has_flag(obj_act, LV_OBJ_FLAG_SCROLL_CHAIN_HOR) == false && hor_en) break;
|
||||
if(lv_obj_has_flag(obj_act, LV_OBJ_FLAG_SCROLL_CHAIN_VER) == false && ver_en) break;
|
||||
|
||||
/*Try the parent*/
|
||||
obj_act = lv_obj_get_parent(obj_act);
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
#include <string.h>
|
||||
|
||||
#if LV_USE_GPU_STM32_DMA2D
|
||||
#include "../gpu/lv_gpu_stm32_dma2d.h"
|
||||
#include "../draw/stm32_dma2d/lv_gpu_stm32_dma2d.h"
|
||||
#endif
|
||||
|
||||
#if LV_USE_GPU_NXP_PXP && LV_USE_GPU_NXP_PXP_AUTO_INIT
|
||||
|
@ -35,10 +35,6 @@
|
|||
#include "../gpu/lv_gpu_nxp_pxp_osa.h"
|
||||
#endif
|
||||
|
||||
#if LV_USE_GPU_SDL
|
||||
#include "../gpu/lv_gpu_sdl.h"
|
||||
#endif
|
||||
|
||||
/*********************
|
||||
* DEFINES
|
||||
*********************/
|
||||
|
@ -59,7 +55,7 @@ static void lv_obj_constructor(const lv_obj_class_t * class_p, lv_obj_t * obj);
|
|||
static void lv_obj_destructor(const lv_obj_class_t * class_p, lv_obj_t * obj);
|
||||
static void lv_obj_draw(lv_event_t * e);
|
||||
static void lv_obj_event(const lv_obj_class_t * class_p, lv_event_t * e);
|
||||
static void draw_scrollbar(lv_obj_t * obj, const lv_area_t * clip_area);
|
||||
static void draw_scrollbar(lv_obj_t * obj, lv_draw_ctx_t * draw_ctx);
|
||||
static lv_res_t scrollbar_init_draw_dsc(lv_obj_t * obj, lv_draw_rect_dsc_t * dsc);
|
||||
static bool obj_valid_child(const lv_obj_t * parent, const lv_obj_t * obj_to_find);
|
||||
static void lv_obj_set_state(lv_obj_t * obj, lv_state_t new_state);
|
||||
|
@ -114,9 +110,11 @@ void lv_init(void)
|
|||
|
||||
_lv_group_init();
|
||||
|
||||
lv_draw_init();
|
||||
|
||||
#if LV_USE_GPU_STM32_DMA2D
|
||||
/*Initialize DMA2D GPU*/
|
||||
lv_gpu_stm32_dma2d_init();
|
||||
lv_draw_stm32_dma2d_init();
|
||||
#endif
|
||||
|
||||
#if LV_USE_GPU_NXP_PXP && LV_USE_GPU_NXP_PXP_AUTO_INIT
|
||||
|
@ -125,9 +123,6 @@ void lv_init(void)
|
|||
for(; ;) ;
|
||||
}
|
||||
#endif
|
||||
#if LV_USE_GPU_SDL
|
||||
lv_gpu_sdl_init();
|
||||
#endif
|
||||
|
||||
_lv_obj_style_init();
|
||||
_lv_ll_init(&LV_GC_ROOT(_lv_disp_ll), sizeof(lv_disp_t));
|
||||
|
@ -145,7 +140,7 @@ void lv_init(void)
|
|||
|
||||
uint8_t * txt_u8 = (uint8_t *)txt;
|
||||
if(txt_u8[0] != 0xc3 || txt_u8[1] != 0x81 || txt_u8[2] != 0x00) {
|
||||
LV_LOG_WARN("The strings has no UTF-8 encoding. Non-ASCII characters won't be displayed.");
|
||||
LV_LOG_WARN("The strings have no UTF-8 encoding. Non-ASCII characters won't be displayed.");
|
||||
}
|
||||
|
||||
uint32_t endianess_test = 0x11223344;
|
||||
|
@ -174,7 +169,7 @@ void lv_init(void)
|
|||
#endif
|
||||
|
||||
#if LV_LOG_LEVEL == LV_LOG_LEVEL_TRACE
|
||||
LV_LOG_WARN("Log level is set the Trace which makes LVGL much slower");
|
||||
LV_LOG_WARN("Log level is set to 'Trace' which makes LVGL much slower");
|
||||
#endif
|
||||
|
||||
lv_extra_init();
|
||||
|
@ -184,13 +179,10 @@ void lv_init(void)
|
|||
LV_LOG_TRACE("finished");
|
||||
}
|
||||
|
||||
#if LV_ENABLE_GC || !LV_MEM_CUSTOM || LV_USE_GPU_SDL
|
||||
#if LV_ENABLE_GC || !LV_MEM_CUSTOM
|
||||
|
||||
void lv_deinit(void)
|
||||
{
|
||||
#if LV_USE_GPU_SDL
|
||||
lv_gpu_sdl_deinit();
|
||||
#endif
|
||||
_lv_gc_clear_roots();
|
||||
|
||||
lv_disp_set_default(NULL);
|
||||
|
@ -237,6 +229,7 @@ void lv_obj_add_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));
|
||||
lv_obj_mark_layout_as_dirty(obj);
|
||||
}
|
||||
|
||||
if(f & LV_OBJ_FLAG_SCROLLABLE) {
|
||||
|
@ -265,6 +258,7 @@ void lv_obj_clear_flag(lv_obj_t * obj, lv_obj_flag_t f)
|
|||
lv_obj_invalidate(obj);
|
||||
if(lv_obj_is_layout_positioned(obj)) {
|
||||
lv_obj_mark_layout_as_dirty(lv_obj_get_parent(obj));
|
||||
lv_obj_mark_layout_as_dirty(obj);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -423,6 +417,7 @@ static void lv_obj_constructor(const lv_obj_class_t * class_p, lv_obj_t * obj)
|
|||
obj->flags |= LV_OBJ_FLAG_SCROLLABLE;
|
||||
obj->flags |= LV_OBJ_FLAG_SCROLL_ELASTIC;
|
||||
obj->flags |= LV_OBJ_FLAG_SCROLL_MOMENTUM;
|
||||
obj->flags |= LV_OBJ_FLAG_SCROLL_WITH_ARROW;
|
||||
if(parent) obj->flags |= LV_OBJ_FLAG_GESTURE_BUBBLE;
|
||||
|
||||
LV_TRACE_OBJ_CREATE("finished");
|
||||
|
@ -509,7 +504,7 @@ static void lv_obj_draw(lv_event_t * e)
|
|||
|
||||
}
|
||||
else if(code == LV_EVENT_DRAW_MAIN) {
|
||||
const lv_area_t * clip_area = lv_event_get_param(e);
|
||||
lv_draw_ctx_t * draw_ctx = lv_event_get_draw_ctx(e);
|
||||
lv_draw_rect_dsc_t draw_dsc;
|
||||
lv_draw_rect_dsc_init(&draw_dsc);
|
||||
/*If the border is drawn later disable loading its properties*/
|
||||
|
@ -518,7 +513,6 @@ static void lv_obj_draw(lv_event_t * e)
|
|||
}
|
||||
|
||||
lv_obj_init_draw_rect_dsc(obj, LV_PART_MAIN, &draw_dsc);
|
||||
|
||||
lv_coord_t w = lv_obj_get_style_transform_width(obj, LV_PART_MAIN);
|
||||
lv_coord_t h = lv_obj_get_style_transform_height(obj, LV_PART_MAIN);
|
||||
lv_area_t coords;
|
||||
|
@ -529,7 +523,7 @@ static void lv_obj_draw(lv_event_t * e)
|
|||
coords.y2 += h;
|
||||
|
||||
lv_obj_draw_part_dsc_t part_dsc;
|
||||
lv_obj_draw_dsc_init(&part_dsc, clip_area);
|
||||
lv_obj_draw_dsc_init(&part_dsc, draw_ctx);
|
||||
part_dsc.class_p = MY_CLASS;
|
||||
part_dsc.type = LV_OBJ_DRAW_PART_RECTANGLE;
|
||||
part_dsc.rect_dsc = &draw_dsc;
|
||||
|
@ -537,26 +531,42 @@ 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);
|
||||
|
||||
lv_draw_rect(&coords, clip_area, &draw_dsc);
|
||||
|
||||
lv_event_send(obj, LV_EVENT_DRAW_PART_END, &part_dsc);
|
||||
|
||||
#if LV_DRAW_COMPLEX
|
||||
if(lv_obj_get_style_clip_corner(obj, LV_PART_MAIN)) {
|
||||
/*If the radius is 0 the parent's coordinates will clip anyway*/
|
||||
lv_coord_t r = lv_obj_get_style_radius(obj, LV_PART_MAIN);
|
||||
if(r != 0) {
|
||||
lv_draw_mask_radius_param_t * mp = lv_mem_buf_get(sizeof(lv_draw_mask_radius_param_t));
|
||||
lv_draw_mask_radius_init(mp, &obj->coords, r, false);
|
||||
/*Add the mask and use `obj+8` as custom id. Don't use `obj` directly because it might be used by the user*/
|
||||
lv_draw_mask_add(mp, obj + 8);
|
||||
}
|
||||
/*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;
|
||||
const void * bg_img_src = draw_dsc.bg_img_src;
|
||||
if(clip_corner) {
|
||||
draw_dsc.bg_img_src = NULL;
|
||||
}
|
||||
#endif
|
||||
|
||||
lv_draw_rect(draw_ctx, &draw_dsc, &coords);
|
||||
|
||||
|
||||
#if LV_DRAW_COMPLEX
|
||||
if(clip_corner) {
|
||||
lv_draw_mask_radius_param_t * mp = lv_mem_buf_get(sizeof(lv_draw_mask_radius_param_t));
|
||||
lv_draw_mask_radius_init(mp, &obj->coords, draw_dsc.radius, false);
|
||||
/*Add the mask and use `obj+8` as custom id. Don't use `obj` directly because it might be used by the user*/
|
||||
lv_draw_mask_add(mp, obj + 8);
|
||||
|
||||
if(bg_img_src) {
|
||||
draw_dsc.bg_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;
|
||||
draw_dsc.bg_img_src = bg_img_src;
|
||||
lv_draw_rect(draw_ctx, &draw_dsc, &coords);
|
||||
}
|
||||
|
||||
}
|
||||
#endif
|
||||
lv_event_send(obj, LV_EVENT_DRAW_PART_END, &part_dsc);
|
||||
}
|
||||
else if(code == LV_EVENT_DRAW_POST) {
|
||||
const lv_area_t * clip_area = lv_event_get_param(e);
|
||||
draw_scrollbar(obj, clip_area);
|
||||
lv_draw_ctx_t * draw_ctx = lv_event_get_draw_ctx(e);
|
||||
draw_scrollbar(obj, draw_ctx);
|
||||
|
||||
#if LV_DRAW_COMPLEX
|
||||
if(lv_obj_get_style_clip_corner(obj, LV_PART_MAIN)) {
|
||||
|
@ -573,9 +583,9 @@ static void lv_obj_draw(lv_event_t * e)
|
|||
lv_draw_rect_dsc_t draw_dsc;
|
||||
lv_draw_rect_dsc_init(&draw_dsc);
|
||||
draw_dsc.bg_opa = LV_OPA_TRANSP;
|
||||
draw_dsc.bg_img_opa = LV_OPA_TRANSP;
|
||||
draw_dsc.outline_opa = LV_OPA_TRANSP;
|
||||
draw_dsc.shadow_opa = LV_OPA_TRANSP;
|
||||
draw_dsc.bg_img_opa = LV_OPA_TRANSP;
|
||||
lv_obj_init_draw_rect_dsc(obj, LV_PART_MAIN, &draw_dsc);
|
||||
|
||||
lv_coord_t w = lv_obj_get_style_transform_width(obj, LV_PART_MAIN);
|
||||
|
@ -588,7 +598,7 @@ static void lv_obj_draw(lv_event_t * e)
|
|||
coords.y2 += h;
|
||||
|
||||
lv_obj_draw_part_dsc_t part_dsc;
|
||||
lv_obj_draw_dsc_init(&part_dsc, clip_area);
|
||||
lv_obj_draw_dsc_init(&part_dsc, draw_ctx);
|
||||
part_dsc.class_p = MY_CLASS;
|
||||
part_dsc.type = LV_OBJ_DRAW_PART_BORDER_POST;
|
||||
part_dsc.rect_dsc = &draw_dsc;
|
||||
|
@ -596,13 +606,13 @@ 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);
|
||||
|
||||
lv_draw_rect(&coords, clip_area, &draw_dsc);
|
||||
lv_draw_rect(draw_ctx, &draw_dsc, &coords);
|
||||
lv_event_send(obj, LV_EVENT_DRAW_PART_END, &part_dsc);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void draw_scrollbar(lv_obj_t * obj, const lv_area_t * clip_area)
|
||||
static void draw_scrollbar(lv_obj_t * obj, lv_draw_ctx_t * draw_ctx)
|
||||
{
|
||||
|
||||
lv_area_t hor_area;
|
||||
|
@ -616,7 +626,7 @@ static void draw_scrollbar(lv_obj_t * obj, const lv_area_t * clip_area)
|
|||
if(sb_res != LV_RES_OK) return;
|
||||
|
||||
lv_obj_draw_part_dsc_t part_dsc;
|
||||
lv_obj_draw_dsc_init(&part_dsc, clip_area);
|
||||
lv_obj_draw_dsc_init(&part_dsc, draw_ctx);
|
||||
part_dsc.class_p = MY_CLASS;
|
||||
part_dsc.type = LV_OBJ_DRAW_PART_SCROLLBAR;
|
||||
part_dsc.rect_dsc = &draw_dsc;
|
||||
|
@ -625,13 +635,14 @@ static void draw_scrollbar(lv_obj_t * obj, const lv_area_t * clip_area)
|
|||
if(lv_area_get_size(&hor_area) > 0) {
|
||||
part_dsc.draw_area = &hor_area;
|
||||
lv_event_send(obj, LV_EVENT_DRAW_PART_BEGIN, &part_dsc);
|
||||
lv_draw_rect(&hor_area, clip_area, &draw_dsc);
|
||||
lv_draw_rect(draw_ctx, &draw_dsc, &hor_area);
|
||||
lv_event_send(obj, LV_EVENT_DRAW_PART_END, &part_dsc);
|
||||
}
|
||||
if(lv_area_get_size(&ver_area) > 0) {
|
||||
part_dsc.draw_area = &ver_area;
|
||||
lv_event_send(obj, LV_EVENT_DRAW_PART_BEGIN, &part_dsc);
|
||||
lv_draw_rect(&ver_area, clip_area, &draw_dsc);
|
||||
part_dsc.draw_area = &ver_area;
|
||||
lv_draw_rect(draw_ctx, &draw_dsc, &ver_area);
|
||||
lv_event_send(obj, LV_EVENT_DRAW_PART_END, &part_dsc);
|
||||
}
|
||||
}
|
||||
|
@ -699,7 +710,7 @@ static void lv_obj_event(const lv_obj_class_t * class_p, lv_event_t * e)
|
|||
LV_UNUSED(class_p);
|
||||
|
||||
lv_event_code_t code = lv_event_get_code(e);
|
||||
lv_obj_t * obj = lv_event_get_target(e);
|
||||
lv_obj_t * obj = lv_event_get_current_target(e);
|
||||
if(code == LV_EVENT_PRESSED) {
|
||||
lv_obj_add_state(obj, LV_STATE_PRESSED);
|
||||
}
|
||||
|
@ -741,7 +752,7 @@ static void lv_obj_event(const lv_obj_class_t * class_p, lv_event_t * e)
|
|||
if(res != LV_RES_OK) return;
|
||||
}
|
||||
}
|
||||
else if(lv_obj_has_flag(obj, LV_OBJ_FLAG_SCROLLABLE) && !lv_obj_is_editable(obj)) {
|
||||
else if(lv_obj_has_flag(obj, LV_OBJ_FLAG_SCROLLABLE | LV_OBJ_FLAG_SCROLL_WITH_ARROW) && !lv_obj_is_editable(obj)) {
|
||||
/*scroll by keypad or encoder*/
|
||||
lv_anim_enable_t anim_enable = LV_ANIM_OFF;
|
||||
lv_coord_t sl = lv_obj_get_scroll_left(obj);
|
||||
|
|
|
@ -95,15 +95,19 @@ enum {
|
|||
LV_OBJ_FLAG_SCROLL_ELASTIC = (1L << 5), /**< Allow scrolling inside but with slower speed*/
|
||||
LV_OBJ_FLAG_SCROLL_MOMENTUM = (1L << 6), /**< Make the object scroll further when "thrown"*/
|
||||
LV_OBJ_FLAG_SCROLL_ONE = (1L << 7), /**< Allow scrolling only one snappable children*/
|
||||
LV_OBJ_FLAG_SCROLL_CHAIN = (1L << 8), /**< Allow propagating the scroll to a parent*/
|
||||
LV_OBJ_FLAG_SCROLL_ON_FOCUS = (1L << 9), /**< Automatically scroll object to make it visible when focused*/
|
||||
LV_OBJ_FLAG_SNAPPABLE = (1L << 10), /**< If scroll snap is enabled on the parent it can snap to this object*/
|
||||
LV_OBJ_FLAG_PRESS_LOCK = (1L << 11), /**< Keep the object pressed even if the press slid from the object*/
|
||||
LV_OBJ_FLAG_EVENT_BUBBLE = (1L << 12), /**< Propagate the events to the parent too*/
|
||||
LV_OBJ_FLAG_GESTURE_BUBBLE = (1L << 13), /**< Propagate the gestures to the parent*/
|
||||
LV_OBJ_FLAG_ADV_HITTEST = (1L << 14), /**< Allow performing more accurate hit (click) test. E.g. consider rounded corners.*/
|
||||
LV_OBJ_FLAG_IGNORE_LAYOUT = (1L << 15), /**< Make the object position-able by the layouts*/
|
||||
LV_OBJ_FLAG_FLOATING = (1L << 16), /**< Do not scroll the object when the parent scrolls and ignore layout*/
|
||||
LV_OBJ_FLAG_SCROLL_CHAIN_HOR = (1L << 8), /**< Allow propagating the horizontal scroll to a parent*/
|
||||
LV_OBJ_FLAG_SCROLL_CHAIN_VER = (1L << 9), /**< Allow propagating the vertical scroll to a parent*/
|
||||
LV_OBJ_FLAG_SCROLL_CHAIN = (LV_OBJ_FLAG_SCROLL_CHAIN_HOR | LV_OBJ_FLAG_SCROLL_CHAIN_VER),
|
||||
LV_OBJ_FLAG_SCROLL_ON_FOCUS = (1L << 10), /**< Automatically scroll object to make it visible when focused*/
|
||||
LV_OBJ_FLAG_SCROLL_WITH_ARROW = (1L << 11), /**< Allow scrolling the focused object with arrow keys*/
|
||||
LV_OBJ_FLAG_SNAPPABLE = (1L << 12), /**< If scroll snap is enabled on the parent it can snap to this object*/
|
||||
LV_OBJ_FLAG_PRESS_LOCK = (1L << 13), /**< Keep the object pressed even if the press slid from the object*/
|
||||
LV_OBJ_FLAG_EVENT_BUBBLE = (1L << 14), /**< Propagate the events to the parent too*/
|
||||
LV_OBJ_FLAG_GESTURE_BUBBLE = (1L << 15), /**< Propagate the gestures to the parent*/
|
||||
LV_OBJ_FLAG_ADV_HITTEST = (1L << 16), /**< Allow performing more accurate hit (click) test. E.g. consider rounded corners.*/
|
||||
LV_OBJ_FLAG_IGNORE_LAYOUT = (1L << 17), /**< Make the object position-able by the layouts*/
|
||||
LV_OBJ_FLAG_FLOATING = (1L << 18), /**< Do not scroll the object when the parent scrolls and ignore layout*/
|
||||
LV_OBJ_FLAG_OVERFLOW_VISIBLE = (1L << 19), /**< Do not clip the children's content to the parent's boundary*/
|
||||
|
||||
LV_OBJ_FLAG_LAYOUT_1 = (1L << 23), /**< Custom flag, free to use by layouts*/
|
||||
LV_OBJ_FLAG_LAYOUT_2 = (1L << 24), /**< Custom flag, free to use by layouts*/
|
||||
|
@ -114,7 +118,10 @@ enum {
|
|||
LV_OBJ_FLAG_USER_2 = (1L << 28), /**< Custom flag, free to use by user*/
|
||||
LV_OBJ_FLAG_USER_3 = (1L << 29), /**< Custom flag, free to use by user*/
|
||||
LV_OBJ_FLAG_USER_4 = (1L << 30), /**< Custom flag, free to use by user*/
|
||||
|
||||
};
|
||||
|
||||
|
||||
typedef uint32_t lv_obj_flag_t;
|
||||
|
||||
/**
|
||||
|
@ -193,7 +200,7 @@ typedef struct _lv_obj_t {
|
|||
*/
|
||||
void lv_init(void);
|
||||
|
||||
#if LV_ENABLE_GC || !LV_MEM_CUSTOM || LV_USE_GPU_SDL
|
||||
#if LV_ENABLE_GC || !LV_MEM_CUSTOM
|
||||
|
||||
/**
|
||||
* Deinit the 'lv' library
|
||||
|
@ -378,10 +385,11 @@ static inline lv_coord_t lv_obj_dpx(const lv_obj_t * obj, lv_coord_t n)
|
|||
|
||||
#if LV_USE_ASSERT_OBJ
|
||||
# define LV_ASSERT_OBJ(obj_p, obj_class) \
|
||||
do { \
|
||||
LV_ASSERT_MSG(obj_p != NULL, "The object is NULL"); \
|
||||
LV_ASSERT_MSG(lv_obj_has_class(obj_p, obj_class) == true, "Incompatible object type."); \
|
||||
LV_ASSERT_MSG(lv_obj_is_valid(obj_p) == true, "The object is invalid, deleted or corrupted?");
|
||||
|
||||
LV_ASSERT_MSG(lv_obj_is_valid(obj_p) == true, "The object is invalid, deleted or corrupted?"); \
|
||||
} while(0)
|
||||
# else
|
||||
# define LV_ASSERT_OBJ(obj_p, obj_class) do{}while(0)
|
||||
#endif
|
||||
|
|
|
@ -55,7 +55,7 @@ lv_obj_t * lv_obj_class_create_obj(const lv_obj_class_t * class_p, lv_obj_t * pa
|
|||
LV_TRACE_OBJ_CREATE("creating a screen");
|
||||
lv_disp_t * disp = lv_disp_get_default();
|
||||
if(!disp) {
|
||||
LV_LOG_WARN("No display created to so far. No place to assign the new screen");
|
||||
LV_LOG_WARN("No display created yet. No place to assign the new screen");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
|
|
@ -58,11 +58,19 @@ void lv_obj_init_draw_rect_dsc(lv_obj_t * obj, uint32_t part, lv_draw_rect_dsc_t
|
|||
draw_dsc->bg_opa = lv_obj_get_style_bg_opa(obj, part);
|
||||
if(draw_dsc->bg_opa > LV_OPA_MIN) {
|
||||
draw_dsc->bg_color = lv_obj_get_style_bg_color_filtered(obj, part);
|
||||
draw_dsc->bg_grad_dir = lv_obj_get_style_bg_grad_dir(obj, part);
|
||||
if(draw_dsc->bg_grad_dir != LV_GRAD_DIR_NONE) {
|
||||
draw_dsc->bg_grad_color = lv_obj_get_style_bg_grad_color_filtered(obj, part);
|
||||
draw_dsc->bg_main_color_stop = lv_obj_get_style_bg_main_stop(obj, part);
|
||||
draw_dsc->bg_grad_color_stop = lv_obj_get_style_bg_grad_stop(obj, part);
|
||||
const lv_grad_dsc_t * grad = lv_obj_get_style_bg_grad(obj, part);
|
||||
if(grad && grad->dir != LV_GRAD_DIR_NONE) {
|
||||
lv_memcpy(&draw_dsc->bg_grad, grad, sizeof(*grad));
|
||||
}
|
||||
else {
|
||||
draw_dsc->bg_grad.dir = lv_obj_get_style_bg_grad_dir(obj, part);
|
||||
if(draw_dsc->bg_grad.dir != LV_GRAD_DIR_NONE) {
|
||||
draw_dsc->bg_grad.stops[0].color = lv_obj_get_style_bg_color_filtered(obj, part);
|
||||
draw_dsc->bg_grad.stops[1].color = lv_obj_get_style_bg_grad_color_filtered(obj, part);
|
||||
draw_dsc->bg_grad.stops[0].frac = lv_obj_get_style_bg_main_stop(obj, part);
|
||||
draw_dsc->bg_grad.stops[1].frac = lv_obj_get_style_bg_grad_stop(obj, part);
|
||||
}
|
||||
draw_dsc->bg_grad.dither = lv_obj_get_style_bg_dither_mode(obj, part);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -128,6 +136,7 @@ void lv_obj_init_draw_rect_dsc(lv_obj_t * obj, uint32_t part, lv_draw_rect_dsc_t
|
|||
|
||||
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;
|
||||
|
@ -322,10 +331,10 @@ lv_coord_t lv_obj_calculate_ext_draw_size(lv_obj_t * obj, uint32_t part)
|
|||
return s;
|
||||
}
|
||||
|
||||
void lv_obj_draw_dsc_init(lv_obj_draw_part_dsc_t * dsc, const lv_area_t * clip_area)
|
||||
void lv_obj_draw_dsc_init(lv_obj_draw_part_dsc_t * dsc, lv_draw_ctx_t * draw_ctx)
|
||||
{
|
||||
lv_memset_00(dsc, sizeof(lv_obj_draw_part_dsc_t));
|
||||
dsc->clip_area = clip_area;
|
||||
dsc->draw_ctx = draw_ctx;
|
||||
}
|
||||
|
||||
bool lv_obj_draw_part_check_type(lv_obj_draw_part_dsc_t * dsc, const lv_obj_class_t * class_p, uint32_t type)
|
||||
|
|
|
@ -34,7 +34,7 @@ typedef enum {
|
|||
} lv_cover_res_t;
|
||||
|
||||
typedef struct {
|
||||
const lv_area_t * clip_area; /**< The current clip area, required if you need to draw something in the event*/
|
||||
lv_draw_ctx_t * draw_ctx; /**< Draw context*/
|
||||
const struct _lv_obj_class_t * class_p; /**< The class that sent the event */
|
||||
uint32_t type; /**< The type if part being draw. Element of `lv_<name>_draw_part_type_t` */
|
||||
lv_area_t * draw_area; /**< The area of the part being drawn*/
|
||||
|
@ -125,9 +125,9 @@ 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 clip_area the current clip area of the drawing
|
||||
* @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, const lv_area_t * clip_area);
|
||||
void lv_obj_draw_dsc_init(lv_obj_draw_part_dsc_t * dsc, lv_draw_ctx_t * draw_ctx);
|
||||
|
||||
/**
|
||||
* Check the type obj a part draw descriptor
|
||||
|
|
|
@ -202,7 +202,7 @@ bool lv_obj_refr_size(lv_obj_t * obj)
|
|||
lv_obj_readjust_scroll(obj, LV_ANIM_OFF);
|
||||
|
||||
/*If the object was out of the parent invalidate the new scrollbar area too.
|
||||
*If it wasn't out of the parent but out now, also invalidate the srollbars*/
|
||||
*If it wasn't out of the parent but out now, also invalidate the scrollbars*/
|
||||
bool on2 = _lv_area_is_in(&obj->coords, &parent_fit_area, 0);
|
||||
if(on1 || (!on1 && on2)) lv_obj_scrollbar_invalidate(parent);
|
||||
|
||||
|
@ -292,7 +292,7 @@ void lv_obj_mark_layout_as_dirty(lv_obj_t * obj)
|
|||
|
||||
/*Make the display refreshing*/
|
||||
lv_disp_t * disp = lv_obj_get_disp(scr);
|
||||
lv_timer_resume(disp->refr_timer);
|
||||
if(disp->refr_timer) lv_timer_resume(disp->refr_timer);
|
||||
}
|
||||
|
||||
void lv_obj_update_layout(const lv_obj_t * obj)
|
||||
|
@ -538,6 +538,17 @@ lv_coord_t lv_obj_get_y2(const lv_obj_t * obj)
|
|||
return lv_obj_get_y(obj) + lv_obj_get_height(obj);
|
||||
}
|
||||
|
||||
lv_coord_t lv_obj_get_x_aligned(const lv_obj_t * obj)
|
||||
{
|
||||
return lv_obj_get_style_x(obj, LV_PART_MAIN);
|
||||
}
|
||||
|
||||
lv_coord_t lv_obj_get_y_aligned(const lv_obj_t * obj)
|
||||
{
|
||||
return lv_obj_get_style_y(obj, LV_PART_MAIN);
|
||||
}
|
||||
|
||||
|
||||
lv_coord_t lv_obj_get_width(const lv_obj_t * obj)
|
||||
{
|
||||
LV_ASSERT_OBJ(obj, MY_CLASS);
|
||||
|
@ -796,6 +807,12 @@ 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);
|
||||
|
@ -813,7 +830,7 @@ bool lv_obj_area_is_visible(const lv_obj_t * obj, lv_area_t * area)
|
|||
{
|
||||
if(lv_obj_has_flag(obj, LV_OBJ_FLAG_HIDDEN)) return false;
|
||||
|
||||
/*Invalidate the object only if it belongs to the current or previous'*/
|
||||
/*Invalidate the object only if it belongs to the current or previous or one of the layers'*/
|
||||
lv_obj_t * obj_scr = lv_obj_get_screen(obj);
|
||||
lv_disp_t * disp = lv_obj_get_disp(obj_scr);
|
||||
if(obj_scr != lv_disp_get_scr_act(disp) &&
|
||||
|
@ -824,6 +841,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)) {
|
||||
lv_area_t obj_coords;
|
||||
lv_coord_t ext_size = _lv_obj_get_ext_draw_size(obj);
|
||||
lv_area_copy(&obj_coords, &obj->coords);
|
||||
|
@ -832,18 +850,20 @@ bool lv_obj_area_is_visible(const lv_obj_t * obj, lv_area_t * area)
|
|||
obj_coords.x2 += ext_size;
|
||||
obj_coords.y2 += ext_size;
|
||||
|
||||
bool is_common;
|
||||
|
||||
is_common = _lv_area_intersect(area, area, &obj_coords);
|
||||
if(is_common == false) return false; /*The area is not on the object*/
|
||||
/*The area is not on the object*/
|
||||
if(!_lv_area_intersect(area, area, &obj_coords)) return false;
|
||||
}
|
||||
|
||||
/*Truncate recursively to the parents*/
|
||||
lv_obj_t * par = lv_obj_get_parent(obj);
|
||||
while(par != NULL) {
|
||||
is_common = _lv_area_intersect(area, area, &par->coords);
|
||||
if(is_common == false) return false; /*If no common parts with parent break;*/
|
||||
if(lv_obj_has_flag(par, LV_OBJ_FLAG_HIDDEN)) return
|
||||
false; /*If the parent is hidden then the child is hidden and won't be drawn*/
|
||||
/*If the parent is hidden then the child is hidden and won't be drawn*/
|
||||
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;
|
||||
}
|
||||
|
||||
par = lv_obj_get_parent(par);
|
||||
}
|
||||
|
@ -888,6 +908,9 @@ void lv_obj_get_click_area(const lv_obj_t * obj, lv_area_t * area)
|
|||
|
||||
bool lv_obj_hit_test(lv_obj_t * obj, const lv_point_t * point)
|
||||
{
|
||||
if(!lv_obj_has_flag(obj, LV_OBJ_FLAG_CLICKABLE)) return false;
|
||||
if(lv_obj_has_state(obj, LV_STATE_DISABLED)) return false;
|
||||
|
||||
lv_area_t a;
|
||||
lv_obj_get_click_area(obj, &a);
|
||||
bool res = _lv_area_is_point_on(&a, point, 0);
|
||||
|
@ -957,11 +980,12 @@ static lv_coord_t calc_content_width(lv_obj_t * obj)
|
|||
default:
|
||||
/* Consider other cases only if x=0 and use the width of the object.
|
||||
* With x!=0 circular dependency could occur. */
|
||||
if(lv_obj_get_style_y(child, 0) == 0) {
|
||||
child_res = LV_MAX(child_res, lv_area_get_width(&child->coords));
|
||||
if(lv_obj_get_style_x(child, 0) == 0) {
|
||||
child_res = LV_MAX(child_res, lv_area_get_width(&child->coords) + pad_right);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
child_res = LV_MAX(child_res, obj->coords.x2 - child->coords.x1 + 1);
|
||||
}
|
||||
}
|
||||
|
@ -989,10 +1013,11 @@ static lv_coord_t calc_content_width(lv_obj_t * obj)
|
|||
/* Consider other cases only if x=0 and use the width of the object.
|
||||
* With x!=0 circular dependency could occur. */
|
||||
if(lv_obj_get_style_y(child, 0) == 0) {
|
||||
child_res = LV_MAX(child_res, lv_area_get_width(&child->coords));
|
||||
child_res = LV_MAX(child_res, lv_area_get_width(&child->coords) + pad_left);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
child_res = LV_MAX(child_res, child->coords.x2 - obj->coords.x1 + 1);
|
||||
}
|
||||
}
|
||||
|
@ -1039,11 +1064,12 @@ static lv_coord_t calc_content_height(lv_obj_t * obj)
|
|||
/* Consider other cases only if y=0 and use the height of the object.
|
||||
* With y!=0 circular dependency could occur. */
|
||||
if(lv_obj_get_style_y(child, 0) == 0) {
|
||||
child_res = LV_MAX(child_res, lv_area_get_height(&child->coords));
|
||||
child_res = LV_MAX(child_res, lv_area_get_height(&child->coords) + pad_top);
|
||||
}
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
child_res = LV_MAX(child_res, child->coords.y2 - obj->coords.y1 + 1);
|
||||
}
|
||||
}
|
||||
|
@ -1051,7 +1077,8 @@ static lv_coord_t calc_content_height(lv_obj_t * obj)
|
|||
if(child_res != LV_COORD_MIN) {
|
||||
child_res += pad_bottom;
|
||||
return LV_MAX(child_res, self_h);
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
return self_h;
|
||||
}
|
||||
|
||||
|
|
|
@ -35,24 +35,36 @@ typedef struct {
|
|||
**********************/
|
||||
|
||||
/**
|
||||
* Set the relative the position of an object (relative to the parent's top left corner)
|
||||
* Set the position of an object relative to the set alignment.
|
||||
* @param obj pointer to an object
|
||||
* @param x new distance from the left side of the parent plus the parent's left padding
|
||||
* @param y new distance from the top side of the parent plus the parent's right padding
|
||||
* @param x new x coordinate
|
||||
* @param y new y coordinate
|
||||
* @note With default alignment it's the distance from the top left corner
|
||||
* @note E.g. LV_ALIGN_CENTER alignment it's the offset from the center of the parent
|
||||
* @note The position is interpreted on the content area of the parent
|
||||
* @note The values can be set in pixel or in percentage of parent size with `lv_pct(v)`
|
||||
*/
|
||||
void lv_obj_set_pos(struct _lv_obj_t * obj, lv_coord_t x, lv_coord_t y);
|
||||
|
||||
/**
|
||||
* Set the x coordinate of a object
|
||||
* Set the x coordinate of an object
|
||||
* @param obj pointer to an object
|
||||
* @param x new distance from the left side from the parent plus the parent's left padding
|
||||
* @param x new x coordinate
|
||||
* @note With default alignment it's the distance from the top left corner
|
||||
* @note E.g. LV_ALIGN_CENTER alignment it's the offset from the center of the parent
|
||||
* @note The position is interpreted on the content area of the parent
|
||||
* @note The values can be set in pixel or in percentage of parent size with `lv_pct(v)`
|
||||
*/
|
||||
void lv_obj_set_x(struct _lv_obj_t * obj, lv_coord_t x);
|
||||
|
||||
/**
|
||||
* Set the y coordinate of a object
|
||||
* Set the y coordinate of an object
|
||||
* @param obj pointer to an object
|
||||
* @param y new distance from the top of the parent plus the parent's top padding
|
||||
* @param y new y coordinate
|
||||
* @note With default alignment it's the distance from the top left corner
|
||||
* @note E.g. LV_ALIGN_CENTER alignment it's the offset from the center of the parent
|
||||
* @note The position is interpreted on the content area of the parent
|
||||
* @note The values can be set in pixel or in percentage of parent size with `lv_pct(v)`
|
||||
*/
|
||||
void lv_obj_set_y(struct _lv_obj_t * obj, lv_coord_t y);
|
||||
|
||||
|
@ -141,7 +153,7 @@ void lv_obj_mark_layout_as_dirty(struct _lv_obj_t * obj);
|
|||
void lv_obj_update_layout(const struct _lv_obj_t * obj);
|
||||
|
||||
/**
|
||||
* Regsiter a new layout
|
||||
* Register a new layout
|
||||
* @param cb the layout update callback
|
||||
* @param user_data custom data that will be passed to `cb`
|
||||
* @return the ID of the new layout
|
||||
|
@ -245,6 +257,20 @@ lv_coord_t lv_obj_get_y(const struct _lv_obj_t * obj);
|
|||
*/
|
||||
lv_coord_t lv_obj_get_y2(const struct _lv_obj_t * obj);
|
||||
|
||||
/**
|
||||
* Get the actually set x coordinate of object, i.e. the offset form the set alignment
|
||||
* @param obj pointer to an object
|
||||
* @return the set x coordinate
|
||||
*/
|
||||
lv_coord_t lv_obj_get_x_aligned(const struct _lv_obj_t * obj);
|
||||
|
||||
/**
|
||||
* Get the actually set y coordinate of object, i.e. the offset form the set alignment
|
||||
* @param obj pointer to an object
|
||||
* @return the set y coordinate
|
||||
*/
|
||||
lv_coord_t lv_obj_get_y_aligned(const struct _lv_obj_t * obj);
|
||||
|
||||
/**
|
||||
* Get the width of an object
|
||||
* @param obj pointer to an object
|
||||
|
|
|
@ -252,9 +252,58 @@ void lv_obj_get_scroll_end(struct _lv_obj_t * obj, lv_point_t * end)
|
|||
* Other functions
|
||||
*====================*/
|
||||
|
||||
void lv_obj_scroll_by(lv_obj_t * obj, lv_coord_t x, lv_coord_t y, lv_anim_enable_t anim_en)
|
||||
void lv_obj_scroll_by_bounded(lv_obj_t * obj, lv_coord_t dx, lv_coord_t dy, lv_anim_enable_t anim_en)
|
||||
{
|
||||
if(x == 0 && y == 0) return;
|
||||
if(dx == 0 && dy == 0) return;
|
||||
|
||||
/*We need to know the final sizes for bound check*/
|
||||
lv_obj_update_layout(obj);
|
||||
|
||||
/*Don't let scroll more then naturally possible by the size of the content*/
|
||||
lv_coord_t x_current = -lv_obj_get_scroll_x(obj);
|
||||
lv_coord_t x_bounded = x_current + dx;
|
||||
|
||||
if(lv_obj_get_style_base_dir(obj, LV_PART_MAIN) != LV_BASE_DIR_RTL) {
|
||||
if(x_bounded > 0) x_bounded = 0;
|
||||
if(x_bounded < 0) {
|
||||
lv_coord_t scroll_max = lv_obj_get_scroll_left(obj) + lv_obj_get_scroll_right(obj);
|
||||
if(scroll_max < 0) scroll_max = 0;
|
||||
|
||||
if(x_bounded < -scroll_max) x_bounded = -scroll_max;
|
||||
}
|
||||
}
|
||||
else {
|
||||
if(x_bounded < 0) x_bounded = 0;
|
||||
if(x_bounded > 0) {
|
||||
lv_coord_t scroll_max = lv_obj_get_scroll_left(obj) + lv_obj_get_scroll_right(obj);
|
||||
if(scroll_max < 0) scroll_max = 0;
|
||||
|
||||
if(x_bounded > scroll_max) x_bounded = scroll_max;
|
||||
}
|
||||
}
|
||||
|
||||
/*Don't let scroll more then naturally possible by the size of the content*/
|
||||
lv_coord_t y_current = -lv_obj_get_scroll_y(obj);
|
||||
lv_coord_t y_bounded = y_current + dy;
|
||||
|
||||
if(y_bounded > 0) y_bounded = 0;
|
||||
if(y_bounded < 0) {
|
||||
lv_coord_t scroll_max = lv_obj_get_scroll_top(obj) + lv_obj_get_scroll_bottom(obj);
|
||||
if(scroll_max < 0) scroll_max = 0;
|
||||
if(y_bounded < -scroll_max) y_bounded = -scroll_max;
|
||||
}
|
||||
|
||||
dx = x_bounded - x_current;
|
||||
dy = y_bounded - y_current;
|
||||
if(dx || dy) {
|
||||
lv_obj_scroll_by(obj, dx, dy, anim_en);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void lv_obj_scroll_by(lv_obj_t * obj, lv_coord_t dx, lv_coord_t dy, lv_anim_enable_t anim_en)
|
||||
{
|
||||
if(dx == 0 && dy == 0) return;
|
||||
if(anim_en == LV_ANIM_ON) {
|
||||
lv_disp_t * d = lv_obj_get_disp(obj);
|
||||
lv_anim_t a;
|
||||
|
@ -262,13 +311,13 @@ void lv_obj_scroll_by(lv_obj_t * obj, lv_coord_t x, lv_coord_t y, lv_anim_enable
|
|||
lv_anim_set_var(&a, obj);
|
||||
lv_anim_set_ready_cb(&a, scroll_anim_ready_cb);
|
||||
|
||||
if(x) {
|
||||
uint32_t t = lv_anim_speed_to_time((lv_disp_get_hor_res(d) * 2) >> 2, 0, x);
|
||||
if(dx) {
|
||||
uint32_t t = lv_anim_speed_to_time((lv_disp_get_hor_res(d) * 2) >> 2, 0, dx);
|
||||
if(t < SCROLL_ANIM_TIME_MIN) t = SCROLL_ANIM_TIME_MIN;
|
||||
if(t > SCROLL_ANIM_TIME_MAX) t = SCROLL_ANIM_TIME_MAX;
|
||||
lv_anim_set_time(&a, t);
|
||||
lv_coord_t sx = lv_obj_get_scroll_x(obj);
|
||||
lv_anim_set_values(&a, -sx, -sx + x);
|
||||
lv_anim_set_values(&a, -sx, -sx + dx);
|
||||
lv_anim_set_exec_cb(&a, scroll_x_anim);
|
||||
lv_anim_set_path_cb(&a, lv_anim_path_ease_out);
|
||||
|
||||
|
@ -278,13 +327,13 @@ void lv_obj_scroll_by(lv_obj_t * obj, lv_coord_t x, lv_coord_t y, lv_anim_enable
|
|||
lv_anim_start(&a);
|
||||
}
|
||||
|
||||
if(y) {
|
||||
uint32_t t = lv_anim_speed_to_time((lv_disp_get_ver_res(d) * 2) >> 2, 0, y);
|
||||
if(dy) {
|
||||
uint32_t t = lv_anim_speed_to_time((lv_disp_get_ver_res(d) * 2) >> 2, 0, dy);
|
||||
if(t < SCROLL_ANIM_TIME_MIN) t = SCROLL_ANIM_TIME_MIN;
|
||||
if(t > SCROLL_ANIM_TIME_MAX) t = SCROLL_ANIM_TIME_MAX;
|
||||
lv_anim_set_time(&a, t);
|
||||
lv_coord_t sy = lv_obj_get_scroll_y(obj);
|
||||
lv_anim_set_values(&a, -sy, -sy + y);
|
||||
lv_anim_set_values(&a, -sy, -sy + dy);
|
||||
lv_anim_set_exec_cb(&a, scroll_y_anim);
|
||||
lv_anim_set_path_cb(&a, lv_anim_path_ease_out);
|
||||
|
||||
|
@ -298,7 +347,7 @@ void lv_obj_scroll_by(lv_obj_t * obj, lv_coord_t x, lv_coord_t y, lv_anim_enable
|
|||
/*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, x, y);
|
||||
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);
|
||||
|
@ -317,48 +366,20 @@ void lv_obj_scroll_to_x(lv_obj_t * obj, lv_coord_t x, lv_anim_enable_t anim_en)
|
|||
{
|
||||
lv_anim_del(obj, scroll_x_anim);
|
||||
|
||||
/*Don't let scroll more then naturally possible by the size of the content*/
|
||||
if(lv_obj_get_style_base_dir(obj, LV_PART_MAIN) != LV_BASE_DIR_RTL) {
|
||||
if(x < 0) x = 0;
|
||||
if(x > 0) {
|
||||
lv_coord_t scroll_max = lv_obj_get_scroll_left(obj) + lv_obj_get_scroll_right(obj);
|
||||
if(scroll_max < 0) scroll_max = 0;
|
||||
|
||||
if(x > scroll_max) x = scroll_max;
|
||||
}
|
||||
}
|
||||
else {
|
||||
if(x > 0) x = 0;
|
||||
if(x < 0) {
|
||||
lv_coord_t scroll_max = lv_obj_get_scroll_left(obj) + lv_obj_get_scroll_right(obj);
|
||||
if(scroll_max < 0) scroll_max = 0;
|
||||
|
||||
if(x < -scroll_max) x = -scroll_max;
|
||||
}
|
||||
}
|
||||
|
||||
lv_coord_t scroll_x = lv_obj_get_scroll_x(obj);
|
||||
lv_coord_t diff = -x + scroll_x;
|
||||
|
||||
lv_obj_scroll_by(obj, diff, 0, anim_en);
|
||||
lv_obj_scroll_by_bounded(obj, diff, 0, anim_en);
|
||||
}
|
||||
|
||||
void lv_obj_scroll_to_y(lv_obj_t * obj, lv_coord_t y, lv_anim_enable_t anim_en)
|
||||
{
|
||||
lv_anim_del(obj, scroll_y_anim);
|
||||
|
||||
/*Don't let scroll more then naturally possible by the size of the content*/
|
||||
if(y < 0) y = 0;
|
||||
if(y > 0) {
|
||||
lv_coord_t scroll_max = lv_obj_get_scroll_top(obj) + lv_obj_get_scroll_bottom(obj);
|
||||
if(scroll_max < 0) scroll_max = 0;
|
||||
if(y > scroll_max) y = scroll_max;
|
||||
}
|
||||
|
||||
lv_coord_t scroll_y = lv_obj_get_scroll_y(obj);
|
||||
lv_coord_t diff = -y + scroll_y;
|
||||
|
||||
lv_obj_scroll_by(obj, 0, diff, anim_en);
|
||||
lv_obj_scroll_by_bounded(obj, 0, diff, anim_en);
|
||||
}
|
||||
|
||||
void lv_obj_scroll_to_view(lv_obj_t * obj, lv_anim_enable_t anim_en)
|
||||
|
@ -452,15 +473,18 @@ void lv_obj_get_scrollbar_area(lv_obj_t * obj, lv_area_t * hor_area, lv_area_t *
|
|||
|
||||
bool rtl = lv_obj_get_style_base_dir(obj, LV_PART_SCROLLBAR) == LV_BASE_DIR_RTL ? true : false;
|
||||
|
||||
lv_coord_t end_space = lv_obj_get_style_pad_top(obj, LV_PART_SCROLLBAR);
|
||||
lv_coord_t side_space = lv_obj_get_style_pad_right(obj, LV_PART_SCROLLBAR);
|
||||
lv_coord_t top_space = lv_obj_get_style_pad_top(obj, LV_PART_SCROLLBAR);
|
||||
lv_coord_t bottom_space = lv_obj_get_style_pad_bottom(obj, LV_PART_SCROLLBAR);
|
||||
lv_coord_t left_space = lv_obj_get_style_pad_left(obj, LV_PART_SCROLLBAR);
|
||||
lv_coord_t right_space = lv_obj_get_style_pad_right(obj, LV_PART_SCROLLBAR);
|
||||
lv_coord_t tickness = lv_obj_get_style_width(obj, LV_PART_SCROLLBAR);
|
||||
|
||||
lv_coord_t obj_h = lv_obj_get_height(obj);
|
||||
lv_coord_t obj_w = lv_obj_get_width(obj);
|
||||
|
||||
lv_coord_t ver_reg_space = ver_draw ? tickness + side_space : 0;
|
||||
lv_coord_t hor_req_space = hor_draw ? tickness + side_space : 0;
|
||||
/*Space required for the vertical and horizontal scrollbars*/
|
||||
lv_coord_t ver_reg_space = ver_draw ? tickness : 0;
|
||||
lv_coord_t hor_req_space = hor_draw ? tickness : 0;
|
||||
lv_coord_t rem;
|
||||
|
||||
if(lv_obj_get_style_bg_opa(obj, LV_PART_SCROLLBAR) < LV_OPA_MIN &&
|
||||
|
@ -468,42 +492,46 @@ void lv_obj_get_scrollbar_area(lv_obj_t * obj, lv_area_t * hor_area, lv_area_t *
|
|||
return;
|
||||
}
|
||||
|
||||
/*Draw horizontal scrollbar if the mode is ON or can be scrolled in this direction*/
|
||||
/*Draw vertical scrollbar if the mode is ON or can be scrolled in this direction*/
|
||||
lv_coord_t content_h = obj_h + st + sb;
|
||||
if(ver_draw && content_h) {
|
||||
ver_area->y1 = obj->coords.y1;
|
||||
ver_area->y2 = obj->coords.y2;
|
||||
if(rtl) {
|
||||
ver_area->x1 = obj->coords.x1 + side_space;
|
||||
ver_area->x1 = obj->coords.x1 + left_space;
|
||||
ver_area->x2 = ver_area->x1 + tickness - 1;
|
||||
}
|
||||
else {
|
||||
ver_area->x2 = obj->coords.x2 - side_space;
|
||||
ver_area->x2 = obj->coords.x2 - right_space;
|
||||
ver_area->x1 = ver_area->x2 - tickness + 1;
|
||||
}
|
||||
|
||||
lv_coord_t sb_h = ((obj_h - end_space * 2 - hor_req_space) * obj_h) / content_h;
|
||||
lv_coord_t sb_h = ((obj_h - top_space - bottom_space - hor_req_space) * obj_h) / content_h;
|
||||
sb_h = LV_MAX(sb_h, SCROLLBAR_MIN_SIZE);
|
||||
rem = (obj_h - end_space * 2 - hor_req_space) -
|
||||
rem = (obj_h - top_space - bottom_space - hor_req_space) -
|
||||
sb_h; /*Remaining size from the scrollbar track that is not the scrollbar itself*/
|
||||
lv_coord_t scroll_h = content_h - obj_h; /*The size of the content which can be really scrolled*/
|
||||
if(scroll_h <= 0) {
|
||||
ver_area->y1 = obj->coords.y1 + end_space;
|
||||
ver_area->y2 = obj->coords.y2 - end_space - hor_req_space - 1;
|
||||
ver_area->y1 = obj->coords.y1 + top_space;
|
||||
ver_area->y2 = obj->coords.y2 - bottom_space - hor_req_space - 1;
|
||||
}
|
||||
else {
|
||||
lv_coord_t sb_y = (rem * sb) / scroll_h;
|
||||
sb_y = rem - sb_y;
|
||||
|
||||
ver_area->y1 = obj->coords.y1 + sb_y + end_space;
|
||||
ver_area->y1 = obj->coords.y1 + sb_y + top_space;
|
||||
ver_area->y2 = ver_area->y1 + sb_h - 1;
|
||||
if(ver_area->y1 < obj->coords.y1 + end_space) {
|
||||
ver_area->y1 = obj->coords.y1 + end_space;
|
||||
if(ver_area->y1 + SCROLLBAR_MIN_SIZE > ver_area->y2)ver_area->y2 = ver_area->y1 + SCROLLBAR_MIN_SIZE;
|
||||
if(ver_area->y1 < obj->coords.y1 + top_space) {
|
||||
ver_area->y1 = obj->coords.y1 + top_space;
|
||||
if(ver_area->y1 + SCROLLBAR_MIN_SIZE > ver_area->y2) {
|
||||
ver_area->y2 = ver_area->y1 + SCROLLBAR_MIN_SIZE;
|
||||
}
|
||||
}
|
||||
if(ver_area->y2 > obj->coords.y2 - hor_req_space - bottom_space) {
|
||||
ver_area->y2 = obj->coords.y2 - hor_req_space - bottom_space;
|
||||
if(ver_area->y2 - SCROLLBAR_MIN_SIZE < ver_area->y1) {
|
||||
ver_area->y1 = ver_area->y2 - SCROLLBAR_MIN_SIZE;
|
||||
}
|
||||
if(ver_area->y2 > obj->coords.y2 - hor_req_space - end_space) {
|
||||
ver_area->y2 = obj->coords.y2 - hor_req_space - end_space;
|
||||
if(ver_area->y2 - SCROLLBAR_MIN_SIZE < ver_area->y1)ver_area->y1 = ver_area->y2 - SCROLLBAR_MIN_SIZE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -511,24 +539,24 @@ void lv_obj_get_scrollbar_area(lv_obj_t * obj, lv_area_t * hor_area, lv_area_t *
|
|||
/*Draw horizontal scrollbar if the mode is ON or can be scrolled in this direction*/
|
||||
lv_coord_t content_w = obj_w + sl + sr;
|
||||
if(hor_draw && content_w) {
|
||||
hor_area->y2 = obj->coords.y2 - side_space;
|
||||
hor_area->y2 = obj->coords.y2 - bottom_space;
|
||||
hor_area->y1 = hor_area->y2 - tickness + 1;
|
||||
hor_area->x1 = obj->coords.x1;
|
||||
hor_area->x2 = obj->coords.x2;
|
||||
|
||||
lv_coord_t sb_w = ((obj_w - end_space * 2 - ver_reg_space) * obj_w) / content_w;
|
||||
lv_coord_t sb_w = ((obj_w - left_space - right_space - ver_reg_space) * obj_w) / content_w;
|
||||
sb_w = LV_MAX(sb_w, SCROLLBAR_MIN_SIZE);
|
||||
rem = (obj_w - end_space * 2 - ver_reg_space) -
|
||||
rem = (obj_w - left_space - right_space - ver_reg_space) -
|
||||
sb_w; /*Remaining size from the scrollbar track that is not the scrollbar itself*/
|
||||
lv_coord_t scroll_w = content_w - obj_w; /*The size of the content which can be really scrolled*/
|
||||
if(scroll_w <= 0) {
|
||||
if(rtl) {
|
||||
hor_area->x1 = obj->coords.x1 + end_space + ver_reg_space - 1;
|
||||
hor_area->x2 = obj->coords.x2 - end_space;
|
||||
hor_area->x1 = obj->coords.x1 + left_space + ver_reg_space - 1;
|
||||
hor_area->x2 = obj->coords.x2 - right_space;
|
||||
}
|
||||
else {
|
||||
hor_area->x1 = obj->coords.x1 + end_space;
|
||||
hor_area->x2 = obj->coords.x2 - end_space - ver_reg_space - 1;
|
||||
hor_area->x1 = obj->coords.x1 + left_space;
|
||||
hor_area->x2 = obj->coords.x2 - right_space - ver_reg_space - 1;
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
@ -536,27 +564,35 @@ void lv_obj_get_scrollbar_area(lv_obj_t * obj, lv_area_t * hor_area, lv_area_t *
|
|||
sb_x = rem - sb_x;
|
||||
|
||||
if(rtl) {
|
||||
hor_area->x1 = obj->coords.x1 + sb_x + end_space + ver_reg_space;
|
||||
hor_area->x1 = obj->coords.x1 + sb_x + left_space + ver_reg_space;
|
||||
hor_area->x2 = hor_area->x1 + sb_w - 1;
|
||||
if(hor_area->x1 < obj->coords.x1 + end_space + ver_reg_space) {
|
||||
hor_area->x1 = obj->coords.x1 + end_space + ver_reg_space;
|
||||
if(hor_area->x1 + SCROLLBAR_MIN_SIZE > hor_area->x2) hor_area->x2 = hor_area->x1 + SCROLLBAR_MIN_SIZE;
|
||||
if(hor_area->x1 < obj->coords.x1 + left_space + ver_reg_space) {
|
||||
hor_area->x1 = obj->coords.x1 + left_space + ver_reg_space;
|
||||
if(hor_area->x1 + SCROLLBAR_MIN_SIZE > hor_area->x2) {
|
||||
hor_area->x2 = hor_area->x1 + SCROLLBAR_MIN_SIZE;
|
||||
}
|
||||
}
|
||||
if(hor_area->x2 > obj->coords.x2 - right_space) {
|
||||
hor_area->x2 = obj->coords.x2 - right_space;
|
||||
if(hor_area->x2 - SCROLLBAR_MIN_SIZE < hor_area->x1) {
|
||||
hor_area->x1 = hor_area->x2 - SCROLLBAR_MIN_SIZE;
|
||||
}
|
||||
if(hor_area->x2 > obj->coords.x2 - end_space) {
|
||||
hor_area->x2 = obj->coords.x2 - end_space;
|
||||
if(hor_area->x2 - SCROLLBAR_MIN_SIZE < hor_area->x1) hor_area->x1 = hor_area->x2 - SCROLLBAR_MIN_SIZE;
|
||||
}
|
||||
}
|
||||
else {
|
||||
hor_area->x1 = obj->coords.x1 + sb_x + end_space;
|
||||
hor_area->x1 = obj->coords.x1 + sb_x + left_space;
|
||||
hor_area->x2 = hor_area->x1 + sb_w - 1;
|
||||
if(hor_area->x1 < obj->coords.x1 + end_space) {
|
||||
hor_area->x1 = obj->coords.x1 + end_space;
|
||||
if(hor_area->x1 + SCROLLBAR_MIN_SIZE > hor_area->x2) hor_area->x2 = hor_area->x1 + SCROLLBAR_MIN_SIZE;
|
||||
if(hor_area->x1 < obj->coords.x1 + left_space) {
|
||||
hor_area->x1 = obj->coords.x1 + left_space;
|
||||
if(hor_area->x1 + SCROLLBAR_MIN_SIZE > hor_area->x2) {
|
||||
hor_area->x2 = hor_area->x1 + SCROLLBAR_MIN_SIZE;
|
||||
}
|
||||
}
|
||||
if(hor_area->x2 > obj->coords.x2 - ver_reg_space - right_space) {
|
||||
hor_area->x2 = obj->coords.x2 - ver_reg_space - right_space;
|
||||
if(hor_area->x2 - SCROLLBAR_MIN_SIZE < hor_area->x1) {
|
||||
hor_area->x1 = hor_area->x2 - SCROLLBAR_MIN_SIZE;
|
||||
}
|
||||
if(hor_area->x2 > obj->coords.x2 - ver_reg_space - end_space) {
|
||||
hor_area->x2 = obj->coords.x2 - ver_reg_space - end_space;
|
||||
if(hor_area->x2 - SCROLLBAR_MIN_SIZE < hor_area->x1) hor_area->x1 = hor_area->x2 - SCROLLBAR_MIN_SIZE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -183,17 +183,27 @@ void lv_obj_get_scroll_end(struct _lv_obj_t * obj, lv_point_t * end);
|
|||
*====================*/
|
||||
|
||||
/**
|
||||
*
|
||||
* Scroll by a given amount of pixels
|
||||
* @param obj pointer to an object to scroll
|
||||
* @param x pixels to scroll horizontally
|
||||
* @param y pixels to scroll vertically
|
||||
* @param dx pixels to scroll horizontally
|
||||
* @param dy pixels to scroll vertically
|
||||
* @param anim_en LV_ANIM_ON: scroll with animation; LV_ANIM_OFF: scroll immediately
|
||||
* @note > 0 value means scroll right/bottom (show the more content on the right/bottom)
|
||||
* @note
|
||||
* @note e.g. dy = -20 means scroll down 20 px
|
||||
*/
|
||||
void lv_obj_scroll_by(struct _lv_obj_t * obj, lv_coord_t x, lv_coord_t y, lv_anim_enable_t anim_en);
|
||||
|
||||
/**
|
||||
* Scroll by a given amount of pixels.
|
||||
* `dx` and `dy` will be limited internally to allow scrolling only on the content area.
|
||||
* @param obj pointer to an object to scroll
|
||||
* @param dx pixels to scroll horizontally
|
||||
* @param dy pixels to scroll vertically
|
||||
* @param anim_en LV_ANIM_ON: scroll with animation; LV_ANIM_OFF: scroll immediately
|
||||
* @note e.g. dy = -20 means scroll down 20 px
|
||||
*/
|
||||
void lv_obj_scroll_by_bounded(struct _lv_obj_t * obj, lv_coord_t dx, lv_coord_t dy, lv_anim_enable_t anim_en);
|
||||
|
||||
/**
|
||||
* Scroll to a given coordinate on an object.
|
||||
* `x` and `y` will be limited internally to allow scrolling only on the content area.
|
||||
|
|
|
@ -422,7 +422,7 @@ void lv_obj_fade_in(lv_obj_t * obj, uint32_t time, uint32_t delay)
|
|||
lv_anim_t a;
|
||||
lv_anim_init(&a);
|
||||
lv_anim_set_var(&a, obj);
|
||||
lv_anim_set_values(&a, LV_OPA_TRANSP, LV_OPA_COVER);
|
||||
lv_anim_set_values(&a, 0, LV_OPA_COVER);
|
||||
lv_anim_set_exec_cb(&a, fade_anim_cb);
|
||||
lv_anim_set_ready_cb(&a, fade_in_anim_ready);
|
||||
lv_anim_set_time(&a, time);
|
||||
|
@ -435,7 +435,7 @@ void lv_obj_fade_out(lv_obj_t * obj, uint32_t time, uint32_t delay)
|
|||
lv_anim_t a;
|
||||
lv_anim_init(&a);
|
||||
lv_anim_set_var(&a, obj);
|
||||
lv_anim_set_values(&a, LV_OPA_COVER, LV_OPA_TRANSP);
|
||||
lv_anim_set_values(&a, lv_obj_get_style_opa(obj, 0), LV_OPA_TRANSP);
|
||||
lv_anim_set_exec_cb(&a, fade_anim_cb);
|
||||
lv_anim_set_time(&a, time);
|
||||
lv_anim_set_delay(&a, delay);
|
||||
|
@ -469,8 +469,7 @@ lv_text_align_t lv_obj_calculate_style_text_align(const struct _lv_obj_t * obj,
|
|||
* Get the local style of an object for a given part and for a given state.
|
||||
* If the local style for the part-state pair doesn't exist allocate and return it.
|
||||
* @param obj pointer to an object
|
||||
* @param part the part in whose local style to get
|
||||
* @param state the state in whose local style to get
|
||||
* @param selector OR-ed value of parts and state for which the style should be get
|
||||
* @return pointer to the local style
|
||||
*/
|
||||
static lv_style_t * get_local_style(lv_obj_t * obj, lv_style_selector_t selector)
|
||||
|
@ -506,8 +505,7 @@ static lv_style_t * get_local_style(lv_obj_t * obj, lv_style_selector_t selecto
|
|||
* Get the transition style of an object for a given part and for a given state.
|
||||
* If the transition style for the part-state pair doesn't exist allocate and return it.
|
||||
* @param obj pointer to an object
|
||||
* @param part the part in whose local style to get
|
||||
* @param state the state in whose local style to get
|
||||
* @param selector OR-ed value of parts and state for which the style should be get
|
||||
* @return pointer to the transition style
|
||||
*/
|
||||
static _lv_obj_style_t * get_trans_style(lv_obj_t * obj, lv_style_selector_t selector)
|
||||
|
|
|
@ -133,10 +133,9 @@ lv_style_value_t lv_obj_get_style_prop(const struct _lv_obj_t * obj, lv_part_t p
|
|||
/**
|
||||
* Set local style property on an object's part and state.
|
||||
* @param obj pointer to an object
|
||||
* @param part a part to which the property should be added
|
||||
* @param state a state to which the property should be added
|
||||
* @param prop the property
|
||||
* @param value value of the property. The correct element should be set according to the type of the property
|
||||
* @param selector OR-ed value of parts and state for which the style should be set
|
||||
*/
|
||||
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);
|
||||
|
@ -147,9 +146,8 @@ lv_res_t lv_obj_get_local_style_prop(struct _lv_obj_t * obj, lv_style_prop_t pro
|
|||
/**
|
||||
* Remove a local style property from a part of an object with a given state.
|
||||
* @param obj pointer to an object
|
||||
* @param part the part of the object which style property should be removed.
|
||||
* @param state the state from which the property should be removed.
|
||||
* @param prop a style property to remove.
|
||||
* @param selector OR-ed value of parts and state for which the style should be removed
|
||||
* @return true the property was found and removed; false: the property was not found
|
||||
*/
|
||||
bool lv_obj_remove_local_style_prop(struct _lv_obj_t * obj, lv_style_prop_t prop, lv_style_selector_t selector);
|
||||
|
@ -230,15 +228,6 @@ static inline void lv_obj_set_style_size(struct _lv_obj_t * obj, lv_coord_t val
|
|||
|
||||
lv_text_align_t lv_obj_calculate_style_text_align(const struct _lv_obj_t * obj, lv_part_t part, const char * txt);
|
||||
|
||||
static inline lv_coord_t lv_obj_get_x_aligned(const struct _lv_obj_t * obj)
|
||||
{
|
||||
return lv_obj_get_style_x(obj, LV_PART_MAIN);
|
||||
}
|
||||
|
||||
static inline lv_coord_t lv_obj_get_y_aligned(const struct _lv_obj_t * obj)
|
||||
{
|
||||
return lv_obj_get_style_y(obj, LV_PART_MAIN);
|
||||
}
|
||||
|
||||
/**********************
|
||||
* MACROS
|
||||
|
@ -248,4 +237,4 @@ static inline lv_coord_t lv_obj_get_y_aligned(const struct _lv_obj_t * obj)
|
|||
} /*extern "C"*/
|
||||
#endif
|
||||
|
||||
#endif /*LV_TEMPL_H*/
|
||||
#endif /*LV_OBJ_STYLE_H*/
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
#include "lv_obj.h"
|
||||
|
||||
void lv_obj_set_style_width(struct _lv_obj_t * obj, lv_coord_t value, lv_style_selector_t selector)
|
||||
{
|
||||
lv_style_value_t v = {
|
||||
|
@ -167,94 +168,6 @@ void lv_obj_set_style_pad_column(struct _lv_obj_t * obj, lv_coord_t value, lv_st
|
|||
lv_obj_set_local_style_prop(obj, LV_STYLE_PAD_COLUMN, v, selector);
|
||||
}
|
||||
|
||||
void lv_obj_set_style_radius(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_RADIUS, v, selector);
|
||||
}
|
||||
|
||||
void lv_obj_set_style_clip_corner(struct _lv_obj_t * obj, bool value, lv_style_selector_t selector)
|
||||
{
|
||||
lv_style_value_t v = {
|
||||
.num = (int32_t)value
|
||||
};
|
||||
lv_obj_set_local_style_prop(obj, LV_STYLE_CLIP_CORNER, v, selector);
|
||||
}
|
||||
|
||||
void lv_obj_set_style_opa(struct _lv_obj_t * obj, lv_opa_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_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)
|
||||
{
|
||||
lv_style_value_t v = {
|
||||
.ptr = value
|
||||
};
|
||||
lv_obj_set_local_style_prop(obj, LV_STYLE_COLOR_FILTER_DSC, v, selector);
|
||||
}
|
||||
|
||||
void lv_obj_set_style_color_filter_opa(struct _lv_obj_t * obj, lv_opa_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_COLOR_FILTER_OPA, 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 = {
|
||||
.num = (int32_t)value
|
||||
};
|
||||
lv_obj_set_local_style_prop(obj, LV_STYLE_ANIM_TIME, v, selector);
|
||||
}
|
||||
|
||||
void lv_obj_set_style_anim_speed(struct _lv_obj_t * obj, uint32_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_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)
|
||||
{
|
||||
lv_style_value_t v = {
|
||||
.ptr = value
|
||||
};
|
||||
lv_obj_set_local_style_prop(obj, LV_STYLE_TRANSITION, v, selector);
|
||||
}
|
||||
|
||||
void lv_obj_set_style_blend_mode(struct _lv_obj_t * obj, lv_blend_mode_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_BLEND_MODE, v, selector);
|
||||
}
|
||||
|
||||
void lv_obj_set_style_layout(struct _lv_obj_t * obj, uint16_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_LAYOUT, v, selector);
|
||||
}
|
||||
|
||||
void lv_obj_set_style_base_dir(struct _lv_obj_t * obj, lv_base_dir_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_BASE_DIR, v, selector);
|
||||
}
|
||||
|
||||
void lv_obj_set_style_bg_color(struct _lv_obj_t * obj, lv_color_t value, lv_style_selector_t selector)
|
||||
{
|
||||
lv_style_value_t v = {
|
||||
|
@ -319,6 +232,22 @@ void lv_obj_set_style_bg_grad_stop(struct _lv_obj_t * obj, lv_coord_t value, lv_
|
|||
lv_obj_set_local_style_prop(obj, LV_STYLE_BG_GRAD_STOP, v, selector);
|
||||
}
|
||||
|
||||
void lv_obj_set_style_bg_grad(struct _lv_obj_t * obj, const lv_grad_dsc_t * value, lv_style_selector_t selector)
|
||||
{
|
||||
lv_style_value_t v = {
|
||||
.ptr = value
|
||||
};
|
||||
lv_obj_set_local_style_prop(obj, LV_STYLE_BG_GRAD, v, selector);
|
||||
}
|
||||
|
||||
void lv_obj_set_style_bg_dither_mode(struct _lv_obj_t * obj, lv_dither_mode_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_BG_DITHER_MODE, v, selector);
|
||||
}
|
||||
|
||||
void lv_obj_set_style_bg_img_src(struct _lv_obj_t * obj, const void * value, lv_style_selector_t selector)
|
||||
{
|
||||
lv_style_value_t v = {
|
||||
|
@ -415,102 +344,6 @@ void lv_obj_set_style_border_post(struct _lv_obj_t * obj, bool value, lv_style_s
|
|||
lv_obj_set_local_style_prop(obj, LV_STYLE_BORDER_POST, v, selector);
|
||||
}
|
||||
|
||||
void lv_obj_set_style_text_color(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, 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 = {
|
||||
.num = (int32_t)value
|
||||
};
|
||||
lv_obj_set_local_style_prop(obj, LV_STYLE_TEXT_OPA, v, selector);
|
||||
}
|
||||
|
||||
void lv_obj_set_style_text_font(struct _lv_obj_t * obj, const lv_font_t * value, lv_style_selector_t selector)
|
||||
{
|
||||
lv_style_value_t v = {
|
||||
.ptr = value
|
||||
};
|
||||
lv_obj_set_local_style_prop(obj, LV_STYLE_TEXT_FONT, v, selector);
|
||||
}
|
||||
|
||||
void lv_obj_set_style_text_letter_space(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_TEXT_LETTER_SPACE, v, selector);
|
||||
}
|
||||
|
||||
void lv_obj_set_style_text_line_space(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_TEXT_LINE_SPACE, v, selector);
|
||||
}
|
||||
|
||||
void lv_obj_set_style_text_decor(struct _lv_obj_t * obj, lv_text_decor_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_TEXT_DECOR, v, selector);
|
||||
}
|
||||
|
||||
void lv_obj_set_style_text_align(struct _lv_obj_t * obj, lv_text_align_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_TEXT_ALIGN, v, selector);
|
||||
}
|
||||
|
||||
void lv_obj_set_style_img_opa(struct _lv_obj_t * obj, lv_opa_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_IMG_OPA, v, selector);
|
||||
}
|
||||
|
||||
void lv_obj_set_style_img_recolor(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, 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 = {
|
||||
.num = (int32_t)value
|
||||
};
|
||||
lv_obj_set_local_style_prop(obj, LV_STYLE_IMG_RECOLOR_OPA, v, selector);
|
||||
}
|
||||
|
||||
void lv_obj_set_style_outline_width(struct _lv_obj_t * obj, lv_coord_t value, lv_style_selector_t selector)
|
||||
{
|
||||
lv_style_value_t v = {
|
||||
|
@ -607,6 +440,38 @@ void lv_obj_set_style_shadow_opa(struct _lv_obj_t * obj, lv_opa_t value, lv_styl
|
|||
lv_obj_set_local_style_prop(obj, LV_STYLE_SHADOW_OPA, v, selector);
|
||||
}
|
||||
|
||||
void lv_obj_set_style_img_opa(struct _lv_obj_t * obj, lv_opa_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_IMG_OPA, v, selector);
|
||||
}
|
||||
|
||||
void lv_obj_set_style_img_recolor(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, 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 = {
|
||||
.num = (int32_t)value
|
||||
};
|
||||
lv_obj_set_local_style_prop(obj, LV_STYLE_IMG_RECOLOR_OPA, v, selector);
|
||||
}
|
||||
|
||||
void lv_obj_set_style_line_width(struct _lv_obj_t * obj, lv_coord_t value, lv_style_selector_t selector)
|
||||
{
|
||||
lv_style_value_t v = {
|
||||
|
@ -711,3 +576,156 @@ void lv_obj_set_style_arc_img_src(struct _lv_obj_t * obj, const void * value, lv
|
|||
lv_obj_set_local_style_prop(obj, LV_STYLE_ARC_IMG_SRC, v, selector);
|
||||
}
|
||||
|
||||
void lv_obj_set_style_text_color(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, 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 = {
|
||||
.num = (int32_t)value
|
||||
};
|
||||
lv_obj_set_local_style_prop(obj, LV_STYLE_TEXT_OPA, v, selector);
|
||||
}
|
||||
|
||||
void lv_obj_set_style_text_font(struct _lv_obj_t * obj, const lv_font_t * value, lv_style_selector_t selector)
|
||||
{
|
||||
lv_style_value_t v = {
|
||||
.ptr = value
|
||||
};
|
||||
lv_obj_set_local_style_prop(obj, LV_STYLE_TEXT_FONT, v, selector);
|
||||
}
|
||||
|
||||
void lv_obj_set_style_text_letter_space(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_TEXT_LETTER_SPACE, v, selector);
|
||||
}
|
||||
|
||||
void lv_obj_set_style_text_line_space(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_TEXT_LINE_SPACE, v, selector);
|
||||
}
|
||||
|
||||
void lv_obj_set_style_text_decor(struct _lv_obj_t * obj, lv_text_decor_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_TEXT_DECOR, v, selector);
|
||||
}
|
||||
|
||||
void lv_obj_set_style_text_align(struct _lv_obj_t * obj, lv_text_align_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_TEXT_ALIGN, v, selector);
|
||||
}
|
||||
|
||||
void lv_obj_set_style_radius(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_RADIUS, v, selector);
|
||||
}
|
||||
|
||||
void lv_obj_set_style_clip_corner(struct _lv_obj_t * obj, bool value, lv_style_selector_t selector)
|
||||
{
|
||||
lv_style_value_t v = {
|
||||
.num = (int32_t)value
|
||||
};
|
||||
lv_obj_set_local_style_prop(obj, LV_STYLE_CLIP_CORNER, v, selector);
|
||||
}
|
||||
|
||||
void lv_obj_set_style_opa(struct _lv_obj_t * obj, lv_opa_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_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)
|
||||
{
|
||||
lv_style_value_t v = {
|
||||
.ptr = value
|
||||
};
|
||||
lv_obj_set_local_style_prop(obj, LV_STYLE_COLOR_FILTER_DSC, v, selector);
|
||||
}
|
||||
|
||||
void lv_obj_set_style_color_filter_opa(struct _lv_obj_t * obj, lv_opa_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_COLOR_FILTER_OPA, 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 = {
|
||||
.num = (int32_t)value
|
||||
};
|
||||
lv_obj_set_local_style_prop(obj, LV_STYLE_ANIM_TIME, v, selector);
|
||||
}
|
||||
|
||||
void lv_obj_set_style_anim_speed(struct _lv_obj_t * obj, uint32_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_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)
|
||||
{
|
||||
lv_style_value_t v = {
|
||||
.ptr = value
|
||||
};
|
||||
lv_obj_set_local_style_prop(obj, LV_STYLE_TRANSITION, v, selector);
|
||||
}
|
||||
|
||||
void lv_obj_set_style_blend_mode(struct _lv_obj_t * obj, lv_blend_mode_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_BLEND_MODE, v, selector);
|
||||
}
|
||||
|
||||
void lv_obj_set_style_layout(struct _lv_obj_t * obj, uint16_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_LAYOUT, v, selector);
|
||||
}
|
||||
|
||||
void lv_obj_set_style_base_dir(struct _lv_obj_t * obj, lv_base_dir_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_BASE_DIR, v, selector);
|
||||
}
|
||||
|
|
|
@ -124,72 +124,6 @@ static inline lv_coord_t lv_obj_get_style_pad_column(const struct _lv_obj_t * ob
|
|||
return (lv_coord_t)v.num;
|
||||
}
|
||||
|
||||
static inline lv_coord_t lv_obj_get_style_radius(const struct _lv_obj_t * obj, uint32_t part)
|
||||
{
|
||||
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_RADIUS);
|
||||
return (lv_coord_t)v.num;
|
||||
}
|
||||
|
||||
static inline bool lv_obj_get_style_clip_corner(const struct _lv_obj_t * obj, uint32_t part)
|
||||
{
|
||||
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_CLIP_CORNER);
|
||||
return (bool)v.num;
|
||||
}
|
||||
|
||||
static inline lv_opa_t lv_obj_get_style_opa(const struct _lv_obj_t * obj, uint32_t part)
|
||||
{
|
||||
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_OPA);
|
||||
return (lv_opa_t)v.num;
|
||||
}
|
||||
|
||||
static inline 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;
|
||||
}
|
||||
|
||||
static inline lv_opa_t lv_obj_get_style_color_filter_opa(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_OPA);
|
||||
return (lv_opa_t)v.num;
|
||||
}
|
||||
|
||||
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);
|
||||
return (uint32_t)v.num;
|
||||
}
|
||||
|
||||
static inline uint32_t lv_obj_get_style_anim_speed(const struct _lv_obj_t * obj, uint32_t part)
|
||||
{
|
||||
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_ANIM_SPEED);
|
||||
return (uint32_t)v.num;
|
||||
}
|
||||
|
||||
static inline const lv_style_transition_dsc_t * lv_obj_get_style_transition(const struct _lv_obj_t * obj, uint32_t part)
|
||||
{
|
||||
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_TRANSITION);
|
||||
return (const lv_style_transition_dsc_t *)v.ptr;
|
||||
}
|
||||
|
||||
static inline lv_blend_mode_t lv_obj_get_style_blend_mode(const struct _lv_obj_t * obj, uint32_t part)
|
||||
{
|
||||
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_BLEND_MODE);
|
||||
return (lv_blend_mode_t)v.num;
|
||||
}
|
||||
|
||||
static inline uint16_t lv_obj_get_style_layout(const struct _lv_obj_t * obj, uint32_t part)
|
||||
{
|
||||
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_LAYOUT);
|
||||
return (uint16_t)v.num;
|
||||
}
|
||||
|
||||
static inline lv_base_dir_t lv_obj_get_style_base_dir(const struct _lv_obj_t * obj, uint32_t part)
|
||||
{
|
||||
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_BASE_DIR);
|
||||
return (lv_base_dir_t)v.num;
|
||||
}
|
||||
|
||||
static inline lv_color_t lv_obj_get_style_bg_color(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);
|
||||
|
@ -238,6 +172,18 @@ static inline lv_coord_t lv_obj_get_style_bg_grad_stop(const struct _lv_obj_t *
|
|||
return (lv_coord_t)v.num;
|
||||
}
|
||||
|
||||
static inline const lv_grad_dsc_t * lv_obj_get_style_bg_grad(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);
|
||||
return (const lv_grad_dsc_t *)v.ptr;
|
||||
}
|
||||
|
||||
static inline lv_dither_mode_t lv_obj_get_style_bg_dither_mode(const struct _lv_obj_t * obj, uint32_t part)
|
||||
{
|
||||
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_BG_DITHER_MODE);
|
||||
return (lv_dither_mode_t)v.num;
|
||||
}
|
||||
|
||||
static inline const void * lv_obj_get_style_bg_img_src(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_SRC);
|
||||
|
@ -310,78 +256,6 @@ static inline bool lv_obj_get_style_border_post(const struct _lv_obj_t * obj, ui
|
|||
return (bool)v.num;
|
||||
}
|
||||
|
||||
static inline lv_color_t lv_obj_get_style_text_color(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);
|
||||
return v.color;
|
||||
}
|
||||
|
||||
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);
|
||||
return v.color;
|
||||
}
|
||||
|
||||
static inline lv_opa_t lv_obj_get_style_text_opa(const struct _lv_obj_t * obj, uint32_t part)
|
||||
{
|
||||
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_TEXT_OPA);
|
||||
return (lv_opa_t)v.num;
|
||||
}
|
||||
|
||||
static inline const lv_font_t * lv_obj_get_style_text_font(const struct _lv_obj_t * obj, uint32_t part)
|
||||
{
|
||||
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_TEXT_FONT);
|
||||
return (const lv_font_t *)v.ptr;
|
||||
}
|
||||
|
||||
static inline lv_coord_t lv_obj_get_style_text_letter_space(const struct _lv_obj_t * obj, uint32_t part)
|
||||
{
|
||||
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_TEXT_LETTER_SPACE);
|
||||
return (lv_coord_t)v.num;
|
||||
}
|
||||
|
||||
static inline lv_coord_t lv_obj_get_style_text_line_space(const struct _lv_obj_t * obj, uint32_t part)
|
||||
{
|
||||
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_TEXT_LINE_SPACE);
|
||||
return (lv_coord_t)v.num;
|
||||
}
|
||||
|
||||
static inline lv_text_decor_t lv_obj_get_style_text_decor(const struct _lv_obj_t * obj, uint32_t part)
|
||||
{
|
||||
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_TEXT_DECOR);
|
||||
return (lv_text_decor_t)v.num;
|
||||
}
|
||||
|
||||
static inline lv_text_align_t lv_obj_get_style_text_align(const struct _lv_obj_t * obj, uint32_t part)
|
||||
{
|
||||
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_TEXT_ALIGN);
|
||||
return (lv_text_align_t)v.num;
|
||||
}
|
||||
|
||||
static inline lv_opa_t lv_obj_get_style_img_opa(const struct _lv_obj_t * obj, uint32_t part)
|
||||
{
|
||||
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_IMG_OPA);
|
||||
return (lv_opa_t)v.num;
|
||||
}
|
||||
|
||||
static inline lv_color_t lv_obj_get_style_img_recolor(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);
|
||||
return v.color;
|
||||
}
|
||||
|
||||
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);
|
||||
return v.color;
|
||||
}
|
||||
|
||||
static inline lv_opa_t lv_obj_get_style_img_recolor_opa(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_OPA);
|
||||
return (lv_opa_t)v.num;
|
||||
}
|
||||
|
||||
static inline lv_coord_t lv_obj_get_style_outline_width(const struct _lv_obj_t * obj, uint32_t part)
|
||||
{
|
||||
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_OUTLINE_WIDTH);
|
||||
|
@ -454,6 +328,30 @@ static inline lv_opa_t lv_obj_get_style_shadow_opa(const struct _lv_obj_t * obj,
|
|||
return (lv_opa_t)v.num;
|
||||
}
|
||||
|
||||
static inline lv_opa_t lv_obj_get_style_img_opa(const struct _lv_obj_t * obj, uint32_t part)
|
||||
{
|
||||
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_IMG_OPA);
|
||||
return (lv_opa_t)v.num;
|
||||
}
|
||||
|
||||
static inline lv_color_t lv_obj_get_style_img_recolor(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);
|
||||
return v.color;
|
||||
}
|
||||
|
||||
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);
|
||||
return v.color;
|
||||
}
|
||||
|
||||
static inline lv_opa_t lv_obj_get_style_img_recolor_opa(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_OPA);
|
||||
return (lv_opa_t)v.num;
|
||||
}
|
||||
|
||||
static inline lv_coord_t lv_obj_get_style_line_width(const struct _lv_obj_t * obj, uint32_t part)
|
||||
{
|
||||
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_LINE_WIDTH);
|
||||
|
@ -532,6 +430,121 @@ static inline const void * lv_obj_get_style_arc_img_src(const struct _lv_obj_t *
|
|||
return (const void *)v.ptr;
|
||||
}
|
||||
|
||||
static inline lv_color_t lv_obj_get_style_text_color(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);
|
||||
return v.color;
|
||||
}
|
||||
|
||||
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);
|
||||
return v.color;
|
||||
}
|
||||
|
||||
static inline lv_opa_t lv_obj_get_style_text_opa(const struct _lv_obj_t * obj, uint32_t part)
|
||||
{
|
||||
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_TEXT_OPA);
|
||||
return (lv_opa_t)v.num;
|
||||
}
|
||||
|
||||
static inline const lv_font_t * lv_obj_get_style_text_font(const struct _lv_obj_t * obj, uint32_t part)
|
||||
{
|
||||
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_TEXT_FONT);
|
||||
return (const lv_font_t *)v.ptr;
|
||||
}
|
||||
|
||||
static inline lv_coord_t lv_obj_get_style_text_letter_space(const struct _lv_obj_t * obj, uint32_t part)
|
||||
{
|
||||
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_TEXT_LETTER_SPACE);
|
||||
return (lv_coord_t)v.num;
|
||||
}
|
||||
|
||||
static inline lv_coord_t lv_obj_get_style_text_line_space(const struct _lv_obj_t * obj, uint32_t part)
|
||||
{
|
||||
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_TEXT_LINE_SPACE);
|
||||
return (lv_coord_t)v.num;
|
||||
}
|
||||
|
||||
static inline lv_text_decor_t lv_obj_get_style_text_decor(const struct _lv_obj_t * obj, uint32_t part)
|
||||
{
|
||||
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_TEXT_DECOR);
|
||||
return (lv_text_decor_t)v.num;
|
||||
}
|
||||
|
||||
static inline lv_text_align_t lv_obj_get_style_text_align(const struct _lv_obj_t * obj, uint32_t part)
|
||||
{
|
||||
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_TEXT_ALIGN);
|
||||
return (lv_text_align_t)v.num;
|
||||
}
|
||||
|
||||
static inline lv_coord_t lv_obj_get_style_radius(const struct _lv_obj_t * obj, uint32_t part)
|
||||
{
|
||||
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_RADIUS);
|
||||
return (lv_coord_t)v.num;
|
||||
}
|
||||
|
||||
static inline bool lv_obj_get_style_clip_corner(const struct _lv_obj_t * obj, uint32_t part)
|
||||
{
|
||||
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_CLIP_CORNER);
|
||||
return (bool)v.num;
|
||||
}
|
||||
|
||||
static inline lv_opa_t lv_obj_get_style_opa(const struct _lv_obj_t * obj, uint32_t part)
|
||||
{
|
||||
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_OPA);
|
||||
return (lv_opa_t)v.num;
|
||||
}
|
||||
|
||||
static inline 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;
|
||||
}
|
||||
|
||||
static inline lv_opa_t lv_obj_get_style_color_filter_opa(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_OPA);
|
||||
return (lv_opa_t)v.num;
|
||||
}
|
||||
|
||||
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);
|
||||
return (uint32_t)v.num;
|
||||
}
|
||||
|
||||
static inline uint32_t lv_obj_get_style_anim_speed(const struct _lv_obj_t * obj, uint32_t part)
|
||||
{
|
||||
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_ANIM_SPEED);
|
||||
return (uint32_t)v.num;
|
||||
}
|
||||
|
||||
static inline const lv_style_transition_dsc_t * lv_obj_get_style_transition(const struct _lv_obj_t * obj, uint32_t part)
|
||||
{
|
||||
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_TRANSITION);
|
||||
return (const lv_style_transition_dsc_t *)v.ptr;
|
||||
}
|
||||
|
||||
static inline lv_blend_mode_t lv_obj_get_style_blend_mode(const struct _lv_obj_t * obj, uint32_t part)
|
||||
{
|
||||
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_BLEND_MODE);
|
||||
return (lv_blend_mode_t)v.num;
|
||||
}
|
||||
|
||||
static inline uint16_t lv_obj_get_style_layout(const struct _lv_obj_t * obj, uint32_t part)
|
||||
{
|
||||
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_LAYOUT);
|
||||
return (uint16_t)v.num;
|
||||
}
|
||||
|
||||
static inline lv_base_dir_t lv_obj_get_style_base_dir(const struct _lv_obj_t * obj, uint32_t part)
|
||||
{
|
||||
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_BASE_DIR);
|
||||
return (lv_base_dir_t)v.num;
|
||||
}
|
||||
|
||||
void lv_obj_set_style_width(struct _lv_obj_t * obj, lv_coord_t value, lv_style_selector_t selector);
|
||||
void lv_obj_set_style_min_width(struct _lv_obj_t * obj, lv_coord_t value, lv_style_selector_t selector);
|
||||
void lv_obj_set_style_max_width(struct _lv_obj_t * obj, lv_coord_t value, lv_style_selector_t selector);
|
||||
|
@ -553,17 +566,6 @@ void lv_obj_set_style_pad_left(struct _lv_obj_t * obj, lv_coord_t value, lv_styl
|
|||
void lv_obj_set_style_pad_right(struct _lv_obj_t * obj, lv_coord_t value, lv_style_selector_t selector);
|
||||
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_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_opa(struct _lv_obj_t * obj, lv_opa_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_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);
|
||||
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);
|
||||
|
@ -572,6 +574,8 @@ void lv_obj_set_style_bg_grad_color_filtered(struct _lv_obj_t * obj, lv_color_t
|
|||
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);
|
||||
void lv_obj_set_style_bg_grad(struct _lv_obj_t * obj, const lv_grad_dsc_t * value, lv_style_selector_t selector);
|
||||
void lv_obj_set_style_bg_dither_mode(struct _lv_obj_t * obj, lv_dither_mode_t value, lv_style_selector_t selector);
|
||||
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);
|
||||
|
@ -584,18 +588,6 @@ void lv_obj_set_style_border_opa(struct _lv_obj_t * obj, lv_opa_t value, lv_styl
|
|||
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_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);
|
||||
void lv_obj_set_style_text_line_space(struct _lv_obj_t * obj, lv_coord_t value, lv_style_selector_t selector);
|
||||
void lv_obj_set_style_text_decor(struct _lv_obj_t * obj, lv_text_decor_t value, lv_style_selector_t selector);
|
||||
void lv_obj_set_style_text_align(struct _lv_obj_t * obj, lv_text_align_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_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);
|
||||
|
@ -608,6 +600,10 @@ void lv_obj_set_style_shadow_spread(struct _lv_obj_t * obj, lv_coord_t value, lv
|
|||
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);
|
||||
|
@ -621,3 +617,24 @@ void lv_obj_set_style_arc_color(struct _lv_obj_t * obj, lv_color_t value, lv_sty
|
|||
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);
|
||||
void lv_obj_set_style_text_line_space(struct _lv_obj_t * obj, lv_coord_t value, lv_style_selector_t selector);
|
||||
void lv_obj_set_style_text_decor(struct _lv_obj_t * obj, lv_text_decor_t value, lv_style_selector_t selector);
|
||||
void lv_obj_set_style_text_align(struct _lv_obj_t * obj, lv_text_align_t value, lv_style_selector_t selector);
|
||||
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_opa(struct _lv_obj_t * obj, lv_opa_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_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);
|
||||
|
|
|
@ -172,6 +172,8 @@ void lv_obj_set_parent(lv_obj_t * obj, lv_obj_t * parent)
|
|||
obj->parent = parent;
|
||||
|
||||
/*Notify the original parent because one of its children is lost*/
|
||||
lv_obj_readjust_scroll(old_parent, LV_ANIM_OFF);
|
||||
lv_obj_scrollbar_invalidate(old_parent);
|
||||
lv_event_send(old_parent, LV_EVENT_CHILD_CHANGED, obj);
|
||||
lv_event_send(old_parent, LV_EVENT_CHILD_DELETED, NULL);
|
||||
|
||||
|
@ -188,6 +190,10 @@ void lv_obj_move_to_index(lv_obj_t * obj, int32_t index)
|
|||
{
|
||||
LV_ASSERT_OBJ(obj, MY_CLASS);
|
||||
|
||||
if(index < 0) {
|
||||
index = lv_obj_get_child_cnt(lv_obj_get_parent(obj)) + index;
|
||||
}
|
||||
|
||||
const int32_t old_index = lv_obj_get_index(obj);
|
||||
|
||||
lv_obj_t * parent = lv_obj_get_parent(obj);
|
||||
|
|
|
@ -97,8 +97,8 @@ void lv_obj_swap(struct _lv_obj_t * obj1, struct _lv_obj_t * obj2);
|
|||
* moves the object to the given index in its parent.
|
||||
* When used in listboxes, it can be used to sort the listbox items.
|
||||
* @param obj pointer to the object to be moved.
|
||||
* @param index new index in parent.
|
||||
* @note to move to the foreground: lv_obj_move_to_index(obj, 0)
|
||||
* @param index new index in parent. -1 to count from the back
|
||||
* @note to move to the background: lv_obj_move_to_index(obj, 0)
|
||||
* @note to move forward (up): lv_obj_move_to_index(obj, lv_obj_get_index(obj) - 1)
|
||||
*/
|
||||
void lv_obj_move_to_index(struct _lv_obj_t * obj, int32_t index);
|
||||
|
|
|
@ -29,6 +29,23 @@
|
|||
/**********************
|
||||
* TYPEDEFS
|
||||
**********************/
|
||||
typedef struct {
|
||||
uint32_t perf_last_time;
|
||||
uint32_t elaps_sum;
|
||||
uint32_t frame_cnt;
|
||||
uint32_t fps_sum_cnt;
|
||||
uint32_t fps_sum_all;
|
||||
#if LV_USE_LABEL
|
||||
lv_obj_t * perf_label;
|
||||
#endif
|
||||
} perf_monitor_t;
|
||||
|
||||
typedef struct {
|
||||
uint32_t mem_last_time;
|
||||
#if LV_USE_LABEL
|
||||
lv_obj_t * mem_label;
|
||||
#endif
|
||||
} mem_monitor_t;
|
||||
|
||||
/**********************
|
||||
* STATIC PROTOTYPES
|
||||
|
@ -36,21 +53,32 @@
|
|||
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(const lv_area_t * area_p);
|
||||
static void lv_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_obj_t * top_p, const lv_area_t * mask_p);
|
||||
static void lv_refr_obj(lv_obj_t * obj, const lv_area_t * mask_ori_p);
|
||||
static void draw_buf_flush(void);
|
||||
static void lv_refr_obj_and_children(lv_draw_ctx_t * draw_ctx, lv_obj_t * top_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);
|
||||
|
||||
#if LV_USE_PERF_MONITOR
|
||||
static void perf_monitor_init(perf_monitor_t * perf_monitor);
|
||||
#endif
|
||||
#if LV_USE_MEM_MONITOR
|
||||
static void mem_monitor_init(mem_monitor_t * mem_monitor);
|
||||
#endif
|
||||
|
||||
/**********************
|
||||
* STATIC VARIABLES
|
||||
**********************/
|
||||
static uint32_t px_num;
|
||||
static lv_disp_t * disp_refr; /*Display being refreshed*/
|
||||
|
||||
#if LV_USE_PERF_MONITOR
|
||||
static uint32_t fps_sum_cnt;
|
||||
static uint32_t fps_sum_all;
|
||||
static perf_monitor_t perf_monitor;
|
||||
#endif
|
||||
|
||||
#if LV_USE_MEM_MONITOR
|
||||
static mem_monitor_t mem_monitor;
|
||||
#endif
|
||||
|
||||
/**********************
|
||||
|
@ -71,33 +99,98 @@ static lv_disp_t * disp_refr; /*Display being refreshed*/
|
|||
*/
|
||||
void _lv_refr_init(void)
|
||||
{
|
||||
/*Nothing to do*/
|
||||
#if LV_USE_PERF_MONITOR
|
||||
perf_monitor_init(&perf_monitor);
|
||||
#endif
|
||||
#if LV_USE_MEM_MONITOR
|
||||
mem_monitor_init(&mem_monitor);
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
* Redraw the invalidated areas now.
|
||||
* Normally the redrawing is periodically executed in `lv_timer_handler` but a long blocking process
|
||||
* can prevent the call of `lv_timer_handler`. In this case if the GUI is updated in the process
|
||||
* (e.g. progress bar) this function can be called when the screen should be updated.
|
||||
* @param disp pointer to display to refresh. NULL to refresh all displays.
|
||||
*/
|
||||
void lv_refr_now(lv_disp_t * disp)
|
||||
{
|
||||
lv_anim_refr_now();
|
||||
|
||||
if(disp) {
|
||||
_lv_disp_refr_timer(disp->refr_timer);
|
||||
if(disp->refr_timer) _lv_disp_refr_timer(disp->refr_timer);
|
||||
}
|
||||
else {
|
||||
lv_disp_t * d;
|
||||
d = lv_disp_get_next(NULL);
|
||||
while(d) {
|
||||
_lv_disp_refr_timer(d->refr_timer);
|
||||
if(d->refr_timer) _lv_disp_refr_timer(d->refr_timer);
|
||||
d = lv_disp_get_next(d);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void lv_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;
|
||||
|
||||
const lv_area_t * clip_area_ori = draw_ctx->clip_area;
|
||||
lv_area_t clip_coords_for_obj;
|
||||
|
||||
/*Truncate the clip area to `obj size + ext size` area*/
|
||||
lv_area_t obj_coords_ext;
|
||||
lv_obj_get_coords(obj, &obj_coords_ext);
|
||||
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);
|
||||
|
||||
#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);
|
||||
#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;
|
||||
if(lv_obj_has_flag(obj, LV_OBJ_FLAG_OVERFLOW_VISIBLE)) {
|
||||
clip_coords_for_children = *clip_area_ori;
|
||||
}
|
||||
else {
|
||||
if(!_lv_area_intersect(&clip_coords_for_children, clip_area_ori, &obj->coords)) {
|
||||
refr_children = false;
|
||||
}
|
||||
}
|
||||
|
||||
if(refr_children) {
|
||||
draw_ctx->clip_area = &clip_coords_for_children;
|
||||
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];
|
||||
lv_refr_obj(draw_ctx, child);
|
||||
}
|
||||
}
|
||||
|
||||
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);
|
||||
|
||||
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)
|
||||
|
@ -131,7 +224,7 @@ void _lv_inv_area(lv_disp_t * disp, const lv_area_t * area_p)
|
|||
if(disp->driver->full_refresh) {
|
||||
disp->inv_areas[0] = scr_area;
|
||||
disp->inv_p = 1;
|
||||
lv_timer_resume(disp->refr_timer);
|
||||
if(disp->refr_timer) lv_timer_resume(disp->refr_timer);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -152,7 +245,7 @@ void _lv_inv_area(lv_disp_t * disp, const lv_area_t * area_p)
|
|||
lv_area_copy(&disp->inv_areas[disp->inv_p], &scr_area);
|
||||
}
|
||||
disp->inv_p++;
|
||||
lv_timer_resume(disp->refr_timer);
|
||||
if(disp->refr_timer) lv_timer_resume(disp->refr_timer);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -186,8 +279,8 @@ void _lv_disp_refr_timer(lv_timer_t * tmr)
|
|||
uint32_t start = lv_tick_get();
|
||||
volatile uint32_t elaps = 0;
|
||||
|
||||
if(tmr) {
|
||||
disp_refr = tmr->user_data;
|
||||
|
||||
#if LV_USE_PERF_MONITOR == 0 && LV_USE_MEM_MONITOR == 0
|
||||
/**
|
||||
* Ensure the timer does not run again automatically.
|
||||
|
@ -195,6 +288,10 @@ void _lv_disp_refr_timer(lv_timer_t * tmr)
|
|||
*/
|
||||
lv_timer_pause(tmr);
|
||||
#endif
|
||||
}
|
||||
else {
|
||||
disp_refr = lv_disp_get_default();
|
||||
}
|
||||
|
||||
/*Refresh the screen's layout if required*/
|
||||
lv_obj_update_layout(disp_refr->act_scr);
|
||||
|
@ -218,7 +315,10 @@ void _lv_disp_refr_timer(lv_timer_t * tmr)
|
|||
/*If refresh happened ...*/
|
||||
if(disp_refr->inv_p != 0) {
|
||||
if(disp_refr->driver->full_refresh) {
|
||||
draw_buf_flush();
|
||||
lv_area_t disp_area;
|
||||
lv_area_set(&disp_area, 0, 0, lv_disp_get_hor_res(disp_refr) - 1, lv_disp_get_ver_res(disp_refr) - 1);
|
||||
disp_refr->driver->draw_ctx->buf_area = &disp_area;
|
||||
draw_buf_flush(disp_refr);
|
||||
}
|
||||
|
||||
/*Clean up*/
|
||||
|
@ -241,7 +341,7 @@ void _lv_disp_refr_timer(lv_timer_t * tmr)
|
|||
#endif
|
||||
|
||||
#if LV_USE_PERF_MONITOR && LV_USE_LABEL
|
||||
static lv_obj_t * perf_label = NULL;
|
||||
lv_obj_t * perf_label = perf_monitor.perf_label;
|
||||
if(perf_label == NULL) {
|
||||
perf_label = lv_label_create(lv_layer_sys());
|
||||
lv_obj_set_style_bg_opa(perf_label, LV_OPA_50, 0);
|
||||
|
@ -254,38 +354,44 @@ void _lv_disp_refr_timer(lv_timer_t * tmr)
|
|||
lv_obj_set_style_text_align(perf_label, LV_TEXT_ALIGN_RIGHT, 0);
|
||||
lv_label_set_text(perf_label, "?");
|
||||
lv_obj_align(perf_label, LV_USE_PERF_MONITOR_POS, 0, 0);
|
||||
perf_monitor.perf_label = perf_label;
|
||||
}
|
||||
|
||||
static uint32_t perf_last_time = 0;
|
||||
static uint32_t elaps_sum = 0;
|
||||
static uint32_t frame_cnt = 0;
|
||||
if(lv_tick_elaps(perf_last_time) < 300) {
|
||||
if(lv_tick_elaps(perf_monitor.perf_last_time) < 300) {
|
||||
if(px_num > 5000) {
|
||||
elaps_sum += elaps;
|
||||
frame_cnt ++;
|
||||
perf_monitor.elaps_sum += elaps;
|
||||
perf_monitor.frame_cnt ++;
|
||||
}
|
||||
}
|
||||
else {
|
||||
perf_last_time = lv_tick_get();
|
||||
perf_monitor.perf_last_time = lv_tick_get();
|
||||
uint32_t fps_limit = 1000 / disp_refr->refr_timer->period;
|
||||
unsigned int fps;
|
||||
uint32_t fps;
|
||||
|
||||
if(elaps_sum == 0) elaps_sum = 1;
|
||||
if(frame_cnt == 0) fps = fps_limit;
|
||||
else fps = (1000 * frame_cnt) / elaps_sum;
|
||||
elaps_sum = 0;
|
||||
frame_cnt = 0;
|
||||
if(fps > fps_limit) fps = fps_limit;
|
||||
if(perf_monitor.elaps_sum == 0) {
|
||||
perf_monitor.elaps_sum = 1;
|
||||
}
|
||||
if(perf_monitor.frame_cnt == 0) {
|
||||
fps = fps_limit;
|
||||
}
|
||||
else {
|
||||
fps = (1000 * perf_monitor.frame_cnt) / perf_monitor.elaps_sum;
|
||||
}
|
||||
perf_monitor.elaps_sum = 0;
|
||||
perf_monitor.frame_cnt = 0;
|
||||
if(fps > fps_limit) {
|
||||
fps = fps_limit;
|
||||
}
|
||||
|
||||
fps_sum_all += fps;
|
||||
fps_sum_cnt ++;
|
||||
unsigned int cpu = 100 - lv_timer_get_idle();
|
||||
lv_label_set_text_fmt(perf_label, "%u FPS\n%u%% CPU", fps, cpu);
|
||||
perf_monitor.fps_sum_all += fps;
|
||||
perf_monitor.fps_sum_cnt ++;
|
||||
uint32_t cpu = 100 - lv_timer_get_idle();
|
||||
lv_label_set_text_fmt(perf_label, "%"LV_PRIu32" FPS\n%"LV_PRIu32"%% CPU", fps, cpu);
|
||||
}
|
||||
#endif
|
||||
|
||||
#if LV_USE_MEM_MONITOR && LV_MEM_CUSTOM == 0 && LV_USE_LABEL
|
||||
static lv_obj_t * mem_label = NULL;
|
||||
lv_obj_t * mem_label = mem_monitor.mem_label;
|
||||
if(mem_label == NULL) {
|
||||
mem_label = lv_label_create(lv_layer_sys());
|
||||
lv_obj_set_style_bg_opa(mem_label, LV_OPA_50, 0);
|
||||
|
@ -297,11 +403,11 @@ void _lv_disp_refr_timer(lv_timer_t * tmr)
|
|||
lv_obj_set_style_pad_right(mem_label, 3, 0);
|
||||
lv_label_set_text(mem_label, "?");
|
||||
lv_obj_align(mem_label, LV_USE_MEM_MONITOR_POS, 0, 0);
|
||||
mem_monitor.mem_label = mem_label;
|
||||
}
|
||||
|
||||
static uint32_t mem_last_time = 0;
|
||||
if(lv_tick_elaps(mem_last_time) > 300) {
|
||||
mem_last_time = lv_tick_get();
|
||||
if(lv_tick_elaps(mem_monitor.mem_last_time) > 300) {
|
||||
mem_monitor.mem_last_time = lv_tick_get();
|
||||
lv_mem_monitor_t mon;
|
||||
lv_mem_monitor(&mon);
|
||||
uint32_t used_size = mon.total_size - mon.free_size;;
|
||||
|
@ -317,12 +423,22 @@ void _lv_disp_refr_timer(lv_timer_t * tmr)
|
|||
}
|
||||
|
||||
#if LV_USE_PERF_MONITOR
|
||||
void lv_refr_reset_fps_counter(void)
|
||||
{
|
||||
perf_monitor.fps_sum_all = 0;
|
||||
perf_monitor.fps_sum_cnt = 0;
|
||||
}
|
||||
|
||||
uint32_t lv_refr_get_fps_avg(void)
|
||||
{
|
||||
return fps_sum_all / fps_sum_cnt;
|
||||
if(perf_monitor.fps_sum_cnt == 0) {
|
||||
return 0;
|
||||
}
|
||||
return perf_monitor.fps_sum_all / perf_monitor.fps_sum_cnt;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
/**********************
|
||||
* STATIC FUNCTIONS
|
||||
**********************/
|
||||
|
@ -405,104 +521,72 @@ static void lv_refr_areas(void)
|
|||
*/
|
||||
static void lv_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;
|
||||
|
||||
/*With full refresh just redraw directly into the buffer*/
|
||||
/*In direct mode draw directly on the absolute coordinates of the buffer*/
|
||||
if(disp_refr->driver->full_refresh || disp_refr->driver->direct_mode) {
|
||||
lv_area_t disp_area;
|
||||
lv_area_set(&disp_area, 0, 0, lv_disp_get_hor_res(disp_refr) - 1, lv_disp_get_ver_res(disp_refr) - 1);
|
||||
draw_ctx->buf_area = &disp_area;
|
||||
|
||||
if(disp_refr->driver->full_refresh) {
|
||||
lv_disp_draw_buf_t * draw_buf = lv_disp_get_draw_buf(disp_refr);
|
||||
draw_buf->area.x1 = 0;
|
||||
draw_buf->area.x2 = lv_disp_get_hor_res(disp_refr) - 1;
|
||||
draw_buf->area.y1 = 0;
|
||||
draw_buf->area.y2 = lv_disp_get_ver_res(disp_refr) - 1;
|
||||
disp_refr->driver->draw_buf->last_part = 1;
|
||||
lv_refr_area_part(area_p);
|
||||
draw_ctx->clip_area = &disp_area;
|
||||
lv_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);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
/*Normal refresh: draw the area in parts*/
|
||||
lv_disp_draw_buf_t * draw_buf = lv_disp_get_draw_buf(disp_refr);
|
||||
/*Calculate the max row num*/
|
||||
lv_coord_t w = lv_area_get_width(area_p);
|
||||
lv_coord_t h = lv_area_get_height(area_p);
|
||||
lv_coord_t y2 = area_p->y2 >= lv_disp_get_ver_res(disp_refr) ?
|
||||
lv_disp_get_ver_res(disp_refr) - 1 : area_p->y2;
|
||||
|
||||
int32_t max_row = (uint32_t)draw_buf->size / w;
|
||||
int32_t max_row = get_max_row(disp_refr, w, h);
|
||||
|
||||
if(max_row > h) max_row = h;
|
||||
|
||||
/*Round down the lines of draw_buf if rounding is added*/
|
||||
if(disp_refr->driver->rounder_cb) {
|
||||
lv_area_t tmp;
|
||||
tmp.x1 = 0;
|
||||
tmp.x2 = 0;
|
||||
tmp.y1 = 0;
|
||||
|
||||
lv_coord_t h_tmp = max_row;
|
||||
do {
|
||||
tmp.y2 = h_tmp - 1;
|
||||
disp_refr->driver->rounder_cb(disp_refr->driver, &tmp);
|
||||
|
||||
/*If this height fits into `max_row` then fine*/
|
||||
if(lv_area_get_height(&tmp) <= max_row) break;
|
||||
|
||||
/*Decrement the height of the area until it fits into `max_row` after rounding*/
|
||||
h_tmp--;
|
||||
} while(h_tmp > 0);
|
||||
|
||||
if(h_tmp <= 0) {
|
||||
LV_LOG_WARN("Can't set draw_buf height using the round function. (Wrong round_cb or to "
|
||||
"small draw_buf)");
|
||||
return;
|
||||
}
|
||||
else {
|
||||
max_row = tmp.y2 + 1;
|
||||
}
|
||||
}
|
||||
|
||||
/*In direct mode draw directly on the absolute coordinates of the buffer*/
|
||||
if(disp_refr->driver->direct_mode) {
|
||||
draw_buf->area.x1 = 0;
|
||||
draw_buf->area.x2 = lv_disp_get_hor_res(disp_refr) - 1;
|
||||
draw_buf->area.y1 = 0;
|
||||
draw_buf->area.y2 = lv_disp_get_ver_res(disp_refr) - 1;
|
||||
disp_refr->driver->draw_buf->last_part = disp_refr->driver->draw_buf->last_area;
|
||||
lv_refr_area_part(area_p);
|
||||
}
|
||||
/*Else assume the buffer starts at the given area*/
|
||||
else {
|
||||
/*Always use the full row*/
|
||||
lv_coord_t row;
|
||||
lv_coord_t row_last = 0;
|
||||
lv_area_t sub_area;
|
||||
for(row = area_p->y1; row + max_row - 1 <= y2; row += max_row) {
|
||||
/*Calc. the next y coordinates of draw_buf*/
|
||||
draw_buf->area.x1 = area_p->x1;
|
||||
draw_buf->area.x2 = area_p->x2;
|
||||
draw_buf->area.y1 = row;
|
||||
draw_buf->area.y2 = row + max_row - 1;
|
||||
if(draw_buf->area.y2 > y2) draw_buf->area.y2 = y2;
|
||||
row_last = draw_buf->area.y2;
|
||||
sub_area.x1 = area_p->x1;
|
||||
sub_area.x2 = area_p->x2;
|
||||
sub_area.y1 = row;
|
||||
sub_area.y2 = row + max_row - 1;
|
||||
draw_ctx->buf_area = &sub_area;
|
||||
draw_ctx->clip_area = &sub_area;
|
||||
draw_ctx->buf = disp_refr->driver->draw_buf->buf_act;
|
||||
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(area_p);
|
||||
lv_refr_area_part(draw_ctx);
|
||||
}
|
||||
|
||||
/*If the last y coordinates are not handled yet ...*/
|
||||
if(y2 != row_last) {
|
||||
/*Calc. the next y coordinates of draw_buf*/
|
||||
draw_buf->area.x1 = area_p->x1;
|
||||
draw_buf->area.x2 = area_p->x2;
|
||||
draw_buf->area.y1 = row;
|
||||
draw_buf->area.y2 = y2;
|
||||
|
||||
sub_area.x1 = area_p->x1;
|
||||
sub_area.x2 = area_p->x2;
|
||||
sub_area.y1 = row;
|
||||
sub_area.y2 = y2;
|
||||
draw_ctx->buf_area = &sub_area;
|
||||
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(area_p);
|
||||
}
|
||||
lv_refr_area_part(draw_ctx);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Refresh a part of an area which is on the actual Virtual Display Buffer
|
||||
* @param area_p pointer to an area to refresh
|
||||
*/
|
||||
static void lv_refr_area_part(const lv_area_t * area_p)
|
||||
static void lv_refr_area_part(lv_draw_ctx_t * draw_ctx)
|
||||
{
|
||||
lv_disp_draw_buf_t * draw_buf = lv_disp_get_draw_buf(disp_refr);
|
||||
|
||||
|
@ -517,32 +601,34 @@ static void lv_refr_area_part(const lv_area_t * area_p)
|
|||
lv_obj_t * top_act_scr = NULL;
|
||||
lv_obj_t * top_prev_scr = NULL;
|
||||
|
||||
/*Get the new mask from the original area and the act. draw_buf
|
||||
It will be a part of 'area_p'*/
|
||||
lv_area_t start_mask;
|
||||
_lv_area_intersect(&start_mask, area_p, &draw_buf->area);
|
||||
|
||||
/*Get the most top object which is not covered by others*/
|
||||
top_act_scr = lv_refr_get_top_obj(&start_mask, lv_disp_get_scr_act(disp_refr));
|
||||
top_act_scr = lv_refr_get_top_obj(draw_ctx->buf_area, lv_disp_get_scr_act(disp_refr));
|
||||
if(disp_refr->prev_scr) {
|
||||
top_prev_scr = lv_refr_get_top_obj(&start_mask, disp_refr->prev_scr);
|
||||
top_prev_scr = lv_refr_get_top_obj(draw_ctx->buf_area, disp_refr->prev_scr);
|
||||
}
|
||||
|
||||
/*Draw a display background if there is no top object*/
|
||||
if(top_act_scr == NULL && top_prev_scr == NULL) {
|
||||
if(disp_refr->bg_fn) {
|
||||
disp_refr->bg_fn(&start_mask);
|
||||
} else if(disp_refr->bg_img) {
|
||||
lv_draw_img_dsc_t dsc;
|
||||
lv_draw_img_dsc_init(&dsc);
|
||||
dsc.opa = disp_refr->bg_opa;
|
||||
if(draw_ctx->draw_bg) {
|
||||
lv_draw_rect_dsc_t dsc;
|
||||
lv_draw_rect_dsc_init(&dsc);
|
||||
dsc.bg_img_src = disp_refr->bg_img;
|
||||
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);
|
||||
}
|
||||
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);
|
||||
if(res == LV_RES_OK) {
|
||||
lv_area_t a;
|
||||
lv_area_set(&a, 0, 0, header.w - 1, header.h - 1);
|
||||
lv_draw_img(&a, &start_mask, disp_refr->bg_img, &dsc);
|
||||
lv_draw_img_dsc_t dsc;
|
||||
lv_draw_img_dsc_init(&dsc);
|
||||
dsc.opa = disp_refr->bg_opa;
|
||||
lv_draw_img(draw_ctx, &dsc, &a, disp_refr->bg_img);
|
||||
}
|
||||
else {
|
||||
LV_LOG_WARN("Can't draw the background image");
|
||||
|
@ -553,35 +639,26 @@ static void lv_refr_area_part(const lv_area_t * area_p)
|
|||
lv_draw_rect_dsc_init(&dsc);
|
||||
dsc.bg_color = disp_refr->bg_color;
|
||||
dsc.bg_opa = disp_refr->bg_opa;
|
||||
lv_draw_rect(&start_mask, &start_mask, &dsc);
|
||||
|
||||
lv_draw_rect(draw_ctx, &dsc, draw_ctx->buf_area);
|
||||
}
|
||||
}
|
||||
/*Refresh the previous screen if any*/
|
||||
if(disp_refr->prev_scr) {
|
||||
/*Get the most top object which is not covered by others*/
|
||||
if(top_prev_scr == NULL) {
|
||||
top_prev_scr = disp_refr->prev_scr;
|
||||
}
|
||||
/*Do the refreshing from the top object*/
|
||||
lv_refr_obj_and_children(top_prev_scr, &start_mask);
|
||||
|
||||
if(top_prev_scr == NULL) top_prev_scr = disp_refr->prev_scr;
|
||||
lv_refr_obj_and_children(draw_ctx, top_prev_scr);
|
||||
}
|
||||
|
||||
if(top_act_scr == NULL) {
|
||||
top_act_scr = disp_refr->act_scr;
|
||||
}
|
||||
/*Do the refreshing from the top object*/
|
||||
lv_refr_obj_and_children(top_act_scr, &start_mask);
|
||||
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(lv_disp_get_layer_top(disp_refr), &start_mask);
|
||||
lv_refr_obj_and_children(lv_disp_get_layer_sys(disp_refr), &start_mask);
|
||||
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));
|
||||
|
||||
/*In true double buffered mode flush only once when all areas were rendered.
|
||||
*In normal mode flush after every area*/
|
||||
if(disp_refr->driver->full_refresh == false) {
|
||||
draw_buf_flush();
|
||||
draw_buf_flush(disp_refr);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -595,7 +672,7 @@ 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 this object is fully cover the draw area check the children too*/
|
||||
/*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;
|
||||
|
@ -631,127 +708,88 @@ 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_obj_t * top_p, const lv_area_t * mask_p)
|
||||
static void lv_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.
|
||||
*In this case use the screen directly*/
|
||||
if(top_p == NULL) top_p = lv_disp_get_scr_act(disp_refr);
|
||||
if(top_p == NULL) return; /*Shouldn't happen*/
|
||||
if(top_obj == NULL) top_obj = lv_disp_get_scr_act(disp_refr);
|
||||
if(top_obj == NULL) return; /*Shouldn't happen*/
|
||||
|
||||
/*Refresh the top object and its children*/
|
||||
lv_refr_obj(top_p, mask_p);
|
||||
lv_refr_obj(draw_ctx, top_obj);
|
||||
|
||||
/*Draw the 'younger' sibling objects because they can be on top_obj*/
|
||||
lv_obj_t * par;
|
||||
lv_obj_t * border_p = top_p;
|
||||
lv_obj_t * parent;
|
||||
lv_obj_t * border_p = top_obj;
|
||||
|
||||
par = lv_obj_get_parent(top_p);
|
||||
parent = lv_obj_get_parent(top_obj);
|
||||
|
||||
/*Do until not reach the screen*/
|
||||
while(par != NULL) {
|
||||
while(parent != NULL) {
|
||||
bool go = false;
|
||||
uint32_t i;
|
||||
uint32_t child_cnt = lv_obj_get_child_cnt(par);
|
||||
uint32_t child_cnt = lv_obj_get_child_cnt(parent);
|
||||
for(i = 0; i < child_cnt; i++) {
|
||||
lv_obj_t * child = par->spec_attr->children[i];
|
||||
lv_obj_t * child = parent->spec_attr->children[i];
|
||||
if(!go) {
|
||||
if(child == border_p) go = true;
|
||||
}
|
||||
else {
|
||||
/*Refresh the objects*/
|
||||
lv_refr_obj(child, mask_p);
|
||||
lv_refr_obj(draw_ctx, child);
|
||||
}
|
||||
}
|
||||
|
||||
/*Call the post draw draw function of the parents of the to object*/
|
||||
lv_event_send(par, LV_EVENT_DRAW_POST_BEGIN, (void *)mask_p);
|
||||
lv_event_send(par, LV_EVENT_DRAW_POST, (void *)mask_p);
|
||||
lv_event_send(par, LV_EVENT_DRAW_POST_END, (void *)mask_p);
|
||||
lv_event_send(parent, LV_EVENT_DRAW_POST_BEGIN, (void *)draw_ctx);
|
||||
lv_event_send(parent, LV_EVENT_DRAW_POST, (void *)draw_ctx);
|
||||
lv_event_send(parent, LV_EVENT_DRAW_POST_END, (void *)draw_ctx);
|
||||
|
||||
/*The new border will be the last parents,
|
||||
*so the 'younger' brothers of parent will be refreshed*/
|
||||
border_p = par;
|
||||
border_p = parent;
|
||||
/*Go a level deeper*/
|
||||
par = lv_obj_get_parent(par);
|
||||
parent = lv_obj_get_parent(parent);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Refresh an object an all of its children. (Called recursively)
|
||||
* @param obj pointer to an object to refresh
|
||||
* @param mask_ori_p pointer to an area, the objects will be drawn only here
|
||||
*/
|
||||
static void lv_refr_obj(lv_obj_t * obj, const lv_area_t * mask_ori_p)
|
||||
static uint32_t get_max_row(lv_disp_t * disp, lv_coord_t area_w, lv_coord_t area_h)
|
||||
{
|
||||
/*Do not refresh hidden objects*/
|
||||
if(lv_obj_has_flag(obj, LV_OBJ_FLAG_HIDDEN)) return;
|
||||
int32_t max_row = (uint32_t)disp->driver->draw_buf->size / area_w;
|
||||
|
||||
bool union_ok; /*Store the return value of area_union*/
|
||||
/*Truncate the original mask to the coordinates of the parent
|
||||
*because the parent and its children are visible only here*/
|
||||
lv_area_t obj_mask;
|
||||
lv_area_t obj_ext_mask;
|
||||
lv_area_t obj_area;
|
||||
lv_coord_t ext_size = _lv_obj_get_ext_draw_size(obj);
|
||||
lv_obj_get_coords(obj, &obj_area);
|
||||
obj_area.x1 -= ext_size;
|
||||
obj_area.y1 -= ext_size;
|
||||
obj_area.x2 += ext_size;
|
||||
obj_area.y2 += ext_size;
|
||||
union_ok = _lv_area_intersect(&obj_ext_mask, mask_ori_p, &obj_area);
|
||||
if(max_row > area_h) max_row = area_h;
|
||||
|
||||
/*Draw the parent and its children only if they ore on 'mask_parent'*/
|
||||
if(union_ok != false) {
|
||||
/*Redraw the object*/
|
||||
lv_event_send(obj, LV_EVENT_DRAW_MAIN_BEGIN, &obj_ext_mask);
|
||||
lv_event_send(obj, LV_EVENT_DRAW_MAIN, &obj_ext_mask);
|
||||
lv_event_send(obj, LV_EVENT_DRAW_MAIN_END, &obj_ext_mask);
|
||||
/*Round down the lines of draw_buf if rounding is added*/
|
||||
if(disp_refr->driver->rounder_cb) {
|
||||
lv_area_t tmp;
|
||||
tmp.x1 = 0;
|
||||
tmp.x2 = 0;
|
||||
tmp.y1 = 0;
|
||||
|
||||
#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(&obj_ext_mask, &obj_ext_mask, &draw_dsc);
|
||||
#endif
|
||||
/*Create a new 'obj_mask' without 'ext_size' because the children can't be visible there*/
|
||||
lv_obj_get_coords(obj, &obj_area);
|
||||
union_ok = _lv_area_intersect(&obj_mask, mask_ori_p, &obj_area);
|
||||
if(union_ok != false) {
|
||||
lv_area_t mask_child; /*Mask from obj and its child*/
|
||||
lv_area_t child_area;
|
||||
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];
|
||||
lv_obj_get_coords(child, &child_area);
|
||||
ext_size = _lv_obj_get_ext_draw_size(child);
|
||||
child_area.x1 -= ext_size;
|
||||
child_area.y1 -= ext_size;
|
||||
child_area.x2 += ext_size;
|
||||
child_area.y2 += ext_size;
|
||||
/*Get the union (common parts) of original mask (from obj)
|
||||
*and its child*/
|
||||
union_ok = _lv_area_intersect(&mask_child, &obj_mask, &child_area);
|
||||
lv_coord_t h_tmp = max_row;
|
||||
do {
|
||||
tmp.y2 = h_tmp - 1;
|
||||
disp_refr->driver->rounder_cb(disp_refr->driver, &tmp);
|
||||
|
||||
/*If the parent and the child has common area then refresh the child*/
|
||||
if(union_ok) {
|
||||
/*Refresh the next children*/
|
||||
lv_refr_obj(child, &mask_child);
|
||||
}
|
||||
/*If this height fits into `max_row` then fine*/
|
||||
if(lv_area_get_height(&tmp) <= max_row) break;
|
||||
|
||||
/*Decrement the height of the area until it fits into `max_row` after rounding*/
|
||||
h_tmp--;
|
||||
} while(h_tmp > 0);
|
||||
|
||||
if(h_tmp <= 0) {
|
||||
LV_LOG_WARN("Can't set draw_buf height using the round function. (Wrong round_cb or to "
|
||||
"small draw_buf)");
|
||||
return 0;
|
||||
}
|
||||
else {
|
||||
max_row = tmp.y2 + 1;
|
||||
}
|
||||
}
|
||||
|
||||
/*If all the children are redrawn make 'post draw' draw*/
|
||||
lv_event_send(obj, LV_EVENT_DRAW_POST_BEGIN, &obj_ext_mask);
|
||||
lv_event_send(obj, LV_EVENT_DRAW_POST, &obj_ext_mask);
|
||||
lv_event_send(obj, LV_EVENT_DRAW_POST_END, &obj_ext_mask);
|
||||
}
|
||||
return max_row;
|
||||
}
|
||||
|
||||
static void draw_buf_rotate_180(lv_disp_drv_t * drv, lv_area_t * area, lv_color_t * color_p)
|
||||
|
@ -934,14 +972,13 @@ static void draw_buf_rotate(lv_area_t * area, lv_color_t * color_p)
|
|||
/**
|
||||
* Flush the content of the draw buffer
|
||||
*/
|
||||
static void draw_buf_flush(void)
|
||||
static void draw_buf_flush(lv_disp_t * disp)
|
||||
{
|
||||
lv_disp_draw_buf_t * draw_buf = lv_disp_get_draw_buf(disp_refr);
|
||||
lv_color_t * color_p = draw_buf->buf_act;
|
||||
|
||||
/*Flush the rendered content to the display*/
|
||||
lv_disp_t * disp = _lv_refr_get_disp_refreshing();
|
||||
if(disp->driver->gpu_wait_cb) disp->driver->gpu_wait_cb(disp->driver);
|
||||
lv_draw_ctx_t * draw_ctx = disp->driver->draw_ctx;
|
||||
if(draw_ctx->wait_for_finish) draw_ctx->wait_for_finish(draw_ctx);
|
||||
|
||||
/* In double buffered mode wait until the other buffer is freed
|
||||
* and driver is ready to receive the new buffer */
|
||||
|
@ -956,16 +993,19 @@ static void draw_buf_flush(void)
|
|||
if(disp_refr->driver->draw_buf->last_area && disp_refr->driver->draw_buf->last_part) draw_buf->flushing_last = 1;
|
||||
else draw_buf->flushing_last = 0;
|
||||
|
||||
bool flushing_last = draw_buf->flushing_last;
|
||||
|
||||
if(disp->driver->flush_cb) {
|
||||
/*Rotate the buffer to the display's native orientation if necessary*/
|
||||
if(disp->driver->rotated != LV_DISP_ROT_NONE && disp->driver->sw_rotate) {
|
||||
draw_buf_rotate(&draw_buf->area, draw_buf->buf_act);
|
||||
draw_buf_rotate(draw_ctx->buf_area, draw_ctx->buf);
|
||||
}
|
||||
else {
|
||||
call_flush_cb(disp->driver, &draw_buf->area, color_p);
|
||||
call_flush_cb(disp->driver, draw_ctx->buf_area, draw_ctx->buf);
|
||||
}
|
||||
}
|
||||
if(draw_buf->buf1 && draw_buf->buf2) {
|
||||
/*If there are 2 buffers swap them. With direct mode swap only on the last area*/
|
||||
if(draw_buf->buf1 && draw_buf->buf2 && (!disp->driver->direct_mode || flushing_last)) {
|
||||
if(draw_buf->buf_act == draw_buf->buf1)
|
||||
draw_buf->buf_act = draw_buf->buf2;
|
||||
else
|
||||
|
@ -987,3 +1027,26 @@ static void call_flush_cb(lv_disp_drv_t * drv, const lv_area_t * area, lv_color_
|
|||
|
||||
drv->flush_cb(drv, &offset_area, color_p);
|
||||
}
|
||||
|
||||
#if LV_USE_PERF_MONITOR
|
||||
static void perf_monitor_init(perf_monitor_t * _perf_monitor)
|
||||
{
|
||||
LV_ASSERT_NULL(_perf_monitor);
|
||||
_perf_monitor->elaps_sum = 0;
|
||||
_perf_monitor->fps_sum_all = 0;
|
||||
_perf_monitor->fps_sum_cnt = 0;
|
||||
_perf_monitor->frame_cnt = 0;
|
||||
_perf_monitor->perf_last_time = 0;
|
||||
_perf_monitor->perf_label = NULL;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if LV_USE_MEM_MONITOR
|
||||
static void mem_monitor_init(mem_monitor_t * _mem_monitor)
|
||||
{
|
||||
LV_ASSERT_NULL(_mem_monitor);
|
||||
_mem_monitor->mem_last_time = 0;
|
||||
_mem_monitor->mem_label = NULL;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
|
@ -56,6 +56,13 @@ void _lv_refr_init(void);
|
|||
*/
|
||||
void lv_refr_now(lv_disp_t * disp);
|
||||
|
||||
/**
|
||||
* Redrawn on object an all its children using the passed draw context
|
||||
* @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);
|
||||
|
||||
/**
|
||||
* Invalidate an area on display to redraw it
|
||||
* @param area_p pointer to area which should be invalidated (NULL: delete the invalidated areas)
|
||||
|
@ -80,7 +87,12 @@ void _lv_refr_set_disp_refreshing(lv_disp_t * disp);
|
|||
|
||||
#if LV_USE_PERF_MONITOR
|
||||
/**
|
||||
* Get the average FPS since start up
|
||||
* Reset FPS counter
|
||||
*/
|
||||
void lv_refr_reset_fps_counter(void);
|
||||
|
||||
/**
|
||||
* Get the average FPS
|
||||
* @return the average FPS
|
||||
*/
|
||||
uint32_t lv_refr_get_fps_avg(void);
|
||||
|
|
|
@ -47,7 +47,7 @@ typedef struct _lv_theme_t {
|
|||
|
||||
/**
|
||||
* Get the theme assigned to the display of the object
|
||||
* @param obj pointer to object
|
||||
* @param obj pointer to a theme object
|
||||
* @return the theme of the object's display (can be NULL)
|
||||
*/
|
||||
lv_theme_t * lv_theme_get_from_obj(lv_obj_t * obj);
|
||||
|
@ -77,29 +77,34 @@ void lv_theme_set_apply_cb(lv_theme_t * theme, lv_theme_apply_cb_t apply_cb);
|
|||
|
||||
/**
|
||||
* Get the small font of the theme
|
||||
* @param obj pointer to an object
|
||||
* @return pointer to the font
|
||||
*/
|
||||
const lv_font_t * lv_theme_get_font_small(lv_obj_t * obj);
|
||||
/**
|
||||
* Get the normal font of the theme
|
||||
* @param obj pointer to an object
|
||||
* @return pointer to the font
|
||||
*/
|
||||
const lv_font_t * lv_theme_get_font_normal(lv_obj_t * obj);
|
||||
|
||||
/**
|
||||
* Get the subtitle font of the theme
|
||||
* @param obj pointer to an object
|
||||
* @return pointer to the font
|
||||
*/
|
||||
const lv_font_t * lv_theme_get_font_large(lv_obj_t * obj);
|
||||
|
||||
/**
|
||||
* Get the primary color of the theme
|
||||
* @param obj pointer to an object
|
||||
* @return the color
|
||||
*/
|
||||
lv_color_t lv_theme_get_color_primary(lv_obj_t * obj);
|
||||
|
||||
/**
|
||||
* Get the secondary color of the theme
|
||||
* @param obj pointer to an object
|
||||
* @return the color
|
||||
*/
|
||||
lv_color_t lv_theme_get_color_secondary(lv_obj_t * obj);
|
||||
|
|
|
@ -1,20 +1,13 @@
|
|||
/**
|
||||
* @file lv_gpu_sdl.c
|
||||
* @file lv_draw.c
|
||||
*
|
||||
*/
|
||||
|
||||
/*********************
|
||||
* INCLUDES
|
||||
*********************/
|
||||
|
||||
|
||||
#include "../lv_conf_internal.h"
|
||||
|
||||
#if LV_USE_GPU_SDL
|
||||
|
||||
#include "lv_gpu_sdl.h"
|
||||
#include "sdl/lv_gpu_sdl_utils.h"
|
||||
#include "sdl/lv_gpu_sdl_texture_cache.h"
|
||||
#include "lv_draw.h"
|
||||
#include "sw/lv_draw_sw.h"
|
||||
|
||||
/*********************
|
||||
* DEFINES
|
||||
|
@ -32,6 +25,10 @@
|
|||
* STATIC VARIABLES
|
||||
**********************/
|
||||
|
||||
/**********************
|
||||
* STATIC VARIABLES
|
||||
**********************/
|
||||
|
||||
/**********************
|
||||
* MACROS
|
||||
**********************/
|
||||
|
@ -40,20 +37,17 @@
|
|||
* GLOBAL FUNCTIONS
|
||||
**********************/
|
||||
|
||||
void lv_gpu_sdl_init()
|
||||
void lv_draw_init(void)
|
||||
{
|
||||
_lv_gpu_sdl_utils_init();
|
||||
_lv_gpu_sdl_texture_cache_init();
|
||||
// backend_head = NULL;
|
||||
// lv_draw_sw_init();
|
||||
//
|
||||
//#if LV_USE_GPU_STM32_DMA2D == 0
|
||||
// lv_gpu_stm32_dma2d_init();
|
||||
//#endif
|
||||
}
|
||||
|
||||
void lv_gpu_sdl_deinit()
|
||||
{
|
||||
_lv_gpu_sdl_texture_cache_deinit();
|
||||
_lv_gpu_sdl_utils_deinit();
|
||||
}
|
||||
/**********************
|
||||
* STATIC FUNCTIONS
|
||||
**********************/
|
||||
|
||||
|
||||
#endif /*LV_USE_GPU_SDL*/
|
|
@ -26,7 +26,6 @@ extern "C" {
|
|||
#include "lv_draw_line.h"
|
||||
#include "lv_draw_triangle.h"
|
||||
#include "lv_draw_arc.h"
|
||||
#include "lv_draw_blend.h"
|
||||
#include "lv_draw_mask.h"
|
||||
|
||||
/*********************
|
||||
|
@ -37,10 +36,72 @@ extern "C" {
|
|||
* TYPEDEFS
|
||||
**********************/
|
||||
|
||||
typedef struct {
|
||||
void * user_data;
|
||||
} lv_draw_mask_t;
|
||||
|
||||
|
||||
typedef struct _lv_draw_ctx_t {
|
||||
/**
|
||||
* Pointer to a buffer to draw into
|
||||
*/
|
||||
void * buf;
|
||||
|
||||
/**
|
||||
* The position and size of `buf` (absolute coordinates)
|
||||
*/
|
||||
lv_area_t * buf_area;
|
||||
|
||||
/**
|
||||
* The current clip area with absolute coordinates, always the same or smaller than `buf_area`
|
||||
*/
|
||||
const lv_area_t * clip_area;
|
||||
|
||||
|
||||
void (*draw_rect)(struct _lv_draw_ctx_t * draw_ctx, const lv_draw_rect_dsc_t * dsc, const lv_area_t * coords);
|
||||
|
||||
void (*draw_arc)(struct _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);
|
||||
|
||||
void (*draw_img_decoded)(struct _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);
|
||||
|
||||
lv_res_t (*draw_img)(struct _lv_draw_ctx_t * draw_ctx, const lv_draw_img_dsc_t * draw_dsc,
|
||||
const lv_area_t * coords, const void * src);
|
||||
|
||||
void (*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);
|
||||
|
||||
|
||||
void (*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);
|
||||
|
||||
|
||||
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);
|
||||
|
||||
/**
|
||||
* Replace the buffer with a rect without decoration like radius or borders
|
||||
*/
|
||||
void (*draw_bg)(struct _lv_draw_ctx_t * draw_ctx, const lv_draw_rect_dsc_t * draw_dsc, const lv_area_t * coords);
|
||||
|
||||
/**
|
||||
* Wait until all background operations are finished. (E.g. GPU operations)
|
||||
*/
|
||||
void (*wait_for_finish)(struct _lv_draw_ctx_t * draw);
|
||||
|
||||
#if LV_USE_USER_DATA
|
||||
void * user_data;
|
||||
#endif
|
||||
|
||||
} lv_draw_ctx_t;
|
||||
|
||||
/**********************
|
||||
* GLOBAL PROTOTYPES
|
||||
**********************/
|
||||
|
||||
void lv_draw_init(void);
|
||||
|
||||
/**********************
|
||||
* GLOBAL VARIABLES
|
||||
**********************/
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
CSRCS += lv_draw_arc.c
|
||||
CSRCS += lv_draw_blend.c
|
||||
CSRCS += lv_draw.c
|
||||
CSRCS += lv_draw_img.c
|
||||
CSRCS += lv_draw_label.c
|
||||
CSRCS += lv_draw_line.c
|
||||
|
@ -14,3 +14,5 @@ DEPPATH += --dep-path $(LVGL_DIR)/$(LVGL_DIR_NAME)/src/draw
|
|||
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/sdl/lv_draw_sdl.mk
|
||||
|
|
|
@ -6,46 +6,20 @@
|
|||
/*********************
|
||||
* INCLUDES
|
||||
*********************/
|
||||
#include "lv_draw.h"
|
||||
#include "lv_draw_arc.h"
|
||||
#include "lv_draw_rect.h"
|
||||
#include "lv_draw_mask.h"
|
||||
#include "../misc/lv_math.h"
|
||||
#include "../misc/lv_log.h"
|
||||
#include "../misc/lv_mem.h"
|
||||
|
||||
/*********************
|
||||
* DEFINES
|
||||
*********************/
|
||||
#define SPLIT_RADIUS_LIMIT 10 /*With radius greater than this the arc will drawn in quarters. A quarter is drawn only if there is arc in it*/
|
||||
#define SPLIT_ANGLE_GAP_LIMIT 60 /*With small gaps in the arc don't bother with splitting because there is nothing to skip.*/
|
||||
|
||||
/**********************
|
||||
* TYPEDEFS
|
||||
**********************/
|
||||
typedef struct {
|
||||
lv_coord_t center_x;
|
||||
lv_coord_t center_y;
|
||||
lv_coord_t radius;
|
||||
uint16_t start_angle;
|
||||
uint16_t end_angle;
|
||||
uint16_t start_quarter;
|
||||
uint16_t end_quarter;
|
||||
lv_coord_t width;
|
||||
lv_draw_rect_dsc_t * draw_dsc;
|
||||
const lv_area_t * draw_area;
|
||||
const lv_area_t * clip_area;
|
||||
} quarter_draw_dsc_t;
|
||||
|
||||
/**********************
|
||||
* STATIC PROTOTYPES
|
||||
**********************/
|
||||
#if LV_DRAW_COMPLEX
|
||||
static void draw_quarter_0(quarter_draw_dsc_t * q);
|
||||
static void draw_quarter_1(quarter_draw_dsc_t * q);
|
||||
static void draw_quarter_2(quarter_draw_dsc_t * q);
|
||||
static void draw_quarter_3(quarter_draw_dsc_t * q);
|
||||
static void get_rounded_area(int16_t angle, lv_coord_t radius, uint8_t thickness, lv_area_t * res_area);
|
||||
#endif /*LV_DRAW_COMPLEX*/
|
||||
|
||||
/**********************
|
||||
* STATIC VARIABLES
|
||||
|
@ -59,7 +33,7 @@ typedef struct {
|
|||
* GLOBAL FUNCTIONS
|
||||
**********************/
|
||||
|
||||
LV_ATTRIBUTE_FAST_MEM void lv_draw_arc_dsc_init(lv_draw_arc_dsc_t * dsc)
|
||||
void lv_draw_arc_dsc_init(lv_draw_arc_dsc_t * dsc)
|
||||
{
|
||||
lv_memset_00(dsc, sizeof(lv_draw_arc_dsc_t));
|
||||
dsc->width = 1;
|
||||
|
@ -67,155 +41,17 @@ LV_ATTRIBUTE_FAST_MEM void lv_draw_arc_dsc_init(lv_draw_arc_dsc_t * dsc)
|
|||
dsc->color = lv_color_black();
|
||||
}
|
||||
|
||||
void lv_draw_arc(lv_coord_t center_x, lv_coord_t center_y, uint16_t radius, uint16_t start_angle, uint16_t end_angle,
|
||||
const lv_area_t * clip_area, const lv_draw_arc_dsc_t * dsc)
|
||||
void lv_draw_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)
|
||||
{
|
||||
#if LV_DRAW_COMPLEX
|
||||
if(dsc->opa <= LV_OPA_MIN) return;
|
||||
if(dsc->width == 0) return;
|
||||
if(start_angle == end_angle) return;
|
||||
|
||||
lv_coord_t width = dsc->width;
|
||||
if(width > radius) width = radius;
|
||||
draw_ctx->draw_arc(draw_ctx, dsc, center, radius, start_angle, end_angle);
|
||||
|
||||
lv_draw_rect_dsc_t cir_dsc;
|
||||
lv_draw_rect_dsc_init(&cir_dsc);
|
||||
cir_dsc.blend_mode = dsc->blend_mode;
|
||||
if(dsc->img_src) {
|
||||
cir_dsc.bg_opa = LV_OPA_TRANSP;
|
||||
cir_dsc.bg_img_src = dsc->img_src;
|
||||
cir_dsc.bg_img_opa = dsc->opa;
|
||||
}
|
||||
else {
|
||||
cir_dsc.bg_opa = dsc->opa;
|
||||
cir_dsc.bg_color = dsc->color;
|
||||
}
|
||||
|
||||
lv_area_t area_out;
|
||||
area_out.x1 = center_x - radius;
|
||||
area_out.y1 = center_y - radius;
|
||||
area_out.x2 = center_x + radius - 1; /*-1 because the center already belongs to the left/bottom part*/
|
||||
area_out.y2 = center_y + radius - 1;
|
||||
|
||||
lv_area_t area_in;
|
||||
lv_area_copy(&area_in, &area_out);
|
||||
area_in.x1 += dsc->width;
|
||||
area_in.y1 += dsc->width;
|
||||
area_in.x2 -= dsc->width;
|
||||
area_in.y2 -= dsc->width;
|
||||
|
||||
/*Create inner the mask*/
|
||||
int16_t mask_in_id = LV_MASK_ID_INV;
|
||||
lv_draw_mask_radius_param_t mask_in_param;
|
||||
if(lv_area_get_width(&area_in) > 0 && lv_area_get_height(&area_in) > 0) {
|
||||
lv_draw_mask_radius_init(&mask_in_param, &area_in, LV_RADIUS_CIRCLE, true);
|
||||
mask_in_id = lv_draw_mask_add(&mask_in_param, NULL);
|
||||
}
|
||||
|
||||
lv_draw_mask_radius_param_t mask_out_param;
|
||||
lv_draw_mask_radius_init(&mask_out_param, &area_out, LV_RADIUS_CIRCLE, false);
|
||||
int16_t mask_out_id = lv_draw_mask_add(&mask_out_param, NULL);
|
||||
|
||||
/*Draw a full ring*/
|
||||
if(start_angle + 360 == end_angle || start_angle == end_angle + 360) {
|
||||
cir_dsc.radius = LV_RADIUS_CIRCLE;
|
||||
lv_draw_rect(&area_out, clip_area, &cir_dsc);
|
||||
|
||||
lv_draw_mask_remove_id(mask_out_id);
|
||||
if(mask_in_id != LV_MASK_ID_INV) lv_draw_mask_remove_id(mask_in_id);
|
||||
return;
|
||||
}
|
||||
|
||||
while(start_angle >= 360) start_angle -= 360;
|
||||
while(end_angle >= 360) end_angle -= 360;
|
||||
|
||||
lv_draw_mask_angle_param_t mask_angle_param;
|
||||
lv_draw_mask_angle_init(&mask_angle_param, center_x, center_y, start_angle, end_angle);
|
||||
int16_t mask_angle_id = lv_draw_mask_add(&mask_angle_param, NULL);
|
||||
|
||||
int32_t angle_gap;
|
||||
if(end_angle > start_angle) {
|
||||
angle_gap = 360 - (end_angle - start_angle);
|
||||
}
|
||||
else {
|
||||
angle_gap = start_angle - end_angle;
|
||||
}
|
||||
if(angle_gap > SPLIT_ANGLE_GAP_LIMIT && radius > SPLIT_RADIUS_LIMIT) {
|
||||
/*Handle each quarter individually and skip which is empty*/
|
||||
quarter_draw_dsc_t q_dsc;
|
||||
q_dsc.center_x = center_x;
|
||||
q_dsc.center_y = center_y;
|
||||
q_dsc.radius = radius;
|
||||
q_dsc.start_angle = start_angle;
|
||||
q_dsc.end_angle = end_angle;
|
||||
q_dsc.start_quarter = (start_angle / 90) & 0x3;
|
||||
q_dsc.end_quarter = (end_angle / 90) & 0x3;
|
||||
q_dsc.width = width;
|
||||
q_dsc.draw_dsc = &cir_dsc;
|
||||
q_dsc.draw_area = &area_out;
|
||||
q_dsc.clip_area = clip_area;
|
||||
|
||||
draw_quarter_0(&q_dsc);
|
||||
draw_quarter_1(&q_dsc);
|
||||
draw_quarter_2(&q_dsc);
|
||||
draw_quarter_3(&q_dsc);
|
||||
}
|
||||
else {
|
||||
lv_draw_rect(&area_out, clip_area, &cir_dsc);
|
||||
}
|
||||
|
||||
lv_draw_mask_free_param(&mask_angle_param);
|
||||
lv_draw_mask_free_param(&mask_out_param);
|
||||
lv_draw_mask_free_param(&mask_in_param);
|
||||
|
||||
lv_draw_mask_remove_id(mask_angle_id);
|
||||
lv_draw_mask_remove_id(mask_out_id);
|
||||
if(mask_in_id != LV_MASK_ID_INV) lv_draw_mask_remove_id(mask_in_id);
|
||||
|
||||
if(dsc->rounded) {
|
||||
|
||||
lv_draw_mask_radius_param_t mask_end_param;
|
||||
|
||||
lv_area_t round_area;
|
||||
get_rounded_area(start_angle, radius, width, &round_area);
|
||||
round_area.x1 += center_x;
|
||||
round_area.x2 += center_x;
|
||||
round_area.y1 += center_y;
|
||||
round_area.y2 += center_y;
|
||||
lv_area_t clip_area2;
|
||||
if(_lv_area_intersect(&clip_area2, clip_area, &round_area)) {
|
||||
lv_draw_mask_radius_init(&mask_end_param, &round_area, LV_RADIUS_CIRCLE, false);
|
||||
int16_t mask_end_id = lv_draw_mask_add(&mask_end_param, NULL);
|
||||
|
||||
lv_draw_rect(&area_out, &clip_area2, &cir_dsc);
|
||||
lv_draw_mask_remove_id(mask_end_id);
|
||||
lv_draw_mask_free_param(&mask_end_param);
|
||||
}
|
||||
|
||||
get_rounded_area(end_angle, radius, width, &round_area);
|
||||
round_area.x1 += center_x;
|
||||
round_area.x2 += center_x;
|
||||
round_area.y1 += center_y;
|
||||
round_area.y2 += center_y;
|
||||
if(_lv_area_intersect(&clip_area2, clip_area, &round_area)) {
|
||||
lv_draw_mask_radius_init(&mask_end_param, &round_area, LV_RADIUS_CIRCLE, false);
|
||||
int16_t mask_end_id = lv_draw_mask_add(&mask_end_param, NULL);
|
||||
|
||||
lv_draw_rect(&area_out, &clip_area2, &cir_dsc);
|
||||
lv_draw_mask_remove_id(mask_end_id);
|
||||
lv_draw_mask_free_param(&mask_end_param);
|
||||
}
|
||||
}
|
||||
#else
|
||||
LV_LOG_WARN("Can't draw arc with LV_DRAW_COMPLEX == 0");
|
||||
LV_UNUSED(center_x);
|
||||
LV_UNUSED(center_y);
|
||||
LV_UNUSED(radius);
|
||||
LV_UNUSED(start_angle);
|
||||
LV_UNUSED(end_angle);
|
||||
LV_UNUSED(clip_area);
|
||||
LV_UNUSED(dsc);
|
||||
#endif /*LV_DRAW_COMPLEX*/
|
||||
// const lv_draw_backend_t * backend = lv_draw_backend_get();
|
||||
// backend->draw_arc(center_x, center_y, radius, start_angle, end_angle, clip_area, dsc);
|
||||
}
|
||||
|
||||
void lv_draw_arc_get_area(lv_coord_t x, lv_coord_t y, uint16_t radius, uint16_t start_angle, uint16_t end_angle,
|
||||
|
@ -314,256 +150,3 @@ void lv_draw_arc_get_area(lv_coord_t x, lv_coord_t y, uint16_t radius, uint16_t
|
|||
/**********************
|
||||
* STATIC FUNCTIONS
|
||||
**********************/
|
||||
|
||||
#if LV_DRAW_COMPLEX
|
||||
static void draw_quarter_0(quarter_draw_dsc_t * q)
|
||||
{
|
||||
lv_area_t quarter_area;
|
||||
|
||||
if(q->start_quarter == 0 && q->end_quarter == 0 && q->start_angle < q->end_angle) {
|
||||
/*Small arc here*/
|
||||
quarter_area.y1 = q->center_y + ((lv_trigo_sin(q->start_angle) * (q->radius - q->width)) >> LV_TRIGO_SHIFT);
|
||||
quarter_area.x2 = q->center_x + ((lv_trigo_sin(q->start_angle + 90) * (q->radius)) >> LV_TRIGO_SHIFT);
|
||||
|
||||
quarter_area.y2 = q->center_y + ((lv_trigo_sin(q->end_angle) * q->radius) >> LV_TRIGO_SHIFT);
|
||||
quarter_area.x1 = q->center_x + ((lv_trigo_sin(q->end_angle + 90) * (q->radius - q->width)) >> LV_TRIGO_SHIFT);
|
||||
|
||||
bool ok = _lv_area_intersect(&quarter_area, &quarter_area, q->clip_area);
|
||||
if(ok) lv_draw_rect(q->draw_area, &quarter_area, q->draw_dsc);
|
||||
}
|
||||
else if(q->start_quarter == 0 || q->end_quarter == 0) {
|
||||
/*Start and/or end arcs here*/
|
||||
if(q->start_quarter == 0) {
|
||||
quarter_area.x1 = q->center_x;
|
||||
quarter_area.y2 = q->center_y + q->radius;
|
||||
|
||||
quarter_area.y1 = q->center_y + ((lv_trigo_sin(q->start_angle) * (q->radius - q->width)) >> LV_TRIGO_SHIFT);
|
||||
quarter_area.x2 = q->center_x + ((lv_trigo_sin(q->start_angle + 90) * (q->radius)) >> LV_TRIGO_SHIFT);
|
||||
|
||||
bool ok = _lv_area_intersect(&quarter_area, &quarter_area, q->clip_area);
|
||||
if(ok) lv_draw_rect(q->draw_area, &quarter_area, q->draw_dsc);
|
||||
}
|
||||
if(q->end_quarter == 0) {
|
||||
quarter_area.x2 = q->center_x + q->radius;
|
||||
quarter_area.y1 = q->center_y;
|
||||
|
||||
quarter_area.y2 = q->center_y + ((lv_trigo_sin(q->end_angle) * q->radius) >> LV_TRIGO_SHIFT);
|
||||
quarter_area.x1 = q->center_x + ((lv_trigo_sin(q->end_angle + 90) * (q->radius - q->width)) >> LV_TRIGO_SHIFT);
|
||||
|
||||
bool ok = _lv_area_intersect(&quarter_area, &quarter_area, q->clip_area);
|
||||
if(ok) lv_draw_rect(q->draw_area, &quarter_area, q->draw_dsc);
|
||||
}
|
||||
}
|
||||
else if((q->start_quarter == q->end_quarter && q->start_quarter != 0 && q->end_angle < q->start_angle) ||
|
||||
(q->start_quarter == 2 && q->end_quarter == 1) ||
|
||||
(q->start_quarter == 3 && q->end_quarter == 2) ||
|
||||
(q->start_quarter == 3 && q->end_quarter == 1)) {
|
||||
/*Arc crosses here*/
|
||||
quarter_area.x1 = q->center_x;
|
||||
quarter_area.y1 = q->center_y;
|
||||
quarter_area.x2 = q->center_x + q->radius;
|
||||
quarter_area.y2 = q->center_y + q->radius;
|
||||
|
||||
bool ok = _lv_area_intersect(&quarter_area, &quarter_area, q->clip_area);
|
||||
if(ok) lv_draw_rect(q->draw_area, &quarter_area, q->draw_dsc);
|
||||
}
|
||||
}
|
||||
|
||||
static void draw_quarter_1(quarter_draw_dsc_t * q)
|
||||
{
|
||||
lv_area_t quarter_area;
|
||||
|
||||
if(q->start_quarter == 1 && q->end_quarter == 1 && q->start_angle < q->end_angle) {
|
||||
/*Small arc here*/
|
||||
quarter_area.y2 = q->center_y + ((lv_trigo_sin(q->start_angle) * (q->radius)) >> LV_TRIGO_SHIFT);
|
||||
quarter_area.x2 = q->center_x + ((lv_trigo_sin(q->start_angle + 90) * (q->radius - q->width)) >> LV_TRIGO_SHIFT);
|
||||
|
||||
quarter_area.y1 = q->center_y + ((lv_trigo_sin(q->end_angle) * (q->radius - q->width)) >> LV_TRIGO_SHIFT);
|
||||
quarter_area.x1 = q->center_x + ((lv_trigo_sin(q->end_angle + 90) * (q->radius)) >> LV_TRIGO_SHIFT);
|
||||
|
||||
bool ok = _lv_area_intersect(&quarter_area, &quarter_area, q->clip_area);
|
||||
if(ok) lv_draw_rect(q->draw_area, &quarter_area, q->draw_dsc);
|
||||
}
|
||||
else if(q->start_quarter == 1 || q->end_quarter == 1) {
|
||||
/*Start and/or end arcs here*/
|
||||
if(q->start_quarter == 1) {
|
||||
quarter_area.x1 = q->center_x - q->radius;
|
||||
quarter_area.y1 = q->center_y;
|
||||
|
||||
quarter_area.y2 = q->center_y + ((lv_trigo_sin(q->start_angle) * (q->radius)) >> LV_TRIGO_SHIFT);
|
||||
quarter_area.x2 = q->center_x + ((lv_trigo_sin(q->start_angle + 90) * (q->radius - q->width)) >> LV_TRIGO_SHIFT);
|
||||
|
||||
bool ok = _lv_area_intersect(&quarter_area, &quarter_area, q->clip_area);
|
||||
if(ok) lv_draw_rect(q->draw_area, &quarter_area, q->draw_dsc);
|
||||
}
|
||||
if(q->end_quarter == 1) {
|
||||
quarter_area.x2 = q->center_x - 1;
|
||||
quarter_area.y2 = q->center_y + q->radius;
|
||||
|
||||
quarter_area.y1 = q->center_y + ((lv_trigo_sin(q->end_angle) * (q->radius - q->width)) >> LV_TRIGO_SHIFT);
|
||||
quarter_area.x1 = q->center_x + ((lv_trigo_sin(q->end_angle + 90) * (q->radius)) >> LV_TRIGO_SHIFT);
|
||||
|
||||
bool ok = _lv_area_intersect(&quarter_area, &quarter_area, q->clip_area);
|
||||
if(ok) lv_draw_rect(q->draw_area, &quarter_area, q->draw_dsc);
|
||||
}
|
||||
}
|
||||
else if((q->start_quarter == q->end_quarter && q->start_quarter != 1 && q->end_angle < q->start_angle) ||
|
||||
(q->start_quarter == 0 && q->end_quarter == 2) ||
|
||||
(q->start_quarter == 0 && q->end_quarter == 3) ||
|
||||
(q->start_quarter == 3 && q->end_quarter == 2)) {
|
||||
/*Arc crosses here*/
|
||||
quarter_area.x1 = q->center_x - q->radius;
|
||||
quarter_area.y1 = q->center_y;
|
||||
quarter_area.x2 = q->center_x - 1;
|
||||
quarter_area.y2 = q->center_y + q->radius;
|
||||
|
||||
bool ok = _lv_area_intersect(&quarter_area, &quarter_area, q->clip_area);
|
||||
if(ok) lv_draw_rect(q->draw_area, &quarter_area, q->draw_dsc);
|
||||
}
|
||||
}
|
||||
|
||||
static void draw_quarter_2(quarter_draw_dsc_t * q)
|
||||
{
|
||||
lv_area_t quarter_area;
|
||||
|
||||
if(q->start_quarter == 2 && q->end_quarter == 2 && q->start_angle < q->end_angle) {
|
||||
/*Small arc here*/
|
||||
quarter_area.x1 = q->center_x + ((lv_trigo_sin(q->start_angle + 90) * (q->radius)) >> LV_TRIGO_SHIFT);
|
||||
quarter_area.y2 = q->center_y + ((lv_trigo_sin(q->start_angle) * (q->radius - q->width)) >> LV_TRIGO_SHIFT);
|
||||
|
||||
quarter_area.y1 = q->center_y + ((lv_trigo_sin(q->end_angle) * q->radius) >> LV_TRIGO_SHIFT);
|
||||
quarter_area.x2 = q->center_x + ((lv_trigo_sin(q->end_angle + 90) * (q->radius - q->width)) >> LV_TRIGO_SHIFT);
|
||||
|
||||
bool ok = _lv_area_intersect(&quarter_area, &quarter_area, q->clip_area);
|
||||
if(ok) lv_draw_rect(q->draw_area, &quarter_area, q->draw_dsc);
|
||||
}
|
||||
else if(q->start_quarter == 2 || q->end_quarter == 2) {
|
||||
/*Start and/or end arcs here*/
|
||||
if(q->start_quarter == 2) {
|
||||
quarter_area.x2 = q->center_x - 1;
|
||||
quarter_area.y1 = q->center_y - q->radius;
|
||||
|
||||
quarter_area.x1 = q->center_x + ((lv_trigo_sin(q->start_angle + 90) * (q->radius)) >> LV_TRIGO_SHIFT);
|
||||
quarter_area.y2 = q->center_y + ((lv_trigo_sin(q->start_angle) * (q->radius - q->width)) >> LV_TRIGO_SHIFT);
|
||||
|
||||
bool ok = _lv_area_intersect(&quarter_area, &quarter_area, q->clip_area);
|
||||
if(ok) lv_draw_rect(q->draw_area, &quarter_area, q->draw_dsc);
|
||||
}
|
||||
if(q->end_quarter == 2) {
|
||||
quarter_area.x1 = q->center_x - q->radius;
|
||||
quarter_area.y2 = q->center_y - 1;
|
||||
|
||||
quarter_area.x2 = q->center_x + ((lv_trigo_sin(q->end_angle + 90) * (q->radius - q->width)) >> LV_TRIGO_SHIFT);
|
||||
quarter_area.y1 = q->center_y + ((lv_trigo_sin(q->end_angle) * (q->radius)) >> LV_TRIGO_SHIFT);
|
||||
|
||||
bool ok = _lv_area_intersect(&quarter_area, &quarter_area, q->clip_area);
|
||||
if(ok) lv_draw_rect(q->draw_area, &quarter_area, q->draw_dsc);
|
||||
}
|
||||
}
|
||||
else if((q->start_quarter == q->end_quarter && q->start_quarter != 2 && q->end_angle < q->start_angle) ||
|
||||
(q->start_quarter == 0 && q->end_quarter == 3) ||
|
||||
(q->start_quarter == 1 && q->end_quarter == 3) ||
|
||||
(q->start_quarter == 1 && q->end_quarter == 0)) {
|
||||
/*Arc crosses here*/
|
||||
quarter_area.x1 = q->center_x - q->radius;
|
||||
quarter_area.y1 = q->center_y - q->radius;
|
||||
quarter_area.x2 = q->center_x - 1;
|
||||
quarter_area.y2 = q->center_y - 1;
|
||||
|
||||
bool ok = _lv_area_intersect(&quarter_area, &quarter_area, q->clip_area);
|
||||
if(ok) lv_draw_rect(q->draw_area, &quarter_area, q->draw_dsc);
|
||||
}
|
||||
}
|
||||
|
||||
static void draw_quarter_3(quarter_draw_dsc_t * q)
|
||||
{
|
||||
lv_area_t quarter_area;
|
||||
|
||||
if(q->start_quarter == 3 && q->end_quarter == 3 && q->start_angle < q->end_angle) {
|
||||
/*Small arc here*/
|
||||
quarter_area.x1 = q->center_x + ((lv_trigo_sin(q->start_angle + 90) * (q->radius - q->width)) >> LV_TRIGO_SHIFT);
|
||||
quarter_area.y1 = q->center_y + ((lv_trigo_sin(q->start_angle) * (q->radius)) >> LV_TRIGO_SHIFT);
|
||||
|
||||
quarter_area.x2 = q->center_x + ((lv_trigo_sin(q->end_angle + 90) * (q->radius)) >> LV_TRIGO_SHIFT);
|
||||
quarter_area.y2 = q->center_y + ((lv_trigo_sin(q->end_angle) * (q->radius - q->width)) >> LV_TRIGO_SHIFT);
|
||||
|
||||
bool ok = _lv_area_intersect(&quarter_area, &quarter_area, q->clip_area);
|
||||
if(ok) lv_draw_rect(q->draw_area, &quarter_area, q->draw_dsc);
|
||||
}
|
||||
else if(q->start_quarter == 3 || q->end_quarter == 3) {
|
||||
/*Start and/or end arcs here*/
|
||||
if(q->start_quarter == 3) {
|
||||
quarter_area.x2 = q->center_x + q->radius;
|
||||
quarter_area.y2 = q->center_y - 1;
|
||||
|
||||
quarter_area.x1 = q->center_x + ((lv_trigo_sin(q->start_angle + 90) * (q->radius - q->width)) >> LV_TRIGO_SHIFT);
|
||||
quarter_area.y1 = q->center_y + ((lv_trigo_sin(q->start_angle) * (q->radius)) >> LV_TRIGO_SHIFT);
|
||||
|
||||
bool ok = _lv_area_intersect(&quarter_area, &quarter_area, q->clip_area);
|
||||
if(ok) lv_draw_rect(q->draw_area, &quarter_area, q->draw_dsc);
|
||||
}
|
||||
if(q->end_quarter == 3) {
|
||||
quarter_area.x1 = q->center_x;
|
||||
quarter_area.y1 = q->center_y - q->radius;
|
||||
|
||||
quarter_area.x2 = q->center_x + ((lv_trigo_sin(q->end_angle + 90) * (q->radius)) >> LV_TRIGO_SHIFT);
|
||||
quarter_area.y2 = q->center_y + ((lv_trigo_sin(q->end_angle) * (q->radius - q->width)) >> LV_TRIGO_SHIFT);
|
||||
|
||||
bool ok = _lv_area_intersect(&quarter_area, &quarter_area, q->clip_area);
|
||||
if(ok) lv_draw_rect(q->draw_area, &quarter_area, q->draw_dsc);
|
||||
}
|
||||
}
|
||||
else if((q->start_quarter == q->end_quarter && q->start_quarter != 3 && q->end_angle < q->start_angle) ||
|
||||
(q->start_quarter == 2 && q->end_quarter == 0) ||
|
||||
(q->start_quarter == 1 && q->end_quarter == 0) ||
|
||||
(q->start_quarter == 2 && q->end_quarter == 1)) {
|
||||
/*Arc crosses here*/
|
||||
quarter_area.x1 = q->center_x;
|
||||
quarter_area.y1 = q->center_y - q->radius;
|
||||
quarter_area.x2 = q->center_x + q->radius;
|
||||
quarter_area.y2 = q->center_y - 1;
|
||||
|
||||
bool ok = _lv_area_intersect(&quarter_area, &quarter_area, q->clip_area);
|
||||
if(ok) lv_draw_rect(q->draw_area, &quarter_area, q->draw_dsc);
|
||||
}
|
||||
}
|
||||
|
||||
static void get_rounded_area(int16_t angle, lv_coord_t radius, uint8_t thickness, lv_area_t * res_area)
|
||||
{
|
||||
const uint8_t ps = 8;
|
||||
const uint8_t pa = 127;
|
||||
|
||||
int32_t thick_half = thickness / 2;
|
||||
uint8_t thick_corr = (thickness & 0x01) ? 0 : 1;
|
||||
|
||||
int32_t cir_x;
|
||||
int32_t cir_y;
|
||||
|
||||
cir_x = ((radius - thick_half) * lv_trigo_sin(90 - angle)) >> (LV_TRIGO_SHIFT - ps);
|
||||
cir_y = ((radius - thick_half) * lv_trigo_sin(angle)) >> (LV_TRIGO_SHIFT - ps);
|
||||
|
||||
/*Actually the center of the pixel need to be calculated so apply 1/2 px offset*/
|
||||
if(cir_x > 0) {
|
||||
cir_x = (cir_x - pa) >> ps;
|
||||
res_area->x1 = cir_x - thick_half + thick_corr;
|
||||
res_area->x2 = cir_x + thick_half;
|
||||
}
|
||||
else {
|
||||
cir_x = (cir_x + pa) >> ps;
|
||||
res_area->x1 = cir_x - thick_half;
|
||||
res_area->x2 = cir_x + thick_half - thick_corr;
|
||||
}
|
||||
|
||||
if(cir_y > 0) {
|
||||
cir_y = (cir_y - pa) >> ps;
|
||||
res_area->y1 = cir_y - thick_half + thick_corr;
|
||||
res_area->y2 = cir_y + thick_half;
|
||||
}
|
||||
else {
|
||||
cir_y = (cir_y + pa) >> ps;
|
||||
res_area->y1 = cir_y - thick_half;
|
||||
res_area->y2 = cir_y + thick_half - thick_corr;
|
||||
}
|
||||
}
|
||||
|
||||
#endif /*LV_DRAW_COMPLEX*/
|
||||
|
|
|
@ -13,7 +13,10 @@ extern "C" {
|
|||
/*********************
|
||||
* INCLUDES
|
||||
*********************/
|
||||
#include "lv_draw_line.h"
|
||||
#include "../lv_conf_internal.h"
|
||||
#include "../misc/lv_color.h"
|
||||
#include "../misc/lv_area.h"
|
||||
#include "../misc/lv_style.h"
|
||||
|
||||
/*********************
|
||||
* DEFINES
|
||||
|
@ -25,17 +28,21 @@ extern "C" {
|
|||
typedef struct {
|
||||
lv_color_t color;
|
||||
lv_coord_t width;
|
||||
uint16_t start_angle;
|
||||
uint16_t end_angle;
|
||||
const void * img_src;
|
||||
lv_opa_t opa;
|
||||
lv_blend_mode_t blend_mode : 2;
|
||||
uint8_t rounded : 1;
|
||||
} lv_draw_arc_dsc_t;
|
||||
|
||||
struct _lv_draw_ctx_t;
|
||||
|
||||
/**********************
|
||||
* GLOBAL PROTOTYPES
|
||||
**********************/
|
||||
|
||||
LV_ATTRIBUTE_FAST_MEM void lv_draw_arc_dsc_init(lv_draw_arc_dsc_t * dsc);
|
||||
void lv_draw_arc_dsc_init(lv_draw_arc_dsc_t * dsc);
|
||||
|
||||
/**
|
||||
* Draw an arc. (Can draw pie too with great thickness.)
|
||||
|
@ -48,8 +55,8 @@ LV_ATTRIBUTE_FAST_MEM void lv_draw_arc_dsc_init(lv_draw_arc_dsc_t * dsc);
|
|||
* @param clip_area the arc will be drawn only in this area
|
||||
* @param dsc pointer to an initialized `lv_draw_line_dsc_t` variable
|
||||
*/
|
||||
void lv_draw_arc(lv_coord_t center_x, lv_coord_t center_y, uint16_t radius, uint16_t start_angle, uint16_t end_angle,
|
||||
const lv_area_t * clip_area, const lv_draw_arc_dsc_t * dsc);
|
||||
void lv_draw_arc(struct _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);
|
||||
|
||||
/**
|
||||
* Get an area the should be invalidated when the arcs angle changed between start_angle and end_ange
|
||||
|
@ -73,4 +80,4 @@ void lv_draw_arc_get_area(lv_coord_t x, lv_coord_t y, uint16_t radius, uint16_t
|
|||
} /*extern "C"*/
|
||||
#endif
|
||||
|
||||
#endif /*LV_DRAW_ARC*/
|
||||
#endif /*LV_DRAW_ARC_H*/
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,50 +0,0 @@
|
|||
/**
|
||||
* @file lv_draw_blend.h
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef LV_DRAW_BLEND_H
|
||||
#define LV_DRAW_BLEND_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*********************
|
||||
* INCLUDES
|
||||
*********************/
|
||||
#include "../misc/lv_color.h"
|
||||
#include "../misc/lv_area.h"
|
||||
#include "../misc/lv_style.h"
|
||||
#include "lv_draw_mask.h"
|
||||
|
||||
/*********************
|
||||
* DEFINES
|
||||
*********************/
|
||||
|
||||
/**********************
|
||||
* TYPEDEFS
|
||||
**********************/
|
||||
|
||||
/**********************
|
||||
* GLOBAL PROTOTYPES
|
||||
**********************/
|
||||
|
||||
//! @cond Doxygen_Suppress
|
||||
LV_ATTRIBUTE_FAST_MEM void _lv_blend_fill(const lv_area_t * clip_area, const lv_area_t * fill_area, lv_color_t color,
|
||||
lv_opa_t * mask, lv_draw_mask_res_t mask_res, lv_opa_t opa, lv_blend_mode_t mode);
|
||||
|
||||
LV_ATTRIBUTE_FAST_MEM void _lv_blend_map(const lv_area_t * clip_area, const lv_area_t * map_area,
|
||||
const lv_color_t * map_buf,
|
||||
lv_opa_t * mask, lv_draw_mask_res_t mask_res, lv_opa_t opa, lv_blend_mode_t mode);
|
||||
|
||||
//! @endcond
|
||||
/**********************
|
||||
* MACROS
|
||||
**********************/
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /*extern "C"*/
|
||||
#endif
|
||||
|
||||
#endif /*LV_DRAW_BLEND_H*/
|
|
@ -13,11 +13,6 @@
|
|||
#include "../core/lv_refr.h"
|
||||
#include "../misc/lv_mem.h"
|
||||
#include "../misc/lv_math.h"
|
||||
#if LV_USE_GPU_STM32_DMA2D
|
||||
#include "../gpu/lv_gpu_stm32_dma2d.h"
|
||||
#elif LV_USE_GPU_NXP_PXP
|
||||
#include "../gpu/lv_gpu_nxp_pxp.h"
|
||||
#endif
|
||||
|
||||
/*********************
|
||||
* DEFINES
|
||||
|
@ -30,19 +25,11 @@
|
|||
/**********************
|
||||
* STATIC PROTOTYPES
|
||||
**********************/
|
||||
#if LV_USE_EXTERNAL_RENDERER == 0
|
||||
LV_ATTRIBUTE_FAST_MEM static lv_res_t lv_img_draw_core(const lv_area_t * coords, const lv_area_t * clip_area,
|
||||
const void * src,
|
||||
const lv_draw_img_dsc_t * draw_dsc);
|
||||
LV_ATTRIBUTE_FAST_MEM static lv_res_t decode_and_draw(lv_draw_ctx_t * draw_ctx, const lv_draw_img_dsc_t * draw_dsc,
|
||||
const lv_area_t * coords, const void * src);
|
||||
|
||||
LV_ATTRIBUTE_FAST_MEM static void lv_draw_map(const lv_area_t * map_area, const lv_area_t * clip_area,
|
||||
const uint8_t * map_p,
|
||||
const lv_draw_img_dsc_t * draw_dsc,
|
||||
bool chroma_key, bool alpha_byte);
|
||||
|
||||
static void show_error(const lv_area_t * coords, const lv_area_t * clip_area, const char * msg);
|
||||
static void show_error(lv_draw_ctx_t * draw_ctx, const lv_area_t * coords, const char * msg);
|
||||
static void draw_cleanup(_lv_img_cache_entry_t * cache);
|
||||
#endif
|
||||
|
||||
/**********************
|
||||
* STATIC VARIABLES
|
||||
|
@ -65,7 +52,6 @@ void lv_draw_img_dsc_init(lv_draw_img_dsc_t * dsc)
|
|||
dsc->antialias = LV_COLOR_DEPTH > 8 ? 1 : 0;
|
||||
}
|
||||
|
||||
#if LV_USE_EXTERNAL_RENDERER == 0
|
||||
/**
|
||||
* Draw an image
|
||||
* @param coords the coordinates of the image
|
||||
|
@ -73,26 +59,30 @@ void lv_draw_img_dsc_init(lv_draw_img_dsc_t * dsc)
|
|||
* @param src pointer to a lv_color_t array which contains the pixels of the image
|
||||
* @param dsc pointer to an initialized `lv_draw_img_dsc_t` variable
|
||||
*/
|
||||
void lv_draw_img(const lv_area_t * coords, const lv_area_t * mask, const void * src, const lv_draw_img_dsc_t * dsc)
|
||||
void lv_draw_img(lv_draw_ctx_t * draw_ctx, const lv_draw_img_dsc_t * dsc, const lv_area_t * coords, const void * src)
|
||||
{
|
||||
if(src == NULL) {
|
||||
LV_LOG_WARN("Image draw: src is NULL");
|
||||
show_error(coords, mask, "No\ndata");
|
||||
show_error(draw_ctx, coords, "No\ndata");
|
||||
return;
|
||||
}
|
||||
|
||||
if(dsc->opa <= LV_OPA_MIN) return;
|
||||
|
||||
lv_res_t res;
|
||||
res = lv_img_draw_core(coords, mask, src, dsc);
|
||||
if(draw_ctx->draw_img) {
|
||||
res = draw_ctx->draw_img(draw_ctx, dsc, coords, src);
|
||||
}
|
||||
else {
|
||||
res = decode_and_draw(draw_ctx, dsc, coords, src);
|
||||
}
|
||||
|
||||
if(res == LV_RES_INV) {
|
||||
LV_LOG_WARN("Image draw error");
|
||||
show_error(coords, mask, "No\ndata");
|
||||
show_error(draw_ctx, coords, "No\ndata");
|
||||
return;
|
||||
}
|
||||
}
|
||||
#endif //LV_USE_GPU_SDL_RENDER
|
||||
|
||||
/**
|
||||
* Get the pixel size of a color format in bits
|
||||
|
@ -151,10 +141,6 @@ bool lv_img_cf_is_chroma_keyed(lv_img_cf_t cf)
|
|||
switch(cf) {
|
||||
case LV_IMG_CF_TRUE_COLOR_CHROMA_KEYED:
|
||||
case LV_IMG_CF_RAW_CHROMA_KEYED:
|
||||
case LV_IMG_CF_INDEXED_1BIT:
|
||||
case LV_IMG_CF_INDEXED_2BIT:
|
||||
case LV_IMG_CF_INDEXED_4BIT:
|
||||
case LV_IMG_CF_INDEXED_8BIT:
|
||||
is_chroma_keyed = true;
|
||||
break;
|
||||
|
||||
|
@ -229,14 +215,20 @@ lv_img_src_t lv_img_src_get_type(const void * src)
|
|||
return img_src_type;
|
||||
}
|
||||
|
||||
void lv_draw_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)
|
||||
{
|
||||
if(draw_ctx->draw_img_decoded == NULL) return;
|
||||
|
||||
draw_ctx->draw_img_decoded(draw_ctx, dsc, coords, map_p, color_format);
|
||||
}
|
||||
|
||||
/**********************
|
||||
* STATIC FUNCTIONS
|
||||
**********************/
|
||||
|
||||
#if LV_USE_EXTERNAL_RENDERER == 0
|
||||
LV_ATTRIBUTE_FAST_MEM static lv_res_t lv_img_draw_core(const lv_area_t * coords, const lv_area_t * clip_area,
|
||||
const void * src,
|
||||
const lv_draw_img_dsc_t * draw_dsc)
|
||||
LV_ATTRIBUTE_FAST_MEM static lv_res_t decode_and_draw(lv_draw_ctx_t * draw_ctx, const lv_draw_img_dsc_t * draw_dsc,
|
||||
const lv_area_t * coords, const void * src)
|
||||
{
|
||||
if(draw_dsc->opa <= LV_OPA_MIN) return LV_RES_OK;
|
||||
|
||||
|
@ -244,13 +236,16 @@ LV_ATTRIBUTE_FAST_MEM static lv_res_t lv_img_draw_core(const lv_area_t * coords,
|
|||
|
||||
if(cdsc == NULL) return LV_RES_INV;
|
||||
|
||||
bool chroma_keyed = lv_img_cf_is_chroma_keyed(cdsc->dec_dsc.header.cf);
|
||||
bool alpha_byte = lv_img_cf_has_alpha(cdsc->dec_dsc.header.cf);
|
||||
|
||||
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_has_alpha(cdsc->dec_dsc.header.cf)) cf = LV_IMG_CF_TRUE_COLOR_ALPHA;
|
||||
else cf = LV_IMG_CF_TRUE_COLOR;
|
||||
|
||||
if(cdsc->dec_dsc.error_msg != NULL) {
|
||||
LV_LOG_WARN("Image draw error");
|
||||
|
||||
show_error(coords, clip_area, cdsc->dec_dsc.error_msg);
|
||||
show_error(draw_ctx, coords, cdsc->dec_dsc.error_msg);
|
||||
}
|
||||
/*The decoder could open the image and gave the entire uncompressed image.
|
||||
*Just draw it!*/
|
||||
|
@ -269,22 +264,25 @@ LV_ATTRIBUTE_FAST_MEM static lv_res_t lv_img_draw_core(const lv_area_t * coords,
|
|||
map_area_rot.y2 += coords->y1;
|
||||
}
|
||||
|
||||
lv_area_t mask_com; /*Common area of mask and coords*/
|
||||
lv_area_t clip_com; /*Common area of mask and coords*/
|
||||
bool union_ok;
|
||||
union_ok = _lv_area_intersect(&mask_com, clip_area, &map_area_rot);
|
||||
union_ok = _lv_area_intersect(&clip_com, draw_ctx->clip_area, &map_area_rot);
|
||||
/*Out of mask. There is nothing to draw so the image is drawn successfully.*/
|
||||
if(union_ok == false) {
|
||||
draw_cleanup(cdsc);
|
||||
return LV_RES_OK;
|
||||
}
|
||||
|
||||
lv_draw_map(coords, &mask_com, cdsc->dec_dsc.img_data, draw_dsc, chroma_keyed, alpha_byte);
|
||||
const lv_area_t * clip_area_ori = draw_ctx->clip_area;
|
||||
draw_ctx->clip_area = &clip_com;
|
||||
lv_draw_img_decoded(draw_ctx, draw_dsc, coords, cdsc->dec_dsc.img_data, cf);
|
||||
draw_ctx->clip_area = clip_area_ori;
|
||||
}
|
||||
/*The whole uncompressed image is not available. Try to read it line-by-line*/
|
||||
else {
|
||||
lv_area_t mask_com; /*Common area of mask and coords*/
|
||||
bool union_ok;
|
||||
union_ok = _lv_area_intersect(&mask_com, clip_area, coords);
|
||||
union_ok = _lv_area_intersect(&mask_com, draw_ctx->clip_area, coords);
|
||||
/*Out of mask. There is nothing to draw so the image is drawn successfully.*/
|
||||
if(union_ok == false) {
|
||||
draw_cleanup(cdsc);
|
||||
|
@ -296,6 +294,7 @@ LV_ATTRIBUTE_FAST_MEM static lv_res_t lv_img_draw_core(const lv_area_t * coords,
|
|||
uint8_t * buf = lv_mem_buf_get(lv_area_get_width(&mask_com) *
|
||||
LV_IMG_PX_SIZE_ALPHA_BYTE); /*+1 because of the possible alpha byte*/
|
||||
|
||||
const lv_area_t * clip_area_ori = draw_ctx->clip_area;
|
||||
lv_area_t line;
|
||||
lv_area_copy(&line, &mask_com);
|
||||
lv_area_set_height(&line, 1);
|
||||
|
@ -305,7 +304,7 @@ LV_ATTRIBUTE_FAST_MEM static lv_res_t lv_img_draw_core(const lv_area_t * coords,
|
|||
lv_res_t read_res;
|
||||
for(row = mask_com.y1; row <= mask_com.y2; row++) {
|
||||
lv_area_t mask_line;
|
||||
union_ok = _lv_area_intersect(&mask_line, clip_area, &line);
|
||||
union_ok = _lv_area_intersect(&mask_line, clip_area_ori, &line);
|
||||
if(union_ok == false) continue;
|
||||
|
||||
read_res = lv_img_decoder_read_line(&cdsc->dec_dsc, x, y, width, buf);
|
||||
|
@ -314,14 +313,17 @@ LV_ATTRIBUTE_FAST_MEM static lv_res_t lv_img_draw_core(const lv_area_t * coords,
|
|||
LV_LOG_WARN("Image draw can't read the line");
|
||||
lv_mem_buf_release(buf);
|
||||
draw_cleanup(cdsc);
|
||||
draw_ctx->clip_area = clip_area_ori;
|
||||
return LV_RES_INV;
|
||||
}
|
||||
|
||||
lv_draw_map(&line, &mask_line, buf, draw_dsc, chroma_keyed, alpha_byte);
|
||||
draw_ctx->clip_area = &mask_line;
|
||||
lv_draw_img_decoded(draw_ctx, draw_dsc, &line, buf, cf);
|
||||
line.y1++;
|
||||
line.y2++;
|
||||
y++;
|
||||
}
|
||||
draw_ctx->clip_area = clip_area_ori;
|
||||
lv_mem_buf_release(buf);
|
||||
}
|
||||
|
||||
|
@ -329,330 +331,17 @@ LV_ATTRIBUTE_FAST_MEM static lv_res_t lv_img_draw_core(const lv_area_t * coords,
|
|||
return LV_RES_OK;
|
||||
}
|
||||
|
||||
/**
|
||||
* Draw a color map to the display (image)
|
||||
* @param map_area coordinates the color map
|
||||
* @param clip_area the map will drawn only on this area (truncated to draw_buf area)
|
||||
* @param map_p pointer to a lv_color_t array
|
||||
* @param draw_dsc pointer to an initialized `lv_draw_img_dsc_t` variable
|
||||
* @param chroma_key true: enable transparency of LV_IMG_LV_COLOR_TRANSP color pixels
|
||||
* @param alpha_byte true: extra alpha byte is inserted for every pixel
|
||||
*/
|
||||
LV_ATTRIBUTE_FAST_MEM static void lv_draw_map(const lv_area_t * map_area, const lv_area_t * clip_area,
|
||||
const uint8_t * map_p,
|
||||
const lv_draw_img_dsc_t * draw_dsc,
|
||||
bool chroma_key, bool alpha_byte)
|
||||
{
|
||||
/*Use the clip area as draw area*/
|
||||
lv_area_t draw_area;
|
||||
lv_area_copy(&draw_area, clip_area);
|
||||
|
||||
lv_disp_t * disp = _lv_refr_get_disp_refreshing();
|
||||
lv_disp_draw_buf_t * draw_buf = lv_disp_get_draw_buf(disp);
|
||||
const lv_area_t * disp_area = &draw_buf->area;
|
||||
|
||||
/*Now `draw_area` has absolute coordinates.
|
||||
*Make it relative to `disp_area` to simplify draw to `disp_buf`*/
|
||||
draw_area.x1 -= disp_area->x1;
|
||||
draw_area.y1 -= disp_area->y1;
|
||||
draw_area.x2 -= disp_area->x1;
|
||||
draw_area.y2 -= disp_area->y1;
|
||||
|
||||
bool mask_any = lv_draw_mask_is_any(clip_area);
|
||||
|
||||
/*The simplest case just copy the pixels into the draw_buf*/
|
||||
if(!mask_any && draw_dsc->angle == 0 && draw_dsc->zoom == LV_IMG_ZOOM_NONE &&
|
||||
chroma_key == false && alpha_byte == false && draw_dsc->recolor_opa == LV_OPA_TRANSP) {
|
||||
_lv_blend_map(clip_area, map_area, (lv_color_t *)map_p, NULL, LV_DRAW_MASK_RES_FULL_COVER, draw_dsc->opa,
|
||||
draw_dsc->blend_mode);
|
||||
}
|
||||
|
||||
#if LV_USE_GPU_NXP_PXP
|
||||
/*Simple case without masking and transformations*/
|
||||
else if(!mask_any && draw_dsc->angle == 0 && draw_dsc->zoom == LV_IMG_ZOOM_NONE && alpha_byte == false &&
|
||||
chroma_key == true && draw_dsc->recolor_opa == LV_OPA_TRANSP) { /*copy with color keying (+ alpha)*/
|
||||
lv_gpu_nxp_pxp_enable_color_key();
|
||||
_lv_blend_map(clip_area, map_area, (lv_color_t *)map_p, NULL, LV_DRAW_MASK_RES_FULL_COVER, draw_dsc->opa,
|
||||
draw_dsc->blend_mode);
|
||||
lv_gpu_nxp_pxp_disable_color_key();
|
||||
}
|
||||
else if(!mask_any && draw_dsc->angle == 0 && draw_dsc->zoom == LV_IMG_ZOOM_NONE && alpha_byte == false &&
|
||||
chroma_key == false && draw_dsc->recolor_opa != LV_OPA_TRANSP) { /*copy with recolor (+ alpha)*/
|
||||
lv_gpu_nxp_pxp_enable_recolor(draw_dsc->recolor, draw_dsc->recolor_opa);
|
||||
_lv_blend_map(clip_area, map_area, (lv_color_t *)map_p, NULL, LV_DRAW_MASK_RES_FULL_COVER, draw_dsc->opa,
|
||||
draw_dsc->blend_mode);
|
||||
lv_gpu_nxp_pxp_disable_recolor();
|
||||
}
|
||||
#endif
|
||||
/*In the other cases every pixel need to be checked one-by-one*/
|
||||
else {
|
||||
//#if LV_DRAW_COMPLEX
|
||||
/*The pixel size in byte is different if an alpha byte is added too*/
|
||||
uint8_t px_size_byte = alpha_byte ? LV_IMG_PX_SIZE_ALPHA_BYTE : sizeof(lv_color_t);
|
||||
|
||||
/*Go to the first displayed pixel of the map*/
|
||||
int32_t map_w = lv_area_get_width(map_area);
|
||||
const uint8_t * map_buf_tmp = map_p;
|
||||
map_buf_tmp += map_w * (draw_area.y1 - (map_area->y1 - disp_area->y1)) * px_size_byte;
|
||||
map_buf_tmp += (draw_area.x1 - (map_area->x1 - disp_area->x1)) * px_size_byte;
|
||||
|
||||
lv_color_t c;
|
||||
lv_color_t chroma_keyed_color = LV_COLOR_CHROMA_KEY;
|
||||
uint32_t px_i = 0;
|
||||
|
||||
const uint8_t * map_px;
|
||||
|
||||
lv_coord_t draw_area_h = lv_area_get_height(&draw_area);
|
||||
lv_coord_t draw_area_w = lv_area_get_width(&draw_area);
|
||||
|
||||
lv_area_t blend_area;
|
||||
blend_area.x1 = draw_area.x1 + disp_area->x1;
|
||||
blend_area.x2 = blend_area.x1 + draw_area_w - 1;
|
||||
blend_area.y1 = disp_area->y1 + draw_area.y1;
|
||||
blend_area.y2 = blend_area.y1;
|
||||
|
||||
bool transform = draw_dsc->angle != 0 || draw_dsc->zoom != LV_IMG_ZOOM_NONE ? true : false;
|
||||
/*Simple ARGB image. Handle it as special case because it's very common*/
|
||||
if(!mask_any && !transform && !chroma_key && draw_dsc->recolor_opa == LV_OPA_TRANSP && alpha_byte) {
|
||||
#if LV_USE_GPU_STM32_DMA2D && LV_COLOR_DEPTH == 32
|
||||
/*Blend ARGB images directly*/
|
||||
if(lv_area_get_size(&draw_area) > 240) {
|
||||
int32_t disp_w = lv_area_get_width(disp_area);
|
||||
lv_color_t * disp_buf = draw_buf->buf_act;
|
||||
lv_color_t * disp_buf_first = disp_buf + disp_w * draw_area.y1 + draw_area.x1;
|
||||
lv_gpu_stm32_dma2d_blend(disp_buf_first, disp_w, (const lv_color_t *)map_buf_tmp, draw_dsc->opa, map_w, draw_area_w,
|
||||
draw_area_h);
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
uint32_t hor_res = (uint32_t) lv_disp_get_hor_res(disp);
|
||||
uint32_t mask_buf_size = lv_area_get_size(&draw_area) > (uint32_t) hor_res ? hor_res : lv_area_get_size(&draw_area);
|
||||
lv_color_t * map2 = lv_mem_buf_get(mask_buf_size * sizeof(lv_color_t));
|
||||
lv_opa_t * mask_buf = lv_mem_buf_get(mask_buf_size);
|
||||
|
||||
int32_t x;
|
||||
int32_t y;
|
||||
for(y = 0; y < draw_area_h; y++) {
|
||||
map_px = map_buf_tmp;
|
||||
for(x = 0; x < draw_area_w; x++, map_px += px_size_byte, px_i++) {
|
||||
lv_opa_t px_opa = map_px[LV_IMG_PX_SIZE_ALPHA_BYTE - 1];
|
||||
mask_buf[px_i] = px_opa;
|
||||
if(px_opa) {
|
||||
#if LV_COLOR_DEPTH == 8 || LV_COLOR_DEPTH == 1
|
||||
map2[px_i].full = map_px[0];
|
||||
#elif LV_COLOR_DEPTH == 16
|
||||
map2[px_i].full = map_px[0] + (map_px[1] << 8);
|
||||
#elif LV_COLOR_DEPTH == 32
|
||||
map2[px_i].full = *((uint32_t *)map_px);
|
||||
#endif
|
||||
}
|
||||
#if LV_COLOR_DEPTH == 32
|
||||
map2[px_i].ch.alpha = 0xFF;
|
||||
#endif
|
||||
}
|
||||
|
||||
map_buf_tmp += map_w * px_size_byte;
|
||||
if(px_i + draw_area_w < mask_buf_size) {
|
||||
blend_area.y2 ++;
|
||||
}
|
||||
else {
|
||||
_lv_blend_map(clip_area, &blend_area, map2, mask_buf, LV_DRAW_MASK_RES_CHANGED, draw_dsc->opa, draw_dsc->blend_mode);
|
||||
|
||||
blend_area.y1 = blend_area.y2 + 1;
|
||||
blend_area.y2 = blend_area.y1;
|
||||
|
||||
px_i = 0;
|
||||
}
|
||||
}
|
||||
/*Flush the last part*/
|
||||
if(blend_area.y1 != blend_area.y2) {
|
||||
blend_area.y2--;
|
||||
_lv_blend_map(clip_area, &blend_area, map2, mask_buf, LV_DRAW_MASK_RES_CHANGED, draw_dsc->opa, draw_dsc->blend_mode);
|
||||
}
|
||||
|
||||
lv_mem_buf_release(mask_buf);
|
||||
lv_mem_buf_release(map2);
|
||||
}
|
||||
/*Most complicated case: transform or other mask or chroma keyed*/
|
||||
else {
|
||||
/*Build the image and a mask line-by-line*/
|
||||
uint32_t hor_res = (uint32_t) lv_disp_get_hor_res(disp);
|
||||
uint32_t mask_buf_size = lv_area_get_size(&draw_area) > hor_res ? hor_res : lv_area_get_size(&draw_area);
|
||||
lv_color_t * map2 = lv_mem_buf_get(mask_buf_size * sizeof(lv_color_t));
|
||||
lv_opa_t * mask_buf = lv_mem_buf_get(mask_buf_size);
|
||||
|
||||
#if LV_DRAW_COMPLEX
|
||||
lv_img_transform_dsc_t trans_dsc;
|
||||
lv_memset_00(&trans_dsc, sizeof(lv_img_transform_dsc_t));
|
||||
if(transform) {
|
||||
lv_img_cf_t cf = LV_IMG_CF_TRUE_COLOR;
|
||||
if(alpha_byte) cf = LV_IMG_CF_TRUE_COLOR_ALPHA;
|
||||
else if(chroma_key) cf = LV_IMG_CF_TRUE_COLOR_CHROMA_KEYED;
|
||||
|
||||
trans_dsc.cfg.angle = draw_dsc->angle;
|
||||
trans_dsc.cfg.zoom = draw_dsc->zoom;
|
||||
trans_dsc.cfg.src = map_p;
|
||||
trans_dsc.cfg.src_w = map_w;
|
||||
trans_dsc.cfg.src_h = lv_area_get_height(map_area);;
|
||||
trans_dsc.cfg.cf = cf;
|
||||
trans_dsc.cfg.pivot_x = draw_dsc->pivot.x;
|
||||
trans_dsc.cfg.pivot_y = draw_dsc->pivot.y;
|
||||
trans_dsc.cfg.color = draw_dsc->recolor;
|
||||
trans_dsc.cfg.antialias = draw_dsc->antialias;
|
||||
|
||||
_lv_img_buf_transform_init(&trans_dsc);
|
||||
}
|
||||
#endif
|
||||
uint16_t recolor_premult[3] = {0};
|
||||
lv_opa_t recolor_opa_inv = 255 - draw_dsc->recolor_opa;
|
||||
if(draw_dsc->recolor_opa != 0) {
|
||||
lv_color_premult(draw_dsc->recolor, draw_dsc->recolor_opa, recolor_premult);
|
||||
}
|
||||
|
||||
lv_draw_mask_res_t mask_res;
|
||||
mask_res = (alpha_byte || chroma_key || draw_dsc->angle ||
|
||||
draw_dsc->zoom != LV_IMG_ZOOM_NONE) ? LV_DRAW_MASK_RES_CHANGED : LV_DRAW_MASK_RES_FULL_COVER;
|
||||
|
||||
/*Prepare the `mask_buf`if there are other masks*/
|
||||
if(mask_any) {
|
||||
lv_memset_ff(mask_buf, mask_buf_size);
|
||||
}
|
||||
|
||||
int32_t x;
|
||||
int32_t y;
|
||||
#if LV_DRAW_COMPLEX
|
||||
int32_t rot_y = disp_area->y1 + draw_area.y1 - map_area->y1;
|
||||
#endif
|
||||
for(y = 0; y < draw_area_h; y++) {
|
||||
map_px = map_buf_tmp;
|
||||
#if LV_DRAW_COMPLEX
|
||||
uint32_t px_i_start = px_i;
|
||||
int32_t rot_x = disp_area->x1 + draw_area.x1 - map_area->x1;
|
||||
#endif
|
||||
|
||||
for(x = 0; x < draw_area_w; x++, map_px += px_size_byte, px_i++) {
|
||||
|
||||
#if LV_DRAW_COMPLEX
|
||||
if(transform) {
|
||||
|
||||
/*Transform*/
|
||||
bool ret;
|
||||
ret = _lv_img_buf_transform(&trans_dsc, rot_x + x, rot_y + y);
|
||||
if(ret == false) {
|
||||
mask_buf[px_i] = LV_OPA_TRANSP;
|
||||
continue;
|
||||
}
|
||||
else {
|
||||
mask_buf[px_i] = trans_dsc.res.opa;
|
||||
c.full = trans_dsc.res.color.full;
|
||||
}
|
||||
}
|
||||
/*No transform*/
|
||||
else
|
||||
#endif
|
||||
{
|
||||
if(alpha_byte) {
|
||||
lv_opa_t px_opa = map_px[LV_IMG_PX_SIZE_ALPHA_BYTE - 1];
|
||||
mask_buf[px_i] = px_opa;
|
||||
if(px_opa == 0) {
|
||||
#if LV_COLOR_DEPTH == 32
|
||||
map2[px_i].full = 0;
|
||||
#endif
|
||||
continue;
|
||||
}
|
||||
}
|
||||
else {
|
||||
mask_buf[px_i] = 0xFF;
|
||||
}
|
||||
|
||||
#if LV_COLOR_DEPTH == 1
|
||||
c.full = map_px[0];
|
||||
#elif LV_COLOR_DEPTH == 8
|
||||
c.full = map_px[0];
|
||||
#elif LV_COLOR_DEPTH == 16
|
||||
c.full = map_px[0] + (map_px[1] << 8);
|
||||
#elif LV_COLOR_DEPTH == 32
|
||||
c.full = *((uint32_t *)map_px);
|
||||
c.ch.alpha = 0xFF;
|
||||
#endif
|
||||
if(chroma_key) {
|
||||
if(c.full == chroma_keyed_color.full) {
|
||||
mask_buf[px_i] = LV_OPA_TRANSP;
|
||||
#if LV_COLOR_DEPTH == 32
|
||||
map2[px_i].full = 0;
|
||||
#endif
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
if(draw_dsc->recolor_opa != 0) {
|
||||
c = lv_color_mix_premult(recolor_premult, c, recolor_opa_inv);
|
||||
}
|
||||
|
||||
map2[px_i].full = c.full;
|
||||
}
|
||||
#if LV_DRAW_COMPLEX
|
||||
/*Apply the masks if any*/
|
||||
if(mask_any) {
|
||||
lv_draw_mask_res_t mask_res_sub;
|
||||
mask_res_sub = lv_draw_mask_apply(mask_buf + px_i_start, draw_area.x1 + draw_buf->area.x1,
|
||||
y + draw_area.y1 + draw_buf->area.y1,
|
||||
draw_area_w);
|
||||
if(mask_res_sub == LV_DRAW_MASK_RES_TRANSP) {
|
||||
lv_memset_00(mask_buf + px_i_start, draw_area_w);
|
||||
mask_res = LV_DRAW_MASK_RES_CHANGED;
|
||||
}
|
||||
else if(mask_res_sub == LV_DRAW_MASK_RES_CHANGED) {
|
||||
mask_res = LV_DRAW_MASK_RES_CHANGED;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
map_buf_tmp += map_w * px_size_byte;
|
||||
if(px_i + draw_area_w < mask_buf_size) {
|
||||
blend_area.y2 ++;
|
||||
}
|
||||
else {
|
||||
|
||||
_lv_blend_map(clip_area, &blend_area, map2, mask_buf, mask_res, draw_dsc->opa, draw_dsc->blend_mode);
|
||||
|
||||
blend_area.y1 = blend_area.y2 + 1;
|
||||
blend_area.y2 = blend_area.y1;
|
||||
|
||||
px_i = 0;
|
||||
mask_res = (alpha_byte || chroma_key || draw_dsc->angle ||
|
||||
draw_dsc->zoom != LV_IMG_ZOOM_NONE) ? LV_DRAW_MASK_RES_CHANGED : LV_DRAW_MASK_RES_FULL_COVER;
|
||||
|
||||
/*Prepare the `mask_buf`if there are other masks*/
|
||||
if(mask_any) {
|
||||
lv_memset_ff(mask_buf, mask_buf_size);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*Flush the last part*/
|
||||
if(blend_area.y1 != blend_area.y2) {
|
||||
blend_area.y2--;
|
||||
_lv_blend_map(clip_area, &blend_area, map2, mask_buf, mask_res, draw_dsc->opa, draw_dsc->blend_mode);
|
||||
}
|
||||
|
||||
lv_mem_buf_release(mask_buf);
|
||||
lv_mem_buf_release(map2);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void show_error(const lv_area_t * coords, const lv_area_t * clip_area, const char * msg)
|
||||
static void show_error(lv_draw_ctx_t * draw_ctx, const lv_area_t * coords, const char * msg)
|
||||
{
|
||||
lv_draw_rect_dsc_t rect_dsc;
|
||||
lv_draw_rect_dsc_init(&rect_dsc);
|
||||
rect_dsc.bg_color = lv_color_white();
|
||||
lv_draw_rect(coords, clip_area, &rect_dsc);
|
||||
lv_draw_rect(draw_ctx, &rect_dsc, coords);
|
||||
|
||||
lv_draw_label_dsc_t label_dsc;
|
||||
lv_draw_label_dsc_init(&label_dsc);
|
||||
lv_draw_label(coords, clip_area, &label_dsc, msg, NULL);
|
||||
lv_draw_label(draw_ctx, &label_dsc, coords, msg, NULL);
|
||||
}
|
||||
|
||||
static void draw_cleanup(_lv_img_cache_entry_t * cache)
|
||||
|
@ -664,5 +353,3 @@ static void draw_cleanup(_lv_img_cache_entry_t * cache)
|
|||
LV_UNUSED(cache);
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif //LV_USE_GPU_SDL_RENDER
|
|
@ -15,7 +15,7 @@ extern "C" {
|
|||
*********************/
|
||||
#include "lv_img_decoder.h"
|
||||
#include "lv_img_buf.h"
|
||||
#include "lv_draw_blend.h"
|
||||
#include "../misc/lv_style.h"
|
||||
|
||||
/*********************
|
||||
* DEFINES
|
||||
|
@ -45,6 +45,8 @@ typedef struct {
|
|||
uint8_t antialias : 1;
|
||||
} lv_draw_img_dsc_t;
|
||||
|
||||
struct _lv_draw_ctx_t;
|
||||
|
||||
/**********************
|
||||
* GLOBAL PROTOTYPES
|
||||
**********************/
|
||||
|
@ -57,7 +59,12 @@ void lv_draw_img_dsc_init(lv_draw_img_dsc_t * dsc);
|
|||
* @param src pointer to a lv_color_t array which contains the pixels of the image
|
||||
* @param dsc pointer to an initialized `lv_draw_img_dsc_t` variable
|
||||
*/
|
||||
void lv_draw_img(const lv_area_t * coords, const lv_area_t * mask, const void * src, const lv_draw_img_dsc_t * dsc);
|
||||
void lv_draw_img(struct _lv_draw_ctx_t * draw_ctx, const lv_draw_img_dsc_t * dsc, const lv_area_t * coords,
|
||||
const void * src);
|
||||
|
||||
|
||||
void lv_draw_img_decoded(struct _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);
|
||||
|
||||
/**
|
||||
* Get the type of an image source
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
/*********************
|
||||
* INCLUDES
|
||||
*********************/
|
||||
#include "lv_draw.h"
|
||||
#include "lv_draw_label.h"
|
||||
#include "../misc/lv_math.h"
|
||||
#include "../hal/lv_hal_disp.h"
|
||||
|
@ -13,9 +14,6 @@
|
|||
#include "../misc/lv_bidi.h"
|
||||
#include "../misc/lv_assert.h"
|
||||
|
||||
#if LV_USE_GPU_SDL
|
||||
#include "../gpu/lv_gpu_sdl.h"
|
||||
#endif
|
||||
/*********************
|
||||
* DEFINES
|
||||
*********************/
|
||||
|
@ -36,17 +34,6 @@ typedef uint8_t cmd_state_t;
|
|||
* STATIC PROTOTYPES
|
||||
**********************/
|
||||
|
||||
#if LV_USE_EXTERNAL_RENDERER == 0
|
||||
LV_ATTRIBUTE_FAST_MEM static void draw_letter_normal(lv_coord_t pos_x, lv_coord_t pos_y, lv_font_glyph_dsc_t * g,
|
||||
const lv_area_t * clip_area,
|
||||
const uint8_t * map_p, lv_color_t color, lv_opa_t opa, lv_blend_mode_t blend_mode);
|
||||
|
||||
#if LV_DRAW_COMPLEX && LV_USE_FONT_SUBPX
|
||||
static void draw_letter_subpx(lv_coord_t pos_x, lv_coord_t pos_y, lv_font_glyph_dsc_t * g, const lv_area_t * clip_area,
|
||||
const uint8_t * map_p, lv_color_t color, lv_opa_t opa, lv_blend_mode_t blend_mode);
|
||||
#endif /*LV_DRAW_COMPLEX && LV_USE_FONT_SUBPX*/
|
||||
#endif /*LV_USE_EXTERNAL_RENDERER*/
|
||||
|
||||
static uint8_t hex_char_to_num(char hex);
|
||||
|
||||
/**********************
|
||||
|
@ -57,37 +44,6 @@ static uint8_t hex_char_to_num(char hex);
|
|||
* GLOBAL VARIABLES
|
||||
**********************/
|
||||
|
||||
const uint8_t _lv_bpp1_opa_table[2] = {0, 255}; /*Opacity mapping with bpp = 1 (Just for compatibility)*/
|
||||
const uint8_t _lv_bpp2_opa_table[4] = {0, 85, 170, 255}; /*Opacity mapping with bpp = 2*/
|
||||
|
||||
const uint8_t _lv_bpp3_opa_table[8] = {0, 36, 73, 109, /*Opacity mapping with bpp = 3*/
|
||||
146, 182, 219, 255
|
||||
};
|
||||
|
||||
const uint8_t _lv_bpp4_opa_table[16] = {0, 17, 34, 51, /*Opacity mapping with bpp = 4*/
|
||||
68, 85, 102, 119,
|
||||
136, 153, 170, 187,
|
||||
204, 221, 238, 255
|
||||
};
|
||||
|
||||
const uint8_t _lv_bpp8_opa_table[256] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
|
||||
16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31,
|
||||
32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47,
|
||||
48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63,
|
||||
64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79,
|
||||
80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95,
|
||||
96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
|
||||
112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127,
|
||||
128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143,
|
||||
144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159,
|
||||
160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175,
|
||||
176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191,
|
||||
192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207,
|
||||
208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223,
|
||||
224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239,
|
||||
240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255
|
||||
};
|
||||
|
||||
/**********************
|
||||
* MACROS
|
||||
**********************/
|
||||
|
@ -96,7 +52,7 @@ const uint8_t _lv_bpp8_opa_table[256] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 1
|
|||
* GLOBAL FUNCTIONS
|
||||
**********************/
|
||||
|
||||
LV_ATTRIBUTE_FAST_MEM void lv_draw_label_dsc_init(lv_draw_label_dsc_t * dsc)
|
||||
void lv_draw_label_dsc_init(lv_draw_label_dsc_t * dsc)
|
||||
{
|
||||
lv_memset_00(dsc, sizeof(lv_draw_label_dsc_t));
|
||||
dsc->opa = LV_OPA_COVER;
|
||||
|
@ -118,13 +74,22 @@ LV_ATTRIBUTE_FAST_MEM void lv_draw_label_dsc_init(lv_draw_label_dsc_t * dsc)
|
|||
* @param hint pointer to a `lv_draw_label_hint_t` variable.
|
||||
* It is managed by the draw to speed up the drawing of very long texts (thousands of lines).
|
||||
*/
|
||||
LV_ATTRIBUTE_FAST_MEM void lv_draw_label(const lv_area_t * coords, const lv_area_t * mask,
|
||||
const lv_draw_label_dsc_t * dsc,
|
||||
const char * txt,
|
||||
lv_draw_label_hint_t * hint)
|
||||
LV_ATTRIBUTE_FAST_MEM void lv_draw_label(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)
|
||||
{
|
||||
|
||||
if(dsc->opa <= LV_OPA_MIN) return;
|
||||
if(dsc->font == NULL) {
|
||||
LV_LOG_WARN("dsc->font == NULL");
|
||||
return;
|
||||
}
|
||||
|
||||
if(draw_ctx->draw_letter == NULL) {
|
||||
LV_LOG_WARN("draw->draw_letter == NULL (there is no function to draw letters)");
|
||||
return;
|
||||
}
|
||||
|
||||
lv_draw_label_dsc_t dsc_mod = *dsc;
|
||||
|
||||
const lv_font_t * font = dsc->font;
|
||||
int32_t w;
|
||||
|
||||
|
@ -133,7 +98,7 @@ LV_ATTRIBUTE_FAST_MEM void lv_draw_label(const lv_area_t * coords, const lv_area
|
|||
return;
|
||||
|
||||
lv_area_t clipped_area;
|
||||
bool clip_ok = _lv_area_intersect(&clipped_area, coords, mask);
|
||||
bool clip_ok = _lv_area_intersect(&clipped_area, coords, draw_ctx->clip_area);
|
||||
if(!clip_ok) return;
|
||||
|
||||
lv_text_align_t align = dsc->align;
|
||||
|
@ -146,7 +111,7 @@ LV_ATTRIBUTE_FAST_MEM void lv_draw_label(const lv_area_t * coords, const lv_area
|
|||
w = lv_area_get_width(coords);
|
||||
}
|
||||
else {
|
||||
/*If EXAPND is enabled then not limit the text's width to the object's width*/
|
||||
/*If EXPAND is enabled then not limit the text's width to the object's width*/
|
||||
lv_point_t p;
|
||||
lv_txt_get_size(&p, txt, dsc->font, dsc->letter_space, dsc->line_space, LV_COORD_MAX,
|
||||
dsc->flag);
|
||||
|
@ -186,13 +151,13 @@ LV_ATTRIBUTE_FAST_MEM void lv_draw_label(const lv_area_t * coords, const lv_area
|
|||
pos.y += hint->y;
|
||||
}
|
||||
|
||||
uint32_t line_end = line_start + _lv_txt_get_next_line(&txt[line_start], font, dsc->letter_space, w, dsc->flag);
|
||||
uint32_t line_end = line_start + _lv_txt_get_next_line(&txt[line_start], font, dsc->letter_space, w, NULL, dsc->flag);
|
||||
|
||||
/*Go the first visible line*/
|
||||
while(pos.y + line_height_font < mask->y1) {
|
||||
while(pos.y + line_height_font < draw_ctx->clip_area->y1) {
|
||||
/*Go to next line*/
|
||||
line_start = line_end;
|
||||
line_end += _lv_txt_get_next_line(&txt[line_start], font, dsc->letter_space, w, dsc->flag);
|
||||
line_end += _lv_txt_get_next_line(&txt[line_start], font, dsc->letter_space, w, NULL, dsc->flag);
|
||||
pos.y += line_height;
|
||||
|
||||
/*Save at the threshold coordinate*/
|
||||
|
@ -217,9 +182,6 @@ LV_ATTRIBUTE_FAST_MEM void lv_draw_label(const lv_area_t * coords, const lv_area
|
|||
line_width = lv_txt_get_width(&txt[line_start], line_end - line_start, font, dsc->letter_space, dsc->flag);
|
||||
pos.x += lv_area_get_width(coords) - line_width;
|
||||
}
|
||||
|
||||
lv_opa_t opa = dsc->opa;
|
||||
|
||||
uint32_t sel_start = dsc->sel_start;
|
||||
uint32_t sel_end = dsc->sel_end;
|
||||
if(sel_start > sel_end) {
|
||||
|
@ -241,6 +203,7 @@ LV_ATTRIBUTE_FAST_MEM void lv_draw_label(const lv_area_t * coords, const lv_area
|
|||
uint32_t i;
|
||||
uint32_t par_start = 0;
|
||||
lv_color_t recolor;
|
||||
lv_color_t color = lv_color_black();
|
||||
int32_t letter_w;
|
||||
|
||||
lv_draw_rect_dsc_t draw_dsc_sel;
|
||||
|
@ -317,7 +280,7 @@ LV_ATTRIBUTE_FAST_MEM void lv_draw_label(const lv_area_t * coords, const lv_area
|
|||
}
|
||||
}
|
||||
|
||||
lv_color_t color = dsc->color;
|
||||
color = dsc->color;
|
||||
|
||||
if(cmd_state == CMD_STATE_IN) color = recolor;
|
||||
|
||||
|
@ -330,12 +293,13 @@ LV_ATTRIBUTE_FAST_MEM void lv_draw_label(const lv_area_t * coords, const lv_area
|
|||
sel_coords.y1 = pos.y;
|
||||
sel_coords.x2 = pos.x + letter_w + dsc->letter_space - 1;
|
||||
sel_coords.y2 = pos.y + line_height - 1;
|
||||
lv_draw_rect(&sel_coords, mask, &draw_dsc_sel);
|
||||
lv_draw_rect(draw_ctx, &draw_dsc_sel, &sel_coords);
|
||||
color = dsc->sel_color;
|
||||
}
|
||||
}
|
||||
|
||||
lv_draw_letter(&pos, mask, font, letter, color, opa, dsc->blend_mode);
|
||||
dsc_mod.color = color;
|
||||
lv_draw_letter(draw_ctx, &dsc_mod, &pos, letter);
|
||||
|
||||
if(letter_w > 0) {
|
||||
pos.x += letter_w + dsc->letter_space;
|
||||
|
@ -349,7 +313,8 @@ LV_ATTRIBUTE_FAST_MEM void lv_draw_label(const lv_area_t * coords, const lv_area
|
|||
p1.y = pos.y + (dsc->font->line_height / 2) + line_dsc.width / 2;
|
||||
p2.x = pos.x;
|
||||
p2.y = p1.y;
|
||||
lv_draw_line(&p1, &p2, mask, &line_dsc);
|
||||
line_dsc.color = color;
|
||||
lv_draw_line(draw_ctx, &line_dsc, &p1, &p2);
|
||||
}
|
||||
|
||||
if(dsc->decor & LV_TEXT_DECOR_UNDERLINE) {
|
||||
|
@ -359,7 +324,8 @@ LV_ATTRIBUTE_FAST_MEM void lv_draw_label(const lv_area_t * coords, const lv_area
|
|||
p1.y = pos.y + dsc->font->line_height - dsc->font->base_line - font->underline_position;
|
||||
p2.x = pos.x;
|
||||
p2.y = p1.y;
|
||||
lv_draw_line(&p1, &p2, mask, &line_dsc);
|
||||
line_dsc.color = color;
|
||||
lv_draw_line(draw_ctx, &line_dsc, &p1, &p2);
|
||||
}
|
||||
|
||||
#if LV_USE_BIDI
|
||||
|
@ -368,7 +334,7 @@ LV_ATTRIBUTE_FAST_MEM void lv_draw_label(const lv_area_t * coords, const lv_area
|
|||
#endif
|
||||
/*Go to next line*/
|
||||
line_start = line_end;
|
||||
line_end += _lv_txt_get_next_line(&txt[line_start], font, dsc->letter_space, w, dsc->flag);
|
||||
line_end += _lv_txt_get_next_line(&txt[line_start], font, dsc->letter_space, w, NULL, dsc->flag);
|
||||
|
||||
pos.x = coords->x1;
|
||||
/*Align to middle*/
|
||||
|
@ -389,450 +355,23 @@ LV_ATTRIBUTE_FAST_MEM void lv_draw_label(const lv_area_t * coords, const lv_area
|
|||
/*Go the next line position*/
|
||||
pos.y += line_height;
|
||||
|
||||
if(pos.y > mask->y2) return;
|
||||
if(pos.y > draw_ctx->clip_area->y2) return;
|
||||
}
|
||||
|
||||
LV_ASSERT_MEM_INTEGRITY();
|
||||
}
|
||||
|
||||
#if LV_USE_EXTERNAL_RENDERER == 0
|
||||
void lv_draw_letter(lv_draw_ctx_t * draw_ctx, const lv_draw_label_dsc_t * dsc, const lv_point_t * pos_p,
|
||||
uint32_t letter)
|
||||
{
|
||||
draw_ctx->draw_letter(draw_ctx, dsc, pos_p, letter);
|
||||
}
|
||||
|
||||
|
||||
/**********************
|
||||
* STATIC FUNCTIONS
|
||||
**********************/
|
||||
|
||||
/**
|
||||
* Draw a letter in the Virtual Display Buffer
|
||||
* @param pos_p left-top coordinate of the latter
|
||||
* @param mask_p the letter will be drawn only on this area (truncated to draw_buf area)
|
||||
* @param font_p pointer to font
|
||||
* @param letter a letter to draw
|
||||
* @param color color of letter
|
||||
* @param opa opacity of letter (0..255)
|
||||
*/
|
||||
LV_ATTRIBUTE_FAST_MEM void lv_draw_letter(const lv_point_t * pos_p, const lv_area_t * clip_area,
|
||||
const lv_font_t * font_p,
|
||||
uint32_t letter,
|
||||
lv_color_t color, lv_opa_t opa, lv_blend_mode_t blend_mode)
|
||||
{
|
||||
if(opa < LV_OPA_MIN) return;
|
||||
if(opa > LV_OPA_MAX) opa = LV_OPA_COVER;
|
||||
|
||||
if(font_p == NULL) {
|
||||
LV_LOG_WARN("lv_draw_letter: font is NULL");
|
||||
return;
|
||||
}
|
||||
|
||||
lv_font_glyph_dsc_t g;
|
||||
bool g_ret = lv_font_get_glyph_dsc(font_p, &g, letter, '\0');
|
||||
if(g_ret == false) {
|
||||
/*Add warning if the dsc is not found
|
||||
*but do not print warning for non printable ASCII chars (e.g. '\n')*/
|
||||
if(letter >= 0x20 &&
|
||||
letter != 0xf8ff && /*LV_SYMBOL_DUMMY*/
|
||||
letter != 0x200c) { /*ZERO WIDTH NON-JOINER*/
|
||||
LV_LOG_WARN("lv_draw_letter: glyph dsc. not found for U+%X", (unsigned int)letter);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
/*Don't draw anything if the character is empty. E.g. space*/
|
||||
if((g.box_h == 0) || (g.box_w == 0)) return;
|
||||
|
||||
int32_t pos_x = pos_p->x + g.ofs_x;
|
||||
int32_t pos_y = pos_p->y + (font_p->line_height - font_p->base_line) - g.box_h - g.ofs_y;
|
||||
|
||||
/*If the letter is completely out of mask don't draw it*/
|
||||
if(pos_x + g.box_w < clip_area->x1 ||
|
||||
pos_x > clip_area->x2 ||
|
||||
pos_y + g.box_h < clip_area->y1 ||
|
||||
pos_y > clip_area->y2) {
|
||||
return;
|
||||
}
|
||||
|
||||
const uint8_t * map_p = lv_font_get_glyph_bitmap(font_p, letter);
|
||||
if(map_p == NULL) {
|
||||
LV_LOG_WARN("lv_draw_letter: character's bitmap not found");
|
||||
return;
|
||||
}
|
||||
|
||||
if(font_p->subpx) {
|
||||
#if LV_DRAW_COMPLEX && LV_USE_FONT_SUBPX
|
||||
draw_letter_subpx(pos_x, pos_y, &g, clip_area, map_p, color, opa, blend_mode);
|
||||
#else
|
||||
LV_LOG_WARN("Can't draw sub-pixel rendered letter because LV_USE_FONT_SUBPX == 0 in lv_conf.h");
|
||||
#endif
|
||||
}
|
||||
else {
|
||||
draw_letter_normal(pos_x, pos_y, &g, clip_area, map_p, color, opa, blend_mode);
|
||||
}
|
||||
}
|
||||
|
||||
LV_ATTRIBUTE_FAST_MEM static void draw_letter_normal(lv_coord_t pos_x, lv_coord_t pos_y, lv_font_glyph_dsc_t * g,
|
||||
const lv_area_t * clip_area,
|
||||
const uint8_t * map_p, lv_color_t color, lv_opa_t opa, lv_blend_mode_t blend_mode)
|
||||
{
|
||||
const uint8_t * bpp_opa_table_p;
|
||||
uint32_t bitmask_init;
|
||||
uint32_t bitmask;
|
||||
uint32_t bpp = g->bpp;
|
||||
uint32_t shades;
|
||||
if(bpp == 3) bpp = 4;
|
||||
|
||||
switch(bpp) {
|
||||
case 1:
|
||||
bpp_opa_table_p = _lv_bpp1_opa_table;
|
||||
bitmask_init = 0x80;
|
||||
shades = 2;
|
||||
break;
|
||||
case 2:
|
||||
bpp_opa_table_p = _lv_bpp2_opa_table;
|
||||
bitmask_init = 0xC0;
|
||||
shades = 4;
|
||||
break;
|
||||
case 4:
|
||||
bpp_opa_table_p = _lv_bpp4_opa_table;
|
||||
bitmask_init = 0xF0;
|
||||
shades = 16;
|
||||
break;
|
||||
case 8:
|
||||
bpp_opa_table_p = _lv_bpp8_opa_table;
|
||||
bitmask_init = 0xFF;
|
||||
shades = 256;
|
||||
break; /*No opa table, pixel value will be used directly*/
|
||||
default:
|
||||
LV_LOG_WARN("lv_draw_letter: invalid bpp");
|
||||
return; /*Invalid bpp. Can't render the letter*/
|
||||
}
|
||||
|
||||
static lv_opa_t opa_table[256];
|
||||
static lv_opa_t prev_opa = LV_OPA_TRANSP;
|
||||
static uint32_t prev_bpp = 0;
|
||||
if(opa < LV_OPA_MAX) {
|
||||
if(prev_opa != opa || prev_bpp != bpp) {
|
||||
uint32_t i;
|
||||
for(i = 0; i < shades; i++) {
|
||||
opa_table[i] = bpp_opa_table_p[i] == LV_OPA_COVER ? opa : ((bpp_opa_table_p[i] * opa) >> 8);
|
||||
}
|
||||
}
|
||||
bpp_opa_table_p = opa_table;
|
||||
prev_opa = opa;
|
||||
prev_bpp = bpp;
|
||||
}
|
||||
|
||||
int32_t col, row;
|
||||
int32_t box_w = g->box_w;
|
||||
int32_t box_h = g->box_h;
|
||||
int32_t width_bit = box_w * bpp; /*Letter width in bits*/
|
||||
|
||||
/*Calculate the col/row start/end on the map*/
|
||||
int32_t col_start = pos_x >= clip_area->x1 ? 0 : clip_area->x1 - pos_x;
|
||||
int32_t col_end = pos_x + box_w <= clip_area->x2 ? box_w : clip_area->x2 - pos_x + 1;
|
||||
int32_t row_start = pos_y >= clip_area->y1 ? 0 : clip_area->y1 - pos_y;
|
||||
int32_t row_end = pos_y + box_h <= clip_area->y2 ? box_h : clip_area->y2 - pos_y + 1;
|
||||
|
||||
/*Move on the map too*/
|
||||
uint32_t bit_ofs = (row_start * width_bit) + (col_start * bpp);
|
||||
map_p += bit_ofs >> 3;
|
||||
|
||||
uint8_t letter_px;
|
||||
uint32_t col_bit;
|
||||
col_bit = bit_ofs & 0x7; /*"& 0x7" equals to "% 8" just faster*/
|
||||
|
||||
lv_coord_t hor_res = lv_disp_get_hor_res(_lv_refr_get_disp_refreshing());
|
||||
uint32_t mask_buf_size = box_w * box_h > hor_res ? hor_res : box_w * box_h;
|
||||
lv_opa_t * mask_buf = lv_mem_buf_get(mask_buf_size);
|
||||
int32_t mask_p = 0;
|
||||
|
||||
lv_area_t fill_area;
|
||||
fill_area.x1 = col_start + pos_x;
|
||||
fill_area.x2 = col_end + pos_x - 1;
|
||||
fill_area.y1 = row_start + pos_y;
|
||||
fill_area.y2 = fill_area.y1;
|
||||
#if LV_DRAW_COMPLEX
|
||||
bool mask_any = lv_draw_mask_is_any(&fill_area);
|
||||
#endif
|
||||
|
||||
uint32_t col_bit_max = 8 - bpp;
|
||||
uint32_t col_bit_row_ofs = (box_w + col_start - col_end) * bpp;
|
||||
|
||||
for(row = row_start ; row < row_end; row++) {
|
||||
#if LV_DRAW_COMPLEX
|
||||
int32_t mask_p_start = mask_p;
|
||||
#endif
|
||||
bitmask = bitmask_init >> col_bit;
|
||||
for(col = col_start; col < col_end; col++) {
|
||||
/*Load the pixel's opacity into the mask*/
|
||||
letter_px = (*map_p & bitmask) >> (col_bit_max - col_bit);
|
||||
if(letter_px) {
|
||||
mask_buf[mask_p] = bpp_opa_table_p[letter_px];
|
||||
}
|
||||
else {
|
||||
mask_buf[mask_p] = 0;
|
||||
}
|
||||
|
||||
/*Go to the next column*/
|
||||
if(col_bit < col_bit_max) {
|
||||
col_bit += bpp;
|
||||
bitmask = bitmask >> bpp;
|
||||
}
|
||||
else {
|
||||
col_bit = 0;
|
||||
bitmask = bitmask_init;
|
||||
map_p++;
|
||||
}
|
||||
|
||||
/*Next mask byte*/
|
||||
mask_p++;
|
||||
}
|
||||
|
||||
#if LV_DRAW_COMPLEX
|
||||
/*Apply masks if any*/
|
||||
if(mask_any) {
|
||||
lv_draw_mask_res_t mask_res = lv_draw_mask_apply(mask_buf + mask_p_start, fill_area.x1, fill_area.y2,
|
||||
lv_area_get_width(&fill_area));
|
||||
if(mask_res == LV_DRAW_MASK_RES_TRANSP) {
|
||||
lv_memset_00(mask_buf + mask_p_start, lv_area_get_width(&fill_area));
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
if((uint32_t) mask_p + (col_end - col_start) < mask_buf_size) {
|
||||
fill_area.y2 ++;
|
||||
}
|
||||
else {
|
||||
_lv_blend_fill(clip_area, &fill_area,
|
||||
color, mask_buf, LV_DRAW_MASK_RES_CHANGED, LV_OPA_COVER,
|
||||
blend_mode);
|
||||
|
||||
fill_area.y1 = fill_area.y2 + 1;
|
||||
fill_area.y2 = fill_area.y1;
|
||||
mask_p = 0;
|
||||
}
|
||||
|
||||
col_bit += col_bit_row_ofs;
|
||||
map_p += (col_bit >> 3);
|
||||
col_bit = col_bit & 0x7;
|
||||
}
|
||||
|
||||
/*Flush the last part*/
|
||||
if(fill_area.y1 != fill_area.y2) {
|
||||
fill_area.y2--;
|
||||
_lv_blend_fill(clip_area, &fill_area,
|
||||
color, mask_buf, LV_DRAW_MASK_RES_CHANGED, LV_OPA_COVER,
|
||||
blend_mode);
|
||||
mask_p = 0;
|
||||
}
|
||||
|
||||
lv_mem_buf_release(mask_buf);
|
||||
}
|
||||
|
||||
#if LV_DRAW_COMPLEX && LV_USE_FONT_SUBPX
|
||||
static void draw_letter_subpx(lv_coord_t pos_x, lv_coord_t pos_y, lv_font_glyph_dsc_t * g, const lv_area_t * clip_area,
|
||||
const uint8_t * map_p, lv_color_t color, lv_opa_t opa, lv_blend_mode_t blend_mode)
|
||||
{
|
||||
const uint8_t * bpp_opa_table;
|
||||
uint32_t bitmask_init;
|
||||
uint32_t bitmask;
|
||||
uint32_t bpp = g->bpp;
|
||||
if(bpp == 3) bpp = 4;
|
||||
|
||||
switch(bpp) {
|
||||
case 1:
|
||||
bpp_opa_table = _lv_bpp1_opa_table;
|
||||
bitmask_init = 0x80;
|
||||
break;
|
||||
case 2:
|
||||
bpp_opa_table = _lv_bpp2_opa_table;
|
||||
bitmask_init = 0xC0;
|
||||
break;
|
||||
case 4:
|
||||
bpp_opa_table = _lv_bpp4_opa_table;
|
||||
bitmask_init = 0xF0;
|
||||
break;
|
||||
case 8:
|
||||
bpp_opa_table = _lv_bpp8_opa_table;
|
||||
bitmask_init = 0xFF;
|
||||
break; /*No opa table, pixel value will be used directly*/
|
||||
default:
|
||||
LV_LOG_WARN("lv_draw_letter: invalid bpp not found");
|
||||
return; /*Invalid bpp. Can't render the letter*/
|
||||
}
|
||||
|
||||
int32_t col, row;
|
||||
|
||||
int32_t box_w = g->box_w;
|
||||
int32_t box_h = g->box_h;
|
||||
int32_t width_bit = box_w * bpp; /*Letter width in bits*/
|
||||
|
||||
/*Calculate the col/row start/end on the map*/
|
||||
int32_t col_start = pos_x >= clip_area->x1 ? 0 : (clip_area->x1 - pos_x) * 3;
|
||||
int32_t col_end = pos_x + box_w / 3 <= clip_area->x2 ? box_w : (clip_area->x2 - pos_x + 1) * 3;
|
||||
int32_t row_start = pos_y >= clip_area->y1 ? 0 : clip_area->y1 - pos_y;
|
||||
int32_t row_end = pos_y + box_h <= clip_area->y2 ? box_h : clip_area->y2 - pos_y + 1;
|
||||
|
||||
/*Move on the map too*/
|
||||
int32_t bit_ofs = (row_start * width_bit) + (col_start * bpp);
|
||||
map_p += bit_ofs >> 3;
|
||||
|
||||
uint8_t letter_px;
|
||||
lv_opa_t px_opa;
|
||||
int32_t col_bit;
|
||||
col_bit = bit_ofs & 0x7; /*"& 0x7" equals to "% 8" just faster*/
|
||||
|
||||
lv_area_t map_area;
|
||||
map_area.x1 = col_start / 3 + pos_x;
|
||||
map_area.x2 = col_end / 3 + pos_x - 1;
|
||||
map_area.y1 = row_start + pos_y;
|
||||
map_area.y2 = map_area.y1;
|
||||
|
||||
if(map_area.x2 <= map_area.x1) return;
|
||||
|
||||
int32_t mask_buf_size = box_w * box_h > _LV_MASK_BUF_MAX_SIZE ? _LV_MASK_BUF_MAX_SIZE : g->box_w * g->box_h;
|
||||
lv_opa_t * mask_buf = lv_mem_buf_get(mask_buf_size);
|
||||
int32_t mask_p = 0;
|
||||
|
||||
lv_color_t * color_buf = lv_mem_buf_get(mask_buf_size * sizeof(lv_color_t));
|
||||
|
||||
lv_disp_t * disp = _lv_refr_get_disp_refreshing();
|
||||
lv_disp_draw_buf_t * draw_buf = lv_disp_get_draw_buf(disp);
|
||||
|
||||
int32_t disp_buf_width = lv_area_get_width(&draw_buf->area);
|
||||
lv_color_t * disp_buf_buf_tmp = draw_buf->buf_act;
|
||||
|
||||
/*Set a pointer on draw_buf to the first pixel of the letter*/
|
||||
disp_buf_buf_tmp += ((pos_y - draw_buf->area.y1) * disp_buf_width) + pos_x - draw_buf->area.x1;
|
||||
|
||||
/*If the letter is partially out of mask the move there on draw_buf*/
|
||||
disp_buf_buf_tmp += (row_start * disp_buf_width) + col_start / 3;
|
||||
|
||||
bool mask_any = lv_draw_mask_is_any(&map_area);
|
||||
uint8_t font_rgb[3];
|
||||
|
||||
#if LV_COLOR_16_SWAP == 0
|
||||
uint8_t txt_rgb[3] = {color.ch.red, color.ch.green, color.ch.blue};
|
||||
#else
|
||||
uint8_t txt_rgb[3] = {color.ch.red, (color.ch.green_h << 3) + color.ch.green_l, color.ch.blue};
|
||||
#endif
|
||||
|
||||
for(row = row_start ; row < row_end; row++) {
|
||||
uint32_t subpx_cnt = 0;
|
||||
bitmask = bitmask_init >> col_bit;
|
||||
int32_t mask_p_start = mask_p;
|
||||
|
||||
for(col = col_start; col < col_end; col++) {
|
||||
/*Load the pixel's opacity into the mask*/
|
||||
letter_px = (*map_p & bitmask) >> (8 - col_bit - bpp);
|
||||
if(letter_px != 0) {
|
||||
if(opa == LV_OPA_COVER) {
|
||||
px_opa = bpp == 8 ? letter_px : bpp_opa_table[letter_px];
|
||||
}
|
||||
else {
|
||||
px_opa = bpp == 8 ? (uint32_t)((uint32_t)letter_px * opa) >> 8
|
||||
: (uint32_t)((uint32_t)bpp_opa_table[letter_px] * opa) >> 8;
|
||||
}
|
||||
}
|
||||
else {
|
||||
px_opa = 0;
|
||||
}
|
||||
|
||||
font_rgb[subpx_cnt] = px_opa;
|
||||
|
||||
subpx_cnt ++;
|
||||
if(subpx_cnt == 3) {
|
||||
subpx_cnt = 0;
|
||||
|
||||
lv_color_t res_color;
|
||||
#if LV_COLOR_16_SWAP == 0
|
||||
uint8_t bg_rgb[3] = {disp_buf_buf_tmp->ch.red, disp_buf_buf_tmp->ch.green, disp_buf_buf_tmp->ch.blue};
|
||||
#else
|
||||
uint8_t bg_rgb[3] = {disp_buf_buf_tmp->ch.red,
|
||||
(disp_buf_buf_tmp->ch.green_h << 3) + disp_buf_buf_tmp->ch.green_l,
|
||||
disp_buf_buf_tmp->ch.blue
|
||||
};
|
||||
#endif
|
||||
|
||||
#if LV_FONT_SUBPX_BGR
|
||||
res_color.ch.blue = (uint32_t)((uint32_t)txt_rgb[0] * font_rgb[0] + (bg_rgb[0] * (255 - font_rgb[0]))) >> 8;
|
||||
res_color.ch.red = (uint32_t)((uint32_t)txt_rgb[2] * font_rgb[2] + (bg_rgb[2] * (255 - font_rgb[2]))) >> 8;
|
||||
#else
|
||||
res_color.ch.red = (uint32_t)((uint16_t)txt_rgb[0] * font_rgb[0] + (bg_rgb[0] * (255 - font_rgb[0]))) >> 8;
|
||||
res_color.ch.blue = (uint32_t)((uint16_t)txt_rgb[2] * font_rgb[2] + (bg_rgb[2] * (255 - font_rgb[2]))) >> 8;
|
||||
#endif
|
||||
|
||||
#if LV_COLOR_16_SWAP == 0
|
||||
res_color.ch.green = (uint32_t)((uint32_t)txt_rgb[1] * font_rgb[1] + (bg_rgb[1] * (255 - font_rgb[1]))) >> 8;
|
||||
#else
|
||||
uint8_t green = (uint32_t)((uint32_t)txt_rgb[1] * font_rgb[1] + (bg_rgb[1] * (255 - font_rgb[1]))) >> 8;
|
||||
res_color.ch.green_h = green >> 3;
|
||||
res_color.ch.green_l = green & 0x7;
|
||||
#endif
|
||||
|
||||
#if LV_COLOR_DEPTH == 32
|
||||
res_color.ch.alpha = 0xff;
|
||||
#endif
|
||||
|
||||
if(font_rgb[0] == 0 && font_rgb[1] == 0 && font_rgb[2] == 0) mask_buf[mask_p] = LV_OPA_TRANSP;
|
||||
else mask_buf[mask_p] = LV_OPA_COVER;
|
||||
color_buf[mask_p] = res_color;
|
||||
|
||||
/*Next mask byte*/
|
||||
mask_p++;
|
||||
disp_buf_buf_tmp++;
|
||||
}
|
||||
|
||||
/*Go to the next column*/
|
||||
if(col_bit < (int32_t)(8 - bpp)) {
|
||||
col_bit += bpp;
|
||||
bitmask = bitmask >> bpp;
|
||||
}
|
||||
else {
|
||||
col_bit = 0;
|
||||
bitmask = bitmask_init;
|
||||
map_p++;
|
||||
}
|
||||
}
|
||||
|
||||
/*Apply masks if any*/
|
||||
if(mask_any) {
|
||||
lv_draw_mask_res_t mask_res = lv_draw_mask_apply(mask_buf + mask_p_start, map_area.x1, map_area.y2,
|
||||
lv_area_get_width(&map_area));
|
||||
if(mask_res == LV_DRAW_MASK_RES_TRANSP) {
|
||||
lv_memset_00(mask_buf + mask_p_start, lv_area_get_width(&map_area));
|
||||
}
|
||||
}
|
||||
|
||||
if((int32_t) mask_p + (col_end - col_start) < mask_buf_size) {
|
||||
map_area.y2 ++;
|
||||
}
|
||||
else {
|
||||
_lv_blend_map(clip_area, &map_area, color_buf, mask_buf, LV_DRAW_MASK_RES_CHANGED, opa, blend_mode);
|
||||
|
||||
map_area.y1 = map_area.y2 + 1;
|
||||
map_area.y2 = map_area.y1;
|
||||
mask_p = 0;
|
||||
}
|
||||
|
||||
col_bit += ((box_w - col_end) + col_start) * bpp;
|
||||
|
||||
map_p += (col_bit >> 3);
|
||||
col_bit = col_bit & 0x7;
|
||||
|
||||
/*Next row in draw_buf*/
|
||||
disp_buf_buf_tmp += disp_buf_width - (col_end - col_start) / 3;
|
||||
}
|
||||
|
||||
/*Flush the last part*/
|
||||
if(map_area.y1 != map_area.y2) {
|
||||
map_area.y2--;
|
||||
_lv_blend_map(clip_area, &map_area, color_buf, mask_buf, LV_DRAW_MASK_RES_CHANGED, opa, blend_mode);
|
||||
}
|
||||
|
||||
lv_mem_buf_release(mask_buf);
|
||||
lv_mem_buf_release(color_buf);
|
||||
}
|
||||
#endif /*LV_DRAW_COMPLEX && LV_USE_FONT_SUBPX*/
|
||||
|
||||
#endif /*LV_USE_EXTERNAL_RENDERER*/
|
||||
/**
|
||||
* Convert a hexadecimal characters to a number (0..15)
|
||||
* @param hex Pointer to a hexadecimal character (0..9, A..F)
|
||||
|
|
|
@ -13,10 +13,10 @@ extern "C" {
|
|||
/*********************
|
||||
* INCLUDES
|
||||
*********************/
|
||||
#include "lv_draw_blend.h"
|
||||
#include "../misc/lv_bidi.h"
|
||||
#include "../misc/lv_txt.h"
|
||||
#include "../misc/lv_color.h"
|
||||
#include "../misc/lv_style.h"
|
||||
|
||||
/*********************
|
||||
* DEFINES
|
||||
|
@ -63,12 +63,11 @@ typedef struct _lv_draw_label_hint_t {
|
|||
int32_t coord_y;
|
||||
} lv_draw_label_hint_t;
|
||||
|
||||
struct _lv_draw_ctx_t;
|
||||
/**********************
|
||||
* GLOBAL PROTOTYPES
|
||||
**********************/
|
||||
|
||||
//! @cond Doxygen_Suppress
|
||||
|
||||
LV_ATTRIBUTE_FAST_MEM void lv_draw_label_dsc_init(lv_draw_label_dsc_t * dsc);
|
||||
|
||||
/**
|
||||
|
@ -80,22 +79,15 @@ LV_ATTRIBUTE_FAST_MEM void lv_draw_label_dsc_init(lv_draw_label_dsc_t * dsc);
|
|||
* @param hint pointer to a `lv_draw_label_hint_t` variable.
|
||||
* It is managed by the draw to speed up the drawing of very long texts (thousands of lines).
|
||||
*/
|
||||
LV_ATTRIBUTE_FAST_MEM void lv_draw_label(const lv_area_t * coords, const lv_area_t * mask,
|
||||
const lv_draw_label_dsc_t * dsc,
|
||||
const char * txt, lv_draw_label_hint_t * hint);
|
||||
LV_ATTRIBUTE_FAST_MEM 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);
|
||||
|
||||
LV_ATTRIBUTE_FAST_MEM void lv_draw_letter(const lv_point_t * pos_p, const lv_area_t * clip_area,
|
||||
const lv_font_t * font_p,
|
||||
uint32_t letter, lv_color_t color, lv_opa_t opa, lv_blend_mode_t blend_mode);
|
||||
//! @endcond
|
||||
/***********************
|
||||
* GLOBAL VARIABLES
|
||||
***********************/
|
||||
extern const uint8_t _lv_bpp2_opa_table[];
|
||||
extern const uint8_t _lv_bpp3_opa_table[];
|
||||
extern const uint8_t _lv_bpp1_opa_table[];
|
||||
extern const uint8_t _lv_bpp4_opa_table[];
|
||||
extern const uint8_t _lv_bpp8_opa_table[];
|
||||
|
||||
/**********************
|
||||
* MACROS
|
||||
|
|
|
@ -7,8 +7,6 @@
|
|||
* INCLUDES
|
||||
*********************/
|
||||
#include <stdbool.h>
|
||||
#include "lv_draw_mask.h"
|
||||
#include "lv_draw_blend.h"
|
||||
#include "../core/lv_refr.h"
|
||||
#include "../misc/lv_math.h"
|
||||
|
||||
|
@ -24,16 +22,6 @@
|
|||
* STATIC PROTOTYPES
|
||||
**********************/
|
||||
|
||||
LV_ATTRIBUTE_FAST_MEM static void draw_line_skew(const lv_point_t * point1, const lv_point_t * point2,
|
||||
const lv_area_t * clip,
|
||||
const lv_draw_line_dsc_t * dsc);
|
||||
|
||||
LV_ATTRIBUTE_FAST_MEM static void draw_line_hor(const lv_point_t * point1, const lv_point_t * point2,
|
||||
const lv_area_t * clip,
|
||||
const lv_draw_line_dsc_t * dsc);
|
||||
LV_ATTRIBUTE_FAST_MEM static void draw_line_ver(const lv_point_t * point1, const lv_point_t * point2,
|
||||
const lv_area_t * clip,
|
||||
const lv_draw_line_dsc_t * dsc);
|
||||
/**********************
|
||||
* STATIC VARIABLES
|
||||
**********************/
|
||||
|
@ -54,442 +42,15 @@ LV_ATTRIBUTE_FAST_MEM void lv_draw_line_dsc_init(lv_draw_line_dsc_t * dsc)
|
|||
dsc->color = lv_color_black();
|
||||
}
|
||||
|
||||
/**
|
||||
* Draw a line
|
||||
* @param point1 first point of the line
|
||||
* @param point2 second point of the line
|
||||
* @param clip the line will be drawn only in this area
|
||||
* @param dsc pointer to an initialized `lv_draw_line_dsc_t` variable
|
||||
*/
|
||||
LV_ATTRIBUTE_FAST_MEM void lv_draw_line(const lv_point_t * point1, const lv_point_t * point2, const lv_area_t * clip,
|
||||
const lv_draw_line_dsc_t * dsc)
|
||||
LV_ATTRIBUTE_FAST_MEM 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)
|
||||
{
|
||||
if(dsc->width == 0) return;
|
||||
if(dsc->opa <= LV_OPA_MIN) return;
|
||||
|
||||
if(point1->x == point2->x && point1->y == point2->y) return;
|
||||
|
||||
lv_area_t clip_line;
|
||||
clip_line.x1 = LV_MIN(point1->x, point2->x) - dsc->width / 2;
|
||||
clip_line.x2 = LV_MAX(point1->x, point2->x) + dsc->width / 2;
|
||||
clip_line.y1 = LV_MIN(point1->y, point2->y) - dsc->width / 2;
|
||||
clip_line.y2 = LV_MAX(point1->y, point2->y) + dsc->width / 2;
|
||||
|
||||
bool is_common;
|
||||
is_common = _lv_area_intersect(&clip_line, &clip_line, clip);
|
||||
if(!is_common) return;
|
||||
|
||||
if(point1->y == point2->y) draw_line_hor(point1, point2, &clip_line, dsc);
|
||||
else if(point1->x == point2->x) draw_line_ver(point1, point2, &clip_line, dsc);
|
||||
else draw_line_skew(point1, point2, &clip_line, dsc);
|
||||
|
||||
if(dsc->round_end || dsc->round_start) {
|
||||
lv_draw_rect_dsc_t cir_dsc;
|
||||
lv_draw_rect_dsc_init(&cir_dsc);
|
||||
cir_dsc.bg_color = dsc->color;
|
||||
cir_dsc.radius = LV_RADIUS_CIRCLE;
|
||||
cir_dsc.bg_opa = dsc->opa;
|
||||
|
||||
int32_t r = (dsc->width >> 1);
|
||||
int32_t r_corr = (dsc->width & 1) ? 0 : 1;
|
||||
lv_area_t cir_area;
|
||||
|
||||
if(dsc->round_start) {
|
||||
cir_area.x1 = point1->x - r;
|
||||
cir_area.y1 = point1->y - r;
|
||||
cir_area.x2 = point1->x + r - r_corr;
|
||||
cir_area.y2 = point1->y + r - r_corr ;
|
||||
lv_draw_rect(&cir_area, clip, &cir_dsc);
|
||||
}
|
||||
|
||||
if(dsc->round_end) {
|
||||
cir_area.x1 = point2->x - r;
|
||||
cir_area.y1 = point2->y - r;
|
||||
cir_area.x2 = point2->x + r - r_corr;
|
||||
cir_area.y2 = point2->y + r - r_corr ;
|
||||
lv_draw_rect(&cir_area, clip, &cir_dsc);
|
||||
}
|
||||
}
|
||||
draw_ctx->draw_line(draw_ctx, dsc, point1, point2);
|
||||
}
|
||||
|
||||
/**********************
|
||||
* STATIC FUNCTIONS
|
||||
**********************/
|
||||
|
||||
|
||||
LV_ATTRIBUTE_FAST_MEM static void draw_line_hor(const lv_point_t * point1, const lv_point_t * point2,
|
||||
const lv_area_t * clip,
|
||||
const lv_draw_line_dsc_t * dsc)
|
||||
{
|
||||
lv_opa_t opa = dsc->opa;
|
||||
|
||||
int32_t w = dsc->width - 1;
|
||||
int32_t w_half0 = w >> 1;
|
||||
int32_t w_half1 = w_half0 + (w & 0x1); /*Compensate rounding error*/
|
||||
|
||||
|
||||
|
||||
lv_area_t draw_area;
|
||||
draw_area.x1 = LV_MIN(point1->x, point2->x);
|
||||
draw_area.x2 = LV_MAX(point1->x, point2->x) - 1;
|
||||
draw_area.y1 = point1->y - w_half1;
|
||||
draw_area.y2 = point1->y + w_half0;
|
||||
|
||||
bool dashed = dsc->dash_gap && dsc->dash_width ? true : false;
|
||||
bool simple_mode = true;
|
||||
if(lv_draw_mask_is_any(&draw_area)) simple_mode = false;
|
||||
else if(dashed) simple_mode = false;
|
||||
|
||||
/*If there is no mask then simply draw a rectangle*/
|
||||
if(simple_mode) {
|
||||
_lv_blend_fill(clip, &draw_area,
|
||||
dsc->color, NULL, LV_DRAW_MASK_RES_FULL_COVER, opa,
|
||||
dsc->blend_mode);
|
||||
}
|
||||
#if LV_DRAW_COMPLEX
|
||||
/*If there other mask apply it*/
|
||||
else {
|
||||
lv_disp_t * disp = _lv_refr_get_disp_refreshing();
|
||||
lv_disp_draw_buf_t * draw_buf = lv_disp_get_draw_buf(disp);
|
||||
const lv_area_t * disp_area = &draw_buf->area;
|
||||
/*Get clipped fill area which is the real draw area.
|
||||
*It is always the same or inside `fill_area`*/
|
||||
bool is_common;
|
||||
is_common = _lv_area_intersect(&draw_area, clip, &draw_area);
|
||||
if(!is_common) return;
|
||||
|
||||
/*Now `draw_area` has absolute coordinates.
|
||||
*Make it relative to `disp_area` to simplify draw to `disp_buf`*/
|
||||
draw_area.x1 -= disp_area->x1;
|
||||
draw_area.y1 -= disp_area->y1;
|
||||
draw_area.x2 -= disp_area->x1;
|
||||
draw_area.y2 -= disp_area->y1;
|
||||
|
||||
int32_t draw_area_w = lv_area_get_width(&draw_area);
|
||||
|
||||
lv_area_t fill_area;
|
||||
fill_area.x1 = draw_area.x1 + disp_area->x1;
|
||||
fill_area.x2 = draw_area.x2 + disp_area->x1;
|
||||
fill_area.y1 = draw_area.y1 + disp_area->y1;
|
||||
fill_area.y2 = fill_area.y1;
|
||||
|
||||
lv_coord_t dash_start = 0;
|
||||
if(dashed) {
|
||||
dash_start = (draw_buf->area.x1 + draw_area.x1) % (dsc->dash_gap + dsc->dash_width);
|
||||
}
|
||||
|
||||
lv_opa_t * mask_buf = lv_mem_buf_get(draw_area_w);
|
||||
int32_t h;
|
||||
for(h = draw_area.y1; h <= draw_area.y2; h++) {
|
||||
lv_memset_ff(mask_buf, draw_area_w);
|
||||
lv_draw_mask_res_t mask_res = lv_draw_mask_apply(mask_buf, draw_buf->area.x1 + draw_area.x1, draw_buf->area.y1 + h,
|
||||
draw_area_w);
|
||||
|
||||
if(dashed) {
|
||||
if(mask_res != LV_DRAW_MASK_RES_TRANSP) {
|
||||
lv_coord_t dash_cnt = dash_start;
|
||||
lv_coord_t i;
|
||||
for(i = 0; i < draw_area_w; i++, dash_cnt++) {
|
||||
if(dash_cnt <= dsc->dash_width) {
|
||||
int16_t diff = dsc->dash_width - dash_cnt;
|
||||
i += diff;
|
||||
dash_cnt += diff;
|
||||
}
|
||||
else if(dash_cnt >= dsc->dash_gap + dsc->dash_width) {
|
||||
dash_cnt = 0;
|
||||
}
|
||||
else {
|
||||
mask_buf[i] = 0x00;
|
||||
}
|
||||
}
|
||||
|
||||
mask_res = LV_DRAW_MASK_RES_CHANGED;
|
||||
}
|
||||
}
|
||||
|
||||
_lv_blend_fill(clip, &fill_area,
|
||||
dsc->color, mask_buf, mask_res, dsc->opa,
|
||||
dsc->blend_mode);
|
||||
|
||||
fill_area.y1++;
|
||||
fill_area.y2++;
|
||||
}
|
||||
lv_mem_buf_release(mask_buf);
|
||||
}
|
||||
#endif /*LV_DRAW_COMPLEX*/
|
||||
}
|
||||
|
||||
LV_ATTRIBUTE_FAST_MEM static void draw_line_ver(const lv_point_t * point1, const lv_point_t * point2,
|
||||
const lv_area_t * clip,
|
||||
const lv_draw_line_dsc_t * dsc)
|
||||
{
|
||||
lv_opa_t opa = dsc->opa;
|
||||
|
||||
int32_t w = dsc->width - 1;
|
||||
int32_t w_half0 = w >> 1;
|
||||
int32_t w_half1 = w_half0 + (w & 0x1); /*Compensate rounding error*/
|
||||
|
||||
lv_area_t draw_area;
|
||||
draw_area.x1 = point1->x - w_half1;
|
||||
draw_area.x2 = point1->x + w_half0;
|
||||
draw_area.y1 = LV_MIN(point1->y, point2->y);
|
||||
draw_area.y2 = LV_MAX(point1->y, point2->y) - 1;
|
||||
|
||||
bool dashed = dsc->dash_gap && dsc->dash_width ? true : false;
|
||||
bool simple_mode = true;
|
||||
if(lv_draw_mask_is_any(&draw_area)) simple_mode = false;
|
||||
else if(dashed) simple_mode = false;
|
||||
|
||||
/*If there is no mask then simply draw a rectangle*/
|
||||
if(simple_mode) {
|
||||
_lv_blend_fill(clip, &draw_area,
|
||||
dsc->color, NULL, LV_DRAW_MASK_RES_FULL_COVER, opa,
|
||||
dsc->blend_mode);
|
||||
}
|
||||
|
||||
#if LV_DRAW_COMPLEX
|
||||
/*If there other mask apply it*/
|
||||
else {
|
||||
lv_disp_t * disp = _lv_refr_get_disp_refreshing();
|
||||
lv_disp_draw_buf_t * draw_buf = lv_disp_get_draw_buf(disp);
|
||||
const lv_area_t * disp_area = &draw_buf->area;
|
||||
/*Get clipped fill area which is the real draw area.
|
||||
*It is always the same or inside `fill_area`*/
|
||||
bool is_common;
|
||||
is_common = _lv_area_intersect(&draw_area, clip, &draw_area);
|
||||
if(!is_common) return;
|
||||
|
||||
/*Now `draw_area` has absolute coordinates.
|
||||
*Make it relative to `disp_area` to simplify draw to `disp_buf`*/
|
||||
draw_area.x1 -= draw_buf->area.x1;
|
||||
draw_area.y1 -= draw_buf->area.y1;
|
||||
draw_area.x2 -= draw_buf->area.x1;
|
||||
draw_area.y2 -= draw_buf->area.y1;
|
||||
|
||||
int32_t draw_area_w = lv_area_get_width(&draw_area);
|
||||
|
||||
lv_area_t fill_area;
|
||||
fill_area.x1 = draw_area.x1 + disp_area->x1;
|
||||
fill_area.x2 = draw_area.x2 + disp_area->x1;
|
||||
fill_area.y1 = draw_area.y1 + disp_area->y1;
|
||||
fill_area.y2 = fill_area.y1;
|
||||
|
||||
lv_opa_t * mask_buf = lv_mem_buf_get(draw_area_w);
|
||||
|
||||
lv_coord_t dash_start = 0;
|
||||
if(dashed) {
|
||||
dash_start = (draw_buf->area.y1 + draw_area.y1) % (dsc->dash_gap + dsc->dash_width);
|
||||
}
|
||||
|
||||
lv_coord_t dash_cnt = dash_start;
|
||||
|
||||
int32_t h;
|
||||
for(h = draw_area.y1; h <= draw_area.y2; h++) {
|
||||
lv_memset_ff(mask_buf, draw_area_w);
|
||||
lv_draw_mask_res_t mask_res = lv_draw_mask_apply(mask_buf, draw_buf->area.x1 + draw_area.x1, draw_buf->area.y1 + h,
|
||||
draw_area_w);
|
||||
|
||||
if(dashed) {
|
||||
if(mask_res != LV_DRAW_MASK_RES_TRANSP) {
|
||||
if(dash_cnt > dsc->dash_width) {
|
||||
mask_res = LV_DRAW_MASK_RES_TRANSP;
|
||||
}
|
||||
|
||||
if(dash_cnt >= dsc->dash_gap + dsc->dash_width) {
|
||||
dash_cnt = 0;
|
||||
}
|
||||
}
|
||||
dash_cnt ++;
|
||||
}
|
||||
|
||||
_lv_blend_fill(clip, &fill_area,
|
||||
dsc->color, mask_buf, mask_res, dsc->opa,
|
||||
LV_BLEND_MODE_NORMAL);
|
||||
|
||||
fill_area.y1++;
|
||||
fill_area.y2++;
|
||||
}
|
||||
lv_mem_buf_release(mask_buf);
|
||||
}
|
||||
#endif /*LV_DRAW_COMPLEX*/
|
||||
}
|
||||
|
||||
LV_ATTRIBUTE_FAST_MEM static void draw_line_skew(const lv_point_t * point1, const lv_point_t * point2,
|
||||
const lv_area_t * clip,
|
||||
const lv_draw_line_dsc_t * dsc)
|
||||
{
|
||||
#if LV_DRAW_COMPLEX
|
||||
/*Keep the great y in p1*/
|
||||
lv_point_t p1;
|
||||
lv_point_t p2;
|
||||
if(point1->y < point2->y) {
|
||||
p1.y = point1->y;
|
||||
p2.y = point2->y;
|
||||
p1.x = point1->x;
|
||||
p2.x = point2->x;
|
||||
}
|
||||
else {
|
||||
p1.y = point2->y;
|
||||
p2.y = point1->y;
|
||||
p1.x = point2->x;
|
||||
p2.x = point1->x;
|
||||
}
|
||||
|
||||
int32_t xdiff = p2.x - p1.x;
|
||||
int32_t ydiff = p2.y - p1.y;
|
||||
bool flat = LV_ABS(xdiff) > LV_ABS(ydiff) ? true : false;
|
||||
|
||||
static const uint8_t wcorr[] = {
|
||||
128, 128, 128, 129, 129, 130, 130, 131,
|
||||
132, 133, 134, 135, 137, 138, 140, 141,
|
||||
143, 145, 147, 149, 151, 153, 155, 158,
|
||||
160, 162, 165, 167, 170, 173, 175, 178,
|
||||
181,
|
||||
};
|
||||
|
||||
int32_t w = dsc->width;
|
||||
int32_t wcorr_i = 0;
|
||||
if(flat) wcorr_i = (LV_ABS(ydiff) << 5) / LV_ABS(xdiff);
|
||||
else wcorr_i = (LV_ABS(xdiff) << 5) / LV_ABS(ydiff);
|
||||
|
||||
w = (w * wcorr[wcorr_i] + 63) >> 7; /*+ 63 for rounding*/
|
||||
int32_t w_half0 = w >> 1;
|
||||
int32_t w_half1 = w_half0 + (w & 0x1); /*Compensate rounding error*/
|
||||
|
||||
lv_area_t draw_area;
|
||||
draw_area.x1 = LV_MIN(p1.x, p2.x) - w;
|
||||
draw_area.x2 = LV_MAX(p1.x, p2.x) + w;
|
||||
draw_area.y1 = LV_MIN(p1.y, p2.y) - w;
|
||||
draw_area.y2 = LV_MAX(p1.y, p2.y) + w;
|
||||
|
||||
/*Get the union of `coords` and `clip`*/
|
||||
/*`clip` is already truncated to the `draw_buf` size
|
||||
*in 'lv_refr_area' function*/
|
||||
bool is_common = _lv_area_intersect(&draw_area, &draw_area, clip);
|
||||
if(is_common == false) return;
|
||||
|
||||
lv_draw_mask_line_param_t mask_left_param;
|
||||
lv_draw_mask_line_param_t mask_right_param;
|
||||
lv_draw_mask_line_param_t mask_top_param;
|
||||
lv_draw_mask_line_param_t mask_bottom_param;
|
||||
|
||||
if(flat) {
|
||||
if(xdiff > 0) {
|
||||
lv_draw_mask_line_points_init(&mask_left_param, p1.x, p1.y - w_half0, p2.x, p2.y - w_half0,
|
||||
LV_DRAW_MASK_LINE_SIDE_LEFT);
|
||||
lv_draw_mask_line_points_init(&mask_right_param, p1.x, p1.y + w_half1, p2.x, p2.y + w_half1,
|
||||
LV_DRAW_MASK_LINE_SIDE_RIGHT);
|
||||
}
|
||||
else {
|
||||
lv_draw_mask_line_points_init(&mask_left_param, p1.x, p1.y + w_half1, p2.x, p2.y + w_half1,
|
||||
LV_DRAW_MASK_LINE_SIDE_LEFT);
|
||||
lv_draw_mask_line_points_init(&mask_right_param, p1.x, p1.y - w_half0, p2.x, p2.y - w_half0,
|
||||
LV_DRAW_MASK_LINE_SIDE_RIGHT);
|
||||
}
|
||||
}
|
||||
else {
|
||||
lv_draw_mask_line_points_init(&mask_left_param, p1.x + w_half1, p1.y, p2.x + w_half1, p2.y,
|
||||
LV_DRAW_MASK_LINE_SIDE_LEFT);
|
||||
lv_draw_mask_line_points_init(&mask_right_param, p1.x - w_half0, p1.y, p2.x - w_half0, p2.y,
|
||||
LV_DRAW_MASK_LINE_SIDE_RIGHT);
|
||||
}
|
||||
|
||||
/*Use the normal vector for the endings*/
|
||||
|
||||
int16_t mask_left_id = lv_draw_mask_add(&mask_left_param, NULL);
|
||||
int16_t mask_right_id = lv_draw_mask_add(&mask_right_param, NULL);
|
||||
int16_t mask_top_id = LV_MASK_ID_INV;
|
||||
int16_t mask_bottom_id = LV_MASK_ID_INV;
|
||||
|
||||
if(!dsc->raw_end) {
|
||||
lv_draw_mask_line_points_init(&mask_top_param, p1.x, p1.y, p1.x - ydiff, p1.y + xdiff, LV_DRAW_MASK_LINE_SIDE_BOTTOM);
|
||||
lv_draw_mask_line_points_init(&mask_bottom_param, p2.x, p2.y, p2.x - ydiff, p2.y + xdiff, LV_DRAW_MASK_LINE_SIDE_TOP);
|
||||
mask_top_id = lv_draw_mask_add(&mask_top_param, NULL);
|
||||
mask_bottom_id = lv_draw_mask_add(&mask_bottom_param, NULL);
|
||||
}
|
||||
|
||||
lv_disp_t * disp = _lv_refr_get_disp_refreshing();
|
||||
lv_disp_draw_buf_t * draw_buf = lv_disp_get_draw_buf(disp);
|
||||
|
||||
const lv_area_t * disp_area = &draw_buf->area;
|
||||
|
||||
/*Store the coordinates of the `draw_a` relative to the draw_buf*/
|
||||
draw_area.x1 -= disp_area->x1;
|
||||
draw_area.y1 -= disp_area->y1;
|
||||
draw_area.x2 -= disp_area->x1;
|
||||
draw_area.y2 -= disp_area->y1;
|
||||
|
||||
/*The real draw area is around the line.
|
||||
*It's easy to calculate with steep lines, but the area can be very wide with very flat lines.
|
||||
*So deal with it only with steep lines.*/
|
||||
int32_t draw_area_w = lv_area_get_width(&draw_area);
|
||||
|
||||
/*Draw the background line by line*/
|
||||
int32_t h;
|
||||
uint32_t hor_res = (uint32_t)lv_disp_get_hor_res(disp);
|
||||
size_t mask_buf_size = LV_MIN(lv_area_get_size(&draw_area), hor_res);
|
||||
lv_opa_t * mask_buf = lv_mem_buf_get(mask_buf_size);
|
||||
|
||||
lv_area_t fill_area;
|
||||
fill_area.x1 = draw_area.x1 + disp_area->x1;
|
||||
fill_area.x2 = draw_area.x2 + disp_area->x1;
|
||||
fill_area.y1 = draw_area.y1 + disp_area->y1;
|
||||
fill_area.y2 = fill_area.y1;
|
||||
|
||||
int32_t x = draw_buf->area.x1 + draw_area.x1;
|
||||
|
||||
uint32_t mask_p = 0;
|
||||
|
||||
lv_memset_ff(mask_buf, mask_buf_size);
|
||||
/*Fill the first row with 'color'*/
|
||||
for(h = draw_area.y1 + disp_area->y1; h <= draw_area.y2 + disp_area->y1; h++) {
|
||||
|
||||
lv_draw_mask_res_t mask_res = lv_draw_mask_apply(&mask_buf[mask_p], x, h, draw_area_w);
|
||||
if(mask_res == LV_DRAW_MASK_RES_TRANSP) {
|
||||
lv_memset_00(&mask_buf[mask_p], draw_area_w);
|
||||
}
|
||||
|
||||
mask_p += draw_area_w;
|
||||
if((uint32_t) mask_p + draw_area_w < mask_buf_size) {
|
||||
fill_area.y2 ++;
|
||||
}
|
||||
else {
|
||||
_lv_blend_fill(&fill_area, clip,
|
||||
dsc->color, mask_buf, LV_DRAW_MASK_RES_CHANGED, dsc->opa,
|
||||
dsc->blend_mode);
|
||||
|
||||
fill_area.y1 = fill_area.y2 + 1;
|
||||
fill_area.y2 = fill_area.y1;
|
||||
mask_p = 0;
|
||||
lv_memset_ff(mask_buf, mask_buf_size);
|
||||
}
|
||||
}
|
||||
|
||||
/*Flush the last part*/
|
||||
if(fill_area.y1 != fill_area.y2) {
|
||||
fill_area.y2--;
|
||||
_lv_blend_fill(&fill_area, clip,
|
||||
dsc->color, mask_buf, LV_DRAW_MASK_RES_CHANGED, dsc->opa,
|
||||
dsc->blend_mode);
|
||||
|
||||
}
|
||||
|
||||
lv_mem_buf_release(mask_buf);
|
||||
|
||||
lv_draw_mask_free_param(&mask_left_param);
|
||||
lv_draw_mask_free_param(&mask_right_param);
|
||||
if(mask_top_id != LV_MASK_ID_INV) lv_draw_mask_free_param(&mask_top_param);
|
||||
if(mask_bottom_id != LV_MASK_ID_INV) lv_draw_mask_free_param(&mask_bottom_param);
|
||||
lv_draw_mask_remove_id(mask_left_id);
|
||||
lv_draw_mask_remove_id(mask_right_id);
|
||||
lv_draw_mask_remove_id(mask_top_id);
|
||||
lv_draw_mask_remove_id(mask_bottom_id);
|
||||
#else
|
||||
LV_UNUSED(point1);
|
||||
LV_UNUSED(point2);
|
||||
LV_UNUSED(clip);
|
||||
LV_UNUSED(dsc);
|
||||
LV_LOG_WARN("Can't draw skewed line with LV_DRAW_COMPLEX == 0");
|
||||
#endif /*LV_DRAW_COMPLEX*/
|
||||
}
|
||||
|
||||
|
|
|
@ -13,7 +13,10 @@ extern "C" {
|
|||
/*********************
|
||||
* INCLUDES
|
||||
*********************/
|
||||
#include "lv_draw_blend.h"
|
||||
#include "../lv_conf_internal.h"
|
||||
#include "../misc/lv_color.h"
|
||||
#include "../misc/lv_area.h"
|
||||
#include "../misc/lv_style.h"
|
||||
|
||||
/*********************
|
||||
* DEFINES
|
||||
|
@ -34,11 +37,14 @@ typedef struct {
|
|||
uint8_t raw_end : 1; /*Do not bother with perpendicular line ending if it's not visible for any reason*/
|
||||
} lv_draw_line_dsc_t;
|
||||
|
||||
struct _lv_draw_ctx_t;
|
||||
|
||||
/**********************
|
||||
* GLOBAL PROTOTYPES
|
||||
**********************/
|
||||
|
||||
//! @cond Doxygen_Suppress
|
||||
LV_ATTRIBUTE_FAST_MEM void lv_draw_line_dsc_init(lv_draw_line_dsc_t * dsc);
|
||||
|
||||
/**
|
||||
* Draw a line
|
||||
* @param point1 first point of the line
|
||||
|
@ -46,12 +52,9 @@ typedef struct {
|
|||
* @param clip the line will be drawn only in this area
|
||||
* @param dsc pointer to an initialized `lv_draw_line_dsc_t` variable
|
||||
*/
|
||||
LV_ATTRIBUTE_FAST_MEM void lv_draw_line(const lv_point_t * point1, const lv_point_t * point2, const lv_area_t * clip,
|
||||
const 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);
|
||||
|
||||
LV_ATTRIBUTE_FAST_MEM void lv_draw_line_dsc_init(lv_draw_line_dsc_t * dsc);
|
||||
|
||||
//! @endcond
|
||||
|
||||
/**********************
|
||||
* MACROS
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
/*********************
|
||||
* INCLUDES
|
||||
*********************/
|
||||
#include "lv_draw_mask.h"
|
||||
#include "lv_draw.h"
|
||||
#if LV_DRAW_COMPLEX
|
||||
#include "../misc/lv_math.h"
|
||||
#include "../misc/lv_log.h"
|
||||
|
@ -41,6 +41,9 @@ LV_ATTRIBUTE_FAST_MEM static lv_draw_mask_res_t lv_draw_mask_fade(lv_opa_t * mas
|
|||
LV_ATTRIBUTE_FAST_MEM static lv_draw_mask_res_t lv_draw_mask_map(lv_opa_t * mask_buf, lv_coord_t abs_x,
|
||||
lv_coord_t abs_y, lv_coord_t len,
|
||||
lv_draw_mask_map_param_t * param);
|
||||
LV_ATTRIBUTE_FAST_MEM static lv_draw_mask_res_t lv_draw_mask_polygon(lv_opa_t * mask_buf, lv_coord_t abs_x,
|
||||
lv_coord_t abs_y, lv_coord_t len,
|
||||
lv_draw_mask_polygon_param_t * param);
|
||||
|
||||
LV_ATTRIBUTE_FAST_MEM static lv_draw_mask_res_t line_mask_flat(lv_opa_t * mask_buf, lv_coord_t abs_x, lv_coord_t abs_y,
|
||||
lv_coord_t len,
|
||||
|
@ -140,16 +143,16 @@ LV_ATTRIBUTE_FAST_MEM lv_draw_mask_res_t lv_draw_mask_apply(lv_opa_t * mask_buf,
|
|||
* - `LV_DRAW_MASK_RES_CHANGED`: `mask_buf` has changed, it shows the desired opacity of each pixel in the given line
|
||||
*/
|
||||
LV_ATTRIBUTE_FAST_MEM lv_draw_mask_res_t lv_draw_mask_apply_ids(lv_opa_t * mask_buf, lv_coord_t abs_x, lv_coord_t abs_y,
|
||||
lv_coord_t len, const int16_t *ids, int16_t ids_count)
|
||||
lv_coord_t len, const int16_t * ids, int16_t ids_count)
|
||||
{
|
||||
bool changed = false;
|
||||
_lv_draw_mask_common_dsc_t * dsc;
|
||||
|
||||
for (int i = 0; i < ids_count; i++) {
|
||||
for(int i = 0; i < ids_count; i++) {
|
||||
int16_t id = ids[i];
|
||||
if (id == LV_MASK_ID_INV) continue;
|
||||
if(id == LV_MASK_ID_INV) continue;
|
||||
dsc = LV_GC_ROOT(_lv_draw_mask_list[id]).param;
|
||||
if (!dsc) continue;
|
||||
if(!dsc) continue;
|
||||
lv_draw_mask_res_t res = LV_DRAW_MASK_RES_FULL_COVER;
|
||||
res = dsc->cb(mask_buf, abs_x, abs_y, len, dsc);
|
||||
if(res == LV_DRAW_MASK_RES_TRANSP) return LV_DRAW_MASK_RES_TRANSP;
|
||||
|
@ -219,6 +222,10 @@ void lv_draw_mask_free_param(void * p)
|
|||
}
|
||||
}
|
||||
}
|
||||
else if(pdsc->type == LV_DRAW_MASK_TYPE_POLYGON) {
|
||||
lv_draw_mask_polygon_param_t * poly_p = (lv_draw_mask_polygon_param_t *) p;
|
||||
lv_mem_free(poly_p->cfg.points);
|
||||
}
|
||||
}
|
||||
|
||||
void _lv_draw_mask_cleanup(void)
|
||||
|
@ -462,7 +469,7 @@ void lv_draw_mask_angle_init(lv_draw_mask_angle_param_t * param, lv_coord_t vert
|
|||
|
||||
/**
|
||||
* Initialize a fade mask.
|
||||
* @param param param pointer to a `lv_draw_mask_param_t` to initialize
|
||||
* @param param pointer to an `lv_draw_mask_radius_param_t` to initialize
|
||||
* @param rect coordinates of the rectangle to affect (absolute coordinates)
|
||||
* @param radius radius of the rectangle
|
||||
* @param inv true: keep the pixels inside the rectangle; keep the pixels outside of the rectangle
|
||||
|
@ -471,9 +478,9 @@ void lv_draw_mask_radius_init(lv_draw_mask_radius_param_t * param, const lv_area
|
|||
{
|
||||
lv_coord_t w = lv_area_get_width(rect);
|
||||
lv_coord_t h = lv_area_get_height(rect);
|
||||
if(radius < 0) radius = 0;
|
||||
int32_t short_side = LV_MIN(w, h);
|
||||
if(radius > short_side >> 1) radius = short_side >> 1;
|
||||
if(radius < 0) radius = 0;
|
||||
|
||||
lv_area_copy(¶m->cfg.rect, rect);
|
||||
param->cfg.radius = radius;
|
||||
|
@ -560,6 +567,31 @@ void lv_draw_mask_map_init(lv_draw_mask_map_param_t * param, const lv_area_t * c
|
|||
param->dsc.type = LV_DRAW_MASK_TYPE_MAP;
|
||||
}
|
||||
|
||||
void lv_draw_mask_polygon_init(lv_draw_mask_polygon_param_t * param, const lv_point_t * points, uint16_t point_cnt)
|
||||
{
|
||||
/*Join adjacent points if they are on the same coordinate*/
|
||||
lv_point_t * p = lv_mem_alloc(point_cnt * sizeof(lv_point_t));
|
||||
if(p == NULL) return;
|
||||
uint16_t i;
|
||||
uint16_t pcnt = 0;
|
||||
p[0] = points[0];
|
||||
for(i = 0; i < point_cnt - 1; i++) {
|
||||
if(points[i].x != points[i + 1].x || points[i].y != points[i + 1].y) {
|
||||
p[pcnt] = points[i];
|
||||
pcnt++;
|
||||
}
|
||||
}
|
||||
/*The first and the last points are also adjacent*/
|
||||
if(points[0].x != points[point_cnt - 1].x || points[0].y != points[point_cnt - 1].y) {
|
||||
p[pcnt] = points[point_cnt - 1];
|
||||
pcnt++;
|
||||
}
|
||||
param->cfg.points = p;
|
||||
param->cfg.point_cnt = pcnt;
|
||||
param->dsc.cb = (lv_draw_mask_xcb_t)lv_draw_mask_polygon;
|
||||
param->dsc.type = LV_DRAW_MASK_TYPE_POLYGON;
|
||||
}
|
||||
|
||||
/**********************
|
||||
* STATIC FUNCTIONS
|
||||
**********************/
|
||||
|
@ -1218,6 +1250,79 @@ LV_ATTRIBUTE_FAST_MEM static lv_draw_mask_res_t lv_draw_mask_map(lv_opa_t * mask
|
|||
return LV_DRAW_MASK_RES_CHANGED;
|
||||
}
|
||||
|
||||
LV_ATTRIBUTE_FAST_MEM static lv_draw_mask_res_t lv_draw_mask_polygon(lv_opa_t * mask_buf, lv_coord_t abs_x,
|
||||
lv_coord_t abs_y, lv_coord_t len,
|
||||
lv_draw_mask_polygon_param_t * param)
|
||||
{
|
||||
uint16_t i;
|
||||
struct {
|
||||
lv_point_t p1;
|
||||
lv_point_t p2;
|
||||
} lines[2], tmp;
|
||||
uint16_t line_cnt = 0;
|
||||
lv_memset_00(&lines, sizeof(lines));
|
||||
int psign_prev = 0;
|
||||
for(i = 0; i < param->cfg.point_cnt; i++) {
|
||||
lv_point_t p1 = param->cfg.points[i];
|
||||
lv_point_t p2 = param->cfg.points[i + 1 < param->cfg.point_cnt ? i + 1 : 0];
|
||||
int pdiff = p1.y - p2.y, psign = pdiff / LV_ABS(pdiff);
|
||||
if(pdiff > 0) {
|
||||
if(abs_y > p1.y || abs_y < p2.y) continue;
|
||||
lines[line_cnt].p1 = p2;
|
||||
lines[line_cnt].p2 = p1;
|
||||
}
|
||||
else {
|
||||
if(abs_y < p1.y || abs_y > p2.y) continue;
|
||||
lines[line_cnt].p1 = p1;
|
||||
lines[line_cnt].p2 = p2;
|
||||
}
|
||||
if(psign_prev && psign_prev == psign) continue;
|
||||
psign_prev = psign;
|
||||
line_cnt++;
|
||||
if(line_cnt == 2) break;
|
||||
}
|
||||
if(line_cnt != 2) return LV_DRAW_MASK_RES_TRANSP;
|
||||
if(lines[0].p1.x > lines[1].p1.x || lines[0].p2.x > lines[1].p2.x) {
|
||||
tmp = lines[0];
|
||||
lines[0] = lines[1];
|
||||
lines[1] = tmp;
|
||||
}
|
||||
lv_draw_mask_line_param_t line_p;
|
||||
lv_draw_mask_line_points_init(&line_p, lines[0].p1.x, lines[0].p1.y, lines[0].p2.x, lines[0].p2.y,
|
||||
LV_DRAW_MASK_LINE_SIDE_RIGHT);
|
||||
if(line_p.steep == 0 && line_p.flat) {
|
||||
lv_coord_t x1 = LV_MIN(lines[0].p1.x, lines[0].p2.x);
|
||||
lv_coord_t x2 = LV_MAX(lines[0].p1.x, lines[0].p2.x);
|
||||
for(i = 0; i < len; i++) {
|
||||
mask_buf[i] = mask_mix(mask_buf[i], (abs_x + i >= x1 && abs_x + i <= x2) * 0xFF);
|
||||
}
|
||||
lv_draw_mask_free_param(&line_p);
|
||||
return LV_DRAW_MASK_RES_CHANGED;
|
||||
}
|
||||
lv_draw_mask_res_t res1 = lv_draw_mask_line(mask_buf, abs_x, abs_y, len, &line_p);
|
||||
lv_draw_mask_free_param(&line_p);
|
||||
if(res1 == LV_DRAW_MASK_RES_TRANSP) {
|
||||
return LV_DRAW_MASK_RES_TRANSP;
|
||||
}
|
||||
lv_draw_mask_line_points_init(&line_p, lines[1].p1.x, lines[1].p1.y, lines[1].p2.x, lines[1].p2.y,
|
||||
LV_DRAW_MASK_LINE_SIDE_LEFT);
|
||||
if(line_p.steep == 0 && line_p.flat) {
|
||||
lv_coord_t x1 = LV_MIN(lines[1].p1.x, lines[1].p2.x);
|
||||
lv_coord_t x2 = LV_MAX(lines[1].p1.x, lines[1].p2.x);
|
||||
for(i = 0; i < len; i++) {
|
||||
mask_buf[i] = mask_mix(mask_buf[i], (abs_x + i >= x1 && abs_x + i <= x2) * 0xFF);
|
||||
}
|
||||
lv_draw_mask_free_param(&line_p);
|
||||
return LV_DRAW_MASK_RES_CHANGED;
|
||||
}
|
||||
lv_draw_mask_res_t res2 = lv_draw_mask_line(mask_buf, abs_x, abs_y, len, &line_p);
|
||||
lv_draw_mask_free_param(&line_p);
|
||||
if(res2 == LV_DRAW_MASK_RES_TRANSP) {
|
||||
return LV_DRAW_MASK_RES_TRANSP;
|
||||
}
|
||||
if(res1 == LV_DRAW_MASK_RES_CHANGED || res2 == LV_DRAW_MASK_RES_CHANGED) return LV_DRAW_MASK_RES_CHANGED;
|
||||
return res1;
|
||||
}
|
||||
/**
|
||||
* Initialize the circle drawing
|
||||
* @param c pointer to a point. The coordinates will be calculated here
|
||||
|
|
|
@ -25,9 +25,6 @@ extern "C" {
|
|||
#define LV_MASK_ID_INV (-1)
|
||||
#if LV_DRAW_COMPLEX
|
||||
# define _LV_MASK_MAX_NUM 16
|
||||
# ifndef _LV_MASK_BUF_MAX_SIZE
|
||||
# define _LV_MASK_BUF_MAX_SIZE 2048 /*Should be >= than the max hor res*/
|
||||
# endif
|
||||
#else
|
||||
# define _LV_MASK_MAX_NUM 1
|
||||
#endif
|
||||
|
@ -76,6 +73,7 @@ enum {
|
|||
LV_DRAW_MASK_TYPE_RADIUS,
|
||||
LV_DRAW_MASK_TYPE_FADE,
|
||||
LV_DRAW_MASK_TYPE_MAP,
|
||||
LV_DRAW_MASK_TYPE_POLYGON,
|
||||
};
|
||||
|
||||
typedef uint8_t lv_draw_mask_type_t;
|
||||
|
@ -207,6 +205,16 @@ typedef struct _lv_draw_mask_map_param_t {
|
|||
} cfg;
|
||||
} lv_draw_mask_map_param_t;
|
||||
|
||||
typedef struct {
|
||||
/*The first element must be the common descriptor*/
|
||||
_lv_draw_mask_common_dsc_t dsc;
|
||||
|
||||
struct {
|
||||
lv_point_t * points;
|
||||
uint16_t point_cnt;
|
||||
} cfg;
|
||||
} lv_draw_mask_polygon_param_t;
|
||||
|
||||
|
||||
/**********************
|
||||
* GLOBAL PROTOTYPES
|
||||
|
@ -250,7 +258,7 @@ LV_ATTRIBUTE_FAST_MEM lv_draw_mask_res_t lv_draw_mask_apply(lv_opa_t * mask_buf,
|
|||
* - `LV_DRAW_MASK_RES_CHANGED`: `mask_buf` has changed, it shows the desired opacity of each pixel in the given line
|
||||
*/
|
||||
LV_ATTRIBUTE_FAST_MEM lv_draw_mask_res_t lv_draw_mask_apply_ids(lv_opa_t * mask_buf, lv_coord_t abs_x, lv_coord_t abs_y,
|
||||
lv_coord_t len, const int16_t *ids, int16_t ids_count);
|
||||
lv_coord_t len, const int16_t * ids, int16_t ids_count);
|
||||
|
||||
//! @endcond
|
||||
|
||||
|
@ -343,7 +351,7 @@ void lv_draw_mask_angle_init(lv_draw_mask_angle_param_t * param, lv_coord_t vert
|
|||
|
||||
/**
|
||||
* Initialize a fade mask.
|
||||
* @param param param pointer to a `lv_draw_mask_param_t` to initialize
|
||||
* @param param pointer to an `lv_draw_mask_radius_param_t` to initialize
|
||||
* @param rect coordinates of the rectangle to affect (absolute coordinates)
|
||||
* @param radius radius of the rectangle
|
||||
* @param inv true: keep the pixels inside the rectangle; keep the pixels outside of the rectangle
|
||||
|
@ -371,6 +379,8 @@ void lv_draw_mask_fade_init(lv_draw_mask_fade_param_t * param, const lv_area_t *
|
|||
*/
|
||||
void lv_draw_mask_map_init(lv_draw_mask_map_param_t * param, const lv_area_t * coords, const lv_opa_t * map);
|
||||
|
||||
void lv_draw_mask_polygon_init(lv_draw_mask_polygon_param_t * param, const lv_point_t * points, uint16_t point_cnt);
|
||||
|
||||
#endif /*LV_DRAW_COMPLEX*/
|
||||
|
||||
/**********************
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -13,8 +13,11 @@ extern "C" {
|
|||
/*********************
|
||||
* INCLUDES
|
||||
*********************/
|
||||
#include "lv_draw_blend.h"
|
||||
#include "../font/lv_font.h"
|
||||
#include "../lv_conf_internal.h"
|
||||
#include "../misc/lv_color.h"
|
||||
#include "../misc/lv_area.h"
|
||||
#include "../misc/lv_style.h"
|
||||
#include "sw/lv_draw_sw_gradient.h"
|
||||
|
||||
/*********************
|
||||
* DEFINES
|
||||
|
@ -22,7 +25,6 @@ extern "C" {
|
|||
#define LV_RADIUS_CIRCLE 0x7FFF /**< A very big radius to always draw as circle*/
|
||||
LV_EXPORT_CONST_INT(LV_RADIUS_CIRCLE);
|
||||
|
||||
|
||||
/**********************
|
||||
* TYPEDEFS
|
||||
**********************/
|
||||
|
@ -32,12 +34,15 @@ typedef struct {
|
|||
lv_blend_mode_t blend_mode;
|
||||
|
||||
/*Background*/
|
||||
lv_color_t bg_color;
|
||||
lv_color_t bg_grad_color;
|
||||
uint8_t bg_main_color_stop;
|
||||
uint8_t bg_grad_color_stop;
|
||||
lv_opa_t bg_opa;
|
||||
lv_grad_dir_t bg_grad_dir : 3;
|
||||
#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
|
||||
|
||||
/*Background img*/
|
||||
const void * bg_img_src;
|
||||
|
@ -69,13 +74,14 @@ typedef struct {
|
|||
lv_opa_t shadow_opa;
|
||||
} lv_draw_rect_dsc_t;
|
||||
|
||||
struct _lv_draw_ctx_t;
|
||||
|
||||
/**********************
|
||||
* GLOBAL PROTOTYPES
|
||||
**********************/
|
||||
|
||||
LV_ATTRIBUTE_FAST_MEM void lv_draw_rect_dsc_init(lv_draw_rect_dsc_t * dsc);
|
||||
|
||||
//! @endcond
|
||||
|
||||
/**
|
||||
* Draw a rectangle
|
||||
|
@ -83,15 +89,7 @@ LV_ATTRIBUTE_FAST_MEM void lv_draw_rect_dsc_init(lv_draw_rect_dsc_t * dsc);
|
|||
* @param clip the rectangle will be drawn only in this area
|
||||
* @param dsc pointer to an initialized `lv_draw_rect_dsc_t` variable
|
||||
*/
|
||||
void lv_draw_rect(const lv_area_t * coords, const lv_area_t * clip, const lv_draw_rect_dsc_t * dsc);
|
||||
|
||||
/**
|
||||
* Draw a pixel
|
||||
* @param point the coordinates of the point to draw
|
||||
* @param mask the pixel will be drawn only in this mask
|
||||
* @param style pointer to a style
|
||||
*/
|
||||
//void lv_draw_px(const lv_point_t * point, const lv_area_t * clip_area, const lv_style_t * style);
|
||||
void lv_draw_rect(struct _lv_draw_ctx_t * draw_ctx, const lv_draw_rect_dsc_t * dsc, const lv_area_t * coords);
|
||||
|
||||
/**********************
|
||||
* MACROS
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
/*********************
|
||||
* INCLUDES
|
||||
*********************/
|
||||
#include "lv_draw.h"
|
||||
#include "lv_draw_triangle.h"
|
||||
#include "../misc/lv_math.h"
|
||||
#include "../misc/lv_mem.h"
|
||||
|
@ -34,181 +35,16 @@
|
|||
* GLOBAL FUNCTIONS
|
||||
**********************/
|
||||
|
||||
/**
|
||||
* Draw a triangle
|
||||
* @param points pointer to an array with 3 points
|
||||
* @param clip_area the triangle will be drawn only in this area
|
||||
* @param draw_dsc pointer to an initialized `lv_draw_rect_dsc_t` variable
|
||||
*/
|
||||
void lv_draw_triangle(const lv_point_t points[], const lv_area_t * clip_area, const lv_draw_rect_dsc_t * draw_dsc)
|
||||
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)
|
||||
{
|
||||
#if LV_DRAW_COMPLEX
|
||||
lv_draw_polygon(points, 3, clip_area, draw_dsc);
|
||||
#else
|
||||
LV_UNUSED(points);
|
||||
LV_UNUSED(clip_area);
|
||||
LV_UNUSED(draw_dsc);
|
||||
LV_LOG_WARN("Can't draw triangle with LV_DRAW_COMPLEX == 0");
|
||||
#endif /*LV_DRAW_COMPLEX*/
|
||||
draw_ctx->draw_polygon(draw_ctx, draw_dsc, points, point_cnt);
|
||||
}
|
||||
|
||||
/**
|
||||
* Draw a polygon. Only convex polygons are supported
|
||||
* @param points an array of points
|
||||
* @param point_cnt number of points
|
||||
* @param clip_area polygon will be drawn only in this area
|
||||
* @param draw_dsc pointer to an initialized `lv_draw_rect_dsc_t` variable
|
||||
*/
|
||||
void lv_draw_polygon(const lv_point_t points[], uint16_t point_cnt, const lv_area_t * clip_area,
|
||||
const lv_draw_rect_dsc_t * draw_dsc)
|
||||
void lv_draw_triangle(struct _lv_draw_ctx_t * draw_ctx, const lv_draw_rect_dsc_t * draw_dsc, const lv_point_t points[])
|
||||
{
|
||||
#if LV_DRAW_COMPLEX
|
||||
if(point_cnt < 3) return;
|
||||
if(points == NULL) return;
|
||||
|
||||
/*Join adjacent points if they are on the same coordinate*/
|
||||
lv_point_t * p = lv_mem_buf_get(point_cnt * sizeof(lv_point_t));
|
||||
if(p == NULL) return;
|
||||
uint16_t i;
|
||||
uint16_t pcnt = 0;
|
||||
p[0] = points[0];
|
||||
for(i = 0; i < point_cnt - 1; i++) {
|
||||
if(points[i].x != points[i + 1].x || points[i].y != points[i + 1].y) {
|
||||
p[pcnt] = points[i];
|
||||
pcnt++;
|
||||
}
|
||||
}
|
||||
/*The first and the last points are also adjacent*/
|
||||
if(points[0].x != points[point_cnt - 1].x || points[0].y != points[point_cnt - 1].y) {
|
||||
p[pcnt] = points[point_cnt - 1];
|
||||
pcnt++;
|
||||
}
|
||||
|
||||
point_cnt = pcnt;
|
||||
if(point_cnt < 3) {
|
||||
lv_mem_buf_release(p);
|
||||
return;
|
||||
}
|
||||
|
||||
lv_area_t poly_coords = {.x1 = LV_COORD_MAX, .y1 = LV_COORD_MAX, .x2 = LV_COORD_MIN, .y2 = LV_COORD_MIN};
|
||||
|
||||
for(i = 0; i < point_cnt; i++) {
|
||||
poly_coords.x1 = LV_MIN(poly_coords.x1, p[i].x);
|
||||
poly_coords.y1 = LV_MIN(poly_coords.y1, p[i].y);
|
||||
poly_coords.x2 = LV_MAX(poly_coords.x2, p[i].x);
|
||||
poly_coords.y2 = LV_MAX(poly_coords.y2, p[i].y);
|
||||
}
|
||||
|
||||
bool is_common;
|
||||
lv_area_t poly_mask;
|
||||
is_common = _lv_area_intersect(&poly_mask, &poly_coords, clip_area);
|
||||
if(!is_common) {
|
||||
lv_mem_buf_release(p);
|
||||
return;
|
||||
}
|
||||
/*Find the lowest point*/
|
||||
lv_coord_t y_min = p[0].y;
|
||||
int16_t y_min_i = 0;
|
||||
|
||||
for(i = 1; i < point_cnt; i++) {
|
||||
if(p[i].y < y_min) {
|
||||
y_min = p[i].y;
|
||||
y_min_i = i;
|
||||
}
|
||||
}
|
||||
|
||||
lv_draw_mask_line_param_t * mp = lv_mem_buf_get(sizeof(lv_draw_mask_line_param_t) * point_cnt);
|
||||
lv_draw_mask_line_param_t * mp_next = mp;
|
||||
|
||||
int32_t i_prev_left = y_min_i;
|
||||
int32_t i_prev_right = y_min_i;
|
||||
int32_t i_next_left;
|
||||
int32_t i_next_right;
|
||||
uint32_t mask_cnt = 0;
|
||||
|
||||
/*Get the index of the left and right points*/
|
||||
i_next_left = y_min_i - 1;
|
||||
if(i_next_left < 0) i_next_left = point_cnt + i_next_left;
|
||||
|
||||
i_next_right = y_min_i + 1;
|
||||
if(i_next_right > point_cnt - 1) i_next_right = 0;
|
||||
|
||||
/**
|
||||
* Check if the order of points is inverted or not.
|
||||
* The normal case is when the left point is on `y_min_i - 1`
|
||||
* Explanation:
|
||||
* if angle(p_left) < angle(p_right) -> inverted
|
||||
* dy_left/dx_left < dy_right/dx_right
|
||||
* dy_left * dx_right < dy_right * dx_left
|
||||
*/
|
||||
lv_coord_t dxl = p[i_next_left].x - p[y_min_i].x;
|
||||
lv_coord_t dxr = p[i_next_right].x - p[y_min_i].x;
|
||||
lv_coord_t dyl = p[i_next_left].y - p[y_min_i].y;
|
||||
lv_coord_t dyr = p[i_next_right].y - p[y_min_i].y;
|
||||
|
||||
bool inv = false;
|
||||
if(dyl * dxr < dyr * dxl) inv = true;
|
||||
|
||||
do {
|
||||
if(!inv) {
|
||||
i_next_left = i_prev_left - 1;
|
||||
if(i_next_left < 0) i_next_left = point_cnt + i_next_left;
|
||||
|
||||
i_next_right = i_prev_right + 1;
|
||||
if(i_next_right > point_cnt - 1) i_next_right = 0;
|
||||
}
|
||||
else {
|
||||
i_next_left = i_prev_left + 1;
|
||||
if(i_next_left > point_cnt - 1) i_next_left = 0;
|
||||
|
||||
i_next_right = i_prev_right - 1;
|
||||
if(i_next_right < 0) i_next_right = point_cnt + i_next_right;
|
||||
}
|
||||
|
||||
if(p[i_next_left].y >= p[i_prev_left].y) {
|
||||
if(p[i_next_left].y != p[i_prev_left].y &&
|
||||
p[i_next_left].x != p[i_prev_left].x) {
|
||||
lv_draw_mask_line_points_init(mp_next, p[i_prev_left].x, p[i_prev_left].y,
|
||||
p[i_next_left].x, p[i_next_left].y,
|
||||
LV_DRAW_MASK_LINE_SIDE_RIGHT);
|
||||
lv_draw_mask_add(mp_next, mp);
|
||||
mp_next++;
|
||||
}
|
||||
mask_cnt++;
|
||||
i_prev_left = i_next_left;
|
||||
}
|
||||
|
||||
if(mask_cnt == point_cnt) break;
|
||||
|
||||
if(p[i_next_right].y >= p[i_prev_right].y) {
|
||||
if(p[i_next_right].y != p[i_prev_right].y &&
|
||||
p[i_next_right].x != p[i_prev_right].x) {
|
||||
|
||||
lv_draw_mask_line_points_init(mp_next, p[i_prev_right].x, p[i_prev_right].y,
|
||||
p[i_next_right].x, p[i_next_right].y,
|
||||
LV_DRAW_MASK_LINE_SIDE_LEFT);
|
||||
lv_draw_mask_add(mp_next, mp);
|
||||
mp_next++;
|
||||
}
|
||||
mask_cnt++;
|
||||
i_prev_right = i_next_right;
|
||||
}
|
||||
|
||||
} while(mask_cnt < point_cnt);
|
||||
|
||||
lv_draw_rect(&poly_coords, clip_area, draw_dsc);
|
||||
|
||||
lv_draw_mask_remove_custom(mp);
|
||||
|
||||
lv_mem_buf_release(mp);
|
||||
lv_mem_buf_release(p);
|
||||
#else
|
||||
LV_UNUSED(points);
|
||||
LV_UNUSED(point_cnt);
|
||||
LV_UNUSED(clip_area);
|
||||
LV_UNUSED(draw_dsc);
|
||||
LV_LOG_WARN("Can't draw polygon with LV_DRAW_COMPLEX == 0");
|
||||
#endif /*LV_DRAW_COMPLEX*/
|
||||
draw_ctx->draw_polygon(draw_ctx, draw_dsc, points, 3);
|
||||
}
|
||||
|
||||
/**********************
|
||||
|
|
|
@ -27,24 +27,10 @@ extern "C" {
|
|||
* GLOBAL PROTOTYPES
|
||||
**********************/
|
||||
|
||||
/**
|
||||
* Draw a triangle
|
||||
* @param points pointer to an array with 3 points
|
||||
* @param clip_area the triangle will be drawn only in this area
|
||||
* @param draw_dsc pointer to an initialized `lv_draw_rect_dsc_t` variable
|
||||
*/
|
||||
void lv_draw_triangle(const lv_point_t points[], const lv_area_t * clip, const lv_draw_rect_dsc_t * draw_dsc);
|
||||
|
||||
/**
|
||||
* Draw a polygon. Only convex polygons are supported.
|
||||
* @param points an array of points
|
||||
* @param point_cnt number of points
|
||||
* @param clip_area polygon will be drawn only in this area
|
||||
* @param draw_dsc pointer to an initialized `lv_draw_rect_dsc_t` variable
|
||||
*/
|
||||
void lv_draw_polygon(const lv_point_t points[], uint16_t point_cnt, const lv_area_t * mask,
|
||||
const lv_draw_rect_dsc_t * draw_dsc);
|
||||
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[]);
|
||||
/**********************
|
||||
* MACROS
|
||||
**********************/
|
||||
|
|
|
@ -31,12 +31,10 @@
|
|||
* INCLUDES
|
||||
*********************/
|
||||
|
||||
#include "../lv_conf_internal.h"
|
||||
#include "lv_gpu_nxp_pxp.h"
|
||||
|
||||
#if LV_USE_GPU_NXP_PXP
|
||||
|
||||
#include "lvgl.h"
|
||||
#include "lv_gpu_nxp_pxp.h"
|
||||
#include "../misc/lv_mem.h"
|
||||
#include "../misc/lv_log.h"
|
||||
|
|
@ -38,6 +38,10 @@ extern "C" {
|
|||
* INCLUDES
|
||||
*********************/
|
||||
|
||||
#include "../../lv_conf_internal.h"
|
||||
|
||||
#if LV_USE_GPU_NXP_PXP
|
||||
|
||||
#include "../misc/lv_area.h"
|
||||
#include "../misc/lv_color.h"
|
||||
|
||||
|
@ -180,6 +184,8 @@ void lv_gpu_nxp_pxp_disable_recolor(void);
|
|||
* STATIC FUNCTIONS
|
||||
**********************/
|
||||
|
||||
#endif /*LV_USE_GPU_NXP_PXP*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /*extern "C"*/
|
||||
#endif
|
|
@ -31,10 +31,10 @@
|
|||
* INCLUDES
|
||||
*********************/
|
||||
|
||||
#include "../lv_conf_internal.h"
|
||||
#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"
|
||||
|
||||
#if LV_USE_GPU_NXP_PXP && LV_USE_GPU_NXP_PXP_AUTO_INIT
|
||||
|
||||
#include "lv_gpu_nxp_pxp.h"
|
||||
#include "fsl_pxp.h"
|
|
@ -34,7 +34,7 @@
|
|||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include "../lv_conf_internal.h"
|
||||
#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;
|
|
@ -31,12 +31,11 @@
|
|||
* INCLUDES
|
||||
*********************/
|
||||
|
||||
#include "../lv_conf_internal.h"
|
||||
#include "lv_gpu_nxp_vglite.h"
|
||||
|
||||
#if LV_USE_GPU_NXP_VG_LITE
|
||||
|
||||
#include "lvgl.h"
|
||||
#include "lv_gpu_nxp_vglite.h"
|
||||
#include "../misc/lv_log.h"
|
||||
#include "fsl_cache.h"
|
||||
#include "vg_lite.h"
|
|
@ -37,7 +37,9 @@ extern "C" {
|
|||
/*********************
|
||||
* INCLUDES
|
||||
*********************/
|
||||
#include "misc/lv_area.h"
|
||||
#include "../../lv_conf_internal.h"
|
||||
|
||||
#if LV_USE_GPU_NXP_VG_LITE
|
||||
|
||||
/*********************
|
||||
* DEFINES
|
||||
|
@ -134,6 +136,8 @@ lv_res_t lv_gpu_nxp_vglite_fill(lv_color_t * dest_buf, lv_coord_t dest_width, lv
|
|||
*/
|
||||
lv_res_t lv_gpu_nxp_vglite_blit(lv_gpu_nxp_vglite_blit_info_t * blit);
|
||||
|
||||
#endif /*LV_USE_GPU_NXP_VG_LITE*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /*extern "C"*/
|
||||
#endif
|
|
@ -18,11 +18,11 @@ such as OpenGL.
|
|||
|
||||
## Notices for files
|
||||
|
||||
### `lv_gpu_sdl_stack_blur.c`
|
||||
### `lv_draw_sdl_stack_blur.c`
|
||||
|
||||
Contains modified code from [android-stackblur](https://github.com/kikoso/android-stackblur) project.
|
||||
Apache License 2.0
|
||||
|
||||
### `lv_gpu_sdl_lru.c`/`lv_gpu_sdl_lru.h`
|
||||
### `lv_draw_sdl_lru.c`/`lv_draw_sdl_lru.h`
|
||||
|
||||
Contains modified code from [C-LRU-Cache](https://github.com/willcannings/C-LRU-Cache) project. No license defined.
|
|
@ -0,0 +1,98 @@
|
|||
/**
|
||||
* @file lv_draw_sdl.c
|
||||
*
|
||||
*/
|
||||
|
||||
/*********************
|
||||
* INCLUDES
|
||||
*********************/
|
||||
|
||||
|
||||
#include "../../lv_conf_internal.h"
|
||||
|
||||
#if LV_USE_GPU_SDL
|
||||
|
||||
#include "lv_draw_sdl.h"
|
||||
#include "lv_draw_sdl_utils.h"
|
||||
#include "lv_draw_sdl_texture_cache.h"
|
||||
|
||||
/*********************
|
||||
* DEFINES
|
||||
*********************/
|
||||
void lv_draw_sdl_draw_rect(lv_draw_ctx_t * draw_ctx, const lv_draw_rect_dsc_t * dsc, const lv_area_t * coords);
|
||||
|
||||
lv_res_t lv_draw_sdl_img_core(lv_draw_ctx_t * draw_ctx, const lv_draw_img_dsc_t * draw_dsc,
|
||||
const lv_area_t * coords, const void * src);
|
||||
|
||||
void lv_draw_sdl_draw_letter(lv_draw_ctx_t * draw_ctx, const lv_draw_label_dsc_t * dsc, const lv_point_t * pos_p,
|
||||
uint32_t letter);
|
||||
|
||||
void lv_draw_sdl_draw_line(lv_draw_ctx_t * draw_ctx, const lv_draw_line_dsc_t * dsc, const lv_point_t * point1,
|
||||
const lv_point_t * point2);
|
||||
|
||||
void lv_draw_sdl_draw_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);
|
||||
|
||||
void lv_draw_sdl_polygon(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_sdl_draw_bg(lv_draw_ctx_t * draw_ctx, const lv_draw_rect_dsc_t * dsc, const lv_area_t * coords);
|
||||
|
||||
/**********************
|
||||
* TYPEDEFS
|
||||
**********************/
|
||||
|
||||
/**********************
|
||||
* STATIC PROTOTYPES
|
||||
**********************/
|
||||
|
||||
/**********************
|
||||
* STATIC VARIABLES
|
||||
**********************/
|
||||
|
||||
/**********************
|
||||
* MACROS
|
||||
**********************/
|
||||
|
||||
/**********************
|
||||
* GLOBAL FUNCTIONS
|
||||
**********************/
|
||||
|
||||
void lv_draw_sdl_init_ctx(lv_disp_drv_t * disp_drv, lv_draw_ctx_t * draw_ctx)
|
||||
{
|
||||
_lv_draw_sdl_utils_init();
|
||||
lv_memset_00(draw_ctx, sizeof(lv_draw_sdl_ctx_t));
|
||||
draw_ctx->draw_rect = lv_draw_sdl_draw_rect;
|
||||
draw_ctx->draw_img = lv_draw_sdl_img_core;
|
||||
draw_ctx->draw_letter = lv_draw_sdl_draw_letter;
|
||||
draw_ctx->draw_line = lv_draw_sdl_draw_line;
|
||||
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;
|
||||
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));
|
||||
lv_memset_00(draw_ctx_sdl->internals, sizeof(lv_draw_sdl_context_internals_t));
|
||||
lv_draw_sdl_texture_cache_init(draw_ctx_sdl);
|
||||
}
|
||||
|
||||
void lv_draw_sdl_deinit_ctx(lv_disp_drv_t * disp_drv, lv_draw_ctx_t * draw_ctx)
|
||||
{
|
||||
lv_draw_sdl_ctx_t * draw_ctx_sdl = (lv_draw_sdl_ctx_t *) draw_ctx;
|
||||
lv_draw_sdl_texture_cache_deinit(draw_ctx_sdl);
|
||||
lv_mem_free(draw_ctx_sdl->internals);
|
||||
_lv_draw_sdl_utils_deinit();
|
||||
}
|
||||
|
||||
SDL_Texture * lv_draw_sdl_create_screen_texture(SDL_Renderer * renderer, lv_coord_t hor, lv_coord_t ver)
|
||||
{
|
||||
SDL_Texture * texture = SDL_CreateTexture(renderer, LV_DRAW_SDL_TEXTURE_FORMAT, SDL_TEXTUREACCESS_TARGET, hor, ver);
|
||||
SDL_SetTextureBlendMode(texture, SDL_BLENDMODE_BLEND);
|
||||
return texture;
|
||||
}
|
||||
|
||||
/**********************
|
||||
* STATIC FUNCTIONS
|
||||
**********************/
|
||||
|
||||
#endif /*LV_USE_GPU_SDL*/
|
|
@ -0,0 +1,96 @@
|
|||
/**
|
||||
* @file lv_draw_sdl.h
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef LV_DRAW_SDL_H
|
||||
#define LV_DRAW_SDL_H
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*********************
|
||||
* INCLUDES
|
||||
*********************/
|
||||
#include "../../lv_conf_internal.h"
|
||||
|
||||
#if LV_USE_GPU_SDL
|
||||
|
||||
#include LV_GPU_SDL_INCLUDE_PATH
|
||||
|
||||
#include "../lv_draw.h"
|
||||
#include "../../core/lv_disp.h"
|
||||
|
||||
/*********************
|
||||
* DEFINES
|
||||
*********************/
|
||||
|
||||
#if SDL_BYTEORDER == SDL_BIG_ENDIAN
|
||||
#define LV_DRAW_SDL_TEXTURE_FORMAT SDL_PIXELFORMAT_ARGB8888
|
||||
#else
|
||||
#define LV_DRAW_SDL_TEXTURE_FORMAT SDL_PIXELFORMAT_RGBA8888
|
||||
#endif
|
||||
|
||||
/**********************
|
||||
* TYPEDEFS
|
||||
**********************/
|
||||
|
||||
struct lv_draw_sdl_context_internals_t;
|
||||
|
||||
typedef struct {
|
||||
/**
|
||||
* Render for display driver
|
||||
*/
|
||||
SDL_Renderer * renderer;
|
||||
void * user_data;
|
||||
} lv_draw_sdl_drv_param_t;
|
||||
|
||||
typedef struct {
|
||||
lv_draw_ctx_t base_draw;
|
||||
SDL_Renderer * renderer;
|
||||
struct lv_draw_sdl_context_internals_t * internals;
|
||||
} lv_draw_sdl_ctx_t;
|
||||
|
||||
/**********************
|
||||
* GLOBAL PROTOTYPES
|
||||
**********************/
|
||||
|
||||
void lv_draw_sdl_init_ctx(lv_disp_drv_t * disp_drv, lv_draw_ctx_t * draw_ctx);
|
||||
|
||||
/**
|
||||
* @brief Free caches
|
||||
*
|
||||
*/
|
||||
void lv_draw_sdl_deinit_ctx(lv_disp_drv_t * disp_drv, lv_draw_ctx_t * draw_ctx);
|
||||
|
||||
SDL_Texture * lv_draw_sdl_create_screen_texture(SDL_Renderer * renderer, lv_coord_t hor, lv_coord_t ver);
|
||||
|
||||
/*======================
|
||||
* Add/remove functions
|
||||
*=====================*/
|
||||
|
||||
/*=====================
|
||||
* Setter functions
|
||||
*====================*/
|
||||
|
||||
/*=====================
|
||||
* Getter functions
|
||||
*====================*/
|
||||
|
||||
/*=====================
|
||||
* Other functions
|
||||
*====================*/
|
||||
|
||||
/**********************
|
||||
* MACROS
|
||||
**********************/
|
||||
|
||||
#endif /*LV_USE_GPU_SDL*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /*extern "C"*/
|
||||
#endif
|
||||
|
||||
#endif /*LV_DRAW_SDL_H*/
|
|
@ -0,0 +1,18 @@
|
|||
CSRCS += lv_draw_sdl.c
|
||||
CSRCS += lv_draw_sdl_arc.c
|
||||
CSRCS += lv_draw_sdl_bg.c
|
||||
CSRCS += lv_draw_sdl_composite.c
|
||||
CSRCS += lv_draw_sdl_img.c
|
||||
CSRCS += lv_draw_sdl_label.c
|
||||
CSRCS += lv_draw_sdl_line.c
|
||||
CSRCS += lv_draw_sdl_mask.c
|
||||
CSRCS += lv_draw_sdl_polygon.c
|
||||
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
|
||||
|
||||
DEPPATH += --dep-path $(LVGL_DIR)/$(LVGL_DIR_NAME)/src/draw/sdl
|
||||
VPATH += :$(LVGL_DIR)/$(LVGL_DIR_NAME)/src/draw/sdl
|
||||
|
||||
CFLAGS += "-I$(LVGL_DIR)/$(LVGL_DIR_NAME)/src/draw/sdl"
|
|
@ -0,0 +1,238 @@
|
|||
/**
|
||||
* @file lv_draw_sdl_arc.c
|
||||
*
|
||||
*/
|
||||
|
||||
/*********************
|
||||
* INCLUDES
|
||||
*********************/
|
||||
#include "../../lv_conf_internal.h"
|
||||
|
||||
#if LV_USE_GPU_SDL
|
||||
|
||||
#include "lv_draw_sdl.h"
|
||||
#include "lv_draw_sdl_utils.h"
|
||||
#include "lv_draw_sdl_texture_cache.h"
|
||||
#include "lv_draw_sdl_composite.h"
|
||||
|
||||
/*********************
|
||||
* DEFINES
|
||||
*********************/
|
||||
|
||||
/**********************
|
||||
* TYPEDEFS
|
||||
**********************/
|
||||
|
||||
/**********************
|
||||
* STATIC PROTOTYPES
|
||||
**********************/
|
||||
|
||||
/**********************
|
||||
* STATIC VARIABLES
|
||||
**********************/
|
||||
|
||||
/**********************
|
||||
* MACROS
|
||||
**********************/
|
||||
|
||||
static void dump_masks(SDL_Texture * texture, const lv_area_t * coords, const int16_t * ids, int16_t ids_count,
|
||||
const int16_t * caps);
|
||||
|
||||
static void get_cap_area(int16_t angle, lv_coord_t thickness, uint16_t radius, const lv_point_t * center,
|
||||
lv_area_t * out);
|
||||
|
||||
/**********************
|
||||
* GLOBAL FUNCTIONS
|
||||
**********************/
|
||||
void lv_draw_sdl_draw_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)
|
||||
{
|
||||
lv_draw_sdl_ctx_t * ctx = (lv_draw_sdl_ctx_t *) draw_ctx;
|
||||
|
||||
lv_area_t area_out;
|
||||
area_out.x1 = center->x - radius;
|
||||
area_out.y1 = center->y - radius;
|
||||
area_out.x2 = center->x + radius - 1; /*-1 because the center already belongs to the left/bottom part*/
|
||||
area_out.y2 = center->y + radius - 1;
|
||||
|
||||
lv_area_t draw_area;
|
||||
if(!_lv_area_intersect(&draw_area, &area_out, draw_ctx->clip_area)) {
|
||||
return;
|
||||
}
|
||||
|
||||
lv_area_t area_in;
|
||||
lv_area_copy(&area_in, &area_out);
|
||||
area_in.x1 += dsc->width;
|
||||
area_in.y1 += dsc->width;
|
||||
area_in.x2 -= dsc->width;
|
||||
area_in.y2 -= dsc->width;
|
||||
|
||||
|
||||
while(start_angle >= 360) start_angle -= 360;
|
||||
while(end_angle >= 360) end_angle -= 360;
|
||||
|
||||
int16_t mask_ids[3] = {LV_MASK_ID_INV, LV_MASK_ID_INV, LV_MASK_ID_INV}, mask_ids_count = 1;
|
||||
int16_t cap_ids[2] = {LV_MASK_ID_INV, LV_MASK_ID_INV};
|
||||
|
||||
lv_draw_mask_radius_param_t mask_out_param;
|
||||
lv_draw_mask_radius_init(&mask_out_param, &area_out, LV_RADIUS_CIRCLE, false);
|
||||
mask_ids[0] = lv_draw_mask_add(&mask_out_param, NULL);
|
||||
|
||||
lv_draw_mask_radius_param_t mask_in_param;
|
||||
if(lv_area_get_width(&area_in) > 0 && lv_area_get_height(&area_in) > 0) {
|
||||
lv_draw_mask_radius_init(&mask_in_param, &area_in, LV_RADIUS_CIRCLE, true);
|
||||
mask_ids[1] = lv_draw_mask_add(&mask_in_param, NULL);
|
||||
mask_ids_count++;
|
||||
}
|
||||
|
||||
lv_draw_mask_angle_param_t mask_angle_param;
|
||||
if((start_angle - end_angle) % 360) {
|
||||
lv_draw_mask_angle_init(&mask_angle_param, center->x, center->y, start_angle, end_angle);
|
||||
mask_ids[2] = lv_draw_mask_add(&mask_angle_param, NULL);
|
||||
mask_ids_count++;
|
||||
}
|
||||
|
||||
lv_draw_mask_radius_param_t cap_start_param, cap_end_param;
|
||||
if(mask_ids_count == 3 && dsc->rounded) {
|
||||
lv_area_t start_area, end_area;
|
||||
get_cap_area((int16_t) start_angle, dsc->width, radius, center, &start_area);
|
||||
get_cap_area((int16_t) end_angle, dsc->width, radius, center, &end_area);
|
||||
lv_draw_mask_radius_init(&cap_start_param, &start_area, dsc->width / 2, false);
|
||||
cap_ids[0] = lv_draw_mask_add(&cap_start_param, NULL);
|
||||
lv_draw_mask_radius_init(&cap_end_param, &end_area, dsc->width / 2, false);
|
||||
cap_ids[1] = lv_draw_mask_add(&cap_end_param, NULL);
|
||||
}
|
||||
|
||||
lv_coord_t w = lv_area_get_width(&draw_area), h = lv_area_get_height(&draw_area);
|
||||
SDL_Texture * texture = lv_draw_sdl_composite_texture_obtain(ctx, LV_DRAW_SDL_COMPOSITE_TEXTURE_ID_STREAM1, w, h);
|
||||
SDL_SetTextureBlendMode(texture, SDL_BLENDMODE_BLEND);
|
||||
dump_masks(texture, &draw_area, mask_ids, mask_ids_count, cap_ids[0] != LV_MASK_ID_INV ? cap_ids : NULL);
|
||||
|
||||
lv_draw_mask_remove_id(mask_ids[0]);
|
||||
lv_draw_mask_free_param(&mask_out_param);
|
||||
|
||||
if(mask_ids_count > 1) {
|
||||
lv_draw_mask_remove_id(mask_ids[1]);
|
||||
lv_draw_mask_free_param(&mask_in_param);
|
||||
}
|
||||
|
||||
if(mask_ids_count > 2) {
|
||||
lv_draw_mask_remove_id(mask_ids[2]);
|
||||
lv_draw_mask_free_param(&mask_angle_param);
|
||||
}
|
||||
|
||||
if(cap_ids[0] != LV_MASK_ID_INV) {
|
||||
lv_draw_mask_remove_id(cap_ids[0]);
|
||||
lv_draw_mask_remove_id(cap_ids[1]);
|
||||
lv_draw_mask_free_param(&cap_start_param);
|
||||
lv_draw_mask_free_param(&cap_end_param);
|
||||
}
|
||||
|
||||
SDL_Rect srcrect = {0, 0, w, h}, dstrect;
|
||||
lv_area_to_sdl_rect(&draw_area, &dstrect);
|
||||
SDL_Color color;
|
||||
lv_color_to_sdl_color(&dsc->color, &color);
|
||||
SDL_SetTextureColorMod(texture, color.r, color.g, color.b);
|
||||
SDL_SetTextureAlphaMod(texture, dsc->opa);
|
||||
SDL_RenderCopy(ctx->renderer, texture, &srcrect, &dstrect);
|
||||
}
|
||||
|
||||
/**********************
|
||||
* STATIC FUNCTIONS
|
||||
**********************/
|
||||
|
||||
static void dump_masks(SDL_Texture * texture, const lv_area_t * coords, const int16_t * ids, int16_t ids_count,
|
||||
const int16_t * caps)
|
||||
{
|
||||
lv_coord_t w = lv_area_get_width(coords), h = lv_area_get_height(coords);
|
||||
SDL_assert(w > 0 && h > 0);
|
||||
SDL_Rect rect = {0, 0, w, h};
|
||||
uint8_t * pixels;
|
||||
int pitch;
|
||||
if(SDL_LockTexture(texture, &rect, (void **) &pixels, &pitch) != 0) return;
|
||||
|
||||
lv_opa_t * line_buf = lv_mem_buf_get(rect.w);
|
||||
for(lv_coord_t y = 0; y < rect.h; y++) {
|
||||
lv_memset_ff(line_buf, rect.w);
|
||||
lv_coord_t abs_x = (lv_coord_t) coords->x1, abs_y = (lv_coord_t)(y + coords->y1), len = (lv_coord_t) rect.w;
|
||||
lv_draw_mask_res_t res;
|
||||
res = lv_draw_mask_apply_ids(line_buf, abs_x, abs_y, len, ids, ids_count);
|
||||
if(res == LV_DRAW_MASK_RES_TRANSP) {
|
||||
lv_memset_00(&pixels[y * pitch], 4 * rect.w);
|
||||
}
|
||||
else if(res == LV_DRAW_MASK_RES_FULL_COVER) {
|
||||
lv_memset_ff(&pixels[y * pitch], 4 * rect.w);
|
||||
}
|
||||
else {
|
||||
for(int x = 0; x < rect.w; x++) {
|
||||
uint8_t * pixel = &pixels[y * pitch + x * 4];
|
||||
*pixel = line_buf[x];
|
||||
pixel[1] = pixel[2] = pixel[3] = 0xFF;
|
||||
}
|
||||
}
|
||||
if(caps) {
|
||||
for(int i = 0; i < 2; i++) {
|
||||
lv_memset_ff(line_buf, rect.w);
|
||||
res = lv_draw_mask_apply_ids(line_buf, abs_x, abs_y, len, &caps[i], 1);
|
||||
if(res == LV_DRAW_MASK_RES_TRANSP) {
|
||||
/* Ignore */
|
||||
}
|
||||
else if(res == LV_DRAW_MASK_RES_FULL_COVER) {
|
||||
lv_memset_ff(&pixels[y * pitch], 4 * rect.w);
|
||||
}
|
||||
else {
|
||||
for(int x = 0; x < rect.w; x++) {
|
||||
uint8_t * pixel = &pixels[y * pitch + x * 4];
|
||||
uint16_t old_opa = line_buf[x] + *pixel;
|
||||
*pixel = LV_MIN(old_opa, 0xFF);
|
||||
pixel[1] = pixel[2] = pixel[3] = 0xFF;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
lv_mem_buf_release(line_buf);
|
||||
SDL_UnlockTexture(texture);
|
||||
}
|
||||
|
||||
static void get_cap_area(int16_t angle, lv_coord_t thickness, uint16_t radius, const lv_point_t * center,
|
||||
lv_area_t * out)
|
||||
{
|
||||
const uint8_t ps = 8;
|
||||
const uint8_t pa = 127;
|
||||
|
||||
int32_t thick_half = thickness / 2;
|
||||
uint8_t thick_corr = (thickness & 0x01) ? 0 : 1;
|
||||
|
||||
int32_t cir_x;
|
||||
int32_t cir_y;
|
||||
|
||||
cir_x = ((radius - thick_half) * lv_trigo_sin((int16_t)(90 - angle))) >> (LV_TRIGO_SHIFT - ps);
|
||||
cir_y = ((radius - thick_half) * lv_trigo_sin(angle)) >> (LV_TRIGO_SHIFT - ps);
|
||||
|
||||
/*Actually the center of the pixel need to be calculated so apply 1/2 px offset*/
|
||||
if(cir_x > 0) {
|
||||
cir_x = (cir_x - pa) >> ps;
|
||||
out->x1 = cir_x - thick_half + thick_corr;
|
||||
out->x2 = cir_x + thick_half;
|
||||
}
|
||||
else {
|
||||
cir_x = (cir_x + pa) >> ps;
|
||||
out->x1 = cir_x - thick_half;
|
||||
out->x2 = cir_x + thick_half - thick_corr;
|
||||
}
|
||||
|
||||
if(cir_y > 0) {
|
||||
cir_y = (cir_y - pa) >> ps;
|
||||
out->y1 = cir_y - thick_half + thick_corr;
|
||||
out->y2 = cir_y + thick_half;
|
||||
}
|
||||
else {
|
||||
cir_y = (cir_y + pa) >> ps;
|
||||
out->y1 = cir_y - thick_half;
|
||||
out->y2 = cir_y + thick_half - thick_corr;
|
||||
}
|
||||
lv_area_move(out, center->x, center->y);
|
||||
}
|
||||
|
||||
#endif /*LV_USE_GPU_SDL*/
|
|
@ -0,0 +1,106 @@
|
|||
/**
|
||||
* @file lv_draw_sdl_bg.c
|
||||
*
|
||||
*/
|
||||
|
||||
/*********************
|
||||
* INCLUDES
|
||||
*********************/
|
||||
|
||||
#include "../../lv_conf_internal.h"
|
||||
|
||||
#if LV_USE_GPU_SDL
|
||||
|
||||
#include "../lv_draw_rect.h"
|
||||
#include "../lv_draw_img.h"
|
||||
#include "../lv_draw_label.h"
|
||||
#include "../lv_draw_mask.h"
|
||||
#include "../../core/lv_refr.h"
|
||||
#include "lv_draw_sdl_utils.h"
|
||||
#include "lv_draw_sdl_texture_cache.h"
|
||||
#include "lv_draw_sdl_composite.h"
|
||||
|
||||
/*********************
|
||||
* DEFINES
|
||||
*********************/
|
||||
|
||||
/**********************
|
||||
* TYPEDEFS
|
||||
**********************/
|
||||
|
||||
/**********************
|
||||
* STATIC PROTOTYPES
|
||||
**********************/
|
||||
|
||||
static void draw_bg_color(lv_draw_sdl_ctx_t * ctx, const lv_area_t * coords, const lv_area_t * draw_area,
|
||||
const lv_draw_rect_dsc_t * dsc);
|
||||
|
||||
static void draw_bg_img(lv_draw_sdl_ctx_t * ctx, const lv_area_t * coords, const lv_area_t * draw_area,
|
||||
const lv_draw_rect_dsc_t * dsc);
|
||||
|
||||
/**********************
|
||||
* STATIC VARIABLES
|
||||
**********************/
|
||||
|
||||
/**********************
|
||||
* MACROS
|
||||
**********************/
|
||||
|
||||
/**********************
|
||||
* GLOBAL FUNCTIONS
|
||||
**********************/
|
||||
|
||||
void lv_draw_sdl_draw_bg(lv_draw_ctx_t * draw_ctx, const lv_draw_rect_dsc_t * dsc, const lv_area_t * coords)
|
||||
{
|
||||
const lv_area_t * clip = draw_ctx->clip_area;
|
||||
lv_draw_sdl_ctx_t * ctx = (lv_draw_sdl_ctx_t *) draw_ctx;
|
||||
/* Coords will be translated so coords will start at (0,0) */
|
||||
lv_area_t t_area;
|
||||
bool has_content = _lv_area_intersect(&t_area, coords, clip);
|
||||
|
||||
/* Shadows and outlines will also draw in extended area */
|
||||
if(has_content) {
|
||||
if(dsc->bg_img_src) {
|
||||
draw_bg_img(ctx, coords, &t_area, dsc);
|
||||
}
|
||||
else {
|
||||
draw_bg_color(ctx, coords, &t_area, dsc);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**********************
|
||||
* STATIC FUNCTIONS
|
||||
**********************/
|
||||
|
||||
static void draw_bg_color(lv_draw_sdl_ctx_t * ctx, const lv_area_t * coords, const lv_area_t * draw_area,
|
||||
const lv_draw_rect_dsc_t * dsc)
|
||||
{
|
||||
SDL_Color bg_color;
|
||||
lv_color_to_sdl_color(&dsc->bg_color, &bg_color);
|
||||
SDL_SetRenderDrawBlendMode(ctx->renderer, SDL_BLENDMODE_NONE);
|
||||
SDL_SetRenderDrawColor(ctx->renderer, bg_color.r, bg_color.g, bg_color.b, dsc->bg_opa);
|
||||
|
||||
SDL_Rect rect;
|
||||
lv_area_to_sdl_rect(draw_area, &rect);
|
||||
SDL_RenderFillRect(ctx->renderer, &rect);
|
||||
|
||||
SDL_SetRenderDrawBlendMode(ctx->renderer, SDL_BLENDMODE_BLEND);
|
||||
}
|
||||
|
||||
static void draw_bg_img(lv_draw_sdl_ctx_t * ctx, const lv_area_t * coords, const lv_area_t * draw_area,
|
||||
const lv_draw_rect_dsc_t * dsc)
|
||||
{
|
||||
SDL_SetRenderDrawBlendMode(ctx->renderer, SDL_BLENDMODE_NONE);
|
||||
SDL_SetRenderDrawColor(ctx->renderer, 0, 0, 0, 0);
|
||||
|
||||
SDL_Rect rect;
|
||||
lv_area_to_sdl_rect(draw_area, &rect);
|
||||
SDL_RenderFillRect(ctx->renderer, &rect);
|
||||
|
||||
SDL_SetRenderDrawBlendMode(ctx->renderer, SDL_BLENDMODE_BLEND);
|
||||
lv_draw_rect((lv_draw_ctx_t *) ctx, dsc, coords);
|
||||
}
|
||||
|
||||
#endif /*LV_USE_GPU_SDL*/
|
|
@ -0,0 +1,256 @@
|
|||
/**
|
||||
* @file lv_draw_sdl_composite.c
|
||||
*
|
||||
*/
|
||||
|
||||
/*********************
|
||||
* INCLUDES
|
||||
*********************/
|
||||
#include "../../lv_conf_internal.h"
|
||||
|
||||
#if LV_USE_GPU_SDL
|
||||
|
||||
#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"
|
||||
|
||||
/*********************
|
||||
* DEFINES
|
||||
*********************/
|
||||
|
||||
/**********************
|
||||
* TYPEDEFS
|
||||
**********************/
|
||||
|
||||
typedef struct {
|
||||
lv_sdl_cache_key_magic_t magic;
|
||||
lv_draw_sdl_composite_texture_id_t type;
|
||||
} composite_key_t;
|
||||
|
||||
/**********************
|
||||
* STATIC PROTOTYPES
|
||||
**********************/
|
||||
|
||||
static composite_key_t mask_key_create(lv_draw_sdl_composite_texture_id_t type);
|
||||
|
||||
static lv_coord_t next_pow_of_2(lv_coord_t num);
|
||||
|
||||
static void dump_masks(SDL_Texture * texture, const lv_area_t * coords);
|
||||
/**********************
|
||||
* STATIC VARIABLES
|
||||
**********************/
|
||||
|
||||
/**********************
|
||||
* MACROS
|
||||
**********************/
|
||||
|
||||
/**********************
|
||||
* GLOBAL FUNCTIONS
|
||||
**********************/
|
||||
|
||||
bool lv_draw_sdl_composite_begin(lv_draw_sdl_ctx_t * ctx, const lv_area_t * coords_in, const lv_area_t * clip_in,
|
||||
const lv_area_t * extension, lv_blend_mode_t blend_mode, lv_area_t * coords_out,
|
||||
lv_area_t * clip_out, lv_area_t * apply_area)
|
||||
{
|
||||
lv_area_t full_coords = *coords_in;
|
||||
|
||||
/* Normalize full_coords */
|
||||
if(full_coords.x1 > full_coords.x2) {
|
||||
lv_coord_t x2 = full_coords.x2;
|
||||
full_coords.x2 = full_coords.x1;
|
||||
full_coords.x1 = x2;
|
||||
}
|
||||
if(full_coords.y1 > full_coords.y2) {
|
||||
lv_coord_t y2 = full_coords.y2;
|
||||
full_coords.y2 = full_coords.y1;
|
||||
full_coords.y1 = y2;
|
||||
}
|
||||
|
||||
if(extension) {
|
||||
full_coords.x1 -= extension->x1;
|
||||
full_coords.x2 += extension->x2;
|
||||
full_coords.y1 -= extension->y1;
|
||||
full_coords.y2 += extension->y2;
|
||||
}
|
||||
|
||||
if(!_lv_area_intersect(apply_area, &full_coords, clip_in)) return false;
|
||||
bool has_mask = lv_draw_mask_is_any(apply_area);
|
||||
|
||||
const bool draw_mask = has_mask && LV_GPU_SDL_CUSTOM_BLEND_MODE;
|
||||
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_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 */
|
||||
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);
|
||||
SDL_SetRenderTarget(ctx->renderer, internals->composition);
|
||||
SDL_SetRenderDrawColor(ctx->renderer, 255, 255, 255, 0);
|
||||
SDL_RenderClear(ctx->renderer);
|
||||
#if LV_GPU_SDL_CUSTOM_BLEND_MODE
|
||||
internals->mask = lv_draw_sdl_composite_texture_obtain(ctx, LV_DRAW_SDL_COMPOSITE_TEXTURE_ID_STREAM0, w, h);
|
||||
dump_masks(internals->mask, apply_area);
|
||||
#endif
|
||||
}
|
||||
else if(has_mask) {
|
||||
/* Fallback mask handling. This will at least make bars looks less bad */
|
||||
for(uint8_t i = 0; i < _LV_MASK_MAX_NUM; i++) {
|
||||
_lv_draw_mask_common_dsc_t * comm_param = LV_GC_ROOT(_lv_draw_mask_list[i]).param;
|
||||
if(comm_param == NULL) continue;
|
||||
switch(comm_param->type) {
|
||||
case LV_DRAW_MASK_TYPE_RADIUS: {
|
||||
const lv_draw_mask_radius_param_t * param = (const lv_draw_mask_radius_param_t *) comm_param;
|
||||
if(param->cfg.outer) break;
|
||||
_lv_area_intersect(clip_out, apply_area, ¶m->cfg.rect);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return has_mask;
|
||||
}
|
||||
|
||||
void lv_draw_sdl_composite_end(lv_draw_sdl_ctx_t * ctx, const lv_area_t * apply_area, lv_blend_mode_t blend_mode)
|
||||
{
|
||||
lv_draw_sdl_context_internals_t * internals = ctx->internals;
|
||||
SDL_Rect src_rect = {0, 0, lv_area_get_width(apply_area), lv_area_get_height(apply_area)};
|
||||
#if LV_GPU_SDL_CUSTOM_BLEND_MODE
|
||||
if(internals->mask) {
|
||||
SDL_BlendMode mode = SDL_ComposeCustomBlendMode(SDL_BLENDFACTOR_ZERO, SDL_BLENDFACTOR_ONE,
|
||||
SDL_BLENDOPERATION_ADD, SDL_BLENDFACTOR_ZERO,
|
||||
SDL_BLENDFACTOR_SRC_ALPHA, SDL_BLENDOPERATION_ADD);
|
||||
SDL_SetTextureBlendMode(internals->mask, mode);
|
||||
SDL_RenderCopy(ctx->renderer, internals->mask, &src_rect, &src_rect);
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Shapes are drawn on composite layer when mask or blend mode is present */
|
||||
if(internals->composition) {
|
||||
SDL_Rect dst_rect;
|
||||
lv_area_to_sdl_rect(apply_area, &dst_rect);
|
||||
|
||||
SDL_SetRenderTarget(ctx->renderer, ctx->base_draw.buf);
|
||||
switch(blend_mode) {
|
||||
case LV_BLEND_MODE_NORMAL:
|
||||
SDL_SetTextureBlendMode(internals->composition, SDL_BLENDMODE_BLEND);
|
||||
break;
|
||||
case LV_BLEND_MODE_ADDITIVE:
|
||||
SDL_SetTextureBlendMode(internals->composition, SDL_BLENDMODE_ADD);
|
||||
break;
|
||||
#if LV_GPU_SDL_CUSTOM_BLEND_MODE
|
||||
case LV_BLEND_MODE_SUBTRACTIVE: {
|
||||
SDL_BlendMode mode = SDL_ComposeCustomBlendMode(SDL_BLENDFACTOR_ONE, SDL_BLENDFACTOR_ONE,
|
||||
SDL_BLENDOPERATION_SUBTRACT, SDL_BLENDFACTOR_ONE,
|
||||
SDL_BLENDFACTOR_ONE, SDL_BLENDOPERATION_SUBTRACT);
|
||||
SDL_SetTextureBlendMode(internals->composition, mode);
|
||||
break;
|
||||
}
|
||||
case LV_BLEND_MODE_MULTIPLY: {
|
||||
SDL_BlendMode mode = SDL_ComposeCustomBlendMode(SDL_BLENDFACTOR_ZERO, SDL_BLENDFACTOR_SRC_COLOR,
|
||||
SDL_BLENDOPERATION_ADD, SDL_BLENDFACTOR_ZERO,
|
||||
SDL_BLENDFACTOR_DST_ALPHA, SDL_BLENDOPERATION_ADD);
|
||||
SDL_SetTextureBlendMode(internals->composition, mode);
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
default:
|
||||
LV_LOG_WARN("Doesn't support blend mode %d", blend_mode);
|
||||
SDL_SetTextureBlendMode(internals->composition, SDL_BLENDMODE_BLEND);
|
||||
/* Unsupported yet */
|
||||
break;
|
||||
}
|
||||
SDL_RenderCopy(ctx->renderer, internals->composition, &src_rect, &dst_rect);
|
||||
}
|
||||
|
||||
internals->mask = internals->composition = NULL;
|
||||
}
|
||||
|
||||
SDL_Texture * lv_draw_sdl_composite_texture_obtain(lv_draw_sdl_ctx_t * ctx, lv_draw_sdl_composite_texture_id_t id,
|
||||
lv_coord_t w, lv_coord_t h)
|
||||
{
|
||||
lv_point_t * tex_size = NULL;
|
||||
composite_key_t mask_key = mask_key_create(id);
|
||||
SDL_Texture * result = lv_draw_sdl_texture_cache_get_with_userdata(ctx, &mask_key, sizeof(composite_key_t), NULL,
|
||||
(void **) &tex_size);
|
||||
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) {
|
||||
access = SDL_TEXTUREACCESS_TARGET;
|
||||
}
|
||||
result = SDL_CreateTexture(ctx->renderer, LV_DRAW_SDL_TEXTURE_FORMAT, access, size, size);
|
||||
tex_size = lv_mem_alloc(sizeof(lv_point_t));
|
||||
tex_size->x = tex_size->y = size;
|
||||
lv_draw_sdl_texture_cache_put_advanced(ctx, &mask_key, sizeof(composite_key_t), result, tex_size, lv_mem_free, 0);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**********************
|
||||
* STATIC FUNCTIONS
|
||||
**********************/
|
||||
|
||||
static composite_key_t mask_key_create(lv_draw_sdl_composite_texture_id_t type)
|
||||
{
|
||||
composite_key_t key;
|
||||
/* VERY IMPORTANT! Padding between members is uninitialized, so we have to wipe them manually */
|
||||
SDL_memset(&key, 0, sizeof(key));
|
||||
key.magic = LV_GPU_CACHE_KEY_MAGIC_MASK;
|
||||
key.type = type;
|
||||
return key;
|
||||
}
|
||||
|
||||
static lv_coord_t next_pow_of_2(lv_coord_t num)
|
||||
{
|
||||
lv_coord_t n = 128;
|
||||
while(n < num && n < 16384) {
|
||||
n = n << 1;
|
||||
}
|
||||
return n;
|
||||
}
|
||||
|
||||
static void dump_masks(SDL_Texture * texture, const lv_area_t * coords)
|
||||
{
|
||||
lv_coord_t w = lv_area_get_width(coords), h = lv_area_get_height(coords);
|
||||
SDL_assert(w > 0 && h > 0);
|
||||
SDL_Rect rect = {0, 0, w, h};
|
||||
uint8_t * pixels;
|
||||
int pitch;
|
||||
if(SDL_LockTexture(texture, &rect, (void **) &pixels, &pitch) != 0) return;
|
||||
|
||||
lv_opa_t * line_buf = lv_mem_buf_get(rect.w);
|
||||
for(lv_coord_t y = 0; y < rect.h; y++) {
|
||||
lv_memset_ff(line_buf, rect.w);
|
||||
lv_coord_t abs_x = (lv_coord_t) coords->x1, abs_y = (lv_coord_t)(y + coords->y1), len = (lv_coord_t) rect.w;
|
||||
lv_draw_mask_res_t res;
|
||||
res = lv_draw_mask_apply(line_buf, abs_x, abs_y, len);
|
||||
if(res == LV_DRAW_MASK_RES_TRANSP) {
|
||||
lv_memset_00(&pixels[y * pitch], 4 * rect.w);
|
||||
}
|
||||
else if(res == LV_DRAW_MASK_RES_FULL_COVER) {
|
||||
lv_memset_ff(&pixels[y * pitch], 4 * rect.w);
|
||||
}
|
||||
else {
|
||||
for(int x = 0; x < rect.w; x++) {
|
||||
const size_t idx = y * pitch + x * 4;
|
||||
pixels[idx] = line_buf[x];
|
||||
pixels[idx + 1] = pixels[idx + 2] = pixels[idx + 3] = 0xFF;
|
||||
}
|
||||
}
|
||||
}
|
||||
lv_mem_buf_release(line_buf);
|
||||
SDL_UnlockTexture(texture);
|
||||
}
|
||||
|
||||
#endif /*LV_USE_GPU_SDL*/
|
|
@ -0,0 +1,72 @@
|
|||
/**
|
||||
* @file lv_draw_sdl_composite.h
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef LV_DRAW_SDL_COMPOSITE_H
|
||||
#define LV_DRAW_SDL_COMPOSITE_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*********************
|
||||
* INCLUDES
|
||||
*********************/
|
||||
|
||||
#include "../../lv_conf_internal.h"
|
||||
|
||||
#include LV_GPU_SDL_INCLUDE_PATH
|
||||
|
||||
#include "lv_draw_sdl.h"
|
||||
#include "../../misc/lv_area.h"
|
||||
#include "../../misc/lv_color.h"
|
||||
|
||||
/*********************
|
||||
* DEFINES
|
||||
*********************/
|
||||
|
||||
/**********************
|
||||
* TYPEDEFS
|
||||
**********************/
|
||||
|
||||
typedef enum lv_draw_sdl_composite_texture_id_t {
|
||||
LV_DRAW_SDL_COMPOSITE_TEXTURE_ID_STREAM0,
|
||||
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_t;
|
||||
|
||||
/**********************
|
||||
* GLOBAL PROTOTYPES
|
||||
**********************/
|
||||
|
||||
/**
|
||||
* Begin drawing with mask. Render target will be switched to a temporary texture,
|
||||
* and drawing coordinates may get clipped or translated
|
||||
* @param coords_in Original coordinates
|
||||
* @param clip_in Original clip area
|
||||
* @param extension Useful for shadows or outlines, can be NULL
|
||||
* @param coords_out Translated coords
|
||||
* @param clip_out Translated clip area
|
||||
* @param apply_area Area of actual composited texture will be drawn
|
||||
* @return true if there are any mask needs to be drawn, false otherwise
|
||||
*/
|
||||
bool lv_draw_sdl_composite_begin(lv_draw_sdl_ctx_t * ctx, const lv_area_t * coords_in, const lv_area_t * clip_in,
|
||||
const lv_area_t * extension, lv_blend_mode_t blend_mode, lv_area_t * coords_out,
|
||||
lv_area_t * clip_out, lv_area_t * apply_area);
|
||||
|
||||
void lv_draw_sdl_composite_end(lv_draw_sdl_ctx_t * ctx, const lv_area_t * apply_area, lv_blend_mode_t blend_mode);
|
||||
|
||||
SDL_Texture * lv_draw_sdl_composite_texture_obtain(lv_draw_sdl_ctx_t * ctx, lv_draw_sdl_composite_texture_id_t id,
|
||||
lv_coord_t w, lv_coord_t h);
|
||||
|
||||
/**********************
|
||||
* MACROS
|
||||
**********************/
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /*extern "C"*/
|
||||
#endif
|
||||
|
||||
#endif /*LV_DRAW_SDL_COMPOSITE_H*/
|
|
@ -0,0 +1,459 @@
|
|||
/**
|
||||
* @file lv_draw_sdl_img.c
|
||||
*
|
||||
*/
|
||||
|
||||
/*********************
|
||||
* INCLUDES
|
||||
*********************/
|
||||
|
||||
#include "../../lv_conf_internal.h"
|
||||
|
||||
#if LV_USE_GPU_SDL
|
||||
|
||||
#include "../lv_draw_img.h"
|
||||
#include "../lv_img_cache.h"
|
||||
#include "../lv_draw_mask.h"
|
||||
#include "../../misc/lv_lru.h"
|
||||
#include "../../misc/lv_gc.h"
|
||||
|
||||
#include "lv_draw_sdl_img.h"
|
||||
#include "lv_draw_sdl_utils.h"
|
||||
#include "lv_draw_sdl_texture_cache.h"
|
||||
#include "lv_draw_sdl_composite.h"
|
||||
#include "lv_draw_sdl_rect.h"
|
||||
|
||||
/*********************
|
||||
* DEFINES
|
||||
*********************/
|
||||
|
||||
/**********************
|
||||
* TYPEDEFS
|
||||
**********************/
|
||||
|
||||
typedef struct {
|
||||
lv_sdl_cache_key_magic_t magic;
|
||||
const SDL_Texture * texture;
|
||||
lv_coord_t w, h, radius;
|
||||
} lv_draw_img_rounded_key_t;
|
||||
|
||||
enum {
|
||||
ROUNDED_IMG_PART_LEFT = 0,
|
||||
ROUNDED_IMG_PART_HCENTER = 1,
|
||||
ROUNDED_IMG_PART_RIGHT = 2,
|
||||
ROUNDED_IMG_PART_TOP = 3,
|
||||
ROUNDED_IMG_PART_VCENTER = 4,
|
||||
ROUNDED_IMG_PART_BOTTOM = 5,
|
||||
};
|
||||
|
||||
enum {
|
||||
ROUNDED_IMG_CORNER_TOP_LEFT = 0,
|
||||
ROUNDED_IMG_CORNER_TOP_RIGHT = 1,
|
||||
ROUNDED_IMG_CORNER_BOTTOM_RIGHT = 2,
|
||||
ROUNDED_IMG_CORNER_BOTTOM_LEFT = 3,
|
||||
};
|
||||
|
||||
/**********************
|
||||
* STATIC PROTOTYPES
|
||||
**********************/
|
||||
|
||||
static SDL_Texture * upload_img_texture(SDL_Renderer * renderer, lv_img_decoder_dsc_t * dsc);
|
||||
|
||||
static SDL_Texture * upload_img_texture_fallback(SDL_Renderer * renderer, lv_img_decoder_dsc_t * dsc);
|
||||
|
||||
static bool check_mask_simple_radius(const lv_area_t * coords, lv_coord_t * radius);
|
||||
|
||||
static void draw_img_simple(lv_draw_sdl_ctx_t * ctx, SDL_Texture * texture, const lv_draw_sdl_img_header_t * header,
|
||||
const lv_draw_img_dsc_t * draw_dsc, const lv_area_t * coords, const lv_area_t * clip);
|
||||
|
||||
static void draw_img_rounded(lv_draw_sdl_ctx_t * ctx, SDL_Texture * texture, const lv_draw_sdl_img_header_t * header,
|
||||
const lv_draw_img_dsc_t * draw_dsc, const lv_area_t * coords, const lv_area_t * clip,
|
||||
lv_coord_t radius);
|
||||
|
||||
static SDL_Texture * img_rounded_frag_obtain(lv_draw_sdl_ctx_t * ctx, SDL_Texture * texture,
|
||||
const lv_draw_sdl_img_header_t * header, int w, int h, lv_coord_t radius);
|
||||
|
||||
static lv_draw_img_rounded_key_t rounded_key_create(const SDL_Texture * texture, lv_coord_t w, lv_coord_t h,
|
||||
lv_coord_t radius);
|
||||
|
||||
static void calc_draw_part(SDL_Texture * texture, const lv_draw_sdl_img_header_t * header, const lv_area_t * coords,
|
||||
const lv_area_t * clip, SDL_Rect * clipped_src, SDL_Rect * clipped_dst);
|
||||
/**********************
|
||||
* STATIC VARIABLES
|
||||
**********************/
|
||||
|
||||
/**********************
|
||||
* MACROS
|
||||
**********************/
|
||||
|
||||
|
||||
static void apply_recolor_opa(SDL_Texture * texture, const lv_draw_img_dsc_t * draw_dsc);
|
||||
|
||||
/**********************
|
||||
* GLOBAL FUNCTIONS
|
||||
**********************/
|
||||
|
||||
lv_res_t lv_draw_sdl_img_core(lv_draw_ctx_t * draw_ctx, const lv_draw_img_dsc_t * draw_dsc,
|
||||
const lv_area_t * coords, const void * src)
|
||||
{
|
||||
const lv_area_t * clip = draw_ctx->clip_area;
|
||||
lv_draw_sdl_ctx_t * ctx = (lv_draw_sdl_ctx_t *) draw_ctx;
|
||||
|
||||
size_t key_size;
|
||||
lv_draw_sdl_cache_key_head_img_t * key = lv_draw_sdl_texture_img_key_create(src, draw_dsc->frame_id, &key_size);
|
||||
bool texture_found = false;
|
||||
lv_draw_sdl_img_header_t * header = NULL;
|
||||
SDL_Texture * texture = lv_draw_sdl_texture_cache_get_with_userdata(ctx, key, key_size, &texture_found,
|
||||
(void **) &header);
|
||||
if(!texture_found) {
|
||||
lv_draw_sdl_img_load_texture(ctx, key, key_size, src, draw_dsc->frame_id, &texture, &header);
|
||||
}
|
||||
SDL_free(key);
|
||||
if(!texture) {
|
||||
return LV_RES_INV;
|
||||
}
|
||||
|
||||
lv_area_t zoomed_cords;
|
||||
_lv_img_buf_get_transformed_area(&zoomed_cords, lv_area_get_width(coords), lv_area_get_height(coords), 0,
|
||||
draw_dsc->zoom, &draw_dsc->pivot);
|
||||
lv_area_move(&zoomed_cords, coords->x1, coords->y1);
|
||||
|
||||
/* When in > 0, draw simple radius */
|
||||
lv_coord_t radius = 0;
|
||||
/* Coords will be translated so coords will start at (0,0) */
|
||||
lv_area_t t_coords = zoomed_cords, t_clip = *clip, apply_area;
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
SDL_Rect clip_rect, coords_rect;
|
||||
lv_area_to_sdl_rect(&t_clip, &clip_rect);
|
||||
lv_area_to_sdl_rect(&t_coords, &coords_rect);
|
||||
|
||||
SDL_SetTextureBlendMode(texture, SDL_BLENDMODE_BLEND);
|
||||
|
||||
if(radius > 0) {
|
||||
draw_img_rounded(ctx, texture, header, draw_dsc, &t_coords, &t_clip, radius);
|
||||
}
|
||||
else {
|
||||
draw_img_simple(ctx, texture, header, draw_dsc, &t_coords, &t_clip);
|
||||
}
|
||||
|
||||
lv_draw_sdl_composite_end(ctx, &apply_area, draw_dsc->blend_mode);
|
||||
|
||||
return LV_RES_OK;
|
||||
}
|
||||
|
||||
static void calc_draw_part(SDL_Texture * texture, const lv_draw_sdl_img_header_t * header, const lv_area_t * coords,
|
||||
const lv_area_t * clip, SDL_Rect * clipped_src, SDL_Rect * clipped_dst)
|
||||
{
|
||||
double x = 0, y = 0, w, h;
|
||||
if(SDL_RectEmpty(&header->rect)) {
|
||||
Uint32 format = 0;
|
||||
int access = 0, tw, th;
|
||||
SDL_QueryTexture(texture, &format, &access, &tw, &th);
|
||||
w = tw;
|
||||
h = th;
|
||||
}
|
||||
else {
|
||||
x = header->rect.x;
|
||||
y = header->rect.y;
|
||||
w = header->rect.w;
|
||||
h = header->rect.h;
|
||||
}
|
||||
if(clip) {
|
||||
lv_area_t clipped_area;
|
||||
_lv_area_intersect(&clipped_area, coords, clip);
|
||||
lv_area_to_sdl_rect(&clipped_area, clipped_dst);
|
||||
}
|
||||
else {
|
||||
lv_area_to_sdl_rect(coords, clipped_dst);
|
||||
}
|
||||
lv_coord_t coords_w = lv_area_get_width(coords), coords_h = lv_area_get_height(coords);
|
||||
clipped_src->x = (int)(x + (clipped_dst->x - coords->x1) * w / coords_w);
|
||||
clipped_src->y = (int)(y + (clipped_dst->y - coords->y1) * h / coords_h);
|
||||
clipped_src->w = (int)(w - (coords_w - clipped_dst->w) * w / coords_w);
|
||||
clipped_src->h = (int)(h - (coords_h - clipped_dst->h) * h / coords_h);
|
||||
}
|
||||
|
||||
bool lv_draw_sdl_img_load_texture(lv_draw_sdl_ctx_t * ctx, lv_draw_sdl_cache_key_head_img_t * key, size_t key_size,
|
||||
const void * src, int32_t frame_id, SDL_Texture ** texture,
|
||||
lv_draw_sdl_img_header_t ** header)
|
||||
{
|
||||
_lv_img_cache_entry_t * cdsc = _lv_img_cache_open(src, lv_color_white(), frame_id);
|
||||
lv_draw_sdl_cache_flag_t tex_flags = 0;
|
||||
SDL_Rect rect;
|
||||
SDL_memset(&rect, 0, sizeof(SDL_Rect));
|
||||
if(cdsc) {
|
||||
lv_img_decoder_dsc_t * dsc = &cdsc->dec_dsc;
|
||||
if(dsc->user_data && SDL_memcmp(dsc->user_data, LV_DRAW_SDL_DEC_DSC_TEXTURE_HEAD, 8) == 0) {
|
||||
lv_draw_sdl_dec_dsc_userdata_t * ptr = (lv_draw_sdl_dec_dsc_userdata_t *) dsc->user_data;
|
||||
*texture = ptr->texture;
|
||||
rect = ptr->rect;
|
||||
if(ptr->texture_managed) {
|
||||
tex_flags |= LV_DRAW_SDL_CACHE_FLAG_MANAGED;
|
||||
}
|
||||
ptr->texture_referenced = true;
|
||||
}
|
||||
else {
|
||||
*texture = upload_img_texture(ctx->renderer, dsc);
|
||||
}
|
||||
#if LV_IMG_CACHE_DEF_SIZE == 0
|
||||
lv_img_decoder_close(dsc);
|
||||
#endif
|
||||
}
|
||||
if(texture && cdsc) {
|
||||
*header = SDL_malloc(sizeof(lv_draw_sdl_img_header_t));
|
||||
SDL_memcpy(&(*header)->base, &cdsc->dec_dsc.header, sizeof(lv_img_header_t));
|
||||
(*header)->rect = rect;
|
||||
lv_draw_sdl_texture_cache_put_advanced(ctx, key, key_size, *texture, *header, SDL_free, tex_flags);
|
||||
}
|
||||
else {
|
||||
lv_draw_sdl_texture_cache_put(ctx, key, key_size, NULL);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**********************
|
||||
* STATIC FUNCTIONS
|
||||
**********************/
|
||||
|
||||
static SDL_Texture * upload_img_texture(SDL_Renderer * renderer, lv_img_decoder_dsc_t * dsc)
|
||||
{
|
||||
if(!dsc->img_data) {
|
||||
return upload_img_texture_fallback(renderer, dsc);
|
||||
}
|
||||
bool chroma_keyed = dsc->header.cf == (uint32_t) LV_IMG_CF_TRUE_COLOR_CHROMA_KEYED;
|
||||
int h = (int) dsc->header.h;
|
||||
int w = (int) dsc->header.w;
|
||||
void * data = (void *) dsc->img_data;
|
||||
Uint32 rmask = 0x00FF0000;
|
||||
Uint32 gmask = 0x0000FF00;
|
||||
Uint32 bmask = 0x000000FF;
|
||||
Uint32 amask = 0xFF000000;
|
||||
if(chroma_keyed) {
|
||||
amask = 0x00;
|
||||
}
|
||||
SDL_Surface * surface = SDL_CreateRGBSurfaceFrom(data, w, h, LV_COLOR_DEPTH, w * LV_COLOR_DEPTH / 8,
|
||||
rmask, gmask, bmask, amask);
|
||||
SDL_SetColorKey(surface, chroma_keyed, lv_color_to32(LV_COLOR_CHROMA_KEY));
|
||||
SDL_Texture * texture = SDL_CreateTextureFromSurface(renderer, surface);
|
||||
SDL_FreeSurface(surface);
|
||||
return texture;
|
||||
}
|
||||
|
||||
static SDL_Texture * upload_img_texture_fallback(SDL_Renderer * renderer, lv_img_decoder_dsc_t * dsc)
|
||||
{
|
||||
lv_coord_t h = (lv_coord_t) dsc->header.h;
|
||||
lv_coord_t w = (lv_coord_t) dsc->header.w;
|
||||
uint8_t * data = lv_mem_buf_get(w * h * sizeof(lv_color_t));
|
||||
for(lv_coord_t y = 0; y < h; y++) {
|
||||
lv_img_decoder_read_line(dsc, 0, y, w, &data[y * w * sizeof(lv_color_t)]);
|
||||
}
|
||||
Uint32 rmask = 0x00FF0000;
|
||||
Uint32 gmask = 0x0000FF00;
|
||||
Uint32 bmask = 0x000000FF;
|
||||
Uint32 amask = 0xFF000000;
|
||||
SDL_Surface * surface = SDL_CreateRGBSurfaceFrom(data, w, h, LV_COLOR_DEPTH, w * LV_COLOR_DEPTH / 8,
|
||||
rmask, gmask, bmask, amask);
|
||||
SDL_SetColorKey(surface, SDL_TRUE, lv_color_to32(LV_COLOR_CHROMA_KEY));
|
||||
SDL_Texture * texture = SDL_CreateTextureFromSurface(renderer, surface);
|
||||
SDL_FreeSurface(surface);
|
||||
lv_mem_buf_release(data);
|
||||
return texture;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if there is only one radius mask
|
||||
* @param radius Set to radius value if the only mask is a radius mask
|
||||
* @return true if the only mask is a radius mask
|
||||
*/
|
||||
static bool check_mask_simple_radius(const lv_area_t * coords, lv_coord_t * radius)
|
||||
{
|
||||
if(lv_draw_mask_get_cnt() != 1) return false;
|
||||
for(uint8_t i = 0; i < _LV_MASK_MAX_NUM; i++) {
|
||||
_lv_draw_mask_common_dsc_t * param = LV_GC_ROOT(_lv_draw_mask_list[i]).param;
|
||||
if(param->type == LV_DRAW_MASK_TYPE_RADIUS) {
|
||||
lv_draw_mask_radius_param_t * rparam = (lv_draw_mask_radius_param_t *) param;
|
||||
if(rparam->cfg.outer) return false;
|
||||
if(!_lv_area_is_equal(&rparam->cfg.rect, coords)) return false;
|
||||
*radius = rparam->cfg.radius;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
static void draw_img_simple(lv_draw_sdl_ctx_t * ctx, SDL_Texture * texture, const lv_draw_sdl_img_header_t * header,
|
||||
const lv_draw_img_dsc_t * draw_dsc, const lv_area_t * coords, const lv_area_t * clip)
|
||||
{
|
||||
apply_recolor_opa(texture, draw_dsc);
|
||||
SDL_Point pivot = {.x = draw_dsc->pivot.x, .y = draw_dsc->pivot.y};
|
||||
|
||||
/*Image needs to be rotated, so we have to use clip rect which is slower*/
|
||||
if(draw_dsc->angle != 0) {
|
||||
/* No radius, set clip here */
|
||||
SDL_Rect clip_rect;
|
||||
lv_area_to_sdl_rect(clip, &clip_rect);
|
||||
SDL_RenderSetClipRect(ctx->renderer, &clip_rect);
|
||||
}
|
||||
SDL_Rect src_rect, dst_rect;
|
||||
calc_draw_part(texture, header, coords, clip, &src_rect, &dst_rect);
|
||||
SDL_RenderCopyEx(ctx->renderer, texture, &src_rect, &dst_rect, draw_dsc->angle, &pivot, SDL_FLIP_NONE);
|
||||
if(draw_dsc->angle != 0) {
|
||||
SDL_RenderSetClipRect(ctx->renderer, NULL);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void draw_img_rounded(lv_draw_sdl_ctx_t * ctx, SDL_Texture * texture, const lv_draw_sdl_img_header_t * header,
|
||||
const lv_draw_img_dsc_t * draw_dsc, const lv_area_t * coords, const lv_area_t * clip,
|
||||
lv_coord_t radius)
|
||||
{
|
||||
const int w = lv_area_get_width(coords), h = lv_area_get_height(coords);
|
||||
lv_coord_t real_radius = LV_MIN3(radius, w, h);
|
||||
SDL_Texture * frag = img_rounded_frag_obtain(ctx, texture, header, w, h, real_radius);
|
||||
apply_recolor_opa(frag, draw_dsc);
|
||||
lv_draw_sdl_rect_bg_frag_draw_corners(ctx, frag, real_radius, coords, clip, true);
|
||||
|
||||
apply_recolor_opa(texture, draw_dsc);
|
||||
|
||||
SDL_Rect src_rect, dst_rect;
|
||||
/* Draw 3 parts */
|
||||
lv_area_t clip_tmp, part;
|
||||
calc_draw_part(texture, header, coords, NULL, &src_rect, &dst_rect);
|
||||
for(int i = w > h ? ROUNDED_IMG_PART_LEFT : ROUNDED_IMG_PART_TOP, j = i + 3; i <= j; i++) {
|
||||
switch(i) {
|
||||
case ROUNDED_IMG_PART_LEFT:
|
||||
lv_area_set(&part, coords->x1, coords->y1 + radius, coords->x1 + radius - 1, coords->y2 - radius);
|
||||
break;
|
||||
case ROUNDED_IMG_PART_HCENTER:
|
||||
lv_area_set(&part, coords->x1 + radius, coords->y1, coords->x2 - radius, coords->y2);
|
||||
break;
|
||||
case ROUNDED_IMG_PART_RIGHT:
|
||||
lv_area_set(&part, coords->x2 - radius + 1, coords->y1 + radius, coords->x2, coords->y2 - radius);
|
||||
break;
|
||||
case ROUNDED_IMG_PART_TOP:
|
||||
lv_area_set(&part, coords->x1 + radius, coords->y1, coords->x2 - radius, coords->y1 + radius - 1);
|
||||
break;
|
||||
case ROUNDED_IMG_PART_VCENTER:
|
||||
lv_area_set(&part, coords->x1 + radius, coords->y2 - radius + 1, coords->x2 - radius, coords->y2);
|
||||
break;
|
||||
case ROUNDED_IMG_PART_BOTTOM:
|
||||
lv_area_set(&part, coords->x1, coords->y1 + radius, coords->x2, coords->y2 - radius);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
if(!_lv_area_intersect(&clip_tmp, &part, clip)) continue;
|
||||
SDL_Rect clip_rect;
|
||||
lv_area_to_sdl_rect(&clip_tmp, &clip_rect);
|
||||
SDL_RenderSetClipRect(ctx->renderer, &clip_rect);
|
||||
SDL_RenderCopy(ctx->renderer, texture, &src_rect, &dst_rect);
|
||||
}
|
||||
SDL_RenderSetClipRect(ctx->renderer, NULL);
|
||||
}
|
||||
|
||||
static void apply_recolor_opa(SDL_Texture * texture, const lv_draw_img_dsc_t * draw_dsc)
|
||||
{
|
||||
if(draw_dsc->recolor_opa > LV_OPA_TRANSP) {
|
||||
/* Draw with mixed recolor */
|
||||
lv_color_t recolor = lv_color_mix(draw_dsc->recolor, lv_color_white(), draw_dsc->recolor_opa);
|
||||
SDL_SetTextureColorMod(texture, recolor.ch.red, recolor.ch.green, recolor.ch.blue);
|
||||
}
|
||||
else {
|
||||
/* Draw with no recolor */
|
||||
SDL_SetTextureColorMod(texture, 0xFF, 0xFF, 0xFF);
|
||||
}
|
||||
SDL_SetTextureAlphaMod(texture, draw_dsc->opa);
|
||||
}
|
||||
|
||||
static SDL_Texture * img_rounded_frag_obtain(lv_draw_sdl_ctx_t * ctx, SDL_Texture * texture,
|
||||
const lv_draw_sdl_img_header_t * header, int w, int h, lv_coord_t radius)
|
||||
{
|
||||
lv_draw_img_rounded_key_t key = rounded_key_create(texture, w, h, radius);
|
||||
SDL_Texture * mask_frag = lv_draw_sdl_rect_bg_frag_obtain(ctx, radius);
|
||||
SDL_Texture * img_frag = lv_draw_sdl_texture_cache_get(ctx, &key, sizeof(key), NULL);
|
||||
if(img_frag == NULL) {
|
||||
const lv_coord_t full_frag_size = radius * 2 + 3;
|
||||
img_frag = SDL_CreateTexture(ctx->renderer, LV_DRAW_SDL_TEXTURE_FORMAT, SDL_TEXTUREACCESS_TARGET,
|
||||
full_frag_size, full_frag_size);
|
||||
SDL_SetTextureBlendMode(img_frag, SDL_BLENDMODE_BLEND);
|
||||
SDL_Texture * old_target = SDL_GetRenderTarget(ctx->renderer);
|
||||
SDL_SetRenderTarget(ctx->renderer, img_frag);
|
||||
SDL_SetRenderDrawColor(ctx->renderer, 0, 0, 0, 0);
|
||||
SDL_RenderClear(ctx->renderer);
|
||||
|
||||
lv_area_t coords = {0, 0, w - 1, h - 1}, clip;
|
||||
lv_area_t frag_coords = {0, 0, full_frag_size - 1, full_frag_size - 1};
|
||||
lv_draw_sdl_rect_bg_frag_draw_corners(ctx, mask_frag, radius, &frag_coords, NULL, false);
|
||||
|
||||
SDL_SetTextureAlphaMod(texture, 0xFF);
|
||||
SDL_SetTextureColorMod(texture, 0xFF, 0xFF, 0xFF);
|
||||
#if LV_GPU_SDL_CUSTOM_BLEND_MODE
|
||||
SDL_BlendMode blend_mode = SDL_ComposeCustomBlendMode(SDL_BLENDFACTOR_ONE, SDL_BLENDFACTOR_ZERO,
|
||||
SDL_BLENDOPERATION_ADD, SDL_BLENDFACTOR_DST_ALPHA,
|
||||
SDL_BLENDFACTOR_ZERO, SDL_BLENDOPERATION_ADD);
|
||||
SDL_SetTextureBlendMode(texture, blend_mode);
|
||||
#else
|
||||
SDL_SetTextureBlendMode(texture, SDL_BLENDMODE_MOD);
|
||||
#endif
|
||||
SDL_Rect srcrect, cliprect, dstrect = {0, 0, radius, radius};
|
||||
|
||||
cliprect.w = cliprect.h = radius;
|
||||
for(int i = 0; i <= ROUNDED_IMG_CORNER_BOTTOM_LEFT; i++) {
|
||||
switch(i) {
|
||||
case ROUNDED_IMG_CORNER_TOP_LEFT:
|
||||
cliprect.x = 0;
|
||||
cliprect.y = 0;
|
||||
lv_area_align(&frag_coords, &coords, LV_ALIGN_TOP_LEFT, 0, 0);
|
||||
break;
|
||||
case ROUNDED_IMG_CORNER_TOP_RIGHT:
|
||||
cliprect.x = full_frag_size - radius;
|
||||
cliprect.y = 0;
|
||||
lv_area_align(&frag_coords, &coords, LV_ALIGN_TOP_RIGHT, 0, 0);
|
||||
break;
|
||||
case ROUNDED_IMG_CORNER_BOTTOM_RIGHT:
|
||||
cliprect.x = full_frag_size - radius;
|
||||
cliprect.y = full_frag_size - radius;
|
||||
lv_area_align(&frag_coords, &coords, LV_ALIGN_BOTTOM_RIGHT, 0, 0);
|
||||
break;
|
||||
case ROUNDED_IMG_CORNER_BOTTOM_LEFT:
|
||||
cliprect.x = 0;
|
||||
cliprect.y = full_frag_size - radius;
|
||||
lv_area_align(&frag_coords, &coords, LV_ALIGN_BOTTOM_LEFT, 0, 0);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
calc_draw_part(texture, header, &coords, NULL, &srcrect, &dstrect);
|
||||
SDL_RenderSetClipRect(ctx->renderer, &cliprect);
|
||||
SDL_RenderCopy(ctx->renderer, texture, &srcrect, &dstrect);
|
||||
}
|
||||
SDL_RenderSetClipRect(ctx->renderer, NULL);
|
||||
|
||||
SDL_SetTextureBlendMode(texture, SDL_BLENDMODE_BLEND);
|
||||
|
||||
SDL_SetRenderTarget(ctx->renderer, old_target);
|
||||
lv_draw_sdl_texture_cache_put(ctx, &key, sizeof(key), img_frag);
|
||||
}
|
||||
return img_frag;
|
||||
}
|
||||
|
||||
static lv_draw_img_rounded_key_t rounded_key_create(const SDL_Texture * texture, lv_coord_t w, lv_coord_t h,
|
||||
lv_coord_t radius)
|
||||
{
|
||||
lv_draw_img_rounded_key_t key;
|
||||
SDL_memset(&key, 0, sizeof(key));
|
||||
key.magic = LV_GPU_CACHE_KEY_MAGIC_IMG_ROUNDED_CORNERS;
|
||||
key.texture = texture;
|
||||
key.w = w;
|
||||
key.h = h;
|
||||
key.radius = radius;
|
||||
return key;
|
||||
}
|
||||
|
||||
#endif /*LV_USE_GPU_SDL*/
|
|
@ -0,0 +1,72 @@
|
|||
/**
|
||||
* @file lv_draw_sdl_img.h
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef LV_DRAW_SDL_IMG_H
|
||||
#define LV_DRAW_SDL_IMG_H
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*********************
|
||||
* INCLUDES
|
||||
*********************/
|
||||
#include "../../lv_conf_internal.h"
|
||||
|
||||
#if LV_USE_GPU_SDL
|
||||
|
||||
#include LV_GPU_SDL_INCLUDE_PATH
|
||||
|
||||
#include "../lv_draw.h"
|
||||
|
||||
#include "lv_draw_sdl_texture_cache.h"
|
||||
|
||||
/*********************
|
||||
* DEFINES
|
||||
*********************/
|
||||
|
||||
/**********************
|
||||
* TYPEDEFS
|
||||
**********************/
|
||||
|
||||
typedef struct lv_draw_sdl_img_header_t {
|
||||
lv_img_header_t base;
|
||||
SDL_Rect rect;
|
||||
} lv_draw_sdl_img_header_t;
|
||||
|
||||
/**********************
|
||||
* GLOBAL PROTOTYPES
|
||||
**********************/
|
||||
|
||||
/*======================
|
||||
* Add/remove functions
|
||||
*=====================*/
|
||||
|
||||
/*=====================
|
||||
* Setter functions
|
||||
*====================*/
|
||||
|
||||
/*=====================
|
||||
* Getter functions
|
||||
*====================*/
|
||||
|
||||
/*=====================
|
||||
* Other functions
|
||||
*====================*/
|
||||
bool lv_draw_sdl_img_load_texture(lv_draw_sdl_ctx_t * ctx, lv_draw_sdl_cache_key_head_img_t * key, size_t key_size,
|
||||
const void * src, int32_t frame_id, SDL_Texture ** texture,
|
||||
lv_draw_sdl_img_header_t ** header);
|
||||
/**********************
|
||||
* MACROS
|
||||
**********************/
|
||||
|
||||
#endif /*LV_USE_GPU_SDL*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /*extern "C"*/
|
||||
#endif
|
||||
|
||||
#endif /*LV_DRAW_SDL_IMG_H*/
|
|
@ -0,0 +1,158 @@
|
|||
/**
|
||||
* @file lv_draw_sdl_label.c
|
||||
*
|
||||
*/
|
||||
|
||||
/*********************
|
||||
* INCLUDES
|
||||
*********************/
|
||||
|
||||
#include "../../lv_conf_internal.h"
|
||||
|
||||
#if LV_USE_GPU_SDL
|
||||
|
||||
#include LV_GPU_SDL_INCLUDE_PATH
|
||||
|
||||
#include "../lv_draw_label.h"
|
||||
#include "../../misc/lv_utils.h"
|
||||
|
||||
#include "lv_draw_sdl_utils.h"
|
||||
#include "lv_draw_sdl_texture_cache.h"
|
||||
#include "lv_draw_sdl_composite.h"
|
||||
|
||||
/*********************
|
||||
* DEFINES
|
||||
*********************/
|
||||
|
||||
/**********************
|
||||
* TYPEDEFS
|
||||
**********************/
|
||||
|
||||
typedef struct {
|
||||
lv_sdl_cache_key_magic_t magic;
|
||||
const lv_font_t * font_p;
|
||||
uint32_t letter;
|
||||
} lv_font_glyph_key_t;
|
||||
|
||||
/**********************
|
||||
* STATIC PROTOTYPES
|
||||
**********************/
|
||||
|
||||
static lv_font_glyph_key_t font_key_glyph_create(const lv_font_t * font_p, uint32_t letter);
|
||||
|
||||
|
||||
/**********************
|
||||
* STATIC VARIABLES
|
||||
**********************/
|
||||
|
||||
/**********************
|
||||
* MACROS
|
||||
**********************/
|
||||
|
||||
/**********************
|
||||
* GLOBAL FUNCTIONS
|
||||
**********************/
|
||||
|
||||
void lv_draw_sdl_draw_letter(lv_draw_ctx_t * draw_ctx, const lv_draw_label_dsc_t * dsc, const lv_point_t * pos_p,
|
||||
uint32_t letter)
|
||||
{
|
||||
const lv_area_t * clip_area = draw_ctx->clip_area;
|
||||
const lv_font_t * font_p = dsc->font;
|
||||
lv_opa_t opa = dsc->opa;
|
||||
lv_color_t color = dsc->color;
|
||||
if(opa < LV_OPA_MIN) return;
|
||||
if(opa > LV_OPA_MAX) opa = LV_OPA_COVER;
|
||||
|
||||
if(font_p == NULL) {
|
||||
LV_LOG_WARN("lv_draw_letter: font is NULL");
|
||||
return;
|
||||
}
|
||||
|
||||
lv_font_glyph_dsc_t g;
|
||||
bool g_ret = lv_font_get_glyph_dsc(font_p, &g, letter, '\0');
|
||||
if(g_ret == false) {
|
||||
/*Add warning if the dsc is not found
|
||||
*but do not print warning for non printable ASCII chars (e.g. '\n')*/
|
||||
if(letter >= 0x20 &&
|
||||
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);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
/*Don't draw anything if the character is empty. E.g. space*/
|
||||
if((g.box_h == 0) || (g.box_w == 0)) return;
|
||||
|
||||
int32_t pos_x = pos_p->x + g.ofs_x;
|
||||
int32_t pos_y = pos_p->y + (font_p->line_height - font_p->base_line) - g.box_h - g.ofs_y;
|
||||
|
||||
const lv_area_t letter_area = {pos_x, pos_y, pos_x + g.box_w - 1, pos_y + g.box_h - 1};
|
||||
lv_area_t draw_area;
|
||||
|
||||
/*If the letter is completely out of mask don't draw it*/
|
||||
if(!_lv_area_intersect(&draw_area, &letter_area, clip_area)) {
|
||||
return;
|
||||
}
|
||||
|
||||
lv_draw_sdl_ctx_t * ctx = (lv_draw_sdl_ctx_t *) draw_ctx;
|
||||
SDL_Renderer * renderer = ctx->renderer;
|
||||
|
||||
lv_font_glyph_key_t glyph_key = font_key_glyph_create(font_p, letter);
|
||||
bool glyph_found = false;
|
||||
SDL_Texture * texture = lv_draw_sdl_texture_cache_get(ctx, &glyph_key, sizeof(glyph_key), &glyph_found);
|
||||
if(!glyph_found) {
|
||||
if(g.resolved_font) {
|
||||
font_p = g.resolved_font;
|
||||
}
|
||||
const uint8_t * bmp = lv_font_get_glyph_bitmap(font_p, letter);
|
||||
uint8_t * buf = lv_mem_alloc(g.box_w * g.box_h);
|
||||
lv_sdl_to_8bpp(buf, bmp, g.box_w, g.box_h, g.box_w, g.bpp);
|
||||
SDL_Surface * mask = lv_sdl_create_opa_surface(buf, g.box_w, g.box_h, g.box_w);
|
||||
texture = SDL_CreateTextureFromSurface(renderer, mask);
|
||||
SDL_FreeSurface(mask);
|
||||
lv_mem_free(buf);
|
||||
lv_draw_sdl_texture_cache_put(ctx, &glyph_key, sizeof(glyph_key), texture);
|
||||
}
|
||||
if(!texture) {
|
||||
return;
|
||||
}
|
||||
|
||||
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);
|
||||
|
||||
/*If the letter is completely out of mask don't draw it*/
|
||||
if(!_lv_area_intersect(&draw_area, &t_letter, &t_clip)) {
|
||||
return;
|
||||
}
|
||||
SDL_Rect srcrect, dstrect;
|
||||
lv_area_to_sdl_rect(&draw_area, &dstrect);
|
||||
srcrect.x = draw_area.x1 - t_letter.x1;
|
||||
srcrect.y = draw_area.y1 - t_letter.y1;
|
||||
srcrect.w = dstrect.w;
|
||||
srcrect.h = dstrect.h;
|
||||
SDL_SetTextureBlendMode(texture, SDL_BLENDMODE_BLEND);
|
||||
SDL_SetTextureAlphaMod(texture, opa);
|
||||
SDL_SetTextureColorMod(texture, color.ch.red, color.ch.green, color.ch.blue);
|
||||
SDL_RenderCopy(renderer, texture, &srcrect, &dstrect);
|
||||
|
||||
lv_draw_sdl_composite_end(ctx, &apply_area, dsc->blend_mode);
|
||||
}
|
||||
|
||||
/**********************
|
||||
* STATIC FUNCTIONS
|
||||
**********************/
|
||||
|
||||
static lv_font_glyph_key_t font_key_glyph_create(const lv_font_t * font_p, uint32_t letter)
|
||||
{
|
||||
lv_font_glyph_key_t key;
|
||||
/* VERY IMPORTANT! Padding between members is uninitialized, so we have to wipe them manually */
|
||||
SDL_memset(&key, 0, sizeof(key));
|
||||
key.magic = LV_GPU_CACHE_KEY_MAGIC_FONT_GLYPH;
|
||||
key.font_p = font_p;
|
||||
key.letter = letter;
|
||||
return key;
|
||||
}
|
||||
|
||||
#endif /*LV_USE_GPU_SDL*/
|
|
@ -0,0 +1,154 @@
|
|||
/**
|
||||
* @file lv_draw_sdl_line.c
|
||||
*
|
||||
*/
|
||||
|
||||
/*********************
|
||||
* INCLUDES
|
||||
*********************/
|
||||
#include "../../lv_conf_internal.h"
|
||||
|
||||
#if LV_USE_GPU_SDL
|
||||
|
||||
#include "lv_draw_sdl.h"
|
||||
#include "lv_draw_sdl_utils.h"
|
||||
#include "lv_draw_sdl_texture_cache.h"
|
||||
#include "lv_draw_sdl_composite.h"
|
||||
#include "lv_draw_sdl_mask.h"
|
||||
|
||||
/*********************
|
||||
* DEFINES
|
||||
*********************/
|
||||
#define ROUND_START 0x01
|
||||
#define ROUND_END 0x02
|
||||
/**********************
|
||||
* TYPEDEFS
|
||||
**********************/
|
||||
|
||||
typedef struct {
|
||||
lv_sdl_cache_key_magic_t magic;
|
||||
lv_coord_t length;
|
||||
lv_coord_t width;
|
||||
uint8_t round;
|
||||
} lv_draw_line_key_t;
|
||||
|
||||
/**********************
|
||||
* STATIC PROTOTYPES
|
||||
**********************/
|
||||
|
||||
/**********************
|
||||
* STATIC VARIABLES
|
||||
**********************/
|
||||
|
||||
/**********************
|
||||
* MACROS
|
||||
**********************/
|
||||
|
||||
static lv_draw_line_key_t line_key_create(const lv_draw_line_dsc_t * dsc, lv_coord_t length);
|
||||
|
||||
static SDL_Texture * line_texture_create(lv_draw_sdl_ctx_t * sdl_ctx, const lv_draw_line_dsc_t * dsc,
|
||||
lv_coord_t length);
|
||||
|
||||
/**********************
|
||||
* GLOBAL FUNCTIONS
|
||||
**********************/
|
||||
void lv_draw_sdl_draw_line(lv_draw_ctx_t * draw_ctx, const lv_draw_line_dsc_t * dsc, const lv_point_t * point1,
|
||||
const lv_point_t * point2)
|
||||
{
|
||||
lv_draw_sdl_ctx_t * sdl_ctx = (lv_draw_sdl_ctx_t *) draw_ctx;
|
||||
SDL_Renderer * renderer = sdl_ctx->renderer;
|
||||
lv_coord_t x1 = point1->x, x2 = point2->x, y1 = point1->y, y2 = point2->y;
|
||||
double length = SDL_sqrt(SDL_pow(x2 - x1, 2) + SDL_pow(y2 - y1, 2));
|
||||
if(length - (long) length > 0.5) {
|
||||
length = (long) length + 1;
|
||||
}
|
||||
|
||||
double angle = SDL_atan2(y2 - y1, x2 - x1) * 180 / M_PI;
|
||||
lv_draw_line_key_t key = line_key_create(dsc, (lv_coord_t) length);
|
||||
SDL_Texture * texture = lv_draw_sdl_texture_cache_get(sdl_ctx, &key, sizeof(key), NULL);
|
||||
if(!texture) {
|
||||
texture = line_texture_create(sdl_ctx, dsc, (lv_coord_t) length);
|
||||
lv_draw_sdl_texture_cache_put(sdl_ctx, &key, sizeof(key), texture);
|
||||
}
|
||||
|
||||
lv_area_t coords = {x1, y1, x2, y2};
|
||||
const lv_area_t * clip = draw_ctx->clip_area;
|
||||
|
||||
SDL_Rect coords_r, clip_r;
|
||||
lv_area_to_sdl_rect(&coords, &coords_r);
|
||||
lv_area_to_sdl_rect(clip, &clip_r);
|
||||
|
||||
lv_area_t t_coords = coords, t_clip = *clip, apply_area;
|
||||
lv_area_t extension = {dsc->width / 2, dsc->width / 2, dsc->width / 2, dsc->width / 2};
|
||||
lv_draw_sdl_composite_begin(sdl_ctx, &coords, clip, &extension, dsc->blend_mode, &t_coords, &t_clip,
|
||||
&apply_area);
|
||||
|
||||
SDL_Color color;
|
||||
lv_color_to_sdl_color(&dsc->color, &color);
|
||||
|
||||
SDL_SetTextureColorMod(texture, color.r, color.g, color.b);
|
||||
SDL_SetTextureAlphaMod(texture, dsc->opa);
|
||||
SDL_Rect srcrect = {0, 0, (int) length + dsc->width + 2, dsc->width + 2},
|
||||
dstrect = {t_coords.x1 - 1 - dsc->width / 2, t_coords.y1 - 1, srcrect.w, srcrect.h};
|
||||
SDL_Point center = {1 + dsc->width / 2, 1 + dsc->width / 2};
|
||||
|
||||
SDL_Rect clip_rect;
|
||||
lv_area_to_sdl_rect(&t_clip, &clip_rect);
|
||||
if(!SDL_RectEquals(&clip_rect, &dstrect) || angle != 0) {
|
||||
SDL_RenderSetClipRect(renderer, &clip_rect);
|
||||
}
|
||||
SDL_RenderCopyEx(renderer, texture, &srcrect, &dstrect, angle, ¢er, 0);
|
||||
SDL_RenderSetClipRect(renderer, NULL);
|
||||
|
||||
lv_draw_sdl_composite_end(sdl_ctx, &apply_area, dsc->blend_mode);
|
||||
}
|
||||
|
||||
/**********************
|
||||
* STATIC FUNCTIONS
|
||||
**********************/
|
||||
|
||||
static lv_draw_line_key_t line_key_create(const lv_draw_line_dsc_t * dsc, lv_coord_t length)
|
||||
{
|
||||
lv_draw_line_key_t key;
|
||||
lv_memset_00(&key, sizeof(lv_draw_line_key_t));
|
||||
key.magic = LV_GPU_CACHE_KEY_MAGIC_LINE;
|
||||
key.length = length;
|
||||
key.width = dsc->width;
|
||||
key.round = (dsc->round_start ? ROUND_START : 0) | (dsc->round_end ? ROUND_END : 0);
|
||||
return key;
|
||||
}
|
||||
|
||||
static SDL_Texture * line_texture_create(lv_draw_sdl_ctx_t * sdl_ctx, const lv_draw_line_dsc_t * dsc, lv_coord_t length)
|
||||
{
|
||||
SDL_Texture * texture = SDL_CreateTexture(sdl_ctx->renderer, LV_DRAW_SDL_TEXTURE_FORMAT, SDL_TEXTUREACCESS_TARGET,
|
||||
length + dsc->width + 2, dsc->width + 2);
|
||||
SDL_Texture * target = SDL_GetRenderTarget(sdl_ctx->renderer);
|
||||
SDL_SetRenderTarget(sdl_ctx->renderer, texture);
|
||||
SDL_SetTextureBlendMode(texture, SDL_BLENDMODE_BLEND);
|
||||
SDL_SetRenderDrawColor(sdl_ctx->renderer, 0xFF, 0xFF, 0xFF, 0x0);
|
||||
SDL_RenderClear(sdl_ctx->renderer);
|
||||
SDL_SetRenderDrawColor(sdl_ctx->renderer, 0xFF, 0xFF, 0xFF, 0xFF);
|
||||
SDL_Rect line_rect = {1 + dsc->width / 2, 1, length, dsc->width};
|
||||
SDL_RenderFillRect(sdl_ctx->renderer, &line_rect);
|
||||
if(dsc->round_start || dsc->round_end) {
|
||||
lv_draw_mask_radius_param_t param;
|
||||
lv_area_t round_area = {0, 0, dsc->width - 1, dsc->width - 1};
|
||||
lv_draw_mask_radius_init(¶m, &round_area, LV_RADIUS_CIRCLE, false);
|
||||
|
||||
int16_t mask_id = lv_draw_mask_add(¶m, NULL);
|
||||
SDL_Texture * round_texture = lv_draw_sdl_mask_dump_texture(sdl_ctx->renderer, &round_area, &mask_id, 1);
|
||||
lv_draw_mask_remove_id(mask_id);
|
||||
|
||||
SDL_Rect round_src = {0, 0, dsc->width, dsc->width};
|
||||
SDL_Rect round_dst = {line_rect.x - dsc->width / 2, 1, dsc->width, dsc->width};
|
||||
SDL_RenderCopy(sdl_ctx->renderer, round_texture, &round_src, &round_dst);
|
||||
round_dst.x = line_rect.w + dsc->width / 2;
|
||||
SDL_RenderCopy(sdl_ctx->renderer, round_texture, &round_src, &round_dst);
|
||||
SDL_DestroyTexture(round_texture);
|
||||
}
|
||||
|
||||
SDL_SetRenderTarget(sdl_ctx->renderer, target);
|
||||
return texture;
|
||||
}
|
||||
|
||||
#endif /*LV_USE_GPU_SDL*/
|
|
@ -1,24 +1,25 @@
|
|||
/**
|
||||
* @file lv_gpu_sdl_mask.c
|
||||
* @file lv_draw_sdl_mask.c
|
||||
*
|
||||
*/
|
||||
|
||||
/*********************
|
||||
* INCLUDES
|
||||
*********************/
|
||||
|
||||
#include "../../lv_conf_internal.h"
|
||||
|
||||
#if LV_USE_GPU_SDL
|
||||
|
||||
#include "../../draw/lv_draw_mask.h"
|
||||
#include "../../misc/lv_mem.h"
|
||||
#include "lv_gpu_sdl_mask.h"
|
||||
#include "lv_gpu_sdl_utils.h"
|
||||
#include "../../misc/lv_gc.h"
|
||||
#include "lv_draw_sdl_mask.h"
|
||||
#include "lv_draw_sdl_utils.h"
|
||||
|
||||
/*********************
|
||||
* DEFINES
|
||||
*********************/
|
||||
#ifndef HAVE_SDL_CUSTOM_BLEND_MODE
|
||||
#define HAVE_SDL_CUSTOM_BLEND_MODE (SDL_VERSION_ATLEAST(2, 0, 6))
|
||||
#endif
|
||||
|
||||
/**********************
|
||||
* TYPEDEFS
|
||||
|
@ -40,26 +41,7 @@
|
|||
* GLOBAL FUNCTIONS
|
||||
**********************/
|
||||
|
||||
|
||||
SDL_Surface * lv_sdl_create_mask_surface(lv_opa_t * pixels, lv_coord_t width, lv_coord_t height, lv_coord_t stride)
|
||||
{
|
||||
SDL_Surface * indexed = SDL_CreateRGBSurfaceFrom(pixels, width, height, 8, stride, 0, 0, 0, 0);
|
||||
SDL_SetSurfacePalette(indexed, lv_sdl_get_grayscale_palette(8));
|
||||
SDL_Surface * converted = SDL_ConvertSurfaceFormat(indexed, SDL_PIXELFORMAT_ARGB8888, 0);
|
||||
SDL_FreeSurface(indexed);
|
||||
return converted;
|
||||
}
|
||||
|
||||
SDL_Texture * lv_sdl_create_mask_texture(SDL_Renderer * renderer, lv_opa_t * pixels, lv_coord_t width,
|
||||
lv_coord_t height, lv_coord_t stride)
|
||||
{
|
||||
SDL_Surface * indexed = lv_sdl_create_mask_surface(pixels, width, height, stride);
|
||||
SDL_Texture * texture = SDL_CreateTextureFromSurface(renderer, indexed);
|
||||
SDL_FreeSurface(indexed);
|
||||
return texture;
|
||||
}
|
||||
|
||||
lv_opa_t * lv_draw_mask_dump(const lv_area_t * coords, const int16_t * ids, int16_t ids_count)
|
||||
lv_opa_t * lv_draw_sdl_mask_dump_opa(const lv_area_t * coords, const int16_t * ids, int16_t ids_count)
|
||||
{
|
||||
SDL_assert(coords->x2 >= coords->x1);
|
||||
SDL_assert(coords->y2 >= coords->y1);
|
||||
|
@ -83,28 +65,20 @@ lv_opa_t * lv_draw_mask_dump(const lv_area_t * coords, const int16_t * ids, int1
|
|||
return mask_buf;
|
||||
}
|
||||
|
||||
SDL_Surface * lv_sdl_apply_mask_surface(const lv_area_t * coords, const int16_t * ids, int16_t ids_count)
|
||||
{
|
||||
lv_coord_t w = lv_area_get_width(coords), h = lv_area_get_height(coords);
|
||||
|
||||
lv_opa_t * mask_buf = lv_draw_mask_dump(coords, ids, ids_count);
|
||||
lv_mem_buf_release(mask_buf);
|
||||
return lv_sdl_create_mask_surface(mask_buf, w, h, w);
|
||||
}
|
||||
|
||||
SDL_Texture * lv_sdl_gen_mask_texture(SDL_Renderer * renderer, const lv_area_t * coords, const int16_t * ids,
|
||||
SDL_Texture * lv_draw_sdl_mask_dump_texture(SDL_Renderer * renderer, const lv_area_t * coords, const int16_t * ids,
|
||||
int16_t ids_count)
|
||||
{
|
||||
SDL_Surface * indexed = lv_sdl_apply_mask_surface(coords, ids, ids_count);
|
||||
SDL_Texture * texture = SDL_CreateTextureFromSurface(renderer, indexed);
|
||||
SDL_FreeSurface(indexed);
|
||||
lv_coord_t w = lv_area_get_width(coords), h = lv_area_get_height(coords);
|
||||
lv_opa_t * mask_buf = lv_draw_sdl_mask_dump_opa(coords, ids, ids_count);
|
||||
SDL_Surface * surface = lv_sdl_create_opa_surface(mask_buf, w, h, w);
|
||||
lv_mem_buf_release(mask_buf);
|
||||
SDL_Texture * texture = SDL_CreateTextureFromSurface(renderer, surface);
|
||||
SDL_FreeSurface(surface);
|
||||
return texture;
|
||||
}
|
||||
|
||||
|
||||
/**********************
|
||||
* STATIC FUNCTIONS
|
||||
**********************/
|
||||
|
||||
|
||||
#endif /*LV_USE_GPU_SDL*/
|
|
@ -0,0 +1,51 @@
|
|||
/**
|
||||
* @file lv_draw_sdl_mask.h
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef LV_DRAW_SDL_MASK_H
|
||||
#define LV_DRAW_SDL_MASK_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*********************
|
||||
* INCLUDES
|
||||
*********************/
|
||||
|
||||
#include "../../lv_conf_internal.h"
|
||||
|
||||
#include LV_GPU_SDL_INCLUDE_PATH
|
||||
|
||||
#include "lv_draw_sdl.h"
|
||||
#include "../../misc/lv_area.h"
|
||||
#include "../../misc/lv_color.h"
|
||||
|
||||
/*********************
|
||||
* DEFINES
|
||||
*********************/
|
||||
|
||||
/**********************
|
||||
* TYPEDEFS
|
||||
**********************/
|
||||
|
||||
/**********************
|
||||
* GLOBAL PROTOTYPES
|
||||
**********************/
|
||||
|
||||
lv_opa_t * lv_draw_sdl_mask_dump_opa(const lv_area_t * coords, const int16_t * ids, int16_t ids_count);
|
||||
|
||||
SDL_Texture * lv_draw_sdl_mask_dump_texture(SDL_Renderer * renderer, const lv_area_t * coords, const int16_t * ids,
|
||||
int16_t ids_count);
|
||||
|
||||
|
||||
/**********************
|
||||
* MACROS
|
||||
**********************/
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /*extern "C"*/
|
||||
#endif
|
||||
|
||||
#endif /*LV_DRAW_SDL_MASK_H*/
|
|
@ -0,0 +1,133 @@
|
|||
/**
|
||||
* @file lv_draw_sdl_polygon.c
|
||||
*
|
||||
*/
|
||||
|
||||
/*********************
|
||||
* INCLUDES
|
||||
*********************/
|
||||
#include "../../lv_conf_internal.h"
|
||||
|
||||
#if LV_USE_GPU_SDL
|
||||
|
||||
#include "lv_draw_sdl.h"
|
||||
#include "lv_draw_sdl_utils.h"
|
||||
#include "lv_draw_sdl_texture_cache.h"
|
||||
#include "lv_draw_sdl_composite.h"
|
||||
|
||||
/*********************
|
||||
* DEFINES
|
||||
*********************/
|
||||
|
||||
/**********************
|
||||
* TYPEDEFS
|
||||
**********************/
|
||||
|
||||
/**********************
|
||||
* STATIC PROTOTYPES
|
||||
**********************/
|
||||
|
||||
/**********************
|
||||
* STATIC VARIABLES
|
||||
**********************/
|
||||
|
||||
/**********************
|
||||
* MACROS
|
||||
**********************/
|
||||
|
||||
static void dump_masks(SDL_Texture * texture, const lv_area_t * coords);
|
||||
|
||||
/**********************
|
||||
* GLOBAL FUNCTIONS
|
||||
**********************/
|
||||
void lv_draw_sdl_polygon(lv_draw_ctx_t * draw_ctx, const lv_draw_rect_dsc_t * draw_dsc, const lv_point_t * points,
|
||||
uint16_t point_cnt)
|
||||
{
|
||||
if(point_cnt < 3) return;
|
||||
if(points == NULL) return;
|
||||
|
||||
lv_draw_mask_polygon_param_t polygon_param;
|
||||
lv_draw_mask_polygon_init(&polygon_param, points, point_cnt);
|
||||
|
||||
if(polygon_param.cfg.point_cnt < 3) {
|
||||
lv_draw_mask_free_param(&polygon_param);
|
||||
return;
|
||||
}
|
||||
|
||||
lv_area_t poly_coords = {.x1 = LV_COORD_MAX, .y1 = LV_COORD_MAX, .x2 = LV_COORD_MIN, .y2 = LV_COORD_MIN};
|
||||
|
||||
uint16_t i;
|
||||
for(i = 0; i < point_cnt; i++) {
|
||||
poly_coords.x1 = LV_MIN(poly_coords.x1, polygon_param.cfg.points[i].x);
|
||||
poly_coords.y1 = LV_MIN(poly_coords.y1, polygon_param.cfg.points[i].y);
|
||||
poly_coords.x2 = LV_MAX(poly_coords.x2, polygon_param.cfg.points[i].x);
|
||||
poly_coords.y2 = LV_MAX(poly_coords.y2, polygon_param.cfg.points[i].y);
|
||||
}
|
||||
|
||||
bool is_common;
|
||||
lv_area_t draw_area;
|
||||
is_common = _lv_area_intersect(&draw_area, &poly_coords, draw_ctx->clip_area);
|
||||
if(!is_common) {
|
||||
lv_draw_mask_free_param(&polygon_param);
|
||||
return;
|
||||
}
|
||||
|
||||
lv_draw_sdl_ctx_t * ctx = (lv_draw_sdl_ctx_t *) draw_ctx;
|
||||
|
||||
int16_t mask_id = lv_draw_mask_add(&polygon_param, NULL);
|
||||
|
||||
lv_coord_t w = lv_area_get_width(&draw_area), h = lv_area_get_height(&draw_area);
|
||||
SDL_Texture * texture = lv_draw_sdl_composite_texture_obtain(ctx, LV_DRAW_SDL_COMPOSITE_TEXTURE_ID_STREAM1, w, h);
|
||||
SDL_SetTextureBlendMode(texture, SDL_BLENDMODE_BLEND);
|
||||
dump_masks(texture, &draw_area);
|
||||
|
||||
lv_draw_mask_remove_id(mask_id);
|
||||
lv_draw_mask_free_param(&polygon_param);
|
||||
|
||||
SDL_Rect srcrect = {0, 0, w, h}, dstrect;
|
||||
lv_area_to_sdl_rect(&draw_area, &dstrect);
|
||||
SDL_Color color;
|
||||
lv_color_to_sdl_color(&draw_dsc->bg_color, &color);
|
||||
SDL_SetTextureColorMod(texture, color.r, color.g, color.b);
|
||||
SDL_SetTextureAlphaMod(texture, draw_dsc->bg_opa);
|
||||
SDL_RenderCopy(ctx->renderer, texture, &srcrect, &dstrect);
|
||||
}
|
||||
|
||||
/**********************
|
||||
* STATIC FUNCTIONS
|
||||
**********************/
|
||||
|
||||
static void dump_masks(SDL_Texture * texture, const lv_area_t * coords)
|
||||
{
|
||||
lv_coord_t w = lv_area_get_width(coords), h = lv_area_get_height(coords);
|
||||
SDL_assert(w > 0 && h > 0);
|
||||
SDL_Rect rect = {0, 0, w, h};
|
||||
uint8_t * pixels;
|
||||
int pitch;
|
||||
if(SDL_LockTexture(texture, &rect, (void **) &pixels, &pitch) != 0) return;
|
||||
|
||||
lv_opa_t * line_buf = lv_mem_buf_get(rect.w);
|
||||
for(lv_coord_t y = 0; y < rect.h; y++) {
|
||||
lv_memset_ff(line_buf, rect.w);
|
||||
lv_coord_t abs_x = (lv_coord_t) coords->x1, abs_y = (lv_coord_t)(y + coords->y1), len = (lv_coord_t) rect.w;
|
||||
lv_draw_mask_res_t res;
|
||||
res = lv_draw_mask_apply(line_buf, abs_x, abs_y, len);
|
||||
if(res == LV_DRAW_MASK_RES_TRANSP) {
|
||||
lv_memset_00(&pixels[y * pitch], 4 * rect.w);
|
||||
}
|
||||
else if(res == LV_DRAW_MASK_RES_FULL_COVER) {
|
||||
lv_memset_ff(&pixels[y * pitch], 4 * rect.w);
|
||||
}
|
||||
else {
|
||||
for(int x = 0; x < rect.w; x++) {
|
||||
uint8_t * pixel = &pixels[y * pitch + x * 4];
|
||||
*pixel = line_buf[x];
|
||||
pixel[1] = pixel[2] = pixel[3] = 0xFF;
|
||||
}
|
||||
}
|
||||
}
|
||||
lv_mem_buf_release(line_buf);
|
||||
SDL_UnlockTexture(texture);
|
||||
}
|
||||
|
||||
#endif /*LV_USE_GPU_SDL*/
|
|
@ -1,10 +1,10 @@
|
|||
/**
|
||||
* @file lv_gpu_sdl.h
|
||||
* @file lv_draw_sdl_priv.h
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef LV_GPU_SDL_H
|
||||
#define LV_GPU_SDL_H
|
||||
#ifndef LV_DRAW_SDL_PRIV_H
|
||||
#define LV_DRAW_SDL_PRIV_H
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
@ -14,16 +14,15 @@ extern "C" {
|
|||
/*********************
|
||||
* INCLUDES
|
||||
*********************/
|
||||
#include "../lv_conf_internal.h"
|
||||
#include "../../lv_conf_internal.h"
|
||||
|
||||
#if LV_USE_GPU_SDL
|
||||
|
||||
#if LV_USE_EXTERNAL_RENDERER == 0
|
||||
#error "SDL GPU requires LV_USE_EXTERNAL_RENDERER 1. Enable it in lv_conf.h"
|
||||
#endif
|
||||
|
||||
#include LV_GPU_SDL_INCLUDE_PATH
|
||||
|
||||
#include "../lv_draw.h"
|
||||
#include "../../misc/lv_lru.h"
|
||||
|
||||
/*********************
|
||||
* DEFINES
|
||||
*********************/
|
||||
|
@ -32,18 +31,16 @@ extern "C" {
|
|||
* TYPEDEFS
|
||||
**********************/
|
||||
|
||||
typedef struct lv_draw_sdl_context_internals_t {
|
||||
lv_lru_t * texture_cache;
|
||||
SDL_Texture * mask;
|
||||
SDL_Texture * composition;
|
||||
} lv_draw_sdl_context_internals_t;
|
||||
|
||||
/**********************
|
||||
* GLOBAL PROTOTYPES
|
||||
**********************/
|
||||
|
||||
void lv_gpu_sdl_init();
|
||||
|
||||
/**
|
||||
* @brief Free caches
|
||||
*
|
||||
*/
|
||||
void lv_gpu_sdl_deinit();
|
||||
|
||||
/*======================
|
||||
* Add/remove functions
|
||||
*=====================*/
|
||||
|
@ -70,4 +67,4 @@ void lv_gpu_sdl_deinit();
|
|||
} /*extern "C"*/
|
||||
#endif
|
||||
|
||||
#endif /*LV_GPU_SDL_H*/
|
||||
#endif /*LV_DRAW_SDL_PRIV_H*/
|
|
@ -0,0 +1,708 @@
|
|||
/**
|
||||
* @file lv_draw_sdl_rect.c
|
||||
*
|
||||
*/
|
||||
|
||||
/*********************
|
||||
* INCLUDES
|
||||
*********************/
|
||||
|
||||
#include "../../lv_conf_internal.h"
|
||||
|
||||
#if LV_USE_GPU_SDL
|
||||
|
||||
#include "../lv_draw_rect.h"
|
||||
#include "../lv_draw_img.h"
|
||||
#include "../lv_draw_label.h"
|
||||
#include "../lv_draw_mask.h"
|
||||
#include "../../core/lv_refr.h"
|
||||
#include "lv_draw_sdl_utils.h"
|
||||
#include "lv_draw_sdl_texture_cache.h"
|
||||
#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"
|
||||
|
||||
/*********************
|
||||
* DEFINES
|
||||
*********************/
|
||||
|
||||
/**********************
|
||||
* TYPEDEFS
|
||||
**********************/
|
||||
|
||||
typedef struct {
|
||||
lv_sdl_cache_key_magic_t magic;
|
||||
lv_coord_t radius;
|
||||
lv_coord_t size;
|
||||
} lv_draw_rect_bg_key_t;
|
||||
|
||||
typedef struct {
|
||||
lv_sdl_cache_key_magic_t magic;
|
||||
lv_coord_t radius;
|
||||
lv_coord_t size;
|
||||
lv_coord_t blur;
|
||||
} lv_draw_rect_shadow_key_t;
|
||||
|
||||
typedef struct {
|
||||
lv_sdl_cache_key_magic_t magic;
|
||||
lv_coord_t rout, rin;
|
||||
lv_area_t offsets;
|
||||
} lv_draw_rect_border_key_t;
|
||||
|
||||
/**********************
|
||||
* STATIC PROTOTYPES
|
||||
**********************/
|
||||
|
||||
static void draw_bg_color(lv_draw_sdl_ctx_t * ctx, const lv_area_t * coords, const lv_area_t * draw_area,
|
||||
const lv_draw_rect_dsc_t * dsc);
|
||||
|
||||
static void draw_bg_img(lv_draw_sdl_ctx_t * ctx, const lv_area_t * coords, const lv_area_t * draw_area,
|
||||
const lv_draw_rect_dsc_t * dsc);
|
||||
|
||||
static void draw_border(lv_draw_sdl_ctx_t * ctx, const lv_area_t * coords, const lv_area_t * draw_area,
|
||||
const lv_draw_rect_dsc_t * dsc);
|
||||
|
||||
static void draw_shadow(lv_draw_sdl_ctx_t * ctx, const lv_area_t * coords, const lv_area_t * clip,
|
||||
const lv_draw_rect_dsc_t * dsc);
|
||||
|
||||
static void draw_outline(lv_draw_sdl_ctx_t * ctx, const lv_area_t * coords, const lv_area_t * clip,
|
||||
const lv_draw_rect_dsc_t * dsc);
|
||||
|
||||
static void draw_border_generic(lv_draw_sdl_ctx_t * ctx, const lv_area_t * outer_area, const lv_area_t * inner_area,
|
||||
const lv_area_t * clip, lv_coord_t rout, lv_coord_t rin, lv_color_t color, lv_opa_t opa,
|
||||
lv_blend_mode_t blend_mode);
|
||||
|
||||
static void frag_render_borders(SDL_Renderer * renderer, SDL_Texture * frag, lv_coord_t frag_size,
|
||||
const lv_area_t * coords, const lv_area_t * clipped, bool full);
|
||||
|
||||
static void frag_render_center(SDL_Renderer * renderer, SDL_Texture * frag, lv_coord_t frag_size,
|
||||
const lv_area_t * coords, const lv_area_t * clipped, bool full);
|
||||
|
||||
static lv_draw_rect_bg_key_t rect_bg_key_create(lv_coord_t radius, lv_coord_t size);
|
||||
|
||||
static lv_draw_rect_shadow_key_t rect_shadow_key_create(lv_coord_t radius, lv_coord_t size, lv_coord_t blur);
|
||||
|
||||
static lv_draw_rect_border_key_t rect_border_key_create(lv_coord_t rout, lv_coord_t rin, const lv_area_t * outer_area,
|
||||
const lv_area_t * inner_area);
|
||||
|
||||
/**********************
|
||||
* STATIC VARIABLES
|
||||
**********************/
|
||||
|
||||
/**********************
|
||||
* MACROS
|
||||
**********************/
|
||||
#define SKIP_BORDER(dsc) ((dsc)->border_opa <= LV_OPA_MIN || (dsc)->border_width == 0 || (dsc)->border_side == LV_BORDER_SIDE_NONE || (dsc)->border_post)
|
||||
#define SKIP_SHADOW(dsc) ((dsc)->shadow_width == 0 || (dsc)->shadow_opa <= LV_OPA_MIN || ((dsc)->shadow_width == 1 && (dsc)->shadow_spread <= 0 && (dsc)->shadow_ofs_x == 0 && (dsc)->shadow_ofs_y == 0))
|
||||
#define SKIP_IMAGE(dsc) ((dsc)->bg_img_src == NULL || (dsc)->bg_img_opa <= LV_OPA_MIN)
|
||||
#define SKIP_OUTLINE(dsc) ((dsc)->outline_opa <= LV_OPA_MIN || (dsc)->outline_width == 0)
|
||||
|
||||
/**********************
|
||||
* GLOBAL FUNCTIONS
|
||||
**********************/
|
||||
|
||||
void lv_draw_sdl_draw_rect(lv_draw_ctx_t * draw_ctx, const lv_draw_rect_dsc_t * dsc, const lv_area_t * coords)
|
||||
{
|
||||
const lv_area_t * clip = draw_ctx->clip_area;
|
||||
lv_draw_sdl_ctx_t * ctx = (lv_draw_sdl_ctx_t *) draw_ctx;
|
||||
|
||||
lv_area_t extension = {0, 0, 0, 0};
|
||||
if(!SKIP_SHADOW(dsc)) {
|
||||
lv_coord_t ext = (lv_coord_t)(dsc->shadow_spread - dsc->shadow_width / 2 + 1);
|
||||
extension.x1 = LV_MAX(extension.x1, -dsc->shadow_ofs_x + ext);
|
||||
extension.x2 = LV_MAX(extension.x2, dsc->shadow_ofs_x + ext);
|
||||
extension.y1 = LV_MAX(extension.y1, -dsc->shadow_ofs_y + ext);
|
||||
extension.y2 = LV_MAX(extension.y2, dsc->shadow_ofs_y + ext);
|
||||
}
|
||||
if(!SKIP_OUTLINE(dsc)) {
|
||||
lv_coord_t ext = (lv_coord_t)(dsc->outline_pad - 1 + dsc->outline_width);
|
||||
extension.x1 = LV_MAX(extension.x1, ext);
|
||||
extension.x2 = LV_MAX(extension.x2, ext);
|
||||
extension.y1 = LV_MAX(extension.y1, ext);
|
||||
extension.y2 = LV_MAX(extension.y2, ext);
|
||||
}
|
||||
/* 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_content = _lv_area_intersect(&t_area, &t_coords, &t_clip);
|
||||
|
||||
SDL_Rect clip_rect;
|
||||
lv_area_to_sdl_rect(&t_clip, &clip_rect);
|
||||
draw_shadow(ctx, &t_coords, &t_clip, dsc);
|
||||
/* Shadows and outlines will also draw in extended area */
|
||||
if(has_content) {
|
||||
draw_bg_color(ctx, &t_coords, &t_area, dsc);
|
||||
draw_bg_img(ctx, &t_coords, &t_area, dsc);
|
||||
draw_border(ctx, &t_coords, &t_area, dsc);
|
||||
}
|
||||
draw_outline(ctx, &t_coords, &t_clip, dsc);
|
||||
|
||||
lv_draw_sdl_composite_end(ctx, &apply_area, dsc->blend_mode);
|
||||
}
|
||||
|
||||
SDL_Texture * lv_draw_sdl_rect_bg_frag_obtain(lv_draw_sdl_ctx_t * ctx, lv_coord_t radius)
|
||||
{
|
||||
lv_draw_rect_bg_key_t key = rect_bg_key_create(radius, radius);
|
||||
lv_area_t coords = {0, 0, radius * 2 - 1, radius * 2 - 1};
|
||||
lv_area_t coords_frag = {0, 0, radius - 1, radius - 1};
|
||||
SDL_Texture * texture = lv_draw_sdl_texture_cache_get(ctx, &key, sizeof(key), NULL);
|
||||
if(texture == NULL) {
|
||||
lv_draw_mask_radius_param_t mask_rout_param;
|
||||
lv_draw_mask_radius_init(&mask_rout_param, &coords, radius, false);
|
||||
int16_t mask_id = lv_draw_mask_add(&mask_rout_param, NULL);
|
||||
texture = lv_draw_sdl_mask_dump_texture(ctx->renderer, &coords_frag, &mask_id, 1);
|
||||
lv_draw_mask_remove_id(mask_id);
|
||||
SDL_assert(texture);
|
||||
lv_draw_sdl_texture_cache_put(ctx, &key, sizeof(key), texture);
|
||||
}
|
||||
return texture;
|
||||
}
|
||||
|
||||
void lv_draw_sdl_rect_bg_frag_draw_corners(lv_draw_sdl_ctx_t * ctx, SDL_Texture * frag, lv_coord_t frag_size,
|
||||
const lv_area_t * coords, const lv_area_t * clip, bool full)
|
||||
{
|
||||
if(!clip) clip = coords;
|
||||
lv_area_t corner_area, dst_area;
|
||||
/* Upper left */
|
||||
corner_area.x1 = coords->x1;
|
||||
corner_area.y1 = coords->y1;
|
||||
corner_area.x2 = coords->x1 + frag_size - 1;
|
||||
corner_area.y2 = coords->y1 + frag_size - 1;
|
||||
if(_lv_area_intersect(&dst_area, &corner_area, clip)) {
|
||||
SDL_Rect dst_rect;
|
||||
lv_area_to_sdl_rect(&dst_area, &dst_rect);
|
||||
|
||||
lv_coord_t dw = lv_area_get_width(&dst_area), dh = lv_area_get_height(&dst_area);
|
||||
lv_coord_t sx = (lv_coord_t)(dst_area.x1 - corner_area.x1), sy = (lv_coord_t)(dst_area.y1 - corner_area.y1);
|
||||
SDL_Rect src_rect = {sx, sy, dw, dh};
|
||||
SDL_RenderCopy(ctx->renderer, frag, &src_rect, &dst_rect);
|
||||
}
|
||||
/* Upper right, clip right edge if too big */
|
||||
corner_area.x1 = LV_MAX(coords->x2 - frag_size + 1, coords->x1 + frag_size);
|
||||
corner_area.x2 = coords->x2;
|
||||
if(_lv_area_intersect(&dst_area, &corner_area, clip)) {
|
||||
SDL_Rect dst_rect;
|
||||
lv_area_to_sdl_rect(&dst_area, &dst_rect);
|
||||
|
||||
lv_coord_t dw = lv_area_get_width(&dst_area), dh = lv_area_get_height(&dst_area);
|
||||
if(full) {
|
||||
lv_coord_t sx = (lv_coord_t)(dst_area.x1 - corner_area.x1),
|
||||
sy = (lv_coord_t)(dst_area.y1 - corner_area.y1);
|
||||
SDL_Rect src_rect = {frag_size + 3 + sx, sy, dw, dh};
|
||||
SDL_RenderCopy(ctx->renderer, frag, &src_rect, &dst_rect);
|
||||
}
|
||||
else {
|
||||
SDL_Rect src_rect = {corner_area.x2 - dst_area.x2, dst_area.y1 - corner_area.y1, dw, dh};
|
||||
SDL_RenderCopyEx(ctx->renderer, frag, &src_rect, &dst_rect, 0, NULL, SDL_FLIP_HORIZONTAL);
|
||||
}
|
||||
}
|
||||
/* Lower right, clip bottom edge if too big */
|
||||
corner_area.y1 = LV_MAX(coords->y2 - frag_size + 1, coords->y1 + frag_size);
|
||||
corner_area.y2 = coords->y2;
|
||||
if(_lv_area_intersect(&dst_area, &corner_area, clip)) {
|
||||
SDL_Rect dst_rect;
|
||||
lv_area_to_sdl_rect(&dst_area, &dst_rect);
|
||||
|
||||
lv_coord_t dw = lv_area_get_width(&dst_area), dh = lv_area_get_height(&dst_area);
|
||||
if(full) {
|
||||
lv_coord_t sx = (lv_coord_t)(dst_area.x1 - corner_area.x1),
|
||||
sy = (lv_coord_t)(dst_area.y1 - corner_area.y1);
|
||||
SDL_Rect src_rect = {frag_size + 3 + sx, frag_size + 3 + sy, dw, dh};
|
||||
SDL_RenderCopy(ctx->renderer, frag, &src_rect, &dst_rect);
|
||||
}
|
||||
else {
|
||||
SDL_Rect src_rect = {corner_area.x2 - dst_area.x2, corner_area.y2 - dst_area.y2, dw, dh};
|
||||
SDL_RenderCopyEx(ctx->renderer, frag, &src_rect, &dst_rect, 0, NULL, SDL_FLIP_HORIZONTAL | SDL_FLIP_VERTICAL);
|
||||
}
|
||||
}
|
||||
/* Lower left, right edge should not be clip */
|
||||
corner_area.x1 = coords->x1;
|
||||
corner_area.x2 = coords->x1 + frag_size - 1;
|
||||
if(_lv_area_intersect(&dst_area, &corner_area, clip)) {
|
||||
SDL_Rect dst_rect;
|
||||
lv_area_to_sdl_rect(&dst_area, &dst_rect);
|
||||
|
||||
lv_coord_t dw = lv_area_get_width(&dst_area), dh = lv_area_get_height(&dst_area);
|
||||
if(full) {
|
||||
lv_coord_t sx = (lv_coord_t)(dst_area.x1 - corner_area.x1),
|
||||
sy = (lv_coord_t)(dst_area.y1 - corner_area.y1);
|
||||
SDL_Rect src_rect = {sx, frag_size + 3 + sy, dw, dh};
|
||||
SDL_RenderCopy(ctx->renderer, frag, &src_rect, &dst_rect);
|
||||
}
|
||||
else {
|
||||
SDL_Rect src_rect = {dst_area.x1 - corner_area.x1, corner_area.y2 - dst_area.y2, dw, dh};
|
||||
SDL_RenderCopyEx(ctx->renderer, frag, &src_rect, &dst_rect, 0, NULL, SDL_FLIP_VERTICAL);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**********************
|
||||
* STATIC FUNCTIONS
|
||||
**********************/
|
||||
|
||||
static void draw_bg_color(lv_draw_sdl_ctx_t * ctx, const lv_area_t * coords, const lv_area_t * draw_area,
|
||||
const lv_draw_rect_dsc_t * dsc)
|
||||
{
|
||||
if(dsc->bg_opa == 0) {
|
||||
return;
|
||||
}
|
||||
SDL_Color bg_color;
|
||||
lv_color_to_sdl_color(&dsc->bg_color, &bg_color);
|
||||
lv_coord_t radius = dsc->radius;
|
||||
if(radius <= 0) {
|
||||
SDL_Rect rect;
|
||||
lv_area_to_sdl_rect(draw_area, &rect);
|
||||
SDL_SetRenderDrawColor(ctx->renderer, bg_color.r, bg_color.g, bg_color.b, dsc->bg_opa);
|
||||
SDL_SetRenderDrawBlendMode(ctx->renderer, SDL_BLENDMODE_BLEND);
|
||||
SDL_RenderFillRect(ctx->renderer, &rect);
|
||||
return;
|
||||
}
|
||||
|
||||
/*A small texture with a quarter of the rect is enough*/
|
||||
lv_coord_t bg_w = lv_area_get_width(coords), bg_h = lv_area_get_height(coords);
|
||||
lv_coord_t real_radius = LV_MIN3(bg_w / 2, bg_h / 2, radius);
|
||||
SDL_Texture * texture = lv_draw_sdl_rect_bg_frag_obtain(ctx, real_radius);
|
||||
|
||||
SDL_SetTextureBlendMode(texture, SDL_BLENDMODE_BLEND);
|
||||
SDL_SetTextureAlphaMod(texture, dsc->bg_opa);
|
||||
SDL_SetTextureColorMod(texture, bg_color.r, bg_color.g, bg_color.b);
|
||||
lv_draw_sdl_rect_bg_frag_draw_corners(ctx, texture, real_radius, coords, draw_area, false);
|
||||
frag_render_borders(ctx->renderer, texture, real_radius, coords, draw_area, false);
|
||||
frag_render_center(ctx->renderer, texture, real_radius, coords, draw_area, false);
|
||||
}
|
||||
|
||||
static void draw_bg_img(lv_draw_sdl_ctx_t * ctx, const lv_area_t * coords, const lv_area_t * draw_area,
|
||||
const lv_draw_rect_dsc_t * dsc)
|
||||
{
|
||||
if(SKIP_IMAGE(dsc)) return;
|
||||
|
||||
lv_img_src_t src_type = lv_img_src_get_type(dsc->bg_img_src);
|
||||
if(src_type == LV_IMG_SRC_SYMBOL) {
|
||||
lv_point_t size;
|
||||
lv_txt_get_size(&size, dsc->bg_img_src, dsc->bg_img_symbol_font, 0, 0, LV_COORD_MAX, LV_TEXT_FLAG_NONE);
|
||||
lv_area_t a;
|
||||
a.x1 = coords->x1 + lv_area_get_width(coords) / 2 - size.x / 2;
|
||||
a.x2 = a.x1 + size.x - 1;
|
||||
a.y1 = coords->y1 + lv_area_get_height(coords) / 2 - size.y / 2;
|
||||
a.y2 = a.y1 + size.y - 1;
|
||||
|
||||
lv_draw_label_dsc_t label_draw_dsc;
|
||||
lv_draw_label_dsc_init(&label_draw_dsc);
|
||||
label_draw_dsc.font = dsc->bg_img_symbol_font;
|
||||
label_draw_dsc.color = dsc->bg_img_recolor;
|
||||
label_draw_dsc.opa = dsc->bg_img_opa;
|
||||
lv_draw_label((lv_draw_ctx_t *) ctx, &label_draw_dsc, &a, dsc->bg_img_src, NULL);
|
||||
}
|
||||
else {
|
||||
lv_img_header_t header;
|
||||
size_t key_size;
|
||||
lv_draw_sdl_cache_key_head_img_t * key = lv_draw_sdl_texture_img_key_create(dsc->bg_img_src, 0, &key_size);
|
||||
bool key_found;
|
||||
lv_img_header_t * cache_header = NULL;
|
||||
SDL_Texture * texture = lv_draw_sdl_texture_cache_get_with_userdata(ctx, key, key_size, &key_found,
|
||||
(void **) &cache_header);
|
||||
SDL_free(key);
|
||||
if(texture) {
|
||||
header = *cache_header;
|
||||
}
|
||||
else if(key_found || lv_img_decoder_get_info(dsc->bg_img_src, &header) != LV_RES_OK) {
|
||||
/* When cache hit but with negative result, use default decoder. If still fail, return.*/
|
||||
LV_LOG_WARN("Couldn't read the background image");
|
||||
return;
|
||||
}
|
||||
|
||||
lv_draw_img_dsc_t img_dsc;
|
||||
lv_draw_img_dsc_init(&img_dsc);
|
||||
img_dsc.blend_mode = dsc->blend_mode;
|
||||
img_dsc.recolor = dsc->bg_img_recolor;
|
||||
img_dsc.recolor_opa = dsc->bg_img_recolor_opa;
|
||||
img_dsc.opa = dsc->bg_img_opa;
|
||||
img_dsc.frame_id = 0;
|
||||
|
||||
int16_t radius_mask_id = LV_MASK_ID_INV;
|
||||
lv_draw_mask_radius_param_t radius_param;
|
||||
if(dsc->radius > 0) {
|
||||
lv_draw_mask_radius_init(&radius_param, coords, dsc->radius, false);
|
||||
radius_mask_id = lv_draw_mask_add(&radius_param, NULL);
|
||||
}
|
||||
|
||||
/*Center align*/
|
||||
if(dsc->bg_img_tiled == false) {
|
||||
lv_area_t area;
|
||||
area.x1 = coords->x1 + lv_area_get_width(coords) / 2 - header.w / 2;
|
||||
area.y1 = coords->y1 + lv_area_get_height(coords) / 2 - header.h / 2;
|
||||
area.x2 = area.x1 + header.w - 1;
|
||||
area.y2 = area.y1 + header.h - 1;
|
||||
|
||||
lv_draw_img((lv_draw_ctx_t *) ctx, &img_dsc, &area, dsc->bg_img_src);
|
||||
}
|
||||
else {
|
||||
lv_area_t area;
|
||||
area.y1 = coords->y1;
|
||||
area.y2 = area.y1 + header.h - 1;
|
||||
|
||||
for(; area.y1 <= coords->y2; area.y1 += header.h, area.y2 += header.h) {
|
||||
|
||||
area.x1 = coords->x1;
|
||||
area.x2 = area.x1 + header.w - 1;
|
||||
for(; area.x1 <= coords->x2; area.x1 += header.w, area.x2 += header.w) {
|
||||
lv_draw_img((lv_draw_ctx_t *) ctx, &img_dsc, &area, dsc->bg_img_src);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(radius_mask_id != LV_MASK_ID_INV) {
|
||||
lv_draw_mask_remove_id(radius_mask_id);
|
||||
lv_draw_mask_free_param(&radius_param);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void draw_shadow(lv_draw_sdl_ctx_t * ctx, const lv_area_t * coords, const lv_area_t * clip,
|
||||
const lv_draw_rect_dsc_t * dsc)
|
||||
{
|
||||
/*Check whether the shadow is visible*/
|
||||
if(SKIP_SHADOW(dsc)) return;
|
||||
|
||||
lv_coord_t sw = dsc->shadow_width;
|
||||
|
||||
lv_area_t core_area;
|
||||
core_area.x1 = coords->x1 + dsc->shadow_ofs_x - dsc->shadow_spread;
|
||||
core_area.x2 = coords->x2 + dsc->shadow_ofs_x + dsc->shadow_spread;
|
||||
core_area.y1 = coords->y1 + dsc->shadow_ofs_y - dsc->shadow_spread;
|
||||
core_area.y2 = coords->y2 + dsc->shadow_ofs_y + dsc->shadow_spread;
|
||||
|
||||
lv_area_t shadow_area;
|
||||
shadow_area.x1 = core_area.x1 - sw / 2 - 1;
|
||||
shadow_area.x2 = core_area.x2 + sw / 2 + 1;
|
||||
shadow_area.y1 = core_area.y1 - sw / 2 - 1;
|
||||
shadow_area.y2 = core_area.y2 + sw / 2 + 1;
|
||||
|
||||
lv_opa_t opa = dsc->shadow_opa;
|
||||
|
||||
if(opa > LV_OPA_MAX) opa = LV_OPA_COVER;
|
||||
|
||||
/*Get clipped draw area which is the real draw area.
|
||||
*It is always the same or inside `shadow_area`*/
|
||||
lv_area_t draw_area;
|
||||
if(!_lv_area_intersect(&draw_area, &shadow_area, clip)) return;
|
||||
|
||||
SDL_Rect core_area_rect;
|
||||
lv_area_to_sdl_rect(&shadow_area, &core_area_rect);
|
||||
|
||||
lv_coord_t radius = dsc->radius;
|
||||
/* No matter how big the shadow is, what we need is just a corner */
|
||||
lv_coord_t frag_size = LV_MIN3(lv_area_get_width(&core_area) / 2, lv_area_get_height(&core_area) / 2,
|
||||
LV_MAX(sw / 2, radius));
|
||||
|
||||
/* This is how big the corner is after blurring */
|
||||
lv_coord_t blur_growth = (lv_coord_t)(sw / 2 + 1);
|
||||
|
||||
lv_coord_t blur_frag_size = (lv_coord_t)(frag_size + blur_growth);
|
||||
|
||||
lv_draw_rect_shadow_key_t key = rect_shadow_key_create(radius, frag_size, sw);
|
||||
|
||||
SDL_Texture * texture = lv_draw_sdl_texture_cache_get(ctx, &key, sizeof(key), NULL);
|
||||
if(texture == NULL) {
|
||||
lv_area_t mask_area = {blur_growth, blur_growth}, mask_area_blurred = {0, 0};
|
||||
lv_area_set_width(&mask_area, frag_size * 2);
|
||||
lv_area_set_height(&mask_area, frag_size * 2);
|
||||
lv_area_set_width(&mask_area_blurred, blur_frag_size * 2);
|
||||
lv_area_set_height(&mask_area_blurred, blur_frag_size * 2);
|
||||
|
||||
lv_draw_mask_radius_param_t mask_rout_param;
|
||||
lv_draw_mask_radius_init(&mask_rout_param, &mask_area, radius, false);
|
||||
int16_t mask_id = lv_draw_mask_add(&mask_rout_param, NULL);
|
||||
lv_opa_t * mask_buf = lv_draw_sdl_mask_dump_opa(&mask_area_blurred, &mask_id, 1);
|
||||
lv_stack_blur_grayscale(mask_buf, lv_area_get_width(&mask_area_blurred), lv_area_get_height(&mask_area_blurred),
|
||||
sw / 2 + sw % 2);
|
||||
texture = lv_sdl_create_opa_texture(ctx->renderer, mask_buf, blur_frag_size, blur_frag_size,
|
||||
lv_area_get_width(&mask_area_blurred));
|
||||
lv_mem_buf_release(mask_buf);
|
||||
lv_draw_mask_remove_id(mask_id);
|
||||
SDL_assert(texture);
|
||||
lv_draw_sdl_texture_cache_put(ctx, &key, sizeof(key), texture);
|
||||
}
|
||||
|
||||
SDL_Color shadow_color;
|
||||
lv_color_to_sdl_color(&dsc->shadow_color, &shadow_color);
|
||||
SDL_SetTextureBlendMode(texture, SDL_BLENDMODE_BLEND);
|
||||
SDL_SetTextureAlphaMod(texture, opa);
|
||||
SDL_SetTextureColorMod(texture, shadow_color.r, shadow_color.g, shadow_color.b);
|
||||
|
||||
lv_draw_sdl_rect_bg_frag_draw_corners(ctx, texture, blur_frag_size, &shadow_area, clip, false);
|
||||
frag_render_borders(ctx->renderer, texture, blur_frag_size, &shadow_area, clip, false);
|
||||
frag_render_center(ctx->renderer, texture, blur_frag_size, &shadow_area, clip, false);
|
||||
}
|
||||
|
||||
|
||||
static void draw_border(lv_draw_sdl_ctx_t * ctx, const lv_area_t * coords, const lv_area_t * draw_area,
|
||||
const lv_draw_rect_dsc_t * dsc)
|
||||
{
|
||||
if(SKIP_BORDER(dsc)) return;
|
||||
|
||||
SDL_Color border_color;
|
||||
lv_color_to_sdl_color(&dsc->border_color, &border_color);
|
||||
|
||||
lv_coord_t coords_w = lv_area_get_width(coords), coords_h = lv_area_get_height(coords);
|
||||
lv_coord_t short_side = LV_MIN(coords_w, coords_h);
|
||||
lv_coord_t rout = LV_MIN(dsc->radius, short_side / 2);/*Get the inner area*/
|
||||
lv_area_t area_inner;
|
||||
lv_area_copy(&area_inner, coords);// lv_area_increase(&area_inner, 1, 1);
|
||||
area_inner.x1 += ((dsc->border_side & LV_BORDER_SIDE_LEFT) ? dsc->border_width : -(dsc->border_width + rout));
|
||||
area_inner.x2 -= ((dsc->border_side & LV_BORDER_SIDE_RIGHT) ? dsc->border_width : -(dsc->border_width + rout));
|
||||
area_inner.y1 += ((dsc->border_side & LV_BORDER_SIDE_TOP) ? dsc->border_width : -(dsc->border_width + rout));
|
||||
area_inner.y2 -= ((dsc->border_side & LV_BORDER_SIDE_BOTTOM) ? dsc->border_width : -(dsc->border_width + rout));
|
||||
lv_coord_t rin = LV_MAX(rout - dsc->border_width, 0);
|
||||
draw_border_generic(ctx, coords, &area_inner, draw_area, rout, rin, dsc->border_color, dsc->border_opa,
|
||||
dsc->blend_mode);
|
||||
}
|
||||
|
||||
static void draw_outline(lv_draw_sdl_ctx_t * ctx, const lv_area_t * coords, const lv_area_t * clip,
|
||||
const lv_draw_rect_dsc_t * dsc)
|
||||
{
|
||||
if(SKIP_OUTLINE(dsc)) return;
|
||||
|
||||
lv_opa_t opa = dsc->outline_opa;
|
||||
|
||||
if(opa > LV_OPA_MAX) opa = LV_OPA_COVER;
|
||||
|
||||
/*Get the inner radius*/
|
||||
lv_area_t area_inner;
|
||||
lv_area_copy(&area_inner, coords);
|
||||
|
||||
/*Bring the outline closer to make sure there is no color bleeding with pad=0*/
|
||||
lv_coord_t pad = dsc->outline_pad - 1;
|
||||
area_inner.x1 -= pad;
|
||||
area_inner.y1 -= pad;
|
||||
area_inner.x2 += pad;
|
||||
area_inner.y2 += pad;
|
||||
|
||||
lv_area_t area_outer;
|
||||
lv_area_copy(&area_outer, &area_inner);
|
||||
|
||||
area_outer.x1 -= dsc->outline_width;
|
||||
area_outer.x2 += dsc->outline_width;
|
||||
area_outer.y1 -= dsc->outline_width;
|
||||
area_outer.y2 += dsc->outline_width;
|
||||
|
||||
lv_area_t draw_area;
|
||||
if(!_lv_area_intersect(&draw_area, &area_outer, clip)) return;
|
||||
|
||||
int32_t inner_w = lv_area_get_width(&area_inner);
|
||||
int32_t inner_h = lv_area_get_height(&area_inner);
|
||||
lv_coord_t rin = dsc->radius;
|
||||
int32_t short_side = LV_MIN(inner_w, inner_h);
|
||||
if(rin > short_side >> 1) rin = short_side >> 1;
|
||||
|
||||
lv_coord_t rout = rin + dsc->outline_width;
|
||||
|
||||
draw_border_generic(ctx, &area_outer, &area_inner, clip, rout, rin, dsc->outline_color, dsc->outline_opa,
|
||||
dsc->blend_mode);
|
||||
}
|
||||
|
||||
static void draw_border_generic(lv_draw_sdl_ctx_t * ctx, const lv_area_t * outer_area, const lv_area_t * inner_area,
|
||||
const lv_area_t * clip, lv_coord_t rout, lv_coord_t rin, lv_color_t color, lv_opa_t opa,
|
||||
lv_blend_mode_t blend_mode)
|
||||
{
|
||||
opa = opa >= LV_OPA_COVER ? LV_OPA_COVER : opa;
|
||||
|
||||
SDL_Renderer * renderer = ctx->renderer;
|
||||
|
||||
lv_draw_rect_border_key_t key = rect_border_key_create(rout, rin, outer_area, inner_area);
|
||||
lv_coord_t radius = LV_MIN3(rout, lv_area_get_width(outer_area) / 2, lv_area_get_height(outer_area) / 2);
|
||||
lv_coord_t max_side = LV_MAX4(key.offsets.x1, key.offsets.y1, -key.offsets.x2, -key.offsets.y2);
|
||||
lv_coord_t frag_size = LV_MAX(radius, max_side);
|
||||
SDL_Texture * texture = lv_draw_sdl_texture_cache_get(ctx, &key, sizeof(key), NULL);
|
||||
if(texture == NULL) {
|
||||
/* Create a mask texture with size of (frag_size * 2 + 3) */
|
||||
const lv_area_t frag_area = {0, 0, frag_size * 2 + 2, frag_size * 2 + 2};
|
||||
|
||||
/*Create mask for the outer area*/
|
||||
int16_t mask_ids[2] = {LV_MASK_ID_INV, LV_MASK_ID_INV};
|
||||
lv_draw_mask_radius_param_t mask_rout_param;
|
||||
if(rout > 0) {
|
||||
lv_draw_mask_radius_init(&mask_rout_param, &frag_area, rout, false);
|
||||
mask_ids[0] = lv_draw_mask_add(&mask_rout_param, NULL);
|
||||
}
|
||||
|
||||
/*Create mask for the inner mask*/
|
||||
if(rin < 0) rin = 0;
|
||||
const lv_area_t frag_inner_area = {frag_area.x1 + key.offsets.x1, frag_area.y1 + key.offsets.y1,
|
||||
frag_area.x2 + key.offsets.x2, frag_area.y2 + key.offsets.y2
|
||||
};
|
||||
lv_draw_mask_radius_param_t mask_rin_param;
|
||||
lv_draw_mask_radius_init(&mask_rin_param, &frag_inner_area, rin, true);
|
||||
mask_ids[1] = lv_draw_mask_add(&mask_rin_param, NULL);
|
||||
|
||||
texture = lv_draw_sdl_mask_dump_texture(renderer, &frag_area, mask_ids, 2);
|
||||
|
||||
lv_draw_mask_remove_id(mask_ids[1]);
|
||||
lv_draw_mask_remove_id(mask_ids[0]);
|
||||
SDL_assert(texture);
|
||||
lv_draw_sdl_texture_cache_put(ctx, &key, sizeof(key), texture);
|
||||
}
|
||||
|
||||
SDL_Rect outer_rect;
|
||||
lv_area_to_sdl_rect(outer_area, &outer_rect);
|
||||
SDL_Color color_sdl;
|
||||
lv_color_to_sdl_color(&color, &color_sdl);
|
||||
|
||||
SDL_SetTextureBlendMode(texture, SDL_BLENDMODE_BLEND);
|
||||
SDL_SetTextureAlphaMod(texture, opa);
|
||||
SDL_SetTextureColorMod(texture, color_sdl.r, color_sdl.g, color_sdl.b);
|
||||
|
||||
lv_draw_sdl_rect_bg_frag_draw_corners(ctx, texture, frag_size, outer_area, clip, true);
|
||||
frag_render_borders(renderer, texture, frag_size, outer_area, clip, true);
|
||||
}
|
||||
|
||||
static void frag_render_borders(SDL_Renderer * renderer, SDL_Texture * frag, lv_coord_t frag_size,
|
||||
const lv_area_t * coords, const lv_area_t * clipped, bool full)
|
||||
{
|
||||
lv_area_t border_area, dst_area;
|
||||
/* Top border */
|
||||
border_area.x1 = coords->x1 + frag_size;
|
||||
border_area.y1 = coords->y1;
|
||||
border_area.x2 = coords->x2 - frag_size;
|
||||
border_area.y2 = coords->y1 + frag_size - 1;
|
||||
if(_lv_area_intersect(&dst_area, &border_area, clipped)) {
|
||||
SDL_Rect dst_rect;
|
||||
lv_area_to_sdl_rect(&dst_area, &dst_rect);
|
||||
|
||||
lv_coord_t sy = (lv_coord_t)(dst_area.y1 - border_area.y1);
|
||||
if(full) {
|
||||
SDL_Rect src_rect = {frag_size + 1, sy, 1, lv_area_get_height(&dst_area)};
|
||||
SDL_RenderCopy(renderer, frag, &src_rect, &dst_rect);
|
||||
}
|
||||
else {
|
||||
SDL_Rect src_rect = {frag_size - 1, sy, 1, lv_area_get_height(&dst_area)};
|
||||
SDL_RenderCopy(renderer, frag, &src_rect, &dst_rect);
|
||||
}
|
||||
}
|
||||
/* Bottom border */
|
||||
border_area.y1 = LV_MAX(coords->y2 - frag_size + 1, coords->y1 + frag_size);
|
||||
border_area.y2 = coords->y2;
|
||||
if(_lv_area_intersect(&dst_area, &border_area, clipped)) {
|
||||
SDL_Rect dst_rect;
|
||||
lv_area_to_sdl_rect(&dst_area, &dst_rect);
|
||||
|
||||
lv_coord_t dh = lv_area_get_height(&dst_area);
|
||||
if(full) {
|
||||
lv_coord_t sy = (lv_coord_t)(dst_area.y1 - border_area.y1);
|
||||
SDL_Rect src_rect = {frag_size + 1, frag_size + 3 + sy, 1, dh};
|
||||
SDL_RenderCopy(renderer, frag, &src_rect, &dst_rect);
|
||||
}
|
||||
else {
|
||||
lv_coord_t sy = (lv_coord_t)(border_area.y2 - dst_area.y2);
|
||||
SDL_Rect src_rect = {frag_size - 1, sy, 1, dh};
|
||||
SDL_RenderCopyEx(renderer, frag, &src_rect, &dst_rect, 0, NULL, SDL_FLIP_VERTICAL);
|
||||
}
|
||||
}
|
||||
/* Left border */
|
||||
border_area.x1 = coords->x1;
|
||||
border_area.y1 = coords->y1 + frag_size;
|
||||
border_area.x2 = coords->x1 + frag_size - 1;
|
||||
border_area.y2 = coords->y2 - frag_size;
|
||||
if(_lv_area_intersect(&dst_area, &border_area, clipped)) {
|
||||
SDL_Rect dst_rect;
|
||||
lv_area_to_sdl_rect(&dst_area, &dst_rect);
|
||||
|
||||
lv_coord_t dw = lv_area_get_width(&dst_area);
|
||||
lv_coord_t sx = (lv_coord_t)(dst_area.x1 - border_area.x1);
|
||||
if(full) {
|
||||
SDL_Rect src_rect = {sx, frag_size + 1, dw, 1};
|
||||
SDL_RenderCopy(renderer, frag, &src_rect, &dst_rect);
|
||||
}
|
||||
else {
|
||||
SDL_Rect src_rect = {sx, frag_size - 1, dw, 1};
|
||||
SDL_RenderCopy(renderer, frag, &src_rect, &dst_rect);
|
||||
}
|
||||
}
|
||||
/* Right border */
|
||||
border_area.x1 = LV_MAX(coords->x2 - frag_size + 1, coords->x1 + frag_size);
|
||||
border_area.x2 = coords->x2;
|
||||
if(_lv_area_intersect(&dst_area, &border_area, clipped)) {
|
||||
SDL_Rect dst_rect;
|
||||
lv_area_to_sdl_rect(&dst_area, &dst_rect);
|
||||
|
||||
lv_coord_t dw = lv_area_get_width(&dst_area);
|
||||
if(full) {
|
||||
lv_coord_t sx = (lv_coord_t)(dst_area.x1 - border_area.x1);
|
||||
SDL_Rect src_rect = {frag_size + 3 + sx, frag_size + 1, dw, 1};
|
||||
SDL_RenderCopy(renderer, frag, &src_rect, &dst_rect);
|
||||
}
|
||||
else {
|
||||
lv_coord_t sx = (lv_coord_t)(border_area.x2 - dst_area.x2);
|
||||
SDL_Rect src_rect = {sx, frag_size - 1, dw, 1};
|
||||
SDL_RenderCopyEx(renderer, frag, &src_rect, &dst_rect, 0, NULL, SDL_FLIP_HORIZONTAL);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void frag_render_center(SDL_Renderer * renderer, SDL_Texture * frag, lv_coord_t frag_size,
|
||||
const lv_area_t * coords,
|
||||
const lv_area_t * clipped, bool full)
|
||||
{
|
||||
lv_area_t center_area = {
|
||||
coords->x1 + frag_size,
|
||||
coords->y1 + frag_size,
|
||||
coords->x2 - frag_size,
|
||||
coords->y2 - frag_size,
|
||||
};
|
||||
if(center_area.x2 < center_area.x1 || center_area.y2 < center_area.y1) return;
|
||||
lv_area_t draw_area;
|
||||
if(!_lv_area_intersect(&draw_area, ¢er_area, clipped)) {
|
||||
return;
|
||||
}
|
||||
SDL_Rect dst_rect;
|
||||
lv_area_to_sdl_rect(&draw_area, &dst_rect);
|
||||
if(full) {
|
||||
SDL_Rect src_rect = {frag_size, frag_size, 1, 1};
|
||||
SDL_RenderCopy(renderer, frag, &src_rect, &dst_rect);
|
||||
}
|
||||
else {
|
||||
SDL_Rect src_rect = {frag_size - 1, frag_size - 1, 1, 1};
|
||||
SDL_RenderCopy(renderer, frag, &src_rect, &dst_rect);
|
||||
}
|
||||
}
|
||||
|
||||
static lv_draw_rect_bg_key_t rect_bg_key_create(lv_coord_t radius, lv_coord_t size)
|
||||
{
|
||||
lv_draw_rect_bg_key_t key;
|
||||
SDL_memset(&key, 0, sizeof(key));
|
||||
key.magic = LV_GPU_CACHE_KEY_MAGIC_RECT_BG;
|
||||
key.radius = radius;
|
||||
key.size = size;
|
||||
return key;
|
||||
}
|
||||
|
||||
static lv_draw_rect_shadow_key_t rect_shadow_key_create(lv_coord_t radius, lv_coord_t size, lv_coord_t blur)
|
||||
{
|
||||
lv_draw_rect_shadow_key_t key;
|
||||
SDL_memset(&key, 0, sizeof(key));
|
||||
key.magic = LV_GPU_CACHE_KEY_MAGIC_RECT_SHADOW;
|
||||
key.radius = radius;
|
||||
key.size = size;
|
||||
key.blur = blur;
|
||||
return key;
|
||||
}
|
||||
|
||||
static lv_draw_rect_border_key_t rect_border_key_create(lv_coord_t rout, lv_coord_t rin, const lv_area_t * outer_area,
|
||||
const lv_area_t * inner_area)
|
||||
{
|
||||
lv_draw_rect_border_key_t key;
|
||||
/* VERY IMPORTANT! Padding between members is uninitialized, so we have to wipe them manually */
|
||||
SDL_memset(&key, 0, sizeof(key));
|
||||
key.magic = LV_GPU_CACHE_KEY_MAGIC_RECT_BORDER;
|
||||
key.rout = rout;
|
||||
key.rin = rin;
|
||||
key.offsets.x1 = inner_area->x1 - outer_area->x1;
|
||||
key.offsets.x2 = inner_area->x2 - outer_area->x2;
|
||||
key.offsets.y1 = inner_area->y1 - outer_area->y1;
|
||||
key.offsets.y2 = inner_area->y2 - outer_area->y2;
|
||||
return key;
|
||||
}
|
||||
|
||||
#endif /*LV_USE_GPU_SDL*/
|
|
@ -0,0 +1,75 @@
|
|||
/**
|
||||
* @file lv_draw_sdl_rect.h
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef LV_DRAW_SDL_RECT_H
|
||||
#define LV_DRAW_SDL_RECT_H
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*********************
|
||||
* INCLUDES
|
||||
*********************/
|
||||
#include "../../lv_conf_internal.h"
|
||||
|
||||
#if LV_USE_GPU_SDL
|
||||
|
||||
#include LV_GPU_SDL_INCLUDE_PATH
|
||||
|
||||
#include "../lv_draw.h"
|
||||
|
||||
#include "lv_draw_sdl_texture_cache.h"
|
||||
|
||||
/*********************
|
||||
* DEFINES
|
||||
*********************/
|
||||
|
||||
/**********************
|
||||
* TYPEDEFS
|
||||
**********************/
|
||||
|
||||
typedef struct lv_draw_sdl_rect_header_t {
|
||||
lv_img_header_t base;
|
||||
SDL_Rect rect;
|
||||
} lv_draw_sdl_rect_header_t;
|
||||
|
||||
/**********************
|
||||
* GLOBAL PROTOTYPES
|
||||
**********************/
|
||||
|
||||
/*======================
|
||||
* Add/remove functions
|
||||
*=====================*/
|
||||
|
||||
/*=====================
|
||||
* Setter functions
|
||||
*====================*/
|
||||
|
||||
/*=====================
|
||||
* Getter functions
|
||||
*====================*/
|
||||
|
||||
/*=====================
|
||||
* Other functions
|
||||
*====================*/
|
||||
|
||||
SDL_Texture * lv_draw_sdl_rect_bg_frag_obtain(lv_draw_sdl_ctx_t * ctx, lv_coord_t radius);
|
||||
|
||||
void lv_draw_sdl_rect_bg_frag_draw_corners(lv_draw_sdl_ctx_t * ctx, SDL_Texture * frag, lv_coord_t frag_size,
|
||||
const lv_area_t * coords, const lv_area_t * clip, bool full);
|
||||
|
||||
/**********************
|
||||
* MACROS
|
||||
**********************/
|
||||
|
||||
#endif /*LV_USE_GPU_SDL*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /*extern "C"*/
|
||||
#endif
|
||||
|
||||
#endif /*LV_DRAW_SDL_RECT_H*/
|
|
@ -1,13 +1,14 @@
|
|||
/**
|
||||
* @file lv_gpu_sdl_stack_blur.c
|
||||
* @file lv_draw_sdl_stack_blur.c
|
||||
*
|
||||
*/
|
||||
|
||||
/*********************
|
||||
* INCLUDES
|
||||
*********************/
|
||||
#include "lv_gpu_sdl_stack_blur.h"
|
||||
#include "lv_draw_sdl_stack_blur.h"
|
||||
|
||||
#if LV_USE_GPU_SDL
|
||||
/*********************
|
||||
* DEFINES
|
||||
*********************/
|
||||
|
@ -245,3 +246,4 @@ static void stack_blur_job(lv_opa_t * src, unsigned int w, unsigned int h, unsig
|
|||
}
|
||||
}
|
||||
|
||||
#endif /*LV_USE_GPU_SDL*/
|
|
@ -1,9 +1,9 @@
|
|||
/**
|
||||
* @file lv_gpu_sdl_stack_blur.h
|
||||
* @file lv_draw_sdl_stack_blur.h
|
||||
*
|
||||
*/
|
||||
#ifndef LV_GPU_SDL_STACK_BLUR_H
|
||||
#define LV_GPU_SDL_STACK_BLUR_H
|
||||
#ifndef LV_DRAW_SDL_STACK_BLUR_H
|
||||
#define LV_DRAW_SDL_STACK_BLUR_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
|
@ -15,6 +15,8 @@ extern "C" {
|
|||
|
||||
#include "../../lv_conf_internal.h"
|
||||
|
||||
#if LV_USE_GPU_SDL
|
||||
|
||||
#include "../../misc/lv_color.h"
|
||||
|
||||
/*********************
|
||||
|
@ -35,8 +37,10 @@ void lv_stack_blur_grayscale(lv_opa_t * buf, uint16_t w, uint16_t h, uint16_t r)
|
|||
* MACROS
|
||||
**********************/
|
||||
|
||||
#endif /*LV_USE_GPU_SDL*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /*extern "C"*/
|
||||
#endif
|
||||
|
||||
#endif /*LV_GPU_SDL_STACK_BLUR_H*/
|
||||
#endif /*LV_DRAW_SDL_STACK_BLUR_H*/
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue