Thread overview
image embeded as ubtye
Jul 30, 2007
okibi
Jul 30, 2007
Frank Benoit
Jul 31, 2007
Stewart Gordon
July 30, 2007
Hello!

I've got an image converted to a d source file that contains the image as a ubyte variable. What I'm wanting to know is how do I apply this as the image for a button in gtkD?

I was calling the external file, like such:

Image newImg = new Image("images\\new.png");
Button newBtn = new Button();
newBtn.setImage(newImg);

How can I set the ubyte as the image?

Thanks!
July 30, 2007
> Image newImg = new Image("images\\new.png");
> Button newBtn = new Button();
> newBtn.setImage(newImg);
> 
> How can I set the ubyte as the image?

If this is something like swt, you can probably use a ByteArrayStream or something like this.

BTW, since the import statement of D can include external files into
char[] variables at compile time, it is no more needed to generate
source files for that. (you need to set the -J compiler option)
  ubyte[] imagesdata = cast(ubyte[]) import( "myfile.png" );
July 31, 2007
"okibi" <okibi@ratedo.com> wrote in message news:f8kit9$7o9$1@digitalmars.com...
> I've got an image converted to a d source file that contains the image as a ubyte variable.

If the image is small enough to store in a single byte, you're lucky.

Stewart.