textmode.js / converters / TextmodeBrightnessConverter
Class: TextmodeBrightnessConverter
Converter that maps brightness values from a source texture to ASCII characters.
Extends
Properties
_characterFramebuffer
protected _characterFramebuffer: Framebuffer;
Inherited from
TextmodeFeatureConverter
._characterFramebuffer
_options
protected _options: any;
Inherited from
TextmodeFeatureConverter
._options
_primaryColorFramebuffer
protected _primaryColorFramebuffer: Framebuffer;
Inherited from
TextmodeFeatureConverter
._primaryColorFramebuffer
_rotationFramebuffer
protected _rotationFramebuffer: Framebuffer;
Inherited from
TextmodeFeatureConverter
._rotationFramebuffer
_secondaryColorFramebuffer
protected _secondaryColorFramebuffer: Framebuffer;
Inherited from
TextmodeFeatureConverter
._secondaryColorFramebuffer
_transformFramebuffer
protected _transformFramebuffer: Framebuffer;
Inherited from
TextmodeFeatureConverter
._transformFramebuffer
fontManager
protected fontManager: TextmodeFont;
Inherited from
TextmodeFeatureConverter
.fontManager
grid
protected grid: TextmodeGrid;
Inherited from
palette
protected palette: ColorPalette;
Inherited from
TextmodeFeatureConverter
.palette
renderer
protected renderer: GLRenderer;
Inherited from
TextmodeFeatureConverter
.renderer
Accessors
characterFramebuffer
Get Signature
get characterFramebuffer(): Framebuffer;
Returns the framebuffer containing character data.
Returns
Framebuffer
Inherited from
TextmodeFeatureConverter
.characterFramebuffer
options
Get Signature
get options(): any;
Returns the renderer used by this converter.
Returns
any
Inherited from
TextmodeFeatureConverter
.options
primaryColorFramebuffer
Get Signature
get primaryColorFramebuffer(): Framebuffer;
Returns the framebuffer containing primary color data.
Returns
Framebuffer
Inherited from
TextmodeFeatureConverter
.primaryColorFramebuffer
rotationFramebuffer
Get Signature
get rotationFramebuffer(): Framebuffer;
Returns the framebuffer containing rotation data.
Returns
Framebuffer
Inherited from
TextmodeFeatureConverter
.rotationFramebuffer
secondaryColorFramebuffer
Get Signature
get secondaryColorFramebuffer(): Framebuffer;
Returns the framebuffer containing secondary color data.
Returns
Framebuffer
Inherited from
TextmodeFeatureConverter
.secondaryColorFramebuffer
transformFramebuffer
Get Signature
get transformFramebuffer(): Framebuffer;
Returns the framebuffer containing transformation data.
Returns
Framebuffer
Inherited from
TextmodeFeatureConverter
.transformFramebuffer
Methods
brightnessRange()
brightnessRange(range): void;
Sets the brightness range for ASCII character mapping.
Cells that sample outside this range are rendered as transparent.
Parameters
range
[number
, number
]
Array of two numbers [min, max]
, where min
is darkest and max
is brightest.
Returns
void
cellColor()
cellColor(
r,
g,
b,
a): void;
Sets the cell color for all cells affected by the converter. This is only used when cellColorMode
is set to 'fixed'
.
Parameters
r
number
Red component (0-255).
g
number
= r
Green component (0-255).
b
number
= r
Blue component (0-255).
a
number
= 255
Alpha component (0-255).
Returns
void
Inherited from
TextmodeFeatureConverter
.cellColor
cellColorMode()
cellColorMode(mode): void;
Sets the cell color mode.
'sampled'
: Uses sampled colors from the source texture.'fixed'
: Uses a fixed color set via cellColor.
Parameters
mode
The color mode to use for background cells.
"sampled"
| "fixed"
Returns
void
Inherited from
TextmodeFeatureConverter
.cellColorMode
characterColor()
characterColor(
r,
g,
b,
a): void;
Sets the color of the characters affected by the converter. This is only used when characterColorMode
is set to 'fixed'
.
Parameters
r
number
Red component (0-255).
g
number
= r
Green component (0-255).
b
number
= r
Blue component (0-255).
a
number
= 255
Alpha component (0-255).
Returns
void
Inherited from
TextmodeFeatureConverter
.characterColor
characterColorMode()
characterColorMode(mode): void;
Sets the character color mode.
'sampled'
: Uses sampled colors from the source texture.'fixed'
: Uses a fixed color set bycharacterColor()
.
Parameters
mode
The color mode to use for characters.
"sampled"
| "fixed"
Returns
void
Inherited from
TextmodeFeatureConverter
.characterColorMode
characters()
characters(characters): void;
Sets the characters used for mapping.
Parameters
characters
string
The characters to use for mapping, usually ordered from darkest to brightest.
Returns
void
Inherited from
TextmodeFeatureConverter
.characters
disable()
disable(): void;
Disables the converter.
Returns
void
Inherited from
TextmodeFeatureConverter
.disable
enable()
enable(): void;
Enables the converter.
Returns
void
Inherited from
TextmodeFeatureConverter
.enable
enabled()
enabled(enabled): void;
Enables or disables the converter.
Parameters
enabled
boolean
Whether to enable or disable the converter.
Returns
void
Inherited from
TextmodeFeatureConverter
.enabled
flipHorizontally()
flipHorizontally(flip): void;
Flips the characters horizontally.
Parameters
flip
If true
, characters are flipped horizontally. If false
, no flip is applied.
number
| boolean
Returns
void
Inherited from
TextmodeFeatureConverter
.flipHorizontally
flipVertically()
flipVertically(flip): void;
Flips the characters vertically.
Parameters
flip
If true
, characters are flipped vertically. If false
, no flip is applied.
number
| boolean
Returns
void
Inherited from
TextmodeFeatureConverter
.flipVertically
invert()
invert(invert): void;
Swaps the character and cell color.
Parameters
invert
If true
, the character color becomes the cell color and vice versa.
number
| boolean
Returns
void
Inherited from
TextmodeFeatureConverter
.invert
rotation()
rotation(angle): void;
Sets the rotation angle for the characters.
Parameters
angle
number
The rotation angle in degrees.
Returns
void