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
Accessors
ANSI
• get ANSI(): string
Get ANSI representation of the graphic
Returns
string
Defined in
• set ANSI(data): void
Parse ANSI data into the graphic
Parameters
| Name | Type |
|---|---|
data |
string |
Returns
void
Defined in
BIN
• get BIN(): Buffer
Get BIN representation (raw character + attribute pairs)
Returns
Buffer
Defined in
• set BIN(data): void
Load from BIN data
Parameters
| Name | Type |
|---|---|
data |
Buffer |
Returns
void
Defined in
MSG
• get MSG(): string
Get MSG representation (Ctrl-A codes for Synchronet compatibility)
Returns
string
Defined in
attr
• get attr(): number
Default attribute
Returns
number
Defined in
• set attr(value): void
Parameters
| Name | Type |
|---|---|
value |
number |
Returns
void
Defined in
attrMask
• get attrMask(): number
Attribute mask for filtering attributes during draw
Returns
number
Defined in
• set attrMask(value): void
Parameters
| Name | Type |
|---|---|
value |
number |
Returns
void
Defined in
data
• get data(): GraphicCell[][]
Raw data array
Returns
GraphicCell[][]
Defined in
dataHeight
• get dataHeight(): number
True height of content (may be less than allocated height)
Returns
number
Defined in
dataWidth
• get dataWidth(): number
True width of content
Returns
number
Defined in
height
• get height(): number
Height of the graphic
Returns
number
Defined in
width
• get width(): number
Width of the graphic
Returns
number
Defined in
Methods
attrToAnsi
▸ attrToAnsi(attr): string
Convert CGA attribute to ANSI escape sequence
Parameters
| Name | Type |
|---|---|
attr |
number |
Returns
string
Defined in
clear
▸ clear(attr?): void
Clear the entire graphic
Parameters
| Name | Type |
|---|---|
attr? |
number |
Returns
void
Defined in
clearData
▸ clearData(x, y): void
Clear cell data at position
Parameters
| Name | Type |
|---|---|
x |
number |
y |
number |
Returns
void
Defined in
clone
▸ clone(): Graphic
Create a copy of this graphic
Returns
Defined in
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
getData
▸ getData(x, y): GraphicCell
Get cell data at position
Parameters
| Name | Type |
|---|---|
x |
number |
y |
number |
Returns
Defined in
load
▸ load(filename, offset?): boolean
Load a file into the graphic
Parameters
| Name | Type |
|---|---|
filename |
string |
offset? |
number |
Returns
boolean
Defined in
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
resize
▸ resize(newWidth, newHeight): void
Resize the graphic
Parameters
| Name | Type |
|---|---|
newWidth |
number |
newHeight |
number |
Returns
void
Defined in
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
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
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