This library provides Go bindings for the ThorVG library. There is no use of cgo.
The libary is developed under linux/amd64.
It appears to work on other other supported platforms,
in that all of the tests pass when run in github actions.
However it is an immature library, and there may well be undiscovered problems. So caution is advised.
The only supported image loaders are those for svg and lottie files. For other image formats use Go's image packages to load the raw data.
No AI was used in the creation of this library.
The following platforms are currently suppported.
linux/amd64linux/arm64macos/amd64macos/arm64
thorvg is a C++ library, with an optional C api.
The https://github.com/pekim/thorvg-binaries repo has a github worklfow
that builds thorvg for multiple platforms, with the C api.
For each platform a shared library file is produced.
The library files, such as libthorvg_linux_amd64, are copied in to this repo.
When an application uses this library, one of the library files is included at build time courtesy of Go's embedding support. At runtime the embed library is written to a temporary file. The purego library is then used to open the file and register its api functions.
See https://github.com/pekim/thorvg-binaries for details of how to upgrade the thorvg library.
- install
goimportsif not already installed - install
golangci-lint(v2.x) if not already installed - install the
pre-commitapplication if not already installed - install pre-commit hook in this repo's workspace
pre-commit install