Learn R Programming

plotcli (version 0.2.0)

BlockCanvas: Block Canvas Class

Description

Block Canvas Class

Block Canvas Class

Arguments

Super class

plotcli::Canvas -> BlockCanvas

Public fields

upper_block

Upper half block character

lower_block

Lower half block character

full_block

Full block character

pixel_state

Matrix tracking which half-pixels are set (0=none, 1=upper, 2=lower, 3=both)

Methods

Inherited methods


Method new()

Initialize Block canvas

Usage

BlockCanvas$new(width, height)

Arguments

width

Character width

height

Character height


Method set_pixel()

Set a pixel in Block space

Usage

BlockCanvas$set_pixel(x, y, color = NULL)

Arguments

x

X coordinate (1-based, in pixel space: 1 to width)

y

Y coordinate (1-based, in pixel space: 1 to height*2, 1 = top)

color

Optional color name


Method clear()

Clear the canvas

Usage

BlockCanvas$clear()


Method clone()

The objects of this class are cloneable with this method.

Usage

BlockCanvas$clone(deep = FALSE)

Arguments

deep

Whether to make a deep clone.

Details

Canvas using Unicode block elements for 2x vertical resolution. Uses half-block characters: upper half (U+2580), lower half (U+2584), full block (U+2588).

Resolution: 1x2 (1 horizontal, 2 vertical pixels per character)