Merge pull request #1684 from lvgl/pete-pjb-cpicker
Tidy up the edges of the colour picker widget.
This commit is contained in:
@@ -14,6 +14,7 @@
|
|||||||
### Bugfixes
|
### Bugfixes
|
||||||
- Do not print warning for missing glyph if its height OR width is zero.
|
- Do not print warning for missing glyph if its height OR width is zero.
|
||||||
- Prevent duplicated sending of `LV_EVENT_INSERT` from text area
|
- Prevent duplicated sending of `LV_EVENT_INSERT` from text area
|
||||||
|
- Tidy outer edges of cpicker widget.
|
||||||
- Remove duplicated lines from `lv_tabview_add_tab`
|
- Remove duplicated lines from `lv_tabview_add_tab`
|
||||||
|
|
||||||
## v7.2.0 (21.07.2020)
|
## v7.2.0 (21.07.2020)
|
||||||
|
|||||||
@@ -48,6 +48,13 @@
|
|||||||
|
|
||||||
#define TRI_OFFSET 2
|
#define TRI_OFFSET 2
|
||||||
|
|
||||||
|
/* The OUTER_MASK_WIDTH define is required to assist with the placing of a mask over the outer ring of the widget as when the
|
||||||
|
* multicoloured radial lines are calculated for the outer ring of the widget their lengths are jittering because of the
|
||||||
|
* integer based arithmetic. From tests the maximum delta was found to be 2 so the current value is set to 3 to achieve
|
||||||
|
* appropriate masking.
|
||||||
|
*/
|
||||||
|
#define OUTER_MASK_WIDTH 3
|
||||||
|
|
||||||
/**********************
|
/**********************
|
||||||
* TYPEDEFS
|
* TYPEDEFS
|
||||||
**********************/
|
**********************/
|
||||||
@@ -483,6 +490,17 @@ static void draw_disc_grad(lv_obj_t * cpicker, const lv_area_t * mask)
|
|||||||
uint16_t i;
|
uint16_t i;
|
||||||
lv_coord_t cir_w = lv_obj_get_style_scale_width(cpicker, LV_CPICKER_PART_MAIN);
|
lv_coord_t cir_w = lv_obj_get_style_scale_width(cpicker, LV_CPICKER_PART_MAIN);
|
||||||
|
|
||||||
|
/* Mask outer ring of widget to tidy up ragged edges of lines while drawing outer ring */
|
||||||
|
lv_area_t mask_area_out;
|
||||||
|
lv_area_copy( &mask_area_out, &cpicker->coords);
|
||||||
|
mask_area_out.x1 += OUTER_MASK_WIDTH;
|
||||||
|
mask_area_out.x2 -= OUTER_MASK_WIDTH;
|
||||||
|
mask_area_out.y1 += OUTER_MASK_WIDTH;
|
||||||
|
mask_area_out.y2 -= OUTER_MASK_WIDTH;
|
||||||
|
lv_draw_mask_radius_param_t mask_out_param;
|
||||||
|
lv_draw_mask_radius_init(&mask_out_param, &mask_area_out, LV_RADIUS_CIRCLE, false);
|
||||||
|
int16_t mask_out_id = lv_draw_mask_add(&mask_out_param, 0);
|
||||||
|
|
||||||
/* The inner line ends will be masked out.
|
/* The inner line ends will be masked out.
|
||||||
* So make lines a little bit longer because the masking makes a more even result */
|
* So make lines a little bit longer because the masking makes a more even result */
|
||||||
lv_coord_t cir_w_extra = cir_w + line_dsc.width;
|
lv_coord_t cir_w_extra = cir_w + line_dsc.width;
|
||||||
@@ -498,7 +516,8 @@ static void draw_disc_grad(lv_obj_t * cpicker, const lv_area_t * mask)
|
|||||||
|
|
||||||
lv_draw_line(&p[0], &p[1], mask, &line_dsc);
|
lv_draw_line(&p[0], &p[1], mask, &line_dsc);
|
||||||
}
|
}
|
||||||
|
/* Now remove mask to continue with inner part */
|
||||||
|
lv_draw_mask_remove_id(mask_out_id);
|
||||||
|
|
||||||
/*Mask out the inner area*/
|
/*Mask out the inner area*/
|
||||||
lv_draw_rect_dsc_t bg_dsc;
|
lv_draw_rect_dsc_t bg_dsc;
|
||||||
|
|||||||
Reference in New Issue
Block a user