From d1efce1e339fbe155b966091df1956de73d45a29 Mon Sep 17 00:00:00 2001 From: "Adam D. Ruppe" Date: Wed, 14 Feb 2018 10:04:55 -0500 Subject: [PATCH] setImage from ASHIT-AXAR --- minigui.d | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/minigui.d b/minigui.d index 69f34a4..eb9ec9a 100644 --- a/minigui.d +++ b/minigui.d @@ -5133,6 +5133,14 @@ int[2] getChildPositionRelativeToParentHwnd(Widget c) nothrow { class ImageBox : Widget { private MemoryImage image_; + /// + public void setImage(MemoryImage image){ + this.image_ = image; + if(this.parentWindow && this.parentWindow.win) + sprite = new Sprite(this.parentWindow.win, Image.fromMemoryImage(image_)); + redraw(); + } + /// How to fit the image in the box if they aren't an exact match in size? enum HowToFit { center, /// centers the image, cropping around all the edges as needed @@ -5156,7 +5164,7 @@ class ImageBox : Widget { } private void updateSprite() { - if(this.parentWindow && this.parentWindow.win) + if(sprite is null && this.parentWindow && this.parentWindow.win) sprite = new Sprite(this.parentWindow.win, Image.fromMemoryImage(image_)); }