1
0
mirror of https://github.com/lvgl/lvgl.git synced 2025-01-14 06:42:58 +08:00

experiements with improving styles

This commit is contained in:
Gabor Kiss-Vamosi 2020-12-16 10:22:13 +01:00
parent 6d964609e5
commit 74d19b109c
25 changed files with 2804 additions and 3965 deletions

View File

@ -210,8 +210,8 @@ void lv_scr_load_anim(lv_obj_t * new_scr, lv_scr_load_anim_t anim_type, uint32_t
/*Be sure both screens are in a normal position*/
lv_obj_set_pos(new_scr, 0, 0);
lv_obj_set_pos(lv_scr_act(), 0, 0);
lv_style_remove_prop(_lv_obj_get_local_style(new_scr, LV_OBJ_PART_MAIN), LV_STYLE_OPA_SCALE);
lv_style_remove_prop(_lv_obj_get_local_style(lv_scr_act(), LV_OBJ_PART_MAIN), LV_STYLE_OPA_SCALE);
// lv_style_remove_prop(_lv_obj_get_local_style(new_scr, LV_OBJ_PART_MAIN), LV_STYLE_OPA_SCALE);
// lv_style_remove_prop(_lv_obj_get_local_style(lv_scr_act(), LV_OBJ_PART_MAIN), LV_STYLE_OPA_SCALE);
lv_anim_t a_new;
lv_anim_init(&a_new);
@ -374,7 +374,7 @@ static void scr_load_anim_start(lv_anim_t * a)
static void opa_scale_anim(lv_obj_t * obj, lv_anim_value_t v)
{
lv_obj_set_style_local_opa_scale(obj, LV_OBJ_PART_MAIN, LV_STATE_DEFAULT, v);
// lv_obj_set_style_local_opa_scale(obj, LV_OBJ_PART_MAIN, LV_STATE_DEFAULT, v);
}
@ -384,6 +384,6 @@ static void scr_anim_ready(lv_anim_t * a)
if(d->prev_scr && d->del_prev) lv_obj_del(d->prev_scr);
d->prev_scr = NULL;
lv_style_remove_prop(_lv_obj_get_local_style(a->var, LV_OBJ_PART_MAIN), LV_STYLE_OPA_SCALE);
// lv_style_remove_prop(_lv_obj_get_local_style(a->var, LV_OBJ_PART_MAIN), LV_STYLE_OPA_SCALE);
}
#endif

View File

@ -146,77 +146,77 @@ lv_flex_place_t lv_obj_get_flex_self_place(lv_obj_t * obj)
void _lv_flex_refresh(lv_obj_t * cont)
{
lv_flex_dir_t dir = get_dir(cont);
if(dir == LV_FLEX_DIR_NONE) return;
bool rtl = lv_obj_get_base_dir(cont) == LV_BIDI_DIR_RTL ? true : false;
bool row = dir == LV_FLEX_DIR_ROW ? true : false;
/*Count the grow units and free space*/
lv_coord_t max_main_size = (row ? lv_obj_get_width_fit(cont) : lv_obj_get_height_fit(cont));
lv_coord_t abs_y = cont->coords.y1 + lv_obj_get_style_pad_top(cont, LV_OBJ_PART_MAIN) - lv_obj_get_scroll_y(cont);
lv_coord_t abs_x = cont->coords.x1 + lv_obj_get_style_pad_left(cont, LV_OBJ_PART_MAIN) - lv_obj_get_scroll_x(cont);
lv_flex_place_t cross_place = lv_obj_get_flex_track_place(cont);
lv_flex_place_t main_place = cont->spec_attr->flex_cont.main_place;
lv_coord_t * cross_pos = (row ? &abs_y : &abs_x);
if((row && cont->h_set == LV_SIZE_AUTO) ||
(!row && cont->w_set == LV_SIZE_AUTO))
{
cross_place = LV_FLEX_PLACE_START;
}
if(rtl && !row) {
if(cross_place == LV_FLEX_PLACE_START) cross_place = LV_FLEX_PLACE_END;
else if(cross_place == LV_FLEX_PLACE_END) cross_place = LV_FLEX_PLACE_START;
}
lv_coord_t total_track_cross_size = 0;
lv_coord_t gap = 0;
uint32_t track_cnt = 0;
uint32_t track_first_item;
uint32_t next_track_first_item;
bool rev = get_rev(cont);
if(cross_place != LV_FLEX_PLACE_START) {
track_first_item = rev ? cont->spec_attr->child_cnt - 1 : 0;
track_t t;
while(track_first_item ) {
/*Search the first item of the next row */
next_track_first_item = find_track_end(cont, track_first_item, max_main_size, &t);
total_track_cross_size += t.track_cross_size;
track_cnt++;
track_first_item = next_track_first_item;
}
lv_coord_t max_cross_size = (row ? lv_obj_get_height_fit(cont) : lv_obj_get_width_fit(cont));
place_content(cross_place, max_cross_size, total_track_cross_size, track_cnt, cross_pos, &gap);
}
track_first_item = rev ? cont->spec_attr->child_cnt - 1 : 0;
if(rtl && !row) {
*cross_pos += total_track_cross_size;
}
while(track_first_item) {
track_t t;
/*Search the first item of the next row */
next_track_first_item = find_track_end(cont, track_first_item, max_main_size, &t);
if(rtl && !row) {
*cross_pos -= t.track_cross_size;
}
children_repos(cont, track_first_item, next_track_first_item, abs_x, abs_y, max_main_size, main_place, &t);
track_first_item = next_track_first_item;
if(rtl && !row) {
*cross_pos -= gap;
} else {
*cross_pos += t.track_cross_size + gap;
}
}
LV_ASSERT_MEM_INTEGRITY();
//
// if(dir == LV_FLEX_DIR_NONE) return;
//
// bool rtl = lv_obj_get_base_dir(cont) == LV_BIDI_DIR_RTL ? true : false;
// bool row = dir == LV_FLEX_DIR_ROW ? true : false;
// /*Count the grow units and free space*/
// lv_coord_t max_main_size = (row ? lv_obj_get_width_fit(cont) : lv_obj_get_height_fit(cont));
// lv_coord_t abs_y = cont->coords.y1 + lv_obj_get_style_pad_top(cont, LV_OBJ_PART_MAIN) - lv_obj_get_scroll_y(cont);
// lv_coord_t abs_x = cont->coords.x1 + lv_obj_get_style_pad_left(cont, LV_OBJ_PART_MAIN) - lv_obj_get_scroll_x(cont);
//
// lv_flex_place_t cross_place = lv_obj_get_flex_track_place(cont);
// lv_flex_place_t main_place = cont->spec_attr->flex_cont.main_place;
// lv_coord_t * cross_pos = (row ? &abs_y : &abs_x);
//
// if((row && cont->h_set == LV_SIZE_AUTO) ||
// (!row && cont->w_set == LV_SIZE_AUTO))
// {
// cross_place = LV_FLEX_PLACE_START;
// }
//
// if(rtl && !row) {
// if(cross_place == LV_FLEX_PLACE_START) cross_place = LV_FLEX_PLACE_END;
// else if(cross_place == LV_FLEX_PLACE_END) cross_place = LV_FLEX_PLACE_START;
// }
//
// lv_coord_t total_track_cross_size = 0;
// lv_coord_t gap = 0;
// uint32_t track_cnt = 0;
// uint32_t track_first_item;
// uint32_t next_track_first_item;
// bool rev = get_rev(cont);
//
// if(cross_place != LV_FLEX_PLACE_START) {
// track_first_item = rev ? cont->spec_attr->child_cnt - 1 : 0;
// track_t t;
// while(track_first_item ) {
// /*Search the first item of the next row */
// next_track_first_item = find_track_end(cont, track_first_item, max_main_size, &t);
// total_track_cross_size += t.track_cross_size;
// track_cnt++;
// track_first_item = next_track_first_item;
// }
//
// lv_coord_t max_cross_size = (row ? lv_obj_get_height_fit(cont) : lv_obj_get_width_fit(cont));
// place_content(cross_place, max_cross_size, total_track_cross_size, track_cnt, cross_pos, &gap);
// }
//
// track_first_item = rev ? cont->spec_attr->child_cnt - 1 : 0;
//
// if(rtl && !row) {
// *cross_pos += total_track_cross_size;
// }
//
// while(track_first_item) {
// track_t t;
// /*Search the first item of the next row */
// next_track_first_item = find_track_end(cont, track_first_item, max_main_size, &t);
//
// if(rtl && !row) {
// *cross_pos -= t.track_cross_size;
// }
// children_repos(cont, track_first_item, next_track_first_item, abs_x, abs_y, max_main_size, main_place, &t);
// track_first_item = next_track_first_item;
//
// if(rtl && !row) {
// *cross_pos -= gap;
// } else {
// *cross_pos += t.track_cross_size + gap;
// }
// }
// LV_ASSERT_MEM_INTEGRITY();
}
/**********************
@ -293,91 +293,92 @@ static uint32_t find_track_end(lv_obj_t * cont, uint32_t item_start_id, lv_coord
static void children_repos(lv_obj_t * cont, uint32_t item_first_id, uint32_t item_last_id, lv_coord_t abs_x, lv_coord_t abs_y, lv_coord_t max_main_size, lv_flex_place_t main_place, track_t * t)
{
bool rev = get_rev(cont);
lv_coord_t gap = lv_obj_get_flex_gap(cont);
bool row = get_dir(cont) == LV_FLEX_DIR_ROW ? true : false;
lv_coord_t(*obj_get_main_size)(const lv_obj_t *) = (row ? lv_obj_get_width_margin : lv_obj_get_height_margin);
lv_coord_t(*obj_get_cross_size)(const lv_obj_t *) = (!row ? lv_obj_get_width_margin : lv_obj_get_height_margin);
void (*area_set_main_size)(lv_area_t *, lv_coord_t) = (row ? lv_area_set_width : lv_area_set_height);
void (*area_set_cross_size)(lv_area_t *, lv_coord_t) = (!row ? lv_area_set_width : lv_area_set_height);
lv_coord_t (*area_get_main_size)(const lv_area_t *) = (!row ? lv_area_get_width : lv_area_get_height);
lv_style_int_t (*get_margin_start)(const lv_obj_t *, uint8_t part) = (row ? lv_obj_get_style_margin_left : lv_obj_get_style_margin_top);
lv_style_int_t (*get_margin_end)(const lv_obj_t *, uint8_t part) = (row ? lv_obj_get_style_margin_right : lv_obj_get_style_margin_bottom);
bool rtl = lv_obj_get_base_dir(cont) == LV_BIDI_DIR_RTL ? true : false;
if(row && rtl) abs_x += lv_obj_get_width_fit(cont);
lv_coord_t main_pos = 0;
lv_coord_t place_gap = 0;
place_content(main_place, max_main_size, t->track_main_size, t->item_cnt, &main_pos, &place_gap);
lv_obj_t * item = get_next_item(cont, rev, &item_first_id);
/*Reposition the children*/
while(item && item_first_id != item_last_id) {
/*Ignore non-flex items*/
lv_coord_t main_set = (row ? item->x_set : item->y_set);
if(LV_COORD_IS_FLEX(main_set) == false) {
item = get_next_item(cont, rev, &item_first_id);
continue;
}
lv_coord_t main_size = (row ? item->w_set : item->h_set);
if(_LV_FLEX_GET_GROW(main_size) || LV_COORD_GET_FLEX(main_set) == LV_FLEX_PLACE_STRETCH) {
lv_area_t old_coords;
lv_area_copy(&old_coords, &item->coords);
if(_LV_FLEX_GET_GROW(main_size)) {
lv_coord_t s = _LV_FLEX_GET_GROW(main_size) * t->grow_unit;
s -= get_margin_start(item, LV_OBJ_PART_MAIN) + get_margin_end(item, LV_OBJ_PART_MAIN);
area_set_main_size(&item->coords, s);
}
if(LV_COORD_GET_FLEX(main_set) == LV_FLEX_PLACE_STRETCH) {
area_set_cross_size(&item->coords, t->track_cross_size);
}
if(lv_area_get_height(&old_coords) != area_get_main_size(&item->coords)) {
lv_obj_invalidate(item);
lv_signal_send(item, LV_SIGNAL_COORD_CHG, &old_coords);
lv_obj_invalidate(item);
}
}
lv_coord_t cross_pos = 0;
lv_coord_t cross_set = (row ? item->y_set : item->x_set);
switch(LV_COORD_GET_FLEX(cross_set)) {
case LV_FLEX_PLACE_CENTER:
cross_pos = (t->track_cross_size - obj_get_cross_size(item)) / 2;
break;
case LV_FLEX_PLACE_END:
cross_pos = t->track_cross_size - obj_get_cross_size(item);
break;
}
if(row && rtl) {
main_pos -= obj_get_main_size(item) + gap + place_gap;
}
lv_coord_t diff_x = abs_x - item->coords.x1 + lv_obj_get_style_margin_left(item, LV_OBJ_PART_MAIN);
lv_coord_t diff_y = abs_y - item->coords.y1 + lv_obj_get_style_margin_top(item, LV_OBJ_PART_MAIN);
diff_x += row ? main_pos : cross_pos;
diff_y += row ? cross_pos : main_pos;
if(diff_x || diff_y) {
item->coords.x1 += diff_x;
item->coords.x2 += diff_x;
item->coords.y1 += diff_y;
item->coords.y2 += diff_y;
_lv_obj_move_children_by(item, diff_x, diff_y);
}
if(!(row && rtl)) {
main_pos += obj_get_main_size(item) + gap + place_gap;
}
item = get_next_item(cont, rev, &item_first_id);
}
return;
// bool rev = get_rev(cont);
// lv_coord_t gap = lv_obj_get_flex_gap(cont);
// bool row = get_dir(cont) == LV_FLEX_DIR_ROW ? true : false;
//
// lv_coord_t(*obj_get_main_size)(const lv_obj_t *) = (row ? lv_obj_get_width_margin : lv_obj_get_height_margin);
// lv_coord_t(*obj_get_cross_size)(const lv_obj_t *) = (!row ? lv_obj_get_width_margin : lv_obj_get_height_margin);
// void (*area_set_main_size)(lv_area_t *, lv_coord_t) = (row ? lv_area_set_width : lv_area_set_height);
// void (*area_set_cross_size)(lv_area_t *, lv_coord_t) = (!row ? lv_area_set_width : lv_area_set_height);
// lv_coord_t (*area_get_main_size)(const lv_area_t *) = (!row ? lv_area_get_width : lv_area_get_height);
// lv_coord_t (*get_margin_start)(const lv_obj_t *, uint8_t part) = (row ? lv_obj_get_style_margin_left : lv_obj_get_style_margin_top);
// lv_coord_t (*get_margin_end)(const lv_obj_t *, uint8_t part) = (row ? lv_obj_get_style_margin_right : lv_obj_get_style_margin_bottom);
//
// bool rtl = lv_obj_get_base_dir(cont) == LV_BIDI_DIR_RTL ? true : false;
//
// if(row && rtl) abs_x += lv_obj_get_width_fit(cont);
//
// lv_coord_t main_pos = 0;
//
// lv_coord_t place_gap = 0;
// place_content(main_place, max_main_size, t->track_main_size, t->item_cnt, &main_pos, &place_gap);
//
// lv_obj_t * item = get_next_item(cont, rev, &item_first_id);
// /*Reposition the children*/
// while(item && item_first_id != item_last_id) {
// /*Ignore non-flex items*/
// lv_coord_t main_set = (row ? item->x_set : item->y_set);
// if(LV_COORD_IS_FLEX(main_set) == false) {
// item = get_next_item(cont, rev, &item_first_id);
// continue;
// }
//
// lv_coord_t main_size = (row ? item->w_set : item->h_set);
// if(_LV_FLEX_GET_GROW(main_size) || LV_COORD_GET_FLEX(main_set) == LV_FLEX_PLACE_STRETCH) {
// lv_area_t old_coords;
// lv_area_copy(&old_coords, &item->coords);
//
// if(_LV_FLEX_GET_GROW(main_size)) {
// lv_coord_t s = _LV_FLEX_GET_GROW(main_size) * t->grow_unit;
// s -= get_margin_start(item, LV_OBJ_PART_MAIN) + get_margin_end(item, LV_OBJ_PART_MAIN);
// area_set_main_size(&item->coords, s);
// }
// if(LV_COORD_GET_FLEX(main_set) == LV_FLEX_PLACE_STRETCH) {
// area_set_cross_size(&item->coords, t->track_cross_size);
// }
//
// if(lv_area_get_height(&old_coords) != area_get_main_size(&item->coords)) {
// lv_obj_invalidate(item);
// lv_signal_send(item, LV_SIGNAL_COORD_CHG, &old_coords);
// lv_obj_invalidate(item);
// }
// }
//
// lv_coord_t cross_pos = 0;
// lv_coord_t cross_set = (row ? item->y_set : item->x_set);
// switch(LV_COORD_GET_FLEX(cross_set)) {
// case LV_FLEX_PLACE_CENTER:
// cross_pos = (t->track_cross_size - obj_get_cross_size(item)) / 2;
// break;
// case LV_FLEX_PLACE_END:
// cross_pos = t->track_cross_size - obj_get_cross_size(item);
// break;
// }
//
// if(row && rtl) {
// main_pos -= obj_get_main_size(item) + gap + place_gap;
// }
//
// lv_coord_t diff_x = abs_x - item->coords.x1 + lv_obj_get_style_margin_left(item, LV_OBJ_PART_MAIN);
// lv_coord_t diff_y = abs_y - item->coords.y1 + lv_obj_get_style_margin_top(item, LV_OBJ_PART_MAIN);
// diff_x += row ? main_pos : cross_pos;
// diff_y += row ? cross_pos : main_pos;
//
// if(diff_x || diff_y) {
// item->coords.x1 += diff_x;
// item->coords.x2 += diff_x;
// item->coords.y1 += diff_y;
// item->coords.y2 += diff_y;
// _lv_obj_move_children_by(item, diff_x, diff_y);
// }
//
// if(!(row && rtl)) {
// main_pos += obj_get_main_size(item) + gap + place_gap;
// }
// item = get_next_item(cont, rev, &item_first_id);
// }
}
static void place_content(lv_coord_t place, lv_coord_t max_size, lv_coord_t track_size, lv_coord_t item_cnt, lv_coord_t * start_pos, lv_coord_t * gap)

View File

@ -222,8 +222,8 @@ void _lv_grid_full_refresh(lv_obj_t * cont)
/* Calculate the grids absolute x and y coordinates.
* It will be used as helper during item repositioning to avoid calculating this value for every children*/
lv_coord_t pad_left = lv_obj_get_style_pad_left(cont, LV_OBJ_PART_MAIN);
lv_coord_t pad_top = lv_obj_get_style_pad_top(cont, LV_OBJ_PART_MAIN);
lv_coord_t pad_left = lv_obj_get_style_pad_left(cont, LV_PART_MAIN);
lv_coord_t pad_top = lv_obj_get_style_pad_top(cont, LV_PART_MAIN);
hint.grid_abs.x = pad_left + cont->coords.x1 - lv_obj_get_scroll_x(cont);
hint.grid_abs.y = pad_top + cont->coords.y1 - lv_obj_get_scroll_y(cont);
@ -351,93 +351,93 @@ static void calc_rows(lv_obj_t * cont, _lv_grid_calc_t * calc)
*/
static void item_repos(lv_obj_t * item, _lv_grid_calc_t * calc, item_repos_hint_t * hint)
{
if(_lv_obj_is_grid_item(item) == false) return;
uint32_t col_pos = LV_GRID_GET_CELL_POS(item->x_set);
uint32_t col_span = LV_GRID_GET_CELL_SPAN(item->x_set);
uint32_t row_pos = LV_GRID_GET_CELL_POS(item->y_set);
uint32_t row_span = LV_GRID_GET_CELL_SPAN(item->y_set);
lv_coord_t col_x1 = calc->x[col_pos];
lv_coord_t col_x2 = calc->x[col_pos + col_span - 1] + calc->w[col_pos + col_span - 1];
lv_coord_t col_w = col_x2 - col_x1;
lv_coord_t row_y1 = calc->y[row_pos];
lv_coord_t row_y2 = calc->y[row_pos + row_span - 1] + calc->h[row_pos + row_span - 1];
lv_coord_t row_h = row_y2 - row_y1;
uint8_t x_flag = LV_GRID_GET_CELL_PLACE(item->x_set);
uint8_t y_flag = LV_GRID_GET_CELL_PLACE(item->y_set);
/*If the item has RTL base dir switch start and end*/
if(lv_obj_get_base_dir(item) == LV_BIDI_DIR_RTL) {
if(x_flag == LV_GRID_START) x_flag = LV_GRID_END;
else if(x_flag == LV_GRID_END) x_flag = LV_GRID_START;
}
lv_coord_t x;
lv_coord_t y;
lv_coord_t item_w = lv_obj_get_width(item);
lv_coord_t item_h = lv_obj_get_height(item);
lv_coord_t margin_top = lv_obj_get_style_margin_top(item, LV_OBJ_PART_MAIN);
lv_coord_t margin_bottom = lv_obj_get_style_margin_bottom(item, LV_OBJ_PART_MAIN);
lv_coord_t margin_left = lv_obj_get_style_margin_left(item, LV_OBJ_PART_MAIN);
lv_coord_t margin_right = lv_obj_get_style_margin_right(item, LV_OBJ_PART_MAIN);
switch(x_flag) {
default:
case LV_GRID_START:
x = calc->x[col_pos] + margin_left;
break;
case LV_GRID_STRETCH:
x = calc->x[col_pos] + margin_left;
item_w = col_w - margin_left - margin_right;
item->w_set = LV_SIZE_STRETCH;
break;
case LV_GRID_CENTER:
x = calc->x[col_pos] + (col_w - (item_w + margin_left - margin_right)) / 2;
break;
case LV_GRID_END:
x = calc->x[col_pos] + col_w - lv_obj_get_width(item) - margin_right;
break;
}
switch(y_flag) {
default:
case LV_GRID_START:
y = calc->y[row_pos] + margin_top;
break;
case LV_GRID_STRETCH:
y = calc->y[row_pos] + margin_top;
item_h = row_h - margin_top - margin_bottom;
item->h_set = LV_SIZE_STRETCH;
break;
case LV_GRID_CENTER:
y = calc->y[row_pos] + (row_h - (item_h + margin_top + margin_bottom)) / 2;
break;
case LV_GRID_END:
y = calc->y[row_pos] + row_h - lv_obj_get_height(item) - margin_bottom;
break;
}
/*Set a new size if required*/
if(lv_obj_get_width(item) != item_w || lv_obj_get_height(item) != item_h) {
lv_area_t old_coords;
lv_area_copy(&old_coords, &item->coords);
lv_obj_invalidate(item);
lv_area_set_width(&item->coords, item_w);
lv_area_set_height(&item->coords, item_h);
lv_obj_invalidate(item);
lv_signal_send(item, LV_SIGNAL_COORD_CHG, &old_coords);
}
bool moved = true;
if(hint) {
if(hint->grid_abs.x + x == item->coords.x1 && hint->grid_abs.y + y == item->coords.y1) moved = false;
}
if(moved) _lv_obj_move_to(item, x, y, false);
// if(_lv_obj_is_grid_item(item) == false) return;
//
// uint32_t col_pos = LV_GRID_GET_CELL_POS(item->x_set);
// uint32_t col_span = LV_GRID_GET_CELL_SPAN(item->x_set);
// uint32_t row_pos = LV_GRID_GET_CELL_POS(item->y_set);
// uint32_t row_span = LV_GRID_GET_CELL_SPAN(item->y_set);
//
// lv_coord_t col_x1 = calc->x[col_pos];
// lv_coord_t col_x2 = calc->x[col_pos + col_span - 1] + calc->w[col_pos + col_span - 1];
// lv_coord_t col_w = col_x2 - col_x1;
//
// lv_coord_t row_y1 = calc->y[row_pos];
// lv_coord_t row_y2 = calc->y[row_pos + row_span - 1] + calc->h[row_pos + row_span - 1];
// lv_coord_t row_h = row_y2 - row_y1;
//
// uint8_t x_flag = LV_GRID_GET_CELL_PLACE(item->x_set);
// uint8_t y_flag = LV_GRID_GET_CELL_PLACE(item->y_set);
//
// /*If the item has RTL base dir switch start and end*/
// if(lv_obj_get_base_dir(item) == LV_BIDI_DIR_RTL) {
// if(x_flag == LV_GRID_START) x_flag = LV_GRID_END;
// else if(x_flag == LV_GRID_END) x_flag = LV_GRID_START;
// }
//
// lv_coord_t x;
// lv_coord_t y;
// lv_coord_t item_w = lv_obj_get_width(item);
// lv_coord_t item_h = lv_obj_get_height(item);
//
// lv_coord_t margin_top = lv_obj_get_style_margin_top(item, LV_OBJ_PART_MAIN);
// lv_coord_t margin_bottom = lv_obj_get_style_margin_bottom(item, LV_OBJ_PART_MAIN);
// lv_coord_t margin_left = lv_obj_get_style_margin_left(item, LV_OBJ_PART_MAIN);
// lv_coord_t margin_right = lv_obj_get_style_margin_right(item, LV_OBJ_PART_MAIN);
//
// switch(x_flag) {
// default:
// case LV_GRID_START:
// x = calc->x[col_pos] + margin_left;
// break;
// case LV_GRID_STRETCH:
// x = calc->x[col_pos] + margin_left;
// item_w = col_w - margin_left - margin_right;
// item->w_set = LV_SIZE_STRETCH;
// break;
// case LV_GRID_CENTER:
// x = calc->x[col_pos] + (col_w - (item_w + margin_left - margin_right)) / 2;
// break;
// case LV_GRID_END:
// x = calc->x[col_pos] + col_w - lv_obj_get_width(item) - margin_right;
// break;
// }
//
// switch(y_flag) {
// default:
// case LV_GRID_START:
// y = calc->y[row_pos] + margin_top;
// break;
// case LV_GRID_STRETCH:
// y = calc->y[row_pos] + margin_top;
// item_h = row_h - margin_top - margin_bottom;
// item->h_set = LV_SIZE_STRETCH;
// break;
// case LV_GRID_CENTER:
// y = calc->y[row_pos] + (row_h - (item_h + margin_top + margin_bottom)) / 2;
// break;
// case LV_GRID_END:
// y = calc->y[row_pos] + row_h - lv_obj_get_height(item) - margin_bottom;
// break;
// }
//
// /*Set a new size if required*/
// if(lv_obj_get_width(item) != item_w || lv_obj_get_height(item) != item_h) {
// lv_area_t old_coords;
// lv_area_copy(&old_coords, &item->coords);
// lv_obj_invalidate(item);
// lv_area_set_width(&item->coords, item_w);
// lv_area_set_height(&item->coords, item_h);
// lv_obj_invalidate(item);
// lv_signal_send(item, LV_SIGNAL_COORD_CHG, &old_coords);
//
// }
// bool moved = true;
// if(hint) {
// if(hint->grid_abs.x + x == item->coords.x1 && hint->grid_abs.y + y == item->coords.y1) moved = false;
// }
//
// if(moved) _lv_obj_move_to(item, x, y, false);
}
/**

View File

@ -202,7 +202,7 @@ lv_obj_t * lv_obj_create(lv_obj_t * parent, const lv_obj_t * copy)
else lv_theme_apply(obj, LV_THEME_SCR);
}
else {
lv_style_list_copy(&obj->style_list, &copy->style_list);
// lv_style_list_copy(&obj->style_list, &copy->style_list);
}
return obj;
}
@ -627,14 +627,10 @@ void lv_obj_set_state(lv_obj_t * obj, lv_state_t new_state)
uint8_t part;
for(part = 0; part < _LV_OBJ_PART_MAX; part++) {
lv_style_list_t * style_list = _lv_obj_get_style_list(obj, part);
if(style_list == NULL) break; /*No more style lists*/
if(style_list->ignore_trans) continue;
lv_style_int_t time = lv_obj_get_style_transition_time(obj, part);
lv_style_property_t props[LV_STYLE_TRANS_NUM_MAX];
lv_style_int_t delay = lv_obj_get_style_transition_delay(obj, part);
lv_anim_path_t * path = lv_obj_get_style_transition_path(obj, part);
uint16_t time = lv_obj_get_style_transition_time(obj, part);
lv_style_prop_t props[LV_STYLE_TRANS_NUM_MAX];
uint16_t delay = lv_obj_get_style_transition_delay(obj, part);
const lv_anim_path_t * path = lv_obj_get_style_transition_path(obj, part);
props[0] = lv_obj_get_style_transition_prop_1(obj, part);
props[1] = lv_obj_get_style_transition_prop_2(obj, part);
props[2] = lv_obj_get_style_transition_prop_3(obj, part);
@ -644,26 +640,14 @@ void lv_obj_set_state(lv_obj_t * obj, lv_state_t new_state)
uint8_t i;
for(i = 0; i < LV_STYLE_TRANS_NUM_MAX; i++) {
if(props[i] != 0) {
_lv_style_list_add_trans_style(style_list);
if(props[i] != _LV_STYLE_PROP_INV) {
_lv_obj_create_style_transition(obj, props[i], part, prev_state, new_state, time, delay, path);
}
}
if(cmp_res == _LV_STYLE_STATE_CMP_VISUAL_DIFF) {
#if LV_STYLE_CACHE_LEVEL > 0
_lv_obj_invalidate_style_cache(obj, part, LV_STYLE_PROP_ALL);
#endif
}
}
if(cmp_res == _LV_STYLE_STATE_CMP_DIFF) _lv_obj_refresh_style(obj, LV_OBJ_PART_ALL, LV_STYLE_PROP_ALL);
if(cmp_res == _LV_STYLE_STATE_CMP_DIFF) _lv_obj_refresh_style(obj, LV_STYLE_PROP_ALL);
else if(cmp_res == _LV_STYLE_STATE_CMP_VISUAL_DIFF) lv_obj_invalidate(obj);
#endif
}
@ -1434,8 +1418,6 @@ static void lv_obj_constructor(lv_obj_t * obj, lv_obj_t * parent, const lv_obj_t
if(parent) obj->flags |= LV_OBJ_FLAG_GESTURE_BUBBLE;
obj->state = LV_STATE_DEFAULT;
lv_style_list_init(&obj->style_list);
/*Copy the attributes if required*/
if(copy != NULL) {
lv_area_copy(&obj->coords, &copy->coords);
@ -1479,7 +1461,7 @@ static void lv_obj_constructor(lv_obj_t * obj, lv_obj_t * parent, const lv_obj_t
static void lv_obj_destructor(void * p)
{
lv_obj_t * obj = p;
_lv_obj_reset_style_list_no_refr(obj, LV_OBJ_PART_MAIN);
lv_obj_remove_all_styles(obj);
if(obj->spec_attr) lv_mem_free(obj->spec_attr);
lv_class_destroy(obj);
@ -1497,12 +1479,12 @@ static void lv_obj_destructor(void * p)
static lv_design_res_t lv_obj_design(lv_obj_t * obj, const lv_area_t * clip_area, lv_design_mode_t mode)
{
if(mode == LV_DESIGN_COVER_CHK) {
if(lv_obj_get_style_clip_corner(obj, LV_OBJ_PART_MAIN)) return LV_DESIGN_RES_MASKED;
if(lv_obj_get_style_clip_corner(obj, LV_PART_MAIN)) return LV_DESIGN_RES_MASKED;
/*Most trivial test. Is the mask fully IN the object? If no it surely doesn't cover it*/
lv_coord_t r = lv_obj_get_style_radius(obj, LV_OBJ_PART_MAIN);
lv_coord_t w = lv_obj_get_style_transform_width(obj, LV_OBJ_PART_MAIN);
lv_coord_t h = lv_obj_get_style_transform_height(obj, LV_OBJ_PART_MAIN);
lv_coord_t r = lv_obj_get_style_radius(obj, LV_PART_MAIN);
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;
lv_area_copy(&coords, &obj->coords);
coords.x1 -= w;
@ -1512,11 +1494,11 @@ static lv_design_res_t lv_obj_design(lv_obj_t * obj, const lv_area_t * clip_area
if(_lv_area_is_in(clip_area, &coords, r) == false) return LV_DESIGN_RES_NOT_COVER;
if(lv_obj_get_style_bg_opa(obj, LV_OBJ_PART_MAIN) < LV_OPA_MAX) return LV_DESIGN_RES_NOT_COVER;
if(lv_obj_get_style_bg_opa(obj, LV_PART_MAIN) < LV_OPA_MAX) return LV_DESIGN_RES_NOT_COVER;
if(lv_obj_get_style_bg_blend_mode(obj, LV_OBJ_PART_MAIN) != LV_BLEND_MODE_NORMAL) return LV_DESIGN_RES_NOT_COVER;
if(lv_obj_get_style_border_blend_mode(obj, LV_OBJ_PART_MAIN) != LV_BLEND_MODE_NORMAL) return LV_DESIGN_RES_NOT_COVER;
if(lv_obj_get_style_opa_scale(obj, LV_OBJ_PART_MAIN) < LV_OPA_MAX) return LV_DESIGN_RES_NOT_COVER;
if(lv_obj_get_style_bg_blend_mode(obj, LV_PART_MAIN) != LV_BLEND_MODE_NORMAL) return LV_DESIGN_RES_NOT_COVER;
if(lv_obj_get_style_border_blend_mode(obj, LV_PART_MAIN) != LV_BLEND_MODE_NORMAL) return LV_DESIGN_RES_NOT_COVER;
if(lv_obj_get_style_opa(obj, LV_PART_MAIN) < LV_OPA_MAX) return LV_DESIGN_RES_NOT_COVER;
return LV_DESIGN_RES_COVER;
@ -1525,14 +1507,14 @@ static lv_design_res_t lv_obj_design(lv_obj_t * obj, const lv_area_t * clip_area
lv_draw_rect_dsc_t draw_dsc;
lv_draw_rect_dsc_init(&draw_dsc);
/*If the border is drawn later disable loading its properties*/
if(lv_obj_get_style_border_post(obj, LV_OBJ_PART_MAIN)) {
if(lv_obj_get_style_border_post(obj, LV_PART_MAIN)) {
draw_dsc.border_post = 1;
}
lv_obj_init_draw_rect_dsc(obj, LV_OBJ_PART_MAIN, &draw_dsc);
lv_obj_init_draw_rect_dsc(obj, LV_PART_MAIN, &draw_dsc);
lv_coord_t w = lv_obj_get_style_transform_width(obj, LV_OBJ_PART_MAIN);
lv_coord_t h = lv_obj_get_style_transform_height(obj, LV_OBJ_PART_MAIN);
lv_coord_t w = 0;//lv_obj_get_style_transform_width(obj, LV_OBJ_PART_MAIN);
lv_coord_t h = 0;//lv_obj_get_style_transform_height(obj, LV_OBJ_PART_MAIN);
lv_area_t coords;
lv_area_copy(&coords, &obj->coords);
coords.x1 -= w;
@ -1542,10 +1524,10 @@ static lv_design_res_t lv_obj_design(lv_obj_t * obj, const lv_area_t * clip_area
lv_draw_rect(&coords, clip_area, &draw_dsc);
if(lv_obj_get_style_clip_corner(obj, LV_OBJ_PART_MAIN)) {
if(lv_obj_get_style_clip_corner(obj, LV_PART_MAIN)) {
lv_draw_mask_radius_param_t * mp = _lv_mem_buf_get(sizeof(lv_draw_mask_radius_param_t));
lv_coord_t r = lv_obj_get_style_radius(obj, LV_OBJ_PART_MAIN);
lv_coord_t r = lv_obj_get_style_radius(obj, LV_PART_MAIN);
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*/
@ -1555,23 +1537,23 @@ static lv_design_res_t lv_obj_design(lv_obj_t * obj, const lv_area_t * clip_area
else if(mode == LV_DESIGN_DRAW_POST) {
_lv_obj_draw_scrollbar(obj, clip_area);
if(lv_obj_get_style_clip_corner(obj, LV_OBJ_PART_MAIN)) {
if(lv_obj_get_style_clip_corner(obj, LV_PART_MAIN)) {
lv_draw_mask_radius_param_t * param = lv_draw_mask_remove_custom(obj + 8);
_lv_mem_buf_release(param);
}
/*If the border is drawn later disable loading other properties*/
if(lv_obj_get_style_border_post(obj, LV_OBJ_PART_MAIN)) {
if(lv_obj_get_style_border_post(obj, LV_PART_MAIN)) {
lv_draw_rect_dsc_t draw_dsc;
lv_draw_rect_dsc_init(&draw_dsc);
draw_dsc.bg_opa = LV_OPA_TRANSP;
draw_dsc.pattern_opa = LV_OPA_TRANSP;
// draw_dsc.pattern_opa = LV_OPA_TRANSP;
draw_dsc.shadow_opa = LV_OPA_TRANSP;
draw_dsc.value_opa = LV_OPA_TRANSP;
lv_obj_init_draw_rect_dsc(obj, LV_OBJ_PART_MAIN, &draw_dsc);
lv_obj_init_draw_rect_dsc(obj, LV_PART_MAIN, &draw_dsc);
lv_coord_t w = lv_obj_get_style_transform_width(obj, LV_OBJ_PART_MAIN);
lv_coord_t h = lv_obj_get_style_transform_height(obj, LV_OBJ_PART_MAIN);
lv_coord_t w = 0;//lv_obj_get_style_transform_width(obj, LV_OBJ_PART_MAIN);
lv_coord_t h = 0;//lv_obj_get_style_transform_height(obj, LV_OBJ_PART_MAIN);
lv_area_t coords;
lv_area_copy(&coords, &obj->coords);
coords.x1 -= w;
@ -1651,13 +1633,7 @@ static lv_res_t lv_obj_signal(lv_obj_t * obj, lv_signal_t sign, void * param)
{
lv_res_t res = LV_RES_OK;
if(sign == LV_SIGNAL_GET_STYLE) {
lv_get_style_info_t * info = param;
if(info->part == LV_OBJ_PART_MAIN) info->result = &obj->style_list;
else info->result = NULL;
return LV_RES_OK;
}
else if(sign == LV_SIGNAL_PRESSED) {
if(sign == LV_SIGNAL_PRESSED) {
lv_obj_add_state(obj, LV_STATE_PRESSED);
}
else if(sign == LV_SIGNAL_RELEASED) {
@ -1779,7 +1755,7 @@ static lv_res_t lv_obj_signal(lv_obj_t * obj, lv_signal_t sign, void * param)
}
else if(sign == LV_SIGNAL_REFR_EXT_DRAW_PAD) {
lv_coord_t * s = param;
lv_coord_t d = _lv_obj_get_draw_rect_ext_pad_size(obj, LV_OBJ_PART_MAIN);
lv_coord_t d = _lv_obj_get_draw_rect_ext_pad_size(obj, LV_PART_MAIN);
*s = LV_MATH_MAX(*s, d);
}
else if(sign == LV_SIGNAL_STYLE_CHG) {

View File

@ -45,7 +45,7 @@ extern "C" {
#endif
#define LV_MAX_ANCESTOR_NUM 8
#define _LV_OBJ_PART_MAX 128
#define _LV_OBJ_PART_MAX 32
#define LV_EXT_CLICK_AREA_OFF 0
#define LV_EXT_CLICK_AREA_TINY 1
@ -126,7 +126,6 @@ enum {
LV_SIGNAL_STYLE_CHG, /**< Object's style has changed */
LV_SIGNAL_BASE_DIR_CHG, /**< The base dir has changed*/
LV_SIGNAL_REFR_EXT_DRAW_PAD, /**< Object's extra padding has changed */
LV_SIGNAL_GET_STYLE, /**< Get the style of an object*/
LV_SIGNAL_GET_SELF_SIZE, /**< Get the internal size of a widget*/
/*Input device related*/
@ -230,7 +229,7 @@ LV_CLASS_DECLARE_START(lv_obj, lv_base)
_lv_base_data \
struct _lv_obj_t * parent; \
lv_obj_spec_attr_t * spec_attr; \
lv_style_list_t style_list; \
lv_obj_style_list_t style_list; \
lv_area_t coords; \
lv_coord_t x_set; \
lv_coord_t y_set; \
@ -248,12 +247,15 @@ LV_CLASS_DECLARE_END(lv_obj, lv_base)
extern lv_obj_class_t lv_obj;
enum {
LV_OBJ_PART_MAIN,
LV_OBJ_PART_ALL = 0xFF,
LV_PART_MAIN,
LV_PART_SCROLLBAR,
LV_PART_CONTENT,
LV_PART_INDICATOR,
LV_PART_KNOB,
LV_PART_PLACEHOLDER,
LV_PART_HIGHLIGHT,
};
typedef uint8_t lv_obj_part_t;
/** Used by `lv_obj_get_type()`. The object's and its ancestor types are stored here*/
typedef struct {
const char * type[LV_MAX_ANCESTOR_NUM]; /**< [0]: the actual type, [1]: ancestor, [2] #1's ancestor
@ -265,11 +267,6 @@ typedef struct {
bool result;
} lv_hit_test_info_t;
typedef struct {
uint8_t part;
lv_style_list_t * result;
} lv_get_style_info_t;
/**********************
* GLOBAL PROTOTYPES
**********************/

View File

@ -54,12 +54,12 @@ void lv_obj_init_draw_rect_dsc(lv_obj_t * obj, uint8_t part, lv_draw_rect_dsc_t
draw_dsc->radius = lv_obj_get_style_radius(obj, part);
#if LV_USE_OPA_SCALE
lv_opa_t opa_scale = lv_obj_get_style_opa_scale(obj, part);
if(opa_scale <= LV_OPA_MIN) {
lv_opa_t opa = lv_obj_get_style_opa(obj, part);
if(opa <= LV_OPA_MIN) {
draw_dsc->bg_opa = LV_OPA_TRANSP;
draw_dsc->border_opa = LV_OPA_TRANSP;
draw_dsc->shadow_opa = LV_OPA_TRANSP;
draw_dsc->pattern_opa = LV_OPA_TRANSP;
draw_dsc->bg_img_opa = LV_OPA_TRANSP;
draw_dsc->value_opa = LV_OPA_TRANSP;
return;
}
@ -113,26 +113,26 @@ void lv_obj_init_draw_rect_dsc(lv_obj_t * obj, uint8_t part, lv_draw_rect_dsc_t
#endif
#if LV_USE_PATTERN
draw_dsc->pattern_image = lv_obj_get_style_pattern_image(obj, part);
if(draw_dsc->pattern_image) {
if(draw_dsc->pattern_opa != LV_OPA_TRANSP) {
draw_dsc->pattern_opa = lv_obj_get_style_pattern_opa(obj, part);
if(draw_dsc->pattern_opa > LV_OPA_MIN) {
draw_dsc->pattern_recolor_opa = lv_obj_get_style_pattern_recolor_opa(obj, part);
draw_dsc->pattern_repeat = lv_obj_get_style_pattern_repeat(obj, part);
if(lv_img_src_get_type(draw_dsc->pattern_image) == LV_IMG_SRC_SYMBOL) {
draw_dsc->pattern_recolor = lv_obj_get_style_pattern_recolor(obj, part);
draw_dsc->pattern_font = lv_obj_get_style_text_font(obj, part);
}
else if(draw_dsc->pattern_recolor_opa > LV_OPA_MIN) {
draw_dsc->pattern_recolor = lv_obj_get_style_pattern_recolor(obj, part);
}
#if LV_USE_BLEND_MODES
draw_dsc->pattern_blend_mode = lv_obj_get_style_pattern_blend_mode(obj, part);
#endif
}
}
}
// if(draw_dsc->bg_img_opa != LV_OPA_TRANSP) {
// draw_dsc->bg_img_src = lv_obj_get_style_pattern_image(obj, part);
// if(draw_dsc->bg_img_src) {
// draw_dsc->bg_img_opa = lv_obj_get_style_pattern_opa(obj, part);
// if(draw_dsc->bg_img_opa > LV_OPA_MIN) {
//// draw_dsc->pattern_recolor_opa = lv_obj_get_style_pattern_recolor_opa(obj, part);
//// draw_dsc->bg_img_mosaic = lv_obj_get_style_pattern_repeat(obj, part);
// if(lv_img_src_get_type(draw_dsc->bg_img_src) == LV_IMG_SRC_SYMBOL) {
//// draw_dsc->pattern_recolor = lv_obj_get_style_pattern_recolor(obj, part);
// draw_dsc->pattern_font = lv_obj_get_style_text_font(obj, part);
// }
// else if(draw_dsc->pattern_recolor_opa > LV_OPA_MIN) {
// draw_dsc->pattern_recolor = lv_obj_get_style_pattern_recolor(obj, part);
// }
//#if LV_USE_BLEND_MODES
// draw_dsc->pattern_blend_mode = lv_obj_get_style_pattern_blend_mode(obj, part);
//#endif
// }
// }
// }
#endif
#if LV_USE_SHADOW
@ -153,34 +153,12 @@ void lv_obj_init_draw_rect_dsc(lv_obj_t * obj, uint8_t part, lv_draw_rect_dsc_t
}
#endif
#if LV_USE_VALUE_STR
draw_dsc->value_str = lv_obj_get_style_value_str(obj, part);
if(draw_dsc->value_str) {
if(draw_dsc->value_opa > LV_OPA_MIN) {
draw_dsc->value_opa = lv_obj_get_style_value_opa(obj, part);
if(draw_dsc->value_opa > LV_OPA_MIN) {
draw_dsc->value_ofs_x = lv_obj_get_style_value_ofs_x(obj, part);
draw_dsc->value_ofs_y = lv_obj_get_style_value_ofs_y(obj, part);
draw_dsc->value_color = lv_obj_get_style_value_color(obj, part);
draw_dsc->value_font = lv_obj_get_style_value_font(obj, part);
draw_dsc->value_letter_space = lv_obj_get_style_value_letter_space(obj, part);
draw_dsc->value_line_space = lv_obj_get_style_value_line_space(obj, part);
draw_dsc->value_align = lv_obj_get_style_value_align(obj, part);
#if LV_USE_BLEND_MODES
draw_dsc->value_blend_mode = lv_obj_get_style_value_blend_mode(obj, part);
#endif
}
}
}
#endif
#if LV_USE_OPA_SCALE
if(opa_scale < LV_OPA_MAX) {
draw_dsc->bg_opa = (uint16_t)((uint16_t)draw_dsc->bg_opa * opa_scale) >> 8;
draw_dsc->border_opa = (uint16_t)((uint16_t)draw_dsc->border_opa * opa_scale) >> 8;
draw_dsc->shadow_opa = (uint16_t)((uint16_t)draw_dsc->shadow_opa * opa_scale) >> 8;
draw_dsc->pattern_opa = (uint16_t)((uint16_t)draw_dsc->pattern_opa * opa_scale) >> 8;
draw_dsc->value_opa = (uint16_t)((uint16_t)draw_dsc->value_opa * opa_scale) >> 8;
if(opa < LV_OPA_MAX) {
draw_dsc->bg_opa = (uint16_t)((uint16_t)draw_dsc->bg_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->value_opa = (uint16_t)((uint16_t)draw_dsc->value_opa * opa) >> 8;
}
#endif
}
@ -195,34 +173,34 @@ void lv_obj_init_draw_rect_dsc(lv_obj_t * obj, uint8_t part, lv_draw_rect_dsc_t
*/
void lv_obj_init_draw_label_dsc(lv_obj_t * obj, uint8_t part, lv_draw_label_dsc_t * draw_dsc)
{
draw_dsc->opa = lv_obj_get_style_text_opa(obj, part);
if(draw_dsc->opa <= LV_OPA_MIN) return;
#if LV_USE_OPA_SCALE
lv_opa_t opa_scale = lv_obj_get_style_opa_scale(obj, part);
if(opa_scale < LV_OPA_MAX) {
draw_dsc->opa = (uint16_t)((uint16_t)draw_dsc->opa * opa_scale) >> 8;
}
if(draw_dsc->opa <= LV_OPA_MIN) return;
#endif
draw_dsc->color = lv_obj_get_style_text_color(obj, part);
draw_dsc->letter_space = lv_obj_get_style_text_letter_space(obj, part);
draw_dsc->line_space = lv_obj_get_style_text_line_space(obj, part);
draw_dsc->decor = lv_obj_get_style_text_decor(obj, part);
#if LV_USE_BLEND_MODES
draw_dsc->blend_mode = lv_obj_get_style_text_blend_mode(obj, part);
#endif
draw_dsc->font = lv_obj_get_style_text_font(obj, part);
if(draw_dsc->sel_start != LV_DRAW_LABEL_NO_TXT_SEL && draw_dsc->sel_end != LV_DRAW_LABEL_NO_TXT_SEL) {
draw_dsc->color = lv_obj_get_style_text_sel_color(obj, part);
}
#if LV_USE_BIDI
draw_dsc->bidi_dir = lv_obj_get_base_dir(obj);
#endif
// draw_dsc->opa = lv_obj_get_style_text_opa(obj, part);
// if(draw_dsc->opa <= LV_OPA_MIN) return;
//
//#if LV_USE_OPA_SCALE
// lv_opa_t opa_scale = lv_obj_get_style_opa_scale(obj, part);
// if(opa_scale < LV_OPA_MAX) {
// draw_dsc->opa = (uint16_t)((uint16_t)draw_dsc->opa * opa_scale) >> 8;
// }
// if(draw_dsc->opa <= LV_OPA_MIN) return;
//#endif
//
// draw_dsc->color = lv_obj_get_style_text_color(obj, part);
// draw_dsc->letter_space = lv_obj_get_style_text_letter_space(obj, part);
// draw_dsc->line_space = lv_obj_get_style_text_line_space(obj, part);
// draw_dsc->decor = lv_obj_get_style_text_decor(obj, part);
//#if LV_USE_BLEND_MODES
// draw_dsc->blend_mode = lv_obj_get_style_text_blend_mode(obj, part);
//#endif
//
// draw_dsc->font = lv_obj_get_style_text_font(obj, part);
//
// if(draw_dsc->sel_start != LV_DRAW_LABEL_NO_TXT_SEL && draw_dsc->sel_end != LV_DRAW_LABEL_NO_TXT_SEL) {
// draw_dsc->color = lv_obj_get_style_text_sel_color(obj, part);
// }
//
//#if LV_USE_BIDI
// draw_dsc->bidi_dir = lv_obj_get_base_dir(obj);
//#endif
}
/**
@ -235,29 +213,29 @@ void lv_obj_init_draw_label_dsc(lv_obj_t * obj, uint8_t part, lv_draw_label_dsc_
*/
void lv_obj_init_draw_img_dsc(lv_obj_t * obj, uint8_t part, lv_draw_img_dsc_t * draw_dsc)
{
draw_dsc->opa = lv_obj_get_style_image_opa(obj, part);
if(draw_dsc->opa <= LV_OPA_MIN) return;
#if LV_USE_OPA_SCALE
lv_opa_t opa_scale = lv_obj_get_style_opa_scale(obj, part);
if(opa_scale < LV_OPA_MAX) {
draw_dsc->opa = (uint16_t)((uint16_t)draw_dsc->opa * opa_scale) >> 8;
}
if(draw_dsc->opa <= LV_OPA_MIN) return;
#endif
draw_dsc->angle = 0;
draw_dsc->zoom = LV_IMG_ZOOM_NONE;
draw_dsc->pivot.x = lv_area_get_width(&obj->coords) / 2;
draw_dsc->pivot.y = lv_area_get_height(&obj->coords) / 2;
draw_dsc->recolor_opa = lv_obj_get_style_image_recolor_opa(obj, part);
if(draw_dsc->recolor_opa > 0) {
draw_dsc->recolor = lv_obj_get_style_image_recolor(obj, part);
}
#if LV_USE_BLEND_MODES
draw_dsc->blend_mode = lv_obj_get_style_image_blend_mode(obj, part);
#endif
// draw_dsc->opa = lv_obj_get_style_image_opa(obj, part);
// if(draw_dsc->opa <= LV_OPA_MIN) return;
//
//#if LV_USE_OPA_SCALE
// lv_opa_t opa_scale = lv_obj_get_style_opa_scale(obj, part);
// if(opa_scale < LV_OPA_MAX) {
// draw_dsc->opa = (uint16_t)((uint16_t)draw_dsc->opa * opa_scale) >> 8;
// }
// if(draw_dsc->opa <= LV_OPA_MIN) return;
//#endif
//
// draw_dsc->angle = 0;
// draw_dsc->zoom = LV_IMG_ZOOM_NONE;
// draw_dsc->pivot.x = lv_area_get_width(&obj->coords) / 2;
// draw_dsc->pivot.y = lv_area_get_height(&obj->coords) / 2;
//
// draw_dsc->recolor_opa = lv_obj_get_style_image_recolor_opa(obj, part);
// if(draw_dsc->recolor_opa > 0) {
// draw_dsc->recolor = lv_obj_get_style_image_recolor(obj, part);
// }
//#if LV_USE_BLEND_MODES
// draw_dsc->blend_mode = lv_obj_get_style_image_blend_mode(obj, part);
//#endif
}
@ -271,33 +249,33 @@ void lv_obj_init_draw_img_dsc(lv_obj_t * obj, uint8_t part, lv_draw_img_dsc_t *
*/
void lv_obj_init_draw_line_dsc(lv_obj_t * obj, uint8_t part, lv_draw_line_dsc_t * draw_dsc)
{
draw_dsc->width = lv_obj_get_style_line_width(obj, part);
if(draw_dsc->width == 0) return;
draw_dsc->opa = lv_obj_get_style_line_opa(obj, part);
if(draw_dsc->opa <= LV_OPA_MIN) return;
#if LV_USE_OPA_SCALE
lv_opa_t opa_scale = lv_obj_get_style_opa_scale(obj, part);
if(opa_scale < LV_OPA_MAX) {
draw_dsc->opa = (uint16_t)((uint16_t)draw_dsc->opa * opa_scale) >> 8;
}
if(draw_dsc->opa <= LV_OPA_MIN) return;
#endif
draw_dsc->color = lv_obj_get_style_line_color(obj, part);
draw_dsc->dash_width = lv_obj_get_style_line_dash_width(obj, part);
if(draw_dsc->dash_width) {
draw_dsc->dash_gap = lv_obj_get_style_line_dash_gap(obj, part);
}
draw_dsc->round_start = lv_obj_get_style_line_rounded(obj, part);
draw_dsc->round_end = draw_dsc->round_start;
#if LV_USE_BLEND_MODES
draw_dsc->blend_mode = lv_obj_get_style_line_blend_mode(obj, part);
#endif
// draw_dsc->width = lv_obj_get_style_line_width(obj, part);
// if(draw_dsc->width == 0) return;
//
// draw_dsc->opa = lv_obj_get_style_line_opa(obj, part);
// if(draw_dsc->opa <= LV_OPA_MIN) return;
//
//#if LV_USE_OPA_SCALE
// lv_opa_t opa_scale = lv_obj_get_style_opa_scale(obj, part);
// if(opa_scale < LV_OPA_MAX) {
// draw_dsc->opa = (uint16_t)((uint16_t)draw_dsc->opa * opa_scale) >> 8;
// }
// if(draw_dsc->opa <= LV_OPA_MIN) return;
//#endif
//
// draw_dsc->color = lv_obj_get_style_line_color(obj, part);
//
// draw_dsc->dash_width = lv_obj_get_style_line_dash_width(obj, part);
// if(draw_dsc->dash_width) {
// draw_dsc->dash_gap = lv_obj_get_style_line_dash_gap(obj, part);
// }
//
// draw_dsc->round_start = lv_obj_get_style_line_rounded(obj, part);
// draw_dsc->round_end = draw_dsc->round_start;
//
//#if LV_USE_BLEND_MODES
// draw_dsc->blend_mode = lv_obj_get_style_line_blend_mode(obj, part);
//#endif
}
/**
@ -310,68 +288,68 @@ lv_coord_t _lv_obj_get_draw_rect_ext_pad_size(lv_obj_t * obj, uint8_t part)
{
lv_coord_t s = 0;
lv_coord_t sh_width = lv_obj_get_style_shadow_width(obj, part);
if(sh_width) {
lv_opa_t sh_opa = lv_obj_get_style_shadow_opa(obj, part);
if(sh_opa > LV_OPA_MIN) {
sh_width = sh_width / 2; /*THe blur adds only half width*/
sh_width++;
sh_width += lv_obj_get_style_shadow_spread(obj, part);
lv_style_int_t sh_ofs_x = lv_obj_get_style_shadow_ofs_x(obj, part);
lv_style_int_t sh_ofs_y = lv_obj_get_style_shadow_ofs_y(obj, part);
sh_width += LV_MATH_MAX(LV_MATH_ABS(sh_ofs_x), LV_MATH_ABS(sh_ofs_y));
s = LV_MATH_MAX(s, sh_width);
}
}
const char * value_str = lv_obj_get_style_value_str(obj, part);
if(value_str) {
lv_opa_t value_opa = lv_obj_get_style_value_opa(obj, part);
if(value_opa > LV_OPA_MIN) {
lv_style_int_t letter_space = lv_obj_get_style_value_letter_space(obj, part);
lv_style_int_t line_space = lv_obj_get_style_value_letter_space(obj, part);
const lv_font_t * font = lv_obj_get_style_value_font(obj, part);
lv_point_t txt_size;
_lv_txt_get_size(&txt_size, value_str, font, letter_space, line_space, LV_COORD_MAX, LV_TXT_FLAG_NONE);
lv_area_t value_area;
value_area.x1 = 0;
value_area.y1 = 0;
value_area.x2 = txt_size.x - 1;
value_area.y2 = txt_size.y - 1;
lv_style_int_t align = lv_obj_get_style_value_align(obj, part);
lv_style_int_t xofs = lv_obj_get_style_value_ofs_x(obj, part);
lv_style_int_t yofs = lv_obj_get_style_value_ofs_y(obj, part);
lv_point_t p_align;
_lv_area_align(&obj->coords, &value_area, align, &p_align);
value_area.x1 += p_align.x + xofs;
value_area.y1 += p_align.y + yofs;
value_area.x2 += p_align.x + xofs;
value_area.y2 += p_align.y + yofs;
s = LV_MATH_MAX(s, obj->coords.x1 - value_area.x1);
s = LV_MATH_MAX(s, obj->coords.y1 - value_area.y1);
s = LV_MATH_MAX(s, value_area.x2 - obj->coords.x2);
s = LV_MATH_MAX(s, value_area.y2 - obj->coords.y2);
}
}
lv_style_int_t outline_width = lv_obj_get_style_outline_width(obj, part);
if(outline_width) {
lv_opa_t outline_opa = lv_obj_get_style_outline_opa(obj, part);
if(outline_opa > LV_OPA_MIN) {
lv_style_int_t outline_pad = lv_obj_get_style_outline_pad(obj, part);
s = LV_MATH_MAX(s, outline_pad + outline_width);
}
}
lv_coord_t w = lv_obj_get_style_transform_width(obj, part);
lv_coord_t h = lv_obj_get_style_transform_height(obj, part);
lv_coord_t wh = LV_MATH_MAX(w, h);
if(wh > 0) s += wh;
// lv_coord_t sh_width = lv_obj_get_style_shadow_width(obj, part);
// if(sh_width) {
// lv_opa_t sh_opa = lv_obj_get_style_shadow_opa(obj, part);
// if(sh_opa > LV_OPA_MIN) {
// sh_width = sh_width / 2; /*THe blur adds only half width*/
// sh_width++;
// sh_width += lv_obj_get_style_shadow_spread(obj, part);
// lv_style_int_t sh_ofs_x = lv_obj_get_style_shadow_ofs_x(obj, part);
// lv_style_int_t sh_ofs_y = lv_obj_get_style_shadow_ofs_y(obj, part);
// sh_width += LV_MATH_MAX(LV_MATH_ABS(sh_ofs_x), LV_MATH_ABS(sh_ofs_y));
// s = LV_MATH_MAX(s, sh_width);
// }
// }
//
// const char * value_str = lv_obj_get_style_value_str(obj, part);
// if(value_str) {
// lv_opa_t value_opa = lv_obj_get_style_value_opa(obj, part);
// if(value_opa > LV_OPA_MIN) {
// lv_style_int_t letter_space = lv_obj_get_style_value_letter_space(obj, part);
// lv_style_int_t line_space = lv_obj_get_style_value_letter_space(obj, part);
// const lv_font_t * font = lv_obj_get_style_value_font(obj, part);
//
// lv_point_t txt_size;
// _lv_txt_get_size(&txt_size, value_str, font, letter_space, line_space, LV_COORD_MAX, LV_TXT_FLAG_NONE);
//
// lv_area_t value_area;
// value_area.x1 = 0;
// value_area.y1 = 0;
// value_area.x2 = txt_size.x - 1;
// value_area.y2 = txt_size.y - 1;
//
// lv_style_int_t align = lv_obj_get_style_value_align(obj, part);
// lv_style_int_t xofs = lv_obj_get_style_value_ofs_x(obj, part);
// lv_style_int_t yofs = lv_obj_get_style_value_ofs_y(obj, part);
// lv_point_t p_align;
// _lv_area_align(&obj->coords, &value_area, align, &p_align);
//
// value_area.x1 += p_align.x + xofs;
// value_area.y1 += p_align.y + yofs;
// value_area.x2 += p_align.x + xofs;
// value_area.y2 += p_align.y + yofs;
//
// s = LV_MATH_MAX(s, obj->coords.x1 - value_area.x1);
// s = LV_MATH_MAX(s, obj->coords.y1 - value_area.y1);
// s = LV_MATH_MAX(s, value_area.x2 - obj->coords.x2);
// s = LV_MATH_MAX(s, value_area.y2 - obj->coords.y2);
// }
// }
//
// lv_style_int_t outline_width = lv_obj_get_style_outline_width(obj, part);
// if(outline_width) {
// lv_opa_t outline_opa = lv_obj_get_style_outline_opa(obj, part);
// if(outline_opa > LV_OPA_MIN) {
// lv_style_int_t outline_pad = lv_obj_get_style_outline_pad(obj, part);
// s = LV_MATH_MAX(s, outline_pad + outline_width);
// }
// }
//
// lv_coord_t w = lv_obj_get_style_transform_width(obj, part);
// lv_coord_t h = lv_obj_get_style_transform_height(obj, part);
// lv_coord_t wh = LV_MATH_MAX(w, h);
// if(wh > 0) s += wh;
return s;
}
@ -407,147 +385,147 @@ void _lv_obj_refresh_ext_draw_pad(lv_obj_t * obj)
*/
void _lv_obj_draw_scrollbar(lv_obj_t * obj, const lv_area_t * clip_area)
{
if(lv_obj_has_flag(obj, LV_OBJ_FLAG_SCROLLABLE) == false) return;
lv_scroll_dir_t sm = lv_obj_get_scrollbar_mode(obj);
if(sm == LV_SCROLLBAR_MODE_OFF) {
return;
}
/*If there is no indev scrolling this object but the moe is active return*/
lv_indev_t * indev = lv_indev_get_next(NULL);
if(sm == LV_SCROLLBAR_MODE_ACTIVE) {
bool found = false;
while(indev) {
if(lv_indev_get_scroll_obj(indev) == obj) {
found = true;
break;
}
indev = lv_indev_get_next(indev);
}
if(!found) {
return;
}
}
lv_coord_t st = lv_obj_get_scroll_top(obj);
lv_coord_t sb = lv_obj_get_scroll_bottom(obj);
lv_coord_t sl = lv_obj_get_scroll_left(obj);
lv_coord_t sr = lv_obj_get_scroll_right(obj);
/*Return if too small content to scroll*/
if(sm == LV_SCROLLBAR_MODE_AUTO && st <= 0 && sb <= 0 && sl <= 0 && sr <= 0) {
return;
}
lv_coord_t end_space = lv_obj_get_style_scrollbar_space_end(obj, LV_OBJ_PART_MAIN);
lv_coord_t side_space = lv_obj_get_style_scrollbar_space_side(obj, LV_OBJ_PART_MAIN);
lv_coord_t tickness = lv_obj_get_style_scrollbar_tickness(obj, LV_OBJ_PART_MAIN);
lv_coord_t obj_h = lv_obj_get_height(obj);
lv_coord_t obj_w = lv_obj_get_width(obj);
lv_scroll_dir_t dir = lv_obj_get_scroll_dir(obj);
bool ver_draw = false;
if((dir & LV_DIR_VER) &&
((sm == LV_SCROLLBAR_MODE_ON) ||
(sm == LV_SCROLLBAR_MODE_AUTO && (st > 0 || sb > 0)) ||
(sm == LV_SCROLLBAR_MODE_ACTIVE && lv_indev_get_scroll_dir(indev) == LV_SCROLL_DIR_VER))) {
ver_draw = true;
}
bool hor_draw = false;
if((dir & LV_DIR_HOR) &&
((sm == LV_SCROLLBAR_MODE_ON) ||
(sm == LV_SCROLLBAR_MODE_AUTO && (sl > 0 || sr > 0)) ||
(sm == LV_SCROLLBAR_MODE_ACTIVE && lv_indev_get_scroll_dir(indev) == LV_SCROLL_DIR_HOR))) {
hor_draw = true;
}
lv_coord_t ver_reg_space = ver_draw ? tickness + side_space : 0;
lv_coord_t hor_req_space = hor_draw ? tickness + side_space : 0;
lv_coord_t rem;
lv_draw_rect_dsc_t draw_dsc;
lv_res_t sb_res = scrollbar_init_draw_dsc(obj, &draw_dsc);
if(sb_res != LV_RES_OK) return;
lv_area_t area;
area.y1 = obj->coords.y1;
area.y2 = obj->coords.y2;
area.x2 = obj->coords.x2 - side_space;
area.x1 = area.x2 - tickness;
/*Draw horizontal scrollbar if the mode is ON or can be scrolled in this direction*/
if(ver_draw && _lv_area_is_on(&area, clip_area)) {
lv_coord_t content_h = obj_h + st + sb;
lv_coord_t sb_h = ((obj_h - end_space * 2 - hor_req_space) * obj_h) / content_h;
sb_h = LV_MATH_MAX(sb_h, SCROLLBAR_MIN_SIZE);
rem = (obj_h - end_space * 2 - 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) {
area.y1 = obj->coords.y1 + end_space;
area.y2 = obj->coords.y2 - end_space - hor_req_space - 1;
area.x2 = obj->coords.x2 - side_space;
area.x1 = area.x2 - tickness + 1;
} else {
lv_coord_t sb_y = (rem * sb) / scroll_h;
sb_y = rem - sb_y;
area.y1 = obj->coords.y1 + sb_y + end_space;
area.y2 = area.y1 + sb_h - 1;
area.x2 = obj->coords.x2 - side_space;
area.x1 = area.x2 - tickness;
if(area.y1 < obj->coords.y1 + end_space) {
area.y1 = obj->coords.y1 + end_space;
if(area.y1 + SCROLLBAR_MIN_SIZE > area.y2) area.y2 = area.y1 + SCROLLBAR_MIN_SIZE;
}
if(area.y2 > obj->coords.y2 - hor_req_space - end_space) {
area.y2 = obj->coords.y2 - hor_req_space - end_space;
if(area.y2 - SCROLLBAR_MIN_SIZE < area.y1) area.y1 = area.y2 - SCROLLBAR_MIN_SIZE;
}
}
lv_draw_rect(&area, clip_area, &draw_dsc);
}
area.y2 = obj->coords.y2 - side_space;
area.y1 =area.y2 - tickness;
area.x1 = obj->coords.x1;
area.x2 = obj->coords.x2;
/*Draw horizontal scrollbar if the mode is ON or can be scrolled in this direction*/
if(hor_draw && _lv_area_is_on(&area, clip_area)) {
lv_coord_t content_w = obj_w + sl + sr;
lv_coord_t sb_w = ((obj_w - end_space * 2 - ver_reg_space) * obj_w) / content_w;
sb_w = LV_MATH_MAX(sb_w, SCROLLBAR_MIN_SIZE);
rem = (obj_w - end_space * 2 - 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) {
area.y2 = obj->coords.y2 - side_space;
area.y1 = area.y2 - tickness + 1;
area.x1 = obj->coords.x1 + end_space;
area.x2 = obj->coords.x2 - end_space - ver_reg_space - 1;
} else {
lv_coord_t sb_x = (rem * sr) / scroll_w;
sb_x = rem - sb_x;
area.x1 = obj->coords.x1 + sb_x + end_space;
area.x2 = area.x1 + sb_w - 1;
area.y2 = obj->coords.y2 - side_space;
area.y1 = area.y2 - tickness;
if(area.x1 < obj->coords.x1 + end_space) {
area.x1 = obj->coords.x1 + end_space;
if(area.x1 + SCROLLBAR_MIN_SIZE > area.x2) area.x2 = area.x1 + SCROLLBAR_MIN_SIZE;
}
if(area.x2 > obj->coords.x2 - ver_reg_space - end_space) {
area.x2 = obj->coords.x2 - ver_reg_space - end_space;
if(area.x2 - SCROLLBAR_MIN_SIZE < area.x1) area.x1 = area.x2 - SCROLLBAR_MIN_SIZE;
}
}
lv_draw_rect(&area, clip_area, &draw_dsc);
}
// if(lv_obj_has_flag(obj, LV_OBJ_FLAG_SCROLLABLE) == false) return;
//
// lv_scroll_dir_t sm = lv_obj_get_scrollbar_mode(obj);
// if(sm == LV_SCROLLBAR_MODE_OFF) {
// return;
// }
//
// /*If there is no indev scrolling this object but the moe is active return*/
// lv_indev_t * indev = lv_indev_get_next(NULL);
// if(sm == LV_SCROLLBAR_MODE_ACTIVE) {
// bool found = false;
// while(indev) {
// if(lv_indev_get_scroll_obj(indev) == obj) {
// found = true;
// break;
// }
// indev = lv_indev_get_next(indev);
// }
// if(!found) {
// return;
// }
// }
//
// lv_coord_t st = lv_obj_get_scroll_top(obj);
// lv_coord_t sb = lv_obj_get_scroll_bottom(obj);
// lv_coord_t sl = lv_obj_get_scroll_left(obj);
// lv_coord_t sr = lv_obj_get_scroll_right(obj);
//
// /*Return if too small content to scroll*/
// if(sm == LV_SCROLLBAR_MODE_AUTO && st <= 0 && sb <= 0 && sl <= 0 && sr <= 0) {
// return;
// }
//
// lv_coord_t end_space = lv_obj_get_style_scrollbar_space_end(obj, LV_OBJ_PART_MAIN);
// lv_coord_t side_space = lv_obj_get_style_scrollbar_space_side(obj, LV_OBJ_PART_MAIN);
// lv_coord_t tickness = lv_obj_get_style_scrollbar_tickness(obj, LV_OBJ_PART_MAIN);
//
// lv_coord_t obj_h = lv_obj_get_height(obj);
// lv_coord_t obj_w = lv_obj_get_width(obj);
//
// lv_scroll_dir_t dir = lv_obj_get_scroll_dir(obj);
//
// bool ver_draw = false;
// if((dir & LV_DIR_VER) &&
// ((sm == LV_SCROLLBAR_MODE_ON) ||
// (sm == LV_SCROLLBAR_MODE_AUTO && (st > 0 || sb > 0)) ||
// (sm == LV_SCROLLBAR_MODE_ACTIVE && lv_indev_get_scroll_dir(indev) == LV_SCROLL_DIR_VER))) {
// ver_draw = true;
// }
//
//
// bool hor_draw = false;
// if((dir & LV_DIR_HOR) &&
// ((sm == LV_SCROLLBAR_MODE_ON) ||
// (sm == LV_SCROLLBAR_MODE_AUTO && (sl > 0 || sr > 0)) ||
// (sm == LV_SCROLLBAR_MODE_ACTIVE && lv_indev_get_scroll_dir(indev) == LV_SCROLL_DIR_HOR))) {
// hor_draw = true;
// }
//
//
// lv_coord_t ver_reg_space = ver_draw ? tickness + side_space : 0;
// lv_coord_t hor_req_space = hor_draw ? tickness + side_space : 0;
// lv_coord_t rem;
//
// lv_draw_rect_dsc_t draw_dsc;
// lv_res_t sb_res = scrollbar_init_draw_dsc(obj, &draw_dsc);
// if(sb_res != LV_RES_OK) return;
//
// lv_area_t area;
// area.y1 = obj->coords.y1;
// area.y2 = obj->coords.y2;
// area.x2 = obj->coords.x2 - side_space;
// area.x1 = area.x2 - tickness;
//
// /*Draw horizontal scrollbar if the mode is ON or can be scrolled in this direction*/
// if(ver_draw && _lv_area_is_on(&area, clip_area)) {
// lv_coord_t content_h = obj_h + st + sb;
// lv_coord_t sb_h = ((obj_h - end_space * 2 - hor_req_space) * obj_h) / content_h;
// sb_h = LV_MATH_MAX(sb_h, SCROLLBAR_MIN_SIZE);
// rem = (obj_h - end_space * 2 - 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) {
// area.y1 = obj->coords.y1 + end_space;
// area.y2 = obj->coords.y2 - end_space - hor_req_space - 1;
// area.x2 = obj->coords.x2 - side_space;
// area.x1 = area.x2 - tickness + 1;
// } else {
// lv_coord_t sb_y = (rem * sb) / scroll_h;
// sb_y = rem - sb_y;
//
// area.y1 = obj->coords.y1 + sb_y + end_space;
// area.y2 = area.y1 + sb_h - 1;
// area.x2 = obj->coords.x2 - side_space;
// area.x1 = area.x2 - tickness;
// if(area.y1 < obj->coords.y1 + end_space) {
// area.y1 = obj->coords.y1 + end_space;
// if(area.y1 + SCROLLBAR_MIN_SIZE > area.y2) area.y2 = area.y1 + SCROLLBAR_MIN_SIZE;
// }
// if(area.y2 > obj->coords.y2 - hor_req_space - end_space) {
// area.y2 = obj->coords.y2 - hor_req_space - end_space;
// if(area.y2 - SCROLLBAR_MIN_SIZE < area.y1) area.y1 = area.y2 - SCROLLBAR_MIN_SIZE;
// }
// }
// lv_draw_rect(&area, clip_area, &draw_dsc);
// }
//
// area.y2 = obj->coords.y2 - side_space;
// area.y1 =area.y2 - tickness;
// area.x1 = obj->coords.x1;
// area.x2 = obj->coords.x2;
// /*Draw horizontal scrollbar if the mode is ON or can be scrolled in this direction*/
// if(hor_draw && _lv_area_is_on(&area, clip_area)) {
// lv_coord_t content_w = obj_w + sl + sr;
// lv_coord_t sb_w = ((obj_w - end_space * 2 - ver_reg_space) * obj_w) / content_w;
// sb_w = LV_MATH_MAX(sb_w, SCROLLBAR_MIN_SIZE);
// rem = (obj_w - end_space * 2 - 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) {
// area.y2 = obj->coords.y2 - side_space;
// area.y1 = area.y2 - tickness + 1;
// area.x1 = obj->coords.x1 + end_space;
// area.x2 = obj->coords.x2 - end_space - ver_reg_space - 1;
// } else {
// lv_coord_t sb_x = (rem * sr) / scroll_w;
// sb_x = rem - sb_x;
//
// area.x1 = obj->coords.x1 + sb_x + end_space;
// area.x2 = area.x1 + sb_w - 1;
// area.y2 = obj->coords.y2 - side_space;
// area.y1 = area.y2 - tickness;
// if(area.x1 < obj->coords.x1 + end_space) {
// area.x1 = obj->coords.x1 + end_space;
// if(area.x1 + SCROLLBAR_MIN_SIZE > area.x2) area.x2 = area.x1 + SCROLLBAR_MIN_SIZE;
// }
// if(area.x2 > obj->coords.x2 - ver_reg_space - end_space) {
// area.x2 = obj->coords.x2 - ver_reg_space - end_space;
// if(area.x2 - SCROLLBAR_MIN_SIZE < area.x1) area.x1 = area.x2 - SCROLLBAR_MIN_SIZE;
// }
// }
// lv_draw_rect(&area, clip_area, &draw_dsc);
// }
}
/**********************
@ -562,33 +540,33 @@ void _lv_obj_draw_scrollbar(lv_obj_t * obj, const lv_area_t * clip_area)
*/
static lv_res_t scrollbar_init_draw_dsc(lv_obj_t * obj, lv_draw_rect_dsc_t * dsc)
{
lv_draw_rect_dsc_init(dsc);
dsc->bg_opa = lv_obj_get_style_scrollbar_bg_opa(obj, LV_OBJ_PART_MAIN);
if(dsc->bg_opa > LV_OPA_MIN) {
dsc->bg_color = lv_obj_get_style_scrollbar_bg_color(obj, LV_OBJ_PART_MAIN);
}
dsc->border_opa = lv_obj_get_style_scrollbar_border_opa(obj, LV_OBJ_PART_MAIN);
if(dsc->border_opa > LV_OPA_MIN) {
dsc->border_width = lv_obj_get_style_scrollbar_border_width(obj, LV_OBJ_PART_MAIN);
if(dsc->border_width > 0) {
dsc->border_color = lv_obj_get_style_scrollbar_border_color(obj, LV_OBJ_PART_MAIN);
} else {
dsc->border_opa = LV_OPA_TRANSP;
}
}
lv_opa_t opa_scale = lv_obj_get_style_opa_scale(obj, LV_OBJ_PART_MAIN);
if(opa_scale < LV_OPA_MAX) {
dsc->bg_opa = (dsc->bg_opa * opa_scale) >> 8;
dsc->border_opa = (dsc->bg_opa * opa_scale) >> 8;
}
if(dsc->bg_opa != LV_OPA_TRANSP || dsc->border_opa != LV_OPA_TRANSP) {
dsc->radius = lv_obj_get_style_scrollbar_radius(obj, LV_OBJ_PART_MAIN);
return LV_RES_OK;
} else {
return LV_RES_INV;
}
// lv_draw_rect_dsc_init(dsc);
// dsc->bg_opa = lv_obj_get_style_scrollbar_bg_opa(obj, LV_OBJ_PART_MAIN);
// if(dsc->bg_opa > LV_OPA_MIN) {
// dsc->bg_color = lv_obj_get_style_scrollbar_bg_color(obj, LV_OBJ_PART_MAIN);
// }
//
// dsc->border_opa = lv_obj_get_style_scrollbar_border_opa(obj, LV_OBJ_PART_MAIN);
// if(dsc->border_opa > LV_OPA_MIN) {
// dsc->border_width = lv_obj_get_style_scrollbar_border_width(obj, LV_OBJ_PART_MAIN);
// if(dsc->border_width > 0) {
// dsc->border_color = lv_obj_get_style_scrollbar_border_color(obj, LV_OBJ_PART_MAIN);
// } else {
// dsc->border_opa = LV_OPA_TRANSP;
// }
// }
//
// lv_opa_t opa_scale = lv_obj_get_style_opa_scale(obj, LV_OBJ_PART_MAIN);
// if(opa_scale < LV_OPA_MAX) {
// dsc->bg_opa = (dsc->bg_opa * opa_scale) >> 8;
// dsc->border_opa = (dsc->bg_opa * opa_scale) >> 8;
// }
//
// if(dsc->bg_opa != LV_OPA_TRANSP || dsc->border_opa != LV_OPA_TRANSP) {
// dsc->radius = lv_obj_get_style_scrollbar_radius(obj, LV_OBJ_PART_MAIN);
// return LV_RES_OK;
// } else {
// return LV_RES_INV;
// }
}

View File

@ -203,8 +203,8 @@ void lv_obj_set_height(lv_obj_t * obj, lv_coord_t h)
*/
void lv_obj_set_content_width(lv_obj_t * obj, lv_coord_t w)
{
lv_style_int_t pleft = lv_obj_get_style_pad_left(obj, LV_OBJ_PART_MAIN);
lv_style_int_t pright = lv_obj_get_style_pad_right(obj, LV_OBJ_PART_MAIN);
lv_coord_t pleft = lv_obj_get_style_pad_left(obj, LV_PART_MAIN);
lv_coord_t pright = lv_obj_get_style_pad_right(obj, LV_PART_MAIN);
lv_obj_set_width(obj, w + pleft + pright);
}
@ -216,8 +216,8 @@ void lv_obj_set_content_width(lv_obj_t * obj, lv_coord_t w)
*/
void lv_obj_set_content_height(lv_obj_t * obj, lv_coord_t h)
{
lv_style_int_t ptop = lv_obj_get_style_pad_top(obj, LV_OBJ_PART_MAIN);
lv_style_int_t pbottom = lv_obj_get_style_pad_bottom(obj, LV_OBJ_PART_MAIN);
lv_coord_t ptop = lv_obj_get_style_pad_top(obj, LV_PART_MAIN);
lv_coord_t pbottom = lv_obj_get_style_pad_bottom(obj, LV_PART_MAIN);
lv_obj_set_height(obj, h + ptop + pbottom);
}
@ -230,8 +230,8 @@ void lv_obj_set_content_height(lv_obj_t * obj, lv_coord_t h)
*/
void lv_obj_set_width_margin(lv_obj_t * obj, lv_coord_t w)
{
lv_style_int_t mleft = lv_obj_get_style_margin_left(obj, LV_OBJ_PART_MAIN);
lv_style_int_t mright = lv_obj_get_style_margin_right(obj, LV_OBJ_PART_MAIN);
lv_coord_t mleft = 0;//lv_obj_get_style_margin_left(obj, LV_PART_MAIN);
lv_coord_t mright = 0;//lv_obj_get_style_margin_right(obj, LV_PART_MAIN);
lv_obj_set_width(obj, w - mleft - mright);
}
@ -244,8 +244,8 @@ void lv_obj_set_width_margin(lv_obj_t * obj, lv_coord_t w)
*/
void lv_obj_set_height_margin(lv_obj_t * obj, lv_coord_t h)
{
lv_style_int_t mtop = lv_obj_get_style_margin_top(obj, LV_OBJ_PART_MAIN);
lv_style_int_t mbottom = lv_obj_get_style_margin_bottom(obj, LV_OBJ_PART_MAIN);
lv_coord_t mtop = 0;//lv_obj_get_style_margin_top(obj, LV_PART_MAIN);
lv_coord_t mbottom = 0;//lv_obj_get_style_margin_bottom(obj, LV_PART_MAIN);
lv_obj_set_height(obj, h - mtop - mbottom);
}
@ -269,8 +269,8 @@ void lv_obj_align(lv_obj_t * obj, const lv_obj_t * base, lv_align_t align, lv_co
lv_coord_t x = 0;
lv_coord_t y = 0;
lv_obj_t * parent = lv_obj_get_parent(obj);
lv_coord_t pleft = lv_obj_get_style_pad_left(parent, LV_OBJ_PART_MAIN);
lv_coord_t ptop = lv_obj_get_style_pad_top(parent, LV_OBJ_PART_MAIN);
lv_coord_t pleft = lv_obj_get_style_pad_left(parent, LV_PART_MAIN);
lv_coord_t ptop = lv_obj_get_style_pad_top(parent, LV_PART_MAIN);
switch(align) {
case LV_ALIGN_CENTER:
x = lv_obj_get_width_fit(base) / 2 - lv_obj_get_width(obj) / 2;
@ -403,8 +403,8 @@ void lv_obj_get_inner_coords(const lv_obj_t * obj, lv_area_t * coords_out)
{
LV_ASSERT_OBJ(obj, LV_OBJX_NAME);
lv_border_side_t part = lv_obj_get_style_border_side(obj, LV_OBJ_PART_MAIN);
lv_coord_t w = lv_obj_get_style_border_width(obj, LV_OBJ_PART_MAIN);
lv_border_side_t part = lv_obj_get_style_border_side(obj, LV_PART_MAIN);
lv_coord_t w = lv_obj_get_style_border_width(obj, LV_PART_MAIN);
if(part & LV_BORDER_SIDE_LEFT) coords_out->x1 += w;
if(part & LV_BORDER_SIDE_RIGHT) coords_out->x2 -= w;
@ -429,7 +429,7 @@ lv_coord_t lv_obj_get_x(const lv_obj_t * obj)
if(parent) {
rel_x = obj->coords.x1 - parent->coords.x1;
rel_x += lv_obj_get_scroll_x(parent);
rel_x -= lv_obj_get_style_pad_left(parent, LV_OBJ_PART_MAIN);
rel_x -= lv_obj_get_style_pad_left(parent, LV_PART_MAIN);
}
else {
rel_x = obj->coords.x1;
@ -454,7 +454,7 @@ lv_coord_t lv_obj_get_y(const lv_obj_t * obj)
if(parent) {
rel_y = obj->coords.y1 - parent->coords.y1;
rel_y += lv_obj_get_scroll_y(parent);
rel_y -= lv_obj_get_style_pad_top(parent, LV_OBJ_PART_MAIN);
rel_y -= lv_obj_get_style_pad_top(parent, LV_PART_MAIN);
}
else {
rel_y = obj->coords.y1;
@ -497,8 +497,8 @@ lv_coord_t lv_obj_get_width_fit(const lv_obj_t * obj)
{
LV_ASSERT_OBJ(obj, LV_OBJX_NAME);
lv_style_int_t left = lv_obj_get_style_pad_left(obj, LV_OBJ_PART_MAIN);
lv_style_int_t right = lv_obj_get_style_pad_right(obj, LV_OBJ_PART_MAIN);
lv_coord_t left = lv_obj_get_style_pad_left(obj, LV_PART_MAIN);
lv_coord_t right = lv_obj_get_style_pad_right(obj, LV_PART_MAIN);
return lv_obj_get_width(obj) - left - right;
}
@ -512,8 +512,8 @@ lv_coord_t lv_obj_get_height_fit(const lv_obj_t * obj)
{
LV_ASSERT_OBJ(obj, LV_OBJX_NAME);
lv_style_int_t top = lv_obj_get_style_pad_top((lv_obj_t *)obj, LV_OBJ_PART_MAIN);
lv_style_int_t bottom = lv_obj_get_style_pad_bottom((lv_obj_t *)obj, LV_OBJ_PART_MAIN);
lv_coord_t top = lv_obj_get_style_pad_top((lv_obj_t *)obj, LV_PART_MAIN);
lv_coord_t bottom = lv_obj_get_style_pad_bottom((lv_obj_t *)obj, LV_PART_MAIN);
return lv_obj_get_height(obj) - top - bottom;
}
@ -526,8 +526,8 @@ lv_coord_t lv_obj_get_height_fit(const lv_obj_t * obj)
*/
lv_coord_t lv_obj_get_height_margin(const lv_obj_t * obj)
{
lv_style_int_t mtop = lv_obj_get_style_margin_top(obj, LV_OBJ_PART_MAIN);
lv_style_int_t mbottom = lv_obj_get_style_margin_bottom(obj, LV_OBJ_PART_MAIN);
lv_coord_t mtop = lv_obj_get_style_margin_top(obj, LV_PART_MAIN);
lv_coord_t mbottom = lv_obj_get_style_margin_bottom(obj, LV_PART_MAIN);
return lv_obj_get_height(obj) + mtop + mbottom;
}
@ -540,8 +540,8 @@ lv_coord_t lv_obj_get_height_margin(const lv_obj_t * obj)
*/
lv_coord_t lv_obj_get_width_margin(const lv_obj_t * obj)
{
lv_style_int_t mleft = lv_obj_get_style_margin_left(obj, LV_OBJ_PART_MAIN);
lv_style_int_t mright = lv_obj_get_style_margin_right(obj, LV_OBJ_PART_MAIN);
lv_coord_t mleft = lv_obj_get_style_margin_left(obj, LV_PART_MAIN);
lv_coord_t mright = lv_obj_get_style_margin_right(obj, LV_PART_MAIN);
return lv_obj_get_width(obj) + mleft + mright;
}
@ -620,8 +620,8 @@ void _lv_obj_move_to(lv_obj_t * obj, lv_coord_t x, lv_coord_t y, bool notify_par
lv_obj_t * parent = obj->parent;
if(parent) {
lv_coord_t pad_left = lv_obj_get_style_pad_left(parent, LV_OBJ_PART_MAIN);
lv_coord_t pad_top = lv_obj_get_style_pad_top(parent, LV_OBJ_PART_MAIN);
lv_coord_t pad_left = lv_obj_get_style_pad_left(parent, LV_PART_MAIN);
lv_coord_t pad_top = lv_obj_get_style_pad_top(parent, LV_PART_MAIN);
x += pad_left + parent->coords.x1 - lv_obj_get_scroll_x(parent);
y += pad_top + parent->coords.y1 - lv_obj_get_scroll_y(parent);

View File

@ -130,11 +130,11 @@ lv_coord_t lv_obj_get_scroll_bottom(lv_obj_t * obj)
uint32_t i;
for(i = 0; i < lv_obj_get_child_cnt(obj); i++) {
lv_obj_t * child = lv_obj_get_child(obj, i);
child_res = LV_MATH_MAX(child_res, child->coords.y2 + lv_obj_get_style_margin_bottom(child, LV_OBJ_PART_MAIN));
child_res = LV_MATH_MAX(child_res, child->coords.y2 + lv_obj_get_style_margin_bottom(child, LV_PART_MAIN));
}
lv_coord_t pad_top = lv_obj_get_style_pad_top(obj, LV_OBJ_PART_MAIN);
lv_coord_t pad_bottom = lv_obj_get_style_pad_bottom(obj, LV_OBJ_PART_MAIN);
lv_coord_t pad_top = lv_obj_get_style_pad_top(obj, LV_PART_MAIN);
lv_coord_t pad_bottom = lv_obj_get_style_pad_bottom(obj, LV_PART_MAIN);
child_res -= (obj->coords.y2 - pad_bottom);
@ -156,8 +156,8 @@ lv_coord_t lv_obj_get_scroll_left(lv_obj_t * obj)
}
/*With RTL base direction scrolling the left is normal so find the left most coordinate*/
lv_coord_t pad_right = lv_obj_get_style_pad_right(obj, LV_OBJ_PART_MAIN);
lv_coord_t pad_left = lv_obj_get_style_pad_left(obj, LV_OBJ_PART_MAIN);
lv_coord_t pad_right = lv_obj_get_style_pad_right(obj, LV_PART_MAIN);
lv_coord_t pad_left = lv_obj_get_style_pad_left(obj, LV_PART_MAIN);
lv_coord_t child_res = 0;
@ -165,7 +165,7 @@ lv_coord_t lv_obj_get_scroll_left(lv_obj_t * obj)
lv_coord_t x1 = LV_COORD_MAX;
for(i = 0; i < lv_obj_get_child_cnt(obj); i++) {
lv_obj_t * child = lv_obj_get_child(obj, i);
x1 = LV_MATH_MIN(x1, child->coords.x1 - lv_obj_get_style_margin_left(child, LV_OBJ_PART_MAIN));
x1 = LV_MATH_MIN(x1, child->coords.x1 - lv_obj_get_style_margin_left(child, LV_PART_MAIN));
}
@ -197,11 +197,11 @@ lv_coord_t lv_obj_get_scroll_right(lv_obj_t * obj)
uint32_t i;
for(i = 0; i < lv_obj_get_child_cnt(obj); i++) {
lv_obj_t * child = lv_obj_get_child(obj, i);
child_res = LV_MATH_MAX(child_res, child->coords.x2 + lv_obj_get_style_margin_right(child, LV_OBJ_PART_MAIN));
child_res = LV_MATH_MAX(child_res, child->coords.x2 + lv_obj_get_style_margin_right(child, LV_PART_MAIN));
}
lv_coord_t pad_right = lv_obj_get_style_pad_right(obj, LV_OBJ_PART_MAIN);
lv_coord_t pad_left = lv_obj_get_style_pad_left(obj, LV_OBJ_PART_MAIN);
lv_coord_t pad_right = lv_obj_get_style_pad_right(obj, LV_PART_MAIN);
lv_coord_t pad_left = lv_obj_get_style_pad_left(obj, LV_PART_MAIN);
child_res -= (obj->coords.x2 - pad_right);
@ -324,10 +324,10 @@ void lv_obj_scroll_to_view(lv_obj_t * obj, lv_anim_enable_t anim_en)
{
lv_obj_t * parent = lv_obj_get_parent(obj);
lv_coord_t pleft = lv_obj_get_style_pad_left(parent, LV_OBJ_PART_MAIN);
lv_coord_t pright = lv_obj_get_style_pad_right(parent, LV_OBJ_PART_MAIN);
lv_coord_t ptop = lv_obj_get_style_pad_top(parent, LV_OBJ_PART_MAIN);
lv_coord_t pbottom = lv_obj_get_style_pad_bottom(parent, LV_OBJ_PART_MAIN);
lv_coord_t pleft = lv_obj_get_style_pad_left(parent, LV_PART_MAIN);
lv_coord_t pright = lv_obj_get_style_pad_right(parent, LV_PART_MAIN);
lv_coord_t ptop = lv_obj_get_style_pad_top(parent, LV_PART_MAIN);
lv_coord_t pbottom = lv_obj_get_style_pad_bottom(parent, LV_PART_MAIN);
lv_coord_t left_diff = parent->coords.x1 + pleft - obj->coords.x1;
lv_coord_t right_diff = -(parent->coords.x2 - pright - obj->coords.x2);

File diff suppressed because it is too large Load Diff

View File

@ -33,11 +33,24 @@ typedef enum {
_LV_STYLE_STATE_CMP_DIFF, /*There are larger differences, the objects need to ne notfied*/
} _lv_style_state_cmp_t;
typedef struct {
lv_style_t * style;
uint16_t state;
uint8_t part;
uint8_t is_local :1;
uint8_t is_trans :1;
}lv_obj_style_t;
typedef struct {
lv_obj_style_t * styles;
uint8_t style_cnt;
uint8_t skip_trans :1;
}lv_obj_style_list_t;
/**********************
* GLOBAL PROTOTYPES
**********************/
/**
* Initialize the object related style manager module.
* Called by LVGL in `lv_init()`
@ -51,7 +64,7 @@ void _lv_obj_style_init(void);
* E.g. `LV_OBJ_PART_MAIN`, `LV_BTN_PART_MAIN`, `LV_SLIDER_PART_KNOB`
* @param style pointer to a style to add (Only its pointer will be saved)
*/
void lv_obj_add_style(lv_obj_t * obj, uint8_t part, lv_style_t * style);
void lv_obj_add_style(struct _lv_obj_t * obj, uint32_t part, uint32_t state, lv_style_t * style);
/**
* Remove a style from the style list of an object.
@ -60,7 +73,7 @@ void lv_obj_add_style(lv_obj_t * obj, uint8_t part, lv_style_t * style);
* E.g. `LV_OBJ_PART_MAIN`, `LV_BTN_PART_MAIN`, `LV_SLIDER_PART_KNOB`
* @param style pointer to a style to remove
*/
void lv_obj_remove_style(lv_obj_t * obj, uint8_t part, lv_style_t * style);
void lv_obj_remove_style(struct _lv_obj_t * obj, uint32_t part, uint32_t state, lv_style_t * style);
/**
* Reset a style to the default (empty) state.
@ -70,7 +83,7 @@ void lv_obj_remove_style(lv_obj_t * obj, uint8_t part, lv_style_t * style);
* @param part the part of the object which style list should be reseted.
* E.g. `LV_OBJ_PART_MAIN`, `LV_BTN_PART_MAIN`, `LV_SLIDER_PART_KNOB`
*/
void lv_obj_reset_style_list(lv_obj_t * obj, uint8_t part);
void lv_obj_remove_all_styles(struct _lv_obj_t * obj);
/**
* Notify all object if a style is modified
@ -79,18 +92,6 @@ void lv_obj_reset_style_list(lv_obj_t * obj, uint8_t part);
*/
void lv_obj_report_style_change(lv_style_t * style);
/**
* 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.
* E.g. `LV_OBJ_PART_MAIN`, `LV_BTN_PART_MAIN`, `LV_SLIDER_PART_KNOB`
* @param prop a style property ORed with a state.
* E.g. `LV_STYLE_TEXT_FONT | (LV_STATE_PRESSED << LV_STYLE_STATE_POS)`
* @return true: the property was found and removed; false: the property was not found
*/
bool lv_obj_remove_style_local_prop(lv_obj_t * obj, uint8_t part, lv_style_property_t prop);
#if LV_USE_ANIMATION
/**
@ -99,7 +100,7 @@ bool lv_obj_remove_style_local_prop(lv_obj_t * obj, uint8_t part, lv_style_prope
* @param time duration of the animation [ms]
* @param delay wait before the animation starts [ms]
*/
void lv_obj_fade_in(lv_obj_t * obj, uint32_t time, uint32_t delay);
void lv_obj_fade_in(struct _lv_obj_t * obj, uint32_t time, uint32_t delay);
/**
* Fade out (from fully cover to transparent) an object and all its children using an `opa_scale` animation.
@ -107,175 +108,11 @@ void lv_obj_fade_in(lv_obj_t * obj, uint32_t time, uint32_t delay);
* @param time duration of the animation [ms]
* @param delay wait before the animation starts [ms]
*/
void lv_obj_fade_out(lv_obj_t * obj, uint32_t time, uint32_t delay);
void lv_obj_fade_out(struct _lv_obj_t * obj, uint32_t time, uint32_t delay);
#endif
/**
* Get the style list of part of an object
* @param obj pointer to an object
* @param part the part of the object.
* E.g. `LV_OBJ_PART_MAIN`, `LV_BTN_PART_MAIN`, `LV_SLIDER_PART_KNOB`
* @return pointer to the style list
*/
lv_style_list_t * _lv_obj_get_style_list(const lv_obj_t * obj, uint8_t part);
/**
* Enable/disable the use of style cache for an object
* @param obj pointer to an object
* @param dis true: disable; false: enable (re-enable)
*/
void _lv_obj_disable_style_caching(lv_obj_t * obj, bool dis);
#if LV_STYLE_CACHE_LEVEL > 0
/**
* Mark the object and all of it's children's style lists as invalid.
* The cache will be updated when a cached property asked nest time
* @param obj pointer to an object
*/
void _lv_obj_invalidate_style_cache(lv_obj_t * obj, uint8_t part, lv_style_property_t prop);
#endif
/**
* Get a style property of a part of an object in the object's current state.
* If there is a running transitions it is taken into account
* @param obj pointer to an object
* @param part the part of the object which style property should be get.
* E.g. `LV_OBJ_PART_MAIN`, `LV_BTN_PART_MAIN`, `LV_SLIDER_PART_KNOB`
* @param prop the property to get. E.g. `LV_STYLE_BORDER_WIDTH`.
* The state of the object will be added internally
* @return the value of the property of the given part in the current state.
* If the property is not found a default value will be returned.
* @note shouldn't be used directly. Use the specific property get functions instead.
* For example: `lv_obj_style_get_border_width()`
* @note for performance reasons it's not checked if the property really has integer type
*/
lv_style_int_t _lv_obj_get_style_int(const lv_obj_t * obj, uint8_t part, lv_style_property_t prop);
/**
* Get a style property of a part of an object in the object's current state.
* If there is a running transitions it is taken into account
* @param obj pointer to an object
* @param part the part of the object which style property should be get.
* E.g. `LV_OBJ_PART_MAIN`, `LV_BTN_PART_MAIN`, `LV_SLIDER_PART_KNOB`
* @param prop the property to get. E.g. `LV_STYLE_BORDER_COLOR`.
* The state of the object will be added internally
* @return the value of the property of the given part in the current state.
* If the property is not found a default value will be returned.
* @note shouldn't be used directly. Use the specific property get functions instead.
* For example: `lv_obj_style_get_border_color()`
* @note for performance reasons it's not checked if the property really has color type
*/
lv_color_t _lv_obj_get_style_color(const lv_obj_t * obj, uint8_t part, lv_style_property_t prop);
/**
* Get a style property of a part of an object in the object's current state.
* If there is a running transitions it is taken into account
* @param obj pointer to an object
* @param part the part of the object which style property should be get.
* E.g. `LV_OBJ_PART_MAIN`, `LV_BTN_PART_MAIN`, `LV_SLIDER_PART_KNOB`
* @param prop the property to get. E.g. `LV_STYLE_BORDER_OPA`.
* The state of the object will be added internally
* @return the value of the property of the given part in the current state.
* If the property is not found a default value will be returned.
* @note shouldn't be used directly. Use the specific property get functions instead.
* For example: `lv_obj_style_get_border_opa()`
* @note for performance reasons it's not checked if the property really has opacity type
*/
lv_opa_t _lv_obj_get_style_opa(const lv_obj_t * obj, uint8_t part, lv_style_property_t prop);
/**
* Get a style property of a part of an object in the object's current state.
* If there is a running transitions it is taken into account
* @param obj pointer to an object
* @param part the part of the object which style property should be get.
* E.g. `LV_OBJ_PART_MAIN`, `LV_BTN_PART_MAIN`, `LV_SLIDER_PART_KNOB`
* @param prop the property to get. E.g. `LV_STYLE_TEXT_FONT`.
* The state of the object will be added internally
* @return the value of the property of the given part in the current state.
* If the property is not found a default value will be returned.
* @note shouldn't be used directly. Use the specific property get functions instead.
* For example: `lv_obj_style_get_border_opa()`
* @note for performance reasons it's not checked if the property really has pointer type
*/
const void * _lv_obj_get_style_ptr(const lv_obj_t * obj, uint8_t part, lv_style_property_t prop);
/**
* Get the local style of a part of an object.
* @param obj pointer to an object
* @param part the part of the object which style property should be set.
* E.g. `LV_OBJ_PART_MAIN`, `LV_BTN_PART_MAIN`, `LV_SLIDER_PART_KNOB`
* @return pointer to the local style if exists else `NULL`.
*/
lv_style_t * _lv_obj_get_local_style(lv_obj_t * obj, uint8_t part);
/**
* Set a local style property of a part of an object in a given state.
* @param obj pointer to an object
* @param part the part of the object which style property should be set.
* E.g. `LV_OBJ_PART_MAIN`, `LV_BTN_PART_MAIN`, `LV_SLIDER_PART_KNOB`
* @param prop a style property ORed with a state.
* E.g. `LV_STYLE_BORDER_WIDTH | (LV_STATE_PRESSED << LV_STYLE_STATE_POS)`
* @param the value to set
* @note shouldn't be used directly. Use the specific property get functions instead.
* For example: `lv_obj_style_get_border_width()`
* @note for performance reasons it's not checked if the property really has integer type
*/
void _lv_obj_set_style_local_int(lv_obj_t * obj, uint8_t part, lv_style_property_t prop, lv_style_int_t value);
/**
* Set a local style property of a part of an object in a given state.
* @param obj pointer to an object
* @param part the part of the object which style property should be set.
* E.g. `LV_OBJ_PART_MAIN`, `LV_BTN_PART_MAIN`, `LV_SLIDER_PART_KNOB`
* @param prop a style property ORed with a state.
* E.g. `LV_STYLE_BORDER_COLOR | (LV_STATE_PRESSED << LV_STYLE_STATE_POS)`
* @param the value to set
* @note shouldn't be used directly. Use the specific property get functions instead.
* For example: `lv_obj_style_get_border_opa()`
* @note for performance reasons it's not checked if the property really has color type
*/
void _lv_obj_set_style_local_color(lv_obj_t * obj, uint8_t part, lv_style_property_t prop, lv_color_t color);
/**
* Set a local style property of a part of an object in a given state.
* @param obj pointer to an object
* @param part the part of the object which style property should be set.
* E.g. `LV_OBJ_PART_MAIN`, `LV_BTN_PART_MAIN`, `LV_SLIDER_PART_KNOB`
* @param prop a style property ORed with a state.
* E.g. `LV_STYLE_BORDER_OPA | (LV_STATE_PRESSED << LV_STYLE_STATE_POS)`
* @param the value to set
* @note shouldn't be used directly. Use the specific property get functions instead.
* For example: `lv_obj_style_get_border_opa()`
* @note for performance reasons it's not checked if the property really has opacity type
*/
void _lv_obj_set_style_local_opa(lv_obj_t * obj, uint8_t part, lv_style_property_t prop, lv_opa_t opa);
/**
* Set a local style property of a part of an object in a given state.
* @param obj pointer to an object
* @param part the part of the object which style property should be set.
* E.g. `LV_OBJ_PART_MAIN`, `LV_BTN_PART_MAIN`, `LV_SLIDER_PART_KNOB`
* @param prop a style property ORed with a state.
* E.g. `LV_STYLE_TEXT_FONT | (LV_STATE_PRESSED << LV_STYLE_STATE_POS)`
* @param value the value to set
* @note shouldn't be used directly. Use the specific property get functions instead.
* For example: `lv_obj_style_get_border_opa()`
* @note for performance reasons it's not checked if the property really has pointer type
*/
void _lv_obj_set_style_local_ptr(lv_obj_t * obj, uint8_t part, lv_style_property_t prop, const void * value);
/**
* Reset a style to the default (empty) state.
* Release all used memories and cancel pending related transitions.
* Typically used in `LV_SIGNAL_CLEAN_UP.
* @param obj pointer to an object
* @param part the part of the object which style list should be reseted.
* E.g. `LV_OBJ_PART_MAIN`, `LV_BTN_PART_MAIN`, `LV_SLIDER_PART_KNOB`
*/
void _lv_obj_reset_style_list_no_refr(lv_obj_t * obj, uint8_t part);
lv_style_value_t lv_obj_get_style_prop(const struct _lv_obj_t * obj, uint8_t part, lv_style_prop_t prop);
/**
* Notify an object and its children about its style is modified
@ -283,13 +120,14 @@ void _lv_obj_reset_style_list_no_refr(lv_obj_t * obj, uint8_t part);
* @param part the part of the object which style property should be refreshed.
* @param prop `LV_STYLE_PROP_ALL` or an `LV_STYLE_...` property. It is used to optimize what needs to be refreshed.
*/
void _lv_obj_refresh_style(lv_obj_t * obj, uint8_t part, lv_style_property_t prop);
void _lv_obj_refresh_style(struct _lv_obj_t * obj, lv_style_prop_t prop);
/**
* Remove all transitions from an object
* @param obj pointer to an object
*/
void _lv_obj_remove_style_trans(lv_obj_t * obj);
void _lv_obj_remove_style_trans(struct _lv_obj_t * obj);
void lv_obj_set_style_prop(lv_obj_t * obj, uint32_t part, uint32_t state, lv_style_prop_t prop, lv_style_value_t value);
#if LV_USE_ANIMATION
@ -306,8 +144,8 @@ void _lv_obj_remove_style_trans(lv_obj_t * obj);
* @param path the path of the transition
* @return pointer to the allocated `the transaction` variable or `NULL` if no transition created
*/
void _lv_obj_create_style_transition(lv_obj_t * obj, lv_style_property_t prop, uint8_t part, lv_state_t prev_state,
lv_state_t new_state, uint32_t time, uint32_t delay, lv_anim_path_t * path);
void _lv_obj_create_style_transition(struct _lv_obj_t * obj, lv_style_prop_t prop, uint8_t part, lv_state_t prev_state,
lv_state_t new_state, uint32_t time, uint32_t delay, const lv_anim_path_t * path);
#endif
@ -318,7 +156,238 @@ void _lv_obj_create_style_transition(lv_obj_t * obj, lv_style_property_t prop, u
* @param state2 an other state
* @return an element of `_lv_style_state_cmp_t`
*/
_lv_style_state_cmp_t _lv_obj_style_state_compare(lv_obj_t * obj, lv_state_t state1, lv_state_t state2);
_lv_style_state_cmp_t _lv_obj_style_state_compare(struct _lv_obj_t * obj, lv_state_t state1, lv_state_t state2);
static inline void lv_obj_set_style_bg_color(struct _lv_obj_t * obj, uint32_t part, uint32_t state, lv_color_t value)
{
lv_style_value_t v;
v._color = value;
lv_obj_set_style_prop(obj, part, state, LV_STYLE_BG_COLOR, v);
}
static inline void lv_obj_set_style_bg_opa(struct _lv_obj_t * obj, uint32_t part, uint32_t state, lv_opa_t value)
{
lv_style_value_t v;
v._int = value;
lv_obj_set_style_prop(obj, part, state, LV_STYLE_BG_OPA, v);
}
/*********************
* OBJ STYLE GET
*********************/
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 v._int; }
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 v._int; }
static inline lv_coord_t lv_obj_get_style_transform_width(const struct _lv_obj_t * obj, uint32_t part) {
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_TRANSFORM_WIDTH); return v._int; }
static inline lv_coord_t lv_obj_get_style_transform_height(const struct _lv_obj_t * obj, uint32_t part) {
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_TRANSFORM_HEIGHT); return v._int; }
static inline lv_coord_t lv_obj_get_style_transform_zoom(const struct _lv_obj_t * obj, uint32_t part) {
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_TRANSFORM_ZOOM); return v._int; }
static inline lv_coord_t lv_obj_get_style_transform_angle(const struct _lv_obj_t * obj, uint32_t part) {
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_TRANSFORM_ANGLE); return v._int; }
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 v._int; }
static inline lv_coord_t lv_obj_get_style_pad_top(const struct _lv_obj_t * obj, uint32_t part) {
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_PAD_TOP); return v._int; }
static inline lv_coord_t lv_obj_get_style_pad_bottom(const struct _lv_obj_t * obj, uint32_t part) {
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_PAD_BOTTOM); return v._int; }
static inline lv_coord_t lv_obj_get_style_pad_left(const struct _lv_obj_t * obj, uint32_t part) {
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_PAD_LEFT); return v._int; }
static inline lv_coord_t lv_obj_get_style_pad_right(const struct _lv_obj_t * obj, uint32_t part) {
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_PAD_RIGHT); return v._int; }
static inline lv_coord_t lv_obj_get_style_margin_top(const struct _lv_obj_t * obj, uint32_t part) {
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_MARGIN_TOP); return v._int; }
static inline lv_coord_t lv_obj_get_style_margin_bottom(const struct _lv_obj_t * obj, uint32_t part) {
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_MARGIN_BOTTOM); return v._int; }
static inline lv_coord_t lv_obj_get_style_margin_left(const struct _lv_obj_t * obj, uint32_t part) {
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_MARGIN_LEFT); return v._int; }
static inline lv_coord_t lv_obj_get_style_margin_right(const struct _lv_obj_t * obj, uint32_t part) {
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_MARGIN_RIGHT); return v._int; }
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); return v._color; }
static inline lv_opa_t lv_obj_get_style_bg_opa(const struct _lv_obj_t * obj, uint32_t part) {
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_BG_OPA); return v._int; }
static inline lv_color_t lv_obj_get_style_bg_grad_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_GRAD_COLOR); return v._color; }
static inline lv_grad_dir_t lv_obj_get_style_bg_grad_dir(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_DIR); return v._int; }
static inline lv_blend_mode_t lv_obj_get_style_bg_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_BG_BLEND_MODE); return v._int; }
static inline lv_coord_t lv_obj_get_style_bg_main_stop(const struct _lv_obj_t * obj, uint32_t part) {
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_BG_MAIN_STOP); return v._int; }
static inline lv_coord_t lv_obj_get_style_bg_grad_stop(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_STOP); return v._int; }
static inline lv_color_t lv_obj_get_style_border_color(const struct _lv_obj_t * obj, uint32_t part) {
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_BORDER_COLOR); return v._color; }
static inline lv_opa_t lv_obj_get_style_border_opa(const struct _lv_obj_t * obj, uint32_t part) {
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_BORDER_OPA); return v._int; }
static inline lv_coord_t lv_obj_get_style_border_width(const struct _lv_obj_t * obj, uint32_t part) {
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_BORDER_WIDTH); return v._int; }
static inline lv_border_side_t lv_obj_get_style_border_side(const struct _lv_obj_t * obj, uint32_t part) {
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_BORDER_SIDE); return v._int; }
static inline bool lv_obj_get_style_border_post(const struct _lv_obj_t * obj, uint32_t part) {
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_BORDER_POST); return v._int; }
static inline lv_blend_mode_t lv_obj_get_style_border_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_BORDER_BLEND_MODE); return v._int; }
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_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 v._int; }
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 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 v._int; }
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 v._int; }
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 v._int; }
static inline lv_blend_mode_t lv_obj_get_style_text_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_TEXT_BLEND_MODE); return v._int; }
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 v._int; }
static inline lv_blend_mode_t lv_obj_get_style_img_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_IMG_BLEND_MODE); return v._int; }
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_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 v._int; }
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); return v._int; }
static inline lv_color_t lv_obj_get_style_outline_color(const struct _lv_obj_t * obj, uint32_t part) {
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_OUTLINE_COLOR); return v._color; }
static inline lv_opa_t lv_obj_get_style_outline_opa(const struct _lv_obj_t * obj, uint32_t part) {
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_OUTLINE_OPA); return v._int; }
static inline lv_coord_t lv_obj_get_style_outline_pad(const struct _lv_obj_t * obj, uint32_t part) {
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_OUTLINE_PAD); return v._int; }
static inline lv_blend_mode_t lv_obj_get_style_outline_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_OUTLINE_BLEND_MODE); return v._int; }
static inline lv_coord_t lv_obj_get_style_shadow_width(const struct _lv_obj_t * obj, uint32_t part) {
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_SHADOW_WIDTH); return v._int; }
static inline lv_coord_t lv_obj_get_style_shadow_ofs_x(const struct _lv_obj_t * obj, uint32_t part) {
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_SHADOW_OFS_X); return v._int; }
static inline lv_coord_t lv_obj_get_style_shadow_ofs_y(const struct _lv_obj_t * obj, uint32_t part) {
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_SHADOW_OFS_Y); return v._int; }
static inline lv_coord_t lv_obj_get_style_shadow_spread(const struct _lv_obj_t * obj, uint32_t part) {
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_SHADOW_SPREAD); return v._int; }
static inline lv_blend_mode_t lv_obj_get_style_shadow_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_SHADOW_BLEND_MODE); return v._int; }
static inline lv_color_t lv_obj_get_style_shadow_color(const struct _lv_obj_t * obj, uint32_t part) {
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_SHADOW_COLOR); return v._color; }
static inline lv_opa_t lv_obj_get_style_shadow_opa(const struct _lv_obj_t * obj, uint32_t part) {
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_SHADOW_OPA); return v._int; }
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); return v._int; }
static inline lv_blend_mode_t lv_obj_get_style_line_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_LINE_BLEND_MODE); return v._int; }
static inline lv_coord_t lv_obj_get_style_line_dash_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_DASH_WIDTH); return v._int; }
static inline lv_coord_t lv_obj_get_style_line_dash_gap(const struct _lv_obj_t * obj, uint32_t part) {
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_LINE_DASH_GAP); return v._int; }
static inline lv_coord_t lv_obj_get_style_line_rounded(const struct _lv_obj_t * obj, uint32_t part) {
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_LINE_ROUNDED); return v._int; }
static inline lv_color_t lv_obj_get_style_line_color(const struct _lv_obj_t * obj, uint32_t part) {
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_LINE_COLOR); return v._color; }
static inline lv_opa_t lv_obj_get_style_line_opa(const struct _lv_obj_t * obj, uint32_t part) {
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_LINE_OPA); return v._int; }
static inline const char * lv_obj_get_style_content_text(const struct _lv_obj_t * obj, uint32_t part) {
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_CONTENT_TEXT); return v._ptr; }
static inline lv_align_t lv_obj_get_style_content_align(const struct _lv_obj_t * obj, uint32_t part) {
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_CONTENT_ALIGN); return v._int; }
static inline lv_coord_t lv_obj_get_style_content_ofs_x(const struct _lv_obj_t * obj, uint32_t part) {
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_CONTENT_OFS_X); return v._int; }
static inline lv_coord_t lv_obj_get_style_content_ofs_y(const struct _lv_obj_t * obj, uint32_t part) {
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_CONTENT_OFS_Y); return v._int; }
static inline uint16_t lv_obj_get_style_transition_time(const struct _lv_obj_t * obj, uint32_t part) {
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_TRANSITION_TIME); return v._int; }
static inline uint16_t lv_obj_get_style_transition_delay(const struct _lv_obj_t * obj, uint32_t part) {
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_TRANSITION_DELAY); return v._int; }
static inline const lv_anim_path_t * lv_obj_get_style_transition_path(const struct _lv_obj_t * obj, uint32_t part) {
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_TRANSITION_PATH); return v._ptr; }
static inline lv_style_prop_t lv_obj_get_style_transition_prop_1(const struct _lv_obj_t * obj, uint32_t part) {
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_TRANSITION_PROP_1); return v._int; }
static inline lv_style_prop_t lv_obj_get_style_transition_prop_2(const struct _lv_obj_t * obj, uint32_t part) {
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_TRANSITION_PROP_2); return v._int; }
static inline lv_style_prop_t lv_obj_get_style_transition_prop_3(const struct _lv_obj_t * obj, uint32_t part) {
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_TRANSITION_PROP_3); return v._int; }
static inline lv_style_prop_t lv_obj_get_style_transition_prop_4(const struct _lv_obj_t * obj, uint32_t part) {
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_TRANSITION_PROP_4); return v._int; }
static inline lv_style_prop_t lv_obj_get_style_transition_prop_5(const struct _lv_obj_t * obj, uint32_t part) {
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_TRANSITION_PROP_5); return v._int; }
static inline lv_style_prop_t lv_obj_get_style_transition_prop_6(const struct _lv_obj_t * obj, uint32_t part) {
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_TRANSITION_PROP_6); return v._int; }
@ -326,297 +395,6 @@ _lv_style_state_cmp_t _lv_obj_style_state_compare(lv_obj_t * obj, lv_state_t sta
* MACROS
**********************/
/**
* Macro to declare the most important style set/get API functions.
*
* Get the value of a style property from an object in the object's current state
* -----------------------------------------------------------------------------
* - Get the value of a style property from an object in the object's current state.
* - Transition animation is taken into account.
* - If the property is not set in the object's styles check the parent(s) if the property can be inherited
* - If still not found return a default value.
* - For example:
* `lv_style_int_t w = lv_obj_get_style_border_width(btn1, LV_BTN_PART_MAIN);`
*
* Set a local style property for an object in a given state
* ---------------------------------------------------------
* - For example:
* `lv_obj_set_style_local_border_width(btn1, LV_BTN_PART_MAIN, LV_STATE_PRESSED, 2);`
*
* Get a local style property's value of an object in a given state
* ----------------------------------------------------------------
* - Return the best matching property in the given state.
* - E.g. if `state` parameter is LV_STATE_PRESSED | LV_STATE_CHECKED` but the property defined only in
* `LV_STATE_PRESSED` and `LV_STATE_DEFAULT` the best matching state is `LV_STATE_PRESSED`
* (because it has higher precedence) and it will be returned.
* - If the property is not found even in `LV_STATE_DEFAULT` `-1` is returned.
* - For example:
* `//Type of result should be lv_style_int_t/lv_opa_t/lv_color_t/const void * according to the type of the property`
* `lv_style_int_t result;`
* `lv_obj_get_style_local_border_width(btn1, LV_BTN_PART_MAIN, LV_STATE_PRESSED, &result);`
* `if(weight > 0) ...the property is found and loaded into result...`
*
* Get the value from a style in a given state
* -------------------------------------------
* - The same rules applies to the return value then for "lv_obj_get_style_local_...()" above
* - For example
* `int16_t weight = lv_style_get_border_width(&style1, LV_STATE_PRESSED, &result);`
* `if(weight > 0) ...the property is found and loaded into result...`
* Set a value in a style in a given state
* ---------------------------------------
* - For example
* `lv_style_set_border_width(&style1, LV_STATE_PRESSED, 2);`
*/
#define _OBJ_GET_STYLE_scalar(prop_name, func_name, value_type, style_type) \
static inline value_type lv_obj_get_style_##func_name (const lv_obj_t * obj, uint8_t part) \
{ \
return (value_type) _lv_obj_get_style##style_type (obj, part, LV_STYLE_##prop_name); \
}
#define _OBJ_GET_STYLE_nonscalar(prop_name, func_name, value_type, style_type) \
static inline value_type lv_obj_get_style_##func_name (const lv_obj_t * obj, uint8_t part) \
{ \
return _lv_obj_get_style##style_type (obj, part, LV_STYLE_##prop_name); \
}
#define _OBJ_SET_STYLE_LOCAL_scalar(prop_name, func_name, value_type, style_type) \
static inline void lv_obj_set_style_local_##func_name (lv_obj_t * obj, uint8_t part, lv_state_t state, value_type value) \
{ \
_lv_obj_set_style_local##style_type (obj, part, LV_STYLE_##prop_name | (state << LV_STYLE_STATE_POS), value); \
}
#define _OBJ_SET_STYLE_LOCAL_nonscalar(prop_name, func_name, value_type, style_type) \
static inline void lv_obj_set_style_local_##func_name (lv_obj_t * obj, uint8_t part, lv_state_t state, value_type value) \
{ \
_lv_obj_set_style_local##style_type (obj, part, LV_STYLE_##prop_name | (state << LV_STYLE_STATE_POS), value); \
}
#define _OBJ_SET_STYLE_scalar(prop_name, func_name, value_type, style_type) \
static inline void lv_style_set_##func_name (lv_style_t * style, lv_state_t state, value_type value) \
{ \
_lv_style_set##style_type (style, LV_STYLE_##prop_name | (state << LV_STYLE_STATE_POS), value); \
}
#define _OBJ_SET_STYLE_nonscalar(prop_name, func_name, value_type, style_type) \
static inline void lv_style_set_##func_name (lv_style_t * style, lv_state_t state, value_type value) \
{ \
_lv_style_set##style_type (style, LV_STYLE_##prop_name | (state << LV_STYLE_STATE_POS), value); \
}
#define _LV_OBJ_STYLE_SET_GET_DECLARE(prop_name, func_name, value_type, style_type, scalar) \
_OBJ_GET_STYLE_##scalar(prop_name, func_name, value_type, style_type) \
_OBJ_SET_STYLE_LOCAL_##scalar(prop_name, func_name, value_type, style_type) \
_OBJ_SET_STYLE_##scalar(prop_name, func_name, value_type, style_type)
_LV_OBJ_STYLE_SET_GET_DECLARE(RADIUS, radius, lv_style_int_t, _int, scalar)
_LV_OBJ_STYLE_SET_GET_DECLARE(CLIP_CORNER, clip_corner, bool, _int, scalar)
_LV_OBJ_STYLE_SET_GET_DECLARE(SIZE, size, lv_style_int_t, _int, scalar)
_LV_OBJ_STYLE_SET_GET_DECLARE(TRANSFORM_WIDTH, transform_width, lv_style_int_t, _int, scalar)
_LV_OBJ_STYLE_SET_GET_DECLARE(TRANSFORM_HEIGHT, transform_height, lv_style_int_t, _int, scalar)
_LV_OBJ_STYLE_SET_GET_DECLARE(TRANSFORM_ANGLE, transform_angle, lv_style_int_t, _int, scalar)
_LV_OBJ_STYLE_SET_GET_DECLARE(TRANSFORM_ZOOM, transform_zoom, lv_style_int_t, _int, scalar)
_LV_OBJ_STYLE_SET_GET_DECLARE(OPA_SCALE, opa_scale, lv_opa_t, _opa, scalar)
_LV_OBJ_STYLE_SET_GET_DECLARE(PAD_TOP, pad_top, lv_style_int_t, _int, scalar)
_LV_OBJ_STYLE_SET_GET_DECLARE(PAD_BOTTOM, pad_bottom, lv_style_int_t, _int, scalar)
_LV_OBJ_STYLE_SET_GET_DECLARE(PAD_LEFT, pad_left, lv_style_int_t, _int, scalar)
_LV_OBJ_STYLE_SET_GET_DECLARE(PAD_RIGHT, pad_right, lv_style_int_t, _int, scalar)
_LV_OBJ_STYLE_SET_GET_DECLARE(MARGIN_TOP, margin_top, lv_style_int_t, _int, scalar)
_LV_OBJ_STYLE_SET_GET_DECLARE(MARGIN_BOTTOM, margin_bottom, lv_style_int_t, _int, scalar)
_LV_OBJ_STYLE_SET_GET_DECLARE(MARGIN_LEFT, margin_left, lv_style_int_t, _int, scalar)
_LV_OBJ_STYLE_SET_GET_DECLARE(MARGIN_RIGHT, margin_right, lv_style_int_t, _int, scalar)
_LV_OBJ_STYLE_SET_GET_DECLARE(BG_BLEND_MODE, bg_blend_mode, lv_blend_mode_t, _int, scalar)
_LV_OBJ_STYLE_SET_GET_DECLARE(BG_MAIN_STOP, bg_main_stop, lv_style_int_t, _int, scalar)
_LV_OBJ_STYLE_SET_GET_DECLARE(BG_GRAD_STOP, bg_grad_stop, lv_style_int_t, _int, scalar)
_LV_OBJ_STYLE_SET_GET_DECLARE(BG_GRAD_DIR, bg_grad_dir, lv_grad_dir_t, _int, scalar)
_LV_OBJ_STYLE_SET_GET_DECLARE(BG_COLOR, bg_color, lv_color_t, _color, nonscalar)
_LV_OBJ_STYLE_SET_GET_DECLARE(BG_GRAD_COLOR, bg_grad_color, lv_color_t, _color, nonscalar)
_LV_OBJ_STYLE_SET_GET_DECLARE(BG_OPA, bg_opa, lv_opa_t, _opa, scalar)
_LV_OBJ_STYLE_SET_GET_DECLARE(BORDER_WIDTH, border_width, lv_style_int_t, _int, scalar)
_LV_OBJ_STYLE_SET_GET_DECLARE(BORDER_SIDE, border_side, lv_border_side_t, _int, scalar)
_LV_OBJ_STYLE_SET_GET_DECLARE(BORDER_BLEND_MODE, border_blend_mode, lv_blend_mode_t, _int, scalar)
_LV_OBJ_STYLE_SET_GET_DECLARE(BORDER_POST, border_post, bool, _int, scalar)
_LV_OBJ_STYLE_SET_GET_DECLARE(BORDER_COLOR, border_color, lv_color_t, _color, nonscalar)
_LV_OBJ_STYLE_SET_GET_DECLARE(BORDER_OPA, border_opa, lv_opa_t, _opa, scalar)
_LV_OBJ_STYLE_SET_GET_DECLARE(OUTLINE_WIDTH, outline_width, lv_style_int_t, _int, scalar)
_LV_OBJ_STYLE_SET_GET_DECLARE(OUTLINE_PAD, outline_pad, lv_style_int_t, _int, scalar)
_LV_OBJ_STYLE_SET_GET_DECLARE(OUTLINE_BLEND_MODE, outline_blend_mode, lv_blend_mode_t, _int, scalar)
_LV_OBJ_STYLE_SET_GET_DECLARE(OUTLINE_COLOR, outline_color, lv_color_t, _color, nonscalar)
_LV_OBJ_STYLE_SET_GET_DECLARE(OUTLINE_OPA, outline_opa, lv_opa_t, _opa, scalar)
_LV_OBJ_STYLE_SET_GET_DECLARE(SHADOW_WIDTH, shadow_width, lv_style_int_t, _int, scalar)
_LV_OBJ_STYLE_SET_GET_DECLARE(SHADOW_OFS_X, shadow_ofs_x, lv_style_int_t, _int, scalar)
_LV_OBJ_STYLE_SET_GET_DECLARE(SHADOW_OFS_Y, shadow_ofs_y, lv_style_int_t, _int, scalar)
_LV_OBJ_STYLE_SET_GET_DECLARE(SHADOW_SPREAD, shadow_spread, lv_style_int_t, _int, scalar)
_LV_OBJ_STYLE_SET_GET_DECLARE(SHADOW_BLEND_MODE, shadow_blend_mode, lv_blend_mode_t, _int, scalar)
_LV_OBJ_STYLE_SET_GET_DECLARE(SHADOW_COLOR, shadow_color, lv_color_t, _color, nonscalar)
_LV_OBJ_STYLE_SET_GET_DECLARE(SHADOW_OPA, shadow_opa, lv_opa_t, _opa, scalar)
_LV_OBJ_STYLE_SET_GET_DECLARE(PATTERN_REPEAT, pattern_repeat, bool, _int, scalar)
_LV_OBJ_STYLE_SET_GET_DECLARE(PATTERN_BLEND_MODE, pattern_blend_mode, lv_blend_mode_t, _int, scalar)
_LV_OBJ_STYLE_SET_GET_DECLARE(PATTERN_RECOLOR, pattern_recolor, lv_color_t, _color, nonscalar)
_LV_OBJ_STYLE_SET_GET_DECLARE(PATTERN_OPA, pattern_opa, lv_opa_t, _opa, scalar)
_LV_OBJ_STYLE_SET_GET_DECLARE(PATTERN_RECOLOR_OPA, pattern_recolor_opa, lv_opa_t, _opa, scalar)
_LV_OBJ_STYLE_SET_GET_DECLARE(PATTERN_IMAGE, pattern_image, const void *, _ptr, scalar)
_LV_OBJ_STYLE_SET_GET_DECLARE(VALUE_LETTER_SPACE, value_letter_space, lv_style_int_t, _int, scalar)
_LV_OBJ_STYLE_SET_GET_DECLARE(VALUE_LINE_SPACE, value_line_space, lv_style_int_t, _int, scalar)
_LV_OBJ_STYLE_SET_GET_DECLARE(VALUE_BLEND_MODE, value_blend_mode, lv_blend_mode_t, _int, scalar)
_LV_OBJ_STYLE_SET_GET_DECLARE(VALUE_OFS_X, value_ofs_x, lv_style_int_t, _int, scalar)
_LV_OBJ_STYLE_SET_GET_DECLARE(VALUE_OFS_Y, value_ofs_y, lv_style_int_t, _int, scalar)
_LV_OBJ_STYLE_SET_GET_DECLARE(VALUE_ALIGN, value_align, lv_align_t, _int, scalar)
_LV_OBJ_STYLE_SET_GET_DECLARE(VALUE_COLOR, value_color, lv_color_t, _color, nonscalar)
_LV_OBJ_STYLE_SET_GET_DECLARE(VALUE_OPA, value_opa, lv_opa_t, _opa, scalar)
_LV_OBJ_STYLE_SET_GET_DECLARE(VALUE_FONT, value_font, const lv_font_t *, _ptr, scalar)
_LV_OBJ_STYLE_SET_GET_DECLARE(VALUE_STR, value_str, const char *, _ptr, scalar)
_LV_OBJ_STYLE_SET_GET_DECLARE(TEXT_LETTER_SPACE, text_letter_space, lv_style_int_t, _int, scalar)
_LV_OBJ_STYLE_SET_GET_DECLARE(TEXT_LINE_SPACE, text_line_space, lv_style_int_t, _int, scalar)
_LV_OBJ_STYLE_SET_GET_DECLARE(TEXT_DECOR, text_decor, lv_text_decor_t, _int, scalar)
_LV_OBJ_STYLE_SET_GET_DECLARE(TEXT_BLEND_MODE, text_blend_mode, lv_blend_mode_t, _int, scalar)
_LV_OBJ_STYLE_SET_GET_DECLARE(TEXT_COLOR, text_color, lv_color_t, _color, nonscalar)
_LV_OBJ_STYLE_SET_GET_DECLARE(TEXT_SEL_COLOR, text_sel_color, lv_color_t, _color, nonscalar)
_LV_OBJ_STYLE_SET_GET_DECLARE(TEXT_SEL_BG_COLOR, text_sel_bg_color, lv_color_t, _color, nonscalar)
_LV_OBJ_STYLE_SET_GET_DECLARE(TEXT_OPA, text_opa, lv_opa_t, _opa, scalar)
_LV_OBJ_STYLE_SET_GET_DECLARE(TEXT_FONT, text_font, const lv_font_t *, _ptr, scalar)
_LV_OBJ_STYLE_SET_GET_DECLARE(LINE_WIDTH, line_width, lv_style_int_t, _int, scalar)
_LV_OBJ_STYLE_SET_GET_DECLARE(LINE_BLEND_MODE, line_blend_mode, lv_blend_mode_t, _int, scalar)
_LV_OBJ_STYLE_SET_GET_DECLARE(LINE_DASH_WIDTH, line_dash_width, lv_style_int_t, _int, scalar)
_LV_OBJ_STYLE_SET_GET_DECLARE(LINE_DASH_GAP, line_dash_gap, lv_style_int_t, _int, scalar)
_LV_OBJ_STYLE_SET_GET_DECLARE(LINE_ROUNDED, line_rounded, bool, _int, scalar)
_LV_OBJ_STYLE_SET_GET_DECLARE(LINE_COLOR, line_color, lv_color_t, _color, nonscalar)
_LV_OBJ_STYLE_SET_GET_DECLARE(LINE_OPA, line_opa, lv_opa_t, _opa, scalar)
_LV_OBJ_STYLE_SET_GET_DECLARE(IMAGE_BLEND_MODE, image_blend_mode, lv_blend_mode_t, _int, scalar)
_LV_OBJ_STYLE_SET_GET_DECLARE(IMAGE_RECOLOR, image_recolor, lv_color_t, _color, nonscalar)
_LV_OBJ_STYLE_SET_GET_DECLARE(IMAGE_OPA, image_opa, lv_opa_t, _opa, scalar)
_LV_OBJ_STYLE_SET_GET_DECLARE(IMAGE_RECOLOR_OPA, image_recolor_opa, lv_opa_t, _opa, scalar)
_LV_OBJ_STYLE_SET_GET_DECLARE(TRANSITION_TIME, transition_time, lv_style_int_t, _int, scalar)
_LV_OBJ_STYLE_SET_GET_DECLARE(TRANSITION_DELAY, transition_delay, lv_style_int_t, _int, scalar)
_LV_OBJ_STYLE_SET_GET_DECLARE(TRANSITION_PROP_1, transition_prop_1, lv_style_int_t, _int, scalar)
_LV_OBJ_STYLE_SET_GET_DECLARE(TRANSITION_PROP_2, transition_prop_2, lv_style_int_t, _int, scalar)
_LV_OBJ_STYLE_SET_GET_DECLARE(TRANSITION_PROP_3, transition_prop_3, lv_style_int_t, _int, scalar)
_LV_OBJ_STYLE_SET_GET_DECLARE(TRANSITION_PROP_4, transition_prop_4, lv_style_int_t, _int, scalar)
_LV_OBJ_STYLE_SET_GET_DECLARE(TRANSITION_PROP_5, transition_prop_5, lv_style_int_t, _int, scalar)
_LV_OBJ_STYLE_SET_GET_DECLARE(TRANSITION_PROP_6, transition_prop_6, lv_style_int_t, _int, scalar)
#if LV_USE_ANIMATION
_LV_OBJ_STYLE_SET_GET_DECLARE(TRANSITION_PATH, transition_path, lv_anim_path_t *, _ptr, scalar)
#else
/*For compatibility*/
_LV_OBJ_STYLE_SET_GET_DECLARE(TRANSITION_PATH, transition_path, const void *, _ptr, scalar)
#endif
_LV_OBJ_STYLE_SET_GET_DECLARE(SCALE_WIDTH, scale_width, lv_style_int_t, _int, scalar)
_LV_OBJ_STYLE_SET_GET_DECLARE(SCALE_BORDER_WIDTH, scale_border_width, lv_style_int_t, _int, scalar)
_LV_OBJ_STYLE_SET_GET_DECLARE(SCALE_END_BORDER_WIDTH, scale_end_border_width, lv_style_int_t, _int, scalar)
_LV_OBJ_STYLE_SET_GET_DECLARE(SCALE_END_LINE_WIDTH, scale_end_line_width, lv_style_int_t, _int, scalar)
_LV_OBJ_STYLE_SET_GET_DECLARE(SCALE_GRAD_COLOR, scale_grad_color, lv_color_t, _color, nonscalar)
_LV_OBJ_STYLE_SET_GET_DECLARE(SCALE_END_COLOR, scale_end_color, lv_color_t, _color, nonscalar)
_LV_OBJ_STYLE_SET_GET_DECLARE(SCROLLBAR_TICKNESS, scrollbar_tickness, lv_style_int_t, _int, scalar)
_LV_OBJ_STYLE_SET_GET_DECLARE(SCROLLBAR_SPACE_SIDE, scrollbar_space_side, lv_style_int_t, _int, scalar)
_LV_OBJ_STYLE_SET_GET_DECLARE(SCROLLBAR_SPACE_END, scrollbar_space_end, lv_style_int_t, _int, scalar)
_LV_OBJ_STYLE_SET_GET_DECLARE(SCROLLBAR_RADIUS, scrollbar_radius, lv_style_int_t, _int, scalar)
_LV_OBJ_STYLE_SET_GET_DECLARE(SCROLLBAR_BORDER_WIDTH, scrollbar_border_width, lv_style_int_t, _int, scalar)
_LV_OBJ_STYLE_SET_GET_DECLARE(SCROLLBAR_BG_COLOR, scrollbar_bg_color, lv_color_t, _color, nonscalar)
_LV_OBJ_STYLE_SET_GET_DECLARE(SCROLLBAR_BORDER_COLOR, scrollbar_border_color, lv_color_t, _color, nonscalar)
_LV_OBJ_STYLE_SET_GET_DECLARE(SCROLLBAR_BG_OPA, scrollbar_bg_opa, lv_opa_t, _opa, scalar)
_LV_OBJ_STYLE_SET_GET_DECLARE(SCROLLBAR_BORDER_OPA, scrollbar_border_opa, lv_opa_t, _opa, scalar)
#undef _LV_OBJ_STYLE_SET_GET_DECLARE
static inline void lv_obj_set_style_local_pad_all(lv_obj_t * obj, uint8_t part, lv_state_t state, lv_style_int_t value)
{
lv_obj_set_style_local_pad_top(obj, part, state, value);
lv_obj_set_style_local_pad_bottom(obj, part, state, value);
lv_obj_set_style_local_pad_left(obj, part, state, value);
lv_obj_set_style_local_pad_right(obj, part, state, value);
}
static inline void lv_style_set_pad_all(lv_style_t * style, lv_state_t state, lv_style_int_t value)
{
lv_style_set_pad_top(style, state, value);
lv_style_set_pad_bottom(style, state, value);
lv_style_set_pad_left(style, state, value);
lv_style_set_pad_right(style, state, value);
}
static inline void lv_obj_set_style_local_pad_hor(lv_obj_t * obj, uint8_t part, lv_state_t state, lv_style_int_t value)
{
lv_obj_set_style_local_pad_left(obj, part, state, value);
lv_obj_set_style_local_pad_right(obj, part, state, value);
}
static inline void lv_style_set_pad_hor(lv_style_t * style, lv_state_t state, lv_style_int_t value)
{
lv_style_set_pad_left(style, state, value);
lv_style_set_pad_right(style, state, value);
}
static inline void lv_obj_set_style_local_pad_ver(lv_obj_t * obj, uint8_t part, lv_state_t state, lv_style_int_t value)
{
lv_obj_set_style_local_pad_top(obj, part, state, value);
lv_obj_set_style_local_pad_bottom(obj, part, state, value);
}
static inline void lv_style_set_pad_ver(lv_style_t * style, lv_state_t state, lv_style_int_t value)
{
lv_style_set_pad_top(style, state, value);
lv_style_set_pad_bottom(style, state, value);
}
static inline void lv_obj_set_style_local_margin_all(lv_obj_t * obj, uint8_t part, lv_state_t state,
lv_style_int_t value)
{
lv_obj_set_style_local_margin_top(obj, part, state, value);
lv_obj_set_style_local_margin_bottom(obj, part, state, value);
lv_obj_set_style_local_margin_left(obj, part, state, value);
lv_obj_set_style_local_margin_right(obj, part, state, value);
}
static inline void lv_style_set_margin_all(lv_style_t * style, lv_state_t state, lv_style_int_t value)
{
lv_style_set_margin_top(style, state, value);
lv_style_set_margin_bottom(style, state, value);
lv_style_set_margin_left(style, state, value);
lv_style_set_margin_right(style, state, value);
}
static inline void lv_obj_set_style_local_margin_hor(lv_obj_t * obj, uint8_t part, lv_state_t state,
lv_style_int_t value)
{
lv_obj_set_style_local_margin_left(obj, part, state, value);
lv_obj_set_style_local_margin_right(obj, part, state, value);
}
static inline void lv_style_set_margin_hor(lv_style_t * style, lv_state_t state, lv_style_int_t value)
{
lv_style_set_margin_left(style, state, value);
lv_style_set_margin_right(style, state, value);
}
static inline void lv_obj_set_style_local_margin_ver(lv_obj_t * obj, uint8_t part, lv_state_t state,
lv_style_int_t value)
{
lv_obj_set_style_local_margin_top(obj, part, state, value);
lv_obj_set_style_local_margin_bottom(obj, part, state, value);
}
static inline void lv_style_set_margin_ver(lv_style_t * style, lv_state_t state, lv_style_int_t value)
{
lv_style_set_margin_top(style, state, value);
lv_style_set_margin_bottom(style, state, value);
}
#ifdef __cplusplus
} /* extern "C" */
#endif

View File

@ -598,9 +598,9 @@ static lv_obj_t * lv_refr_get_top_obj(const lv_area_t * area_p, lv_obj_t * obj)
if(design_res == LV_DESIGN_RES_MASKED) return NULL;
#if LV_USE_OPA_SCALE
if(design_res == LV_DESIGN_RES_COVER && lv_obj_get_style_opa_scale(obj, LV_OBJ_PART_MAIN) != LV_OPA_COVER) {
design_res = LV_DESIGN_RES_NOT_COVER;
}
// if(design_res == LV_DESIGN_RES_COVER && lv_obj_get_style_opa_scale(obj, LV_PART_MAIN) != LV_OPA_COVER) {
// design_res = LV_DESIGN_RES_NOT_COVER;
// }
#endif
uint32_t i;

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -75,7 +75,7 @@ void lv_draw_arc(lv_coord_t center_x, lv_coord_t center_y, uint16_t radius, uin
if(dsc->width == 0) return;
if(start_angle == end_angle) return;
lv_style_int_t width = dsc->width;
lv_coord_t width = dsc->width;
if(width > radius) width = radius;
lv_draw_rect_dsc_t cir_dsc;

View File

@ -32,8 +32,8 @@ typedef struct {
lv_color_t sel_bg_color;
const lv_font_t * font;
lv_opa_t opa;
lv_style_int_t line_space;
lv_style_int_t letter_space;
lv_coord_t line_space;
lv_coord_t letter_space;
uint32_t sel_start;
uint32_t sel_end;
lv_coord_t ofs_x;

View File

@ -173,7 +173,7 @@ LV_ATTRIBUTE_FAST_MEM static void draw_line_hor(const lv_point_t * point1, const
fill_area.y1 = draw_area.y1 + disp_area->y1;
fill_area.y2 = fill_area.y1;
lv_style_int_t dash_start = 0;
lv_coord_t dash_start = 0;
if(dashed) {
dash_start = (vdb->area.x1 + draw_area.x1) % (dsc->dash_gap + dsc->dash_width);
}
@ -186,7 +186,7 @@ LV_ATTRIBUTE_FAST_MEM static void draw_line_hor(const lv_point_t * point1, const
if(dashed) {
if(mask_res != LV_DRAW_MASK_RES_TRANSP) {
lv_style_int_t dash_cnt = dash_start;
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) {
@ -276,12 +276,12 @@ LV_ATTRIBUTE_FAST_MEM static void draw_line_ver(const lv_point_t * point1, const
lv_opa_t * mask_buf = _lv_mem_buf_get(draw_area_w);
lv_style_int_t dash_start = 0;
lv_coord_t dash_start = 0;
if(dashed) {
dash_start = (vdb->area.y1 + draw_area.y1) % (dsc->dash_gap + dsc->dash_width);
}
lv_style_int_t dash_cnt = dash_start;
lv_coord_t dash_cnt = dash_start;
int32_t h;
for(h = draw_area.y1; h <= draw_area.y2; h++) {

View File

@ -24,9 +24,9 @@ extern "C" {
**********************/
typedef struct {
lv_color_t color;
lv_style_int_t width;
lv_style_int_t dash_width;
lv_style_int_t dash_gap;
lv_coord_t width;
lv_coord_t dash_width;
lv_coord_t dash_gap;
lv_opa_t opa;
lv_blend_mode_t blend_mode : 2;
uint8_t round_start : 1;

View File

@ -78,14 +78,12 @@ LV_ATTRIBUTE_FAST_MEM void lv_draw_rect_dsc_init(lv_draw_rect_dsc_t * dsc)
dsc->bg_color = LV_COLOR_WHITE;
dsc->bg_grad_color = LV_COLOR_BLACK;
dsc->border_color = LV_COLOR_BLACK;
dsc->pattern_recolor = LV_COLOR_BLACK;
dsc->value_color = LV_COLOR_BLACK;
dsc->shadow_color = LV_COLOR_BLACK;
dsc->bg_grad_color_stop = 0xFF;
dsc->bg_opa = LV_OPA_COVER;
dsc->outline_opa = LV_OPA_COVER;
dsc->border_opa = LV_OPA_COVER;
dsc->pattern_opa = LV_OPA_COVER;
dsc->pattern_font = LV_THEME_DEFAULT_FONT_NORMAL;
dsc->value_opa = LV_OPA_COVER;
dsc->value_font = LV_THEME_DEFAULT_FONT_NORMAL;
@ -1186,10 +1184,9 @@ static void draw_outline(const lv_area_t * coords, const lv_area_t * clip, const
#if LV_USE_PATTERN
static void draw_pattern(const lv_area_t * coords, const lv_area_t * clip, const lv_draw_rect_dsc_t * dsc)
{
if(dsc->pattern_image == NULL) return;
if(dsc->pattern_opa <= LV_OPA_MIN) return;
if(dsc->bg_img_src == NULL) return;
lv_img_src_t src_type = lv_img_src_get_type(dsc->pattern_image);
lv_img_src_t src_type = lv_img_src_get_type(dsc->bg_img_src);
lv_draw_img_dsc_t img_dsc;
lv_draw_label_dsc_t label_dsc;
@ -1198,7 +1195,7 @@ static void draw_pattern(const lv_area_t * coords, const lv_area_t * clip, const
if(src_type == LV_IMG_SRC_FILE || src_type == LV_IMG_SRC_VARIABLE) {
lv_img_header_t header;
lv_res_t res = lv_img_decoder_get_info(dsc->pattern_image, &header);
lv_res_t res = lv_img_decoder_get_info(dsc->bg_img_src, &header);
if(res != LV_RES_OK) {
LV_LOG_WARN("draw_img: can't get image info");
return;
@ -1208,17 +1205,15 @@ static void draw_pattern(const lv_area_t * coords, const lv_area_t * clip, const
img_h = header.h;
lv_draw_img_dsc_init(&img_dsc);
img_dsc.opa = dsc->pattern_opa;
img_dsc.recolor_opa = dsc->pattern_recolor_opa;
img_dsc.recolor = dsc->pattern_recolor;
// img_dsc.opa = dsc->pattern_opa;
}
else if(src_type == LV_IMG_SRC_SYMBOL) {
lv_draw_label_dsc_init(&label_dsc);
label_dsc.color = dsc->pattern_recolor;
// label_dsc.color = dsc->pattern_recolor;
label_dsc.font = dsc->pattern_font;
label_dsc.opa = dsc->pattern_opa;
// label_dsc.opa = dsc->pattern_opa;
lv_point_t s;
_lv_txt_get_size(&s, dsc->pattern_image, label_dsc.font, label_dsc.letter_space, label_dsc.line_space, LV_COORD_MAX,
_lv_txt_get_size(&s, dsc->bg_img_src, label_dsc.font, label_dsc.letter_space, label_dsc.line_space, LV_COORD_MAX,
LV_TXT_FLAG_NONE);
img_w = s.x;
img_h = s.y;
@ -1236,7 +1231,7 @@ static void draw_pattern(const lv_area_t * coords, const lv_area_t * clip, const
lv_area_t coords_tmp;
if(dsc->pattern_repeat) {
if(dsc->bg_img_mosaic) {
lv_draw_mask_radius_param_t radius_mask_param;
lv_draw_mask_radius_init(&radius_mask_param, coords, dsc->radius, false);
int16_t radius_mask_id = lv_draw_mask_add(&radius_mask_param, NULL);
@ -1251,8 +1246,8 @@ static void draw_pattern(const lv_area_t * coords, const lv_area_t * clip, const
coords_tmp.x1 = coords->x1 - ofs_x;
coords_tmp.x2 = coords_tmp.x1 + img_w - 1;
for(; coords_tmp.x1 <= coords->x2; coords_tmp.x1 += img_w, coords_tmp.x2 += img_w) {
if(src_type == LV_IMG_SRC_SYMBOL) lv_draw_label(&coords_tmp, clip, &label_dsc, dsc->pattern_image, NULL);
else lv_draw_img(&coords_tmp, clip, dsc->pattern_image, &img_dsc);
if(src_type == LV_IMG_SRC_SYMBOL) lv_draw_label(&coords_tmp, clip, &label_dsc, dsc->bg_img_src, NULL);
else lv_draw_img(&coords_tmp, clip, dsc->bg_img_src, &img_dsc);
}
}
lv_draw_mask_remove_id(radius_mask_id);
@ -1281,8 +1276,8 @@ static void draw_pattern(const lv_area_t * coords, const lv_area_t * clip, const
radius_mask_id = lv_draw_mask_add(&radius_mask_param, NULL);
}
if(src_type == LV_IMG_SRC_SYMBOL) lv_draw_label(&coords_tmp, clip, &label_dsc, dsc->pattern_image, NULL);
else lv_draw_img(&coords_tmp, clip, dsc->pattern_image, &img_dsc);
if(src_type == LV_IMG_SRC_SYMBOL) lv_draw_label(&coords_tmp, clip, &label_dsc, dsc->bg_img_src, NULL);
else lv_draw_img(&coords_tmp, clip, dsc->bg_img_src, &img_dsc);
lv_draw_mask_remove_id(radius_mask_id);
}

View File

@ -24,48 +24,46 @@ extern "C" {
**********************/
typedef struct {
lv_style_int_t radius;
lv_coord_t radius;
/*Background*/
lv_color_t bg_color;
lv_color_t bg_grad_color;
lv_grad_dir_t bg_grad_dir;
lv_style_int_t bg_main_color_stop;
lv_style_int_t bg_grad_color_stop;
uint8_t bg_main_color_stop;
uint8_t bg_grad_color_stop;
lv_opa_t bg_opa;
lv_blend_mode_t bg_blend_mode;
/*Border*/
lv_color_t border_color;
lv_style_int_t border_width;
lv_style_int_t border_side;
lv_coord_t border_width;
lv_border_side_t border_side;
lv_opa_t border_opa;
lv_blend_mode_t border_blend_mode;
uint8_t border_post : 1; /*There is a border it will be drawn later. */
/*Outline*/
lv_color_t outline_color;
lv_style_int_t outline_width;
lv_style_int_t outline_pad;
lv_coord_t outline_width;
lv_coord_t outline_pad;
lv_opa_t outline_opa;
lv_blend_mode_t outline_blend_mode;
/*Shadow*/
lv_color_t shadow_color;
lv_style_int_t shadow_width;
lv_style_int_t shadow_ofs_x;
lv_style_int_t shadow_ofs_y;
lv_style_int_t shadow_spread;
lv_coord_t shadow_width;
lv_coord_t shadow_ofs_x;
lv_coord_t shadow_ofs_y;
lv_coord_t shadow_spread;
lv_opa_t shadow_opa;
lv_blend_mode_t shadow_blend_mode;
/*Pattern*/
const void * pattern_image;
const void * bg_img_src;
const lv_font_t * pattern_font;
lv_color_t pattern_recolor;
lv_opa_t pattern_opa;
lv_opa_t pattern_recolor_opa;
uint8_t pattern_repeat : 1;
lv_opa_t bg_img_opa;
uint8_t bg_img_mosaic : 1;
lv_blend_mode_t pattern_blend_mode;
/*Value*/
@ -73,10 +71,10 @@ typedef struct {
const lv_font_t * value_font;
lv_opa_t value_opa;
lv_color_t value_color;
lv_style_int_t value_ofs_x;
lv_style_int_t value_ofs_y;
lv_style_int_t value_letter_space;
lv_style_int_t value_line_space;
lv_coord_t value_ofs_x;
lv_coord_t value_ofs_y;
lv_coord_t value_letter_space;
lv_coord_t value_line_space;
lv_align_t value_align;
lv_blend_mode_t value_blend_mode;
} lv_draw_rect_dsc_t;

View File

@ -155,8 +155,8 @@ lv_disp_t * lv_disp_drv_register(lv_disp_drv_t * driver)
disp->act_scr = lv_obj_create(NULL, NULL); /*Create a default screen on the display*/
disp->top_layer = lv_obj_create(NULL, NULL); /*Create top layer on the display*/
disp->sys_layer = lv_obj_create(NULL, NULL); /*Create sys layer on the display*/
lv_obj_reset_style_list(disp->top_layer, LV_OBJ_PART_MAIN);
lv_obj_reset_style_list(disp->sys_layer, LV_OBJ_PART_MAIN);
lv_obj_remove_all_styles(disp->top_layer);
lv_obj_remove_all_styles(disp->sys_layer);
lv_obj_clear_flag(disp->top_layer, LV_OBJ_FLAG_CLICKABLE);
lv_obj_clear_flag(disp->sys_layer, LV_OBJ_FLAG_CLICKABLE);

View File

@ -161,8 +161,6 @@ void * lv_mem_alloc(size_t size)
return &zero_mem;
}
printf("alloc:%d\n", size);
#ifdef LV_ARCH_64
/*Round the size up to 8*/
size = (size + 7) & (~0x7);

View File

@ -20,7 +20,6 @@
* STATIC PROTOTYPES
**********************/
static void apply_theme(lv_theme_t * th, lv_obj_t * obj, lv_theme_style_t name);
static void clear_styles(lv_obj_t * obj, lv_theme_style_t name);
/**********************
* STATIC VARIABLES
@ -62,7 +61,7 @@ lv_theme_t * lv_theme_get_act(void)
void lv_theme_apply(lv_obj_t * obj, lv_theme_style_t name)
{
/* Remove the existing styles from all part of the object. */
clear_styles(obj, name);
lv_obj_remove_all_styles(obj);
/*Apply the theme including the base theme(s)*/
@ -198,155 +197,3 @@ static void apply_theme(lv_theme_t * th, lv_obj_t * obj, lv_theme_style_t name)
th->apply_cb(act_theme, obj, name);
}
}
static void clear_styles(lv_obj_t * obj, lv_theme_style_t name)
{
switch(name) {
case LV_THEME_NONE:
break;
case LV_THEME_SCR:
_lv_obj_reset_style_list_no_refr(obj, LV_OBJ_PART_MAIN);
break;
case LV_THEME_OBJ:
_lv_obj_reset_style_list_no_refr(obj, LV_OBJ_PART_MAIN);
break;
#if LV_USE_BTN
case LV_THEME_BTN:
_lv_obj_reset_style_list_no_refr(obj, LV_BTN_PART_MAIN);
break;
#endif
#if LV_USE_BTNMATRIX
case LV_THEME_BTNMATRIX:
_lv_obj_reset_style_list_no_refr(obj, LV_BTNMATRIX_PART_MAIN);
_lv_obj_reset_style_list_no_refr(obj, LV_BTNMATRIX_PART_BTN);
break;
#endif
#if LV_USE_BAR
case LV_THEME_BAR:
_lv_obj_reset_style_list_no_refr(obj, LV_BAR_PART_MAIN);
_lv_obj_reset_style_list_no_refr(obj, LV_BAR_PART_INDIC);
break;
#endif
#if LV_USE_SWITCH
case LV_THEME_SWITCH:
_lv_obj_reset_style_list_no_refr(obj, LV_SWITCH_PART_MAIN);
_lv_obj_reset_style_list_no_refr(obj, LV_SWITCH_PART_INDIC);
_lv_obj_reset_style_list_no_refr(obj, LV_SWITCH_PART_KNOB);
break;
#endif
#if LV_USE_IMG
case LV_THEME_IMAGE:
_lv_obj_reset_style_list_no_refr(obj, LV_IMG_PART_MAIN);
break;
#endif
#if LV_USE_IMGBTN
case LV_THEME_IMGBTN:
_lv_obj_reset_style_list_no_refr(obj, LV_IMG_PART_MAIN);
break;
#endif
#if LV_USE_LABEL
case LV_THEME_LABEL:
_lv_obj_reset_style_list_no_refr(obj, LV_LABEL_PART_MAIN);
break;
#endif
#if LV_USE_LINE
case LV_THEME_LINE:
_lv_obj_reset_style_list_no_refr(obj, LV_LABEL_PART_MAIN);
break;
#endif
#if LV_USE_ARC
case LV_THEME_ARC:
_lv_obj_reset_style_list_no_refr(obj, LV_ARC_PART_BG);
_lv_obj_reset_style_list_no_refr(obj, LV_ARC_PART_INDIC);
break;
#endif
#if LV_USE_SLIDER
case LV_THEME_SLIDER:
_lv_obj_reset_style_list_no_refr(obj, LV_SLIDER_PART_MAIN);
_lv_obj_reset_style_list_no_refr(obj, LV_SLIDER_PART_INDIC);
_lv_obj_reset_style_list_no_refr(obj, LV_SLIDER_PART_KNOB);
break;
#endif
#if LV_USE_CHECKBOX
case LV_THEME_CHECKBOX:
_lv_obj_reset_style_list_no_refr(obj, LV_CHECKBOX_PART_MAIN);
_lv_obj_reset_style_list_no_refr(obj, LV_CHECKBOX_PART_BULLET);
break;
#endif
#if LV_USE_ROLLER
case LV_THEME_ROLLER:
_lv_obj_reset_style_list_no_refr(obj, LV_ROLLER_PART_BG);
_lv_obj_reset_style_list_no_refr(obj, LV_ROLLER_PART_SELECTED);
break;
#endif
#if LV_USE_OBJMASK
case LV_THEME_OBJMASK:
_lv_obj_reset_style_list_no_refr(obj, LV_OBJMASK_PART_MAIN);
break;
#endif
#if LV_USE_DROPDOWN
case LV_THEME_DROPDOWN:
_lv_obj_reset_style_list_no_refr(obj, LV_DROPDOWN_PART_MAIN);
_lv_obj_reset_style_list_no_refr(obj, LV_DROPDOWN_PART_LIST);
_lv_obj_reset_style_list_no_refr(obj, LV_DROPDOWN_PART_SELECTED);
break;
#endif
#if LV_USE_CHART
case LV_THEME_CHART:
_lv_obj_reset_style_list_no_refr(obj, LV_CHART_PART_BG);
_lv_obj_reset_style_list_no_refr(obj, LV_CHART_PART_SERIES_BG);
_lv_obj_reset_style_list_no_refr(obj, LV_CHART_PART_SERIES);
break;
#endif
#if LV_USE_TABLE
case LV_THEME_TABLE:
_lv_obj_reset_style_list_no_refr(obj, LV_TABLE_PART_BG);
_lv_obj_reset_style_list_no_refr(obj, LV_TABLE_PART_CELL1);
_lv_obj_reset_style_list_no_refr(obj, LV_TABLE_PART_CELL2);
_lv_obj_reset_style_list_no_refr(obj, LV_TABLE_PART_CELL3);
_lv_obj_reset_style_list_no_refr(obj, LV_TABLE_PART_CELL4);
break;
#endif
#if LV_USE_TEXTAREA
case LV_THEME_TEXTAREA:
_lv_obj_reset_style_list_no_refr(obj, LV_TEXTAREA_PART_MAIN);
_lv_obj_reset_style_list_no_refr(obj, LV_TEXTAREA_PART_PLACEHOLDER);
_lv_obj_reset_style_list_no_refr(obj, LV_TEXTAREA_PART_CURSOR);
break;
#endif
#if LV_USE_LINEMETER
case LV_THEME_LINEMETER:
_lv_obj_reset_style_list_no_refr(obj, LV_LINEMETER_PART_MAIN);
break;
#endif
#if LV_USE_GAUGE
case LV_THEME_GAUGE:
_lv_obj_reset_style_list_no_refr(obj, LV_GAUGE_PART_MAIN);
_lv_obj_reset_style_list_no_refr(obj, LV_GAUGE_PART_MAJOR);
_lv_obj_reset_style_list_no_refr(obj, LV_GAUGE_PART_NEEDLE);
break;
#endif
default:
break;
}
}

View File

@ -87,7 +87,7 @@ lv_theme_t * lv_theme_empty_init(lv_color_t color_primary, lv_color_t color_seco
theme.flags = flags;
style_init_reset(&styles->opa_cover);
lv_style_set_bg_opa(&styles->opa_cover, LV_STATE_DEFAULT, LV_OPA_COVER);
lv_style_set_bg_opa(&styles->opa_cover, LV_OPA_COVER);
theme.apply_xcb = NULL;
theme.apply_cb = theme_apply;
@ -99,8 +99,7 @@ static void theme_apply(lv_theme_t * th, lv_obj_t * obj, lv_theme_style_t name)
{
LV_UNUSED(th);
if(name == LV_THEME_SCR) {
_lv_obj_reset_style_list_no_refr(obj, LV_OBJ_PART_MAIN);
lv_obj_add_style(obj, LV_OBJ_PART_MAIN, &styles->opa_cover);
lv_obj_add_style(obj, LV_PART_MAIN, LV_STATE_DEFAULT, &styles->opa_cover);
}
}

View File

@ -47,8 +47,6 @@ LV_CLASS_DECLARE_START(lv_arc, lv_obj);
uint16_t indic_angle_end; \
uint16_t bg_angle_start; \
uint16_t bg_angle_end; \
lv_style_list_t style_arc; \
lv_style_list_t style_knob; /* Style of the knob */ \
int16_t value; /*Current value of the arc*/ \
int16_t min_value; /*Minimum value of the arc*/ \
int16_t max_value; /*Maximum value of the arc*/ \

View File

@ -553,16 +553,16 @@ static void draw_indic(lv_obj_t * obj, const lv_area_t * clip_area)
lv_opa_t bg_opa = draw_indic_dsc.bg_opa;
lv_opa_t border_opa = draw_indic_dsc.border_opa;
lv_opa_t value_opa = draw_indic_dsc.value_opa;
const void * pattern_src = draw_indic_dsc.pattern_image;
const void * pattern_src = draw_indic_dsc.bg_img_src;
draw_indic_dsc.bg_opa = LV_OPA_TRANSP;
draw_indic_dsc.border_opa = LV_OPA_TRANSP;
draw_indic_dsc.value_opa = LV_OPA_TRANSP;
draw_indic_dsc.pattern_image = NULL;
draw_indic_dsc.bg_img_src = NULL;
lv_draw_rect(&bar->indic_area, clip_area, &draw_indic_dsc);
draw_indic_dsc.bg_opa = bg_opa;
draw_indic_dsc.border_opa = border_opa;
draw_indic_dsc.value_opa = value_opa;
draw_indic_dsc.pattern_image = pattern_src;
draw_indic_dsc.bg_img_src = pattern_src;
}
@ -608,7 +608,7 @@ static void draw_indic(lv_obj_t * obj, const lv_area_t * clip_area)
draw_indic_dsc.bg_opa = LV_OPA_TRANSP;
draw_indic_dsc.shadow_opa = LV_OPA_TRANSP;
draw_indic_dsc.value_opa = LV_OPA_TRANSP;
draw_indic_dsc.pattern_image = NULL;
draw_indic_dsc.bg_img_src = NULL;
lv_draw_rect(&bar->indic_area, clip_area, &draw_indic_dsc);
lv_draw_mask_remove_id(mask_indic_id);