openvideo 0.1.11 → 0.2.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.
@@ -1,6 +1,9 @@
1
- import { Filter, RenderTexture } from 'pixi.js';
1
+ import { Texture, RenderTexture } from 'pixi.js';
2
2
  import { EffectOptions, EffectRendererOptions } from './types';
3
- export declare function makeEffect({ name, renderer }: EffectOptions): {
4
- filter: Filter;
3
+ export declare function makeEffect({ name, renderer, values }: EffectOptions): Promise<{
4
+ filter: null;
5
+ render({ canvasTexture }: EffectRendererOptions): Texture<import('pixi.js').TextureSource<any>>;
6
+ } | {
7
+ filter: any;
5
8
  render({ width, height, canvasTexture, progress }: EffectRendererOptions): RenderTexture;
6
- };
9
+ }>;
@@ -1015,3 +1015,18 @@ export declare const FAST_ZOOM_UNIFORMS: {
1015
1015
  type: string;
1016
1016
  };
1017
1017
  };
1018
+ export declare const CHROMA_KEY_FRAGMENT = "\nprecision highp float;\n\nvarying vec2 vTextureCoord;\nuniform sampler2D uTexture;\n\nuniform vec3 uKeyColor; \nuniform float uSimilarity; \nuniform float uSpill; \n\nvoid main() {\n vec4 color = texture2D(uTexture, vTextureCoord);\n \n float maxChannel = max(max(uKeyColor.r, uKeyColor.g), uKeyColor.b);\n \n float diff;\n float spillAmount = 0.0;\n \n if (maxChannel == uKeyColor.g && uKeyColor.g > uKeyColor.r && uKeyColor.g > uKeyColor.b) {\n diff = color.g - max(color.r, color.b);\n spillAmount = max(0.0, color.g - max(color.r, color.b));\n color.g -= spillAmount * uSpill;\n \n float avg = (color.r + color.b) * 0.5;\n color.r = mix(color.r, avg, spillAmount);\n color.b = mix(color.b, avg, spillAmount);\n } \n else if (maxChannel == uKeyColor.b && uKeyColor.b > uKeyColor.r && uKeyColor.b > uKeyColor.g) {\n diff = color.b - max(color.r, color.g);\n spillAmount = max(0.0, color.b - max(color.r, color.g));\n color.b -= spillAmount * uSpill;\n \n float avg = (color.r + color.g) * 0.5;\n color.r = mix(color.r, avg, spillAmount);\n color.g = mix(color.g, avg, spillAmount);\n } \n else {\n diff = color.r - max(color.g, color.b);\n spillAmount = max(0.0, color.r - max(color.g, color.b));\n color.r -= spillAmount * uSpill;\n \n float avg = (color.g + color.b) * 0.5;\n color.g = mix(color.g, avg, spillAmount);\n color.b = mix(color.b, avg, spillAmount);\n }\n \n float mask = step(uSimilarity, diff); \n float alpha = 1.0 - mask;\n\n if (diff > uSimilarity) {\n gl_FragColor = vec4(0.0, 0.0, 0.0, 0.0);\n return;\n }\n\n gl_FragColor = vec4(color.rgb, color.a * alpha);\n}\n";
1019
+ export declare const CHROMA_KEY_UNIFORMS: {
1020
+ uKeyColor: {
1021
+ value: number[];
1022
+ type: string;
1023
+ };
1024
+ uSimilarity: {
1025
+ value: number;
1026
+ type: string;
1027
+ };
1028
+ uSpill: {
1029
+ value: number;
1030
+ type: string;
1031
+ };
1032
+ };
@@ -1,16 +1,38 @@
1
- export interface GlTransition {
1
+ export interface GlEffect {
2
2
  label: string;
3
3
  fragment: string;
4
4
  uniforms?: Record<string, {
5
5
  value: any;
6
6
  type: string;
7
7
  }>;
8
+ previewStatic?: string;
9
+ previewDynamic?: string;
8
10
  }
9
- export declare const GL_EFFECTS: Record<string, GlTransition>;
10
- export type EffectKey = keyof typeof GL_EFFECTS;
11
- export declare const GL_EFFECT_OPTIONS: Array<{
11
+ /**
12
+ * Register a custom effect at runtime
13
+ */
14
+ export declare function registerCustomEffect(name: string, effect: GlEffect): void;
15
+ /**
16
+ * Unregister a custom effect at runtime
17
+ */
18
+ export declare function unregisterCustomEffect(name: string): void;
19
+ /**
20
+ * Get all available effects, including library and runtime registered ones
21
+ */
22
+ export declare function getAllEffects(): Record<string, GlEffect>;
23
+ export declare const GL_EFFECTS: Record<string, GlEffect>;
24
+ export type EffectKey = string;
25
+ export declare function getEffectOptions(): {
12
26
  key: EffectKey;
13
27
  label: string;
14
- previewStatic: string | undefined;
15
- previewDynamic: string | undefined;
16
- }>;
28
+ isCustom: boolean;
29
+ previewStatic: string;
30
+ previewDynamic: string;
31
+ }[];
32
+ export declare const GL_EFFECT_OPTIONS: {
33
+ key: EffectKey;
34
+ label: string;
35
+ isCustom: boolean;
36
+ previewStatic: string;
37
+ previewDynamic: string;
38
+ }[];
@@ -0,0 +1,40 @@
1
+ import { AdjustmentFilterOptions, AdvancedBloomFilterOptions, AsciiFilterOptions, BevelFilterOptions, BloomFilterOptions, BulgePinchFilterOptions, ColorGradientFilterOptions, ColorOverlayFilterOptions, ColorReplaceFilterOptions, ConvolutionFilterOptions, CRTFilterOptions, DotFilterOptions, DropShadowFilterOptions, GlitchFilterOptions, GlowFilterOptions, GodrayFilterOptions, HslAdjustmentFilterOptions, KawaseBlurFilterOptions, MotionBlurFilterOptions, MultiColorReplaceFilterOptions, OldFilmFilterOptions, OutlineFilterOptions, RadialBlurFilterOptions, ReflectionFilterOptions, RGBSplitFilterOptions, ShockwaveFilterOptions, SimplexNoiseFilterOptions, TiltShiftFilterOptions, TwistFilterOptions, ZoomBlurFilterOptions } from 'pixi-filters';
2
+ export type FilterOptionsMap = {
3
+ adjustmentFilter: AdjustmentFilterOptions;
4
+ advancedBloomFilter: AdvancedBloomFilterOptions;
5
+ asciiFilter: AsciiFilterOptions;
6
+ backdropBlurFilter: any;
7
+ bevelFilter: BevelFilterOptions;
8
+ bloomFilter: BloomFilterOptions;
9
+ bulgePinchFilter: BulgePinchFilterOptions;
10
+ colorGradientFilter: ColorGradientFilterOptions;
11
+ colorMapFilter: any;
12
+ colorOverlayFilter: ColorOverlayFilterOptions;
13
+ colorReplaceFilter: ColorReplaceFilterOptions;
14
+ convolutionFilter: ConvolutionFilterOptions;
15
+ crossHatchFilter: any;
16
+ crtFilter: CRTFilterOptions;
17
+ dotFilter: DotFilterOptions;
18
+ dropShadowFilter: DropShadowFilterOptions;
19
+ embossFilter: any;
20
+ glitchFilter: GlitchFilterOptions;
21
+ glowFilter: GlowFilterOptions;
22
+ godrayFilter: GodrayFilterOptions;
23
+ grayscaleFilter: any;
24
+ hslAdjustmentFilter: HslAdjustmentFilterOptions;
25
+ kawaseBlurFilter: KawaseBlurFilterOptions;
26
+ motionBlurFilter: MotionBlurFilterOptions;
27
+ multiColorReplaceFilter: MultiColorReplaceFilterOptions;
28
+ oldFilmFilter: OldFilmFilterOptions;
29
+ outlineFilter: OutlineFilterOptions;
30
+ pixelateFilter: any;
31
+ radialBlurFilter: RadialBlurFilterOptions;
32
+ reflectionFilter: ReflectionFilterOptions;
33
+ rgbSplitFilter: RGBSplitFilterOptions;
34
+ shockwaveFilter: ShockwaveFilterOptions;
35
+ simpleLightmapFilter: any;
36
+ simplexNoiseFilter: SimplexNoiseFilterOptions;
37
+ tiltShiftFilter: TiltShiftFilterOptions;
38
+ twistFilter: TwistFilterOptions;
39
+ zoomBlurFilter: ZoomBlurFilterOptions;
40
+ };
@@ -3,6 +3,7 @@ import { EffectKey } from './glsl/gl-effect';
3
3
  export interface EffectOptions {
4
4
  name: EffectKey;
5
5
  renderer: Renderer;
6
+ values?: Record<string, any>;
6
7
  }
7
8
  export interface EffectRendererOptions {
8
9
  canvasTexture: HTMLCanvasElement | ImageBitmap | HTMLImageElement | HTMLVideoElement | RenderTexture;