Module: core/graphic
Graphic Class - In-Memory ANSI Buffer
Summary
Cell-based ANSI manipulation for storing and rendering graphics
Inspired by Synchronet’s graphic.js library, this class provides:
- Cell-based data structure (character + attribute per cell)
- Load ANS/BIN files into memory
- Draw to screen at specific coordinates
- Partial region drawing
- Scroll, clear, putmsg operations
- Export to ANSI string or BIN format
Table of contents
References
Classes
Interfaces
Functions
References
CGA
Re-exports CGA
Functions
getBackground
▸ getBackground(attr): number
Helper function to extract background from attribute
Parameters
| Name | Type |
|---|---|
attr |
number |
Returns
number
Defined in
getForeground
▸ getForeground(attr): number
Helper function to extract foreground from attribute
Parameters
| Name | Type |
|---|---|
attr |
number |
Returns
number
Defined in
hasBlink
▸ hasBlink(attr): boolean
Helper function to check if blink is set
Parameters
| Name | Type |
|---|---|
attr |
number |
Returns
boolean
Defined in
makeAttr
▸ makeAttr(fg, bg?, blink?): number
Helper function to create attribute from components
Parameters
| Name | Type | Default value |
|---|---|---|
fg |
number |
undefined |
bg |
number |
0 |
blink |
boolean |
false |
Returns
number