From 538f78b76e95b20676602678c4fac82c19b56e58 Mon Sep 17 00:00:00 2001 From: lixianjing Date: Wed, 10 Apr 2024 08:58:18 +0800 Subject: [PATCH] improve demos --- demos/demo_canvas_offline.c | 2 +- demos/demo_ui_old_app.c | 3 ++- demos/vg_common.inc | 7 ++++--- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/demos/demo_canvas_offline.c b/demos/demo_canvas_offline.c index fe3776cf1..a93dc707d 100644 --- a/demos/demo_canvas_offline.c +++ b/demos/demo_canvas_offline.c @@ -60,7 +60,7 @@ static ret_t on_paint_vgcanvas(void* ctx, event_t* e) { vgcanvas_translate(vg, 0, 50); stroke_lines(vg); vgcanvas_translate(vg, 0, 50); - draw_image(vg); + draw_image(vg, "bricks"); vgcanvas_translate(vg, 50, 100); draw_matrix(vg); diff --git a/demos/demo_ui_old_app.c b/demos/demo_ui_old_app.c index 7060c901c..9dfb60b56 100644 --- a/demos/demo_ui_old_app.c +++ b/demos/demo_ui_old_app.c @@ -317,7 +317,8 @@ static ret_t on_paint_vgcanvas(void* ctx, event_t* e) { vgcanvas_translate(vg, 0, 50); stroke_lines(vg); vgcanvas_translate(vg, 0, 50); - draw_image(vg); + draw_image(vg, "bricks"); + draw_image(vg, "message"); vgcanvas_translate(vg, 50, 100); draw_matrix(vg); diff --git a/demos/vg_common.inc b/demos/vg_common.inc index ff3a2c7cc..dc14d8901 100644 --- a/demos/vg_common.inc +++ b/demos/vg_common.inc @@ -335,12 +335,12 @@ static void stroke_lines(vgcanvas_t* vg) { vgcanvas_restore(vg); } -static void draw_image(vgcanvas_t* vg) { +static void draw_image(vgcanvas_t* vg, const char* name) { bitmap_t img; vgcanvas_save(vg); - image_manager_get_bitmap(image_manager(), "bricks", &img); + image_manager_get_bitmap(image_manager(), name, &img); vgcanvas_translate(vg, (vg->w - img.w) / 2, 0); @@ -429,7 +429,8 @@ static inline ret_t on_paint_vg(void* ctx, event_t* e) { vgcanvas_translate(vg, 0, 50); stroke_lines(vg); vgcanvas_translate(vg, 0, 50); - draw_image(vg); + draw_image(vg, "bricks"); + draw_image(vg, "message"); vgcanvas_translate(vg, 50, 100); draw_matrix(vg);