mirror of
https://gitee.com/zlgopen/awtk.git
synced 2024-11-30 11:08:34 +08:00
improve image
This commit is contained in:
parent
0bdfb20aca
commit
52916cee73
@ -49,8 +49,9 @@ static ret_t image_on_paint_self(widget_t* widget, canvas_t* c) {
|
|||||||
if (image->draw_type == IMAGE_DRAW_ICON) {
|
if (image->draw_type == IMAGE_DRAW_ICON) {
|
||||||
vgcanvas_draw_icon(vg, &bitmap, 0, 0, bitmap.w, bitmap.h, 0, 0, widget->w, widget->h);
|
vgcanvas_draw_icon(vg, &bitmap, 0, 0, bitmap.w, bitmap.h, 0, 0, widget->w, widget->h);
|
||||||
} else {
|
} else {
|
||||||
vgcanvas_draw_image(vg, &bitmap, 0, 0, bitmap.w, bitmap.h, 0, 0, widget->w,
|
float_t x = (widget->w - bitmap.w) * 0.5f;
|
||||||
widget->h);
|
float_t y = (widget->h - bitmap.h) * 0.5f;
|
||||||
|
vgcanvas_draw_image(vg, &bitmap, 0, 0, bitmap.w, bitmap.h, x, y, bitmap.w, bitmap.h);
|
||||||
}
|
}
|
||||||
vgcanvas_restore(vg);
|
vgcanvas_restore(vg);
|
||||||
break;
|
break;
|
||||||
|
Loading…
Reference in New Issue
Block a user