Graphics/font/platform backends with common interfaces?

Taylor Hillegeist via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Wed Dec 23 11:22:01 PST 2015


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
}



More information about the Digitalmars-d-learn mailing list