Code Monkey home page Code Monkey logo

vkvg's Introduction


vkvg

Vulkan Vector Graphics

vkvg is an open-source 2D graphics library written in C using Vulkan as backend. The API follows the same pattern as Cairo, 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 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
  • Test includes svg rendering with nanoSVG

Requirements:

  • CMake: version >= 3.16
  • Vulkan: version >= 1.1
  • FontConfig: optional, without fontconfig, use vkvg_load_font_from_path.
  • Freetype: optional, stb_truetype as alternative.
  • Harfbuzz: optional, without complex text shaping may be wrong.
  • GLSLC: spirv compiler, included in LunarG SDK: compile shader to spir-V (building only, optional)
  • xxd: generate headers with precompiled shaders (building only, optional)
  • GLFW: 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

#fetch sources from github
git clone --recursive https://github.com/jpbruyere/vkvg.git
cd vkvg
# Create build directory
mkdir build
cd build
# Run CMake configuration
cmake ..

CMake configure options

Core library options:
  • -DVKVG_USE_GLUTESS=true: Use embedded glu tesselator to fill polygones in NON-ZERO mode. If false, a simple ear clipping algorithm is used.
  • -DVKVG_SVG=true: Enable experimental svg renderer. If false, use nanoSVG.
  • -DVKVG_RECORDING=true: Enable experimental draw commands recording infrastructure.
  • -DVKVG_BUILD_DOCS=true: Build documentation if doxygen is found.
Text rendering libraries:

Those libraries are enabled by default, but disabled if not found.

  • -DVKVG_USE_FONTCONFIG=true: enable FontConfig to resolve font's names.
  • -DVKVG_USE_FREETYPE=true: enable FreeType to render glyphs, if false glyphs are rendered with stb_truetype.
  • -DVKVG_USE_HARFBUZZ=true: enable harfbuzz for text shaping.
Tests options:
  • -DVKVG_BUILD_TESTS=true: build all tests in the tests forlder.
  • -DVKVG_TEST_DIRECT_DRAW=true: enable drawing directly on the swapchain images.
Debugging options:

If vkvg is compiled with CMAKE_BUILD_TYPE=Debug, several additional options are made available to help debugging:

  • -DENABLE_VALIDATION=true: enable vulkan validation layer.
  • -DENABLE_DBG_UTILS=true: enable various vulkan debug utils extensions features.
  • -DENABLE_RENDERDOC=true: enable renderdoc layer.
  • -DENABLE_WIRED_FILL=true: enable rendering in wired mode, current mode is controled with the global variable vkvg_wired_debug.
  • -DENABLE_PROFILING=true: add -pg to the compile options.
  • -DVKVG_DBG_STATS=true: store various context statistics fetchable with vkvg_device_get_stats()
cmake --build .

A detailed tutorial is available for Windows.

Running tests

Append the -h option to see available command line parameters.

Contributing

See the contribution guide for more information.

Join us on gitter for any question.

Addtitional Credits

Change log

  • v0.2.0
    • radial gradients.
    • better stroke joins handling.
    • png saved in srgb format.
    • doxygen cmake target and style

To Do

  • Use Scissor where possible.
  • Improve stroke algorithms.
  • Radial gradients.
  • Dashed lines.
  • Operators.
  • Optimize vulkan memory allocations by sub-allocating from a single shared memory chunk per type.
  • Optimize command submissions.
  • Test SDF font rendering.
  • Avoid line joins inside curves and arc.
  • Structured unit testing.
  • Perf and memory checks.
  • Code cleanup and comments.
  • Documentations.

vkvg's People

Contributors

jpbruyere avatar rubo3 avatar fzwoch avatar volatus avatar panaman67 avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.