textmode.js 0.1.6-beta.6 → 0.1.7
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/dist/textmode.esm.js +1197 -1168
- package/dist/textmode.esm.min.js +1237 -1208
- package/dist/textmode.umd.js +56 -18
- package/dist/textmode.umd.min.js +56 -18
- package/dist/types/errors/Error.d.ts +3 -5
- package/dist/types/errors/ErrorHandler.d.ts +3 -3
- package/dist/types/export/base/DataExtractor.d.ts +3 -3
- package/dist/types/export/base/FileHandler.d.ts +6 -6
- package/dist/types/export/image/ImageContentGenerator.d.ts +3 -3
- package/dist/types/export/image/ImageDataExtractor.d.ts +1 -1
- package/dist/types/export/image/ImageExporter.d.ts +8 -8
- package/dist/types/export/image/ImageFileHandler.d.ts +3 -15
- package/dist/types/export/svg/SVGContentGenerator.d.ts +11 -11
- package/dist/types/export/svg/SVGDataExtractor.d.ts +3 -3
- package/dist/types/export/svg/SVGExporter.d.ts +6 -6
- package/dist/types/export/svg/SVGFileHandler.d.ts +3 -3
- package/dist/types/export/svg/SVGPathGenerator.d.ts +5 -6
- package/dist/types/export/txt/TXTContentGenerator.d.ts +1 -1
- package/dist/types/export/txt/TXTDataExtractor.d.ts +1 -1
- package/dist/types/export/txt/TXTExporter.d.ts +6 -6
- package/dist/types/export/txt/TXTFileHandler.d.ts +2 -2
- package/dist/types/rendering/webgl/Framebuffer.d.ts +8 -8
- package/dist/types/rendering/webgl/Renderer.d.ts +35 -35
- package/dist/types/rendering/webgl/Shader.d.ts +14 -14
- package/dist/types/rendering/webgl/geometries/BaseGeometry.d.ts +10 -10
- package/dist/types/rendering/webgl/geometries/Line.d.ts +1 -1
- package/dist/types/rendering/webgl/geometries/Rectangle.d.ts +2 -2
- package/dist/types/textmode/Canvas.d.ts +9 -7
- package/dist/types/textmode/ConversionPipeline.d.ts +23 -15
- package/dist/types/textmode/Grid.d.ts +6 -6
- package/dist/types/textmode/Textmodifier.d.ts +15 -16
- package/dist/types/textmode/converters/BrightnessConverter.d.ts +8 -8
- package/dist/types/textmode/converters/Converter.d.ts +5 -5
- package/dist/types/textmode/converters/FeatureConverter.d.ts +6 -6
- package/dist/types/textmode/font/TextmodeFont.d.ts +8 -8
- package/dist/types/textmode/mixins/TextmodifierMixin.d.ts +1 -1
- package/package.json +1 -1
|
@@ -11,29 +11,17 @@ export declare class ImageFileHandler extends FileHandler {
|
|
|
11
11
|
* @param filename The filename (without extension)
|
|
12
12
|
* @param format The image format
|
|
13
13
|
*/
|
|
14
|
-
saveImage(content: Blob, filename: string, format: ImageFormat): void;
|
|
14
|
+
$saveImage(content: Blob, filename: string, format: ImageFormat): void;
|
|
15
15
|
/**
|
|
16
16
|
* Saves image from blob
|
|
17
17
|
* @param blob The blob containing image data
|
|
18
18
|
* @param filename The complete filename with extension
|
|
19
19
|
*/
|
|
20
|
-
private
|
|
20
|
+
private _saveImageFromBlob;
|
|
21
21
|
/**
|
|
22
22
|
* Validates if the browser supports saving files in the specified format
|
|
23
23
|
* @param format The image format to validate
|
|
24
24
|
* @returns True if the format is supported for saving
|
|
25
25
|
*/
|
|
26
|
-
validateSaveSupport(format: ImageFormat): boolean;
|
|
27
|
-
/**
|
|
28
|
-
* Gets the MIME type for the specified image format
|
|
29
|
-
* @param format The image format
|
|
30
|
-
* @returns The MIME type string
|
|
31
|
-
*/
|
|
32
|
-
getMimeType(format: ImageFormat): string;
|
|
33
|
-
/**
|
|
34
|
-
* Gets the file extension for the specified image format
|
|
35
|
-
* @param format The image format
|
|
36
|
-
* @returns The file extension (including the dot)
|
|
37
|
-
*/
|
|
38
|
-
getFileExtension(format: ImageFormat): string;
|
|
26
|
+
$validateSaveSupport(format: ImageFormat): boolean;
|
|
39
27
|
}
|
|
@@ -5,39 +5,39 @@ import type { TextmodeFont, TextmodeGrid } from '../../index';
|
|
|
5
5
|
* This class handles the creation of SVG elements, groups, and styling.
|
|
6
6
|
*/
|
|
7
7
|
export declare class SVGContentGenerator {
|
|
8
|
-
private
|
|
8
|
+
private _pathGenerator;
|
|
9
9
|
constructor();
|
|
10
10
|
/**
|
|
11
11
|
* Generates the SVG header with metadata
|
|
12
12
|
* @param gridInfo Grid dimensions
|
|
13
13
|
* @returns SVG header string
|
|
14
14
|
*/
|
|
15
|
-
generateSVGHeader(gridInfo: TextmodeGrid): string;
|
|
15
|
+
$generateSVGHeader(gridInfo: TextmodeGrid): string;
|
|
16
16
|
/**
|
|
17
17
|
* Generates the SVG footer
|
|
18
18
|
* @returns SVG footer string
|
|
19
19
|
*/
|
|
20
|
-
generateSVGFooter(): string;
|
|
20
|
+
$generateSVGFooter(): string;
|
|
21
21
|
/**
|
|
22
22
|
* Generates background rectangle if needed
|
|
23
23
|
* @param gridInfo Grid information
|
|
24
24
|
* @param options SVG generation options
|
|
25
25
|
* @returns Background rectangle SVG string or empty string
|
|
26
26
|
*/
|
|
27
|
-
generateBackground(gridInfo: TextmodeGrid, options: SVGGenerationOptions): string;
|
|
27
|
+
$generateBackground(gridInfo: TextmodeGrid, options: SVGGenerationOptions): string;
|
|
28
28
|
/**
|
|
29
29
|
* Converts RGBA object to CSS color string
|
|
30
30
|
* @param color RGBA color object
|
|
31
31
|
* @returns CSS color string
|
|
32
32
|
*/
|
|
33
|
-
private
|
|
33
|
+
private _rgbaToColorString;
|
|
34
34
|
/**
|
|
35
35
|
* Generates SVG transform attribute string
|
|
36
36
|
* @param cellData Cell data with transform information
|
|
37
37
|
* @param gridInfo Grid information for center calculations
|
|
38
38
|
* @returns Transform attribute string or empty string
|
|
39
39
|
*/
|
|
40
|
-
private
|
|
40
|
+
private _generateTransformAttribute;
|
|
41
41
|
/**
|
|
42
42
|
* Generates background rectangle for a cell
|
|
43
43
|
* @param cellData Cell data
|
|
@@ -45,7 +45,7 @@ export declare class SVGContentGenerator {
|
|
|
45
45
|
* @param options SVG generation options
|
|
46
46
|
* @returns Background rectangle SVG string or empty string
|
|
47
47
|
*/
|
|
48
|
-
private
|
|
48
|
+
private _generateCellBackground;
|
|
49
49
|
/**
|
|
50
50
|
* Generates character path element for a cell
|
|
51
51
|
* @param cellData Cell data
|
|
@@ -54,7 +54,7 @@ export declare class SVGContentGenerator {
|
|
|
54
54
|
* @param options SVG generation options
|
|
55
55
|
* @returns Character path SVG string
|
|
56
56
|
*/
|
|
57
|
-
private
|
|
57
|
+
private _generateCharacterPath;
|
|
58
58
|
/**
|
|
59
59
|
* Generates complete SVG content for a single cell
|
|
60
60
|
* @param cellData Cell data
|
|
@@ -63,7 +63,7 @@ export declare class SVGContentGenerator {
|
|
|
63
63
|
* @param options SVG generation options
|
|
64
64
|
* @returns Complete cell SVG content
|
|
65
65
|
*/
|
|
66
|
-
generateCellContent(cellData: SVGCellData, gridInfo: TextmodeGrid, fontInfo: TextmodeFont, options: SVGGenerationOptions): string;
|
|
66
|
+
$generateCellContent(cellData: SVGCellData, gridInfo: TextmodeGrid, fontInfo: TextmodeFont, options: SVGGenerationOptions): string;
|
|
67
67
|
/**
|
|
68
68
|
* Generates the complete SVG content from cell data
|
|
69
69
|
* @param cellDataArray Array of cell data
|
|
@@ -72,11 +72,11 @@ export declare class SVGContentGenerator {
|
|
|
72
72
|
* @param options SVG generation options
|
|
73
73
|
* @returns Complete SVG string
|
|
74
74
|
*/
|
|
75
|
-
generateSVGContent(cellDataArray: SVGCellData[], grid: TextmodeGrid, fontInfo: TextmodeFont, options: SVGGenerationOptions): string;
|
|
75
|
+
$generateSVGContent(cellDataArray: SVGCellData[], grid: TextmodeGrid, fontInfo: TextmodeFont, options: SVGGenerationOptions): string;
|
|
76
76
|
/**
|
|
77
77
|
* Optimizes SVG content by removing empty elements and unnecessary whitespace
|
|
78
78
|
* @param svgContent Raw SVG content
|
|
79
79
|
* @returns Optimized SVG content
|
|
80
80
|
*/
|
|
81
|
-
optimizeSVGContent(svgContent: string): string;
|
|
81
|
+
$optimizeSVGContent(svgContent: string): string;
|
|
82
82
|
}
|
|
@@ -13,7 +13,7 @@ export declare class SVGDataExtractor extends DataExtractor {
|
|
|
13
13
|
* @param pixelIndex Pixel index in the array
|
|
14
14
|
* @returns Transform data object
|
|
15
15
|
*/
|
|
16
|
-
private
|
|
16
|
+
private _extractTransformData;
|
|
17
17
|
/**
|
|
18
18
|
* Calculates cell position information
|
|
19
19
|
* @param x Grid X coordinate
|
|
@@ -21,7 +21,7 @@ export declare class SVGDataExtractor extends DataExtractor {
|
|
|
21
21
|
* @param gridInfo Grid information
|
|
22
22
|
* @returns Position data object
|
|
23
23
|
*/
|
|
24
|
-
private
|
|
24
|
+
private _calculateCellPosition;
|
|
25
25
|
/**
|
|
26
26
|
* Processes all grid cells and extracts SVG cell data
|
|
27
27
|
* @param framebufferData Raw pixel data from framebuffers
|
|
@@ -29,5 +29,5 @@ export declare class SVGDataExtractor extends DataExtractor {
|
|
|
29
29
|
* @param font Font information
|
|
30
30
|
* @returns Array of SVG cell data objects
|
|
31
31
|
*/
|
|
32
|
-
extractSVGCellData(framebufferData: FramebufferData, grid: TextmodeGrid): SVGCellData[];
|
|
32
|
+
$extractSVGCellData(framebufferData: FramebufferData, grid: TextmodeGrid): SVGCellData[];
|
|
33
33
|
}
|
|
@@ -5,27 +5,27 @@ import type { SVGExportOptions } from './types';
|
|
|
5
5
|
* content generation, and file handling.
|
|
6
6
|
*/
|
|
7
7
|
export declare class SVGExporter {
|
|
8
|
-
private
|
|
9
|
-
private
|
|
10
|
-
private
|
|
8
|
+
private _dataExtractor;
|
|
9
|
+
private _contentGenerator;
|
|
10
|
+
private _fileHandler;
|
|
11
11
|
constructor();
|
|
12
12
|
/**
|
|
13
13
|
* Applies default values to SVG export options
|
|
14
14
|
* @param options User-provided options
|
|
15
15
|
* @returns Complete options with defaults applied
|
|
16
16
|
*/
|
|
17
|
-
private
|
|
17
|
+
private _applyDefaultOptions;
|
|
18
18
|
/**
|
|
19
19
|
* Generates SVG content from textmode rendering data without saving to file
|
|
20
20
|
* @param textmodifier The textmodifier instance containing rendering data
|
|
21
21
|
* @param options Export options (excluding filename)
|
|
22
22
|
* @returns SVG content as string
|
|
23
23
|
*/
|
|
24
|
-
generateSVG(textmodifier: any, options?: Omit<SVGExportOptions, 'filename'>): string;
|
|
24
|
+
$generateSVG(textmodifier: any, options?: Omit<SVGExportOptions, 'filename'>): string;
|
|
25
25
|
/**
|
|
26
26
|
* Exports SVG content to a downloadable file
|
|
27
27
|
* @param textmodifier The textmodifier instance containing rendering data
|
|
28
28
|
* @param options Export options including filename
|
|
29
29
|
*/
|
|
30
|
-
saveSVG(textmodifier: any, options?: SVGExportOptions): void;
|
|
30
|
+
$saveSVG(textmodifier: any, options?: SVGExportOptions): void;
|
|
31
31
|
}
|
|
@@ -9,17 +9,17 @@ export declare class SVGFileHandler extends FileHandler {
|
|
|
9
9
|
* @param svgContent The SVG content string
|
|
10
10
|
* @returns Blob object containing the SVG data
|
|
11
11
|
*/
|
|
12
|
-
createSVGBlob(svgContent: string): Blob;
|
|
12
|
+
$createSVGBlob(svgContent: string): Blob;
|
|
13
13
|
/**
|
|
14
14
|
* Downloads SVG content as a file
|
|
15
15
|
* @param svgContent The SVG content to download
|
|
16
16
|
* @param filename The filename (without extension)
|
|
17
17
|
*/
|
|
18
|
-
|
|
18
|
+
private _downloadSVG;
|
|
19
19
|
/**
|
|
20
20
|
* Saves SVG content with automatic filename generation if not provided
|
|
21
21
|
* @param svgContent The SVG content to save
|
|
22
22
|
* @param filename Optional filename (will generate if not provided)
|
|
23
23
|
*/
|
|
24
|
-
saveSVG(svgContent: string, filename?: string): void;
|
|
24
|
+
$saveSVG(svgContent: string, filename?: string): void;
|
|
25
25
|
}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import type { GlyphPath } from './types';
|
|
2
1
|
import type { TyprFont } from '../../textmode/font/types.ts';
|
|
3
2
|
/**
|
|
4
3
|
* Handles SVG path generation for character glyphs.
|
|
@@ -11,7 +10,7 @@ export declare class SVGPathGenerator {
|
|
|
11
10
|
* @param codePoint The Unicode code point to look up
|
|
12
11
|
* @returns The glyph index, or 0 if not found
|
|
13
12
|
*/
|
|
14
|
-
private
|
|
13
|
+
private _getGlyphIndex;
|
|
15
14
|
/**
|
|
16
15
|
* Creates a path object for a glyph
|
|
17
16
|
* @param fontData Font data object
|
|
@@ -21,7 +20,7 @@ export declare class SVGPathGenerator {
|
|
|
21
20
|
* @param fontSize Font size
|
|
22
21
|
* @returns Path object with bounding box and SVG methods
|
|
23
22
|
*/
|
|
24
|
-
private
|
|
23
|
+
private _createGlyphPath;
|
|
25
24
|
/**
|
|
26
25
|
* Converts glyph data to SVG path string
|
|
27
26
|
* @param glyphData Glyph data from font
|
|
@@ -30,7 +29,7 @@ export declare class SVGPathGenerator {
|
|
|
30
29
|
* @param scale Scale factor
|
|
31
30
|
* @returns SVG path data string
|
|
32
31
|
*/
|
|
33
|
-
private
|
|
32
|
+
private _glyphToSVGPath;
|
|
34
33
|
/**
|
|
35
34
|
* Generates an SVG path for a character glyph
|
|
36
35
|
* @param character The character to generate a path for
|
|
@@ -40,7 +39,7 @@ export declare class SVGPathGenerator {
|
|
|
40
39
|
* @param fontSize Font size
|
|
41
40
|
* @returns Path object with SVG generation methods
|
|
42
41
|
*/
|
|
43
|
-
|
|
42
|
+
private _generateCharacterPath;
|
|
44
43
|
/**
|
|
45
44
|
* Generates SVG path data for a character with positioning calculations
|
|
46
45
|
* @param character The character to render
|
|
@@ -53,5 +52,5 @@ export declare class SVGPathGenerator {
|
|
|
53
52
|
* @param advanceWidth Character advance width
|
|
54
53
|
* @returns SVG path data string or null if generation fails
|
|
55
54
|
*/
|
|
56
|
-
generatePositionedCharacterPath(character: string, fontData: TyprFont, cellX: number, cellY: number, cellWidth: number, cellHeight: number, fontSize: number, advanceWidth: number): string | null;
|
|
55
|
+
$generatePositionedCharacterPath(character: string, fontData: TyprFont, cellX: number, cellY: number, cellWidth: number, cellHeight: number, fontSize: number, advanceWidth: number): string | null;
|
|
57
56
|
}
|
|
@@ -10,5 +10,5 @@ export declare class TXTContentGenerator {
|
|
|
10
10
|
* @param options Generation options
|
|
11
11
|
* @returns TXT content as string
|
|
12
12
|
*/
|
|
13
|
-
generateTXTContent(characterGrid: string[][], options: TXTGenerationOptions): string;
|
|
13
|
+
$generateTXTContent(characterGrid: string[][], options: TXTGenerationOptions): string;
|
|
14
14
|
}
|
|
@@ -14,5 +14,5 @@ export declare class TXTDataExtractor extends DataExtractor {
|
|
|
14
14
|
* @param emptyCharacter Character to use for empty cells
|
|
15
15
|
* @returns 2D array of characters (rows x columns)
|
|
16
16
|
*/
|
|
17
|
-
extractCharacterGrid(framebufferData: FramebufferData, grid: TextmodeGrid, font: TextmodeFont, emptyCharacter?: string): string[][];
|
|
17
|
+
$extractCharacterGrid(framebufferData: FramebufferData, grid: TextmodeGrid, font: TextmodeFont, emptyCharacter?: string): string[][];
|
|
18
18
|
}
|
|
@@ -5,27 +5,27 @@ import type { TXTExportOptions } from './types';
|
|
|
5
5
|
* content generation, and file handling.
|
|
6
6
|
*/
|
|
7
7
|
export declare class TXTExporter {
|
|
8
|
-
private
|
|
9
|
-
private
|
|
10
|
-
private
|
|
8
|
+
private _dataExtractor;
|
|
9
|
+
private _contentGenerator;
|
|
10
|
+
private _fileHandler;
|
|
11
11
|
constructor();
|
|
12
12
|
/**
|
|
13
13
|
* Applies default values to TXT export options
|
|
14
14
|
* @param options User-provided options
|
|
15
15
|
* @returns Complete options with defaults applied
|
|
16
16
|
*/
|
|
17
|
-
private
|
|
17
|
+
private _applyDefaultOptions;
|
|
18
18
|
/**
|
|
19
19
|
* Generates TXT content from textmode rendering data without saving to file
|
|
20
20
|
* @param textmodifier The textmodifier instance containing rendering data
|
|
21
21
|
* @param options Export options (excluding filename)
|
|
22
22
|
* @returns TXT content as string
|
|
23
23
|
*/
|
|
24
|
-
generateTXT(textmodifier: any, options?: Omit<TXTExportOptions, 'filename'>): string;
|
|
24
|
+
$generateTXT(textmodifier: any, options?: Omit<TXTExportOptions, 'filename'>): string;
|
|
25
25
|
/**
|
|
26
26
|
* Exports TXT content to a downloadable file
|
|
27
27
|
* @param textmodifier The textmodifier instance containing rendering data
|
|
28
28
|
* @param options Export options including filename
|
|
29
29
|
*/
|
|
30
|
-
saveTXT(textmodifier: any, options?: TXTExportOptions): void;
|
|
30
|
+
$saveTXT(textmodifier: any, options?: TXTExportOptions): void;
|
|
31
31
|
}
|
|
@@ -9,11 +9,11 @@ export declare class TXTFileHandler extends FileHandler {
|
|
|
9
9
|
* @param content The TXT content to save
|
|
10
10
|
* @param filename The filename to use for the download
|
|
11
11
|
*/
|
|
12
|
-
saveTXT(content: string, filename: string): void;
|
|
12
|
+
$saveTXT(content: string, filename: string): void;
|
|
13
13
|
/**
|
|
14
14
|
* Ensures filename has proper extension and is valid
|
|
15
15
|
* @param filename The filename to validate and fix
|
|
16
16
|
* @returns Valid filename with .txt extension
|
|
17
17
|
*/
|
|
18
|
-
private
|
|
18
|
+
private _ensureValidFilename;
|
|
19
19
|
}
|
|
@@ -13,22 +13,22 @@ export type MediaSource = HTMLCanvasElement | HTMLVideoElement;
|
|
|
13
13
|
* Can also be used as a standalone texture (without render target functionality).
|
|
14
14
|
*/
|
|
15
15
|
export declare class Framebuffer {
|
|
16
|
-
private
|
|
16
|
+
private _gl;
|
|
17
17
|
private _framebuffer;
|
|
18
18
|
private _texture;
|
|
19
19
|
private _width;
|
|
20
20
|
private _height;
|
|
21
|
-
private
|
|
22
|
-
private
|
|
21
|
+
private _options;
|
|
22
|
+
private _previousState;
|
|
23
23
|
private _pixels;
|
|
24
24
|
constructor(gl: WebGLRenderingContext, width: number, height?: number, options?: FramebufferOptions);
|
|
25
25
|
/**
|
|
26
26
|
* Execute a function with this framebuffer bound, then restore previous binding
|
|
27
27
|
*/
|
|
28
|
-
private
|
|
29
|
-
private
|
|
30
|
-
private
|
|
31
|
-
private
|
|
28
|
+
private _withFramebufferBound;
|
|
29
|
+
private _createTexture;
|
|
30
|
+
private _updateTextureSize;
|
|
31
|
+
private _attachTexture;
|
|
32
32
|
/**
|
|
33
33
|
* Update the framebuffer texture with canvas or video content
|
|
34
34
|
*/
|
|
@@ -75,7 +75,7 @@ export declare class Framebuffer {
|
|
|
75
75
|
* Dispose of WebGL resources used by this framebuffer.
|
|
76
76
|
* This method is idempotent and safe to call multiple times.
|
|
77
77
|
*/
|
|
78
|
-
dispose(): void;
|
|
78
|
+
$dispose(): void;
|
|
79
79
|
get framebuffer(): WebGLFramebuffer | null;
|
|
80
80
|
get texture(): WebGLTexture;
|
|
81
81
|
get width(): number;
|
|
@@ -4,24 +4,24 @@ import { Shader } from "./Shader";
|
|
|
4
4
|
* Core WebGL renderer that manages the WebGL context and provides high-level rendering operations
|
|
5
5
|
*/
|
|
6
6
|
export declare class GLRenderer {
|
|
7
|
-
private
|
|
8
|
-
private
|
|
9
|
-
private
|
|
10
|
-
private
|
|
11
|
-
private
|
|
12
|
-
private
|
|
13
|
-
private
|
|
14
|
-
private
|
|
15
|
-
private
|
|
16
|
-
private
|
|
17
|
-
private
|
|
18
|
-
private
|
|
19
|
-
private
|
|
7
|
+
private _gl;
|
|
8
|
+
private _imageShader;
|
|
9
|
+
private _solidColorShader;
|
|
10
|
+
private _currentShader;
|
|
11
|
+
private _rectangleGeometry;
|
|
12
|
+
private _lineGeometry;
|
|
13
|
+
private _currentFillColor;
|
|
14
|
+
private _fillMode;
|
|
15
|
+
private _currentStrokeColor;
|
|
16
|
+
private _currentStrokeWeight;
|
|
17
|
+
private _strokeMode;
|
|
18
|
+
private _currentRotation;
|
|
19
|
+
private _stateStack;
|
|
20
20
|
constructor(gl: WebGLRenderingContext | WebGL2RenderingContext);
|
|
21
21
|
/**
|
|
22
22
|
* Set the current shader
|
|
23
23
|
*/
|
|
24
|
-
shader(shader: Shader): void;
|
|
24
|
+
$shader(shader: Shader): void;
|
|
25
25
|
/**
|
|
26
26
|
* Sets the fill color for subsequent rendering operations
|
|
27
27
|
* @param r Red component *(0-255)*
|
|
@@ -29,7 +29,7 @@ export declare class GLRenderer {
|
|
|
29
29
|
* @param b Blue component *(0-255, optional)*
|
|
30
30
|
* @param a Alpha component *(0-255, optional)*
|
|
31
31
|
*/
|
|
32
|
-
fill(r: number, g?: number, b?: number, a?: number): void;
|
|
32
|
+
$fill(r: number, g?: number, b?: number, a?: number): void;
|
|
33
33
|
/**
|
|
34
34
|
* Sets the stroke color for subsequent rendering operations
|
|
35
35
|
* @param r Red component *(0-255)*
|
|
@@ -37,49 +37,49 @@ export declare class GLRenderer {
|
|
|
37
37
|
* @param b Blue component *(0-255, optional)*
|
|
38
38
|
* @param a Alpha component *(0-255, optional)*
|
|
39
39
|
*/
|
|
40
|
-
stroke(r: number, g?: number, b?: number, a?: number): void;
|
|
40
|
+
$stroke(r: number, g?: number, b?: number, a?: number): void;
|
|
41
41
|
/**
|
|
42
42
|
* Sets the stroke weight (thickness) for subsequent stroke operations
|
|
43
43
|
* @param weight The stroke thickness in pixels
|
|
44
44
|
*/
|
|
45
|
-
strokeWeight(weight: number): void;
|
|
45
|
+
$strokeWeight(weight: number): void;
|
|
46
46
|
/**
|
|
47
47
|
* Disables stroke rendering for subsequent operations
|
|
48
48
|
*/
|
|
49
|
-
noStroke(): void;
|
|
49
|
+
$noStroke(): void;
|
|
50
50
|
/**
|
|
51
51
|
* Disables fill rendering for subsequent operations
|
|
52
52
|
*/
|
|
53
|
-
noFill(): void;
|
|
53
|
+
$noFill(): void;
|
|
54
54
|
/**
|
|
55
55
|
* Sets the rotation angle for subsequent rendering operations
|
|
56
56
|
* @param degrees The rotation angle in degrees
|
|
57
57
|
*/
|
|
58
|
-
rotate(degrees: number): void;
|
|
58
|
+
$rotate(degrees: number): void;
|
|
59
59
|
/**
|
|
60
60
|
* Save the current rendering state (fill, stroke, etc.) to the state stack
|
|
61
61
|
*/
|
|
62
|
-
push(): void;
|
|
62
|
+
$push(): void;
|
|
63
63
|
/**
|
|
64
64
|
* Restore the most recently saved rendering state from the state stack
|
|
65
65
|
*/
|
|
66
|
-
pop(): void;
|
|
66
|
+
$pop(): void;
|
|
67
67
|
/**
|
|
68
68
|
* Reset frame-specific state - called automatically after each frame.
|
|
69
69
|
* Note: This does not reset fill/stroke state as that should persist
|
|
70
70
|
* across frames and be managed by push/pop or explicit calls.
|
|
71
71
|
*/
|
|
72
|
-
reset(): void;
|
|
73
|
-
createShader(vertexSource: string, fragmentSource: string): Shader;
|
|
74
|
-
createFilterShader(fragmentSource: string): Shader;
|
|
72
|
+
$reset(): void;
|
|
73
|
+
$createShader(vertexSource: string, fragmentSource: string): Shader;
|
|
74
|
+
$createFilterShader(fragmentSource: string): Shader;
|
|
75
75
|
/**
|
|
76
76
|
* Set a uniform value for the current shader
|
|
77
77
|
*/
|
|
78
|
-
setUniform(name: string, value: any): void;
|
|
78
|
+
$setUniform(name: string, value: any): void;
|
|
79
79
|
/**
|
|
80
80
|
* Draw a rectangle with the current fill and/or stroke settings
|
|
81
81
|
*/
|
|
82
|
-
rect(x: number, y: number, width: number, height: number): void;
|
|
82
|
+
$rect(x: number, y: number, width: number, height: number): void;
|
|
83
83
|
/**
|
|
84
84
|
* Draw a line from (x1, y1) to (x2, y2) with the current stroke settings.
|
|
85
85
|
* Lines only support stroke rendering - fill properties are ignored.
|
|
@@ -88,27 +88,27 @@ export declare class GLRenderer {
|
|
|
88
88
|
* @param x2 X-coordinate of the line end point
|
|
89
89
|
* @param y2 Y-coordinate of the line end point
|
|
90
90
|
*/
|
|
91
|
-
line(x1: number, y1: number, x2: number, y2: number): void;
|
|
91
|
+
$line(x1: number, y1: number, x2: number, y2: number): void;
|
|
92
92
|
/**
|
|
93
93
|
* Calculate rotation parameters for built-in shaders (NDC coordinates)
|
|
94
94
|
*/
|
|
95
|
-
private
|
|
95
|
+
private _calculateRotationParams;
|
|
96
96
|
/**
|
|
97
97
|
* Create a new framebuffer
|
|
98
98
|
*/
|
|
99
|
-
createFramebuffer(width: number, height: number, options?: FramebufferOptions): Framebuffer;
|
|
99
|
+
$createFramebuffer(width: number, height: number, options?: FramebufferOptions): Framebuffer;
|
|
100
100
|
/**
|
|
101
101
|
* Fill the current framebuffer with a solid color
|
|
102
102
|
*/
|
|
103
|
-
background(r: number, g?: number, b?: number, a?: number): void;
|
|
103
|
+
$background(r: number, g?: number, b?: number, a?: number): void;
|
|
104
104
|
/**
|
|
105
105
|
* Clear the current framebuffer
|
|
106
106
|
*/
|
|
107
|
-
clear(r?: number, g?: number, b?: number, a?: number): void;
|
|
107
|
+
$clear(r?: number, g?: number, b?: number, a?: number): void;
|
|
108
108
|
/**
|
|
109
109
|
* Ensure viewport matches canvas dimensions
|
|
110
110
|
*/
|
|
111
|
-
resetViewport(): void;
|
|
111
|
+
$resetViewport(): void;
|
|
112
112
|
/**
|
|
113
113
|
* Get the WebGL context
|
|
114
114
|
*/
|
|
@@ -117,9 +117,9 @@ export declare class GLRenderer {
|
|
|
117
117
|
* Dispose of all WebGL resources managed by this renderer.
|
|
118
118
|
* This method is idempotent and safe to call multiple times.
|
|
119
119
|
*/
|
|
120
|
-
dispose(): void;
|
|
120
|
+
$dispose(): void;
|
|
121
121
|
/**
|
|
122
122
|
* Render a framebuffer at a specific position with optional scaling
|
|
123
123
|
*/
|
|
124
|
-
image(source: Framebuffer, posX: number, posY: number, width?: number, height?: number): void;
|
|
124
|
+
$image(source: Framebuffer, posX: number, posY: number, width?: number, height?: number): void;
|
|
125
125
|
}
|
|
@@ -2,29 +2,29 @@
|
|
|
2
2
|
* Shader program wrapper with simplified uniform management
|
|
3
3
|
*/
|
|
4
4
|
export declare class Shader {
|
|
5
|
-
private
|
|
6
|
-
private
|
|
7
|
-
private
|
|
8
|
-
private
|
|
9
|
-
private
|
|
10
|
-
private
|
|
5
|
+
private _gl;
|
|
6
|
+
private _program;
|
|
7
|
+
private _uniformLocations;
|
|
8
|
+
private _uniformTypes;
|
|
9
|
+
private _textureUnitCounter;
|
|
10
|
+
private _maxTextureUnits;
|
|
11
11
|
constructor(gl: WebGLRenderingContext, vertexSource: string, fragmentSource: string);
|
|
12
|
-
private
|
|
13
|
-
private
|
|
14
|
-
private
|
|
12
|
+
private _cacheLocations;
|
|
13
|
+
private _createProgram;
|
|
14
|
+
private _createShader;
|
|
15
15
|
/**
|
|
16
16
|
* Use this shader program
|
|
17
17
|
*/
|
|
18
|
-
use(): void;
|
|
18
|
+
$use(): void;
|
|
19
19
|
/**
|
|
20
20
|
* Set a single uniform value with automatic texture unit management
|
|
21
21
|
*/
|
|
22
22
|
setUniform(name: string, value: any): void;
|
|
23
|
-
private
|
|
23
|
+
private _getNextTextureUnit;
|
|
24
24
|
/**
|
|
25
25
|
* Check if a uniform is an integer type
|
|
26
26
|
*/
|
|
27
|
-
private
|
|
27
|
+
private _isUniformInteger;
|
|
28
28
|
/**
|
|
29
29
|
* Get the WebGL program
|
|
30
30
|
*/
|
|
@@ -33,9 +33,9 @@ export declare class Shader {
|
|
|
33
33
|
* Dispose of WebGL resources used by this shader.
|
|
34
34
|
* This method is idempotent and safe to call multiple times.
|
|
35
35
|
*/
|
|
36
|
-
dispose(): void;
|
|
36
|
+
$dispose(): void;
|
|
37
37
|
/**
|
|
38
38
|
* Reset texture unit counter (useful when starting a new frame)
|
|
39
39
|
*/
|
|
40
|
-
|
|
40
|
+
private _resetTextureUnits;
|
|
41
41
|
}
|
|
@@ -2,39 +2,39 @@
|
|
|
2
2
|
* Base class for WebGL geometry rendering with shared vertex buffer management
|
|
3
3
|
*/
|
|
4
4
|
export declare abstract class BaseGeometry {
|
|
5
|
-
protected
|
|
6
|
-
protected
|
|
7
|
-
protected
|
|
8
|
-
private
|
|
5
|
+
protected _gl: WebGLRenderingContext;
|
|
6
|
+
protected _unitBuffer: WebGLBuffer | null;
|
|
7
|
+
protected _bytesPerVertex: number;
|
|
8
|
+
private _attribCache;
|
|
9
9
|
constructor(gl: WebGLRenderingContext);
|
|
10
10
|
/**
|
|
11
11
|
* Ensure the unit buffer is created and bound
|
|
12
12
|
*/
|
|
13
|
-
protected
|
|
13
|
+
protected _ensureUnitBuffer(): void;
|
|
14
14
|
/**
|
|
15
15
|
* Enable vertex attributes and return their locations
|
|
16
16
|
*/
|
|
17
|
-
protected
|
|
17
|
+
protected _enableAttribs(): {
|
|
18
18
|
positionLoc: number;
|
|
19
19
|
texLoc: number;
|
|
20
20
|
};
|
|
21
21
|
/**
|
|
22
22
|
* Disable vertex attributes
|
|
23
23
|
*/
|
|
24
|
-
protected
|
|
24
|
+
protected _disableAttribs(positionLoc: number, texLoc: number): void;
|
|
25
25
|
/**
|
|
26
26
|
* Convert screen coordinates to NDC (Normalized Device Coordinates)
|
|
27
27
|
*/
|
|
28
|
-
protected
|
|
28
|
+
protected _toNDC(x: number, y: number): {
|
|
29
29
|
nx: number;
|
|
30
30
|
ny: number;
|
|
31
31
|
};
|
|
32
32
|
/**
|
|
33
33
|
* Upload quad vertices to the buffer in NDC coordinates
|
|
34
34
|
*/
|
|
35
|
-
protected
|
|
35
|
+
protected _uploadQuadNDC(x1: number, y1: number, x2: number, y2: number): void;
|
|
36
36
|
/**
|
|
37
37
|
* Dispose of WebGL resources used by this geometry
|
|
38
38
|
*/
|
|
39
|
-
dispose(): void;
|
|
39
|
+
$dispose(): void;
|
|
40
40
|
}
|
|
@@ -7,5 +7,5 @@ export declare class Line extends BaseGeometry {
|
|
|
7
7
|
/**
|
|
8
8
|
* Draw a line from (x1, y1) to (x2, y2) with specified weight
|
|
9
9
|
*/
|
|
10
|
-
draw(x1: number, y1: number, x2: number, y2: number, weight: number): void;
|
|
10
|
+
$draw(x1: number, y1: number, x2: number, y2: number, weight: number): void;
|
|
11
11
|
}
|
|
@@ -7,9 +7,9 @@ export declare class Rectangle extends BaseGeometry {
|
|
|
7
7
|
/**
|
|
8
8
|
* Draw a filled rectangle
|
|
9
9
|
*/
|
|
10
|
-
drawFill(x: number, y: number, width: number, height: number): void;
|
|
10
|
+
$drawFill(x: number, y: number, width: number, height: number): void;
|
|
11
11
|
/**
|
|
12
12
|
* Draw a rectangle stroke (outline)
|
|
13
13
|
*/
|
|
14
|
-
drawStroke(x: number, y: number, width: number, height: number, weight: number): void;
|
|
14
|
+
$drawStroke(x: number, y: number, width: number, height: number, weight: number): void;
|
|
15
15
|
}
|