On Friday, 21 March 2014 at 13:54:25 UTC, Vladimir Panteleev
On Friday, 21 March 2014 at 12:27:57 UTC, Rikki Cattermole
On Friday, 21 March 2014 at 11:04:58 UTC, Vladimir Panteleev
Some highlights from a recent overhaul of the graphics
package from my D library. It makes use of a number of
D-specific language features, so I've tried to make the
article accessible to people new to D as well.
Are you planning on adding a font rasterizer
Parsing vector font files is a big undertaking. I'd likely use
a text rendering library, such as FreeType. Hardcoding a small
bitmap font for ASCII only is also a possibility.
Yeah it is quite a big one. But it may be well worth it to have
it generate code at CTFE per font. Would be more efficient
and can it work at CTFE?
This program almost works:
auto smiley = Image!char(20, 20);
smiley.fillCircle(10, 10, 10, '#');
smiley.fillCircle( 6, 6, 2, ' ');
smiley.fillCircle(14, 6, 2, ' ');
smiley.fillSector(10, 10, 6, 8, 0, PI, ' ');
return smiley.h.iota.map!(y =>
"almost" because fillSector calls atan2, which doesn't work in
(And yeah, I totally did just declare an image with a
Yeah I've noticed that some of phobos wasn't really designed with
CTFE in mind *grumbles*. Maybe one day I'll look into getting
that sorted out.
colorspace of "char".)