Skip to content

Canvas Operations

Saif Ahmed edited this page Dec 8, 2022 · 2 revisions

Once a canvas has been created several things can be done to manipulate the whole screen.

  • $canvas->clear() clears the canvas, Re-initialises the canvas with blank braille characters. This is different from clearscreen() which is exported by Term::Graille and clears the whole screen.

  • $canvas->scroll($direction,$wrap, $noChars)
    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 C<$wrap> is a true value, the screen wraps around.$noChars is number of characters to scroll; left right scrolls are 2 pixels at a time, vertical scrolls are 4 pixels at a time.

  • $canvas->exportCanvas($filename) , $canvas->importCanvas($filename,[$toBuffer]) This allows the loading and unloading of a canvas from a file. There is no checking of the dimension of the canvas being imported at the moment. Import can be direct to the canvas, the function return the loaded data as an ArrayRef, the optional $toBuffer parameter, if true prevents loading the data onto the canvas.