Hi all, I needed to write an SVG renderer; something that draws an SVG file onto an image (not to be confused with an SVG generator such as SVGo). I wanted to do this in native go, and not rely on wrapping pre-existing C code.
The golang 2D drawing packages I could find were not capable of rendering stroked paths with joins like 'arc' or 'miter-clip', or specifying between ending a stroked path as an open line or a closed loop. So, in order to draw SVG 2.0 <https://www.w3.org/TR/SVG2/> compliant stroked and dashed-stroked paths, I refactored and enhanced the raster package from the golang translation of freetype, <https://github.com/golang/freetype>used by many of the 2D packages, into a new package; rasterx <https://github.com/srwiley/rasterx>. More information on the refactorization is available in the readme. The SVG renderer, oksvg <https://github.com/srwiley/oksvg>, processes only a basic sub-set of the SVG specification, but it is capable of faithfully rendering many, probably most, but certainly not all, of the free and commercial SVG icons available. I have been focusing on just the basics the path functions, and many elements like defs, gradients, or animations have not been added at this point. However, the full SVG 2.0 path specification is implemented and even exceeded, since rasterx can perform additional path functions that are not described by the SVG 2.0 specification. Also, when an SVG file is parsed, oksvg can be set to ignore, log, or error-out when reading an unrecognized SVG element. So now we can render a large set of SVG icons in native go! I hope some of you find this useful. Please check it out and let me know what you think. The image below demonstrates the effect of some of the available joining and capping functions. Cheers! [image: TestShapes.png] -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.