Ask HN: Need C code for drawing graphic primitives to a framebuffer

I have a framebuffer that must be seen as being slow. Also the cpu accessing the fb has no cache whatsoever to accelerate the memory access. I need c code for drawing thick lines with endcaps, thick circles, thick elipsoids and thick beizier curves. I have code to do all this 1 pixel wide, but I need code to draw them with a width without plotting over and over each pixel. I already have Bresenham implementation for lines, circles, ellipsis and beizier

  • You probably want to draw curves and polygons then fill them.

    It's possible to imagine drawing extra thick lines by modifying the algorithm but the equivalent changes to a curve would leave gaps. I suppose you could figure out how eg boundary paths for beziers are calculated and transform your algorithm so each step draws to the boundary. It seems like more work for something less general than filling though.

  • You need to look at a 2d vector graphics library eg: Skia, Cairo, Agg, NanoVG, Blend2D, OpenVG (and many other, in no particular order).

  • Then paint to a regular buffer and do a memcpy to the framebuffer that has no cache at the end of each frame, possibly only copying a region/tiles you want to update.

    All the libraries that exist are designed to work like this.