Thread overview | ||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
December 23, 2015 Graphics/font/platform backends with common interfaces? | ||||
---|---|---|---|---|
| ||||
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 } |
December 23, 2015 Re: Graphics/font/platform backends with common interfaces? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Taylor Hillegeist | On Wednesday, 23 December 2015 at 19:22:01 UTC, 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 > } It was an initiative, but it looks abandoned now (Aurora Graphics): Thread: http://forum.dlang.org/thread/op.w9w0efr1707hn8@invictus.hra.local Source Code: https://github.com/auroragraphics/ |
December 23, 2015 Re: Graphics/font/platform backends with common interfaces? | ||||
---|---|---|---|---|
| ||||
Posted in reply to rumbu | On Wednesday, 23 December 2015 at 20:23:25 UTC, rumbu wrote:
> On Wednesday, 23 December 2015 at 19:22:01 UTC, Taylor
>
> It was an initiative, but it looks abandoned now (Aurora Graphics):
> Thread: http://forum.dlang.org/thread/op.w9w0efr1707hn8@invictus.hra.local
> Source Code: https://github.com/auroragraphics/
I know I was excited when It was announced at DConf 2014. It really is too bad.
what can be done now? how are standards defined around here for the benefit of the community?
+---------------+
| USER APP |
+---------------+
| GUI LIB |
+---------------+ <----- what is this interface
| GRAPICS LIB |
+---+---+-------+ <----- what is this interface
|SDL|GDI|OPENGL.|
+---+---+-------+
But is there any standard interfaces?
|
December 23, 2015 Re: Graphics/font/platform backends with common interfaces? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Taylor Hillegeist | On Wednesday, 23 December 2015 at 20:49:21 UTC, Taylor Hillegeist wrote:
> | GRAPICS LIB |
> +---+---+-------+ <----- what is this interface
> |SDL|GDI|OPENGL.|
> +---+---+-------+
SDL, GDI, and OpenGL *are* graphics libs so it seems a bit silly to put an interface there.
|
December 23, 2015 Re: Graphics/font/platform backends with common interfaces? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Adam D. Ruppe | On Wednesday, 23 December 2015 at 20:52:05 UTC, Adam D. Ruppe wrote:
> On Wednesday, 23 December 2015 at 20:49:21 UTC, Taylor Hillegeist wrote:
>> | GRAPICS LIB |
>> +---+---+-------+ <----- what is this interface
>> |SDL|GDI|OPENGL.|
>> +---+---+-------+
>
> SDL, GDI, and OpenGL *are* graphics libs so it seems a bit silly to put an interface there.
I guess I'm thinking that to be able to switch between backends(gdi sdl) you use you must have a common interface. And if everyone had the same common interface it could be nice right?
|
December 23, 2015 Re: Graphics/font/platform backends with common interfaces? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Adam D. Ruppe | On Wednesday, 23 December 2015 at 20:52:05 UTC, Adam D. Ruppe wrote:
> On Wednesday, 23 December 2015 at 20:49:21 UTC, Taylor Hillegeist wrote:
>> | GRAPICS LIB |
>> +---+---+-------+ <----- what is this interface
>> |SDL|GDI|OPENGL.|
>> +---+---+-------+
>
> SDL, GDI, and OpenGL *are* graphics libs so it seems a bit silly to put an interface there.
yes silly, more specially as
- some of them are 2D with FP coordinates
- some of them are 2D with integral coordinates
- some of them are 2D with integral coordinates with transformation of the plan
- some of them are 2D with integral coordinates without transformation of the plan
- some of them are 3D FP float coordinates with transformation of the plan
- some of them are in DirectMode, some of them not.
- etc...
So this would result in 5 or 6 templatized (because of the coord type) interface.
IIRC Interfaces are not devirtualizables so that they can be extracted...
also to put SDL and OPENGL on the same level is a bit strange.
|
December 23, 2015 Re: Graphics/font/platform backends with common interfaces? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Taylor Hillegeist | On Wednesday, 23 December 2015 at 20:57:27 UTC, Taylor Hillegeist wrote:
> On Wednesday, 23 December 2015 at 20:52:05 UTC, Adam D. Ruppe wrote:
>> On Wednesday, 23 December 2015 at 20:49:21 UTC, Taylor Hillegeist wrote:
>>> | GRAPICS LIB |
>>> +---+---+-------+ <----- what is this interface
>>> |SDL|GDI|OPENGL.|
>>> +---+---+-------+
>>
>> SDL, GDI, and OpenGL *are* graphics libs so it seems a bit silly to put an interface there.
>
> I guess I'm thinking that to be able to switch between backends(gdi sdl) you use you must have a common interface. And if everyone had the same common interface it could be nice right?
maybe this is more what I'm thinking.
+-----------------+
| USER APP |
+-----------------+
| GUI LIB |
+-----------------+ <----- what is this interface
| GenericGL |
+-----------------+ <----- what is this interface
| NativeGL |
+-----------------+
|
December 23, 2015 Re: Graphics/font/platform backends with common interfaces? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Basile B. | On Wednesday, 23 December 2015 at 21:07:12 UTC, Basile B. wrote:
> On Wednesday, 23 December 2015 at 20:52:05 UTC, Adam D. Ruppe wrote:
>> [...]
>
> yes silly, more specially as
>
> - some of them are 2D with FP coordinates
> - some of them are 2D with integral coordinates
> - some of them are 2D with integral coordinates with transformation of the plan
> - some of them are 2D with integral coordinates without transformation of the plan
> - some of them are 3D FP float coordinates with transformation of the plan
> - some of them are in DirectMode, some of them not.
> - etc...
>
> So this would result in 5 or 6 templatized (because of the coord type) interface.
> IIRC Interfaces are not devirtualizables so that they can be extracted...
>
> also to put SDL and OPENGL on the same level is a bit strange.
Thanks for letting me know! So is what your saying is that an common interface is not possible or practical or perhaps useful?
|
December 23, 2015 Re: Graphics/font/platform backends with common interfaces? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Taylor Hillegeist | On Wednesday, 23 December 2015 at 21:12:11 UTC, Taylor Hillegeist wrote:
> On Wednesday, 23 December 2015 at 21:07:12 UTC, Basile B. wrote:
>> [...]
>
> Thanks for letting me know! So is what your saying is that an common interface is not possible or practical or perhaps useful?
Also wouldn't the least common denominator be
2D FP in Retained Mode?
|
December 23, 2015 Re: Graphics/font/platform backends with common interfaces? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Taylor Hillegeist | On Wednesday, 23 December 2015 at 21:12:11 UTC, Taylor Hillegeist wrote:
> On Wednesday, 23 December 2015 at 21:07:12 UTC, Basile B. wrote:
>> [...]
>
> Thanks for letting me know! So is what your saying is that an common interface is not possible or practical or perhaps useful?
It's possible but it seems to be complex.
|
Copyright © 1999-2021 by the D Language Foundation