distance-field

Library for generating distance field bitmaps to render as pseudo-vector images in a shader
Documentation
How to run
Checkout the repository and cd into it; then run:
cargo run --example generator -- img/input.png output.png 64 64
This will take the following image as input:

And generate a 64x64 distance field:

Now we can use the generated distance field to create a vector image. First we need to scale it up with a linear interpolation:

Then we apply a treshold function:

You can see that we have something which looks very similar to the original input image and that just from a 64x64 image! But it's still very pixelated and doesn't look like a vector image. This can be fixed by not doing a hard treshold but allowing some shades of gray. In GIMP we can do this by adjusting the levels:

This gives us the following result:
