iniquity

A re-imagining of the iconic BBS software.

View on GitHub

Class: Graphic

core/graphic.Graphic

Graphic class for in-memory ANSI manipulation

Table of contents

Constructors

Accessors

Methods

Constructors

constructor

new Graphic(options?)

Parameters

Name Type
options GraphicOptions

Defined in

core/src/graphic.ts:61

Accessors

ANSI

get ANSI(): string

Get ANSI representation of the graphic

Returns

string

Defined in

core/src/graphic.ts:431

set ANSI(data): void

Parse ANSI data into the graphic

Parameters

Name Type
data string

Returns

void

Defined in

core/src/graphic.ts:469


BIN

get BIN(): Buffer

Get BIN representation (raw character + attribute pairs)

Returns

Buffer

Defined in

core/src/graphic.ts:719

set BIN(data): void

Load from BIN data

Parameters

Name Type
data Buffer

Returns

void

Defined in

core/src/graphic.ts:740


MSG

get MSG(): string

Get MSG representation (Ctrl-A codes for Synchronet compatibility)

Returns

string

Defined in

core/src/graphic.ts:756


attr

get attr(): number

Default attribute

Returns

number

Defined in

core/src/graphic.ts:102

set attr(value): void

Parameters

Name Type
value number

Returns

void

Defined in

core/src/graphic.ts:106


attrMask

get attrMask(): number

Attribute mask for filtering attributes during draw

Returns

number

Defined in

core/src/graphic.ts:113

set attrMask(value): void

Parameters

Name Type
value number

Returns

void

Defined in

core/src/graphic.ts:117


data

get data(): GraphicCell[][]

Raw data array

Returns

GraphicCell[][]

Defined in

core/src/graphic.ts:124


dataHeight

get dataHeight(): number

True height of content (may be less than allocated height)

Returns

number

Defined in

core/src/graphic.ts:131


dataWidth

get dataWidth(): number

True width of content

Returns

number

Defined in

core/src/graphic.ts:138


height

get height(): number

Height of the graphic

Returns

number

Defined in

core/src/graphic.ts:95


width

get width(): number

Width of the graphic

Returns

number

Defined in

core/src/graphic.ts:88

Methods

attrToAnsi

attrToAnsi(attr): string

Convert CGA attribute to ANSI escape sequence

Parameters

Name Type
attr number

Returns

string

Defined in

core/src/graphic.ts:374


clear

clear(attr?): void

Clear the entire graphic

Parameters

Name Type
attr? number

Returns

void

Defined in

core/src/graphic.ts:193


clearData

clearData(x, y): void

Clear cell data at position

Parameters

Name Type
x number
y number

Returns

void

Defined in

core/src/graphic.ts:182


clone

clone(): Graphic

Create a copy of this graphic

Returns

Graphic

Defined in

core/src/graphic.ts:822


draw

draw(output, xpos?, ypos?, width?, height?, xoff?, yoff?, delay?): boolean

Draw the graphic to output at specified position

Parameters

Name Type Default value
output IQOutput undefined
xpos number 1
ypos number 1
width? number undefined
height? number undefined
xoff number 0
yoff number 0
delay? number undefined

Returns

boolean

Defined in

core/src/graphic.ts:319


getData

getData(x, y): GraphicCell

Get cell data at position

Parameters

Name Type
x number
y number

Returns

GraphicCell

Defined in

core/src/graphic.ts:151


load

load(filename, offset?): boolean

Load a file into the graphic

Parameters

Name Type
filename string
offset? number

Returns

boolean

Defined in

core/src/graphic.ts:285


putmsg

putmsg(x, y, text, attr?): void

Put a message at position with optional attribute

Parameters

Name Type
x number
y number
text string
attr? number

Returns

void

Defined in

core/src/graphic.ts:237


resize

resize(newWidth, newHeight): void

Resize the graphic

Parameters

Name Type
newWidth number
newHeight number

Returns

void

Defined in

core/src/graphic.ts:846


scroll

scroll(direction?, lines?): void

Scroll the graphic content

Parameters

Name Type Default value
direction "up" | "down" "up"
lines number 1

Returns

void

Defined in

core/src/graphic.ts:207


setANSI

setANSI(data, processMCI?): void

Set ANSI content with optional MCI pre-processing

Parameters

Name Type Default value Description
data string undefined ANSI content (may contain MCI/pipe codes)
processMCI boolean false If true, process all MCI codes (pipe codes, @-codes, control codes) before parsing ANSI

Returns

void

Defined in

core/src/graphic.ts:478


setData

setData(x, y, ch, attr): void

Set cell data at position

Parameters

Name Type
x number
y number
ch string
attr number

Returns

void

Defined in

core/src/graphic.ts:162