Skip to content

The Canvas

Saif Ahmed edited this page Dec 7, 2022 · 3 revisions

Using Term::Graille is pretty much typical for perl modules in general. utf8 fonts need to be enabled, and the terminal needs to be ANSI capable. Term::Graille also exports many functions for manipulating the ANSI terminal as well.

#! /usr/bin/env perl

use strict; use warnings;

use Term::Graille  qw/colour paint printAt cursorAt clearScreen border blockBlit block2braille pixelAt/;

A new drawing area, or "canvas" can be created using Term Graille::new(). The width and height are pseudo pixel values. The Graille canvas follows the Cartesian coordinate system with the 0,0 being at the bottom left corner of the canvas. Only the width and height are absolutely needed.

my $canvas = Term::Graille->new(
    width  => 140,
    height => 60,
    top=>4,
    left=>4,
    borderStyle => "double",
    borderColour => "blue",
    title => " Graille Application ",
    titleColour => "red",
  );