A small V library to draw pixel graphics on the terminal using Braille letters

1 month ago 1

Vrawille is a free software V library for drawing in the terminal using Braille characters. It's inspired in similar libraries in other languages like drawille but it's a complete rewrite from scratch.

⠀⠀⠀⠀⠀⣀⣤⣶⣶⣶⣶⣶⣶⣦⣄⡀⠀⠀⠀⠀ ⠀⠀⢀⡴⠞⠋⠉⠉⠈⠉⠉⠛⠿⣿⣿⣿⣶⣄⠀⠀ ⠀⠠⠊⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⠻⣿⣿⣿⣦⠀ ⠠⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠹⣿⣿⣿⣧ ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣿⣿⣿⣿ ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣾⣿⣿⣿ ⠠⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢠⣿⣿⣿⡿ ⠀⠡⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣠⣿⣿⣿⡿⠁ ⠀⠀⠘⢦⣄⡀⠀⠀⠀⠀⠀⣀⣤⣾⣿⣿⣿⠟⠀⠀ ⠀⠀⠀⠀⠈⠛⠿⣿⣾⣿⣿⣿⣿⡿⠟⠋⠀⠀⠀⠀

Vrawille also supports rendering images loaded through stbi in the terminal:

Digital drawing of an anime girl with wolf ears rendered entirely using Braille characters

Animation made of Braille characters

The easiest way to get vrawille is using vpm:

vpm install Nirei.vrawille

The API is simple:

// Create a Canvas struct width, height := 48, 48 mut canvas := vrawille.Canvas.new(width, height) // Set some pixels canvas.set(22,22) canvas.set(23,23) canvas.set(24,24) canvas.set(25,25) canvas.set(26,26) canvas.set(27,27) canvas.set(27,22) canvas.set(26,23) canvas.set(25,24) canvas.set(24,25) canvas.set(23,26) canvas.set(22,27) // Draw your canvas println(*canvas)

The preceding code should produce this result:

⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢄⠀⡠⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⡠⠛⢄⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀

You can find some more usage examples in the examples folder.

Feel free to submit Issues and Pull Requests to vrawille's repository directly.

Vrawille is Free Software, licensed under the terms of the Apache License 2.0 of which you can find a copy in our LICENSE file.

Image "Holo's Gaze" by Arata Lab, used in the examples is licensed under CC BY NC ND 3.0.

Read Entire Article