j
jaipkg.dev
packages / library / svgrastr

svgrastr

f71b7f2library

Jai usage example of a foreign c library

No license · updated 12 months ago

Simple SVG rasterizer

This project is an example of using foreign code in Jai. Compatible with compiler version beta 0.2.016.

The final executable is statically linked with a single-header C library, that is being initially created by a C compiler:

cc:
nanosvg.h & nanosvgrast.h > nanosvg.c > nanosvg.o

ar:
nanosvg.o > libnanosvg.a

jai:
main.jai & libnanosvg.a > svgrastr

Build and run:

jai first.jai

./svgrastr -help
----- Here is the list of valid arguments: -----
    -i: SVG input file path
    -o: PNG output file path
    -w: Output file width
    -h: Output file height

    -help, -HELP, -?: Show the list of commands.

./svgrastr -i assets/cog.svg -o cog.png -w 120 -h 120
File written: cog.png

Tools

  • jai
  • cc
  • ar

Dependencies: