GUI library for D

Adam D. Ruppe destructionator at gmail.com
Mon Apr 4 21:13:37 PDT 2011


Michel Fortin wrote:
> It would also be nice to be able to load an image from a file, but
> that's a little more complicated.

I have some .bmp and .png loading written up too. Doesn't implement
every feature of either format, but enough to get by.

>From my program:

import arsd.bmp;
void main() {
       auto i = new BMP("lol.bmp"); // loading from file

       i.display(); // display it to the screen
}

Alternatively, make one with arrays:

void main() {
     auto i = new Image(255, 255);
     for(int b = 0; b < h; b++)
     for(int a = 0; a < w; a++)
	i.setPixel(a,b,Color(255,a,0)); // truecolor

     i.display();
}



You can also write out to a file or to a memory array (should
probably be some kind of lazy range). When combined with cgi.d,
that means you can output images to the web browser like so:

http://arsdnet.net/cgi-bin/gradient?h=100&w=100&c1=ff0000&c2=00ff00

No need for external libraries - my png read/write is homegrown in
D. (which is why it doesn't implement the full standard, but it's
also much smaller and simpler to use than something that does)


It doesn't offer much for drawing - it's just a memory array
and a few of my ancient DOS routines ported over, but it's a start.

I'll see about cleaning it up for a release next chance I get.


More information about the Digitalmars-d mailing list