mirror of
https://github.com/lvgl/lvgl.git
synced 2026-05-30 07:06:19 +08:00
refactor(vector): clean up the API of vector drawing (#8922)
Co-authored-by: cubic-dev-ai[bot] <191113872+cubic-dev-ai[bot]@users.noreply.github.com>
This commit is contained in:
committed by
GitHub
parent
a9f3ac781a
commit
8b6e87021f
@@ -34,38 +34,38 @@ void tearDown(void)
|
||||
|
||||
static void draw_shapes(lv_layer_t * layer, const lv_matrix_t * transform)
|
||||
{
|
||||
lv_vector_dsc_t * ctx = lv_vector_dsc_create(layer);
|
||||
lv_vector_dsc_set_transform(ctx, transform);
|
||||
lv_draw_vector_dsc_t * ctx = lv_draw_vector_dsc_create(layer);
|
||||
lv_draw_vector_dsc_set_transform(ctx, transform);
|
||||
|
||||
lv_area_t rect = {0, 0, 640, 480};
|
||||
lv_vector_dsc_set_fill_color(ctx, lv_color_white());
|
||||
lv_draw_vector_dsc_set_fill_color(ctx, lv_color_white());
|
||||
rect = lv_matrix_transform_area(transform, &rect);
|
||||
lv_vector_clear_area(ctx, &rect);
|
||||
lv_draw_vector_dsc_clear_area(ctx, &rect);
|
||||
|
||||
lv_vector_path_t * path = lv_vector_path_create(LV_VECTOR_PATH_QUALITY_MEDIUM);
|
||||
|
||||
lv_area_t rect1 = {50, 50, 150, 150};
|
||||
lv_vector_dsc_set_transform(ctx, transform);
|
||||
lv_draw_vector_dsc_set_transform(ctx, transform);
|
||||
lv_vector_path_clear(path);
|
||||
lv_vector_path_append_rect(path, &rect1, 0, 0);
|
||||
lv_vector_dsc_set_fill_color(ctx, lv_color_make(0xff, 0x00, 0x00));
|
||||
lv_vector_dsc_add_path(ctx, path);
|
||||
lv_draw_vector_dsc_set_fill_color(ctx, lv_color_make(0xff, 0x00, 0x00));
|
||||
lv_draw_vector_dsc_add_path(ctx, path);
|
||||
|
||||
lv_vector_path_clear(path);
|
||||
lv_vector_path_append_rect(path, &rect1, 20, 20);
|
||||
lv_vector_dsc_translate(ctx, 150, 0);
|
||||
lv_vector_dsc_set_fill_color(ctx, lv_color_make(0x00, 0x00, 0xff));
|
||||
lv_vector_dsc_add_path(ctx, path);
|
||||
lv_draw_vector_dsc_translate(ctx, 150, 0);
|
||||
lv_draw_vector_dsc_set_fill_color(ctx, lv_color_make(0x00, 0x00, 0xff));
|
||||
lv_draw_vector_dsc_add_path(ctx, path);
|
||||
|
||||
lv_fpoint_t pc = {100, 100};
|
||||
lv_vector_path_clear(path);
|
||||
lv_vector_path_append_circle(path, &pc, 50, 50);
|
||||
lv_vector_dsc_translate(ctx, 150, 0);
|
||||
lv_vector_dsc_set_fill_color32(ctx, lv_color_to_32(lv_color_make(0x00, 0xff, 0x00), 0x80));
|
||||
lv_vector_dsc_add_path(ctx, path);
|
||||
lv_draw_vector_dsc_translate(ctx, 150, 0);
|
||||
lv_draw_vector_dsc_set_fill_color32(ctx, lv_color_to_32(lv_color_make(0x00, 0xff, 0x00), 0x80));
|
||||
lv_draw_vector_dsc_add_path(ctx, path);
|
||||
|
||||
lv_vector_dsc_set_transform(ctx, transform);
|
||||
lv_vector_dsc_translate(ctx, 0, 150);
|
||||
lv_draw_vector_dsc_set_transform(ctx, transform);
|
||||
lv_draw_vector_dsc_translate(ctx, 0, 150);
|
||||
|
||||
lv_grad_stop_t stops[2];
|
||||
lv_memzero(stops, sizeof(stops));
|
||||
@@ -78,60 +78,60 @@ static void draw_shapes(lv_layer_t * layer, const lv_matrix_t * transform)
|
||||
|
||||
lv_matrix_t mt;
|
||||
lv_matrix_identity(&mt);
|
||||
lv_vector_dsc_set_fill_transform(ctx, &mt);
|
||||
lv_vector_dsc_set_fill_radial_gradient(ctx, 100, 100, 50);
|
||||
lv_vector_dsc_set_fill_gradient_color_stops(ctx, stops, 2);
|
||||
lv_vector_dsc_set_fill_gradient_spread(ctx, LV_VECTOR_GRADIENT_SPREAD_PAD);
|
||||
lv_vector_dsc_add_path(ctx, path);
|
||||
lv_draw_vector_dsc_set_fill_transform(ctx, &mt);
|
||||
lv_draw_vector_dsc_set_fill_radial_gradient(ctx, 100, 100, 50);
|
||||
lv_draw_vector_dsc_set_fill_gradient_color_stops(ctx, stops, 2);
|
||||
lv_draw_vector_dsc_set_fill_gradient_spread(ctx, LV_VECTOR_GRADIENT_SPREAD_PAD);
|
||||
lv_draw_vector_dsc_add_path(ctx, path);
|
||||
|
||||
lv_vector_dsc_set_transform(ctx, transform);
|
||||
lv_vector_dsc_translate(ctx, 150, 150);
|
||||
lv_draw_vector_dsc_set_transform(ctx, transform);
|
||||
lv_draw_vector_dsc_translate(ctx, 150, 150);
|
||||
lv_draw_image_dsc_t img_dsc;
|
||||
lv_draw_image_dsc_init(&img_dsc);
|
||||
LV_IMAGE_DECLARE(test_image_cogwheel_argb8888);
|
||||
img_dsc.header = test_image_cogwheel_argb8888.header;
|
||||
img_dsc.src = &test_image_cogwheel_argb8888;
|
||||
lv_vector_dsc_set_fill_image(ctx, &img_dsc);
|
||||
lv_draw_vector_dsc_set_fill_image(ctx, &img_dsc);
|
||||
lv_matrix_identity(&mt);
|
||||
lv_matrix_translate(&mt, 50, 50);
|
||||
//lv_matrix_rotate(&mt, 45);
|
||||
//lv_matrix_scale(&mt, 1.5f, 1.5f);
|
||||
lv_matrix_translate(&mt, -50, -50);
|
||||
lv_vector_dsc_set_fill_transform(ctx, &mt);
|
||||
lv_vector_dsc_add_path(ctx, path);
|
||||
lv_draw_vector_dsc_set_fill_transform(ctx, &mt);
|
||||
lv_draw_vector_dsc_add_path(ctx, path);
|
||||
|
||||
lv_vector_dsc_set_transform(ctx, transform);
|
||||
lv_vector_dsc_translate(ctx, 300, 150);
|
||||
lv_vector_dsc_set_fill_color(ctx, lv_color_make(0xff, 0x00, 0x00));
|
||||
lv_vector_dsc_add_path(ctx, path);
|
||||
lv_draw_vector_dsc_set_transform(ctx, transform);
|
||||
lv_draw_vector_dsc_translate(ctx, 300, 150);
|
||||
lv_draw_vector_dsc_set_fill_color(ctx, lv_color_make(0xff, 0x00, 0x00));
|
||||
lv_draw_vector_dsc_add_path(ctx, path);
|
||||
|
||||
lv_vector_path_clear(path);
|
||||
lv_vector_path_append_rect(path, &rect1, 20, 20);
|
||||
lv_area_t rect2 = {80, 80, 120, 120};
|
||||
lv_vector_path_append_rect(path, &rect2, 15, 15);
|
||||
lv_vector_dsc_translate(ctx, 50, 0);
|
||||
lv_vector_dsc_set_fill_color(ctx, lv_color_make(0x00, 0x80, 0xff));
|
||||
lv_vector_dsc_set_blend_mode(ctx, LV_VECTOR_BLEND_MULTIPLY);
|
||||
lv_vector_dsc_set_fill_rule(ctx, LV_VECTOR_FILL_EVENODD);
|
||||
lv_vector_dsc_add_path(ctx, path);
|
||||
lv_draw_vector_dsc_translate(ctx, 50, 0);
|
||||
lv_draw_vector_dsc_set_fill_color(ctx, lv_color_make(0x00, 0x80, 0xff));
|
||||
lv_draw_vector_dsc_set_blend_mode(ctx, LV_VECTOR_BLEND_MULTIPLY);
|
||||
lv_draw_vector_dsc_set_fill_rule(ctx, LV_VECTOR_FILL_EVENODD);
|
||||
lv_draw_vector_dsc_add_path(ctx, path);
|
||||
|
||||
lv_vector_path_clear(path);
|
||||
lv_vector_dsc_set_transform(ctx, transform);
|
||||
lv_vector_dsc_set_blend_mode(ctx, LV_VECTOR_BLEND_SRC_OVER);
|
||||
lv_draw_vector_dsc_set_transform(ctx, transform);
|
||||
lv_draw_vector_dsc_set_blend_mode(ctx, LV_VECTOR_BLEND_SRC_OVER);
|
||||
|
||||
rect = (lv_area_t) {
|
||||
500, 50, 550, 100
|
||||
};
|
||||
lv_vector_dsc_set_fill_color(ctx, lv_color_lighten(lv_color_black(), 50));
|
||||
lv_draw_vector_dsc_set_fill_color(ctx, lv_color_lighten(lv_color_black(), 50));
|
||||
rect = lv_matrix_transform_area(transform, &rect);
|
||||
lv_vector_clear_area(ctx, &rect); // clear screen
|
||||
lv_draw_vector_dsc_clear_area(ctx, &rect); // clear screen
|
||||
|
||||
lv_fpoint_t p = {500, 100}; /* Center */
|
||||
lv_vector_dsc_set_stroke_color(ctx, lv_color_make(0x00, 0xff, 0xff));
|
||||
lv_vector_dsc_set_stroke_opa(ctx, LV_OPA_COVER);
|
||||
lv_vector_dsc_set_stroke_width(ctx, 2.0f);
|
||||
lv_vector_dsc_set_stroke_dash(ctx, NULL, 0);
|
||||
lv_vector_dsc_set_fill_opa(ctx, LV_OPA_TRANSP);
|
||||
lv_draw_vector_dsc_set_stroke_color(ctx, lv_color_make(0x00, 0xff, 0xff));
|
||||
lv_draw_vector_dsc_set_stroke_opa(ctx, LV_OPA_COVER);
|
||||
lv_draw_vector_dsc_set_stroke_width(ctx, 2.0f);
|
||||
lv_draw_vector_dsc_set_stroke_dash(ctx, NULL, 0);
|
||||
lv_draw_vector_dsc_set_fill_opa(ctx, LV_OPA_TRANSP);
|
||||
lv_vector_path_move_to(path, &p);
|
||||
lv_fpoint_t temp = {p.x + 50, p.y};
|
||||
lv_vector_path_line_to(path, &temp);
|
||||
@@ -139,30 +139,30 @@ static void draw_shapes(lv_layer_t * layer, const lv_matrix_t * transform)
|
||||
lv_vector_path_line_to(path, &p);
|
||||
lv_vector_path_close(path);
|
||||
|
||||
lv_vector_dsc_add_path(ctx, path);
|
||||
lv_draw_vector_dsc_add_path(ctx, path);
|
||||
|
||||
/* Below code has same effect as above one but with solid fill */
|
||||
lv_vector_dsc_set_fill_color(ctx, lv_color_make(0xFF, 0x00, 0x00));
|
||||
lv_vector_dsc_set_fill_opa(ctx, LV_OPA_COVER);
|
||||
lv_draw_vector_dsc_set_fill_color(ctx, lv_color_make(0xFF, 0x00, 0x00));
|
||||
lv_draw_vector_dsc_set_fill_opa(ctx, LV_OPA_COVER);
|
||||
lv_vector_path_clear(path);
|
||||
lv_vector_path_append_arc(path, &p, 50, 45, 45, true);
|
||||
lv_vector_dsc_add_path(ctx, path); // draw a path
|
||||
lv_draw_vector_dsc_add_path(ctx, path); // draw a path
|
||||
|
||||
/* Test image filling with absolute coordinates */
|
||||
lv_vector_dsc_set_transform(ctx, transform);
|
||||
lv_vector_dsc_set_fill_units(ctx, LV_VECTOR_FILL_UNITS_USER_SPACE_ON_USE);
|
||||
lv_vector_dsc_set_fill_image(ctx, &img_dsc);
|
||||
lv_vector_dsc_set_fill_opa(ctx, LV_OPA_50);
|
||||
lv_vector_dsc_set_stroke_opa(ctx, LV_OPA_TRANSP);
|
||||
lv_draw_vector_dsc_set_transform(ctx, transform);
|
||||
lv_draw_vector_dsc_set_fill_units(ctx, LV_VECTOR_FILL_UNITS_USER_SPACE_ON_USE);
|
||||
lv_draw_vector_dsc_set_fill_image(ctx, &img_dsc);
|
||||
lv_draw_vector_dsc_set_fill_opa(ctx, LV_OPA_50);
|
||||
lv_draw_vector_dsc_set_stroke_opa(ctx, LV_OPA_TRANSP);
|
||||
lv_matrix_identity(&mt);
|
||||
lv_matrix_translate(&mt, 50, 350);
|
||||
lv_vector_dsc_set_fill_transform(ctx, &mt);
|
||||
lv_draw_vector_dsc_set_fill_transform(ctx, &mt);
|
||||
|
||||
lv_vector_path_clear(path);
|
||||
/* Aligned with translate. Image resolution is 100x100, cropped to 50% of width and height */
|
||||
lv_area_t img_area = {50, 350, 50 + 50, 350 + 50};
|
||||
lv_vector_path_append_rect(path, &img_area, 0, 0);
|
||||
lv_vector_dsc_add_path(ctx, path);
|
||||
lv_draw_vector_dsc_add_path(ctx, path);
|
||||
|
||||
/* Test PNG image file */
|
||||
lv_vector_path_clear(path);
|
||||
@@ -173,96 +173,96 @@ static void draw_shapes(lv_layer_t * layer, const lv_matrix_t * transform)
|
||||
|
||||
lv_draw_image_dsc_init(&img_dsc);
|
||||
img_dsc.src = "A:src/test_assets/test_img_lvgl_logo.png";
|
||||
lv_vector_dsc_set_transform(ctx, transform);
|
||||
lv_vector_dsc_set_fill_units(ctx, LV_VECTOR_FILL_UNITS_OBJECT_BOUNDING_BOX);
|
||||
lv_vector_dsc_set_fill_image(ctx, &img_dsc);
|
||||
lv_vector_dsc_set_fill_opa(ctx, LV_OPA_COVER);
|
||||
lv_draw_vector_dsc_set_transform(ctx, transform);
|
||||
lv_draw_vector_dsc_set_fill_units(ctx, LV_VECTOR_FILL_UNITS_OBJECT_BOUNDING_BOX);
|
||||
lv_draw_vector_dsc_set_fill_image(ctx, &img_dsc);
|
||||
lv_draw_vector_dsc_set_fill_opa(ctx, LV_OPA_COVER);
|
||||
|
||||
lv_matrix_identity(&mt);
|
||||
lv_vector_dsc_set_fill_transform(ctx, &mt);
|
||||
lv_vector_dsc_add_path(ctx, path);
|
||||
lv_draw_vector_dsc_set_fill_transform(ctx, &mt);
|
||||
lv_draw_vector_dsc_add_path(ctx, path);
|
||||
|
||||
lv_draw_vector(ctx);
|
||||
lv_vector_path_delete(path);
|
||||
lv_vector_dsc_delete(ctx);
|
||||
lv_draw_vector_dsc_delete(ctx);
|
||||
}
|
||||
|
||||
static void draw_lines(lv_layer_t * layer, const lv_matrix_t * transform)
|
||||
{
|
||||
lv_vector_dsc_t * ctx = lv_vector_dsc_create(layer);
|
||||
lv_vector_dsc_set_transform(ctx, transform);
|
||||
lv_draw_vector_dsc_t * ctx = lv_draw_vector_dsc_create(layer);
|
||||
lv_draw_vector_dsc_set_transform(ctx, transform);
|
||||
|
||||
lv_area_t rect = {0, 0, 640, 480};
|
||||
lv_vector_dsc_set_fill_color(ctx, lv_color_white());
|
||||
lv_draw_vector_dsc_set_fill_color(ctx, lv_color_white());
|
||||
rect = lv_matrix_transform_area(transform, &rect);
|
||||
lv_vector_clear_area(ctx, &rect);
|
||||
lv_draw_vector_dsc_clear_area(ctx, &rect);
|
||||
|
||||
lv_vector_path_t * path = lv_vector_path_create(LV_VECTOR_PATH_QUALITY_MEDIUM);
|
||||
|
||||
lv_vector_dsc_set_stroke_opa(ctx, LV_OPA_COVER);
|
||||
lv_vector_dsc_set_fill_opa(ctx, LV_OPA_0);
|
||||
lv_draw_vector_dsc_set_stroke_opa(ctx, LV_OPA_COVER);
|
||||
lv_draw_vector_dsc_set_fill_opa(ctx, LV_OPA_0);
|
||||
|
||||
lv_fpoint_t pts1[] = {{50, 50}, {400, 50}};
|
||||
lv_vector_path_clear(path);
|
||||
lv_vector_path_move_to(path, &pts1[0]);
|
||||
lv_vector_path_line_to(path, &pts1[1]);
|
||||
lv_vector_dsc_add_path(ctx, path);
|
||||
lv_draw_vector_dsc_add_path(ctx, path);
|
||||
|
||||
lv_fpoint_t pts2[] = {{50, 80}, {400, 80}};
|
||||
lv_vector_path_clear(path);
|
||||
lv_vector_path_move_to(path, &pts2[0]);
|
||||
lv_vector_path_line_to(path, &pts2[1]);
|
||||
lv_vector_dsc_set_stroke_color(ctx, lv_color_make(0xff, 0x00, 0x00));
|
||||
lv_vector_dsc_set_stroke_width(ctx, 3.0f);
|
||||
lv_vector_dsc_add_path(ctx, path);
|
||||
lv_draw_vector_dsc_set_stroke_color(ctx, lv_color_make(0xff, 0x00, 0x00));
|
||||
lv_draw_vector_dsc_set_stroke_width(ctx, 3.0f);
|
||||
lv_draw_vector_dsc_add_path(ctx, path);
|
||||
|
||||
lv_fpoint_t pts3[] = {{50, 120}, {400, 120}};
|
||||
lv_vector_path_clear(path);
|
||||
lv_vector_path_move_to(path, &pts3[0]);
|
||||
lv_vector_path_line_to(path, &pts3[1]);
|
||||
lv_vector_dsc_set_stroke_color(ctx, lv_color_make(0x00, 0xff, 0x00));
|
||||
lv_vector_dsc_set_stroke_width(ctx, 5.0f);
|
||||
lv_draw_vector_dsc_set_stroke_color(ctx, lv_color_make(0x00, 0xff, 0x00));
|
||||
lv_draw_vector_dsc_set_stroke_width(ctx, 5.0f);
|
||||
float dashes[] = {10, 15, 20, 12};
|
||||
lv_vector_dsc_set_stroke_dash(ctx, dashes, 4);
|
||||
lv_vector_dsc_add_path(ctx, path);
|
||||
lv_draw_vector_dsc_set_stroke_dash(ctx, dashes, 4);
|
||||
lv_draw_vector_dsc_add_path(ctx, path);
|
||||
|
||||
lv_fpoint_t pts4[] = {{100, 150}, {50, 250}, {150, 250}};
|
||||
lv_vector_path_clear(path);
|
||||
lv_vector_path_move_to(path, &pts4[0]);
|
||||
lv_vector_path_line_to(path, &pts4[1]);
|
||||
lv_vector_path_line_to(path, &pts4[2]);
|
||||
lv_vector_dsc_set_stroke_color(ctx, lv_color_make(0x00, 0x00, 0x00));
|
||||
lv_vector_dsc_set_stroke_width(ctx, 10.0f);
|
||||
lv_vector_dsc_set_stroke_dash(ctx, NULL, 0);
|
||||
lv_vector_dsc_set_stroke_join(ctx, LV_VECTOR_STROKE_JOIN_MITER);
|
||||
lv_vector_dsc_add_path(ctx, path);
|
||||
lv_draw_vector_dsc_set_stroke_color(ctx, lv_color_make(0x00, 0x00, 0x00));
|
||||
lv_draw_vector_dsc_set_stroke_width(ctx, 10.0f);
|
||||
lv_draw_vector_dsc_set_stroke_dash(ctx, NULL, 0);
|
||||
lv_draw_vector_dsc_set_stroke_join(ctx, LV_VECTOR_STROKE_JOIN_MITER);
|
||||
lv_draw_vector_dsc_add_path(ctx, path);
|
||||
|
||||
lv_vector_dsc_translate(ctx, 150, 0);
|
||||
lv_vector_dsc_set_stroke_join(ctx, LV_VECTOR_STROKE_JOIN_BEVEL);
|
||||
lv_vector_dsc_add_path(ctx, path);
|
||||
lv_draw_vector_dsc_translate(ctx, 150, 0);
|
||||
lv_draw_vector_dsc_set_stroke_join(ctx, LV_VECTOR_STROKE_JOIN_BEVEL);
|
||||
lv_draw_vector_dsc_add_path(ctx, path);
|
||||
|
||||
lv_vector_dsc_translate(ctx, 150, 0);
|
||||
lv_vector_dsc_set_stroke_join(ctx, LV_VECTOR_STROKE_JOIN_ROUND);
|
||||
lv_vector_dsc_add_path(ctx, path);
|
||||
lv_draw_vector_dsc_translate(ctx, 150, 0);
|
||||
lv_draw_vector_dsc_set_stroke_join(ctx, LV_VECTOR_STROKE_JOIN_ROUND);
|
||||
lv_draw_vector_dsc_add_path(ctx, path);
|
||||
|
||||
lv_fpoint_t pts5[] = {{50, 300}, {150, 300}};
|
||||
lv_vector_dsc_set_transform(ctx, transform);
|
||||
lv_draw_vector_dsc_set_transform(ctx, transform);
|
||||
lv_vector_path_clear(path);
|
||||
lv_vector_path_move_to(path, &pts5[0]);
|
||||
lv_vector_path_line_to(path, &pts5[1]);
|
||||
lv_vector_dsc_set_stroke_cap(ctx, LV_VECTOR_STROKE_CAP_BUTT);
|
||||
lv_vector_dsc_add_path(ctx, path);
|
||||
lv_draw_vector_dsc_set_stroke_cap(ctx, LV_VECTOR_STROKE_CAP_BUTT);
|
||||
lv_draw_vector_dsc_add_path(ctx, path);
|
||||
|
||||
lv_vector_dsc_translate(ctx, 0, 40);
|
||||
lv_vector_dsc_set_stroke_cap(ctx, LV_VECTOR_STROKE_CAP_SQUARE);
|
||||
lv_vector_dsc_add_path(ctx, path);
|
||||
lv_draw_vector_dsc_translate(ctx, 0, 40);
|
||||
lv_draw_vector_dsc_set_stroke_cap(ctx, LV_VECTOR_STROKE_CAP_SQUARE);
|
||||
lv_draw_vector_dsc_add_path(ctx, path);
|
||||
|
||||
lv_vector_dsc_translate(ctx, 0, 40);
|
||||
lv_vector_dsc_set_stroke_cap(ctx, LV_VECTOR_STROKE_CAP_ROUND);
|
||||
lv_vector_dsc_add_path(ctx, path);
|
||||
lv_draw_vector_dsc_translate(ctx, 0, 40);
|
||||
lv_draw_vector_dsc_set_stroke_cap(ctx, LV_VECTOR_STROKE_CAP_ROUND);
|
||||
lv_draw_vector_dsc_add_path(ctx, path);
|
||||
|
||||
lv_area_t rect1 = {250, 300, 350, 400};
|
||||
lv_vector_dsc_set_transform(ctx, transform);
|
||||
lv_draw_vector_dsc_set_transform(ctx, transform);
|
||||
lv_vector_path_clear(path);
|
||||
lv_vector_path_append_rect(path, &rect1, 0, 0);
|
||||
|
||||
@@ -279,16 +279,16 @@ static void draw_lines(lv_layer_t * layer, const lv_matrix_t * transform)
|
||||
lv_matrix_identity(&mt);
|
||||
lv_matrix_rotate(&mt, 5);
|
||||
lv_matrix_translate(&mt, 20, 20);
|
||||
lv_vector_dsc_set_stroke_transform(ctx, &mt);
|
||||
lv_vector_dsc_set_stroke_join(ctx, LV_VECTOR_STROKE_JOIN_MITER);
|
||||
lv_vector_dsc_set_stroke_linear_gradient(ctx, 250, 300, 350, 300);
|
||||
lv_vector_dsc_set_stroke_gradient_color_stops(ctx, stops, 2);
|
||||
lv_vector_dsc_set_stroke_gradient_spread(ctx, LV_VECTOR_GRADIENT_SPREAD_REFLECT);
|
||||
lv_vector_dsc_add_path(ctx, path); // draw a path
|
||||
lv_draw_vector_dsc_set_stroke_transform(ctx, &mt);
|
||||
lv_draw_vector_dsc_set_stroke_join(ctx, LV_VECTOR_STROKE_JOIN_MITER);
|
||||
lv_draw_vector_dsc_set_stroke_linear_gradient(ctx, 250, 300, 350, 300);
|
||||
lv_draw_vector_dsc_set_stroke_gradient_color_stops(ctx, stops, 2);
|
||||
lv_draw_vector_dsc_set_stroke_gradient_spread(ctx, LV_VECTOR_GRADIENT_SPREAD_REFLECT);
|
||||
lv_draw_vector_dsc_add_path(ctx, path); // draw a path
|
||||
|
||||
lv_draw_vector(ctx);
|
||||
lv_vector_path_delete(path);
|
||||
lv_vector_dsc_delete(ctx);
|
||||
lv_draw_vector_dsc_delete(ctx);
|
||||
}
|
||||
|
||||
static void canvas_draw(const char * name, draw_cb_t draw_cb)
|
||||
|
||||
Reference in New Issue
Block a user