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:81

Accessors

ANSI

get ANSI(): string

Get ANSI representation of the graphic

Returns

string

Defined in

core/src/graphic.ts:451

set ANSI(data): void

Parse ANSI data into the graphic

Parameters

Name Type
data string

Returns

void

Defined in

core/src/graphic.ts:489


BIN

get BIN(): Buffer

Get BIN representation (raw character + attribute pairs)

Returns

Buffer

Defined in

core/src/graphic.ts:739

set BIN(data): void

Load from BIN data

Parameters

Name Type
data Buffer

Returns

void

Defined in

core/src/graphic.ts:760


MSG

get MSG(): string

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

Returns

string

Defined in

core/src/graphic.ts:776


attr

get attr(): number

Default attribute

Returns

number

Defined in

core/src/graphic.ts:122

set attr(value): void

Parameters

Name Type
value number

Returns

void

Defined in

core/src/graphic.ts:126


attrMask

get attrMask(): number

Attribute mask for filtering attributes during draw

Returns

number

Defined in

core/src/graphic.ts:133

set attrMask(value): void

Parameters

Name Type
value number

Returns

void

Defined in

core/src/graphic.ts:137


data

get data(): GraphicCell[][]

Raw data array

Returns

GraphicCell[][]

Defined in

core/src/graphic.ts:144


dataHeight

get dataHeight(): number

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

Returns

number

Defined in

core/src/graphic.ts:151


dataWidth

get dataWidth(): number

True width of content

Returns

number

Defined in

core/src/graphic.ts:158


height

get height(): number

Height of the graphic

Returns

number

Defined in

core/src/graphic.ts:115


width

get width(): number

Width of the graphic

Returns

number

Defined in

core/src/graphic.ts:108

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:394


clear

clear(attr?): void

Clear the entire graphic

Parameters

Name Type
attr? number

Returns

void

Defined in

core/src/graphic.ts:213


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:202


clone

clone(): Graphic

Create a copy of this graphic

Returns

Graphic

Defined in

core/src/graphic.ts:842


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:339


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:171


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:305


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:257


resize

resize(newWidth, newHeight): void

Resize the graphic

Parameters

Name Type
newWidth number
newHeight number

Returns

void

Defined in

core/src/graphic.ts:866


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:227


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:498


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:182