textmode.filters.js 1.2.3 → 1.2.4
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 +21 -1
- package/dist/textmode.filters.esm.js +1 -1
- package/dist/textmode.filters.umd.js +1 -1
- package/dist/types/builtins/catalog.d.ts +167 -0
- package/dist/types/builtins/color-adjustment/brightness.d.ts +28 -0
- package/dist/types/builtins/color-adjustment/contrast.d.ts +28 -0
- package/dist/types/builtins/color-adjustment/grayscale.d.ts +16 -0
- package/dist/types/builtins/color-adjustment/hueRotate.d.ts +30 -0
- package/dist/types/builtins/color-adjustment/invert.d.ts +1 -0
- package/dist/types/builtins/color-adjustment/posterize.d.ts +31 -0
- package/dist/types/builtins/color-adjustment/saturation.d.ts +28 -0
- package/dist/types/builtins/color-adjustment/sepia.d.ts +16 -0
- package/dist/types/builtins/color-adjustment/threshold.d.ts +16 -0
- package/dist/types/builtins/definition.d.ts +26 -0
- package/dist/types/builtins/distortion/chromaticAberration.d.ts +40 -0
- package/dist/types/builtins/distortion/gridDistortion.d.ts +101 -0
- package/dist/types/builtins/distortion/pixelate.d.ts +28 -0
- package/dist/types/builtins/stylization/bloom.d.ts +55 -0
- package/dist/types/builtins/stylization/crtMattias.d.ts +52 -0
- package/dist/types/builtins/stylization/filmGrain.d.ts +64 -0
- package/dist/types/builtins/stylization/glitch.d.ts +28 -0
- package/dist/types/builtins/stylization/scanlines.d.ts +75 -0
- package/dist/types/builtins/stylization/vignette.d.ts +52 -0
- package/dist/types/index.d.ts +41 -24
- package/dist/types/plugin/FiltersPlugin.d.ts +9 -0
- package/dist/types/public/augmentations.d.ts +15 -0
- package/dist/types/public/filter-types.d.ts +26 -0
- package/dist/types/runtime/FilterRegistry.d.ts +26 -0
- package/dist/types/runtime/FilterRenderer.d.ts +26 -0
- package/dist/types/runtime/FilterScheduler.d.ts +35 -0
- package/dist/types/runtime/TextmodeFilterManager.d.ts +54 -0
- package/dist/types/runtime/types.d.ts +22 -0
- package/package.json +24 -67
- package/dist/types/types.d.ts +0 -638
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Configuration options for the `'chromaticAberration'` filter.
|
|
3
|
+
*
|
|
4
|
+
* RGB color channel separation effect that simulates lens distortion
|
|
5
|
+
* found in cheap cameras or creates stylized glitch aesthetics.
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* {@includeCode ../../../examples/Distortion/chromaticAberration/sketch.js}
|
|
9
|
+
*
|
|
10
|
+
* @category Distortion filters
|
|
11
|
+
*
|
|
12
|
+
* @see {@link https://code.textmode.art/api/textmode.filters.js/interfaces/ChromaticAberrationOptions | ChromaticAberrationOptions API reference}
|
|
13
|
+
*/
|
|
14
|
+
export interface ChromaticAberrationOptions {
|
|
15
|
+
/**
|
|
16
|
+
* Offset amount in pixels.
|
|
17
|
+
*
|
|
18
|
+
* Controls how far the red and blue channels are separated from green.
|
|
19
|
+
*
|
|
20
|
+
* @default 5.0
|
|
21
|
+
*
|
|
22
|
+
* @see {@link https://code.textmode.art/api/textmode.filters.js/interfaces/ChromaticAberrationOptions#amount | ChromaticAberrationOptions.amount API reference}
|
|
23
|
+
*/
|
|
24
|
+
amount?: number;
|
|
25
|
+
/**
|
|
26
|
+
* Direction of the color separation as `[x, y]`.
|
|
27
|
+
*
|
|
28
|
+
* - `[1, 0]` = horizontal separation
|
|
29
|
+
* - `[0, 1]` = vertical separation
|
|
30
|
+
* - `[1, 1]` = diagonal separation
|
|
31
|
+
*
|
|
32
|
+
* The vector is normalized internally, so `[2, 0]` is the same as `[1, 0]`.
|
|
33
|
+
*
|
|
34
|
+
* @default [1.0, 0.0]
|
|
35
|
+
*
|
|
36
|
+
* @see {@link https://code.textmode.art/api/textmode.filters.js/interfaces/ChromaticAberrationOptions#direction | ChromaticAberrationOptions.direction API reference}
|
|
37
|
+
*/
|
|
38
|
+
direction?: [number, number];
|
|
39
|
+
}
|
|
40
|
+
export declare const chromaticAberrationFilter: import("../definition").BuiltinFilterDescriptor;
|
|
@@ -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;
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,38 +1,55 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @packageDocumentation
|
|
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.
|
|
3
5
|
*
|
|
4
|
-
*
|
|
6
|
+
* @categoryDescription Workflow
|
|
7
|
+
* The plugin that installs the filter system on a textmode.js sketch.
|
|
5
8
|
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
* it to a layer, the composited scene, or the final presentation stage.
|
|
9
|
+
* @categoryDescription Filter management
|
|
10
|
+
* The runtime that owns filter registration, queues, GPU resources, and cleanup.
|
|
9
11
|
*
|
|
10
|
-
*
|
|
12
|
+
* @categoryDescription Built-in filters
|
|
13
|
+
* The shipped filter names and their parameter types.
|
|
11
14
|
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
* geometry. **Stylization** adds glitch, CRT, scanlines, vignette, bloom, and
|
|
15
|
-
* film grain treatments.
|
|
15
|
+
* @categoryDescription Custom filters
|
|
16
|
+
* Types used when registering bespoke GPU filters on the manager.
|
|
16
17
|
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
*/
|
|
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.
|
|
18
|
+
* @categoryDescription Color adjustment filters
|
|
19
|
+
* Configuration options for the bundled color-adjustment effects.
|
|
24
20
|
*
|
|
25
|
-
*
|
|
26
|
-
*
|
|
21
|
+
* @categoryDescription Distortion filters
|
|
22
|
+
* Configuration options for the bundled distortion effects.
|
|
27
23
|
*
|
|
28
|
-
* @
|
|
24
|
+
* @categoryDescription Stylization filters
|
|
25
|
+
* Configuration options for the bundled stylization effects.
|
|
29
26
|
*
|
|
30
|
-
* @
|
|
31
|
-
* {@includeCode ../examples/ColorAdjustment/brightness/sketch.js}
|
|
32
|
-
*
|
|
33
|
-
* @see {@link https://code.textmode.art/api/textmode.filters.js/variables/FiltersPlugin | FiltersPlugin API reference}
|
|
27
|
+
* @showCategories
|
|
34
28
|
*/
|
|
35
|
-
|
|
29
|
+
import './public/augmentations';
|
|
30
|
+
export { FiltersPlugin } from './plugin/FiltersPlugin';
|
|
31
|
+
export { TextmodeFilterManager } from './runtime/TextmodeFilterManager';
|
|
32
|
+
export type { TextmodeFilterShader, TextmodeFilterUniformDefinitions } from './public/filter-types';
|
|
33
|
+
export type { FilterName } from './public/filter-types';
|
|
34
|
+
export type { BuiltInFilterName, BuiltInFilterParameterMap } from './builtins/catalog';
|
|
35
|
+
export type { BloomOptions } from './builtins/stylization/bloom';
|
|
36
|
+
export type { BrightnessOptions } from './builtins/color-adjustment/brightness';
|
|
37
|
+
export type { ChromaticAberrationOptions } from './builtins/distortion/chromaticAberration';
|
|
38
|
+
export type { ContrastOptions } from './builtins/color-adjustment/contrast';
|
|
39
|
+
export type { CrtMattiasOptions } from './builtins/stylization/crtMattias';
|
|
40
|
+
export type { FilmGrainOptions } from './builtins/stylization/filmGrain';
|
|
41
|
+
export type { GlitchOptions } from './builtins/stylization/glitch';
|
|
42
|
+
export type { GrayscaleOptions } from './builtins/color-adjustment/grayscale';
|
|
43
|
+
export type { GridDistortionOptions } from './builtins/distortion/gridDistortion';
|
|
44
|
+
export type { HueRotateOptions } from './builtins/color-adjustment/hueRotate';
|
|
45
|
+
export type { PixelateOptions } from './builtins/distortion/pixelate';
|
|
46
|
+
export type { PosterizeOptions } from './builtins/color-adjustment/posterize';
|
|
47
|
+
export type { SaturationOptions } from './builtins/color-adjustment/saturation';
|
|
48
|
+
export type { ScanlinesOptions } from './builtins/stylization/scanlines';
|
|
49
|
+
export type { SepiaOptions } from './builtins/color-adjustment/sepia';
|
|
50
|
+
export type { ThresholdOptions } from './builtins/color-adjustment/threshold';
|
|
51
|
+
export type { VignetteOptions } from './builtins/stylization/vignette';
|
|
52
|
+
import type { TextmodePlugin } from 'textmode.js';
|
|
36
53
|
declare global {
|
|
37
54
|
interface Window {
|
|
38
55
|
FiltersPlugin?: TextmodePlugin;
|
|
@@ -0,0 +1,9 @@
|
|
|
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
|
+
* @category Workflow
|
|
6
|
+
*
|
|
7
|
+
* @see {@link https://code.textmode.art/api/textmode.filters.js/variables/FiltersPlugin | FiltersPlugin API reference}
|
|
8
|
+
*/
|
|
9
|
+
export declare const FiltersPlugin: TextmodePlugin;
|
|
@@ -0,0 +1,15 @@
|
|
|
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
|
+
}
|
|
15
|
+
export {};
|
|
@@ -0,0 +1,26 @@
|
|
|
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
|
+
* @category Custom filters
|
|
7
|
+
*
|
|
8
|
+
* @see {@link https://code.textmode.art/api/textmode.filters.js/type-aliases/TextmodeFilterUniformDefinitions | TextmodeFilterUniformDefinitions API reference}
|
|
9
|
+
*/
|
|
10
|
+
export type TextmodeFilterUniformDefinitions = Record<string, readonly [paramName: string, defaultValue: TextmodeUniformValue]>;
|
|
11
|
+
/**
|
|
12
|
+
* A precompiled textmode shader, inline fragment source, or shader URL accepted by custom registration.
|
|
13
|
+
*
|
|
14
|
+
* @category Custom filters
|
|
15
|
+
*
|
|
16
|
+
* @see {@link https://code.textmode.art/api/textmode.filters.js/type-aliases/TextmodeFilterShader | TextmodeFilterShader API reference}
|
|
17
|
+
*/
|
|
18
|
+
export type TextmodeFilterShader = TextmodeShader | string;
|
|
19
|
+
/**
|
|
20
|
+
* Built-in names retain completion while arbitrary custom names remain valid.
|
|
21
|
+
*
|
|
22
|
+
* @category Custom filters
|
|
23
|
+
*
|
|
24
|
+
* @see {@link https://code.textmode.art/api/textmode.filters.js/type-aliases/FilterName | FilterName API reference}
|
|
25
|
+
*/
|
|
26
|
+
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
|
+
}
|