Proposal: Vector graphics API

Vector graphics are a great utility for developers, which SDL2 supports but partially(with functions like SDL_RenderDrawRect and SDL_RenderFillRect). Developers can use SDL2_gfx, but it uses pixel plotting (as noted by @rtrussell) to draw the shapes, which may be a bit inefficient. Another alternative is to use OpenGL/DirectX/Vulcan/Metal vector graphics libraries, but this solution requires the developer to handle cross-platform stuff (when using DirectX/Metal). On the other hand, SDL2 handles cross-platform API-s by choosing the most performant one.
So I propose to (only one of these ideas, choice goes to the developers of SDL2):

  1. add a new SDL2 “extension” library called SDL_Vgfx (if you think you find a better name, please suggest it)
  2. introduce a new header file on the library (I propose SDL_vg.h)
  3. add new drawing functions on the already existing SDL_render.h header
    which contain new drawing functions like SDL_RenderDrawCircle, SDL_RenderDrawEllipse, SDL_RenderDrawBezier, etc.

The functions I propose are similar to those provided by SDL2_gfx, with the exception that the proposed functions should use better drawing algorithms (other than pixel plotting) where possible to gain performance. I propose that anti-aliasing should be a must for each of these drawing functions (where needed, of course).

Suggestions are welcome. Thank you for your time.

I’m unsure what you mean by “software rendering” in this context. SDL2_gfx (and my own extensions) ultimately call SDL_RenderDrawPoints() or SDL_RenderDrawLine() so they do, indirectly, benefit from accelerated hardware rendering, if enabled.

Having to decompose everything to points and lines adds a bottleneck, certainly, but I wouldn’t describe it as “software rendering”.

Thanks for the note @rtrussell. With software rendering, I meant exactly what you said, but I just mixed using points/lines with software rendering. I fixed it now. Thanks once more.