BigW Consortium Gitlab

Commit 27fa1699 by Gabor

lv_img transp_en moved to img header + minor modsin objx

parent 2666ed5f
...@@ -33,7 +33,7 @@ void lv_draw_label(const area_t * cords_p,const area_t * mask_p, ...@@ -33,7 +33,7 @@ void lv_draw_label(const area_t * cords_p,const area_t * mask_p,
void lv_draw_line(const point_t * p1, const point_t * p2, const area_t * mask_p, void lv_draw_line(const point_t * p1, const point_t * p2, const area_t * mask_p,
const lv_lines_t * lines_p, opa_t opa); const lv_lines_t * lines_p, opa_t opa);
void lv_draw_img(const area_t * cords_p, const area_t * mask_p, void lv_draw_img(const area_t * cords_p, const area_t * mask_p,
const lv_imgs_t * imgs_p, opa_t opa, const char * fn, const color_t * map_p); const lv_imgs_t * imgs_p, opa_t opa, const char * fn);
/********************** /**********************
* MACROS * MACROS
**********************/ **********************/
......
...@@ -110,7 +110,8 @@ void lv_rletter(const point_t * pos_p, const area_t * mask_p, ...@@ -110,7 +110,8 @@ void lv_rletter(const point_t * pos_p, const area_t * mask_p,
* @param transp true: enable transparency of LV_IMG_COLOR_TRANSP color pixels * @param transp true: enable transparency of LV_IMG_COLOR_TRANSP color pixels
*/ */
void lv_rmap(const area_t * cords_p, const area_t * mask_p, void lv_rmap(const area_t * cords_p, const area_t * mask_p,
const color_t * map_p, opa_t opa, bool transp) const color_t * map_p, opa_t opa, bool transp,
color_t recolor, color_t recolor_opa)
{ {
area_t masked_a; area_t masked_a;
bool union_ok; bool union_ok;
......
...@@ -30,7 +30,8 @@ void lv_rletter(const point_t * pos_p, const area_t * mask_p, ...@@ -30,7 +30,8 @@ void lv_rletter(const point_t * pos_p, const area_t * mask_p,
const font_t * font_p, uint8_t letter, const font_t * font_p, uint8_t letter,
color_t color, opa_t opa); color_t color, opa_t opa);
void lv_rmap(const area_t * cords_p, const area_t * mask_p, void lv_rmap(const area_t * cords_p, const area_t * mask_p,
const color_t * map_p, opa_t opa, bool transp); const color_t * map_p, opa_t opa, bool transp,
color_t recolor, color_t recolor_opa);
/********************** /**********************
* MACROS * MACROS
**********************/ **********************/
......
...@@ -146,7 +146,8 @@ void lv_vletter(const point_t * pos_p, const area_t * mask_p, ...@@ -146,7 +146,8 @@ void lv_vletter(const point_t * pos_p, const area_t * mask_p,
* @param transp true: enable transparency of LV_IMG_COLOR_TRANSP color pixels * @param transp true: enable transparency of LV_IMG_COLOR_TRANSP color pixels
*/ */
void lv_vmap(const area_t * cords_p, const area_t * mask_p, void lv_vmap(const area_t * cords_p, const area_t * mask_p,
const color_t * map_p, opa_t opa, bool transp) const color_t * map_p, opa_t opa, bool transp,
color_t recolor, opa_t recolor_opa)
{ {
area_t masked_a; area_t masked_a;
bool union_ok; bool union_ok;
...@@ -196,6 +197,7 @@ void lv_vmap(const area_t * cords_p, const area_t * mask_p, ...@@ -196,6 +197,7 @@ void lv_vmap(const area_t * cords_p, const area_t * mask_p,
cord_t row; cord_t row;
cord_t col; cord_t col;
color_t transp_color = LV_IMG_COLOR_TRANSP; color_t transp_color = LV_IMG_COLOR_TRANSP;
color_t color_tmp;
cord_t map_i; cord_t map_i;
map_p -= map_width; /*Compensate the first row % LV_DOWNSCALE*/ map_p -= map_width; /*Compensate the first row % LV_DOWNSCALE*/
for(row = masked_a.y1; row <= masked_a.y2; row++) { for(row = masked_a.y1; row <= masked_a.y2; row++) {
...@@ -203,9 +205,12 @@ void lv_vmap(const area_t * cords_p, const area_t * mask_p, ...@@ -203,9 +205,12 @@ void lv_vmap(const area_t * cords_p, const area_t * mask_p,
map_i = masked_a.x1 >> ds_shift; map_i = masked_a.x1 >> ds_shift;
map_i--; /*Compensate the first col % LV_DOWNSCALE*/ map_i--; /*Compensate the first col % LV_DOWNSCALE*/
for(col = masked_a.x1; col <= masked_a.x2; col++) { for(col = masked_a.x1; col <= masked_a.x2; col++) {
if(col % LV_DOWNSCALE == 0) map_i++; if(col % LV_DOWNSCALE == 0) {
map_i++;
color_tmp = color_mix(recolor, map_p[map_i], recolor_opa);
}
if(transp == false || map_p[map_i].full != transp_color.full) { if(transp == false || map_p[map_i].full != transp_color.full) {
vdb_buf_tmp[col] = color_mix(map_p[map_i], vdb_buf_tmp[col], opa); vdb_buf_tmp[col] = color_mix(color_tmp, vdb_buf_tmp[col], opa);
} }
} }
vdb_buf_tmp += vdb_width; /*Next row on the VDB*/ vdb_buf_tmp += vdb_width; /*Next row on the VDB*/
...@@ -232,32 +237,70 @@ void lv_vmap(const area_t * cords_p, const area_t * mask_p, ...@@ -232,32 +237,70 @@ void lv_vmap(const area_t * cords_p, const area_t * mask_p,
vdb_buf_tmp += vdb_width; /*Next row on the VDB*/ vdb_buf_tmp += vdb_width; /*Next row on the VDB*/
} }
} }
/*To recolor draw simply a rectangle above the image*/
#if LV_VDB_SIZE != 0
lv_vfill(cords_p, mask_p, recolor, recolor_opa);
#endif
} else { /*transp == true: Check all pixels */ } else { /*transp == true: Check all pixels */
cord_t row; cord_t row;
cord_t col; cord_t col;
color_t transp_color = LV_IMG_COLOR_TRANSP; color_t transp_color = LV_IMG_COLOR_TRANSP;
if(opa == OPA_COVER) { /*no opa */
for(row = masked_a.y1; row <= masked_a.y2; row++) {
for(col = masked_a.x1; col <= masked_a.x2; col ++) {
if(map_p[col].full != transp_color.full) {
vdb_buf_tmp[col] = map_p[col];
}
}
map_p += map_width; /*Next row on the map*/
vdb_buf_tmp += vdb_width; /*Next row on the VDB*/
}
} else {
for(row = masked_a.y1; row <= masked_a.y2; row++) {
for(col = masked_a.x1; col <= masked_a.x2; col ++) {
if(map_p[col].full != transp_color.full) {
vdb_buf_tmp[col] = color_mix( map_p[col], vdb_buf_tmp[col], opa);
}
}
map_p += map_width; /*Next row on the map*/ if(recolor_opa == OPA_TRANSP)/*No recolor*/
vdb_buf_tmp += vdb_width; /*Next row on the VDB*/ {
} if(opa == OPA_COVER) { /*no opa */
for(row = masked_a.y1; row <= masked_a.y2; row++) {
for(col = masked_a.x1; col <= masked_a.x2; col ++) {
if(map_p[col].full != transp_color.full) {
vdb_buf_tmp[col] = map_p[col];
}
}
map_p += map_width; /*Next row on the map*/
vdb_buf_tmp += vdb_width; /*Next row on the VDB*/
}
} else {
for(row = masked_a.y1; row <= masked_a.y2; row++) {
for(col = masked_a.x1; col <= masked_a.x2; col ++) {
if(map_p[col].full != transp_color.full) {
vdb_buf_tmp[col] = color_mix( map_p[col], vdb_buf_tmp[col], opa);
}
}
map_p += map_width; /*Next row on the map*/
vdb_buf_tmp += vdb_width; /*Next row on the VDB*/
}
}
} else { /*Recolor needed*/
color_t color_tmp;
if(opa == OPA_COVER) { /*no opa */
for(row = masked_a.y1; row <= masked_a.y2; row++) {
for(col = masked_a.x1; col <= masked_a.x2; col ++) {
if(map_p[col].full != transp_color.full) {
color_tmp = color_mix(recolor, map_p[col], recolor_opa);
vdb_buf_tmp[col] = color_tmp;
}
}
map_p += map_width; /*Next row on the map*/
vdb_buf_tmp += vdb_width; /*Next row on the VDB*/
}
} else {
for(row = masked_a.y1; row <= masked_a.y2; row++) {
for(col = masked_a.x1; col <= masked_a.x2; col ++) {
if(map_p[col].full != transp_color.full) {
color_tmp = color_mix(recolor, map_p[col], recolor_opa);
vdb_buf_tmp[col] = color_mix(color_tmp, vdb_buf_tmp[col], opa);
}
}
map_p += map_width; /*Next row on the map*/
vdb_buf_tmp += vdb_width; /*Next row on the VDB*/
}
}
} }
} }
#endif /*No upscale and no downscale*/ #endif /*No upscale and no downscale*/
...@@ -347,4 +390,9 @@ static bool lv_vletter_get_px(const font_t * font_p, uint8_t letter, cord_t x, c ...@@ -347,4 +390,9 @@ static bool lv_vletter_get_px(const font_t * font_p, uint8_t letter, cord_t x, c
if((map_byte & (1 << col_sub)) == 0) return false; if((map_byte & (1 << col_sub)) == 0) return false;
else return true; else return true;
} }
#endif #endif
...@@ -36,7 +36,8 @@ void lv_vletter(const point_t * pos_p, const area_t * mask_p, ...@@ -36,7 +36,8 @@ void lv_vletter(const point_t * pos_p, const area_t * mask_p,
color_t color, opa_t opa); color_t color, opa_t opa);
void lv_vmap(const area_t * cords_p, const area_t * mask_p, void lv_vmap(const area_t * cords_p, const area_t * mask_p,
const color_t * map_p, opa_t opa, bool transp); const color_t * map_p, opa_t opa, bool transp,
color_t recolor, color_t recolor_opa);
/********************** /**********************
......
...@@ -34,11 +34,10 @@ lv_obj_t* def_scr_dp = NULL; ...@@ -34,11 +34,10 @@ lv_obj_t* def_scr_dp = NULL;
lv_obj_t* act_scr_dp = NULL; lv_obj_t* act_scr_dp = NULL;
ll_dsc_t scr_ll; ll_dsc_t scr_ll;
lv_objs_t lv_objs_def = {.color = COLOR_GRAY, .empty = 0, .auto_color = 1}; lv_objs_t lv_objs_def = {.color = COLOR_GRAY, .empty = 0};
lv_objs_t lv_objs_color = {.color = COLOR_RED, .empty = 0, .auto_color = 0}; lv_objs_t lv_objs_scr = {.color = LV_OBJ_DEF_SCR_COLOR, .empty = 0};
lv_objs_t lv_objs_scr = {.color = LV_OBJ_DEF_SCR_COLOR, .empty = 0, .auto_color = 0}; lv_objs_t lv_objs_color = {.color = COLOR_RED, .empty = 0};
lv_objs_t lv_objs_empty = {.color = COLOR_GRAY, .empty = 1, .auto_color = 0}; lv_objs_t lv_objs_empty = {.color = COLOR_GRAY, .empty = 1};
lv_objs_t lv_objs_autocolor = {.color = COLOR_GRAY, .empty = 0, .auto_color = 1};
/********************** /**********************
* MACROS * MACROS
...@@ -336,9 +335,6 @@ lv_objs_t * lv_objs_get(lv_objs_builtin_t style, lv_objs_t * copy_p) ...@@ -336,9 +335,6 @@ lv_objs_t * lv_objs_get(lv_objs_builtin_t style, lv_objs_t * copy_p)
case LV_OBJS_EMPTY: case LV_OBJS_EMPTY:
style_p = &lv_objs_empty; style_p = &lv_objs_empty;
break; break;
case LV_OBJS_AUTOCOLOR:
style_p = &lv_objs_autocolor;
break;
default: default:
style_p = NULL; style_p = NULL;
} }
...@@ -1243,29 +1239,6 @@ static bool lv_obj_design(lv_obj_t* obj_dp, const area_t * mask_p, lv_design_mo ...@@ -1243,29 +1239,6 @@ static bool lv_obj_design(lv_obj_t* obj_dp, const area_t * mask_p, lv_design_mo
opa_t opa = lv_obj_get_opa(obj_dp); opa_t opa = lv_obj_get_opa(obj_dp);
color_t color = objs_p->color; color_t color = objs_p->color;
/*Calculate the color*/
if(objs_p->auto_color != 0) {
lv_obj_t* par_dp = lv_obj_get_parent(obj_dp);
if(par_dp == NULL) { /*If it is a screen use the default color*/
color = LV_OBJ_DEF_SCR_COLOR;
} else { /*Add a random color on every level*/
color = COLOR_WHITE;
while(par_dp != NULL) {
#if COLOR_DEPTH == 1
color.full ++;
#elif COLOR_DEPTH == 8
color.full += 0x52;
#elif COLOR_DEPTH == 16
color.full += 0xA953;
#elif COLOR_DEPTH == 24
color.full +=0x2963A9;
#endif
par_dp = lv_obj_get_parent(par_dp);
}
}
}
/*Simply draw a rectangle*/ /*Simply draw a rectangle*/
#if LV_VDB_SIZE == 0 #if LV_VDB_SIZE == 0
lv_rfill(&obj_dp->cords, mask_p, color, opa); lv_rfill(&obj_dp->cords, mask_p, color, opa);
......
...@@ -80,8 +80,8 @@ typedef struct __LV_OBJ_T ...@@ -80,8 +80,8 @@ typedef struct __LV_OBJ_T
area_t cords; area_t cords;
/*Basic appearance*/ /*Basic appearance*/
opa_t opa; opa_t opa;
/*Attributes and states*/ /*Attributes and states*/
uint8_t click_en :1; /*1: can be pressed by a display input device*/ uint8_t click_en :1; /*1: can be pressed by a display input device*/
uint8_t drag_en :1; /*1: enable the dragging*/ uint8_t drag_en :1; /*1: enable the dragging*/
...@@ -134,7 +134,6 @@ typedef struct ...@@ -134,7 +134,6 @@ typedef struct
{ {
color_t color; color_t color;
uint8_t empty :1; uint8_t empty :1;
uint8_t auto_color :1;
}lv_objs_t; }lv_objs_t;
typedef enum typedef enum
...@@ -143,7 +142,6 @@ typedef enum ...@@ -143,7 +142,6 @@ typedef enum
LV_OBJS_COLOR, LV_OBJS_COLOR,
LV_OBJS_SCR, LV_OBJS_SCR,
LV_OBJS_EMPTY, LV_OBJS_EMPTY,
LV_OBJS_AUTOCOLOR,
}lv_objs_builtin_t; }lv_objs_builtin_t;
/********************** /**********************
......
...@@ -351,7 +351,7 @@ lv_btns_t * lv_btns_get(lv_btns_builtin_t style, lv_btns_t * copy_p) ...@@ -351,7 +351,7 @@ lv_btns_t * lv_btns_get(lv_btns_builtin_t style, lv_btns_t * copy_p)
style_p = &lv_btns_border; style_p = &lv_btns_border;
break; break;
default: default:
style_p = NULL; style_p = &lv_btns_def;
} }
if(copy_p != NULL) { if(copy_p != NULL) {
......
...@@ -33,8 +33,9 @@ static bool lv_img_design(lv_obj_t* obj_dp, const area_t * mask_p, lv_design_mod ...@@ -33,8 +33,9 @@ static bool lv_img_design(lv_obj_t* obj_dp, const area_t * mask_p, lv_design_mod
/*----------------- /*-----------------
* Style definition * Style definition
*-----------------*/ *-----------------*/
static lv_imgs_t lv_imgs_def = {.transp_en = 0}; static lv_imgs_t lv_imgs_def = {.recolor_opa=OPA_TRANSP};
static lv_imgs_t lv_imgs_transp = {.transp_en = 1}; static lv_imgs_t lv_imgs_light = {.objs.color = COLOR_WHITE, .recolor_opa=OPA_50};
static lv_imgs_t lv_imgs_dark = {.objs.color = COLOR_BLACK, .recolor_opa=OPA_50};
/********************** /**********************
* MACROS * MACROS
...@@ -129,11 +130,14 @@ lv_imgs_t * lv_imgs_get(lv_imgs_builtin_t style, lv_imgs_t * copy_p) ...@@ -129,11 +130,14 @@ lv_imgs_t * lv_imgs_get(lv_imgs_builtin_t style, lv_imgs_t * copy_p)
case LV_IMGS_DEF: case LV_IMGS_DEF:
style_p = &lv_imgs_def; style_p = &lv_imgs_def;
break; break;
case LV_IMGS_TRANSP: case LV_IMGS_LIGHT:
style_p = &lv_imgs_transp; style_p = &lv_imgs_light;
break;
case LV_IMGS_DARK:
style_p = &lv_imgs_dark;
break; break;
default: default:
style_p = NULL; style_p = &lv_imgs_def;
} }
if(copy_p != NULL) { if(copy_p != NULL) {
...@@ -252,9 +256,10 @@ bool lv_img_get_auto_size(lv_obj_t* obj_dp) ...@@ -252,9 +256,10 @@ bool lv_img_get_auto_size(lv_obj_t* obj_dp)
*/ */
static bool lv_img_design(lv_obj_t* obj_dp, const area_t * mask_p, lv_design_mode_t mode) static bool lv_img_design(lv_obj_t* obj_dp, const area_t * mask_p, lv_design_mode_t mode)
{ {
lv_imgs_t * imgs_p = lv_obj_get_style(obj_dp);
if(mode == LV_DESIGN_COVER_CHK) { if(mode == LV_DESIGN_COVER_CHK) {
lv_imgs_t * imgs_p = lv_obj_get_style(obj_dp); if(imgs_p->objs.empty == 0) {
if(imgs_p->transp_en == 0) {
bool cover; bool cover;
cover = area_is_in(mask_p, &obj_dp->cords); cover = area_is_in(mask_p, &obj_dp->cords);
return cover; return cover;
...@@ -276,10 +281,9 @@ static bool lv_img_design(lv_obj_t* obj_dp, const area_t * mask_p, lv_design_mod ...@@ -276,10 +281,9 @@ static bool lv_img_design(lv_obj_t* obj_dp, const area_t * mask_p, lv_design_mod
cords_tmp.x1 = cords.x1; cords_tmp.x1 = cords.x1;
cords_tmp.x2 = cords.x1 + img_ext_p->w - 1; cords_tmp.x2 = cords.x1 + img_ext_p->w - 1;
for(; cords_tmp.x1 < cords.x2; cords_tmp.x1 += img_ext_p->w, cords_tmp.x2 += img_ext_p->w) { for(; cords_tmp.x1 < cords.x2; cords_tmp.x1 += img_ext_p->w, cords_tmp.x2 += img_ext_p->w) {
lv_draw_img(&cords_tmp, mask_p, lv_obj_get_style(obj_dp),opa, img_ext_p->fn_dp, NULL); lv_draw_img(&cords_tmp, mask_p, lv_obj_get_style(obj_dp),opa, img_ext_p->fn_dp);
} }
} }
return true; return true;
} }
......
...@@ -26,7 +26,7 @@ ...@@ -26,7 +26,7 @@
typedef struct typedef struct
{ {
lv_objs_t objs; lv_objs_t objs;
uint8_t transp_en :1; opa_t recolor_opa;
}lv_imgs_t; }lv_imgs_t;
typedef struct typedef struct
...@@ -34,21 +34,22 @@ typedef struct ...@@ -34,21 +34,22 @@ typedef struct
char* fn_dp; char* fn_dp;
cord_t w; cord_t w;
cord_t h; cord_t h;
uint8_t auto_size :1; uint8_t auto_size :1;
}lv_img_ext_t; }lv_img_ext_t;
typedef enum typedef enum
{ {
LV_IMGS_DEF, LV_IMGS_DEF,
LV_IMGS_TRANSP LV_IMGS_LIGHT,
LV_IMGS_DARK,
}lv_imgs_builtin_t; }lv_imgs_builtin_t;
typedef struct typedef struct
{ {
uint16_t w; uint16_t w;
uint16_t h; uint16_t h;
uint16_t res1; uint16_t cd; /*Color depth*/
uint16_t res2; uint16_t transp :1; /*Do not draw LV_IMG_TRANSP_COLOR pixels*/
}lv_img_raw_header_t; }lv_img_raw_header_t;
......
...@@ -32,25 +32,25 @@ static bool lv_label_design(lv_obj_t* obj_dp, const area_t * mask_p, lv_design_m ...@@ -32,25 +32,25 @@ static bool lv_label_design(lv_obj_t* obj_dp, const area_t * mask_p, lv_design_m
* STATIC VARIABLES * STATIC VARIABLES
**********************/ **********************/
static lv_labels_t lv_labels_def = { static lv_labels_t lv_labels_def = {
.font = LV_FONT_DEFAULT, .color = COLOR_MAKE(0x10, 0x18, 0x20), .font = LV_FONT_DEFAULT, .objs.color = COLOR_MAKE(0x10, 0x18, 0x20),
.letter_space = 2 * LV_STYLE_MULT, .line_space = 2 * LV_STYLE_MULT, .letter_space = 2 * LV_STYLE_MULT, .line_space = 2 * LV_STYLE_MULT,
.mid = 1 .mid = 1
}; };
static lv_labels_t lv_labels_btn = { static lv_labels_t lv_labels_btn = {
.font = LV_FONT_DEFAULT, .color = COLOR_MAKE(0xd0, 0xe0, 0xf0), .font = LV_FONT_DEFAULT, .objs.color = COLOR_MAKE(0xd0, 0xe0, 0xf0),
.letter_space = 2 * LV_STYLE_MULT, .line_space = 2 * LV_STYLE_MULT, .letter_space = 2 * LV_STYLE_MULT, .line_space = 2 * LV_STYLE_MULT,
.mid = 1, .mid = 1,
}; };
static lv_labels_t lv_labels_title = { static lv_labels_t lv_labels_title = {
.font = LV_FONT_DEFAULT, .color = COLOR_MAKE(0x10, 0x20, 0x30), .font = LV_FONT_DEFAULT, .objs.color = COLOR_MAKE(0x10, 0x20, 0x30),
.letter_space = 4 * LV_STYLE_MULT, .line_space = 4 * LV_STYLE_MULT, .letter_space = 4 * LV_STYLE_MULT, .line_space = 4 * LV_STYLE_MULT,
.mid = 0, .mid = 0,
}; };
static lv_labels_t lv_labels_txt = { static lv_labels_t lv_labels_txt = {
.font = LV_FONT_DEFAULT, .color = COLOR_MAKE(0x16, 0x23, 0x34), .font = LV_FONT_DEFAULT, .objs.color = COLOR_MAKE(0x16, 0x23, 0x34),
.letter_space = 1 * LV_STYLE_MULT, .line_space = 2 * LV_STYLE_MULT, .letter_space = 1 * LV_STYLE_MULT, .line_space = 2 * LV_STYLE_MULT,
.mid = 0, .mid = 0,
}; };
...@@ -274,7 +274,7 @@ lv_labels_t * lv_labels_get(lv_labels_builtin_t style, lv_labels_t * copy_p) ...@@ -274,7 +274,7 @@ lv_labels_t * lv_labels_get(lv_labels_builtin_t style, lv_labels_t * copy_p)
style_p = &lv_labels_title; style_p = &lv_labels_title;
break; break;
default: default:
style_p = NULL; style_p = &lv_labels_def;
} }
if(copy_p != NULL) { if(copy_p != NULL) {
......
...@@ -25,8 +25,8 @@ ...@@ -25,8 +25,8 @@
typedef struct typedef struct
{ {
lv_objs_t objs;
font_types_t font; font_types_t font;
color_t color;
uint16_t letter_space; uint16_t letter_space;
uint16_t line_space; uint16_t line_space;
uint8_t mid :1; uint8_t mid :1;
......
...@@ -38,14 +38,11 @@ static bool lv_line_design(lv_obj_t* obj_dp, const area_t * mask_p, lv_design_mo ...@@ -38,14 +38,11 @@ static bool lv_line_design(lv_obj_t* obj_dp, const area_t * mask_p, lv_design_mo
/********************** /**********************
* STATIC VARIABLES * STATIC VARIABLES
**********************/ **********************/
static lv_lines_t lv_lines_def = { .width = 2 * LV_STYLE_MULT, .objs.color = COLOR_RED, static lv_lines_t lv_lines_def = { .width = 2 * LV_STYLE_MULT, .objs.color = COLOR_RED};
.bg_color = COLOR_BLACK, .bg_opa = 0};
static lv_lines_t lv_lines_decor = { .width = 1 * LV_STYLE_MULT, .objs.color = COLOR_GRAY, static lv_lines_t lv_lines_decor = { .width = 1 * LV_STYLE_MULT, .objs.color = COLOR_GRAY};
.bg_color = COLOR_BLACK, .bg_opa = 0};
static lv_lines_t lv_lines_chart = { .width = 3 * LV_STYLE_MULT, .objs.color = COLOR_BLUE, static lv_lines_t lv_lines_chart = { .width = 3 * LV_STYLE_MULT, .objs.color = COLOR_BLUE};
.bg_color = COLOR_BLACK, .bg_opa = 0};
/********************** /**********************
* MACROS * MACROS
...@@ -265,7 +262,7 @@ lv_lines_t * lv_lines_get(lv_lines_builtin_t style, lv_lines_t * copy_p) ...@@ -265,7 +262,7 @@ lv_lines_t * lv_lines_get(lv_lines_builtin_t style, lv_lines_t * copy_p)
style_p = &lv_lines_chart; style_p = &lv_lines_chart;
break; break;
default: default:
style_p = NULL; style_p = &lv_lines_def;
} }
if(copy_p != NULL) { if(copy_p != NULL) {
...@@ -298,13 +295,7 @@ static bool lv_line_design(lv_obj_t* obj_dp, const area_t * mask_p, lv_design_mo ...@@ -298,13 +295,7 @@ static bool lv_line_design(lv_obj_t* obj_dp, const area_t * mask_p, lv_design_mo
if(ext_p->point_num == 0 || ext_p->point_p == NULL) return false; if(ext_p->point_num == 0 || ext_p->point_p == NULL) return false;
lv_lines_t * lines_p = lv_obj_get_style(obj_dp); lv_lines_t * lines_p = lv_obj_get_style(obj_dp);
if(lines_p->bg_opa != 0) {
#if LV_VDB_SIZE != 0
lv_vfill(&obj_dp->cords, mask_p, lines_p->bg_color, lines_p->bg_opa * 255 / 100);
#else
lv_rfill(&obj_dp->cords, mask_p, lines_p->bg_color, lines_p->bg_opa * 255 / 100);
#endif
}
opa_t opa = lv_obj_get_opa(obj_dp); opa_t opa = lv_obj_get_opa(obj_dp);
area_t area; area_t area;
lv_obj_get_cords(obj_dp, &area); lv_obj_get_cords(obj_dp, &area);
......
...@@ -33,9 +33,7 @@ typedef struct ...@@ -33,9 +33,7 @@ typedef struct
typedef struct typedef struct
{ {
lv_objs_t objs; lv_objs_t objs;
color_t bg_color;
uint16_t width; uint16_t width;
opa_t bg_opa;
}lv_lines_t; }lv_lines_t;
typedef enum typedef enum
......
...@@ -156,6 +156,7 @@ lv_obj_t* lv_page_create(lv_obj_t * par_dp, lv_obj_t * ori_dp) ...@@ -156,6 +156,7 @@ lv_obj_t* lv_page_create(lv_obj_t * par_dp, lv_obj_t * ori_dp)
page_p->sbh_dp = lv_rect_create(par_dp, NULL); page_p->sbh_dp = lv_rect_create(par_dp, NULL);
lv_obj_set_height(page_p->sbh_dp, pages_p->sb_width); lv_obj_set_height(page_p->sbh_dp, pages_p->sb_width);
lv_obj_set_style(page_p->sbh_dp, &pages_p->sb_rects); lv_obj_set_style(page_p->sbh_dp, &pages_p->sb_rects);
lv_obj_set_click(page_p->sbh_dp, false);
if(pages_p->sb_mode == LV_PAGE_SB_MODE_ON) { if(pages_p->sb_mode == LV_PAGE_SB_MODE_ON) {
lv_obj_set_opa(page_p->sbh_dp, (pages_p->sb_opa * OPA_COVER) / 100); lv_obj_set_opa(page_p->sbh_dp, (pages_p->sb_opa * OPA_COVER) / 100);
} else { } else {
...@@ -166,6 +167,7 @@ lv_obj_t* lv_page_create(lv_obj_t * par_dp, lv_obj_t * ori_dp) ...@@ -166,6 +167,7 @@ lv_obj_t* lv_page_create(lv_obj_t * par_dp, lv_obj_t * ori_dp)
page_p->sbv_dp =lv_rect_create(par_dp, NULL); page_p->sbv_dp =lv_rect_create(par_dp, NULL);
lv_obj_set_width(page_p->sbv_dp, pages_p->sb_width); lv_obj_set_width(page_p->sbv_dp, pages_p->sb_width);
lv_obj_set_style(page_p->sbv_dp, &pages_p->sb_rects); lv_obj_set_style(page_p->sbv_dp, &pages_p->sb_rects);
lv_obj_set_click(page_p->sbv_dp, false);
if(lv_pages_def.sb_mode == LV_PAGE_SB_MODE_ON) { if(lv_pages_def.sb_mode == LV_PAGE_SB_MODE_ON) {
lv_obj_set_opa(page_p->sbv_dp, (pages_p->sb_opa * OPA_COVER) / 100); lv_obj_set_opa(page_p->sbv_dp, (pages_p->sb_opa * OPA_COVER) / 100);
} else { } else {
...@@ -299,7 +301,6 @@ bool lv_page_signal(lv_obj_t* obj_dp, lv_signal_t sign, void* param) ...@@ -299,7 +301,6 @@ bool lv_page_signal(lv_obj_t* obj_dp, lv_signal_t sign, void* param)
} }
return obj_valid; return obj_valid;
} }
/** /**
...@@ -334,7 +335,7 @@ lv_pages_t * lv_pages_get(lv_pages_builtin_t style, lv_pages_t * to_copy) ...@@ -334,7 +335,7 @@ lv_pages_t * lv_pages_get(lv_pages_builtin_t style, lv_pages_t * to_copy)
style_p = &lv_pages_transp; style_p = &lv_pages_transp;
break; break;
default: default:
style_p = NULL; style_p = &lv_pages_def;
} }
if(to_copy != NULL) { if(to_copy != NULL) {
......
...@@ -229,7 +229,7 @@ lv_rects_t * lv_rects_get(lv_rects_builtin_t style, lv_rects_t * copy_p) ...@@ -229,7 +229,7 @@ lv_rects_t * lv_rects_get(lv_rects_builtin_t style, lv_rects_t * copy_p)
style_p = &lv_rects_transp; style_p = &lv_rects_transp;
break; break;
default: default:
style_p = NULL; style_p = &lv_rects_def;
} }
if(copy_p != NULL) { if(copy_p != NULL) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment