Need help with DLANGUI

Vadim Lopatin via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Tue Mar 24 00:42:41 PDT 2015


On Monday, 23 February 2015 at 19:41:30 UTC, Eric wrote:
>
> I have been trying out dlanui, and I am able to create an image
> with FreeImage and display it with an ImageWidget.  However this
> requires that I write the image out to disk, and then load it 
> again
> to display it.  Is there any way I can update or create the 
> image
> in memory without going to disk?
>
> Thanks,
>
> Eric

Hello,

Sorry for delayed answer.
Is your question still actual?

You can use something like
// create RGBA8888 drawing buffer
ColorDrawBuffer buf = new ColorDrawBuffer(width, height);
// copy pixels into buf from your custom image
// .........
// put into DrawBufRef
DrawBufRef imageDrawBuf = buf;
// create image drawable
DrawableRef myCustomImageDrawable = new 
ImageDrawable(imageDrawBuf);
// set drawable of ImageWidget
imageWidget.drawable = myCustomImageDrawable;

There was code in dlangui.graphics.image which could copy 
FreeImage images to ColorDrawBuf, but in recent version it's 
removed. You can check github revision history to get proper code.

BTW, why do you need FreeImage to create image? Isn't it just 
possible inside dlangui?


More information about the Digitalmars-d-learn mailing list