Skip to content

textmode.js / converters / TextmodeBrightnessConverter

Class: TextmodeBrightnessConverter

Converter that maps brightness values from a source texture to ASCII characters.

Extends

Properties

_characterFramebuffer

ts
protected _characterFramebuffer: Framebuffer;

Inherited from

TextmodeFeatureConverter._characterFramebuffer


_options

ts
protected _options: any;

Inherited from

TextmodeFeatureConverter._options


_primaryColorFramebuffer

ts
protected _primaryColorFramebuffer: Framebuffer;

Inherited from

TextmodeFeatureConverter._primaryColorFramebuffer


_rotationFramebuffer

ts
protected _rotationFramebuffer: Framebuffer;

Inherited from

TextmodeFeatureConverter._rotationFramebuffer


_secondaryColorFramebuffer

ts
protected _secondaryColorFramebuffer: Framebuffer;

Inherited from

TextmodeFeatureConverter._secondaryColorFramebuffer


_transformFramebuffer

ts
protected _transformFramebuffer: Framebuffer;

Inherited from

TextmodeFeatureConverter._transformFramebuffer


fontManager

ts
protected fontManager: TextmodeFont;

Inherited from

TextmodeFeatureConverter.fontManager


grid

ts
protected grid: TextmodeGrid;

Inherited from

TextmodeFeatureConverter.grid


palette

ts
protected palette: ColorPalette;

Inherited from

TextmodeFeatureConverter.palette


renderer

ts
protected renderer: GLRenderer;

Inherited from

TextmodeFeatureConverter.renderer

Accessors

characterFramebuffer

Get Signature

ts
get characterFramebuffer(): Framebuffer;

Returns the framebuffer containing character data.

Returns

Framebuffer

Inherited from

TextmodeFeatureConverter.characterFramebuffer


options

Get Signature

ts
get options(): any;

Returns the renderer used by this converter.

Returns

any

Inherited from

TextmodeFeatureConverter.options


primaryColorFramebuffer

Get Signature

ts
get primaryColorFramebuffer(): Framebuffer;

Returns the framebuffer containing primary color data.

Returns

Framebuffer

Inherited from

TextmodeFeatureConverter.primaryColorFramebuffer


rotationFramebuffer

Get Signature

ts
get rotationFramebuffer(): Framebuffer;

Returns the framebuffer containing rotation data.

Returns

Framebuffer

Inherited from

TextmodeFeatureConverter.rotationFramebuffer


secondaryColorFramebuffer

Get Signature

ts
get secondaryColorFramebuffer(): Framebuffer;

Returns the framebuffer containing secondary color data.

Returns

Framebuffer

Inherited from

TextmodeFeatureConverter.secondaryColorFramebuffer


transformFramebuffer

Get Signature

ts
get transformFramebuffer(): Framebuffer;

Returns the framebuffer containing transformation data.

Returns

Framebuffer

Inherited from

TextmodeFeatureConverter.transformFramebuffer

Methods

brightnessRange()

ts
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()

ts
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()

ts
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()

ts
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()

ts
characterColorMode(mode): void;

Sets the character color mode.

  • 'sampled': Uses sampled colors from the source texture.
  • 'fixed': Uses a fixed color set by characterColor().

Parameters

mode

The color mode to use for characters.

"sampled" | "fixed"

Returns

void

Inherited from

TextmodeFeatureConverter.characterColorMode


characters()

ts
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()

ts
disable(): void;

Disables the converter.

Returns

void

Inherited from

TextmodeFeatureConverter.disable


enable()

ts
enable(): void;

Enables the converter.

Returns

void

Inherited from

TextmodeFeatureConverter.enable


enabled()

ts
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()

ts
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()

ts
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()

ts
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()

ts
rotation(angle): void;

Sets the rotation angle for the characters.

Parameters

angle

number

The rotation angle in degrees.

Returns

void

Inherited from

TextmodeFeatureConverter.rotation