add horizontal gradient main/grad_color_stop
This commit is contained in:
@@ -1626,13 +1626,13 @@ void lv_obj_get_coords(const lv_obj_t * obj, lv_area_t * cords_p)
|
|||||||
void lv_obj_get_inner_coords(const lv_obj_t * obj, lv_area_t * coords_p)
|
void lv_obj_get_inner_coords(const lv_obj_t * obj, lv_area_t * coords_p)
|
||||||
{
|
{
|
||||||
const lv_style_t * style = lv_obj_get_style(obj);
|
const lv_style_t * style = lv_obj_get_style(obj);
|
||||||
if(style->body.border.part & LV_BORDER_LEFT) coords_p->x1 += style->body.border.width;
|
if(style->body.border.part & LV_BORDER_PART_LEFT) coords_p->x1 += style->body.border.width;
|
||||||
|
|
||||||
if(style->body.border.part & LV_BORDER_RIGHT) coords_p->x2 -= style->body.border.width;
|
if(style->body.border.part & LV_BORDER_PART_RIGHT) coords_p->x2 -= style->body.border.width;
|
||||||
|
|
||||||
if(style->body.border.part & LV_BORDER_TOP) coords_p->y1 += style->body.border.width;
|
if(style->body.border.part & LV_BORDER_PART_TOP) coords_p->y1 += style->body.border.width;
|
||||||
|
|
||||||
if(style->body.border.part & LV_BORDER_BOTTOM) coords_p->y2 -= style->body.border.width;
|
if(style->body.border.part & LV_BORDER_PART_BOTTOM) coords_p->y2 -= style->body.border.width;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -217,7 +217,7 @@ void lv_disp_refr_task(lv_task_t * task)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
lv_draw_free_buf();
|
lv_draw_buf_free_all();
|
||||||
|
|
||||||
LV_LOG_TRACE("lv_refr_task: ready");
|
LV_LOG_TRACE("lv_refr_task: ready");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -72,8 +72,11 @@ void lv_style_init(void)
|
|||||||
/*Screen style*/
|
/*Screen style*/
|
||||||
lv_style_scr.glass = 0;
|
lv_style_scr.glass = 0;
|
||||||
lv_style_scr.body.opa = LV_OPA_COVER;
|
lv_style_scr.body.opa = LV_OPA_COVER;
|
||||||
lv_style_scr.body.main_color = LV_COLOR_RED;
|
lv_style_scr.body.main_color = LV_COLOR_WHITE;
|
||||||
lv_style_scr.body.grad_color = LV_COLOR_WHITE;
|
lv_style_scr.body.grad_color = LV_COLOR_WHITE;
|
||||||
|
lv_style_scr.body.main_color_stop = 0;
|
||||||
|
lv_style_scr.body.grad_color_stop = 255;
|
||||||
|
lv_style_scr.body.grad_dir = LV_GRAD_DIR_VER;
|
||||||
lv_style_scr.body.radius = 0;
|
lv_style_scr.body.radius = 0;
|
||||||
lv_style_scr.body.blend_mode = LV_BLEND_MODE_NORMAL;
|
lv_style_scr.body.blend_mode = LV_BLEND_MODE_NORMAL;
|
||||||
lv_style_scr.body.padding.left = 0;
|
lv_style_scr.body.padding.left = 0;
|
||||||
@@ -85,7 +88,7 @@ void lv_style_init(void)
|
|||||||
lv_style_scr.body.border.color = LV_COLOR_BLACK;
|
lv_style_scr.body.border.color = LV_COLOR_BLACK;
|
||||||
lv_style_scr.body.border.opa = LV_OPA_COVER;
|
lv_style_scr.body.border.opa = LV_OPA_COVER;
|
||||||
lv_style_scr.body.border.width = 0;
|
lv_style_scr.body.border.width = 0;
|
||||||
lv_style_scr.body.border.part = LV_BORDER_FULL;
|
lv_style_scr.body.border.part = LV_BORDER_PART_FULL;
|
||||||
lv_style_scr.body.border.blend_mode = LV_BLEND_MODE_NORMAL;
|
lv_style_scr.body.border.blend_mode = LV_BLEND_MODE_NORMAL;
|
||||||
|
|
||||||
lv_style_scr.body.shadow.color = LV_COLOR_GRAY;
|
lv_style_scr.body.shadow.color = LV_COLOR_GRAY;
|
||||||
@@ -173,9 +176,12 @@ void lv_style_init(void)
|
|||||||
|
|
||||||
/*Button released style*/
|
/*Button released style*/
|
||||||
lv_style_copy(&lv_style_btn_rel, &lv_style_plain);
|
lv_style_copy(&lv_style_btn_rel, &lv_style_plain);
|
||||||
lv_style_btn_rel.body.main_color = lv_color_make(0x76, 0xa2, 0xd0);
|
lv_style_btn_rel.body.main_color = LV_COLOR_LIME;//lv_color_make(0x76, 0xa2, 0xd0);
|
||||||
lv_style_btn_rel.body.grad_color = lv_color_make(0x19, 0x3a, 0x5d);
|
lv_style_btn_rel.body.grad_color = LV_COLOR_BLUE;//lv_color_make(0x19, 0x3a, 0x5d);
|
||||||
lv_style_btn_rel.body.radius = LV_DPI / 15;
|
lv_style_btn_rel.body.main_color_stop = 0x80;//0x10;
|
||||||
|
lv_style_btn_rel.body.grad_color_stop = 0xd0;//0x10;
|
||||||
|
lv_style_btn_rel.body.grad_dir = LV_GRAD_DIR_VER;
|
||||||
|
lv_style_btn_rel.body.radius = 15;//LV_DPI / 15;
|
||||||
lv_style_btn_rel.body.opa = LV_OPA_COVER;
|
lv_style_btn_rel.body.opa = LV_OPA_COVER;
|
||||||
// lv_style_btn_rel.body.blend_mode = LV_BLEND_MODE_ADDITIVE;
|
// lv_style_btn_rel.body.blend_mode = LV_BLEND_MODE_ADDITIVE;
|
||||||
lv_style_btn_rel.body.padding.left = LV_DPI / 4;
|
lv_style_btn_rel.body.padding.left = LV_DPI / 4;
|
||||||
@@ -184,15 +190,16 @@ void lv_style_init(void)
|
|||||||
lv_style_btn_rel.body.padding.bottom = LV_DPI / 6;
|
lv_style_btn_rel.body.padding.bottom = LV_DPI / 6;
|
||||||
lv_style_btn_rel.body.padding.inner = LV_DPI / 10;
|
lv_style_btn_rel.body.padding.inner = LV_DPI / 10;
|
||||||
lv_style_btn_rel.body.border.color = lv_color_make(0x0b, 0x19, 0x28);
|
lv_style_btn_rel.body.border.color = lv_color_make(0x0b, 0x19, 0x28);
|
||||||
lv_style_btn_rel.body.border.width = LV_DPI / 50 >= 1 ? LV_DPI / 50 : 1;
|
lv_style_btn_rel.body.border.width = 0;//LV_DPI / 50 >= 1 ? LV_DPI / 50 : 1;
|
||||||
lv_style_btn_rel.body.border.opa = LV_OPA_70;
|
lv_style_btn_rel.body.border.opa = LV_OPA_70;
|
||||||
|
// lv_style_btn_rel.body.border.part = LV_BORDER_PART_LEFT | LV_BORDER_PART_TOP;
|
||||||
lv_style_btn_rel.body.shadow.color = LV_COLOR_BLACK;
|
lv_style_btn_rel.body.shadow.color = LV_COLOR_BLACK;
|
||||||
lv_style_btn_rel.body.shadow.width = 0;
|
lv_style_btn_rel.body.shadow.width = 10;
|
||||||
lv_style_btn_rel.body.shadow.spread = 0;
|
// lv_style_btn_rel.body.shadow.spread = 5;
|
||||||
// lv_style_btn_rel.body.shadow.blend_mode = LV_BLEND_MODE_SUBTRACTIVE;
|
// lv_style_btn_rel.body.shadow.blend_mode = LV_BLEND_MODE_SUBTRACTIVE;
|
||||||
lv_style_btn_rel.body.shadow.opa = LV_OPA_COVER;
|
lv_style_btn_rel.body.shadow.opa = LV_OPA_COVER;
|
||||||
lv_style_btn_rel.body.shadow.offset.x = 0;
|
lv_style_btn_rel.body.shadow.offset.x = 10;
|
||||||
lv_style_btn_rel.body.shadow.offset.y = 0;
|
lv_style_btn_rel.body.shadow.offset.y = 20;
|
||||||
lv_style_btn_rel.text.color = lv_color_make(0xff, 0xff, 0xff);
|
lv_style_btn_rel.text.color = lv_color_make(0xff, 0xff, 0xff);
|
||||||
lv_style_btn_rel.image.color = lv_color_make(0xff, 0xff, 0xff);
|
lv_style_btn_rel.image.color = lv_color_make(0xff, 0xff, 0xff);
|
||||||
|
|
||||||
|
|||||||
@@ -31,16 +31,26 @@ extern "C" {
|
|||||||
|
|
||||||
/*Border types (Use 'OR'ed values)*/
|
/*Border types (Use 'OR'ed values)*/
|
||||||
enum {
|
enum {
|
||||||
LV_BORDER_NONE = 0x00,
|
LV_BORDER_PART_NONE = 0x00,
|
||||||
LV_BORDER_BOTTOM = 0x01,
|
LV_BORDER_PART_BOTTOM = 0x01,
|
||||||
LV_BORDER_TOP = 0x02,
|
LV_BORDER_PART_TOP = 0x02,
|
||||||
LV_BORDER_LEFT = 0x04,
|
LV_BORDER_PART_LEFT = 0x04,
|
||||||
LV_BORDER_RIGHT = 0x08,
|
LV_BORDER_PART_RIGHT = 0x08,
|
||||||
LV_BORDER_FULL = 0x0F,
|
LV_BORDER_PART_FULL = 0x0F,
|
||||||
LV_BORDER_INTERNAL = 0x10, /**< FOR matrix-like objects (e.g. Button matrix)*/
|
LV_BORDER_PART_INTERNAL = 0x10, /**< FOR matrix-like objects (e.g. Button matrix)*/
|
||||||
};
|
};
|
||||||
typedef uint8_t lv_border_part_t;
|
typedef uint8_t lv_border_part_t;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
enum {
|
||||||
|
LV_GRAD_DIR_NONE,
|
||||||
|
LV_GRAD_DIR_VER,
|
||||||
|
LV_GRAD_DIR_HOR,
|
||||||
|
};
|
||||||
|
|
||||||
|
typedef uint8_t lv_grad_dir_t;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Styles can be assigned to objects - which holds information about
|
* Styles can be assigned to objects - which holds information about
|
||||||
* how the object should be drawn.
|
* how the object should be drawn.
|
||||||
@@ -59,7 +69,11 @@ typedef struct
|
|||||||
lv_color_t grad_color; /**< Second color. If not equal to `main_color` a gradient will be drawn for the background. */
|
lv_color_t grad_color; /**< Second color. If not equal to `main_color` a gradient will be drawn for the background. */
|
||||||
lv_coord_t radius; /**< Object's corner radius. You can use #LV_RADIUS_CIRCLE if you want to draw a circle. */
|
lv_coord_t radius; /**< Object's corner radius. You can use #LV_RADIUS_CIRCLE if you want to draw a circle. */
|
||||||
lv_opa_t opa; /**< Object's opacity (0-255). */
|
lv_opa_t opa; /**< Object's opacity (0-255). */
|
||||||
|
lv_opa_t main_color_stop;
|
||||||
|
lv_opa_t grad_color_stop;
|
||||||
lv_blend_mode_t blend_mode :3;
|
lv_blend_mode_t blend_mode :3;
|
||||||
|
lv_grad_dir_t grad_dir;
|
||||||
|
|
||||||
|
|
||||||
struct
|
struct
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -35,7 +35,6 @@
|
|||||||
/**********************
|
/**********************
|
||||||
* STATIC VARIABLES
|
* STATIC VARIABLES
|
||||||
**********************/
|
**********************/
|
||||||
static uint32_t draw_buf_size = 0;
|
|
||||||
|
|
||||||
/**********************
|
/**********************
|
||||||
* MACROS
|
* MACROS
|
||||||
@@ -50,34 +49,63 @@ static uint32_t draw_buf_size = 0;
|
|||||||
* Be careful to not use the buffer while other processes are using it.
|
* Be careful to not use the buffer while other processes are using it.
|
||||||
* @param size the required size
|
* @param size the required size
|
||||||
*/
|
*/
|
||||||
void * lv_draw_get_buf(uint32_t size)
|
void * lv_draw_buf_get(uint32_t size)
|
||||||
{
|
{
|
||||||
if(size <= draw_buf_size) return LV_GC_ROOT(_lv_draw_buf);
|
/*Try to find a free buffer with suitable size */
|
||||||
|
uint8_t i;
|
||||||
LV_LOG_TRACE("lv_draw_get_buf: allocate");
|
for(i = 0; i < LV_DRAW_BUF_MAX_NUM; i++) {
|
||||||
|
if(_lv_draw_buf[i].used == 0 && _lv_draw_buf[i].size >= size) {
|
||||||
draw_buf_size = size;
|
_lv_draw_buf[i].used = 1;
|
||||||
|
return _lv_draw_buf[i].p;
|
||||||
if(LV_GC_ROOT(_lv_draw_buf) == NULL) {
|
}
|
||||||
LV_GC_ROOT(_lv_draw_buf) = lv_mem_alloc(size);
|
|
||||||
lv_mem_assert(LV_GC_ROOT(_lv_draw_buf));
|
|
||||||
return LV_GC_ROOT(_lv_draw_buf);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
LV_GC_ROOT(_lv_draw_buf) = lv_mem_realloc(LV_GC_ROOT(_lv_draw_buf), size);
|
/*Reallocate a free buffer*/
|
||||||
lv_mem_assert(LV_GC_ROOT(_lv_draw_buf));
|
for(i = 0; i < LV_DRAW_BUF_MAX_NUM; i++) {
|
||||||
return LV_GC_ROOT(_lv_draw_buf);
|
if(_lv_draw_buf[i].used == 0) {
|
||||||
|
_lv_draw_buf[i].used = 1;
|
||||||
|
_lv_draw_buf[i].size = size;
|
||||||
|
_lv_draw_buf[i].p = lv_mem_realloc(_lv_draw_buf[i].p, size);
|
||||||
|
lv_mem_assert(_lv_draw_buf[i].p);
|
||||||
|
return _lv_draw_buf[i].p;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
LV_LOG_ERROR("lv_draw_buf_get: no free buffer. Increase LV_DRAW_BUF_MAX_NUM.");
|
||||||
|
|
||||||
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Free the draw buffer
|
* Release the draw buffer
|
||||||
|
* @param p buffer to release
|
||||||
*/
|
*/
|
||||||
void lv_draw_free_buf(void)
|
void lv_draw_buf_release(void * p)
|
||||||
{
|
{
|
||||||
if(LV_GC_ROOT(_lv_draw_buf)) {
|
uint8_t i;
|
||||||
lv_mem_free(LV_GC_ROOT(_lv_draw_buf));
|
for(i = 0; i < LV_DRAW_BUF_MAX_NUM; i++) {
|
||||||
LV_GC_ROOT(_lv_draw_buf) = NULL;
|
if(_lv_draw_buf[i].p == p) {
|
||||||
draw_buf_size = 0;
|
_lv_draw_buf[i].used = 0;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
LV_LOG_ERROR("lv_draw_buf_release: p is not a known buffer")
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Free all draw buffers
|
||||||
|
*/
|
||||||
|
void lv_draw_buf_free_all(void)
|
||||||
|
{
|
||||||
|
uint8_t i;
|
||||||
|
for(i = 0; i < LV_DRAW_BUF_MAX_NUM; i++) {
|
||||||
|
if(_lv_draw_buf[i].p) {
|
||||||
|
lv_mem_free(_lv_draw_buf[i].p);
|
||||||
|
_lv_draw_buf[i].p = NULL;
|
||||||
|
_lv_draw_buf[i].used = 0;
|
||||||
|
_lv_draw_buf[i].size = 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -26,10 +26,16 @@ extern "C" {
|
|||||||
/*********************
|
/*********************
|
||||||
* DEFINES
|
* DEFINES
|
||||||
*********************/
|
*********************/
|
||||||
|
#define LV_DRAW_BUF_MAX_NUM 6
|
||||||
|
|
||||||
/**********************
|
/**********************
|
||||||
* TYPEDEFS
|
* TYPEDEFS
|
||||||
**********************/
|
**********************/
|
||||||
|
typedef struct {
|
||||||
|
void * p;
|
||||||
|
uint16_t size;
|
||||||
|
uint8_t used :1;
|
||||||
|
}lv_draw_buf_t;
|
||||||
|
|
||||||
/**********************
|
/**********************
|
||||||
* GLOBAL PROTOTYPES
|
* GLOBAL PROTOTYPES
|
||||||
@@ -40,48 +46,19 @@ extern "C" {
|
|||||||
* Be careful to not use the buffer while other processes are using it.
|
* Be careful to not use the buffer while other processes are using it.
|
||||||
* @param size the required size
|
* @param size the required size
|
||||||
*/
|
*/
|
||||||
void * lv_draw_get_buf(uint32_t size);
|
void * lv_draw_buf_get(uint32_t size);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Free the draw buffer
|
* Release the draw buffer
|
||||||
|
* @param p buffer to release
|
||||||
*/
|
*/
|
||||||
void lv_draw_free_buf(void);
|
void lv_draw_buf_release(void * p);
|
||||||
|
|
||||||
#if LV_ANTIALIAS
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the opacity of a pixel based it's position in a line segment
|
* Free all draw buffers
|
||||||
* @param seg segment length
|
|
||||||
* @param px_id position of of a pixel which opacity should be get [0..seg-1]
|
|
||||||
* @param base_opa the base opacity
|
|
||||||
* @return the opacity of the given pixel
|
|
||||||
*/
|
*/
|
||||||
lv_opa_t lv_draw_aa_get_opa(lv_coord_t seg, lv_coord_t px_id, lv_opa_t base_opa);
|
void lv_draw_buf_free_all(void);
|
||||||
|
|
||||||
/**
|
|
||||||
* Add a vertical anti-aliasing segment (pixels with decreasing opacity)
|
|
||||||
* @param x start point x coordinate
|
|
||||||
* @param y start point y coordinate
|
|
||||||
* @param length length of segment (negative value to start from 0 opacity)
|
|
||||||
* @param mask draw only in this area
|
|
||||||
* @param color color of pixels
|
|
||||||
* @param opa maximum opacity
|
|
||||||
*/
|
|
||||||
void lv_draw_aa_ver_seg(lv_coord_t x, lv_coord_t y, lv_coord_t length, const lv_area_t * mask, lv_color_t color,
|
|
||||||
lv_opa_t opa);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Add a horizontal anti-aliasing segment (pixels with decreasing opacity)
|
|
||||||
* @param x start point x coordinate
|
|
||||||
* @param y start point y coordinate
|
|
||||||
* @param length length of segment (negative value to start from 0 opacity)
|
|
||||||
* @param mask draw only in this area
|
|
||||||
* @param color color of pixels
|
|
||||||
* @param opa maximum opacity
|
|
||||||
*/
|
|
||||||
void lv_draw_aa_hor_seg(lv_coord_t x, lv_coord_t y, lv_coord_t length, const lv_area_t * mask, lv_color_t color,
|
|
||||||
lv_opa_t opa);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/**********************
|
/**********************
|
||||||
* GLOBAL VARIABLES
|
* GLOBAL VARIABLES
|
||||||
|
|||||||
@@ -510,7 +510,7 @@ static lv_res_t lv_img_draw_core(const lv_area_t * coords, const lv_area_t * mas
|
|||||||
else {
|
else {
|
||||||
lv_coord_t width = lv_area_get_width(&mask_com);
|
lv_coord_t width = lv_area_get_width(&mask_com);
|
||||||
|
|
||||||
uint8_t * buf = lv_draw_get_buf(lv_area_get_width(&mask_com) * ((LV_COLOR_DEPTH >> 3) + 1)); /*+1 because of the possible alpha byte*/
|
uint8_t * buf = lv_draw_buf_get(lv_area_get_width(&mask_com) * ((LV_COLOR_DEPTH >> 3) + 1)); /*+1 because of the possible alpha byte*/
|
||||||
|
|
||||||
lv_area_t line;
|
lv_area_t line;
|
||||||
lv_area_copy(&line, &mask_com);
|
lv_area_copy(&line, &mask_com);
|
||||||
@@ -524,6 +524,7 @@ static lv_res_t lv_img_draw_core(const lv_area_t * coords, const lv_area_t * mas
|
|||||||
if(read_res != LV_RES_OK) {
|
if(read_res != LV_RES_OK) {
|
||||||
lv_img_decoder_close(&cdsc->dec_dsc);
|
lv_img_decoder_close(&cdsc->dec_dsc);
|
||||||
LV_LOG_WARN("Image draw can't read the line");
|
LV_LOG_WARN("Image draw can't read the line");
|
||||||
|
lv_draw_buf_release(buf);
|
||||||
return LV_RES_INV;
|
return LV_RES_INV;
|
||||||
}
|
}
|
||||||
lv_draw_map(&line, mask, buf, opa, chroma_keyed, alpha_byte, style);
|
lv_draw_map(&line, mask, buf, opa, chroma_keyed, alpha_byte, style);
|
||||||
@@ -531,6 +532,7 @@ static lv_res_t lv_img_draw_core(const lv_area_t * coords, const lv_area_t * mas
|
|||||||
line.y2++;
|
line.y2++;
|
||||||
y++;
|
y++;
|
||||||
}
|
}
|
||||||
|
lv_draw_buf_release(buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
return LV_RES_OK;
|
return LV_RES_OK;
|
||||||
@@ -584,9 +586,12 @@ static void lv_draw_map(const lv_area_t * map_area, const lv_area_t * clip_area,
|
|||||||
/*The pixel size in byte is different if an alpha byte is added too*/
|
/*The pixel size in byte is different if an alpha byte is added too*/
|
||||||
uint8_t px_size_byte = alpha_byte ? LV_IMG_PX_SIZE_ALPHA_BYTE : sizeof(lv_color_t);
|
uint8_t px_size_byte = alpha_byte ? LV_IMG_PX_SIZE_ALPHA_BYTE : sizeof(lv_color_t);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*Build the image and a mask line-by-line*/
|
/*Build the image and a mask line-by-line*/
|
||||||
lv_color_t map2[LV_HOR_RES_MAX];
|
uint32_t mask_buf_size = lv_area_get_size(&draw_area) > LV_HOR_RES_MAX ? lv_area_get_size(&draw_area) : LV_HOR_RES_MAX;
|
||||||
lv_opa_t mask_buf[LV_HOR_RES_MAX];
|
lv_color_t * map2 = lv_draw_buf_get(mask_buf_size * sizeof(lv_color_t));
|
||||||
|
lv_opa_t * mask_buf = lv_draw_buf_get(mask_buf_size);
|
||||||
|
|
||||||
/*Go to the first displayed pixel of the map*/
|
/*Go to the first displayed pixel of the map*/
|
||||||
lv_coord_t map_w = lv_area_get_width(map_area);
|
lv_coord_t map_w = lv_area_get_width(map_area);
|
||||||
@@ -609,7 +614,7 @@ static void lv_draw_map(const lv_area_t * map_area, const lv_area_t * clip_area,
|
|||||||
|
|
||||||
/*Prepare the `mask_buf`if there are other masks*/
|
/*Prepare the `mask_buf`if there are other masks*/
|
||||||
if(other_mask_cnt) {
|
if(other_mask_cnt) {
|
||||||
memset(mask_buf, 0xFF, sizeof(mask_buf));
|
memset(mask_buf, 0xFF, mask_buf_size);
|
||||||
}
|
}
|
||||||
|
|
||||||
lv_draw_mask_res_t mask_res;
|
lv_draw_mask_res_t mask_res;
|
||||||
@@ -664,7 +669,7 @@ static void lv_draw_map(const lv_area_t * map_area, const lv_area_t * clip_area,
|
|||||||
}
|
}
|
||||||
|
|
||||||
map_buf_tmp += map_w * px_size_byte;
|
map_buf_tmp += map_w * px_size_byte;
|
||||||
if(px_i + lv_area_get_width(&draw_area) < sizeof(mask_buf)) {
|
if(px_i + lv_area_get_width(&draw_area) < mask_buf_size) {
|
||||||
blend_area.y2 ++;
|
blend_area.y2 ++;
|
||||||
} else {
|
} else {
|
||||||
lv_blend_map(clip_area, &blend_area, map2, mask_buf, mask_res, opa, style->image.blend_mode);
|
lv_blend_map(clip_area, &blend_area, map2, mask_buf, mask_res, opa, style->image.blend_mode);
|
||||||
@@ -677,7 +682,7 @@ static void lv_draw_map(const lv_area_t * map_area, const lv_area_t * clip_area,
|
|||||||
|
|
||||||
/*Prepare the `mask_buf`if there are other masks*/
|
/*Prepare the `mask_buf`if there are other masks*/
|
||||||
if(other_mask_cnt) {
|
if(other_mask_cnt) {
|
||||||
memset(mask_buf, 0xFF, sizeof(mask_buf));
|
memset(mask_buf, 0xFF, mask_buf_size);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -687,6 +692,9 @@ static void lv_draw_map(const lv_area_t * map_area, const lv_area_t * clip_area,
|
|||||||
lv_blend_map(clip_area, &blend_area, map2, mask_buf, mask_res, opa, style->image.blend_mode);
|
lv_blend_map(clip_area, &blend_area, map2, mask_buf, mask_res, opa, style->image.blend_mode);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
lv_draw_buf_release(mask_buf);
|
||||||
|
lv_draw_buf_release(map2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,6 +17,7 @@
|
|||||||
#define LABEL_RECOLOR_PAR_LENGTH 6
|
#define LABEL_RECOLOR_PAR_LENGTH 6
|
||||||
#define LV_LABEL_HINT_UPDATE_TH 1024 /*Update the "hint" if the label's y coordinates have changed more then this*/
|
#define LV_LABEL_HINT_UPDATE_TH 1024 /*Update the "hint" if the label's y coordinates have changed more then this*/
|
||||||
|
|
||||||
|
|
||||||
/**********************
|
/**********************
|
||||||
* TYPEDEFS
|
* TYPEDEFS
|
||||||
**********************/
|
**********************/
|
||||||
@@ -290,7 +291,11 @@ static void lv_draw_letter(const lv_point_t * pos_p, const lv_area_t * clip_area
|
|||||||
lv_font_glyph_dsc_t g;
|
lv_font_glyph_dsc_t g;
|
||||||
bool g_ret = lv_font_get_glyph_dsc(font_p, &g, letter, '\0');
|
bool g_ret = lv_font_get_glyph_dsc(font_p, &g, letter, '\0');
|
||||||
if(g_ret == false) {
|
if(g_ret == false) {
|
||||||
|
/* Add waring if the dsc is not found
|
||||||
|
* but do not print warning for non printable ASCII chars (e.g. '\n')*/
|
||||||
|
if(letter >= 0x20) {
|
||||||
LV_LOG_WARN("lv_draw_letter: glyph dsc. not found");
|
LV_LOG_WARN("lv_draw_letter: glyph dsc. not found");
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -335,9 +340,6 @@ static void lv_draw_letter(const lv_point_t * pos_p, const lv_area_t * clip_area
|
|||||||
pos_y + g.box_h < clip_area->y1 ||
|
pos_y + g.box_h < clip_area->y1 ||
|
||||||
pos_y > clip_area->y2) return;
|
pos_y > clip_area->y2) return;
|
||||||
|
|
||||||
lv_disp_t * disp = lv_refr_get_disp_refreshing();
|
|
||||||
lv_disp_buf_t * vdb = lv_disp_get_buf(disp);
|
|
||||||
|
|
||||||
lv_coord_t col, row;
|
lv_coord_t col, row;
|
||||||
|
|
||||||
uint8_t width_byte_scr = g.box_w >> 3; /*Width in bytes (on the screen finally) (e.g. w = 11 -> 2 bytes wide)*/
|
uint8_t width_byte_scr = g.box_w >> 3; /*Width in bytes (on the screen finally) (e.g. w = 11 -> 2 bytes wide)*/
|
||||||
@@ -359,7 +361,8 @@ static void lv_draw_letter(const lv_point_t * pos_p, const lv_area_t * clip_area
|
|||||||
uint16_t col_bit;
|
uint16_t col_bit;
|
||||||
col_bit = bit_ofs & 0x7; /* "& 0x7" equals to "% 8" just faster */
|
col_bit = bit_ofs & 0x7; /* "& 0x7" equals to "% 8" just faster */
|
||||||
|
|
||||||
lv_opa_t mask_buf[LV_HOR_RES_MAX];
|
uint32_t mask_buf_size = g.box_w * g.box_h > LV_HOR_RES_MAX ? g.box_w * g.box_h : LV_HOR_RES_MAX;
|
||||||
|
lv_opa_t * mask_buf = lv_draw_buf_get(mask_buf_size);
|
||||||
lv_coord_t mask_p = 0;
|
lv_coord_t mask_p = 0;
|
||||||
lv_coord_t mask_p_start;
|
lv_coord_t mask_p_start;
|
||||||
|
|
||||||
@@ -414,7 +417,7 @@ static void lv_draw_letter(const lv_point_t * pos_p, const lv_area_t * clip_area
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(mask_p + (row_end - row_start) < sizeof(mask_buf)) {
|
if((uint32_t) mask_p + (row_end - row_start) < mask_buf_size) {
|
||||||
fill_area.y2 ++;
|
fill_area.y2 ++;
|
||||||
} else {
|
} else {
|
||||||
lv_blend_fill(clip_area, &fill_area,
|
lv_blend_fill(clip_area, &fill_area,
|
||||||
@@ -440,6 +443,8 @@ static void lv_draw_letter(const lv_point_t * pos_p, const lv_area_t * clip_area
|
|||||||
LV_BLEND_MODE_NORMAL);
|
LV_BLEND_MODE_NORMAL);
|
||||||
mask_p = 0;
|
mask_p = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
lv_draw_buf_release(mask_buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -513,7 +513,7 @@ static lv_draw_mask_res_t line_mask_steep(lv_opa_t * mask_buf, lv_coord_t abs_x,
|
|||||||
|
|
||||||
if(p->inv) {
|
if(p->inv) {
|
||||||
k = xei - abs_x;
|
k = xei - abs_x;
|
||||||
if(k > len) {
|
if(k >= len) {
|
||||||
return LV_DRAW_MASK_RES_FULL_TRANSP;
|
return LV_DRAW_MASK_RES_FULL_TRANSP;
|
||||||
}
|
}
|
||||||
if(k >= 0) memset(&mask_buf[0], 0x00, k);
|
if(k >= 0) memset(&mask_buf[0], 0x00, k);
|
||||||
@@ -548,12 +548,11 @@ static lv_draw_mask_res_t line_mask_steep(lv_opa_t * mask_buf, lv_coord_t abs_x,
|
|||||||
if(p->inv) {
|
if(p->inv) {
|
||||||
k = xei - abs_x - 1;
|
k = xei - abs_x - 1;
|
||||||
|
|
||||||
if(k > len) k= len;
|
if(k > len) k = len;
|
||||||
if(k == 0) return LV_DRAW_MASK_RES_FULL_TRANSP;
|
else if(k > 0) memset(&mask_buf[0], 0x00, k);
|
||||||
else if(k >= 0) memset(&mask_buf[0], 0x00, k);
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
if(k > len) return LV_DRAW_MASK_RES_FULL_TRANSP;
|
if(k > len) return LV_DRAW_MASK_RES_FULL_COVER;
|
||||||
if(k >= 0) memset(&mask_buf[k] ,0x00, len - k);
|
if(k >= 0) memset(&mask_buf[k] ,0x00, len - k);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -28,6 +28,7 @@
|
|||||||
**********************/
|
**********************/
|
||||||
static void draw_bg(const lv_area_t * coords, const lv_area_t * clip, const lv_style_t * style, lv_opa_t opa_scale);
|
static void draw_bg(const lv_area_t * coords, const lv_area_t * clip, const lv_style_t * style, lv_opa_t opa_scale);
|
||||||
static void draw_shadow(const lv_area_t * coords, const lv_area_t * clip, const lv_style_t * style, lv_opa_t opa_scale);
|
static void draw_shadow(const lv_area_t * coords, const lv_area_t * clip, const lv_style_t * style, lv_opa_t opa_scale);
|
||||||
|
static lv_color_t grad_get(const lv_style_t * style, lv_coord_t s, lv_coord_t i);
|
||||||
static void shadow_draw_corner_buf(const lv_area_t * coords, lv_opa_t * sh_buf, lv_coord_t s, lv_coord_t r);
|
static void shadow_draw_corner_buf(const lv_area_t * coords, lv_opa_t * sh_buf, lv_coord_t s, lv_coord_t r);
|
||||||
static void shadow_blur_corner(lv_coord_t size, lv_coord_t sw, lv_opa_t * res_buf, uint16_t * sh_ups_buf);
|
static void shadow_blur_corner(lv_coord_t size, lv_coord_t sw, lv_opa_t * res_buf, uint16_t * sh_ups_buf);
|
||||||
|
|
||||||
@@ -80,7 +81,6 @@ static void draw_bg(const lv_area_t * coords, const lv_area_t * clip, const lv_s
|
|||||||
if(is_common == false) return;
|
if(is_common == false) return;
|
||||||
|
|
||||||
const lv_area_t * disp_area = &vdb->area;
|
const lv_area_t * disp_area = &vdb->area;
|
||||||
lv_color_t * disp_buf = vdb->buf_act;
|
|
||||||
|
|
||||||
/* Now `draw_area` has absolute coordinates.
|
/* Now `draw_area` has absolute coordinates.
|
||||||
* Make it relative to `disp_area` to simplify draw to `disp_buf`*/
|
* Make it relative to `disp_area` to simplify draw to `disp_buf`*/
|
||||||
@@ -92,18 +92,25 @@ static void draw_bg(const lv_area_t * coords, const lv_area_t * clip, const lv_s
|
|||||||
lv_coord_t draw_area_w = lv_area_get_width(&draw_area);
|
lv_coord_t draw_area_w = lv_area_get_width(&draw_area);
|
||||||
|
|
||||||
/*Create a mask if there is a radius*/
|
/*Create a mask if there is a radius*/
|
||||||
lv_opa_t mask_buf[LV_HOR_RES_MAX];
|
lv_opa_t * mask_buf = lv_draw_buf_get(draw_area_w);
|
||||||
|
|
||||||
|
bool simple_mode = true;
|
||||||
|
if(lv_draw_mask_get_cnt()!= 0) simple_mode = false;
|
||||||
|
else if(style->body.border.part != LV_BORDER_PART_FULL) simple_mode = false;
|
||||||
|
else if(style->body.grad_dir == LV_GRAD_DIR_HOR) simple_mode = false;
|
||||||
|
|
||||||
uint8_t other_mask_cnt = lv_draw_mask_get_cnt();
|
|
||||||
int16_t mask_rout_id = LV_MASK_ID_INV;
|
int16_t mask_rout_id = LV_MASK_ID_INV;
|
||||||
|
|
||||||
|
lv_coord_t coords_w = lv_area_get_width(coords);
|
||||||
|
lv_coord_t coords_h = lv_area_get_height(coords);
|
||||||
|
|
||||||
/*Get the real radius*/
|
/*Get the real radius*/
|
||||||
lv_coord_t rout = style->body.radius;
|
lv_coord_t rout = style->body.radius;
|
||||||
lv_coord_t short_side = LV_MATH_MIN(lv_area_get_width(coords), lv_area_get_height(coords));
|
lv_coord_t short_side = LV_MATH_MIN(coords_w, coords_h);
|
||||||
if(rout > short_side >> 1) rout = short_side >> 1;
|
if(rout > short_side >> 1) rout = short_side >> 1;
|
||||||
|
|
||||||
/*Most simple case: just a plain rectangle*/
|
/*Most simple case: just a plain rectangle*/
|
||||||
if(other_mask_cnt == 0 && rout == 0 && style->body.main_color.full == style->body.grad_color.full) {
|
if(simple_mode && rout == 0 && style->body.main_color.full == style->body.grad_color.full) {
|
||||||
lv_blend_fill(clip, coords,
|
lv_blend_fill(clip, coords,
|
||||||
style->body.main_color, NULL, LV_DRAW_MASK_RES_FULL_COVER, style->body.opa,
|
style->body.main_color, NULL, LV_DRAW_MASK_RES_FULL_COVER, style->body.opa,
|
||||||
style->body.blend_mode);
|
style->body.blend_mode);
|
||||||
@@ -117,12 +124,24 @@ static void draw_bg(const lv_area_t * coords, const lv_area_t * clip, const lv_s
|
|||||||
mask_rout_id = lv_draw_mask_add(&mask_rout_param, NULL);
|
mask_rout_id = lv_draw_mask_add(&mask_rout_param, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(opa >= LV_OPA_MIN) {
|
||||||
/*Draw the background line by line*/
|
/*Draw the background line by line*/
|
||||||
lv_coord_t h;
|
lv_coord_t h;
|
||||||
lv_draw_mask_res_t mask_res = LV_DRAW_MASK_RES_FULL_COVER;
|
lv_draw_mask_res_t mask_res = LV_DRAW_MASK_RES_FULL_COVER;
|
||||||
lv_color_t grad_color = style->body.main_color;
|
lv_color_t grad_color = style->body.main_color;
|
||||||
|
|
||||||
if(opa >= LV_OPA_MIN) {
|
|
||||||
|
lv_color_t * grad_map = NULL;
|
||||||
|
/*In case of horizontal gradient pre-compute a line with a gradient*/
|
||||||
|
if(style->body.grad_dir == LV_GRAD_DIR_HOR && style->body.main_color.full != style->body.grad_color.full) {
|
||||||
|
grad_map = lv_draw_buf_get(coords_w * sizeof(lv_color_t));
|
||||||
|
|
||||||
|
lv_coord_t i;
|
||||||
|
for(i = 0; i < coords_w; i++) {
|
||||||
|
grad_map[i] = grad_get(style, coords_w, i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
lv_area_t fill_area;
|
lv_area_t fill_area;
|
||||||
fill_area.x1 = coords->x1;
|
fill_area.x1 = coords->x1;
|
||||||
fill_area.x2 = coords->x2;
|
fill_area.x2 = coords->x2;
|
||||||
@@ -135,7 +154,7 @@ static void draw_bg(const lv_area_t * coords, const lv_area_t * clip, const lv_s
|
|||||||
if(y > coords->y1 + rout + 1 &&
|
if(y > coords->y1 + rout + 1 &&
|
||||||
y < coords->y2 - rout - 1) {
|
y < coords->y2 - rout - 1) {
|
||||||
mask_res = LV_DRAW_MASK_RES_FULL_COVER;
|
mask_res = LV_DRAW_MASK_RES_FULL_COVER;
|
||||||
if(other_mask_cnt != 0) {
|
if(simple_mode == false) {
|
||||||
memset(mask_buf, LV_OPA_COVER, draw_area_w);
|
memset(mask_buf, LV_OPA_COVER, draw_area_w);
|
||||||
mask_res = lv_draw_mask_apply(mask_buf, vdb->area.x1 + draw_area.x1, vdb->area.y1 + h, draw_area_w);
|
mask_res = lv_draw_mask_apply(mask_buf, vdb->area.x1 + draw_area.x1, vdb->area.y1 + h, draw_area_w);
|
||||||
}
|
}
|
||||||
@@ -147,14 +166,13 @@ static void draw_bg(const lv_area_t * coords, const lv_area_t * clip, const lv_s
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*Get the current line color*/
|
/*Get the current line color*/
|
||||||
if(style->body.main_color.full != style->body.grad_color.full) {
|
if(style->body.grad_dir == LV_GRAD_DIR_VER && style->body.main_color.full != style->body.grad_color.full) {
|
||||||
lv_opa_t mix = (uint32_t)((uint32_t) (y - coords->y1) * 255) / lv_area_get_height(coords);
|
grad_color = grad_get(style, lv_area_get_height(coords), y - coords->y1);
|
||||||
grad_color = lv_color_mix(style->body.grad_color, style->body.main_color, mix);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If there is not other mask and drawing the corner area split the drawing to corner and middle areas
|
/* If there is not other mask and drawing the corner area split the drawing to corner and middle areas
|
||||||
* because it the middle mask shuldn't be taken into account (therefore its faster)*/
|
* because it the middle mask shuldn't be taken into account (therefore its faster)*/
|
||||||
if(other_mask_cnt == 0 &&
|
if(simple_mode &&
|
||||||
(y < coords->y1 + rout + 1 ||
|
(y < coords->y1 + rout + 1 ||
|
||||||
y > coords->y2 - rout - 1)) {
|
y > coords->y2 - rout - 1)) {
|
||||||
|
|
||||||
@@ -184,12 +202,19 @@ static void draw_bg(const lv_area_t * coords, const lv_area_t * clip, const lv_s
|
|||||||
lv_blend_fill(clip, &fill_area2,
|
lv_blend_fill(clip, &fill_area2,
|
||||||
grad_color, mask_buf + mask_ofs, mask_res, style->body.opa, style->body.blend_mode);
|
grad_color, mask_buf + mask_ofs, mask_res, style->body.opa, style->body.blend_mode);
|
||||||
} else {
|
} else {
|
||||||
|
if(grad_map == NULL) {
|
||||||
lv_blend_fill(clip, &fill_area,
|
lv_blend_fill(clip, &fill_area,
|
||||||
grad_color,mask_buf, mask_res, style->body.opa, style->body.blend_mode);
|
grad_color,mask_buf, mask_res, opa, style->body.blend_mode);
|
||||||
|
} else {
|
||||||
|
lv_blend_map(clip, &fill_area, grad_map, mask_buf, mask_res, opa, style->body.blend_mode);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
fill_area.y1++;
|
fill_area.y1++;
|
||||||
fill_area.y2++;
|
fill_area.y2++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(grad_map) lv_draw_buf_release(grad_map);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -209,10 +234,10 @@ static void draw_bg(const lv_area_t * coords, const lv_area_t * clip, const lv_s
|
|||||||
/*Get the inner area*/
|
/*Get the inner area*/
|
||||||
lv_area_t area_small;
|
lv_area_t area_small;
|
||||||
lv_area_copy(&area_small, coords);
|
lv_area_copy(&area_small, coords);
|
||||||
area_small.x1 += border_width;
|
area_small.x1 += ((style->body.border.part & LV_BORDER_PART_LEFT) ? border_width : 0);
|
||||||
area_small.x2 -= border_width;
|
area_small.x2 -= ((style->body.border.part & LV_BORDER_PART_RIGHT) ? border_width : 0);
|
||||||
area_small.y1 += border_width;
|
area_small.y1 += ((style->body.border.part & LV_BORDER_PART_TOP) ? border_width : 0);
|
||||||
area_small.y2 -= border_width;
|
area_small.y2 -= ((style->body.border.part & LV_BORDER_PART_BOTTOM) ? border_width : 0);
|
||||||
|
|
||||||
/*Create the mask*/
|
/*Create the mask*/
|
||||||
lv_draw_mask_radius_init(&mask_rsmall_param, &area_small, rout - border_width, true);
|
lv_draw_mask_radius_init(&mask_rsmall_param, &area_small, rout - border_width, true);
|
||||||
@@ -225,9 +250,10 @@ static void draw_bg(const lv_area_t * coords, const lv_area_t * clip, const lv_s
|
|||||||
lv_area_t fill_area;
|
lv_area_t fill_area;
|
||||||
|
|
||||||
/*Apply some optimization if there is no other mask*/
|
/*Apply some optimization if there is no other mask*/
|
||||||
if(other_mask_cnt == 0) {
|
if(simple_mode) {
|
||||||
/*Draw the upper corner area*/
|
/*Draw the upper corner area*/
|
||||||
lv_coord_t upper_corner_end = coords->y1 - disp_area->y1 + corner_size;
|
lv_coord_t upper_corner_end = coords->y1 - disp_area->y1 + corner_size;
|
||||||
|
|
||||||
fill_area.x1 = coords->x1;
|
fill_area.x1 = coords->x1;
|
||||||
fill_area.x2 = coords->x2;
|
fill_area.x2 = coords->x2;
|
||||||
fill_area.y1 = disp_area->y1 + draw_area.y1;
|
fill_area.y1 = disp_area->y1 + draw_area.y1;
|
||||||
@@ -237,15 +263,15 @@ static void draw_bg(const lv_area_t * coords, const lv_area_t * clip, const lv_s
|
|||||||
mask_res = lv_draw_mask_apply(mask_buf, vdb->area.x1 + draw_area.x1, vdb->area.y1 + h, draw_area_w);
|
mask_res = lv_draw_mask_apply(mask_buf, vdb->area.x1 + draw_area.x1, vdb->area.y1 + h, draw_area_w);
|
||||||
|
|
||||||
lv_area_t fill_area2;
|
lv_area_t fill_area2;
|
||||||
fill_area2.x1 = coords->x1;
|
|
||||||
fill_area2.x2 = coords->x1 + rout - 1;
|
|
||||||
fill_area2.y1 = fill_area.y1;
|
fill_area2.y1 = fill_area.y1;
|
||||||
fill_area2.y2 = fill_area.y2;
|
fill_area2.y2 = fill_area.y2;
|
||||||
|
|
||||||
|
fill_area2.x1 = coords->x1;
|
||||||
|
fill_area2.x2 = coords->x1 + rout - 1;
|
||||||
|
|
||||||
lv_blend_fill(clip, &fill_area2,
|
lv_blend_fill(clip, &fill_area2,
|
||||||
style->body.border.color, mask_buf, mask_res, style->body.border.opa, style->body.border.blend_mode);
|
style->body.border.color, mask_buf, mask_res, style->body.border.opa, style->body.border.blend_mode);
|
||||||
|
|
||||||
|
|
||||||
if(fill_area2.y2 < coords->y1 + style->body.border.width) {
|
if(fill_area2.y2 < coords->y1 + style->body.border.width) {
|
||||||
fill_area2.x1 = coords->x1 + rout;
|
fill_area2.x1 = coords->x1 + rout;
|
||||||
fill_area2.x2 = coords->x2 - rout;
|
fill_area2.x2 = coords->x2 - rout;
|
||||||
@@ -253,6 +279,7 @@ static void draw_bg(const lv_area_t * coords, const lv_area_t * clip, const lv_s
|
|||||||
lv_blend_fill(clip, &fill_area2,
|
lv_blend_fill(clip, &fill_area2,
|
||||||
style->body.border.color, NULL, LV_DRAW_MASK_RES_FULL_COVER, style->body.border.opa, style->body.border.blend_mode);
|
style->body.border.color, NULL, LV_DRAW_MASK_RES_FULL_COVER, style->body.border.opa, style->body.border.blend_mode);
|
||||||
}
|
}
|
||||||
|
|
||||||
fill_area2.x1 = coords->x2 - rout + 1;
|
fill_area2.x1 = coords->x2 - rout + 1;
|
||||||
fill_area2.x2 = coords->x2;
|
fill_area2.x2 = coords->x2;
|
||||||
|
|
||||||
@@ -266,6 +293,7 @@ static void draw_bg(const lv_area_t * coords, const lv_area_t * clip, const lv_s
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*Draw the lower corner area corner area*/
|
/*Draw the lower corner area corner area*/
|
||||||
|
if(style->body.border.part & LV_BORDER_PART_BOTTOM) {
|
||||||
lv_coord_t lower_corner_end = coords->y2 - disp_area->y1 - corner_size;
|
lv_coord_t lower_corner_end = coords->y2 - disp_area->y1 - corner_size;
|
||||||
if(lower_corner_end <= upper_corner_end) lower_corner_end = upper_corner_end + 1;
|
if(lower_corner_end <= upper_corner_end) lower_corner_end = upper_corner_end + 1;
|
||||||
fill_area.y1 = disp_area->y1 + lower_corner_end;
|
fill_area.y1 = disp_area->y1 + lower_corner_end;
|
||||||
@@ -284,7 +312,7 @@ static void draw_bg(const lv_area_t * coords, const lv_area_t * clip, const lv_s
|
|||||||
style->body.border.color, mask_buf, mask_res, style->body.border.opa, style->body.border.blend_mode);
|
style->body.border.color, mask_buf, mask_res, style->body.border.opa, style->body.border.blend_mode);
|
||||||
|
|
||||||
|
|
||||||
if(fill_area2.y2 > coords->y2 - style->body.border.width) {
|
if(fill_area2.y2 > coords->y2 - style->body.border.width ) {
|
||||||
fill_area2.x1 = coords->x1 + rout;
|
fill_area2.x1 = coords->x1 + rout;
|
||||||
fill_area2.x2 = coords->x2 - rout;
|
fill_area2.x2 = coords->x2 - rout;
|
||||||
|
|
||||||
@@ -303,13 +331,14 @@ static void draw_bg(const lv_area_t * coords, const lv_area_t * clip, const lv_s
|
|||||||
fill_area.y1++;
|
fill_area.y1++;
|
||||||
fill_area.y2++;
|
fill_area.y2++;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/*Draw the left vertical border part*/
|
/*Draw the left vertical border part*/
|
||||||
fill_area.x1 = coords->x1;
|
|
||||||
fill_area.x2 = coords->x1 + border_width - 1;
|
|
||||||
fill_area.y1 = coords->y1 + corner_size + 1;
|
fill_area.y1 = coords->y1 + corner_size + 1;
|
||||||
fill_area.y2 = coords->y2 - corner_size - 1;
|
fill_area.y2 = coords->y2 - corner_size - 1;
|
||||||
|
|
||||||
|
fill_area.x1 = coords->x1;
|
||||||
|
fill_area.x2 = coords->x1 + border_width - 1;
|
||||||
lv_blend_fill(clip, &fill_area,
|
lv_blend_fill(clip, &fill_area,
|
||||||
style->body.border.color, NULL, LV_DRAW_MASK_RES_FULL_COVER, style->body.border.opa, style->body.border.blend_mode);
|
style->body.border.color, NULL, LV_DRAW_MASK_RES_FULL_COVER, style->body.border.opa, style->body.border.blend_mode);
|
||||||
|
|
||||||
@@ -342,9 +371,24 @@ static void draw_bg(const lv_area_t * coords, const lv_area_t * clip, const lv_s
|
|||||||
}
|
}
|
||||||
|
|
||||||
lv_draw_mask_remove_id(mask_rout_id);
|
lv_draw_mask_remove_id(mask_rout_id);
|
||||||
|
lv_draw_buf_release(mask_buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static lv_color_t grad_get(const lv_style_t * style, lv_coord_t s, lv_coord_t i)
|
||||||
|
{
|
||||||
|
lv_coord_t min = (style->body.main_color_stop * s) >> 8;
|
||||||
|
if(i <= min) return style->body.main_color;
|
||||||
|
|
||||||
|
lv_coord_t max = (style->body.grad_color_stop * s) >> 8;
|
||||||
|
if(i >= max) return style->body.grad_color;
|
||||||
|
|
||||||
|
lv_coord_t d = style->body.grad_color_stop - style->body.main_color_stop;
|
||||||
|
d = (s * d) >> 8;
|
||||||
|
i -= min;
|
||||||
|
lv_opa_t mix = (i * 255) / d;
|
||||||
|
return lv_color_mix(style->body.grad_color, style->body.main_color, mix);
|
||||||
|
}
|
||||||
|
|
||||||
static void draw_shadow(const lv_area_t * coords, const lv_area_t * clip, const lv_style_t * style, lv_opa_t opa_scale)
|
static void draw_shadow(const lv_area_t * coords, const lv_area_t * clip, const lv_style_t * style, lv_opa_t opa_scale)
|
||||||
{
|
{
|
||||||
@@ -387,7 +431,6 @@ static void draw_shadow(const lv_area_t * coords, const lv_area_t * clip, const
|
|||||||
if(is_common == false) return;
|
if(is_common == false) return;
|
||||||
|
|
||||||
const lv_area_t * disp_area = &vdb->area;
|
const lv_area_t * disp_area = &vdb->area;
|
||||||
lv_color_t * disp_buf = vdb->buf_act;
|
|
||||||
|
|
||||||
/* Now `draw_area` has absolute coordinates.
|
/* Now `draw_area` has absolute coordinates.
|
||||||
* Make it relative to `disp_area` to simplify draw to `disp_buf`*/
|
* Make it relative to `disp_area` to simplify draw to `disp_buf`*/
|
||||||
@@ -396,14 +439,11 @@ static void draw_shadow(const lv_area_t * coords, const lv_area_t * clip, const
|
|||||||
draw_area.x2 -= disp_area->x1;
|
draw_area.x2 -= disp_area->x1;
|
||||||
draw_area.y2 -= disp_area->y1;
|
draw_area.y2 -= disp_area->y1;
|
||||||
|
|
||||||
lv_coord_t draw_area_w = lv_area_get_width(&draw_area);
|
|
||||||
|
|
||||||
/*Get the real radius*/
|
/*Get the real radius*/
|
||||||
lv_coord_t r_bg = style->body.radius;
|
lv_coord_t r_bg = style->body.radius;
|
||||||
lv_coord_t short_side = LV_MATH_MIN(lv_area_get_width(coords), lv_area_get_height(coords));
|
lv_coord_t short_side = LV_MATH_MIN(lv_area_get_width(coords), lv_area_get_height(coords));
|
||||||
if(r_bg > short_side >> 1) r_bg = short_side >> 1;
|
if(r_bg > short_side >> 1) r_bg = short_side >> 1;
|
||||||
|
|
||||||
|
|
||||||
lv_coord_t r_sh = style->body.radius;
|
lv_coord_t r_sh = style->body.radius;
|
||||||
short_side = LV_MATH_MIN(lv_area_get_width(&sh_rect_area), lv_area_get_height(&sh_rect_area));
|
short_side = LV_MATH_MIN(lv_area_get_width(&sh_rect_area), lv_area_get_height(&sh_rect_area));
|
||||||
if(r_sh > short_side >> 1) r_sh = short_side >> 1;
|
if(r_sh > short_side >> 1) r_sh = short_side >> 1;
|
||||||
@@ -423,7 +463,7 @@ static void draw_shadow(const lv_area_t * coords, const lv_area_t * clip, const
|
|||||||
|
|
||||||
/*Create a mask*/
|
/*Create a mask*/
|
||||||
lv_draw_mask_res_t mask_res;
|
lv_draw_mask_res_t mask_res;
|
||||||
lv_opa_t mask_buf[LV_HOR_RES_MAX];
|
lv_opa_t * mask_buf = lv_draw_buf_get(lv_area_get_width(&sh_rect_area));
|
||||||
|
|
||||||
lv_draw_mask_param_t mask_rout_param;
|
lv_draw_mask_param_t mask_rout_param;
|
||||||
lv_draw_mask_radius_init(&mask_rout_param, coords, r_bg, true);
|
lv_draw_mask_radius_init(&mask_rout_param, coords, r_bg, true);
|
||||||
@@ -720,12 +760,11 @@ static void draw_shadow(const lv_area_t * coords, const lv_area_t * clip, const
|
|||||||
}
|
}
|
||||||
|
|
||||||
lv_draw_mask_remove_id(mask_rout_id);
|
lv_draw_mask_remove_id(mask_rout_id);
|
||||||
|
lv_draw_buf_release(mask_buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void shadow_draw_corner_buf(const lv_area_t * coords, lv_opa_t * sh_buf, lv_coord_t sw, lv_coord_t r)
|
static void shadow_draw_corner_buf(const lv_area_t * coords, lv_opa_t * sh_buf, lv_coord_t sw, lv_coord_t r)
|
||||||
{
|
{
|
||||||
|
|
||||||
lv_coord_t sw_ori = sw;
|
lv_coord_t sw_ori = sw;
|
||||||
lv_coord_t size = sw_ori + r;
|
lv_coord_t size = sw_ori + r;
|
||||||
|
|
||||||
@@ -739,7 +778,6 @@ static void shadow_draw_corner_buf(const lv_area_t * coords, lv_opa_t * sh_buf,
|
|||||||
|
|
||||||
lv_draw_mask_param_t mask_param;
|
lv_draw_mask_param_t mask_param;
|
||||||
lv_draw_mask_radius_init(&mask_param, &sh_area, r, false);
|
lv_draw_mask_radius_init(&mask_param, &sh_area, r, false);
|
||||||
// int16_t mask_id = lv_draw_mask_add(lv_mask_radius, &mask_param, NULL);
|
|
||||||
|
|
||||||
#if SHADOW_ENHANCE
|
#if SHADOW_ENHANCE
|
||||||
/*Set half shadow width width because blur will be repeated*/
|
/*Set half shadow width width because blur will be repeated*/
|
||||||
@@ -751,8 +789,8 @@ static void shadow_draw_corner_buf(const lv_area_t * coords, lv_opa_t * sh_buf,
|
|||||||
|
|
||||||
lv_draw_mask_res_t mask_res;
|
lv_draw_mask_res_t mask_res;
|
||||||
lv_coord_t y;
|
lv_coord_t y;
|
||||||
lv_opa_t mask_line[size];
|
lv_opa_t * mask_line = lv_draw_buf_get(size);
|
||||||
uint16_t sh_ups_buf[size*size];
|
uint16_t * sh_ups_buf = lv_draw_buf_get(size * size * sizeof(uint16_t));
|
||||||
uint16_t * sh_ups_tmp_buf = sh_ups_buf;
|
uint16_t * sh_ups_tmp_buf = sh_ups_buf;
|
||||||
for(y = 0; y < size; y++) {
|
for(y = 0; y < size; y++) {
|
||||||
memset(mask_line, 0xFF, size);
|
memset(mask_line, 0xFF, size);
|
||||||
@@ -770,7 +808,7 @@ static void shadow_draw_corner_buf(const lv_area_t * coords, lv_opa_t * sh_buf,
|
|||||||
|
|
||||||
sh_ups_tmp_buf += size;
|
sh_ups_tmp_buf += size;
|
||||||
}
|
}
|
||||||
|
lv_draw_buf_release(mask_line);
|
||||||
|
|
||||||
// uint32_t k;
|
// uint32_t k;
|
||||||
// for(k = 0; k < size * size; k++) {
|
// for(k = 0; k < size * size; k++) {
|
||||||
@@ -778,22 +816,23 @@ static void shadow_draw_corner_buf(const lv_area_t * coords, lv_opa_t * sh_buf,
|
|||||||
// }
|
// }
|
||||||
// return;
|
// return;
|
||||||
|
|
||||||
|
|
||||||
if(sw == 1) {
|
if(sw == 1) {
|
||||||
lv_coord_t i;
|
lv_coord_t i;
|
||||||
for(i = 0; i < size * size; i++) {
|
for(i = 0; i < size * size; i++) {
|
||||||
sh_buf[i] = (sh_ups_buf[i] >> SHADOW_UPSACALE_SHIFT);
|
sh_buf[i] = (sh_ups_buf[i] >> SHADOW_UPSACALE_SHIFT);
|
||||||
}
|
}
|
||||||
|
lv_draw_buf_release(sh_ups_buf);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
shadow_blur_corner(size, sw, sh_buf, sh_ups_buf);
|
shadow_blur_corner(size, sw, sh_buf, sh_ups_buf);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#if SHADOW_ENHANCE
|
#if SHADOW_ENHANCE
|
||||||
sw = sw_ori - sw;
|
sw = sw_ori - sw;
|
||||||
if(sw <= 1) return;
|
if(sw <= 1) {
|
||||||
|
lv_draw_buf_release(sh_ups_buf);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
uint32_t i;
|
uint32_t i;
|
||||||
sh_ups_buf[0] = (sh_buf[0] << SHADOW_UPSACALE_SHIFT) / sw;
|
sh_ups_buf[0] = (sh_buf[0] << SHADOW_UPSACALE_SHIFT) / sw;
|
||||||
@@ -805,17 +844,18 @@ static void shadow_draw_corner_buf(const lv_area_t * coords, lv_opa_t * sh_buf,
|
|||||||
shadow_blur_corner(size, sw, sh_buf, sh_ups_buf);
|
shadow_blur_corner(size, sw, sh_buf, sh_ups_buf);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
lv_draw_buf_release(sh_ups_buf);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void shadow_blur_corner(lv_coord_t size, lv_coord_t sw, lv_opa_t * res_buf, uint16_t * sh_ups_buf)
|
static void shadow_blur_corner(lv_coord_t size, lv_coord_t sw, lv_opa_t * res_buf, uint16_t * sh_ups_buf)
|
||||||
{
|
{
|
||||||
|
|
||||||
lv_coord_t s_left = sw >> 1;
|
lv_coord_t s_left = sw >> 1;
|
||||||
lv_coord_t s_right = (sw >> 1);
|
lv_coord_t s_right = (sw >> 1);
|
||||||
if((sw & 1) == 0) s_left--;
|
if((sw & 1) == 0) s_left--;
|
||||||
|
|
||||||
/*Horizontal blur*/
|
/*Horizontal blur*/
|
||||||
uint16_t sh_ups_hor_buf[size*size];
|
uint16_t * sh_ups_hor_buf = lv_draw_buf_get(size * size * sizeof(uint16_t));
|
||||||
uint16_t * sh_ups_hor_buf_tmp;
|
uint16_t * sh_ups_hor_buf_tmp;
|
||||||
|
|
||||||
lv_coord_t x;
|
lv_coord_t x;
|
||||||
@@ -826,7 +866,7 @@ static void shadow_blur_corner(lv_coord_t size, lv_coord_t sw, lv_opa_t * res_bu
|
|||||||
|
|
||||||
for(y = 0; y < size; y++) {
|
for(y = 0; y < size; y++) {
|
||||||
int32_t v = sh_ups_tmp_buf[size-1] * sw;
|
int32_t v = sh_ups_tmp_buf[size-1] * sw;
|
||||||
for(x = size; x >=0; x--) {
|
for(x = size - 1; x >=0; x--) {
|
||||||
sh_ups_hor_buf_tmp[x] = v;
|
sh_ups_hor_buf_tmp[x] = v;
|
||||||
|
|
||||||
/*Forget the right pixel*/
|
/*Forget the right pixel*/
|
||||||
@@ -848,16 +888,18 @@ static void shadow_blur_corner(lv_coord_t size, lv_coord_t sw, lv_opa_t * res_bu
|
|||||||
/*Vertical blur*/
|
/*Vertical blur*/
|
||||||
uint32_t i;
|
uint32_t i;
|
||||||
sh_ups_hor_buf[0] = sh_ups_hor_buf[0] / sw;
|
sh_ups_hor_buf[0] = sh_ups_hor_buf[0] / sw;
|
||||||
for(i = 1; i < size * size; i++) {
|
for(i = 1; i < (uint32_t)size * size; i++) {
|
||||||
if(sh_ups_hor_buf[i] == sh_ups_hor_buf[i-1]) sh_ups_hor_buf[i] = sh_ups_hor_buf[i-1];
|
if(sh_ups_hor_buf[i] == sh_ups_hor_buf[i-1]) sh_ups_hor_buf[i] = sh_ups_hor_buf[i-1];
|
||||||
else sh_ups_hor_buf[i] = sh_ups_hor_buf[i] / sw;
|
else sh_ups_hor_buf[i] = sh_ups_hor_buf[i] / sw;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
for(x = 0; x < size; x++) {
|
for(x = 0; x < size; x++) {
|
||||||
sh_ups_hor_buf_tmp = &sh_ups_hor_buf[x];
|
sh_ups_hor_buf_tmp = &sh_ups_hor_buf[x];
|
||||||
lv_opa_t * sh_buf_tmp = &res_buf[x];
|
lv_opa_t * sh_buf_tmp = &res_buf[x];
|
||||||
int32_t v = sh_ups_hor_buf_tmp[0] * sw;
|
int32_t v = sh_ups_hor_buf_tmp[0] * sw;
|
||||||
for(y = 0; y < size; y++, sh_ups_hor_buf_tmp += size, sh_buf_tmp += size) {
|
for(y = 0; y < size ; y++, sh_ups_hor_buf_tmp += size, sh_buf_tmp += size) {
|
||||||
sh_buf_tmp[0] = v < 0 ? 0 : (v >> SHADOW_UPSACALE_SHIFT);
|
sh_buf_tmp[0] = v < 0 ? 0 : (v >> SHADOW_UPSACALE_SHIFT);
|
||||||
|
|
||||||
/*Forget the top pixel*/
|
/*Forget the top pixel*/
|
||||||
@@ -873,5 +915,7 @@ static void shadow_blur_corner(lv_coord_t size, lv_coord_t sw, lv_opa_t * res_bu
|
|||||||
v += bottom_val;
|
v += bottom_val;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
lv_draw_buf_release(sh_ups_hor_buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -594,7 +594,7 @@ static lv_res_t lv_img_decoder_built_in_line_alpha(lv_img_decoder_dsc_t * dsc, l
|
|||||||
|
|
||||||
#if LV_USE_FILESYSTEM
|
#if LV_USE_FILESYSTEM
|
||||||
lv_img_decoder_built_in_data_t * user_data = dsc->user_data;
|
lv_img_decoder_built_in_data_t * user_data = dsc->user_data;
|
||||||
uint8_t fs_buf[LV_HOR_RES_MAX];
|
uint8_t * fs_buf = lv_draw_buf_get(w);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
const uint8_t * data_tmp = NULL;
|
const uint8_t * data_tmp = NULL;
|
||||||
@@ -629,6 +629,7 @@ static lv_res_t lv_img_decoder_built_in_line_alpha(lv_img_decoder_dsc_t * dsc, l
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
lv_draw_buf_release(fs_buf);
|
||||||
return LV_RES_OK;
|
return LV_RES_OK;
|
||||||
|
|
||||||
#else
|
#else
|
||||||
@@ -681,7 +682,7 @@ static lv_res_t lv_img_decoder_built_in_line_indexed(lv_img_decoder_dsc_t * dsc,
|
|||||||
lv_img_decoder_built_in_data_t * user_data = dsc->user_data;
|
lv_img_decoder_built_in_data_t * user_data = dsc->user_data;
|
||||||
|
|
||||||
#if LV_USE_FILESYSTEM
|
#if LV_USE_FILESYSTEM
|
||||||
uint8_t fs_buf[LV_HOR_RES_MAX];
|
uint8_t * fs_buf = lv_draw_buf_get(w);
|
||||||
#endif
|
#endif
|
||||||
const uint8_t * data_tmp = NULL;
|
const uint8_t * data_tmp = NULL;
|
||||||
if(dsc->src_type == LV_IMG_SRC_VARIABLE) {
|
if(dsc->src_type == LV_IMG_SRC_VARIABLE) {
|
||||||
@@ -713,7 +714,7 @@ static lv_res_t lv_img_decoder_built_in_line_indexed(lv_img_decoder_dsc_t * dsc,
|
|||||||
data_tmp++;
|
data_tmp++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
lv_draw_buf_release(fs_buf);
|
||||||
return LV_RES_OK;
|
return LV_RES_OK;
|
||||||
#else
|
#else
|
||||||
LV_LOG_WARN("Image built-in indexed line reader failed because LV_IMG_CF_INDEXED is 0 in lv_conf.h");
|
LV_LOG_WARN("Image built-in indexed line reader failed because LV_IMG_CF_INDEXED is 0 in lv_conf.h");
|
||||||
|
|||||||
@@ -25,6 +25,7 @@ extern "C" {
|
|||||||
#include "lv_mem.h"
|
#include "lv_mem.h"
|
||||||
#include "lv_ll.h"
|
#include "lv_ll.h"
|
||||||
#include "../lv_draw/lv_img_cache.h"
|
#include "../lv_draw/lv_img_cache.h"
|
||||||
|
#include "../lv_draw/lv_draw.h"
|
||||||
|
|
||||||
/*********************
|
/*********************
|
||||||
* DEFINES
|
* DEFINES
|
||||||
@@ -41,7 +42,7 @@ extern "C" {
|
|||||||
prefix lv_ll_t _lv_img_defoder_ll; \
|
prefix lv_ll_t _lv_img_defoder_ll; \
|
||||||
prefix lv_img_cache_entry_t * _lv_img_cache_array; \
|
prefix lv_img_cache_entry_t * _lv_img_cache_array; \
|
||||||
prefix void * _lv_task_act; \
|
prefix void * _lv_task_act; \
|
||||||
prefix void * _lv_draw_buf;
|
prefix lv_draw_buf_t _lv_draw_buf[LV_DRAW_BUF_MAX_NUM]; \
|
||||||
|
|
||||||
#define LV_NO_PREFIX
|
#define LV_NO_PREFIX
|
||||||
#define LV_ROOTS LV_GC_ROOTS(LV_NO_PREFIX)
|
#define LV_ROOTS LV_GC_ROOTS(LV_NO_PREFIX)
|
||||||
|
|||||||
@@ -660,22 +660,22 @@ static lv_design_res_t lv_btnm_design(lv_obj_t * btnm, const lv_area_t * clip_ar
|
|||||||
lv_style_copy(&style_tmp, btn_style);
|
lv_style_copy(&style_tmp, btn_style);
|
||||||
|
|
||||||
/*Remove borders on the edges if `LV_BORDER_INTERNAL`*/
|
/*Remove borders on the edges if `LV_BORDER_INTERNAL`*/
|
||||||
if(style_tmp.body.border.part & LV_BORDER_INTERNAL) {
|
if(style_tmp.body.border.part & LV_BORDER_PART_INTERNAL) {
|
||||||
if(area_tmp.y1 == btnm->coords.y1 + bg_style->body.padding.top) {
|
if(area_tmp.y1 == btnm->coords.y1 + bg_style->body.padding.top) {
|
||||||
style_tmp.body.border.part &= ~LV_BORDER_TOP;
|
style_tmp.body.border.part &= ~LV_BORDER_PART_TOP;
|
||||||
}
|
}
|
||||||
if(area_tmp.y2 == btnm->coords.y2 - bg_style->body.padding.bottom) {
|
if(area_tmp.y2 == btnm->coords.y2 - bg_style->body.padding.bottom) {
|
||||||
style_tmp.body.border.part &= ~LV_BORDER_BOTTOM;
|
style_tmp.body.border.part &= ~LV_BORDER_PART_BOTTOM;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(txt_i == 0) {
|
if(txt_i == 0) {
|
||||||
style_tmp.body.border.part &= ~LV_BORDER_LEFT;
|
style_tmp.body.border.part &= ~LV_BORDER_PART_LEFT;
|
||||||
} else if(strcmp(ext->map_p[txt_i - 1], "\n") == 0) {
|
} else if(strcmp(ext->map_p[txt_i - 1], "\n") == 0) {
|
||||||
style_tmp.body.border.part &= ~LV_BORDER_LEFT;
|
style_tmp.body.border.part &= ~LV_BORDER_PART_LEFT;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(ext->map_p[txt_i + 1][0] == '\0' || strcmp(ext->map_p[txt_i + 1], "\n") == 0) {
|
if(ext->map_p[txt_i + 1][0] == '\0' || strcmp(ext->map_p[txt_i + 1], "\n") == 0) {
|
||||||
style_tmp.body.border.part &= ~LV_BORDER_RIGHT;
|
style_tmp.body.border.part &= ~LV_BORDER_PART_RIGHT;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
lv_draw_rect(&area_tmp, clip_area, &style_tmp, opa_scale);
|
lv_draw_rect(&area_tmp, clip_area, &style_tmp, opa_scale);
|
||||||
|
|||||||
@@ -217,8 +217,8 @@ static lv_design_res_t lv_line_design(lv_obj_t * line, const lv_area_t * clip_ar
|
|||||||
lv_opa_t opa_scale = lv_obj_get_opa_scale(line);
|
lv_opa_t opa_scale = lv_obj_get_opa_scale(line);
|
||||||
lv_area_t area;
|
lv_area_t area;
|
||||||
lv_obj_get_coords(line, &area);
|
lv_obj_get_coords(line, &area);
|
||||||
lv_coord_t x_ofs = area.x1;
|
lv_coord_t x_ofs = area.x1;// - (style->line.width & 0x1);
|
||||||
lv_coord_t y_ofs = area.y1;
|
lv_coord_t y_ofs = area.y1;// - (style->line.width & 0x1 ? 0 : 1);
|
||||||
lv_point_t p1;
|
lv_point_t p1;
|
||||||
lv_point_t p2;
|
lv_point_t p2;
|
||||||
lv_coord_t h = lv_obj_get_height(line);
|
lv_coord_t h = lv_obj_get_height(line);
|
||||||
@@ -227,8 +227,8 @@ static lv_design_res_t lv_line_design(lv_obj_t * line, const lv_area_t * clip_ar
|
|||||||
lv_style_t circle_style_tmp; /*If rounded...*/
|
lv_style_t circle_style_tmp; /*If rounded...*/
|
||||||
lv_style_copy(&circle_style_tmp, style);
|
lv_style_copy(&circle_style_tmp, style);
|
||||||
circle_style_tmp.body.radius = LV_RADIUS_CIRCLE;
|
circle_style_tmp.body.radius = LV_RADIUS_CIRCLE;
|
||||||
circle_style_tmp.body.main_color = style->line.color;
|
circle_style_tmp.body.main_color = style->line.color;//LV_COLOR_RED;//style->line.color;
|
||||||
circle_style_tmp.body.grad_color = style->line.color;
|
circle_style_tmp.body.grad_color = style->line.color;//LV_COLOR_RED;//style->line.color;
|
||||||
circle_style_tmp.body.opa = style->line.opa;
|
circle_style_tmp.body.opa = style->line.opa;
|
||||||
lv_area_t circle_area;
|
lv_area_t circle_area;
|
||||||
|
|
||||||
@@ -249,20 +249,22 @@ static lv_design_res_t lv_line_design(lv_obj_t * line, const lv_area_t * clip_ar
|
|||||||
|
|
||||||
/*Draw circle on the joints if enabled*/
|
/*Draw circle on the joints if enabled*/
|
||||||
if(style->line.rounded) {
|
if(style->line.rounded) {
|
||||||
circle_area.x1 = p1.x - ((style->line.width - 1) >> 1) - ((style->line.width - 1) & 0x1);
|
lv_coord_t r = (style->line.width >> 1);
|
||||||
circle_area.y1 = p1.y - ((style->line.width - 1) >> 1) - ((style->line.width - 1) & 0x1);
|
circle_area.x1 = p1.x - r;
|
||||||
circle_area.x2 = p1.x + ((style->line.width - 1) >> 1);
|
circle_area.y1 = p1.y - r;
|
||||||
circle_area.y2 = p1.y + ((style->line.width - 1) >> 1);
|
circle_area.x2 = p1.x + r - 1;
|
||||||
|
circle_area.y2 = p1.y + r - 1;
|
||||||
lv_draw_rect(&circle_area, clip_area, &circle_style_tmp, opa_scale);
|
lv_draw_rect(&circle_area, clip_area, &circle_style_tmp, opa_scale);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*Draw circle on the last point too if enabled*/
|
/*Draw circle on the last point too if enabled*/
|
||||||
if(style->line.rounded) {
|
if(style->line.rounded) {
|
||||||
circle_area.x1 = p2.x - ((style->line.width - 1) >> 1) - ((style->line.width - 1) & 0x1);
|
lv_coord_t r = (style->line.width >> 1) - 1;
|
||||||
circle_area.y1 = p2.y - ((style->line.width - 1) >> 1) - ((style->line.width - 1) & 0x1);
|
circle_area.x1 = p2.x - r - 1;
|
||||||
circle_area.x2 = p2.x + ((style->line.width - 1) >> 1);
|
circle_area.y1 = p2.y - r - 1;
|
||||||
circle_area.y2 = p2.y + ((style->line.width - 1) >> 1);
|
circle_area.x2 = p2.x + r;
|
||||||
|
circle_area.y2 = p2.y + r;
|
||||||
lv_draw_rect(&circle_area, clip_area, &circle_style_tmp, opa_scale);
|
lv_draw_rect(&circle_area, clip_area, &circle_style_tmp, opa_scale);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -69,7 +69,7 @@ lv_obj_t * lv_objmask_create(lv_obj_t * par, const lv_obj_t * copy)
|
|||||||
|
|
||||||
/*Init the new object mask object mask*/
|
/*Init the new object mask object mask*/
|
||||||
if(copy == NULL) {
|
if(copy == NULL) {
|
||||||
lv_objmask_set_style(new_objmask, LV_OBJMASK_STYLE_BG, &lv_style_transp);
|
lv_objmask_set_style(new_objmask, LV_OBJMASK_STYLE_BG, &lv_style_plain);
|
||||||
|
|
||||||
}
|
}
|
||||||
/*Copy an existing object mask*/
|
/*Copy an existing object mask*/
|
||||||
|
|||||||
@@ -823,7 +823,7 @@ static void win_init(void)
|
|||||||
header.body.border.opa = panel.body.border.opa;
|
header.body.border.opa = panel.body.border.opa;
|
||||||
header.body.border.width = panel.body.border.width;
|
header.body.border.width = panel.body.border.width;
|
||||||
header.body.border.color = lv_color_hsv_to_rgb(_hue, 20, 80);
|
header.body.border.color = lv_color_hsv_to_rgb(_hue, 20, 80);
|
||||||
header.body.border.part = LV_BORDER_BOTTOM;
|
header.body.border.part = LV_BORDER_PART_BOTTOM;
|
||||||
header.text.color = lv_color_hsv_to_rgb(_hue, 5, 100);
|
header.text.color = lv_color_hsv_to_rgb(_hue, 5, 100);
|
||||||
header.image.color = lv_color_hsv_to_rgb(_hue, 5, 100);
|
header.image.color = lv_color_hsv_to_rgb(_hue, 5, 100);
|
||||||
|
|
||||||
|
|||||||
@@ -378,7 +378,7 @@ static void calendar_init(void)
|
|||||||
week_box.body.padding.right = theme.style.panel->body.padding.right;
|
week_box.body.padding.right = theme.style.panel->body.padding.right;
|
||||||
week_box.body.border.color = theme.style.panel->body.border.color;
|
week_box.body.border.color = theme.style.panel->body.border.color;
|
||||||
week_box.body.border.width = theme.style.panel->body.border.width;
|
week_box.body.border.width = theme.style.panel->body.border.width;
|
||||||
week_box.body.border.part = LV_BORDER_LEFT | LV_BORDER_RIGHT;
|
week_box.body.border.part = LV_BORDER_PART_LEFT | LV_BORDER_PART_RIGHT;
|
||||||
week_box.body.radius = 0;
|
week_box.body.radius = 0;
|
||||||
|
|
||||||
static lv_style_t today_box;
|
static lv_style_t today_box;
|
||||||
@@ -445,7 +445,7 @@ static void btnm_init(void)
|
|||||||
bg.text.color = lv_color_hex3(0x555);
|
bg.text.color = lv_color_hex3(0x555);
|
||||||
|
|
||||||
lv_style_copy(&rel, theme.style.panel);
|
lv_style_copy(&rel, theme.style.panel);
|
||||||
rel.body.border.part = LV_BORDER_FULL | LV_BORDER_INTERNAL;
|
rel.body.border.part = LV_BORDER_PART_FULL | LV_BORDER_PART_INTERNAL;
|
||||||
rel.body.border.width = 1;
|
rel.body.border.width = 1;
|
||||||
rel.body.border.color = lv_color_hex3(0xbbb);
|
rel.body.border.color = lv_color_hex3(0xbbb);
|
||||||
rel.body.opa = LV_OPA_TRANSP;
|
rel.body.opa = LV_OPA_TRANSP;
|
||||||
@@ -536,7 +536,7 @@ static void ta_init(void)
|
|||||||
lv_style_copy(&oneline, &def);
|
lv_style_copy(&oneline, &def);
|
||||||
oneline.body.opa = LV_OPA_TRANSP;
|
oneline.body.opa = LV_OPA_TRANSP;
|
||||||
oneline.body.radius = 0;
|
oneline.body.radius = 0;
|
||||||
oneline.body.border.part = LV_BORDER_BOTTOM;
|
oneline.body.border.part = LV_BORDER_PART_BOTTOM;
|
||||||
oneline.body.border.width = 3;
|
oneline.body.border.width = 3;
|
||||||
oneline.body.border.color = lv_color_hex3(0x333);
|
oneline.body.border.color = lv_color_hex3(0x333);
|
||||||
oneline.body.border.opa = LV_OPA_COVER;
|
oneline.body.border.opa = LV_OPA_COVER;
|
||||||
@@ -579,7 +579,7 @@ static void list_init(void)
|
|||||||
rel.body.radius = 10;
|
rel.body.radius = 10;
|
||||||
rel.body.border.color = lv_color_hex3(0xbbb);
|
rel.body.border.color = lv_color_hex3(0xbbb);
|
||||||
rel.body.border.width = 1;
|
rel.body.border.width = 1;
|
||||||
rel.body.border.part = LV_BORDER_BOTTOM;
|
rel.body.border.part = LV_BORDER_PART_BOTTOM;
|
||||||
|
|
||||||
lv_style_copy(&pr, &rel);
|
lv_style_copy(&pr, &rel);
|
||||||
pr.glass = 0;
|
pr.glass = 0;
|
||||||
@@ -679,7 +679,7 @@ static void tabview_init(void)
|
|||||||
btn_bg.body.radius = 0;
|
btn_bg.body.radius = 0;
|
||||||
btn_bg.body.border.width = 1;
|
btn_bg.body.border.width = 1;
|
||||||
btn_bg.body.border.color = lv_color_hex3(0x888);
|
btn_bg.body.border.color = lv_color_hex3(0x888);
|
||||||
btn_bg.body.border.part = LV_BORDER_BOTTOM;
|
btn_bg.body.border.part = LV_BORDER_PART_BOTTOM;
|
||||||
btn_bg.body.border.opa = LV_OPA_COVER;
|
btn_bg.body.border.opa = LV_OPA_COVER;
|
||||||
btn_bg.body.shadow.width = 5;
|
btn_bg.body.shadow.width = 5;
|
||||||
btn_bg.body.shadow.color = DEF_SHADOW_COLOR;
|
btn_bg.body.shadow.color = DEF_SHADOW_COLOR;
|
||||||
@@ -703,7 +703,7 @@ static void tabview_init(void)
|
|||||||
pr.body.radius = 0;
|
pr.body.radius = 0;
|
||||||
pr.body.border.width = 1;
|
pr.body.border.width = 1;
|
||||||
pr.body.border.color = lv_color_hex3(0x888);
|
pr.body.border.color = lv_color_hex3(0x888);
|
||||||
pr.body.border.part = LV_BORDER_BOTTOM;
|
pr.body.border.part = LV_BORDER_PART_BOTTOM;
|
||||||
pr.body.border.opa = LV_OPA_COVER;
|
pr.body.border.opa = LV_OPA_COVER;
|
||||||
pr.text.color = lv_color_hex3(0x111);
|
pr.text.color = lv_color_hex3(0x111);
|
||||||
|
|
||||||
@@ -767,7 +767,7 @@ static void win_init(void)
|
|||||||
header.body.radius = 0;
|
header.body.radius = 0;
|
||||||
header.body.border.width = 1;
|
header.body.border.width = 1;
|
||||||
header.body.border.color = lv_color_hex3(0xbbb);
|
header.body.border.color = lv_color_hex3(0xbbb);
|
||||||
header.body.border.part = LV_BORDER_BOTTOM;
|
header.body.border.part = LV_BORDER_PART_BOTTOM;
|
||||||
header.body.border.opa = LV_OPA_COVER;
|
header.body.border.opa = LV_OPA_COVER;
|
||||||
header.body.padding.inner = 0;
|
header.body.padding.inner = 0;
|
||||||
header.body.padding.left = 0;
|
header.body.padding.left = 0;
|
||||||
|
|||||||
@@ -61,7 +61,7 @@ static void basic_init(void)
|
|||||||
def.body.border.color = LV_COLOR_BLACK;
|
def.body.border.color = LV_COLOR_BLACK;
|
||||||
def.body.border.width = 1;
|
def.body.border.width = 1;
|
||||||
def.body.border.opa = LV_OPA_COVER;
|
def.body.border.opa = LV_OPA_COVER;
|
||||||
def.body.border.part = LV_BORDER_FULL;
|
def.body.border.part = LV_BORDER_PART_FULL;
|
||||||
|
|
||||||
def.text.font = _font;
|
def.text.font = _font;
|
||||||
def.text.color = LV_COLOR_BLACK;
|
def.text.color = LV_COLOR_BLACK;
|
||||||
|
|||||||
@@ -456,7 +456,7 @@ static void btnm_init(void)
|
|||||||
btnm_bg.body.border.width = 1;
|
btnm_bg.body.border.width = 1;
|
||||||
|
|
||||||
lv_style_copy(&rel, theme.style.btn.rel);
|
lv_style_copy(&rel, theme.style.btn.rel);
|
||||||
rel.body.border.part = LV_BORDER_FULL | LV_BORDER_INTERNAL;
|
rel.body.border.part = LV_BORDER_PART_FULL | LV_BORDER_PART_INTERNAL;
|
||||||
rel.body.border.width = 1;
|
rel.body.border.width = 1;
|
||||||
rel.body.radius = 2;
|
rel.body.radius = 2;
|
||||||
|
|
||||||
@@ -571,7 +571,7 @@ static void list_init(void)
|
|||||||
|
|
||||||
lv_style_copy(&list_btn_rel, &bg);
|
lv_style_copy(&list_btn_rel, &bg);
|
||||||
list_btn_rel.body.opa = LV_OPA_TRANSP;
|
list_btn_rel.body.opa = LV_OPA_TRANSP;
|
||||||
list_btn_rel.body.border.part = LV_BORDER_BOTTOM;
|
list_btn_rel.body.border.part = LV_BORDER_PART_BOTTOM;
|
||||||
list_btn_rel.body.border.color = lv_color_hsv_to_rgb(_hue, 10, 5);
|
list_btn_rel.body.border.color = lv_color_hsv_to_rgb(_hue, 10, 5);
|
||||||
list_btn_rel.body.border.width = 1;
|
list_btn_rel.body.border.width = 1;
|
||||||
list_btn_rel.body.radius = LV_DPI / 10;
|
list_btn_rel.body.radius = LV_DPI / 10;
|
||||||
|
|||||||
@@ -681,7 +681,7 @@ static void tabview_init(void)
|
|||||||
lv_style_copy(&btn_bg, &def);
|
lv_style_copy(&btn_bg, &def);
|
||||||
btn_bg.body.opa = LV_OPA_TRANSP;
|
btn_bg.body.opa = LV_OPA_TRANSP;
|
||||||
btn_bg.body.border.width = 2;
|
btn_bg.body.border.width = 2;
|
||||||
btn_bg.body.border.part = LV_BORDER_BOTTOM;
|
btn_bg.body.border.part = LV_BORDER_PART_BOTTOM;
|
||||||
btn_bg.body.border.color = lv_color_hsv_to_rgb(_hue, 10, 90);
|
btn_bg.body.border.color = lv_color_hsv_to_rgb(_hue, 10, 90);
|
||||||
|
|
||||||
lv_style_copy(&indic, &def);
|
lv_style_copy(&indic, &def);
|
||||||
@@ -750,7 +750,7 @@ static void win_init(void)
|
|||||||
lv_style_copy(&header, &def);
|
lv_style_copy(&header, &def);
|
||||||
header.body.opa = LV_OPA_TRANSP;
|
header.body.opa = LV_OPA_TRANSP;
|
||||||
header.body.border.width = 2;
|
header.body.border.width = 2;
|
||||||
header.body.border.part = LV_BORDER_BOTTOM;
|
header.body.border.part = LV_BORDER_PART_BOTTOM;
|
||||||
header.body.border.color = lv_color_hsv_to_rgb(_hue, 10, 90);
|
header.body.border.color = lv_color_hsv_to_rgb(_hue, 10, 90);
|
||||||
header.text.color = lv_color_hex3(0x666);
|
header.text.color = lv_color_hex3(0x666);
|
||||||
header.image.color = lv_color_hex3(0x666);
|
header.image.color = lv_color_hex3(0x666);
|
||||||
|
|||||||
Reference in New Issue
Block a user