Code Monkey home page Code Monkey logo

drawille's Introduction

Drawille

Pixel graphics in terminal implemented with unicode braille characters

MIT License Version 1.0.3 Travis CI

About

This project is a Java port of the original drawille python project by asciimoo. This project serves as a library for Java to draw in the console using braille letters that are part of the unicode character space. Braille characters in unicode have a 4 by 2 matrix that can be used as a sub-matrix for each character in a console screen. This braille dot matrix effectively raises the resolution of any console by eight times. The examples below were rendered in the console using this Java library. The original ideas for these examples came from the original project repository.

Examples

Canvas canvas = new Canvas ( 75, 6 );
for ( int x = 0; x <= canvas.getWidth () * 8; x++ ) {
	canvas.set ( x / 10, ( int ) Math.round ( 10 + Math.cos ( x * Math.PI / 180 ) * 10 ) );
}
canvas.render ();

Example #01

Turtle turtle = new Turtle ( 75, 50 );
turtle.move ( turtle.getWidth () / 2, turtle.getHeight () / 2 );
turtle.down ();
for ( int x = 0; x < 72; x++ ) {
	turtle.right ( 20 );
	for ( int y = 0; y < 72; y++ ) {
		turtle.right ( 20 );
		turtle.forward ( 10 );
	}
}
turtle.render ();

Example #02

Building & Running

This project uses maven as a build system. Therefore to package this library into a jar, execute mvn package while in the project root directory. Since braille characters are part of the unicode domain, it is important to append the -Dfile.encoding=UTF-8 flag when running your Java application. This will ensure that the braille characters are rendered correctly in your console. If this flag is not passed, then you will likely see the ? character in place of it.

Development Environment

Docker can be used to spin up a quick development environment:

docker build -t drawille .
docker run -it -v `pwd`:/usr/src/drawille drawille bash

Once inside the container, you can compile and run the examples:

mvn package
javac -cp target/drawille-1.0.3.jar docs/examples/*Demo.java
java -cp .:target/drawille-1.0.3.jar docs/examples/CanvasDemo
java -cp .:target/drawille-1.0.3.jar docs/examples/TurtleDemo

Bugs / Feature Requests

If you have any feature requests, please open up an issue. Similarly if there are any bugs found, please report them by opening up an issue. If a bug is found, please include steps to reproduce the issue, alongside the expected and actual behavior.

drawille's People

Contributors

null93 avatar fulcanelly avatar elbosso avatar

Stargazers

 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.