simpledisplay.d now works on as 64 bit on X

bearophile bearophileHUGS at lycos.com
Sun Jun 9 15:09:54 PDT 2013


Adam D. Ruppe:

> Another problem I just realized though: on Windows, bitmaps are 
> stored upside down so you'd have to draw y-inverted too. Didn't 
> make a difference here because the image doesn't care about 
> orientation but it would be visible with a lot of other 
> programs.
>
> Maybe simple functions or mixins (if inlining isn't reliable) 
> could be used to hide this detail.

This high level library should generate the same image output on 
all systems it compiles on.


> (and this library isn't really made for max performance, 
> instead preferring simplicity of use and implementation.

A small, basic and simple to use graphics library has its usages. 
For small single-module (or few modules) programs like the one I 
have linked in Rosettacode you don't want to import a large GUI 
library.

Eventually I think such simple simpledisplay.d and color.d 
modules should go in Phobos, after some cleaning, ddoc string, a 
heavy cycle of review and improvements, API design, etc. It's a 
battery worth putting in the standard library. So people can 
write portable and very easy to use little graphical programs in 
D.

Delphi has a large and efficient GUI toolkit in the standard 
library, but I think it's not a good idea to put a GUI toolkit in 
Phobos. But a little library as simpledisplay is OK.

Maybe for Phobos simpledisplay.d could be renamed just 
graphicdisplay.d or something like that.

Regarding color, I think it will enjoy few more color-related 
functions, like a function to generate a rainbow given the 
temperature of a black body, few more greying functions, a bit 
more colorimetry, etc.

A color.d module for Phobos should not import simpledisplay.d. 
And it should be a top-level module (unlike now, that's inside a 
package).

Even the Python standard library has a very minimal color module:
http://docs.python.org/2/library/colorsys.html

A third small module (less than 15-30 KB of code) worth adding to 
Phobos, that builds on graphicdisplay.d and color.d, could 
generate basic data plots (scatter plots and line plots). It's 
not meant to replace a complete library for graphing. It's meant 
for a quick and very simple display of all kind of data during 
development or for quick D script-like programs.

When I program in Python I often use the good 
http://matplotlib.org/ . It's a large plotting library that 
allows me to plot data with few lines of code. This allows me to 
visualize intermediate data during debugging, like arrays, so it 
improves my understanding of data and such data.

Bye,
bearophile


More information about the Digitalmars-d-announce mailing list