merge new draw structure

This commit is contained in:
Gabor Kiss-Vamosi
2018-06-07 15:42:41 +02:00
19 changed files with 3138 additions and 2131 deletions

View File

@@ -48,8 +48,8 @@ typedef struct
uint16_t sel_opt_id; /*Index of the current option*/
uint16_t sel_opt_id_ori; /*Store the original index on focus*/
uint16_t anim_time; /*Open/Close animation time [ms]*/
uint8_t opened :1; /*1: The list is opened*/
lv_coord_t fix_height; /*Height if the ddlist is opened. (0: auto-size)*/
uint8_t opened :1; /*1: The list is opened (handled by the library)*/
lv_coord_t fix_height; /*Height of the ddlist when opened. (0: auto-size)*/
}lv_ddlist_ext_t;
typedef enum {

View File

@@ -215,6 +215,14 @@ static bool lv_line_design(lv_obj_t * line, const lv_area_t * mask, lv_design_mo
lv_coord_t h = lv_obj_get_height(line);
uint16_t i;
lv_style_t circle_style;
lv_style_copy(&circle_style, style);
circle_style.body.radius = LV_RADIUS_CIRCLE;
circle_style.body.main_color = style->line.color;
circle_style.body.grad_color = style->line.color;
circle_style.body.opa = style->line.opa;
lv_area_t circle_area;
/*Read all pints and draw the lines*/
for (i = 0; i < ext->point_num - 1; i++) {
@@ -229,7 +237,20 @@ static bool lv_line_design(lv_obj_t * line, const lv_area_t * mask, lv_design_mo
p2.y = h - ext->point_array[i + 1].y + y_ofs;
}
lv_draw_line(&p1, &p2, mask, style);
circle_area.x1 = p1.x - (style->line.width >> 1);
circle_area.y1 = p1.y - (style->line.width >> 1);
circle_area.x2 = p1.x + (style->line.width >> 1);
circle_area.y2 = p1.y + (style->line.width >> 1);
// lv_draw_rect(&circle_area, mask, &circle_style);
}
circle_area.x1 = p2.x - (style->line.width >> 1);
circle_area.y1 = p2.y - (style->line.width >> 1);
circle_area.x2 = p2.x + (style->line.width >> 1);
circle_area.y2 = p2.y + (style->line.width >> 1);
// lv_draw_rect(&circle_area, mask, &circle_style);
}
return true;
}

View File

@@ -14,6 +14,7 @@
#include "../lv_themes/lv_theme.h"
#include "../lv_core/lv_group.h"
#include "../lv_misc/lv_trigo.h"
#include "../lv_misc/lv_math.h"
/*********************
* DEFINES
@@ -332,6 +333,13 @@ static lv_res_t lv_lmeter_signal(lv_obj_t * lmeter, lv_signal_t sign, void * par
if(sign == LV_SIGNAL_CLEANUP) {
/*Nothing to cleanup. (No dynamically allocated memory in 'ext')*/
}
else if(sign == LV_SIGNAL_STYLE_CHG) {
lv_obj_refresh_ext_size(lmeter);
}
else if(sign == LV_SIGNAL_REFR_EXT_SIZE) {
lv_style_t * style = lv_lmeter_get_style(lmeter);
lmeter->ext_size = LV_MATH_MAX(lmeter->ext_size, style->line.width);
}
else if(sign == LV_SIGNAL_GET_TYPE) {
lv_obj_type_t * buf = param;
uint8_t i;

View File

@@ -130,7 +130,7 @@ uint16_t lv_lmeter_get_scale_angle(lv_obj_t * lmeter);
* @param lmeter pointer to a line meter object
* @return pointer to the line meter's style
*/
static inline lv_style_t * lv_lmeter_get_style_bg(lv_obj_t * lmeter)
static inline lv_style_t * lv_lmeter_get_style(lv_obj_t * lmeter)
{
return lv_obj_get_style(lmeter);
}