textmode.js 0.1.9-beta.5 → 0.1.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +14 -13
- package/dist/textmode.esm.js +1032 -1006
- package/dist/textmode.esm.min.js +952 -926
- package/dist/textmode.umd.js +14 -14
- package/dist/textmode.umd.min.js +16 -16
- package/dist/types/ColorPalette.d.ts +2 -5
- package/dist/types/export/txt/TXTDataExtractor.d.ts +3 -3
- package/dist/types/export/txt/types.d.ts +5 -3
- package/dist/types/index.d.ts +2 -1
- package/dist/types/rendering/core/Framebuffer.d.ts +140 -0
- package/dist/types/rendering/core/Shader.d.ts +59 -0
- package/dist/types/rendering/core/index.d.ts +2 -0
- package/dist/types/rendering/index.d.ts +3 -2
- package/dist/types/rendering/webgl/Framebuffer.d.ts +5 -20
- package/dist/types/rendering/webgl/Renderer.d.ts +9 -7
- package/dist/types/rendering/webgl/Shader.d.ts +23 -7
- package/dist/types/textmode/ConversionPipeline.d.ts +1 -1
- package/dist/types/textmode/Textmodifier.d.ts +4 -4
- package/dist/types/textmode/converters/BrightnessConverter.d.ts +25 -25
- package/dist/types/textmode/converters/Converter.d.ts +12 -5
- package/dist/types/textmode/converters/FeatureConverter.d.ts +27 -5
- package/dist/types/textmode/converters/index.d.ts +3 -3
- package/dist/types/textmode/font/TextmodeFont.d.ts +2 -2
- package/dist/types/textmode/font/TextureAtlas.d.ts +2 -2
- package/dist/types/textmode/font/utils/FontTableReader.d.ts +2 -7
- package/dist/types/textmode/mixins/RenderingMixin.d.ts +3 -3
- package/package.json +1 -1
- package/dist/types/rendering/core/AbstractFramebuffer.d.ts +0 -1
- package/dist/types/rendering/core/AbstractGeometry.d.ts +0 -1
- package/dist/types/rendering/core/AbstractShader.d.ts +0 -1
- package/dist/types/rendering/core/AbstractTexture.d.ts +0 -1
- package/dist/types/rendering/core/GraphicsContext.d.ts +0 -1
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Core shader abstractions for textmode.js rendering system.
|
|
3
|
+
* Provides base classes and interfaces for WebGL and future WebGPU shader implementations.
|
|
4
|
+
*/
|
|
5
|
+
import type { IFramebuffer } from './Framebuffer';
|
|
6
|
+
/**
|
|
7
|
+
* Supported uniform value types
|
|
8
|
+
*/
|
|
9
|
+
export type UniformValue = number | boolean | number[] | Float32Array | Int32Array | IFramebuffer;
|
|
10
|
+
/**
|
|
11
|
+
* Core interface that all shader implementations must satisfy.
|
|
12
|
+
* Defines the contract for shader programs across different graphics APIs.
|
|
13
|
+
* @ignore
|
|
14
|
+
*/
|
|
15
|
+
export interface IShader {
|
|
16
|
+
/** Whether the shader is currently compiled and ready to use */
|
|
17
|
+
readonly isReady: boolean;
|
|
18
|
+
/**
|
|
19
|
+
* Activate this shader for rendering.
|
|
20
|
+
* Makes this shader the active program for subsequent draw calls.
|
|
21
|
+
* @ignore
|
|
22
|
+
*/
|
|
23
|
+
$use(): void;
|
|
24
|
+
/**
|
|
25
|
+
* Set a uniform value by name.
|
|
26
|
+
* @param name Name of the uniform
|
|
27
|
+
* @param value Value to set
|
|
28
|
+
*/
|
|
29
|
+
setUniform(name: string, value: UniformValue): void;
|
|
30
|
+
/**
|
|
31
|
+
* Set multiple uniforms at once.
|
|
32
|
+
* @param uniforms Object containing uniform name-value pairs
|
|
33
|
+
*/
|
|
34
|
+
setUniforms(uniforms: Record<string, UniformValue>): void;
|
|
35
|
+
/**
|
|
36
|
+
* Reset internal state (texture units, etc.) for a new frame.
|
|
37
|
+
* @ignore
|
|
38
|
+
*/
|
|
39
|
+
$resetState(): void;
|
|
40
|
+
/**
|
|
41
|
+
* Dispose of resources used by this shader.
|
|
42
|
+
* After calling this method, the shader should not be used.
|
|
43
|
+
* @ignore
|
|
44
|
+
*/
|
|
45
|
+
$dispose(): void;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Abstract base class for shader implementations.
|
|
49
|
+
*/
|
|
50
|
+
export declare abstract class Shader implements IShader {
|
|
51
|
+
protected _isReady: boolean;
|
|
52
|
+
protected constructor();
|
|
53
|
+
get isReady(): boolean;
|
|
54
|
+
setUniforms(uniforms: Record<string, UniformValue>): void;
|
|
55
|
+
abstract $use(): void;
|
|
56
|
+
abstract setUniform(name: string, value: UniformValue): void;
|
|
57
|
+
abstract $resetState(): void;
|
|
58
|
+
abstract $dispose(): void;
|
|
59
|
+
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
-
export
|
|
1
|
+
export * from './core';
|
|
2
|
+
export { GLShader as Shader } from './webgl/Shader';
|
|
2
3
|
export { GLRenderer } from './webgl/Renderer';
|
|
3
|
-
export {
|
|
4
|
+
export { GLFramebuffer } from './webgl/Framebuffer';
|
|
@@ -1,26 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
filter?: 'nearest' | 'linear';
|
|
3
|
-
wrap?: 'clamp' | 'repeat';
|
|
4
|
-
format?: 'rgba' | 'rgb';
|
|
5
|
-
type?: 'unsigned_byte' | 'float';
|
|
6
|
-
}
|
|
7
|
-
/**
|
|
8
|
-
* Supported media sources for framebuffer textures
|
|
9
|
-
*/
|
|
10
|
-
export type MediaSource = HTMLCanvasElement | HTMLVideoElement;
|
|
1
|
+
import { Framebuffer, type FramebufferOptions } from '../core/Framebuffer';
|
|
11
2
|
/**
|
|
12
|
-
*
|
|
3
|
+
* WebGL implementation of the framebuffer abstraction.
|
|
4
|
+
* Provides GPU-accelerated render targets with automatic texture creation.
|
|
13
5
|
* Can also be used as a standalone texture (without render target functionality).
|
|
14
6
|
*/
|
|
15
|
-
export declare class Framebuffer {
|
|
7
|
+
export declare class GLFramebuffer extends Framebuffer {
|
|
16
8
|
private _gl;
|
|
17
9
|
private _framebuffer;
|
|
18
10
|
private _texture;
|
|
19
|
-
private _width;
|
|
20
|
-
private _height;
|
|
21
|
-
private _options;
|
|
22
11
|
private _previousState;
|
|
23
|
-
private _pixels;
|
|
24
12
|
constructor(gl: WebGLRenderingContext, width: number, height?: number, options?: FramebufferOptions);
|
|
25
13
|
/**
|
|
26
14
|
* Execute a function with this framebuffer bound, then restore previous binding
|
|
@@ -32,7 +20,7 @@ export declare class Framebuffer {
|
|
|
32
20
|
/**
|
|
33
21
|
* Update the framebuffer texture with canvas or video content
|
|
34
22
|
*/
|
|
35
|
-
update(source:
|
|
23
|
+
$update(source: HTMLCanvasElement | HTMLVideoElement): void;
|
|
36
24
|
/**
|
|
37
25
|
* Update the framebuffer texture with pixel data
|
|
38
26
|
*/
|
|
@@ -78,7 +66,4 @@ export declare class Framebuffer {
|
|
|
78
66
|
$dispose(): void;
|
|
79
67
|
get framebuffer(): WebGLFramebuffer | null;
|
|
80
68
|
get texture(): WebGLTexture;
|
|
81
|
-
get width(): number;
|
|
82
|
-
get height(): number;
|
|
83
|
-
get pixels(): Uint8Array | null;
|
|
84
69
|
}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { GLFramebuffer } from "./Framebuffer";
|
|
2
|
+
import type { Framebuffer, FramebufferOptions } from '../core/Framebuffer';
|
|
3
|
+
import { GLShader } from "./Shader";
|
|
4
|
+
import type { UniformValue } from "../core";
|
|
3
5
|
/**
|
|
4
6
|
* Core WebGL renderer that manages the WebGL context and provides high-level rendering operations
|
|
5
7
|
*/
|
|
@@ -21,7 +23,7 @@ export declare class GLRenderer {
|
|
|
21
23
|
/**
|
|
22
24
|
* Set the current shader
|
|
23
25
|
*/
|
|
24
|
-
$shader(shader:
|
|
26
|
+
$shader(shader: GLShader): void;
|
|
25
27
|
/**
|
|
26
28
|
* Sets the fill color for subsequent rendering operations
|
|
27
29
|
* @param r Red component *(0-255)*
|
|
@@ -76,12 +78,12 @@ export declare class GLRenderer {
|
|
|
76
78
|
* @returns true if WebGL2, false if WebGL1
|
|
77
79
|
*/
|
|
78
80
|
private _detectShaderVersion;
|
|
79
|
-
$createShader(vertexSource: string, fragmentSource: string):
|
|
80
|
-
$createFilterShader(fragmentSource: string):
|
|
81
|
+
$createShader(vertexSource: string, fragmentSource: string): GLShader;
|
|
82
|
+
$createFilterShader(fragmentSource: string): GLShader;
|
|
81
83
|
/**
|
|
82
84
|
* Set a uniform value for the current shader
|
|
83
85
|
*/
|
|
84
|
-
$setUniform(name: string, value:
|
|
86
|
+
$setUniform(name: string, value: UniformValue): void;
|
|
85
87
|
/**
|
|
86
88
|
* Draw a rectangle with the current fill and/or stroke settings
|
|
87
89
|
*/
|
|
@@ -102,7 +104,7 @@ export declare class GLRenderer {
|
|
|
102
104
|
/**
|
|
103
105
|
* Create a new framebuffer
|
|
104
106
|
*/
|
|
105
|
-
$createFramebuffer(width: number, height: number, options?: FramebufferOptions):
|
|
107
|
+
$createFramebuffer(width: number, height: number, options?: FramebufferOptions): GLFramebuffer;
|
|
106
108
|
/**
|
|
107
109
|
* Fill the current framebuffer with a solid color
|
|
108
110
|
*/
|
|
@@ -1,14 +1,30 @@
|
|
|
1
|
+
import { Shader, type UniformValue } from '../core/Shader';
|
|
1
2
|
/**
|
|
2
|
-
*
|
|
3
|
+
* WebGL implementation of the shader abstraction.
|
|
4
|
+
* Provides GPU shader program management with automatic uniform handling.
|
|
3
5
|
*/
|
|
4
|
-
export declare class Shader {
|
|
6
|
+
export declare class GLShader extends Shader {
|
|
5
7
|
private _gl;
|
|
6
8
|
private _program;
|
|
7
9
|
private _uniformLocations;
|
|
8
10
|
private _uniformTypes;
|
|
9
11
|
private _textureUnitCounter;
|
|
10
12
|
private _maxTextureUnits;
|
|
13
|
+
/**
|
|
14
|
+
* Creates a new GLShader instance.
|
|
15
|
+
* @param gl The WebGL rendering context.
|
|
16
|
+
* @param vertexSource The source code for the vertex shader.
|
|
17
|
+
* @param fragmentSource The source code for the fragment shader.
|
|
18
|
+
* @ignore
|
|
19
|
+
*/
|
|
11
20
|
constructor(gl: WebGLRenderingContext, vertexSource: string, fragmentSource: string);
|
|
21
|
+
/**
|
|
22
|
+
* Factory method to create a shader from source object
|
|
23
|
+
*/
|
|
24
|
+
static fromSource(gl: WebGLRenderingContext, source: {
|
|
25
|
+
vertex: string;
|
|
26
|
+
fragment: string;
|
|
27
|
+
}): GLShader;
|
|
12
28
|
private _cacheLocations;
|
|
13
29
|
private _createProgram;
|
|
14
30
|
private _createShader;
|
|
@@ -16,10 +32,14 @@ export declare class Shader {
|
|
|
16
32
|
* Use this shader program
|
|
17
33
|
*/
|
|
18
34
|
$use(): void;
|
|
35
|
+
/**
|
|
36
|
+
* Reset texture unit counter and other state
|
|
37
|
+
*/
|
|
38
|
+
$resetState(): void;
|
|
19
39
|
/**
|
|
20
40
|
* Set a single uniform value with automatic texture unit management
|
|
21
41
|
*/
|
|
22
|
-
setUniform(name: string, value:
|
|
42
|
+
setUniform(name: string, value: UniformValue): void;
|
|
23
43
|
private _getNextTextureUnit;
|
|
24
44
|
/**
|
|
25
45
|
* Check if a uniform is an integer type
|
|
@@ -34,8 +54,4 @@ export declare class Shader {
|
|
|
34
54
|
* This method is idempotent and safe to call multiple times.
|
|
35
55
|
*/
|
|
36
56
|
$dispose(): void;
|
|
37
|
-
/**
|
|
38
|
-
* Reset texture unit counter (useful when starting a new frame)
|
|
39
|
-
*/
|
|
40
|
-
private _resetTextureUnits;
|
|
41
57
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Framebuffer } from "../rendering/
|
|
1
|
+
import type { Framebuffer } from "../rendering/core/Framebuffer";
|
|
2
2
|
import type { GLRenderer } from "../rendering/webgl/Renderer";
|
|
3
3
|
import { TextmodeBrightnessConverter, TextmodeConverter } from "./converters";
|
|
4
4
|
import type { TextmodeFont } from "./font";
|
|
@@ -21,15 +21,15 @@ export type TextmodeOptions = {
|
|
|
21
21
|
fontSize?: number;
|
|
22
22
|
/**
|
|
23
23
|
* Automatic rendering mode. Defaults to 'auto'.
|
|
24
|
-
* - 'manual'
|
|
25
|
-
* - 'auto'
|
|
24
|
+
* - `'manual'`: Requires manual `render()` calls
|
|
25
|
+
* - `'auto'`: Automatically renders using [requestAnimationFrame](https://developer.mozilla.org/en-US/docs/Web/API/window/requestAnimationFrame)
|
|
26
26
|
*/
|
|
27
27
|
renderMode?: 'manual' | 'auto';
|
|
28
28
|
/** Maximum frames per second for auto rendering. Defaults to 60. */
|
|
29
29
|
frameRate?: number;
|
|
30
|
-
/** The width of the canvas in standalone mode. Defaults to 800. */
|
|
30
|
+
/** The width of the canvas in `standalone` mode. Defaults to 800. */
|
|
31
31
|
width?: number;
|
|
32
|
-
/** The height of the canvas in standalone mode. Defaults to 600. */
|
|
32
|
+
/** The height of the canvas in `standalone` mode. Defaults to 600. */
|
|
33
33
|
height?: number;
|
|
34
34
|
/**
|
|
35
35
|
* URL or path to a custom font file *(.otf/.ttf)*.
|
|
@@ -1,36 +1,36 @@
|
|
|
1
1
|
import { GLRenderer } from "../../rendering/webgl/Renderer";
|
|
2
|
-
import { Framebuffer } from "../../rendering/webgl/Framebuffer";
|
|
3
2
|
import { TextmodeFont } from "../font";
|
|
4
3
|
import { TextmodeGrid } from "../Grid";
|
|
5
|
-
import { TextmodeFeatureConverter } from "./FeatureConverter";
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
/** Color of the ASCII characters. Only used when `characterColorMode` is set to `fixed` */
|
|
12
|
-
characterColor: number[];
|
|
13
|
-
/** Character color mode */
|
|
14
|
-
characterColorMode: string;
|
|
15
|
-
/** Cell background color. Only used when `characterColorMode` is set to `fixed` */
|
|
16
|
-
cellColor: number[];
|
|
17
|
-
/** Background color mode */
|
|
18
|
-
cellColorMode: string;
|
|
19
|
-
/** Swap the cells ASCII character colors with it's cell background colors */
|
|
20
|
-
invert: boolean;
|
|
21
|
-
/** Rotation angle of all characters in the grid in degrees */
|
|
22
|
-
rotation: number[];
|
|
23
|
-
/** Flip the ASCII characters horizontally */
|
|
24
|
-
flipHorizontally: boolean;
|
|
25
|
-
/** Flip the ASCII characters vertically */
|
|
26
|
-
flipVertically: boolean;
|
|
4
|
+
import { TextmodeFeatureConverter, type TextmodeFeatureConverterOptions } from "./FeatureConverter";
|
|
5
|
+
import type { Framebuffer } from "../../rendering";
|
|
6
|
+
/**
|
|
7
|
+
* Options interface for the brightness converter.
|
|
8
|
+
*/
|
|
9
|
+
export interface TextmodeBrightnessConverterOptions extends TextmodeFeatureConverterOptions {
|
|
27
10
|
/** Range of brightness values to map to ASCII characters */
|
|
28
11
|
brightnessRange: [number, number];
|
|
29
|
-
}
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Default brightness converter options used when no options are specified.
|
|
15
|
+
*
|
|
16
|
+
* **Default values:**
|
|
17
|
+
* - `enabled`: `true` - Enable the brightness converter
|
|
18
|
+
* - `characters`: `" .:-=+*%@#"` - Character set for brightness mapping *(from darkest to brightest)*
|
|
19
|
+
* - `characterColor`: `#FFFFFF` - White color for ASCII characters *(only used when `characterColorMode` is `'fixed'`)*
|
|
20
|
+
* - `characterColorMode`: `'sampled'` - Sample character colors from source texture
|
|
21
|
+
* - `cellColor`: `#000000` - Black background color for cells *(only used when `cellColorMode` is `'fixed'`)*
|
|
22
|
+
* - `cellColorMode`: `'fixed'` - Use fixed background color for all cells
|
|
23
|
+
* - `invert`: `false` - Don't swap character and background colors
|
|
24
|
+
* - `rotation`: `0` - No rotation applied to characters
|
|
25
|
+
* - `flipHorizontally`: `false` - Don't flip characters horizontally
|
|
26
|
+
* - `flipVertically`: `false` - Don't flip characters vertically
|
|
27
|
+
* - `brightnessRange`: `[0, 255]` - Full brightness range for character mapping
|
|
28
|
+
*/
|
|
29
|
+
export declare const BRIGHTNESS_DEFAULT_OPTIONS: TextmodeBrightnessConverterOptions;
|
|
30
30
|
/**
|
|
31
31
|
* Converter that maps brightness values from a source texture to ASCII characters.
|
|
32
32
|
*/
|
|
33
|
-
export declare class TextmodeBrightnessConverter extends TextmodeFeatureConverter {
|
|
33
|
+
export declare class TextmodeBrightnessConverter extends TextmodeFeatureConverter<TextmodeBrightnessConverterOptions> {
|
|
34
34
|
private _sampleShader;
|
|
35
35
|
private _colorFillShader;
|
|
36
36
|
private _charMappingShader;
|
|
@@ -1,11 +1,18 @@
|
|
|
1
1
|
import type { TextmodeFont } from "../font";
|
|
2
|
-
import type { Framebuffer } from "../../rendering/webgl/Framebuffer";
|
|
3
2
|
import type { GLRenderer } from "../../rendering/webgl/Renderer";
|
|
4
3
|
import type { TextmodeGrid } from "../Grid";
|
|
4
|
+
import type { Framebuffer } from "../../rendering";
|
|
5
|
+
/**
|
|
6
|
+
* Base options interface for all textmode converters.
|
|
7
|
+
*/
|
|
8
|
+
export interface TextmodeConverterOptions {
|
|
9
|
+
/** Enable/disable the converter */
|
|
10
|
+
enabled: boolean;
|
|
11
|
+
}
|
|
5
12
|
/**
|
|
6
13
|
* Base class for all textmode converters.
|
|
7
14
|
*/
|
|
8
|
-
export declare class TextmodeConverter {
|
|
15
|
+
export declare class TextmodeConverter<TOptions extends TextmodeConverterOptions = TextmodeConverterOptions> {
|
|
9
16
|
protected _renderer: GLRenderer;
|
|
10
17
|
protected _fontManager: TextmodeFont;
|
|
11
18
|
protected _grid: TextmodeGrid;
|
|
@@ -14,7 +21,7 @@ export declare class TextmodeConverter {
|
|
|
14
21
|
protected _secondaryColorFramebuffer: Framebuffer;
|
|
15
22
|
protected _rotationFramebuffer: Framebuffer;
|
|
16
23
|
protected _transformFramebuffer: Framebuffer;
|
|
17
|
-
protected _options:
|
|
24
|
+
protected _options: TOptions;
|
|
18
25
|
/**
|
|
19
26
|
* Creates a new TextmodeConverter instance.
|
|
20
27
|
* @param renderer Renderer instance for texture creation
|
|
@@ -23,7 +30,7 @@ export declare class TextmodeConverter {
|
|
|
23
30
|
* @param options Additional options for the converter
|
|
24
31
|
* @ignore
|
|
25
32
|
*/
|
|
26
|
-
constructor(renderer: GLRenderer, fontManager: TextmodeFont, grid: TextmodeGrid, options?:
|
|
33
|
+
constructor(renderer: GLRenderer, fontManager: TextmodeFont, grid: TextmodeGrid, options?: Partial<TOptions>);
|
|
27
34
|
/**
|
|
28
35
|
* Resizes all internal framebuffers to match the grid dimensions.
|
|
29
36
|
* @ignore
|
|
@@ -58,5 +65,5 @@ export declare class TextmodeConverter {
|
|
|
58
65
|
/** Returns the framebuffer containing transformation data. */
|
|
59
66
|
get transformFramebuffer(): Framebuffer;
|
|
60
67
|
/** Returns the defined options for this converter. */
|
|
61
|
-
get options():
|
|
68
|
+
get options(): TOptions;
|
|
62
69
|
}
|
|
@@ -2,14 +2,37 @@ import { TextmodeColorPalette } from "../../ColorPalette";
|
|
|
2
2
|
import type { TextmodeFont } from "../font";
|
|
3
3
|
import type { GLRenderer } from "../../rendering/webgl/Renderer";
|
|
4
4
|
import type { TextmodeGrid } from "../Grid";
|
|
5
|
-
import { TextmodeConverter } from "./Converter";
|
|
6
|
-
import type { Framebuffer } from "../../rendering
|
|
5
|
+
import { TextmodeConverter, type TextmodeConverterOptions } from "./Converter";
|
|
6
|
+
import type { Framebuffer } from "../../rendering";
|
|
7
|
+
/**
|
|
8
|
+
* Options interface for feature-based textmode converters.
|
|
9
|
+
*/
|
|
10
|
+
export interface TextmodeFeatureConverterOptions extends TextmodeConverterOptions {
|
|
11
|
+
/** Characters used for mapping, usually ordered from least dense to most dense */
|
|
12
|
+
characters: string;
|
|
13
|
+
/** Color of the characters. Only used when `characterColorMode` is set to `'fixed'` */
|
|
14
|
+
characterColor: [number, number, number, number];
|
|
15
|
+
/** Character color mode */
|
|
16
|
+
characterColorMode: "sampled" | "fixed";
|
|
17
|
+
/** Cell background color. Only used when `cellColorMode` is set to `'fixed'` */
|
|
18
|
+
cellColor: [number, number, number, number];
|
|
19
|
+
/** Background color mode */
|
|
20
|
+
cellColorMode: "sampled" | "fixed";
|
|
21
|
+
/** Swap the character and cell colors */
|
|
22
|
+
invert: boolean;
|
|
23
|
+
/** Rotation angle stored as RGBA where RGB encodes the rotation and A is always 1 */
|
|
24
|
+
rotation: [number, number, number, number];
|
|
25
|
+
/** Flip the characters horizontally */
|
|
26
|
+
flipHorizontally: boolean;
|
|
27
|
+
/** Flip the characters vertically */
|
|
28
|
+
flipVertically: boolean;
|
|
29
|
+
}
|
|
7
30
|
/**
|
|
8
31
|
* Abstract base class for all feature-based textmode converters like `'brightness'`.
|
|
9
32
|
*/
|
|
10
|
-
export declare abstract class TextmodeFeatureConverter extends TextmodeConverter {
|
|
33
|
+
export declare abstract class TextmodeFeatureConverter<TOptions extends TextmodeFeatureConverterOptions = TextmodeFeatureConverterOptions> extends TextmodeConverter<TOptions> {
|
|
11
34
|
protected _palette: TextmodeColorPalette;
|
|
12
|
-
protected constructor(renderer: GLRenderer, fontManager: TextmodeFont, grid: TextmodeGrid, options?:
|
|
35
|
+
protected constructor(renderer: GLRenderer, fontManager: TextmodeFont, grid: TextmodeGrid, options?: Partial<TOptions>);
|
|
13
36
|
/**
|
|
14
37
|
* Converts the source framebuffer to the target format.
|
|
15
38
|
* @param sourceFramebuffer The source framebuffer to convert.
|
|
@@ -87,7 +110,6 @@ export declare abstract class TextmodeFeatureConverter extends TextmodeConverter
|
|
|
87
110
|
* Helper method to set color mode with validation.
|
|
88
111
|
* @param mode The color mode to set.
|
|
89
112
|
* @param optionKey The option key to set in _options.
|
|
90
|
-
* @param errorMessage The error message to show if validation fails.
|
|
91
113
|
*/
|
|
92
114
|
private _setColorMode;
|
|
93
115
|
/**
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export { TextmodeConverter } from './Converter';
|
|
2
|
-
export { TextmodeFeatureConverter } from './FeatureConverter';
|
|
3
|
-
export { TextmodeBrightnessConverter } from './BrightnessConverter';
|
|
1
|
+
export { TextmodeConverter, type TextmodeConverterOptions } from './Converter';
|
|
2
|
+
export { TextmodeFeatureConverter, type TextmodeFeatureConverterOptions } from './FeatureConverter';
|
|
3
|
+
export { TextmodeBrightnessConverter, type TextmodeBrightnessConverterOptions, BRIGHTNESS_DEFAULT_OPTIONS } from './BrightnessConverter';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { GLRenderer } from '../../rendering/webgl/Renderer.ts';
|
|
2
|
-
import type {
|
|
2
|
+
import type { GLFramebuffer } from '../../rendering/webgl/Framebuffer.ts';
|
|
3
3
|
import type { TextmodeCharacter } from './types.ts';
|
|
4
4
|
import type { TyprFont } from './typr/types.ts';
|
|
5
5
|
/**
|
|
@@ -86,7 +86,7 @@ export declare class TextmodeFont {
|
|
|
86
86
|
* Returns the WebGL framebuffer containing the font texture atlas.
|
|
87
87
|
* @ignore
|
|
88
88
|
*/
|
|
89
|
-
get fontFramebuffer():
|
|
89
|
+
get fontFramebuffer(): GLFramebuffer;
|
|
90
90
|
/** Returns the array of {@link TextmodeCharacter} objects in the font. */
|
|
91
91
|
get characters(): TextmodeCharacter[];
|
|
92
92
|
/** Returns the number of columns in the texture atlas. */
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { TextmodeCharacter, GlyphDimensions } from './types.ts';
|
|
2
2
|
import type { GLRenderer } from '../../rendering/webgl/Renderer.ts';
|
|
3
|
-
import type {
|
|
3
|
+
import type { GLFramebuffer } from '../../rendering/webgl/Framebuffer.ts';
|
|
4
4
|
import type { TyprFont } from './typr/types.ts';
|
|
5
5
|
/**
|
|
6
6
|
* Handles creation of texture atlases for font rendering.
|
|
@@ -27,7 +27,7 @@ export declare class TextureAtlasCreation {
|
|
|
27
27
|
* @returns Object containing framebuffer, columns, and rows
|
|
28
28
|
*/
|
|
29
29
|
createTextureAtlas(characters: TextmodeCharacter[], maxGlyphDimensions: GlyphDimensions, fontSize: number, fontDataOrFamilyName: TyprFont | string): {
|
|
30
|
-
framebuffer:
|
|
30
|
+
framebuffer: GLFramebuffer;
|
|
31
31
|
columns: number;
|
|
32
32
|
rows: number;
|
|
33
33
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { TyprFont
|
|
1
|
+
import type { TyprFont } from '../typr/types.ts';
|
|
2
2
|
/**
|
|
3
3
|
* Centralized font table reader that eliminates redundant font data access.
|
|
4
4
|
* Provides cached access to font tables and metrics with consistent error handling.
|
|
@@ -6,14 +6,9 @@ import type { TyprFont, CmapTable } from '../typr/types.ts';
|
|
|
6
6
|
export declare class FontTableReader {
|
|
7
7
|
private _glyphIndexCache;
|
|
8
8
|
private _cmapTableCache;
|
|
9
|
-
/**
|
|
10
|
-
* Gets the best character mapping table for Unicode text.
|
|
11
|
-
* Prefers format 4 (BMP Unicode) or format 12 (full Unicode).
|
|
12
|
-
* Results are cached per font.
|
|
13
|
-
*/
|
|
14
|
-
$getBestCmapTable(font: TyprFont): CmapTable | null;
|
|
15
9
|
/**
|
|
16
10
|
* Gets the glyph index for a given Unicode code point.
|
|
11
|
+
* Searches through all available cmap tables to find the character.
|
|
17
12
|
* Results are cached per font and character.
|
|
18
13
|
*/
|
|
19
14
|
$getGlyphIndex(font: TyprFont, codePoint: number): number;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Mixin } from './TextmodifierMixin';
|
|
2
|
-
import type { Framebuffer, Shader } from '../../rendering';
|
|
3
|
-
import type { FramebufferOptions } from '../../rendering/
|
|
2
|
+
import type { Framebuffer, Shader, UniformValue } from '../../rendering';
|
|
3
|
+
import type { FramebufferOptions } from '../../rendering/core/Framebuffer';
|
|
4
4
|
/**
|
|
5
5
|
* Interface for rendering capabilities that will be mixed into Textmodifier
|
|
6
6
|
*/
|
|
@@ -401,7 +401,7 @@ export interface RenderingCapabilities {
|
|
|
401
401
|
* @param name The name of the uniform variable to set.
|
|
402
402
|
* @param value The value to set for the uniform variable.
|
|
403
403
|
*/
|
|
404
|
-
setUniform(name: string, value:
|
|
404
|
+
setUniform(name: string, value: UniformValue): void;
|
|
405
405
|
/**
|
|
406
406
|
* Draw an image to the canvas.
|
|
407
407
|
* @param source The image source
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|