@remotion/effects 4.0.467 → 4.0.468

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.
@@ -35,3 +35,5 @@ export declare const validateUnitInterval: (value: number, name: string) => void
35
35
  export declare const validateNonNegative: (value: number, name: string) => void;
36
36
  export declare const validateSignedUnitInterval: (value: number, name: string) => void;
37
37
  export declare const clampColorChannel: (value: number) => number;
38
+ export type ParsedColorRgba = readonly [number, number, number, number];
39
+ export declare const parseColorRgba: (ctx: CanvasRenderingContext2D, color: string) => ParsedColorRgba;
@@ -0,0 +1,31 @@
1
+ export declare const duotoneSchema: {
2
+ readonly darkColor: {
3
+ readonly type: "color";
4
+ readonly default: "#000000";
5
+ readonly description: "Dark color";
6
+ };
7
+ readonly lightColor: {
8
+ readonly type: "color";
9
+ readonly default: "#ffffff";
10
+ readonly description: "Light color";
11
+ };
12
+ readonly threshold: {
13
+ readonly type: "number";
14
+ readonly min: 0;
15
+ readonly max: 1;
16
+ readonly step: 0.01;
17
+ readonly default: 0.5;
18
+ readonly description: "Luminance threshold";
19
+ };
20
+ };
21
+ export type DuotoneParams = {
22
+ /** Color used for pixels below the luminance threshold. Defaults to black. */
23
+ readonly darkColor?: string;
24
+ /** Color used for pixels at or above the luminance threshold. Defaults to white. */
25
+ readonly lightColor?: string;
26
+ /** Luminance threshold from `0` to `1`. Defaults to `0.5`. */
27
+ readonly threshold?: number;
28
+ };
29
+ export declare const duotone: (params?: (DuotoneParams & {
30
+ readonly disabled?: boolean | undefined;
31
+ }) | undefined) => import("remotion").EffectDescriptor<unknown>;
@@ -17,6 +17,12 @@ var assertRequiredColor = (value, name) => {
17
17
  throw new TypeError(`"${name}" must be a non-empty string, but got ${JSON.stringify(value)}`);
18
18
  }
19
19
  };
20
+ var assertOptionalColor = (value, name) => {
21
+ if (value === undefined) {
22
+ return;
23
+ }
24
+ assertRequiredColor(value, name);
25
+ };
20
26
 
21
27
  // src/color-utils.ts
22
28
  var DEFAULT_AMOUNT = 1;
@@ -81,6 +87,13 @@ var validateSignedUnitInterval = (value, name) => {
81
87
  var clampColorChannel = (value) => {
82
88
  return Math.max(0, Math.min(255, value));
83
89
  };
90
+ var parseColorRgba = (ctx, color) => {
91
+ ctx.clearRect(0, 0, 1, 1);
92
+ ctx.fillStyle = color;
93
+ ctx.fillRect(0, 0, 1, 1);
94
+ const { data } = ctx.getImageData(0, 0, 1, 1);
95
+ return [data[0], data[1], data[2], data[3]];
96
+ };
84
97
 
85
98
  // src/barrel-distortion/barrel-distortion-runtime.ts
86
99
  import { Internals } from "remotion";
@@ -301,7 +314,7 @@ var validateBarrelDistortionParams = (params) => {
301
314
  };
302
315
  var barrelDistortion = createEffect({
303
316
  type: "remotion/barrel-distortion",
304
- label: "Barrel Distortion",
317
+ label: "barrelDistortion()",
305
318
  documentationLink: "https://www.remotion.dev/docs/effects/barrel-distortion",
306
319
  backend: "webgl2",
307
320
  calculateKey: (params) => {
package/dist/esm/blur.mjs CHANGED
@@ -17,6 +17,12 @@ var assertRequiredColor = (value, name) => {
17
17
  throw new TypeError(`"${name}" must be a non-empty string, but got ${JSON.stringify(value)}`);
18
18
  }
19
19
  };
20
+ var assertOptionalColor = (value, name) => {
21
+ if (value === undefined) {
22
+ return;
23
+ }
24
+ assertRequiredColor(value, name);
25
+ };
20
26
 
21
27
  // src/blur/blur-runtime.ts
22
28
  import { Internals } from "remotion";
@@ -389,7 +395,7 @@ var validateBlurParams = (params) => {
389
395
  };
390
396
  var blur = createEffect({
391
397
  type: "remotion/blur",
392
- label: "Blur",
398
+ label: "blur()",
393
399
  documentationLink: "https://www.remotion.dev/docs/effects/blur",
394
400
  backend: "webgl2",
395
401
  calculateKey: (params) => {
@@ -17,6 +17,12 @@ var assertRequiredColor = (value, name) => {
17
17
  throw new TypeError(`"${name}" must be a non-empty string, but got ${JSON.stringify(value)}`);
18
18
  }
19
19
  };
20
+ var assertOptionalColor = (value, name) => {
21
+ if (value === undefined) {
22
+ return;
23
+ }
24
+ assertRequiredColor(value, name);
25
+ };
20
26
 
21
27
  // src/color-utils.ts
22
28
  var DEFAULT_AMOUNT = 1;
@@ -81,6 +87,13 @@ var validateSignedUnitInterval = (value, name) => {
81
87
  var clampColorChannel = (value) => {
82
88
  return Math.max(0, Math.min(255, value));
83
89
  };
90
+ var parseColorRgba = (ctx, color) => {
91
+ ctx.clearRect(0, 0, 1, 1);
92
+ ctx.fillStyle = color;
93
+ ctx.fillRect(0, 0, 1, 1);
94
+ const { data } = ctx.getImageData(0, 0, 1, 1);
95
+ return [data[0], data[1], data[2], data[3]];
96
+ };
84
97
 
85
98
  // src/brightness.ts
86
99
  var { createEffect } = Internals;
@@ -98,7 +111,7 @@ var validateBrightnessParams = (params) => {
98
111
  };
99
112
  var brightness = createEffect({
100
113
  type: "remotion/brightness",
101
- label: "Brightness",
114
+ label: "brightness()",
102
115
  documentationLink: "https://www.remotion.dev/docs/effects/brightness",
103
116
  backend: "2d",
104
117
  calculateKey: (params) => {
@@ -17,6 +17,12 @@ var assertRequiredColor = (value, name) => {
17
17
  throw new TypeError(`"${name}" must be a non-empty string, but got ${JSON.stringify(value)}`);
18
18
  }
19
19
  };
20
+ var assertOptionalColor = (value, name) => {
21
+ if (value === undefined) {
22
+ return;
23
+ }
24
+ assertRequiredColor(value, name);
25
+ };
20
26
 
21
27
  // src/color-utils.ts
22
28
  var DEFAULT_AMOUNT = 1;
@@ -81,6 +87,13 @@ var validateSignedUnitInterval = (value, name) => {
81
87
  var clampColorChannel = (value) => {
82
88
  return Math.max(0, Math.min(255, value));
83
89
  };
90
+ var parseColorRgba = (ctx, color) => {
91
+ ctx.clearRect(0, 0, 1, 1);
92
+ ctx.fillStyle = color;
93
+ ctx.fillRect(0, 0, 1, 1);
94
+ const { data } = ctx.getImageData(0, 0, 1, 1);
95
+ return [data[0], data[1], data[2], data[3]];
96
+ };
84
97
 
85
98
  // src/chromatic-aberration/chromatic-aberration-runtime.ts
86
99
  import { Internals } from "remotion";
@@ -301,7 +314,7 @@ var validateChromaticAberrationParams = (params) => {
301
314
  };
302
315
  var chromaticAberration = createEffect({
303
316
  type: "remotion/chromatic-aberration",
304
- label: "Chromatic Aberration",
317
+ label: "chromaticAberration()",
305
318
  documentationLink: "https://www.remotion.dev/docs/effects/chromatic-aberration",
306
319
  backend: "webgl2",
307
320
  calculateKey: (params) => {
@@ -17,6 +17,12 @@ var assertRequiredColor = (value, name) => {
17
17
  throw new TypeError(`"${name}" must be a non-empty string, but got ${JSON.stringify(value)}`);
18
18
  }
19
19
  };
20
+ var assertOptionalColor = (value, name) => {
21
+ if (value === undefined) {
22
+ return;
23
+ }
24
+ assertRequiredColor(value, name);
25
+ };
20
26
 
21
27
  // src/color-utils.ts
22
28
  var DEFAULT_AMOUNT = 1;
@@ -81,6 +87,13 @@ var validateSignedUnitInterval = (value, name) => {
81
87
  var clampColorChannel = (value) => {
82
88
  return Math.max(0, Math.min(255, value));
83
89
  };
90
+ var parseColorRgba = (ctx, color) => {
91
+ ctx.clearRect(0, 0, 1, 1);
92
+ ctx.fillStyle = color;
93
+ ctx.fillRect(0, 0, 1, 1);
94
+ const { data } = ctx.getImageData(0, 0, 1, 1);
95
+ return [data[0], data[1], data[2], data[3]];
96
+ };
84
97
 
85
98
  // src/contrast.ts
86
99
  var { createEffect } = Internals;
@@ -98,7 +111,7 @@ var validateContrastParams = (params) => {
98
111
  };
99
112
  var contrast = createEffect({
100
113
  type: "remotion/contrast",
101
- label: "Contrast",
114
+ label: "contrast()",
102
115
  documentationLink: "https://www.remotion.dev/docs/effects/contrast",
103
116
  backend: "2d",
104
117
  calculateKey: (params) => {
@@ -0,0 +1,365 @@
1
+ // src/duotone.ts
2
+ import { Internals } from "remotion";
3
+
4
+ // src/validate-effect-param.ts
5
+ var assertEffectParamsObject = (params, effectLabel) => {
6
+ if (params === null || typeof params !== "object") {
7
+ throw new TypeError(`${effectLabel} effect requires a parameters object, but got ${JSON.stringify(params)}`);
8
+ }
9
+ };
10
+ var assertRequiredFiniteNumber = (value, name) => {
11
+ if (typeof value !== "number" || !Number.isFinite(value)) {
12
+ throw new TypeError(`"${name}" must be a finite number, but got ${JSON.stringify(value)}`);
13
+ }
14
+ };
15
+ var assertRequiredColor = (value, name) => {
16
+ if (typeof value !== "string" || value.length === 0) {
17
+ throw new TypeError(`"${name}" must be a non-empty string, but got ${JSON.stringify(value)}`);
18
+ }
19
+ };
20
+ var assertOptionalColor = (value, name) => {
21
+ if (value === undefined) {
22
+ return;
23
+ }
24
+ assertRequiredColor(value, name);
25
+ };
26
+
27
+ // src/color-utils.ts
28
+ var DEFAULT_AMOUNT = 1;
29
+ var DEFAULT_BRIGHTNESS_AMOUNT = 0;
30
+ var DEFAULT_HUE_DEGREES = 0;
31
+ var colorAmountSchema = {
32
+ type: "number",
33
+ min: 0,
34
+ max: 1,
35
+ step: 0.01,
36
+ default: DEFAULT_AMOUNT,
37
+ description: "Amount"
38
+ };
39
+ var colorMultiplierSchema = {
40
+ type: "number",
41
+ min: 0,
42
+ step: 0.01,
43
+ default: DEFAULT_AMOUNT,
44
+ description: "Amount"
45
+ };
46
+ var brightnessAmountSchema = {
47
+ type: "number",
48
+ min: -1,
49
+ max: 1,
50
+ step: 0.01,
51
+ default: DEFAULT_BRIGHTNESS_AMOUNT,
52
+ description: "Amount"
53
+ };
54
+ var hueDegreesSchema = {
55
+ type: "number",
56
+ step: 1,
57
+ default: DEFAULT_HUE_DEGREES,
58
+ description: "Degrees"
59
+ };
60
+ var assertOptionalFiniteNumber = (value, name) => {
61
+ if (value === undefined) {
62
+ return;
63
+ }
64
+ assertRequiredFiniteNumber(value, name);
65
+ };
66
+ var validateUnitInterval = (value, name) => {
67
+ if (value < 0) {
68
+ throw new TypeError(`"${name}" must be >= 0, but got ${JSON.stringify(value)}`);
69
+ }
70
+ if (value > 1) {
71
+ throw new TypeError(`"${name}" must be <= 1, but got ${JSON.stringify(value)}`);
72
+ }
73
+ };
74
+ var validateNonNegative = (value, name) => {
75
+ if (value < 0) {
76
+ throw new TypeError(`"${name}" must be >= 0, but got ${JSON.stringify(value)}`);
77
+ }
78
+ };
79
+ var validateSignedUnitInterval = (value, name) => {
80
+ if (value < -1) {
81
+ throw new TypeError(`"${name}" must be >= -1, but got ${JSON.stringify(value)}`);
82
+ }
83
+ if (value > 1) {
84
+ throw new TypeError(`"${name}" must be <= 1, but got ${JSON.stringify(value)}`);
85
+ }
86
+ };
87
+ var clampColorChannel = (value) => {
88
+ return Math.max(0, Math.min(255, value));
89
+ };
90
+ var parseColorRgba = (ctx, color) => {
91
+ ctx.clearRect(0, 0, 1, 1);
92
+ ctx.fillStyle = color;
93
+ ctx.fillRect(0, 0, 1, 1);
94
+ const { data } = ctx.getImageData(0, 0, 1, 1);
95
+ return [data[0], data[1], data[2], data[3]];
96
+ };
97
+
98
+ // src/duotone.ts
99
+ var { createEffect, createWebGL2ContextError } = Internals;
100
+ var DEFAULT_DARK_COLOR = "#000000";
101
+ var DEFAULT_LIGHT_COLOR = "#ffffff";
102
+ var DEFAULT_LUMINANCE_THRESHOLD = 0.5;
103
+ var duotoneSchema = {
104
+ darkColor: {
105
+ type: "color",
106
+ default: DEFAULT_DARK_COLOR,
107
+ description: "Dark color"
108
+ },
109
+ lightColor: {
110
+ type: "color",
111
+ default: DEFAULT_LIGHT_COLOR,
112
+ description: "Light color"
113
+ },
114
+ threshold: {
115
+ type: "number",
116
+ min: 0,
117
+ max: 1,
118
+ step: 0.01,
119
+ default: DEFAULT_LUMINANCE_THRESHOLD,
120
+ description: "Luminance threshold"
121
+ }
122
+ };
123
+ var resolve = (p) => ({
124
+ darkColor: p.darkColor ?? DEFAULT_DARK_COLOR,
125
+ lightColor: p.lightColor ?? DEFAULT_LIGHT_COLOR,
126
+ threshold: p.threshold ?? DEFAULT_LUMINANCE_THRESHOLD
127
+ });
128
+ var validateDuotoneParams = (params) => {
129
+ assertEffectParamsObject(params, "Duotone");
130
+ assertOptionalColor(params.darkColor, "darkColor");
131
+ assertOptionalColor(params.lightColor, "lightColor");
132
+ assertOptionalFiniteNumber(params.threshold, "threshold");
133
+ const { threshold } = resolve(params);
134
+ validateUnitInterval(threshold, "threshold");
135
+ };
136
+ var DUOTONE_VS = `#version 300 es
137
+ in vec2 aPos;
138
+ in vec2 aUv;
139
+ out vec2 vUv;
140
+
141
+ void main() {
142
+ vUv = aUv;
143
+ gl_Position = vec4(aPos, 0.0, 1.0);
144
+ }
145
+ `;
146
+ var DUOTONE_FS = `#version 300 es
147
+ precision highp float;
148
+
149
+ in vec2 vUv;
150
+ out vec4 fragColor;
151
+
152
+ uniform sampler2D uSource;
153
+ uniform vec3 uDarkColor;
154
+ uniform vec3 uLightColor;
155
+ uniform float uThreshold;
156
+
157
+ void main() {
158
+ vec4 texColor = texture(uSource, vUv);
159
+ float alpha = texColor.a;
160
+
161
+ if (alpha <= 0.001) {
162
+ fragColor = vec4(0.0);
163
+ return;
164
+ }
165
+
166
+ vec3 rgb = texColor.rgb / alpha;
167
+ float luminance = dot(rgb, vec3(0.299, 0.587, 0.114));
168
+ vec3 duotoneColor = luminance < uThreshold ? uDarkColor : uLightColor;
169
+
170
+ fragColor = vec4(duotoneColor * alpha, alpha);
171
+ }
172
+ `;
173
+ var compileShader = (gl, type, source) => {
174
+ const shader = gl.createShader(type);
175
+ if (!shader) {
176
+ throw new Error("Failed to create WebGL shader");
177
+ }
178
+ gl.shaderSource(shader, source);
179
+ gl.compileShader(shader);
180
+ if (!gl.getShaderParameter(shader, gl.COMPILE_STATUS)) {
181
+ const log = gl.getShaderInfoLog(shader);
182
+ gl.deleteShader(shader);
183
+ throw new Error(`Duotone shader compile failed: ${log ?? "(no log)"}`);
184
+ }
185
+ return shader;
186
+ };
187
+ var linkProgram = (gl, vs, fs) => {
188
+ const program = gl.createProgram();
189
+ if (!program) {
190
+ throw new Error("Failed to create WebGL program");
191
+ }
192
+ gl.attachShader(program, vs);
193
+ gl.attachShader(program, fs);
194
+ gl.linkProgram(program);
195
+ if (!gl.getProgramParameter(program, gl.LINK_STATUS)) {
196
+ const log = gl.getProgramInfoLog(program);
197
+ gl.deleteProgram(program);
198
+ throw new Error(`Duotone program link failed: ${log ?? "(no log)"}`);
199
+ }
200
+ return program;
201
+ };
202
+ var createProgram = (gl, vertexSource, fragmentSource) => {
203
+ const vs = compileShader(gl, gl.VERTEX_SHADER, vertexSource);
204
+ const fs = compileShader(gl, gl.FRAGMENT_SHADER, fragmentSource);
205
+ const program = linkProgram(gl, vs, fs);
206
+ gl.deleteShader(vs);
207
+ gl.deleteShader(fs);
208
+ return program;
209
+ };
210
+ var createRgbaTexture = (gl) => {
211
+ const texture = gl.createTexture();
212
+ if (!texture) {
213
+ throw new Error("Failed to create WebGL texture");
214
+ }
215
+ gl.bindTexture(gl.TEXTURE_2D, texture);
216
+ gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.LINEAR);
217
+ gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.LINEAR);
218
+ gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE);
219
+ gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE);
220
+ gl.bindTexture(gl.TEXTURE_2D, null);
221
+ return texture;
222
+ };
223
+ var setupDuotone = (target) => {
224
+ const gl = target.getContext("webgl2", {
225
+ premultipliedAlpha: true,
226
+ alpha: true,
227
+ preserveDrawingBuffer: true
228
+ });
229
+ if (!gl) {
230
+ throw createWebGL2ContextError("duotone effect");
231
+ }
232
+ gl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, true);
233
+ const program = createProgram(gl, DUOTONE_VS, DUOTONE_FS);
234
+ const vao = gl.createVertexArray();
235
+ if (!vao) {
236
+ throw new Error("Failed to create WebGL vertex array");
237
+ }
238
+ gl.bindVertexArray(vao);
239
+ const data = new Float32Array([
240
+ -1,
241
+ -1,
242
+ 0,
243
+ 0,
244
+ 1,
245
+ -1,
246
+ 1,
247
+ 0,
248
+ -1,
249
+ 1,
250
+ 0,
251
+ 1,
252
+ 1,
253
+ 1,
254
+ 1,
255
+ 1
256
+ ]);
257
+ const vbo = gl.createBuffer();
258
+ if (!vbo) {
259
+ throw new Error("Failed to create WebGL buffer");
260
+ }
261
+ gl.bindBuffer(gl.ARRAY_BUFFER, vbo);
262
+ gl.bufferData(gl.ARRAY_BUFFER, data, gl.STATIC_DRAW);
263
+ const aPos = gl.getAttribLocation(program, "aPos");
264
+ const aUv = gl.getAttribLocation(program, "aUv");
265
+ gl.enableVertexAttribArray(aPos);
266
+ gl.vertexAttribPointer(aPos, 2, gl.FLOAT, false, 16, 0);
267
+ gl.enableVertexAttribArray(aUv);
268
+ gl.vertexAttribPointer(aUv, 2, gl.FLOAT, false, 16, 8);
269
+ gl.bindVertexArray(null);
270
+ const textureSource = createRgbaTexture(gl);
271
+ const colorCanvas = document.createElement("canvas");
272
+ colorCanvas.width = 1;
273
+ colorCanvas.height = 1;
274
+ const colorCtx = colorCanvas.getContext("2d", { willReadFrequently: true });
275
+ if (!colorCtx) {
276
+ throw new Error("Failed to acquire 2D context for color parsing");
277
+ }
278
+ return {
279
+ gl,
280
+ program,
281
+ vao,
282
+ vbo,
283
+ textureSource,
284
+ uniforms: {
285
+ uSource: gl.getUniformLocation(program, "uSource"),
286
+ uDarkColor: gl.getUniformLocation(program, "uDarkColor"),
287
+ uLightColor: gl.getUniformLocation(program, "uLightColor"),
288
+ uThreshold: gl.getUniformLocation(program, "uThreshold")
289
+ },
290
+ colorCtx,
291
+ cachedDarkColor: "",
292
+ cachedDarkColorRgba: [0, 0, 0, 255],
293
+ cachedLightColor: "",
294
+ cachedLightColorRgba: [255, 255, 255, 255]
295
+ };
296
+ };
297
+ var normalizedRgb = (color) => {
298
+ return [color[0] / 255, color[1] / 255, color[2] / 255];
299
+ };
300
+ var getParsedColors = (state, resolved) => {
301
+ if (state.cachedDarkColor !== resolved.darkColor) {
302
+ state.cachedDarkColor = resolved.darkColor;
303
+ state.cachedDarkColorRgba = parseColorRgba(state.colorCtx, resolved.darkColor);
304
+ }
305
+ if (state.cachedLightColor !== resolved.lightColor) {
306
+ state.cachedLightColor = resolved.lightColor;
307
+ state.cachedLightColorRgba = parseColorRgba(state.colorCtx, resolved.lightColor);
308
+ }
309
+ return {
310
+ dark: state.cachedDarkColorRgba,
311
+ light: state.cachedLightColorRgba
312
+ };
313
+ };
314
+ var duotone = createEffect({
315
+ type: "remotion/duotone",
316
+ label: "duotone()",
317
+ documentationLink: "https://www.remotion.dev/docs/effects/duotone",
318
+ backend: "webgl2",
319
+ calculateKey: (params) => {
320
+ const r = resolve(params);
321
+ return `duotone-${r.darkColor}-${r.lightColor}-${r.threshold}`;
322
+ },
323
+ setup: (target) => setupDuotone(target),
324
+ apply: ({ source, width, height, params, state, flipSourceY }) => {
325
+ const r = resolve(params);
326
+ const { dark, light } = getParsedColors(state, r);
327
+ const [dr, dg, db] = normalizedRgb(dark);
328
+ const [lr, lg, lb] = normalizedRgb(light);
329
+ const { gl, program, textureSource, uniforms, vao } = state;
330
+ gl.viewport(0, 0, width, height);
331
+ gl.bindFramebuffer(gl.FRAMEBUFFER, null);
332
+ gl.clearColor(0, 0, 0, 0);
333
+ gl.clear(gl.COLOR_BUFFER_BIT);
334
+ gl.activeTexture(gl.TEXTURE0);
335
+ gl.bindTexture(gl.TEXTURE_2D, textureSource);
336
+ gl.pixelStorei(gl.UNPACK_FLIP_Y_WEBGL, flipSourceY);
337
+ gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, gl.RGBA, gl.UNSIGNED_BYTE, source);
338
+ gl.useProgram(program);
339
+ if (uniforms.uSource)
340
+ gl.uniform1i(uniforms.uSource, 0);
341
+ if (uniforms.uDarkColor)
342
+ gl.uniform3f(uniforms.uDarkColor, dr, dg, db);
343
+ if (uniforms.uLightColor)
344
+ gl.uniform3f(uniforms.uLightColor, lr, lg, lb);
345
+ if (uniforms.uThreshold)
346
+ gl.uniform1f(uniforms.uThreshold, r.threshold);
347
+ gl.bindVertexArray(vao);
348
+ gl.drawArrays(gl.TRIANGLE_STRIP, 0, 4);
349
+ gl.bindVertexArray(null);
350
+ gl.bindTexture(gl.TEXTURE_2D, null);
351
+ gl.useProgram(null);
352
+ },
353
+ cleanup: ({ gl, program, vao, vbo, textureSource }) => {
354
+ gl.deleteTexture(textureSource);
355
+ gl.deleteBuffer(vbo);
356
+ gl.deleteProgram(program);
357
+ gl.deleteVertexArray(vao);
358
+ },
359
+ schema: duotoneSchema,
360
+ validateParams: validateDuotoneParams
361
+ });
362
+ export {
363
+ duotoneSchema,
364
+ duotone
365
+ };