Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Repository files navigation

NanoSVG Chicory Java

This is a pure Java 11 build of NanoSVG compiled to wasm and then to java using Chicory.

Note

The Chicory runtime used by this project is a fork patched for improved compatibility with Nostr Game Engine, however it should run just fine with the official build.

What this exposes

The public Java API is centered on NanoSvgRenderer:

NanoSvgRenderer renderer = new NanoSvgRenderer(ByteBuffer::allocateDirect);
NanoSvgRenderResult result = renderer.render(svgUtf8ByteBuffer, 256, 256);
ByteBuffer rgba = result.pixels();

To render a source-space SVG viewBox into a target image:

NanoSvgRenderResult viewBox = renderer.renderViewBox(
        svgUtf8ByteBuffer, 256, 256, 64, 64, 128, 128, NanoSvgFitMode.CONTAIN);

Build requirements

  • JDK 11+
  • Gradle 8+
  • Clang/LLD with wasm32 support available as clang
  • WebAssembly linker available as wasm-ld or ld.lld (usually provided by package lld)

Build

./gradlew clean build

About

NanoSVG for java built from wasm + chicory

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages