simpledisplay.d now works on as 64 bit on X

Adam D. Ruppe destructionator at gmail.com
Sun Jun 9 17:41:22 PDT 2013


On Sunday, 9 June 2013 at 22:09:55 UTC, bearophile wrote:
> This high level library should generate the same image output 
> on all systems it compiles on.

Naturally. But if we can get a 10% performance boost that can be 
worth it in a lot of cases. Maybe the api can actually be an 
output range for colors that does one pixel at a time from top to 
bottom, left to right. That'd be less raw than the pointer but 
still avoid recalculating offsets every time when it could just 
be a simple increment.

> 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.

Yes, I agree. I used to do a lot of fun stuff in DOS back in the 
day when all you have is a 256 color, 320x200 framebuffer. It was 
great actually, much lower learning curve than today's huge GUIs 
and capable of all the fun stuff. That's why I made 
simpledisplay.d and terminal.d, an attempt to get that kind of 
thing easy again on new operating systems.

There's libraries like SDL that are fairly simple and quite 
useful too but that is much bigger.

> Eventually I think such simple simpledisplay.d and color.d 
> modules should go in Phobos

That's something I'm not really interested in though, because....

> after some cleaning, ddoc string, a heavy cycle of review and 
> improvements, API design, etc.

that is starting to sound like work! I hack together most these 
modules over weekends, and even if I can spill onto weekdays it 
is still just getting it to barely work for me then time to move 
on.

> 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.

Yeah, those would be cool. I think I have blackbody code 
somewhere, I wrote it for one of my games. My lazypng.d module 
also has a greyscale thing - the plan there was to do png files 
to and from ranges, and add various algorithm like things to 
operate on them.

The png reader in there is actually more complete than the one in 
my png.d, but png.d includes nice helper functions for palette 
swaps, creating Windows icons, etc. that lazypng lacks.

anyway I'm getting sidetracked, sometimes I wish I could get 
enough money to pay my bills just for hacking on random D stuff - 
maybe then I could kill this todo list!

> 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).

What might be better is to do it on top of something like a 
simple image class, which can then be drawn to the screen or 
saved to a file.

A downside though is a lot of graphics functions would have to be 
written, but I think I want to do that anyway eventually. I 
wouldn't do a great job, like most my modules I'd just hack it 
together over a weekend, but it'd be a start. I already have an 
image.d that can be saved to a file.


More information about the Digitalmars-d-announce mailing list