shadow bottom added

This commit is contained in:
Gabor
2017-04-24 12:08:24 +02:00
parent 462244684e
commit d1bec14de8
8 changed files with 328 additions and 162 deletions

View File

@@ -1448,13 +1448,13 @@ static bool lv_obj_design(lv_obj_t * obj, const area_t * mask_p, lv_design_mode
lv_obj_get_cords(obj, &area_tmp);
area_tmp.x1 += r;
area_tmp.x2 -= r;
if(area_is_in(mask_p, &area_tmp) != true) return false;
if(area_is_in(mask_p, &area_tmp) == false) return false;
/*Check vertically without radius*/
lv_obj_get_cords(obj, &area_tmp);
area_tmp.y1 += r;
area_tmp.y2 -= r;
if(area_is_in(mask_p, &area_tmp) != true) return false;
if(area_is_in(mask_p, &area_tmp) == false) return false;
} else if(mode == LV_DESIGN_DRAW_MAIN) {
lv_style_t * style = lv_obj_get_style(obj);

View File

@@ -72,6 +72,7 @@ void lv_style_init (void)
lv_style_set_opad(&lv_style_scr, LV_DPI / 12);
lv_style_set_bopa(&lv_style_scr, OPA_COVER);
lv_style_set_empty(&lv_style_scr, false);
lv_style_set_stype(&lv_style_scr, LV_STYPE_FULL);
lv_style_set_font(&lv_style_scr, font_get(FONT_DEFAULT));
lv_style_set_letter_space(&lv_style_scr, 1 * LV_DOWNSCALE);
@@ -366,6 +367,16 @@ void lv_style_set_empty(lv_style_t * style, bool empty)
style->empty = empty == false ? 0 : 1;
}
/**
* Set the shadow type (position) of a style
* @param style pointer to style
* @param stype shadow type from 'lv_shadow_type_t' enum
*/
void lv_style_set_stype(lv_style_t * style, lv_stype_t stype)
{
style->stype = stype;
}
/**
* Set the font of a style
* @param style pointer to style
@@ -580,6 +591,16 @@ bool lv_style_get_empty(lv_style_t * style, bool empty)
return style->empty == false ? 0 : 1;
}
/**
* Get the shadow type attribute
* @param style pointer to style
* @return shadow type from 'lv_stype_t' enum
*/
bool lv_style_get_stype(lv_style_t * style, bool empty)
{
return style->stype;
}
/**
* Get the font of a style
* @param style pointer to style

View File

@@ -28,12 +28,21 @@ typedef enum {
LV_TXT_ALIGN_MID,
}lv_txt_align_t;
/*Shadow types*/
typedef enum
{
LV_STYPE_BOTTOM = 0,
LV_STYPE_FULL,
}lv_stype_t;
typedef struct
{
/*Object level styles*/
color_t ccolor; /*Content color (e.g. text or image re-color )*/
opa_t opa; /*Opacity of the object*/
uint8_t empty :1; /*Transparent background (border drawn)*/
uint8_t stype :3; /*Shadow type from 'lv_shadow_type_t'*/
color_t mcolor; /*Main color of background*/
color_t gcolor; /*Gradient color of background*/
color_t bcolor; /*Border color of background*/
@@ -100,6 +109,7 @@ lv_style_t * lv_style_inherit(lv_style_t * result, const lv_style_t * child, con
*/
void lv_style_set_ccolor(lv_style_t * style, color_t ccolor);
void lv_style_set_stype(lv_style_t * style, lv_stype_t stype);
/**
* Clear the content color of a style (it will be inherited from the parent style)
* @param style pointer to a style