mirror of
https://github.com/lvgl/lvgl.git
synced 2026-05-25 01:04:25 +08:00
feat(vector): draw rectangle should support minus width/height (#9716)
This commit is contained in:
@@ -389,8 +389,6 @@ void lv_vector_path_get_bounding(const lv_vector_path_t * path, lv_area_t * area
|
||||
|
||||
void lv_vector_path_append_rectangle(lv_vector_path_t * path, float x, float y, float w, float h, float rx, float ry)
|
||||
{
|
||||
if(w <= 0.0f || h <= 0.0f) return;
|
||||
|
||||
float hw = w * 0.5f;
|
||||
float hh = h * 0.5f;
|
||||
|
||||
|
||||
@@ -50,7 +50,13 @@ static void draw_shapes(lv_layer_t * layer, const lv_matrix_t * transform)
|
||||
lv_area_t rect1 = {50, 50, 150, 150};
|
||||
lv_draw_vector_dsc_set_transform(ctx, transform);
|
||||
lv_vector_path_clear(path);
|
||||
lv_vector_path_append_rect(path, &rect1, 0, 0);
|
||||
|
||||
/*
|
||||
* Regarding x=100, create two mirrored rectangles,
|
||||
* using positive width and negative width respectively.
|
||||
*/
|
||||
lv_vector_path_append_rectangle(path, 100, 50, 51, 101, 0, 0);
|
||||
lv_vector_path_append_rectangle(path, 100, 50, -50, 101, 0, 0);
|
||||
lv_draw_vector_dsc_set_fill_color(ctx, lv_color_make(0xff, 0x00, 0x00));
|
||||
lv_draw_vector_dsc_add_path(ctx, path);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user