textmode.js 0.1.9 → 0.2.0-beta.2

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.
Files changed (63) hide show
  1. package/README.md +4 -4
  2. package/dist/textmode.esm.js +1418 -1481
  3. package/dist/textmode.esm.min.js +1500 -1563
  4. package/dist/textmode.umd.js +19 -56
  5. package/dist/textmode.umd.min.js +20 -57
  6. package/dist/types/Textmode.d.ts +10 -38
  7. package/dist/types/export/base/DataExtractor.d.ts +3 -3
  8. package/dist/types/export/image/ImageExporter.d.ts +4 -11
  9. package/dist/types/export/image/types.d.ts +2 -3
  10. package/dist/types/export/svg/SVGExporter.d.ts +1 -1
  11. package/dist/types/export/svg/types.d.ts +1 -0
  12. package/dist/types/export/txt/TXTExporter.d.ts +1 -1
  13. package/dist/types/export/txt/types.d.ts +2 -2
  14. package/dist/types/index.d.ts +1 -7
  15. package/dist/types/rendering/index.d.ts +0 -1
  16. package/dist/types/rendering/webgl/DrawQueue.d.ts +26 -0
  17. package/dist/types/rendering/webgl/Framebuffer.d.ts +41 -40
  18. package/dist/types/rendering/webgl/InstanceBatch.d.ts +91 -0
  19. package/dist/types/rendering/webgl/InstanceData.d.ts +65 -0
  20. package/dist/types/rendering/webgl/RenderPipeline.d.ts +15 -0
  21. package/dist/types/rendering/webgl/RenderState.d.ts +71 -0
  22. package/dist/types/rendering/webgl/Renderer.d.ts +54 -81
  23. package/dist/types/rendering/webgl/Shader.d.ts +11 -16
  24. package/dist/types/rendering/webgl/VAOManager.d.ts +15 -0
  25. package/dist/types/rendering/webgl/geometries/Arc.d.ts +16 -0
  26. package/dist/types/rendering/webgl/geometries/BaseGeometry.d.ts +35 -29
  27. package/dist/types/rendering/webgl/geometries/BezierCurve.d.ts +22 -0
  28. package/dist/types/rendering/webgl/geometries/Ellipse.d.ts +20 -0
  29. package/dist/types/rendering/webgl/geometries/Line.d.ts +13 -4
  30. package/dist/types/rendering/webgl/geometries/Rectangle.d.ts +13 -8
  31. package/dist/types/rendering/webgl/geometries/Triangle.d.ts +20 -0
  32. package/dist/types/rendering/webgl/geometries/index.d.ts +4 -1
  33. package/dist/types/rendering/webgl/index.d.ts +17 -1
  34. package/dist/types/rendering/webgl/types/DrawCommand.d.ts +9 -0
  35. package/dist/types/rendering/webgl/types/GeometryTypes.d.ts +144 -0
  36. package/dist/types/rendering/webgl/types/RenderTypes.d.ts +12 -0
  37. package/dist/types/textmode/AnimationController.d.ts +81 -0
  38. package/dist/types/textmode/Canvas.d.ts +18 -19
  39. package/dist/types/textmode/Grid.d.ts +1 -34
  40. package/dist/types/textmode/Textmodifier.d.ts +36 -277
  41. package/dist/types/textmode/font/CharacterColorMapper.d.ts +3 -3
  42. package/dist/types/textmode/font/TextmodeFont.d.ts +6 -11
  43. package/dist/types/textmode/font/types.d.ts +1 -1
  44. package/dist/types/textmode/font/typr/types.d.ts +1 -1
  45. package/dist/types/textmode/font/utils/index.d.ts +0 -1
  46. package/dist/types/textmode/mixins/AnimationMixin.d.ts +120 -0
  47. package/dist/types/textmode/mixins/ExportMixin.d.ts +4 -6
  48. package/dist/types/textmode/mixins/FontMixin.d.ts +4 -10
  49. package/dist/types/textmode/mixins/RenderingMixin.d.ts +224 -246
  50. package/dist/types/textmode/mixins/TextmodifierMixin.d.ts +13 -4
  51. package/dist/types/textmode/mixins/index.d.ts +2 -2
  52. package/package.json +1 -1
  53. package/dist/types/ColorPalette.d.ts +0 -35
  54. package/dist/types/rendering/core/Framebuffer.d.ts +0 -140
  55. package/dist/types/rendering/core/Shader.d.ts +0 -59
  56. package/dist/types/rendering/core/index.d.ts +0 -2
  57. package/dist/types/textmode/ConversionPipeline.d.ts +0 -110
  58. package/dist/types/textmode/converters/BrightnessConverter.d.ts +0 -58
  59. package/dist/types/textmode/converters/Converter.d.ts +0 -69
  60. package/dist/types/textmode/converters/FeatureConverter.d.ts +0 -128
  61. package/dist/types/textmode/converters/index.d.ts +0 -3
  62. package/dist/types/textmode/font/utils/FontConstants.d.ts +0 -60
  63. package/dist/types/textmode/mixins/ConversionMixin.d.ts +0 -62
@@ -0,0 +1,15 @@
1
+ /**
2
+ * Minimal VAO manager that caches unit-geometry attribute setup per (program, geometry type).
3
+ * It binds only non-instanced attributes (a_position, a_texCoord). Instanced attributes are
4
+ * still configured by InstanceBatch per draw to keep buffers flexible.
5
+ */
6
+ import type { UnitGeometryData } from './types/GeometryTypes';
7
+ export declare class VAOManager {
8
+ private readonly _gl;
9
+ private readonly _cache;
10
+ constructor(gl: WebGL2RenderingContext);
11
+ /** Bind or create a VAO for the given program and geometry key. */
12
+ $bind(program: WebGLProgram, geometryKey: string, unit: UnitGeometryData, geometryBuffer: WebGLBuffer): void;
13
+ $unbind(): void;
14
+ $dispose(): void;
15
+ }
@@ -0,0 +1,16 @@
1
+ /**
2
+ * Instanced arc (pie segment) geometry implementation
3
+ */
4
+ import type { InstanceBatch } from '../InstanceBatch';
5
+ import { type ArcParams } from '../types/GeometryTypes';
6
+ import { BaseGeometry } from './BaseGeometry';
7
+ /**
8
+ * Instanced arc geometry renderer.
9
+ * Batches arc draw calls using a unit triangle fan scaled to width/height.
10
+ * Angles are specified in DEGREES by the API, converted to radians here.
11
+ */
12
+ export declare class Arc extends BaseGeometry {
13
+ constructor(gl: WebGL2RenderingContext, batch: InstanceBatch);
14
+ /** Add an arc instance (filled pie segment) */
15
+ $addInstance(params: ArcParams, renderState: any): number;
16
+ }
@@ -1,40 +1,46 @@
1
1
  /**
2
- * Base class for WebGL geometry rendering with shared vertex buffer management
2
+ * Base class for instanced geometry implementations
3
3
  */
4
- export declare abstract class BaseGeometry {
5
- protected _gl: WebGLRenderingContext;
6
- protected _unitBuffer: WebGLBuffer | null;
7
- protected _bytesPerVertex: number;
8
- private _attribCache;
9
- constructor(gl: WebGLRenderingContext);
10
- /**
11
- * Ensure the unit buffer is created and bound
12
- */
13
- protected _ensureUnitBuffer(): void;
14
- /**
15
- * Enable vertex attributes and return their locations
16
- */
17
- protected _enableAttribs(): {
18
- positionLoc: number;
19
- texLoc: number;
20
- };
4
+ import type { InstanceBatch } from '../InstanceBatch';
5
+ import type { InstanceData } from '../InstanceData';
6
+ import type { IGeometry, GeometryType, UnitGeometryData } from '../types/GeometryTypes';
7
+ /**
8
+ * Abstract base class for all instanced geometries.
9
+ * Provides common functionality for instance data creation and batch management.
10
+ */
11
+ export declare abstract class BaseGeometry implements IGeometry {
12
+ protected readonly _gl: WebGL2RenderingContext;
13
+ protected readonly _batch: InstanceBatch;
14
+ protected readonly _type: GeometryType;
15
+ protected readonly _unitGeometry: UnitGeometryData;
16
+ private _unitBuffer;
17
+ constructor(gl: WebGL2RenderingContext, batch: InstanceBatch, type: GeometryType, unitGeometry: UnitGeometryData);
18
+ get type(): GeometryType;
19
+ get unitGeometry(): UnitGeometryData;
20
+ get unitBuffer(): WebGLBuffer;
21
+ get batch(): InstanceBatch;
22
+ $clearInstances(): void;
23
+ $hasInstances(): boolean;
24
+ $dispose(): void;
25
+ abstract $addInstance(params: any, renderState: any): number;
21
26
  /**
22
- * Disable vertex attributes
27
+ * Create base instance data from render state.
28
+ * This method handles the common instance data creation logic.
29
+ * Subclasses can override this to add geometry-specific data.
23
30
  */
24
- protected _disableAttribs(positionLoc: number, texLoc: number): void;
31
+ protected _createBaseInstanceData(x: number, y: number, width: number, height: number, renderState: any): InstanceData;
25
32
  /**
26
- * Convert screen coordinates to NDC (Normalized Device Coordinates)
33
+ * Convert screen coordinates to NDC for compatibility with existing code
27
34
  */
28
35
  protected _toNDC(x: number, y: number): {
29
36
  nx: number;
30
37
  ny: number;
31
38
  };
32
- /**
33
- * Upload quad vertices to the buffer in NDC coordinates
34
- */
35
- protected _uploadQuadNDC(x1: number, y1: number, x2: number, y2: number): void;
36
- /**
37
- * Dispose of WebGL resources used by this geometry
38
- */
39
- $dispose(): void;
39
+ protected _setRotationCenter(instanceData: InstanceData, centerX: number, centerY: number): void;
40
+ protected _calculateRotationParams(x: number, y: number, width: number, height: number, rotationDegrees: number): {
41
+ centerX: number;
42
+ centerY: number;
43
+ radians: number;
44
+ aspectRatio: number;
45
+ };
40
46
  }
@@ -0,0 +1,22 @@
1
+ /**
2
+ * Instanced bezier curve geometry implementation
3
+ */
4
+ import type { InstanceBatch } from '../InstanceBatch';
5
+ import { type BezierCurveParams } from '../types/GeometryTypes';
6
+ import { BaseGeometry } from './BaseGeometry';
7
+ /**
8
+ * TRUE INSTANCED bezier curve geometry renderer.
9
+ *
10
+ * APPROACH: Use a fixed multi-segment unit geometry shared by all curves.
11
+ * Each instance provides Bezier control points via instance attributes, and the
12
+ * vertex shader evaluates the curve mathematically to transform each segment.
13
+ *
14
+ * This maintains true instanced rendering: one draw call for all curves.
15
+ */
16
+ export declare class BezierCurve extends BaseGeometry {
17
+ constructor(gl: WebGL2RenderingContext, batch: InstanceBatch);
18
+ /**
19
+ * Add a bezier curve instance to the batch - TRUE INSTANCED APPROACH
20
+ */
21
+ $addInstance(params: BezierCurveParams, renderState: any): number;
22
+ }
@@ -0,0 +1,20 @@
1
+ /**
2
+ * Instanced ellipse geometry implementation
3
+ */
4
+ import type { InstanceBatch } from '../InstanceBatch';
5
+ import { type EllipseParams } from '../types/GeometryTypes';
6
+ import { BaseGeometry } from './BaseGeometry';
7
+ /**
8
+ * Instanced ellipse geometry renderer.
9
+ * Batches all ellipse draw calls for efficient GPU rendering.
10
+ */
11
+ export declare class Ellipse extends BaseGeometry {
12
+ constructor(gl: WebGL2RenderingContext, batch: InstanceBatch);
13
+ /**
14
+ * Add an ellipse instance to the batch
15
+ * @param params Ellipse parameters (x,y as top-left corner, width/height as dimensions)
16
+ * @param renderState Current render state
17
+ * @returns Index of the added instance
18
+ */
19
+ $addInstance(params: EllipseParams, renderState: any): number;
20
+ }
@@ -1,11 +1,20 @@
1
+ /**
2
+ * Instanced line geometry implementation
3
+ */
4
+ import type { InstanceBatch } from '../InstanceBatch';
5
+ import { type LineParams } from '../types/GeometryTypes';
1
6
  import { BaseGeometry } from './BaseGeometry';
2
7
  /**
3
- * Line geometry renderer
8
+ * Instanced line geometry renderer.
9
+ * Batches all line draw calls for efficient GPU rendering.
4
10
  */
5
11
  export declare class Line extends BaseGeometry {
6
- constructor(gl: WebGLRenderingContext);
12
+ constructor(gl: WebGL2RenderingContext, batch: InstanceBatch);
7
13
  /**
8
- * Draw a line from (x1, y1) to (x2, y2) with specified weight
14
+ * Add a line instance to the batch
15
+ * @param params Line parameters
16
+ * @param renderState Current render state
17
+ * @returns Index of the added instance
9
18
  */
10
- $draw(x1: number, y1: number, x2: number, y2: number, weight: number): void;
19
+ $addInstance(params: LineParams, renderState: any): number;
11
20
  }
@@ -1,15 +1,20 @@
1
+ /**
2
+ * Instanced rectangle geometry implementation
3
+ */
4
+ import type { InstanceBatch } from '../InstanceBatch';
5
+ import { type RectangleParams } from '../types/GeometryTypes';
1
6
  import { BaseGeometry } from './BaseGeometry';
2
7
  /**
3
- * Rectangle geometry renderer with fill and stroke support
8
+ * Instanced rectangle geometry renderer.
9
+ * Batches all rectangle draw calls for efficient GPU rendering.
4
10
  */
5
11
  export declare class Rectangle extends BaseGeometry {
6
- constructor(gl: WebGLRenderingContext);
7
- /**
8
- * Draw a filled rectangle
9
- */
10
- $drawFill(x: number, y: number, width: number, height: number): void;
12
+ constructor(gl: WebGL2RenderingContext, batch: InstanceBatch);
11
13
  /**
12
- * Draw a rectangle stroke (outline)
14
+ * Add a rectangle instance to the batch
15
+ * @param params Rectangle parameters
16
+ * @param renderState Current render state
17
+ * @returns Index of the added instance
13
18
  */
14
- $drawStroke(x: number, y: number, width: number, height: number, weight: number): void;
19
+ $addInstance(params: RectangleParams, renderState: any): number;
15
20
  }
@@ -0,0 +1,20 @@
1
+ /**
2
+ * Instanced triangle geometry implementation
3
+ */
4
+ import type { InstanceBatch } from '../InstanceBatch';
5
+ import { type TriangleParams } from '../types/GeometryTypes';
6
+ import { BaseGeometry } from './BaseGeometry';
7
+ /**
8
+ * Instanced triangle geometry renderer.
9
+ * Batches all triangle draw calls for efficient GPU rendering.
10
+ */
11
+ export declare class Triangle extends BaseGeometry {
12
+ constructor(gl: WebGL2RenderingContext, batch: InstanceBatch);
13
+ /**
14
+ * Add a triangle instance to the batch
15
+ * @param params Triangle parameters
16
+ * @param renderState Current render state
17
+ * @returns Index of the added instance
18
+ */
19
+ $addInstance(params: TriangleParams, renderState: any): number;
20
+ }
@@ -1,3 +1,6 @@
1
- export { BaseGeometry } from './BaseGeometry';
2
1
  export { Rectangle } from './Rectangle';
3
2
  export { Line } from './Line';
3
+ export { Ellipse } from './Ellipse';
4
+ export { Arc } from './Arc';
5
+ export { Triangle } from './Triangle';
6
+ export { BezierCurve } from './BezierCurve';
@@ -1 +1,17 @@
1
- export {};
1
+ export * from './Framebuffer';
2
+ export * from './Renderer';
3
+ export * from './Shader';
4
+ export * from './StateCache';
5
+ export { GeometryType } from './types/GeometryTypes';
6
+ export type { IGeometry as IInstancedGeometry, UnitGeometryData, RectangleParams, LineParams, EllipseParams, ArcParams, TriangleParams, BezierCurveParams, GeometryParams } from './types/GeometryTypes';
7
+ export type { RenderContext, } from './types/RenderTypes';
8
+ export type { InstanceData } from './InstanceData';
9
+ export { PackedInstanceData, InstanceAttributeLayout } from './InstanceData';
10
+ export { InstanceBatch } from './InstanceBatch';
11
+ export { BaseGeometry } from './geometries/BaseGeometry';
12
+ export { Rectangle } from './geometries/Rectangle';
13
+ export { Line } from './geometries/Line';
14
+ export { Ellipse } from './geometries/Ellipse';
15
+ export { Arc } from './geometries/Arc';
16
+ export { Triangle } from './geometries/Triangle';
17
+ export { BezierCurve } from './geometries/BezierCurve';
@@ -0,0 +1,9 @@
1
+ import type { GeometryParams, GeometryType } from './GeometryTypes';
2
+ import type { IRenderState } from '../RenderState';
3
+ export type DrawParams = GeometryParams;
4
+ export interface DrawCommand {
5
+ id: number;
6
+ type: GeometryType;
7
+ params: DrawParams;
8
+ state: IRenderState;
9
+ }
@@ -0,0 +1,144 @@
1
+ /**
2
+ * Core interfaces and types for the instanced geometry system
3
+ */
4
+ import type { InstanceBatch } from '../InstanceBatch';
5
+ /**
6
+ * Geometry types supported by the instanced rendering system
7
+ */
8
+ export declare enum GeometryType {
9
+ RECTANGLE = "rectangle",
10
+ LINE = "line",
11
+ ELLIPSE = "ellipse",
12
+ ARC = "arc",
13
+ TRIANGLE = "triangle",
14
+ BEZIER_CURVE = "bezier_curve",
15
+ CUSTOM = "custom"
16
+ }
17
+ /**
18
+ * Unit geometry vertex data for a specific geometry type
19
+ */
20
+ export interface UnitGeometryData {
21
+ /** Vertex data as Float32Array (position + texCoord interleaved) */
22
+ vertices: Float32Array;
23
+ /** Number of vertices in the geometry */
24
+ vertexCount: number;
25
+ /** WebGL primitive type (gl.TRIANGLES, gl.LINES, etc.) */
26
+ primitiveType: number;
27
+ /** Stride in bytes between vertices */
28
+ stride: number;
29
+ /** Attribute configuration for position and texCoord */
30
+ attributes: {
31
+ position: {
32
+ size: number;
33
+ offset: number;
34
+ };
35
+ texCoord: {
36
+ size: number;
37
+ offset: number;
38
+ };
39
+ };
40
+ }
41
+ /**
42
+ * Interface for instanced geometry implementations
43
+ */
44
+ export interface IGeometry {
45
+ /** The geometry type identifier */
46
+ readonly type: GeometryType;
47
+ /** The unit geometry data for this geometry type */
48
+ readonly unitGeometry: UnitGeometryData;
49
+ /** The instance batch for managing instances of this geometry */
50
+ readonly batch: InstanceBatch;
51
+ /**
52
+ * Add a new instance of this geometry to the batch
53
+ * @param params Geometry-specific parameters
54
+ * @param renderState Current render state
55
+ * @returns Index of the added instance
56
+ */
57
+ $addInstance(params: any, renderState: any): number;
58
+ /**
59
+ * Clear all instances from the batch
60
+ */
61
+ $clearInstances(): void;
62
+ /**
63
+ * Check if the geometry has any instances to render
64
+ */
65
+ $hasInstances(): boolean;
66
+ /**
67
+ * Dispose of geometry resources
68
+ */
69
+ $dispose(): void;
70
+ }
71
+ /**
72
+ * Parameters for rectangle geometry
73
+ */
74
+ export interface RectangleParams {
75
+ x: number;
76
+ y: number;
77
+ width: number;
78
+ height: number;
79
+ }
80
+ /**
81
+ * Parameters for line geometry
82
+ */
83
+ export interface LineParams {
84
+ x1: number;
85
+ y1: number;
86
+ x2: number;
87
+ y2: number;
88
+ thickness?: number;
89
+ }
90
+ /**
91
+ * Parameters for ellipse geometry
92
+ */
93
+ export interface EllipseParams {
94
+ x: number;
95
+ y: number;
96
+ width: number;
97
+ height: number;
98
+ startAngle?: number;
99
+ endAngle?: number;
100
+ segments?: number;
101
+ }
102
+ /**
103
+ * Parameters for arc geometry (filled pie segment)
104
+ * Angles are specified in DEGREES and arcs are drawn clockwise from start to stop.
105
+ * x, y specify the center of the arc (consistent with current ellipse implementation).
106
+ */
107
+ export interface ArcParams {
108
+ x: number;
109
+ y: number;
110
+ width: number;
111
+ height: number;
112
+ start: number;
113
+ stop: number;
114
+ }
115
+ /**
116
+ * Parameters for triangle geometry
117
+ */
118
+ export interface TriangleParams {
119
+ x1: number;
120
+ y1: number;
121
+ x2: number;
122
+ y2: number;
123
+ x3: number;
124
+ y3: number;
125
+ }
126
+ /**
127
+ * Parameters for bezier curve geometry
128
+ */
129
+ export interface BezierCurveParams {
130
+ x1: number;
131
+ y1: number;
132
+ cp1x: number;
133
+ cp1y: number;
134
+ cp2x: number;
135
+ cp2y: number;
136
+ x2: number;
137
+ y2: number;
138
+ thickness?: number;
139
+ segments?: number;
140
+ }
141
+ /**
142
+ * Union type for all geometry parameters
143
+ */
144
+ export type GeometryParams = RectangleParams | LineParams | EllipseParams | ArcParams | TriangleParams | BezierCurveParams;
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Rendering pipeline interfaces and types
3
+ */
4
+ import type { GLShader } from '../Shader';
5
+ /**
6
+ * Render context containing shader and rendering configuration
7
+ */
8
+ export interface RenderContext {
9
+ shader: GLShader;
10
+ gl: WebGL2RenderingContext;
11
+ viewport: [number, number, number, number];
12
+ }
@@ -0,0 +1,81 @@
1
+ /**
2
+ * Manages animation loop timing and frame rate control for textmode rendering.
3
+ * Provides precise frame rate limiting and smooth animation timing.
4
+ */
5
+ export declare class AnimationController {
6
+ private _frameRateLimit;
7
+ private _frameInterval;
8
+ private _animationFrameId;
9
+ private _lastFrameTime;
10
+ private _isLooping;
11
+ private _frameRate;
12
+ private _lastRenderTime;
13
+ private _frameTimeHistory;
14
+ private _frameTimeHistorySize;
15
+ private _frameCount;
16
+ /**
17
+ * Creates an AnimationController instance.
18
+ * @param frameRateLimit Maximum frames per second. Defaults to 60.
19
+ */
20
+ constructor(frameRateLimit?: number);
21
+ /**
22
+ * Start the animation loop with the provided render callback.
23
+ * @param renderCallback Function to call for each frame render
24
+ */
25
+ start(renderCallback: () => void): void;
26
+ /**
27
+ * Stop the animation loop.
28
+ */
29
+ stop(): void;
30
+ /**
31
+ * Pause the animation loop without stopping it completely.
32
+ */
33
+ pause(): void;
34
+ /**
35
+ * Resume the animation loop if it was paused.
36
+ * @param renderCallback Function to call for each frame render
37
+ */
38
+ resume(renderCallback: () => void): void;
39
+ /**
40
+ * Set or get the frame rate limit.
41
+ * @param fps Optional new frame rate limit. If not provided, returns current measured frame rate.
42
+ * @param renderCallback Required when setting new frame rate and animation is running
43
+ * @returns Current measured frame rate when getting, void when setting
44
+ */
45
+ frameRate(fps?: number, renderCallback?: () => void): number | void;
46
+ /**
47
+ * Update frame rate measurement. Should be called on each render.
48
+ * Uses a rolling average for smoother frame rate reporting.
49
+ */
50
+ measureFrameRate(): void;
51
+ /**
52
+ * Check if the animation loop is currently active.
53
+ */
54
+ get isLooping(): boolean;
55
+ /**
56
+ * Get the current frame rate limit.
57
+ */
58
+ get frameRateLimit(): number;
59
+ /**
60
+ * Get the current measured frame rate.
61
+ */
62
+ get currentFrameRate(): number;
63
+ /**
64
+ * Get the current frame count.
65
+ */
66
+ get frameCount(): number;
67
+ /**
68
+ * Set the current frame count.
69
+ */
70
+ set frameCount(value: number);
71
+ /**
72
+ * Increment the frame count by one.
73
+ * Should be called on each render to track total frames rendered.
74
+ */
75
+ incrementFrame(): void;
76
+ /**
77
+ * Reset the frame count to zero.
78
+ * Useful when restarting animations or resetting state.
79
+ */
80
+ resetFrameCount(): void;
81
+ }
@@ -1,37 +1,36 @@
1
1
  import type { TextmodeOptions } from "./Textmodifier";
2
2
  /**
3
- * Supported capture sources for textmode rendering.
4
- */
5
- export type TextmodeCaptureSource = HTMLCanvasElement | HTMLVideoElement;
6
- /**
7
- * TextmodeCanvas is a utility class that creates an overlay canvas
8
- * for rendering textmode graphics on top of an existing HTML canvas or video element,
9
- * or manages a standalone canvas for independent rendering.
3
+ * Manages a `HTMLCanvasElement` for textmode rendering.
10
4
  * @ignore
11
5
  */
12
6
  export declare class TextmodeCanvas {
13
7
  private _canvas;
14
- private _captureSource;
15
- private _isStandalone;
16
8
  private _resizeObserver?;
17
- onTransformChange?: () => void;
18
- constructor(captureSource: TextmodeCaptureSource, isStandalone?: boolean, opts?: TextmodeOptions);
9
+ private _canvasCreatedByUs;
10
+ /**
11
+ * Creates a new TextmodeCanvas instance.
12
+ * @param opts Options for creating or using an existing canvas
13
+ * @ignore
14
+ */
15
+ constructor(opts?: TextmodeOptions);
19
16
  private _createCanvas;
20
- private _positionOverlayCanvas;
21
- $resize(width?: number, height?: number): void;
22
17
  /**
23
- * Get the WebGL context for the overlay canvas
18
+ * Resize the canvas to the specified width and height.
19
+ * If width or height is not provided, it retains the current dimension.
20
+ * @param width The new width of the canvas in pixels.
21
+ * @param height The new height of the canvas in pixels.
22
+ * @ignore
24
23
  */
25
- $getWebGLContext(): WebGL2RenderingContext | WebGLRenderingContext;
24
+ $resize(width?: number, height?: number): void;
26
25
  /**
27
- * Set up ResizeObserver to monitor for CSS transform changes
28
- *
29
- * note: might be redundant and can be deleted?
26
+ * Get the WebGL context for the overlay canvas
27
+ * @ignore
30
28
  */
31
- private setupTransformObserver;
29
+ $getWebGLContext(): WebGL2RenderingContext;
32
30
  /**
33
31
  * Dispose of this TextmodeCanvas and clean up all resources.
34
32
  * This method is idempotent and safe to call multiple times.
33
+ * @ignore
35
34
  */
36
35
  $dispose(): void;
37
36
  get canvas(): HTMLCanvasElement;
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Manages the grid for the ASCII rendering pipeline of a {@link Textmodifier} instance.
2
+ * Manages the grid of a {@link Textmodifier} instance.
3
3
  */
4
4
  export declare class TextmodeGrid {
5
5
  /** The number of columns in the grid. */
@@ -14,8 +14,6 @@ export declare class TextmodeGrid {
14
14
  private _offsetX;
15
15
  /** The offset to the outer canvas on the y-axis when centering the grid. */
16
16
  private _offsetY;
17
- /** Whether the grid dimensions are fixed, or responsive based on the canvas dimensions. */
18
- private _fixedDimensions;
19
17
  /** The canvas element used to determine the grid dimensions. */
20
18
  private _canvas;
21
19
  /** The width of each cell in the grid. */
@@ -35,10 +33,6 @@ export declare class TextmodeGrid {
35
33
  * @ignore
36
34
  */
37
35
  $reset(): void;
38
- /**
39
- * Reset the total grid width & height, and the offset to the outer canvas.
40
- */
41
- private _updateDimensions;
42
36
  /**
43
37
  * Re-assign the grid cell dimensions and `reset()` the grid.
44
38
  * @param newCellWidth The new cell width.
@@ -46,33 +40,6 @@ export declare class TextmodeGrid {
46
40
  * @ignore
47
41
  */
48
42
  $resizeCellPixelDimensions(newCellWidth: number, newCellHeight: number): void;
49
- /**
50
- * Re-assign the grid dimensions and resize the grid.
51
- *
52
- * Calling this method makes the grid dimensions fixed, meaning they will not automatically resize based on the canvas dimensions.
53
- * @param newCols The new number of columns.
54
- * @param newRows The new number of rows.
55
- * @ignore
56
- */
57
- $resizeGridDimensions(newCols: number, newRows: number): void;
58
- /**
59
- * Make the grid dimensions flexible again, and `reset()` the grid.
60
- * @ignore
61
- */
62
- $resetGridDimensions(): void;
63
- /**
64
- * Update the canvas used by the grid, and reset the grid dimensions.
65
- * @param canvas The new canvas element to use for the grid.
66
- * @ignore
67
- */
68
- $resize(): void;
69
- /**
70
- * Gets or sets whether the grid dimensions *(columns and rows)* are fixed or responsive based on the canvas dimensions.
71
- * @param value Optional. `true` to make the grid dimensions fixed, or `false` to make them responsive. If not provided, returns the current state.
72
- * @returns If no parameter is provided, returns `true` if the grid dimensions are fixed, or `false` if they are responsive.
73
- * @ignore
74
- */
75
- $fixedDimensions(value?: boolean): boolean | void;
76
43
  /** Returns the width of each cell in the grid. */
77
44
  get cellWidth(): number;
78
45
  /** Returns the height of each cell in the grid. */