Vulkan Vector Graphics
**vkvg** is an open-source *2D graphics library* written in **C** using [Vulkan](https://www.khronos.org/vulkan/) as backend. The **API** follows the same pattern as [Cairo](https://www.cairographics.org/), but new functions and original drawing mechanics may be added.
**vkvg** is in early development stage, the API is subject to change. All contributions are welcome.
For API documentation and usage, please refer to the [Cairo](https://www.cairographics.org/) for now.
## Performance comparison
major libs perf comparison
## Current status:
- Fill (stencil even-odd, non-zero with ear clipping).
- Stroke.
- Basic painting operation.
- Font system with caching operational.
- Linear Gradients.
- Line caps and joins.
- Context should be thread safe, extensive tests required.
- Image loading and writing with [stb lib](https://github.com/nothings/stb)
- Test includes svg rendering with [nanoSVG](https://github.com/memononen/nanosvg)
## Requirements:
- [CMake](https://cmake.org/): version >= 3.21
- [Vulkan](https://www.khronos.org/vulkan/)
- [FontConfig](https://www.freedesktop.org/wiki/Software/fontconfig/): optional, without fontconfig, use `vkvg_load_font_from_path`.
- [Freetype](https://www.freetype.org/): optional, stb_truetype as alternative.
- [Harfbuzz](https://www.freedesktop.org/wiki/Software/HarfBuzz/): optional, without complex text shaping may be wrong.
- GLSLC: spirv compiler, included in [LunarG SDK](https://www.lunarg.com/vulkan-sdk/): compile shader to spir-V (building only, optional)
- [xxd](https://linux.die.net/man/1/xxd): generate headers with precompiled shaders (building only, optional)
- [GLFW](http://www.glfw.org/): optional, if present tests are built.
if `glslc` or `xxd` are not present, a precompiled version of the shaders is stored in the git tree.
## Building
```bash
#fetch sources from github
git clone --recursive https://github.com/jpbruyere/vkvg.git
cd vkvg
# Create build directory
mkdir build
cd build
# Run CMake, optionaly setup glslc path
cmake ..
make
```
A [detailed tutorial](doc/windows_build_tutorial.md) is available for Windows.
## Running tests
Append the `-h` option to see available command line parameters.
## Contributing
See the [contribution guide](https://github.com/jpbruyere/vkvg/blob/master/CONTRIBUTING.md) for more information.
Join us on [gitter](https://gitter.im/CSharpRapidOpenWidgets) for any question.
## Change log
* v0.2.0
- radial gradients.
- better stroke joins handling.
- png saved in srgb format.
- doxygen cmake target and style
## To Do
- [x] Use Scissor where possible.
- [x] Improve stroke algorithms.
- [x] Radial gradients.
- [x] Dashed lines.
- [ ] Operators.
- [x] Optimize vulkan memory allocations by sub-allocating from a single shared memory chunk per type.
- [x] Optimize command submissions.
- [x] Test SDF font rendering.
- [x] Avoid line joins inside curves and arc.
- [ ] Structured unit testing.
- [x] Perf and memory checks.
- [ ] Code cleanup and comments.
- [ ] Documentations.