GUI library for D

dsimcha dsimcha at yahoo.com
Mon Apr 4 21:23:07 PDT 2011


On 4/4/2011 9:25 PM, Michel Fortin wrote:
> On 2011-04-04 19:55:44 -0400, Adam Ruppe <destructionator at gmail.com> said:
>
>> Michel Fortin wrote:
>>> On the other hand, one thing that is missing right now, in D and in
>>> most languages, is a standard way to display graphics.
>>
>> Actually, I wrote something to do that last year, but I thought
>> it was too trivial to share.
>>
>> What you do is just draw some RGB stuff to a big memory buffer. Then
>> you can save as bmp, png, or create a window to display it.
>>
>> There was no interaction with the window, except closing it. You'd
>> pop up the window so the user can review the picture, then he closes
>> it and your program continues where it left off.
>>
>> Changing it to allow some updating and interaction shouldn't be
>> too hard.
>>
>> It worked for both win32 and x11, no libraries required.
>
> Reminds me of David Simcha's plot2kill, which also has such a layer on
> top of which it implements plot drawing.
> <http://www.dsource.org/projects/plot2kill>


Right.  Plot2kill defines an abstraction layer over the drawing 
functionality of a GUI library (lines, rectangles, text, etc.), so that 
the code for drawing a plot is strongly decoupled from the GUI library. 
  So far this has proven successful on GtkD and DFL.

However, Plot2kill also defines a default plot window, which allows for 
things like saving the plot interactively, zooming in on subplots and, 
in the GtkD incarnation, customizing several aspects of the plot 
interactively.  For this stuff, I didn't even try to abstract away the 
GUI library because it seemed self-evident to me that creating this 
massive and brittle an adapter layer was a bad idea, and the lesser of 
two evils would be to just write an independent default plot window for 
each library.


More information about the Digitalmars-d mailing list