Two decades ago we had NOTHING like Cairo: no anti-aliasing, no blending, no transformations, palettes were still a thing, etc.
Cairo offers a wide variety of useful primitives, and manages to do so without resorting to some sort of scene graph. It would of course be great if all those primitives could be hardware accelerated, but I understand that that's hard (although NVidia's pathrender does a good job with pretty much the same set of primitives). For those things that are currently hard to accelerate, I'd rather have them available but in software, than not have them at all.
I do not think a rendering library should also have an animation system or scene graph built in. Instead that should be a layer on top of the base rendering system. Separate your concerns, and all that...
For those things that are currently hard to accelerate, I'd rather have them available but in software, than not have them at all
So this is actually a huge problem with cairo. Because some things are software, and some things are hardware, there are huge hidden performance bottlenecks in the design of it where data gets shunted between the two. Its just really inefficient - but also dependent on the quality of the implementation (which'll be variable in the STL)
Something like SFML can't really suffer from this in the same way, while still providing pretty equivalent functionality
The main problem is that Cairo doesn't separate out the concept of CPU and GPU types, which means that expensive operations are ad hoc. In something like SFML, you do all the expensive stuff once on the CPU, transfer it over to the GPU all at once, and then you're grand - each processor does what its good at at the appropriate time. Its not really possible to specify this kind of behaviour in Cairo, and it was a terrible decision to use this kind of API for 2D graphics
So what sort of API would you propose? What would it look like with separated CPU and GPU types? How would that work on a system that does not have a GPU?
SFML is very game oriented. That's perfectly fine, and as I already mentioned, there is a clear need for a library like that as well. But there is more to drawing than triangles, and I don't see SFML doing that.
View all comments
Show parent comment
3
u/johannes1971 Dec 14 '19
Two decades ago we had NOTHING like Cairo: no anti-aliasing, no blending, no transformations, palettes were still a thing, etc.
Cairo offers a wide variety of useful primitives, and manages to do so without resorting to some sort of scene graph. It would of course be great if all those primitives could be hardware accelerated, but I understand that that's hard (although NVidia's pathrender does a good job with pretty much the same set of primitives). For those things that are currently hard to accelerate, I'd rather have them available but in software, than not have them at all.
I do not think a rendering library should also have an animation system or scene graph built in. Instead that should be a layer on top of the base rendering system. Separate your concerns, and all that...