Term::Graille - Terminal Graphics using Braille
my $canvas = Term::Graille->new( width => 72, # pixel width height => 64, # pixel height top=>3, # row position in terminal (optional,defaults to 1) left=>10, # column position (optional,defaults to 1) borderStyle => "double", # );
Inspired by Drawille by asciimoo, which has many variants (including a perl variant Term::Drawille by RHOELZ), this is a clone with a few extras. The goal is to achieve performance and features. with built-in turtle-like graphics, line and curve drawing (Algorithm::Line::Bresenham), scrolling, border setting, and more in development.
my $canvas=Term::Graille-
Creates a new canavas; params are width The pixel width, required height the pixel height, required, top terminal row (optional,default 1) left terminal column ( optional,default 1) borderStyle border type (optional,one of 'simple', 'double', 'thin', 'thick' or 'shadow') borderColour border colour ( optional), title Title text for top border,(optional) titleColour Title colour (optional)
width
height
top
left
borderStyle
borderColour
title
titleColour
$canvas-
Draws the canvas to the terminal window. Optional row and column parameters may be passed to position the displayed canvas. If borderStyle is specified, the border is drawn, If title is specified this is added to the top border
Returns the string containing the canvas of utf8 braille symbols, rows being separated by newline.
Sets a particular pixel on (default if $pixelValue not sent) or off.
$pixelValue
Sets the pixel value at $x,$y to blank
$x,$y
Gets the pixel value at $x,$y
Re-initialises the canvas with blank braille characters
Uses Algorithm::Line::Bresenham to draw a line from $x1,$y1 to $x2,$y2. The optional value $value sets or unsets the pixels
$x1,$y1
$x2,$y2
$value
Uses Algorithm::Line::Bresenham to draw a circle centered at $x1,$y1 with radius $radius to $x2,$y2. The optional value $value sets or unsets the pixels
$radius
Uses Algorithm::Line::Bresenham to draw a rectangular ellipse, (an ellipse bounded by a rectangle defined by $x1,$y1,$x2,$y2). The optional value $value sets or unsets the pixels
$x1,$y1,$x2,$y2
Uses Algorithm::Line::Bresenham to draw a quadratic bezier, defined by end points $x1,$y1,$x3,$y3) and control point $x2,$y2. The optional value $value sets or unsets the pixels
$x1,$y1,$x3,$y3
Uses Algorithm::Line::Bresenham to draw a poly line, form a sequences of points. The optional value $value sets or unsets the pixels
Scrolls in $direction. $direction may be "l", "left", "r","right", "u","up","d", "down". Beacuse of the use of Braille characters, up/down scrolling is 4 pixels at a time, whereas left right scrolling is 2 pixels at a time. If $wrap is a true value, the screen wraps around.
$direction
$wrap
Interface to Graille's built in Turtle interpreter. A string is taken and split by senicolons or newlines into intsructions. The instructions are trimmed, and split by the first space character into command and parameters. Very simple in other words.
fd distance pen moves forward a certain distance. lt angle rt angle turns left or right. bk distance pen moves back a certain distance pu pd Pen is up or down, up means no drawing takes place, and down means the turtle draws as it moves. dir set teh direction at a specific angle in dgrees, with 0 being directly left. mvmoves pen to specific coordinates without drawing ce centers the turtle in the middle of a canvas sp allows animated drawing by specifiying the the number of centiseconds between instructions
fd distance
lt angle
rt angle
bk distance
pu
pd
dir
mv
ce
sp
Saif Ahmed
Artististic, Same as Perl
Manual install:
$ perl Makefile.PL $ make $ make install
To install Term::Graille, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Term::Graille
CPAN shell
perl -MCPAN -e shell install Term::Graille
For more information on module installation, please visit the detailed CPAN module installation guide.