I have just uploaded the initial release of nim-rsvg:
[https://github.com/ngtk3/nim-rsvg](https://github.com/ngtk3/nim-rsvg)
The API is really tiny, so it was not much work making the wrapper.
I have decided to remove the Rsvg prefix from data types, as we generally do.
If that should give too many type name conflicts we may add that prefix again.
Currently I have only this tiny test program, it reads a SVG file and generates
a PNG file. Note that we do not need the close() proc here, the close proc may
be needed when proc rsvg_handle_write () is used.
import cairo
import rsvg
import glib
import gobject
const FileName = "/usr/share/gnome-chess/pieces/simple/whiteKing.svg" # you
may try other files!
var
s: Surface
cr: Context
error: GError
handle: rsvg.Handle
s = imageSurfaceCreate(FORMAT.ARGB32, 1250, 1250) # that is the svg size
displayed by eog!
cr = create(s)
handle = newHandle(FileName, error)
if error != nil:
echo error.message
free(error)
assert handle != nil
assert renderCairo(handle, cr)
objectUnref(handle)
discard writeToPng(s, "image.png")
destroy(cr)
destroy(s)