All Projects → asciimoo → Lua Drawille

asciimoo / Lua Drawille

Pixel graphics in terminal using unicode braille characters

Programming Languages

lua
6591 projects

Lua-DRAWILLE

Generic badge Generic badge Generic badge Generic badge

Draw graphics on the terminal with Braille charakters. Implements a small graphics kernel with a handfull of useful routines, like Line Bresenham and Ellipse, light 3D support and Turtle Graphics.

Additionally the PGL "Primitive Graphics Language", that will plot a graph from a string and that is supported by the implementation of a Lindenmayer algorithm to create fractals. Implementing a nice little Conway's Game of Life as an example.

Lua implementation of drawille Version 2.0 of drawille

Usage

Canvas = require "drawille"

local c = Canvas.new()

for i=0,360*4 do
    if (i % 15) == 0 then
        c:set(i/15, math.floor(math.sin(i*(math.pi/180))*4))
    end
end

print(c:frame())

Rotating Cube Lines Polygon Random Colors Turtle Graphics Hilbert Curve Sierpinski Triangle Lindenmayer Tree Game of Life

Usage with Colors

Note: Color Resolution is peer Character, not per Subpixel of the [Braille][] characters. [Braille]: http://en.wikipedia.org/wiki/Braille For usage with Curses see Examples.

Canvas = require "drawille"

local c = Canvas.new()
c.esccodes = true
for i=0,360*4 do
    if (i % 15) == 0 then
        local r = math.random(0,255)
        local g = math.random(0,255)
        local b = math.random(0,255)
        c:set(i/15, math.floor(math.sin(i*(math.pi/180))*4),r,g,b)
    end
end

print(c:frame())

Sine

Added features with 2.0

  • point3D library with rudimentary backface culling
  • full support of turtle graphics
  • lindenmayer algorithm
  • new "drawille drawing language" DDL
  • shitload of additional examples, especially for Lindenmayer
  • Conways "Game of Life"
  • many new features
  • better 3D routines, lines, ellipses (now Bresenham), working polygons
  • more or less everything the Python version can do but more than that
  • remaining basically compatible to 1.0

Dependings

  • lcurses (sudo luarocks install lcurses)

ToDo

  • better, full 3D routines, using of GPU if available, matrix routines
  • replacing culling algorithm with more modern way, expanding 3D functionality
  • implementing load of 3D objects (working on that right now)
  • while everything is faster in this version, the "speed_test" is still slower than the Python version, because the data structure is different
  • porting data structure into Lua FFI implementation, no optimization done yet

Video Tutorials

Bugs

Bugs or suggestions? Visit the issue tracker.

Tested with

  • urxvt terminal and fixed font
  • Terminology on Linux/Kubuntu 18.10 Terminus (TTF) Font
  • Terminator on Linux/Kubuntu 18.10

Not correctly showing on

  • Konsole with color activated, any font
  • Cool Retro Term on Linux/Kubuntu 18.10

LICENSE

drawille is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

drawille is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU Affero General Public License for more details.

You should have received a copy of the GNU Affero General Public License
along with drawille. If not, see < http://www.gnu.org/licenses/ >.

(C) 2014- by Adam Tauber, <[email protected]>
(CC) 2018 by Hanno Behrens, <behrens[DOT]hanno[AT]gmail[DOT]com>
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].