image embeded as ubtye

Frank Benoit keinfarbton at googlemail.com
Mon Jul 30 06:33:26 PDT 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" );


More information about the Digitalmars-d-learn mailing list