Skip to content

textmode.js / converters / TextmodeFeatureConverter

Class: abstract TextmodeFeatureConverter

Abstract base class for all feature-based textmode converters like 'brightness'.

Extends

Extended by

Constructors

Constructor

ts
protected new TextmodeFeatureConverter(
   renderer, 
   fontManager, 
   grid, 
   options): TextmodeFeatureConverter;

Parameters

renderer

GLRenderer

fontManager

TextmodeFont

grid

TextmodeGrid

options

any = {}

Returns

TextmodeFeatureConverter

Overrides

ts
TextmodeConverter.constructor

Properties

_characterFramebuffer

ts
protected _characterFramebuffer: Framebuffer;

Inherited from

TextmodeConverter._characterFramebuffer


_options

ts
protected _options: any;

Inherited from

TextmodeConverter._options


_primaryColorFramebuffer

ts
protected _primaryColorFramebuffer: Framebuffer;

Inherited from

TextmodeConverter._primaryColorFramebuffer


_rotationFramebuffer

ts
protected _rotationFramebuffer: Framebuffer;

Inherited from

TextmodeConverter._rotationFramebuffer


_secondaryColorFramebuffer

ts
protected _secondaryColorFramebuffer: Framebuffer;

Inherited from

TextmodeConverter._secondaryColorFramebuffer


_transformFramebuffer

ts
protected _transformFramebuffer: Framebuffer;

Inherited from

TextmodeConverter._transformFramebuffer


fontManager

ts
protected fontManager: TextmodeFont;

Inherited from

TextmodeConverter.fontManager


grid

ts
protected grid: TextmodeGrid;

Inherited from

TextmodeConverter.grid


palette

ts
protected palette: ColorPalette;

renderer

ts
protected renderer: GLRenderer;

Inherited from

TextmodeConverter.renderer

Accessors

characterFramebuffer

Get Signature

ts
get characterFramebuffer(): Framebuffer;

Returns the framebuffer containing character data.

Returns

Framebuffer

Inherited from

TextmodeConverter.characterFramebuffer


options

Get Signature

ts
get options(): any;

Returns the renderer used by this converter.

Returns

any

Inherited from

TextmodeConverter.options


primaryColorFramebuffer

Get Signature

ts
get primaryColorFramebuffer(): Framebuffer;

Returns the framebuffer containing primary color data.

Returns

Framebuffer

Inherited from

TextmodeConverter.primaryColorFramebuffer


rotationFramebuffer

Get Signature

ts
get rotationFramebuffer(): Framebuffer;

Returns the framebuffer containing rotation data.

Returns

Framebuffer

Inherited from

TextmodeConverter.rotationFramebuffer


secondaryColorFramebuffer

Get Signature

ts
get secondaryColorFramebuffer(): Framebuffer;

Returns the framebuffer containing secondary color data.

Returns

Framebuffer

Inherited from

TextmodeConverter.secondaryColorFramebuffer


transformFramebuffer

Get Signature

ts
get transformFramebuffer(): Framebuffer;

Returns the framebuffer containing transformation data.

Returns

Framebuffer

Inherited from

TextmodeConverter.transformFramebuffer

Methods

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


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


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


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


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


disable()

ts
disable(): void;

Disables the converter.

Returns

void

Inherited from

TextmodeConverter.disable


enable()

ts
enable(): void;

Enables the converter.

Returns

void

Inherited from

TextmodeConverter.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

TextmodeConverter.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


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


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


rotation()

ts
rotation(angle): void;

Sets the rotation angle for the characters.

Parameters

angle

number

The rotation angle in degrees.

Returns

void