Graphics/font/platform backends with common interfaces?

Rikki Cattermole via Digitalmars-d-learn digitalmars-d-learn at
Wed Dec 23 15:34:58 PST 2015

On 24/12/15 8:22 AM, Taylor Hillegeist wrote:
> So I have seen alot of projects that need the same sort of stuff.
> graphics libraries
> gui libraries
> game libraries
> ploting libaries
> they would all benefit from a backend solution with a common interface for
> color
> fonts
> drawing pen_style aliasing etc.
> but each one i look at seems to have a built up solution with various
> degrees of integration with things like freetype gdi cairo sdl glew opengl.
> Shouldn't there be like a common (interface/abstract class) that these
> back-ends can fulfill? maybe I am unaware of how these things are done.
> And perhaps there are performance reasons that many of these are baked in.
> perhaps it should be like:
> standard color implementation.
> font interface that converts glyphs into drawing strokes.
> and a standard set of drawing instructions with transforms.
> //probably a grotesque simplification
> interface font_do{
>    glyphstrokes getstrokes(string characterstoget);
> }
> interface draw_do{
>    drawpixel(double x,double y);
>    drawline(double x,double y);
>    drawglyph(glypstrokes g);
>    getpostdrawnsize(glypstroks g)
>    ... other things
> }

So far I've been implementing windowing and image libraries for Phobos.
Right now windowing works on Windows minice eventing. Once eventing is 
done it is ready for the first stage of feedback.

Image library is nearly ready for next batch of feedback, PNG 
read/writer is ugh not passing its tests for palette + Adam7 interlacing.

All in all looking at second half of next year for completion.

Manu Evans has been working on the color library which I use.
The vertices definition I am using is from gfm:math with permission for 
Phobos inclusion but that needs drastic changes and somebody to take 
ownership of.

Of course that really doesn't help when it comes to e.g. font 
rasterization. But they are core and must be working first.

More information about the Digitalmars-d-learn mailing list