nimterm/canvas
This page is generated from the module’s exported API and ## documentation comments.
Testable terminal-cell canvas.
Cell = object glyph*: Rune combining*: string continuation*: bool style*: StyleCanvas
Section titled “Canvas”Canvas = object size*: SizeProcedures
Section titled “Procedures”blankCell
Section titled “blankCell”proc blankCell(style = defaultStyle()): Cell {.raises: [], tags: [], forbids: [].}Returns: Cell.
Arguments
Section titled “Arguments”| Name | Type | Default |
|---|---|---|
style |
inferred |
defaultStyle() |
newCanvas
Section titled “newCanvas”proc newCanvas(canvasSize: Size; fill = blankCell()): Canvas {.raises: [], tags: [], forbids: [].}Returns: Canvas.
Arguments
Section titled “Arguments”| Name | Type | Default |
|---|---|---|
canvasSize |
Size |
|
fill |
inferred |
blankCell() |
proc valid(canvas: Canvas; x, y: int): bool {.raises: [], tags: [], forbids: [].}Returns: bool.
Arguments
Section titled “Arguments”| Name | Type | Default |
|---|---|---|
canvas |
Canvas |
|
x |
int |
|
y |
int |
getCell
Section titled “getCell”proc getCell(canvas: Canvas; x, y: int): Cell {.raises: [], tags: [], forbids: [].}Returns: Cell.
Arguments
Section titled “Arguments”| Name | Type | Default |
|---|---|---|
canvas |
Canvas |
|
x |
int |
|
y |
int |
setCell
Section titled “setCell”proc setCell(canvas: var Canvas; x, y: int; cell: Cell) {.raises: [], tags: [], forbids: [].}Arguments
Section titled “Arguments”| Name | Type | Default |
|---|---|---|
canvas |
var Canvas |
|
x |
int |
|
y |
int |
|
cell |
Cell |
proc clear(canvas: var Canvas; fill = blankCell()) {.raises: [], tags: [], forbids: [].}Arguments
Section titled “Arguments”| Name | Type | Default |
|---|---|---|
canvas |
var Canvas |
|
fill |
inferred |
blankCell() |
proc fill(canvas: var Canvas; area: Rect; cell = blankCell()) {.raises: [], tags: [], forbids: [].}Arguments
Section titled “Arguments”| Name | Type | Default |
|---|---|---|
canvas |
var Canvas |
|
area |
Rect |
|
cell |
inferred |
blankCell() |
proc copy(canvas: Canvas): Canvas {.raises: [], tags: [], forbids: [].}Returns: Canvas.
Arguments
Section titled “Arguments”| Name | Type | Default |
|---|---|---|
canvas |
Canvas |
writeText
Section titled “writeText”proc writeText(canvas: var Canvas; x, y: int; text: string; style = defaultStyle(); maxWidth = int.high) {.raises: [], tags: [], forbids: [].}Arguments
Section titled “Arguments”| Name | Type | Default |
|---|---|---|
canvas |
var Canvas |
|
x |
int |
|
y |
int |
|
text |
string |
|
style |
inferred |
defaultStyle() |
maxWidth |
inferred |
int.high |
writeAnsiText
Section titled “writeAnsiText”Write ANSI-styled text as semantic cells, preserving the base background.
proc writeAnsiText(canvas: var Canvas; x, y: int; text: string; baseStyle = defaultStyle(); maxWidth = int.high) {. raises: [], tags: [], forbids: [].}Arguments
Section titled “Arguments”| Name | Type | Default |
|---|---|---|
canvas |
var Canvas |
|
x |
int |
|
y |
int |
|
text |
string |
|
baseStyle |
inferred |
defaultStyle() |
maxWidth |
inferred |
int.high |
lineText
Section titled “lineText”proc lineText(canvas: Canvas; y: int): string {.raises: [], tags: [], forbids: [].}Returns: string.
Arguments
Section titled “Arguments”| Name | Type | Default |
|---|---|---|
canvas |
Canvas |
|
y |
int |
plainText
Section titled “plainText”proc plainText(canvas: Canvas): string {.raises: [], tags: [], forbids: [].}Returns: string.
Arguments
Section titled “Arguments”| Name | Type | Default |
|---|---|---|
canvas |
Canvas |