drawille-0.1.0.5: A port of asciimoo's drawille to haskell

Copyright(c) Pedro Yamada
LicenseGPL-3
MaintainerPedro Yamada <tacla.yamada@gmail.com>
Stabilitystable
Portabilitynon-portable (not tested on multiple environments)
Safe HaskellSafe-Inferred
LanguageHaskell2010

System.Drawille

Description

This module enables using UTF-8 braille characters to render drawings onto the console.

Synopsis

Documentation

type Canvas = Map (Int, Int) Int

The Canvas type. Represents a canvas, mapping points to their braille "px" codes.

empty :: Canvas

The empty canvas, to be drawn upon.

frame :: Canvas -> String

Pretty prints a canvas as a String, ready to be printed.

get :: Canvas -> (Int, Int) -> Bool

Gets the current state for a coordinate in a canvas.

set :: Canvas -> (Int, Int) -> Canvas

Sets a coordinate in a canvas.

unset :: Canvas -> (Int, Int) -> Canvas

Unsets a coordinate in a canvas.

toggle :: Canvas -> (Int, Int) -> Canvas

Toggles the state of a coordinate in a canvas

fromList :: [(Int, Int)] -> Canvas

Creates a canvas from a List of coordinates

toPs :: (Int, Int) -> (Int, Int)

Helper to convert a coordinate to its corespondent in the bigger braille grid's size

toPx :: (Int, Int) -> Int

Converts a coordinate into its local braille "px" code, using the pxMap.

pxMap :: Num a => [[a]]

A mapping between local coordinates, inside of a single cell, and each of the braille characters they correspond to (with an offset).

pxOff :: Num a => a

The offset between the values in the pxMap, which have nice binary properties between each other, and the actual braille character codes.