textmode.filters.js 1.2.3 → 1.2.4-beta.1

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 (35) hide show
  1. package/README.md +24 -1
  2. package/dist/textmode.filters.esm.js +1 -1
  3. package/dist/textmode.filters.umd.js +1 -1
  4. package/dist/types/builtins/catalog.d.ts +163 -0
  5. package/dist/types/builtins/color-adjustment/brightness.d.ts +28 -0
  6. package/dist/types/builtins/color-adjustment/contrast.d.ts +28 -0
  7. package/dist/types/builtins/color-adjustment/grayscale.d.ts +14 -0
  8. package/dist/types/builtins/color-adjustment/hueRotate.d.ts +30 -0
  9. package/dist/types/builtins/color-adjustment/invert.d.ts +1 -0
  10. package/dist/types/builtins/color-adjustment/posterize.d.ts +31 -0
  11. package/dist/types/builtins/color-adjustment/saturation.d.ts +28 -0
  12. package/dist/types/builtins/color-adjustment/sepia.d.ts +14 -0
  13. package/dist/types/builtins/color-adjustment/threshold.d.ts +14 -0
  14. package/dist/types/builtins/definition.d.ts +26 -0
  15. package/dist/types/builtins/distortion/chromaticAberration.d.ts +40 -0
  16. package/dist/types/builtins/distortion/gridDistortion.d.ts +101 -0
  17. package/dist/types/builtins/distortion/pixelate.d.ts +28 -0
  18. package/dist/types/builtins/stylization/bloom.d.ts +55 -0
  19. package/dist/types/builtins/stylization/crtMattias.d.ts +52 -0
  20. package/dist/types/builtins/stylization/filmGrain.d.ts +64 -0
  21. package/dist/types/builtins/stylization/glitch.d.ts +28 -0
  22. package/dist/types/builtins/stylization/scanlines.d.ts +75 -0
  23. package/dist/types/builtins/stylization/vignette.d.ts +52 -0
  24. package/dist/types/global.d.ts +6 -0
  25. package/dist/types/index.d.ts +26 -37
  26. package/dist/types/plugin/FiltersPlugin.d.ts +7 -0
  27. package/dist/types/public/augmentations.d.ts +18 -0
  28. package/dist/types/public/filter-types.d.ts +20 -0
  29. package/dist/types/runtime/FilterRegistry.d.ts +26 -0
  30. package/dist/types/runtime/FilterRenderer.d.ts +26 -0
  31. package/dist/types/runtime/FilterScheduler.d.ts +35 -0
  32. package/dist/types/runtime/TextmodeFilterManager.d.ts +52 -0
  33. package/dist/types/runtime/types.d.ts +22 -0
  34. package/package.json +24 -67
  35. package/dist/types/types.d.ts +0 -638
@@ -0,0 +1,101 @@
1
+ /**
2
+ * Configuration options for the `'gridDistortion'` filter.
3
+ *
4
+ * Distorts a monospaced character grid by varying the width and height
5
+ * of individual cells. Create wave effects, perspective distortions,
6
+ * or other grid warping effects by providing custom factor arrays.
7
+ *
8
+ * This filter is designed specifically for textmode.js grids, allowing
9
+ * you to create dynamic text distortion effects.
10
+ *
11
+ * @example
12
+ * {@includeCode ../../../examples/Distortion/gridDistortion/sketch.js}
13
+ *
14
+ * @category Distortion filters
15
+ *
16
+ * @see {@link https://code.textmode.art/api/textmode.filters.js/interfaces/GridDistortionOptions | GridDistortionOptions API reference}
17
+ */
18
+ export interface GridDistortionOptions {
19
+ /**
20
+ * Grid dimensions as `[columns, rows]`.
21
+ *
22
+ * Should match your textmode grid dimensions.
23
+ *
24
+ * Maximum value: `[128, 128]`
25
+ *
26
+ * @default [80.0, 40.0]
27
+ *
28
+ * @see {@link https://code.textmode.art/api/textmode.filters.js/interfaces/GridDistortionOptions#gridcelldimensions | GridDistortionOptions.gridCellDimensions API reference}
29
+ */
30
+ gridCellDimensions?: [number, number];
31
+ /**
32
+ * Grid size in pixels as `[width, height]`.
33
+ *
34
+ * Typically calculated as:
35
+ * `[t.grid.cols * t.grid.cellWidth, t.grid.rows * t.grid.cellHeight]`
36
+ *
37
+ * @default [640.0, 320.0]
38
+ *
39
+ * @see {@link https://code.textmode.art/api/textmode.filters.js/interfaces/GridDistortionOptions#gridpixeldimensions | GridDistortionOptions.gridPixelDimensions API reference}
40
+ */
41
+ gridPixelDimensions?: [number, number];
42
+ /**
43
+ * Grid offset in pixels as `[offsetX, offsetY]`.
44
+ *
45
+ * Use `[t.grid.offsetX, t.grid.offsetY]` to match your grid position.
46
+ *
47
+ * @default [0.0, 0.0]
48
+ *
49
+ * @see {@link https://code.textmode.art/api/textmode.filters.js/interfaces/GridDistortionOptions#gridoffsetdimensions | GridDistortionOptions.gridOffsetDimensions API reference}
50
+ */
51
+ gridOffsetDimensions?: [number, number];
52
+ /**
53
+ * Array of distortion values (0-1) for each column.
54
+ *
55
+ * Must contain at least as many elements as columns (max 128).
56
+ * Values control the relative width of each column:
57
+ * - `0.0` = minimum width
58
+ * - `0.5` = normal width
59
+ * - `1.0` = maximum width
60
+ *
61
+ * @default Array(128).fill(0.5)
62
+ *
63
+ * @see {@link https://code.textmode.art/api/textmode.filters.js/interfaces/GridDistortionOptions#widthfactors | GridDistortionOptions.widthFactors API reference}
64
+ */
65
+ widthFactors?: number[];
66
+ /**
67
+ * Array of distortion values (0-1) for each row.
68
+ *
69
+ * Must contain at least as many elements as rows (max 128).
70
+ * Values control the relative height of each row:
71
+ * - `0.0` = minimum height
72
+ * - `0.5` = normal height
73
+ * - `1.0` = maximum height
74
+ *
75
+ * @default Array(128).fill(0.5)
76
+ *
77
+ * @see {@link https://code.textmode.art/api/textmode.filters.js/interfaces/GridDistortionOptions#heightfactors | GridDistortionOptions.heightFactors API reference}
78
+ */
79
+ heightFactors?: number[];
80
+ /**
81
+ * Intensity multiplier for width distortion.
82
+ *
83
+ * Higher values create more dramatic width variations.
84
+ *
85
+ * @default 0.5
86
+ *
87
+ * @see {@link https://code.textmode.art/api/textmode.filters.js/interfaces/GridDistortionOptions#widthvariationscale | GridDistortionOptions.widthVariationScale API reference}
88
+ */
89
+ widthVariationScale?: number;
90
+ /**
91
+ * Intensity multiplier for height distortion.
92
+ *
93
+ * Higher values create more dramatic height variations.
94
+ *
95
+ * @default 0.5
96
+ *
97
+ * @see {@link https://code.textmode.art/api/textmode.filters.js/interfaces/GridDistortionOptions#heightvariationscale | GridDistortionOptions.heightVariationScale API reference}
98
+ */
99
+ heightVariationScale?: number;
100
+ }
101
+ export declare const gridDistortionFilter: import("../definition").BuiltinFilterDescriptor;
@@ -0,0 +1,28 @@
1
+ /**
2
+ * Configuration options for the `'pixelate'` filter.
3
+ *
4
+ * Reduces image resolution to create a mosaic/pixelated effect
5
+ * reminiscent of retro video games or censored content.
6
+ *
7
+ * @example
8
+ * {@includeCode ../../../examples/Distortion/pixelate/sketch.js}
9
+ *
10
+ * @category Distortion filters
11
+ *
12
+ * @see {@link https://code.textmode.art/api/textmode.filters.js/interfaces/PixelateOptions | PixelateOptions API reference}
13
+ */
14
+ export interface PixelateOptions {
15
+ /**
16
+ * Size of each pixel block in pixels.
17
+ *
18
+ * Larger values create bigger, more visible pixels.
19
+ *
20
+ * Minimum value: `1.0`
21
+ *
22
+ * @default 4.0
23
+ *
24
+ * @see {@link https://code.textmode.art/api/textmode.filters.js/interfaces/PixelateOptions#pixelsize | PixelateOptions.pixelSize API reference}
25
+ */
26
+ pixelSize?: number;
27
+ }
28
+ export declare const pixelateFilter: import("../definition").BuiltinFilterDescriptor;
@@ -0,0 +1,55 @@
1
+ /**
2
+ * Configuration options for the `'bloom'` filter.
3
+ *
4
+ * Creates a glow effect around bright areas of the image. Pixels above
5
+ * the brightness threshold emit a soft glow that spreads outward.
6
+ * Perfect for creating neon, glowing text, or dreamy effects.
7
+ *
8
+ * @example
9
+ * {@includeCode ../../../examples/Stylization/bloom/sketch.js}
10
+ *
11
+ * @category Stylization filters
12
+ *
13
+ * @see {@link https://code.textmode.art/api/textmode.filters.js/interfaces/BloomOptions | BloomOptions API reference}
14
+ */
15
+ export interface BloomOptions {
16
+ /**
17
+ * Brightness level above which pixels will glow.
18
+ *
19
+ * - `0.0` = everything glows
20
+ * - `0.5` = mid-brightness and above glows (default)
21
+ * - `1.0` = only the brightest pixels glow
22
+ *
23
+ * @default 0.5
24
+ *
25
+ * @see {@link https://code.textmode.art/api/textmode.filters.js/interfaces/BloomOptions#threshold | BloomOptions.threshold API reference}
26
+ */
27
+ threshold?: number;
28
+ /**
29
+ * Strength of the glow effect.
30
+ *
31
+ * - `0.0` = no visible glow
32
+ * - `1.0` = normal glow intensity (default)
33
+ * - `2.0+` = very bright, intense glow
34
+ *
35
+ * @default 1.0
36
+ *
37
+ * @see {@link https://code.textmode.art/api/textmode.filters.js/interfaces/BloomOptions#intensity | BloomOptions.intensity API reference}
38
+ */
39
+ intensity?: number;
40
+ /**
41
+ * Size of the glow spread in pixels.
42
+ *
43
+ * Larger values create a wider, softer glow.
44
+ *
45
+ * - `1.0` = tight glow
46
+ * - `4.0` = moderate spread (default)
47
+ * - `10.0+` = wide, diffuse glow
48
+ *
49
+ * @default 4.0
50
+ *
51
+ * @see {@link https://code.textmode.art/api/textmode.filters.js/interfaces/BloomOptions#radius | BloomOptions.radius API reference}
52
+ */
53
+ radius?: number;
54
+ }
55
+ export declare const bloomFilter: import("../definition").BuiltinFilterDescriptor;
@@ -0,0 +1,52 @@
1
+ /**
2
+ * Configuration options for the `'crtMattias'` filter.
3
+ *
4
+ * CRT monitor emulation effect with screen curvature, animated scanlines,
5
+ * blur, vignette, and film grain noise. Based on Mattias Gustavsson's
6
+ * classic CRT shader.
7
+ *
8
+ * @example
9
+ * {@includeCode ../../../examples/Stylization/crtMattias/sketch.js}
10
+ *
11
+ * @see {@link https://github.com/libretro/glsl-shaders/blob/master/crt/shaders/crt-mattias.glsl | Original shader by Mattias Gustavsson}
12
+ *
13
+ * @category Stylization filters
14
+ *
15
+ * @see {@link https://code.textmode.art/api/textmode.filters.js/interfaces/CrtMattiasOptions | CrtMattiasOptions API reference}
16
+ */
17
+ export interface CrtMattiasOptions {
18
+ /**
19
+ * Amount of screen curvature/barrel distortion.
20
+ *
21
+ * - `0.0` = flat screen
22
+ * - `0.5` = moderate curvature (default)
23
+ * - `1.0` = maximum curvature
24
+ *
25
+ * @default 0.5
26
+ *
27
+ * @see {@link https://code.textmode.art/api/textmode.filters.js/interfaces/CrtMattiasOptions#curvature | CrtMattiasOptions.curvature API reference}
28
+ */
29
+ curvature?: number;
30
+ /**
31
+ * Speed of the scrolling scanline effect.
32
+ *
33
+ * Higher values make the scanline crawl faster.
34
+ *
35
+ * @default 1.0
36
+ *
37
+ * @see {@link https://code.textmode.art/api/textmode.filters.js/interfaces/CrtMattiasOptions#scanspeed | CrtMattiasOptions.scanSpeed API reference}
38
+ */
39
+ scanSpeed?: number;
40
+ /**
41
+ * Animation time parameter.
42
+ *
43
+ * Increment this value each frame to animate the effect.
44
+ * Typically use elapsed time in seconds or frame count.
45
+ *
46
+ * @default 0.0
47
+ *
48
+ * @see {@link https://code.textmode.art/api/textmode.filters.js/interfaces/CrtMattiasOptions#time | CrtMattiasOptions.time API reference}
49
+ */
50
+ time?: number;
51
+ }
52
+ export declare const crtMattiasFilter: import("../definition").BuiltinFilterDescriptor;
@@ -0,0 +1,64 @@
1
+ /**
2
+ * Configuration options for the `'filmGrain'` filter.
3
+ *
4
+ * Adds an animated film grain/noise texture overlay to simulate vintage
5
+ * film stock or analog video. The multi-layered noise creates an organic,
6
+ * moving grain pattern that's less visible in darker areas, mimicking
7
+ * real film characteristics.
8
+ *
9
+ * @example
10
+ * {@includeCode ../../../examples/Stylization/filmGrain/sketch.js}
11
+ *
12
+ * @category Stylization filters
13
+ *
14
+ * @see {@link https://code.textmode.art/api/textmode.filters.js/interfaces/FilmGrainOptions | FilmGrainOptions API reference}
15
+ */
16
+ export interface FilmGrainOptions {
17
+ /**
18
+ * Strength of the grain effect.
19
+ *
20
+ * - `0.0` = no grain
21
+ * - `0.2` = subtle grain (default)
22
+ * - `0.5+` = heavy, noticeable grain
23
+ *
24
+ * @default 0.2
25
+ *
26
+ * @see {@link https://code.textmode.art/api/textmode.filters.js/interfaces/FilmGrainOptions#intensity | FilmGrainOptions.intensity API reference}
27
+ */
28
+ intensity?: number;
29
+ /**
30
+ * Size of grain particles.
31
+ *
32
+ * - `1.0` = fine grain
33
+ * - `2.0` = medium grain (default)
34
+ * - `5.0+` = coarse, chunky grain
35
+ *
36
+ * @default 2.0
37
+ *
38
+ * @see {@link https://code.textmode.art/api/textmode.filters.js/interfaces/FilmGrainOptions#size | FilmGrainOptions.size API reference}
39
+ */
40
+ size?: number;
41
+ /**
42
+ * Animation speed of the grain.
43
+ *
44
+ * - `0.0` = static grain (not recommended)
45
+ * - `1.0` = normal animation speed (default)
46
+ * - `2.0+` = fast, flickering grain
47
+ *
48
+ * @default 1.0
49
+ *
50
+ * @see {@link https://code.textmode.art/api/textmode.filters.js/interfaces/FilmGrainOptions#speed | FilmGrainOptions.speed API reference}
51
+ */
52
+ speed?: number;
53
+ /**
54
+ * Animation time parameter.
55
+ *
56
+ * Increment this value each frame to animate the grain effect.
57
+ *
58
+ * @default 0.0
59
+ *
60
+ * @see {@link https://code.textmode.art/api/textmode.filters.js/interfaces/FilmGrainOptions#time | FilmGrainOptions.time API reference}
61
+ */
62
+ time?: number;
63
+ }
64
+ export declare const filmGrainFilter: import("../definition").BuiltinFilterDescriptor;
@@ -0,0 +1,28 @@
1
+ /**
2
+ * Configuration options for the `'glitch'` filter.
3
+ *
4
+ * Digital glitch effect with RGB channel separation, scanlines, and noise.
5
+ * Creates a corrupted/broken digital signal aesthetic.
6
+ *
7
+ * @example
8
+ * {@includeCode ../../../examples/Stylization/glitch/sketch.js}
9
+ *
10
+ * @category Stylization filters
11
+ *
12
+ * @see {@link https://code.textmode.art/api/textmode.filters.js/interfaces/GlitchOptions | GlitchOptions API reference}
13
+ */
14
+ export interface GlitchOptions {
15
+ /**
16
+ * Glitch intensity.
17
+ *
18
+ * - `0.0` = no glitch effect
19
+ * - `0.5` = subtle glitching
20
+ * - `1.0+` = intense, chaotic glitching
21
+ *
22
+ * @default 0.0
23
+ *
24
+ * @see {@link https://code.textmode.art/api/textmode.filters.js/interfaces/GlitchOptions#amount | GlitchOptions.amount API reference}
25
+ */
26
+ amount?: number;
27
+ }
28
+ export declare const glitchFilter: import("../definition").BuiltinFilterDescriptor;
@@ -0,0 +1,75 @@
1
+ /**
2
+ * Configuration options for the `'scanlines'` filter.
3
+ *
4
+ * A standalone scanline effect that adds horizontal lines to the image
5
+ * to simulate a CRT display or old monitor. More customizable than
6
+ * the scanlines in crtMattias.
7
+ *
8
+ * @example
9
+ * {@includeCode ../../../examples/Stylization/scanlines/sketch.js}
10
+ *
11
+ * @category Stylization filters
12
+ *
13
+ * @see {@link https://code.textmode.art/api/textmode.filters.js/interfaces/ScanlinesOptions | ScanlinesOptions API reference}
14
+ */
15
+ export interface ScanlinesOptions {
16
+ /**
17
+ * Number of scanlines across the image height.
18
+ *
19
+ * Higher values create finer, more dense lines.
20
+ *
21
+ * Minimum value: `10.0`
22
+ *
23
+ * @default 300.0
24
+ *
25
+ * @see {@link https://code.textmode.art/api/textmode.filters.js/interfaces/ScanlinesOptions#count | ScanlinesOptions.count API reference}
26
+ */
27
+ count?: number;
28
+ /**
29
+ * Width of the lines relative to the spacing.
30
+ *
31
+ * - `0.0` = very thin lines (mostly transparent)
32
+ * - `0.5` = equal line and gap width
33
+ * - `1.0` = solid (no gaps)
34
+ *
35
+ * @default 0.5
36
+ *
37
+ * @see {@link https://code.textmode.art/api/textmode.filters.js/interfaces/ScanlinesOptions#linewidth | ScanlinesOptions.lineWidth API reference}
38
+ */
39
+ lineWidth?: number;
40
+ /**
41
+ * Opacity/darkness of the scanlines.
42
+ *
43
+ * - `0.0` = invisible lines
44
+ * - `0.75` = clearly visible (default)
45
+ * - `1.0` = maximum darkness (solid black lines)
46
+ *
47
+ * @default 0.75
48
+ *
49
+ * @see {@link https://code.textmode.art/api/textmode.filters.js/interfaces/ScanlinesOptions#intensity | ScanlinesOptions.intensity API reference}
50
+ */
51
+ intensity?: number;
52
+ /**
53
+ * Scrolling speed of the lines.
54
+ *
55
+ * - `0.0` = static lines
56
+ * - `1.0` = normal scrolling speed
57
+ * - Higher values = faster scrolling
58
+ *
59
+ * @default 1.0
60
+ *
61
+ * @see {@link https://code.textmode.art/api/textmode.filters.js/interfaces/ScanlinesOptions#speed | ScanlinesOptions.speed API reference}
62
+ */
63
+ speed?: number;
64
+ /**
65
+ * Animation time parameter.
66
+ *
67
+ * Increment this value each frame to animate the scrolling effect.
68
+ *
69
+ * @default 0.0
70
+ *
71
+ * @see {@link https://code.textmode.art/api/textmode.filters.js/interfaces/ScanlinesOptions#time | ScanlinesOptions.time API reference}
72
+ */
73
+ time?: number;
74
+ }
75
+ export declare const scanlinesFilter: import("../definition").BuiltinFilterDescriptor;
@@ -0,0 +1,52 @@
1
+ /**
2
+ * Configuration options for the `'vignette'` filter.
3
+ *
4
+ * Darkens the edges and corners of the image, drawing focus to the center.
5
+ * Useful for creating a cinematic look or highlighting central content.
6
+ *
7
+ * @example
8
+ * {@includeCode ../../../examples/Stylization/vignette/sketch.js}
9
+ *
10
+ * @category Stylization filters
11
+ *
12
+ * @see {@link https://code.textmode.art/api/textmode.filters.js/interfaces/VignetteOptions | VignetteOptions API reference}
13
+ */
14
+ export interface VignetteOptions {
15
+ /**
16
+ * Intensity of the darkening effect.
17
+ *
18
+ * - `0.0` = no vignette
19
+ * - `0.5` = moderate vignette (default)
20
+ * - `1.0` = very dark edges
21
+ *
22
+ * @default 0.5
23
+ *
24
+ * @see {@link https://code.textmode.art/api/textmode.filters.js/interfaces/VignetteOptions#amount | VignetteOptions.amount API reference}
25
+ */
26
+ amount?: number;
27
+ /**
28
+ * Falloff gradient softness.
29
+ *
30
+ * - `0.0` = hard edge (sharp transition)
31
+ * - `0.5` = moderate gradient (default)
32
+ * - `1.0` = very soft, gradual falloff
33
+ *
34
+ * @default 0.5
35
+ *
36
+ * @see {@link https://code.textmode.art/api/textmode.filters.js/interfaces/VignetteOptions#softness | VignetteOptions.softness API reference}
37
+ */
38
+ softness?: number;
39
+ /**
40
+ * Shape of the vignette.
41
+ *
42
+ * - `0.0` = rectangular (follows screen edges)
43
+ * - `0.5` = rounded rectangle (default)
44
+ * - `1.0` = circular/elliptical
45
+ *
46
+ * @default 0.5
47
+ *
48
+ * @see {@link https://code.textmode.art/api/textmode.filters.js/interfaces/VignetteOptions#roundness | VignetteOptions.roundness API reference}
49
+ */
50
+ roundness?: number;
51
+ }
52
+ export declare const vignetteFilter: import("../definition").BuiltinFilterDescriptor;
@@ -0,0 +1,6 @@
1
+ import type { TextmodePlugin } from 'textmode.js';
2
+ declare global {
3
+ interface Window {
4
+ FiltersPlugin?: TextmodePlugin;
5
+ }
6
+ }
@@ -1,40 +1,29 @@
1
1
  /**
2
2
  * @packageDocumentation
3
- *
4
- * Apply GPU-accelerated image filters to finished textmode.js scenes.
5
- *
6
- * Add {@link FiltersPlugin} to a sketch to register the built-in WebGL2
7
- * effects. Use the option interfaces below to configure a filter when adding
8
- * it to a layer, the composited scene, or the final presentation stage.
9
- *
10
- * ## Choose a filter
11
- *
12
- * **Color adjustment** changes brightness, contrast, saturation, hue, and
13
- * posterization. **Distortion** changes pixels, color channels, or grid
14
- * geometry. **Stylization** adds glitch, CRT, scanlines, vignette, bloom, and
15
- * film grain treatments.
16
- *
17
- * Start with {@link FiltersPlugin}, then read the
18
- * [Filters guide](/docs/filters) for scopes and workflows.
3
+ * Complete optional filter system for textmode.js, including 18 setup-compiled GPU effects,
4
+ * custom registration, layer/global/final queues, and automatic resource cleanup.
19
5
  */
20
- import type { TextmodePlugin } from 'textmode.js';
21
- export type { BrightnessOptions, ContrastOptions, SaturationOptions, HueRotateOptions, PosterizeOptions, ChromaticAberrationOptions, PixelateOptions, GridDistortionOptions, GlitchOptions, CrtMattiasOptions, ScanlinesOptions, VignetteOptions, BloomOptions, FilmGrainOptions, } from './types';
22
- /**
23
- * GPU-accelerated image filters plugin for textmode.js.
24
- *
25
- * Add this plugin to your textmode.js instance to enable additional customizable
26
- * visual effects that run entirely on the GPU via WebGL2 fragment shaders.
27
- *
28
- * @category Workflow
29
- *
30
- * @example
31
- * {@includeCode ../examples/ColorAdjustment/brightness/sketch.js}
32
- *
33
- * @see {@link https://code.textmode.art/api/textmode.filters.js/variables/FiltersPlugin | FiltersPlugin API reference}
34
- */
35
- export declare const FiltersPlugin: TextmodePlugin;
36
- declare global {
37
- interface Window {
38
- FiltersPlugin?: TextmodePlugin;
39
- }
40
- }
6
+ import './public/augmentations';
7
+ import './global';
8
+ export { FiltersPlugin } from './plugin/FiltersPlugin';
9
+ export { TextmodeFilterManager } from './runtime/TextmodeFilterManager';
10
+ export type { TextmodeFilterShader, TextmodeFilterUniformDefinitions } from './public/filter-types';
11
+ export type { FilterName } from './public/filter-types';
12
+ export type { BuiltInFilterName, BuiltInFilterParameterMap } from './builtins/catalog';
13
+ export type { BloomOptions } from './builtins/stylization/bloom';
14
+ export type { BrightnessOptions } from './builtins/color-adjustment/brightness';
15
+ export type { ChromaticAberrationOptions } from './builtins/distortion/chromaticAberration';
16
+ export type { ContrastOptions } from './builtins/color-adjustment/contrast';
17
+ export type { CrtMattiasOptions } from './builtins/stylization/crtMattias';
18
+ export type { FilmGrainOptions } from './builtins/stylization/filmGrain';
19
+ export type { GlitchOptions } from './builtins/stylization/glitch';
20
+ export type { GrayscaleOptions } from './builtins/color-adjustment/grayscale';
21
+ export type { GridDistortionOptions } from './builtins/distortion/gridDistortion';
22
+ export type { HueRotateOptions } from './builtins/color-adjustment/hueRotate';
23
+ export type { PixelateOptions } from './builtins/distortion/pixelate';
24
+ export type { PosterizeOptions } from './builtins/color-adjustment/posterize';
25
+ export type { SaturationOptions } from './builtins/color-adjustment/saturation';
26
+ export type { ScanlinesOptions } from './builtins/stylization/scanlines';
27
+ export type { SepiaOptions } from './builtins/color-adjustment/sepia';
28
+ export type { ThresholdOptions } from './builtins/color-adjustment/threshold';
29
+ export type { VignetteOptions } from './builtins/stylization/vignette';
@@ -0,0 +1,7 @@
1
+ import type { TextmodePlugin } from 'textmode.js';
2
+ /**
3
+ * GPU-accelerated filters plugin. Installing it adds the complete 18-filter workflow to one Textmodifier.
4
+ *
5
+ * @see {@link https://code.textmode.art/api/textmode.filters.js/variables/FiltersPlugin | FiltersPlugin API reference}
6
+ */
7
+ export declare const FiltersPlugin: TextmodePlugin;
@@ -0,0 +1,18 @@
1
+ import 'textmode.js';
2
+ import type { BuiltInFilterName, BuiltInFilterParameterMap } from '../builtins/catalog';
3
+ import type { TextmodeFilterManager } from '../runtime/TextmodeFilterManager';
4
+ type FilterArguments<TName extends string> = TName extends BuiltInFilterName ? [params?: BuiltInFilterParameterMap[TName]] : [params?: unknown];
5
+ declare module 'textmode.js' {
6
+ interface Textmodifier {
7
+ filter<TName extends string>(name: TName, ...args: FilterArguments<TName>): void;
8
+ readonly filters: TextmodeFilterManager;
9
+ finalDraw(callback: () => void): void;
10
+ }
11
+ interface TextmodeLayer {
12
+ filter<TName extends string>(name: TName, ...args: FilterArguments<TName>): void;
13
+ }
14
+ interface TextmodeLayerManager {
15
+ readonly filters: TextmodeFilterManager;
16
+ }
17
+ }
18
+ export {};
@@ -0,0 +1,20 @@
1
+ import type { TextmodeShader, TextmodeUniformValue } from 'textmode.js';
2
+ import type { BuiltInFilterName } from '../builtins/catalog';
3
+ /**
4
+ * Uniform declarations for a custom filter, mapping GLSL names to public parameter names and defaults.
5
+ *
6
+ * @see {@link https://code.textmode.art/api/textmode.filters.js/type-aliases/TextmodeFilterUniformDefinitions | TextmodeFilterUniformDefinitions API reference}
7
+ */
8
+ export type TextmodeFilterUniformDefinitions = Record<string, readonly [paramName: string, defaultValue: TextmodeUniformValue]>;
9
+ /**
10
+ * A precompiled textmode shader, inline fragment source, or shader URL accepted by custom registration.
11
+ *
12
+ * @see {@link https://code.textmode.art/api/textmode.filters.js/type-aliases/TextmodeFilterShader | TextmodeFilterShader API reference}
13
+ */
14
+ export type TextmodeFilterShader = TextmodeShader | string;
15
+ /**
16
+ * Built-in names retain completion while arbitrary custom names remain valid.
17
+ *
18
+ * @see {@link https://code.textmode.art/api/textmode.filters.js/type-aliases/FilterName | FilterName API reference}
19
+ */
20
+ export type FilterName = BuiltInFilterName | (string & {});
@@ -0,0 +1,26 @@
1
+ import type { Textmodifier } from 'textmode.js';
2
+ import type { BuiltinFilterDescriptor } from '../builtins/definition';
3
+ import type { NormalizedFilterDescriptor } from './types';
4
+ import type { TextmodeFilterShader, TextmodeFilterUniformDefinitions } from '../public/filter-types';
5
+ /**
6
+ * Owns filter definitions, shader compilation, atomic replacement, lookup, and disposal.
7
+ *
8
+ * Bundled sources compile during {@link initializeBuiltins}; custom string sources compile before the
9
+ * registration promise resolves. Precompiled shaders are accepted without recompilation and owned
10
+ * (disposed on replacement, unregister, or registry disposal).
11
+ */
12
+ export declare class FilterRegistry {
13
+ private readonly _textmodifier;
14
+ private readonly _vertexSource;
15
+ private readonly _descriptors;
16
+ private _disposed;
17
+ constructor(textmodifier: Textmodifier, vertexSource: string, catalog: readonly BuiltinFilterDescriptor[]);
18
+ has(id: string): boolean;
19
+ get(id: string): NormalizedFilterDescriptor | undefined;
20
+ register(id: string, shader: TextmodeFilterShader, uniforms: TextmodeFilterUniformDefinitions): Promise<void>;
21
+ unregister(id: string): boolean;
22
+ initializeBuiltins(): Promise<void>;
23
+ dispose(): void;
24
+ private _replace;
25
+ private _assertLive;
26
+ }
@@ -0,0 +1,26 @@
1
+ import type { TextmodeFramebuffer, TextmodeLayer, Textmodifier } from 'textmode.js';
2
+ import type { ResolvedFilterPass } from './types';
3
+ /**
4
+ * GPU pass and resource module: uniform resolution, scratch framebuffer pools, ping-pong target
5
+ * selection, and exception-safe pass execution. Owns the shared filter vertex source and all
6
+ * scratch framebuffers allocated for layers and the composite pipeline.
7
+ */
8
+ export declare class FilterRenderer {
9
+ private readonly _textmodifier;
10
+ private readonly _vertexSource;
11
+ private _layerPools;
12
+ private readonly _pools;
13
+ private _compositePool?;
14
+ constructor(textmodifier: Textmodifier);
15
+ get vertexSource(): string;
16
+ applyLayer(layer: TextmodeLayer, input: TextmodeFramebuffer, passes: readonly ResolvedFilterPass[]): TextmodeFramebuffer;
17
+ applyComposite(input: TextmodeFramebuffer, passes: readonly ResolvedFilterPass[]): TextmodeFramebuffer;
18
+ disposeLayer(layer: TextmodeLayer): void;
19
+ dispose(): void;
20
+ private _apply;
21
+ private _renderPass;
22
+ private _resolveUniforms;
23
+ private _createPool;
24
+ private _resizePool;
25
+ private _disposePool;
26
+ }