fundus 0.0.2 → 0.0.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 +73 -0
- package/build/client/_app/immutable/assets/0.DLhIsYA_.css.br +0 -0
- package/build/client/_app/immutable/assets/0.DLhIsYA_.css.gz +0 -0
- package/build/client/_app/immutable/assets/2.ohi-TClG.css +1 -0
- package/build/client/_app/immutable/assets/2.ohi-TClG.css.br +0 -0
- package/build/client/_app/immutable/assets/2.ohi-TClG.css.gz +0 -0
- package/build/client/_app/immutable/assets/3.JwgtcTEd.css +1 -0
- package/build/client/_app/immutable/assets/3.JwgtcTEd.css.br +0 -0
- package/build/client/_app/immutable/assets/3.JwgtcTEd.css.gz +0 -0
- package/build/client/_app/immutable/assets/4.p004hmEN.css +1 -0
- package/build/client/_app/immutable/assets/4.p004hmEN.css.br +0 -0
- package/build/client/_app/immutable/assets/4.p004hmEN.css.gz +0 -0
- package/build/client/_app/immutable/assets/ConfirmDialog.BdKlitwi.css +1 -0
- package/build/client/_app/immutable/assets/ConfirmDialog.BdKlitwi.css.br +0 -0
- package/build/client/_app/immutable/assets/ConfirmDialog.BdKlitwi.css.gz +0 -0
- package/build/client/_app/immutable/assets/LibraryContextMenu.CMefGNE2.css +1 -0
- package/build/client/_app/immutable/assets/LibraryContextMenu.CMefGNE2.css.br +0 -0
- package/build/client/_app/immutable/assets/LibraryContextMenu.CMefGNE2.css.gz +0 -0
- package/build/client/_app/immutable/chunks/Bjy-W4x2.js.br +0 -0
- package/build/client/_app/immutable/chunks/Bjy-W4x2.js.gz +0 -0
- package/build/client/_app/immutable/chunks/CNRz3sSw.js.br +0 -0
- package/build/client/_app/immutable/chunks/CNRz3sSw.js.gz +0 -0
- package/build/client/_app/immutable/chunks/CO4RBJfa.js.br +0 -0
- package/build/client/_app/immutable/chunks/CO4RBJfa.js.gz +0 -0
- package/build/client/_app/immutable/chunks/DOpBpjxS.js +108 -0
- package/build/client/_app/immutable/chunks/DOpBpjxS.js.br +0 -0
- package/build/client/_app/immutable/chunks/DOpBpjxS.js.gz +0 -0
- package/{dist/editor/_app/immutable/chunks/BfPE5wdt.js → build/client/_app/immutable/chunks/DVEQFclp.js} +1 -1
- package/build/client/_app/immutable/chunks/DVEQFclp.js.br +1 -0
- package/build/client/_app/immutable/chunks/DVEQFclp.js.gz +0 -0
- package/{dist/editor/_app/immutable/chunks/DjvOiDmq.js → build/client/_app/immutable/chunks/DiFoWL2c.js} +1 -1
- package/build/client/_app/immutable/chunks/DiFoWL2c.js.br +0 -0
- package/build/client/_app/immutable/chunks/DiFoWL2c.js.gz +0 -0
- package/build/client/_app/immutable/chunks/DkADHpZF.js +1 -0
- package/build/client/_app/immutable/chunks/DkADHpZF.js.br +0 -0
- package/build/client/_app/immutable/chunks/DkADHpZF.js.gz +0 -0
- package/build/client/_app/immutable/chunks/xihTtKlq.js.br +1 -0
- package/build/client/_app/immutable/chunks/xihTtKlq.js.gz +0 -0
- package/{dist/editor/_app/immutable/entry/app.BkqbfI8n.js → build/client/_app/immutable/entry/app.CKgtYXQb.js} +2 -2
- package/build/client/_app/immutable/entry/app.CKgtYXQb.js.br +0 -0
- package/build/client/_app/immutable/entry/app.CKgtYXQb.js.gz +0 -0
- package/build/client/_app/immutable/entry/start.CYZu5qE1.js +1 -0
- package/build/client/_app/immutable/entry/start.CYZu5qE1.js.br +0 -0
- package/build/client/_app/immutable/entry/start.CYZu5qE1.js.gz +0 -0
- package/{dist/editor/_app/immutable/nodes/0.xdMI5GEU.js → build/client/_app/immutable/nodes/0.I_1SApYQ.js} +1 -1
- package/build/client/_app/immutable/nodes/0.I_1SApYQ.js.br +0 -0
- package/build/client/_app/immutable/nodes/0.I_1SApYQ.js.gz +0 -0
- package/{dist/editor/_app/immutable/nodes/1.D9p2tfoJ.js → build/client/_app/immutable/nodes/1.v6eUTnWq.js} +1 -1
- package/build/client/_app/immutable/nodes/1.v6eUTnWq.js.br +2 -0
- package/build/client/_app/immutable/nodes/1.v6eUTnWq.js.gz +0 -0
- package/build/client/_app/immutable/nodes/2.DoA7Dfl-.js +3 -0
- package/build/client/_app/immutable/nodes/2.DoA7Dfl-.js.br +0 -0
- package/build/client/_app/immutable/nodes/2.DoA7Dfl-.js.gz +0 -0
- package/build/client/_app/immutable/nodes/3.C-DO70Bs.js +1 -0
- package/build/client/_app/immutable/nodes/3.C-DO70Bs.js.br +0 -0
- package/build/client/_app/immutable/nodes/3.C-DO70Bs.js.gz +0 -0
- package/build/client/_app/immutable/nodes/4.CALOuSyz.js +2 -0
- package/build/client/_app/immutable/nodes/4.CALOuSyz.js.br +0 -0
- package/build/client/_app/immutable/nodes/4.CALOuSyz.js.gz +0 -0
- package/build/client/_app/version.json +1 -0
- package/build/client/_app/version.json.br +0 -0
- package/build/client/_app/version.json.gz +0 -0
- package/build/env.js +100 -0
- package/build/env.js.map +1 -0
- package/build/handler.js +22 -0
- package/build/handler.js.map +1 -0
- package/build/index.js +145 -0
- package/build/index.js.map +1 -0
- package/build/server/chunks/chunks/context.js-BUZqFfWG.js +429 -0
- package/build/server/chunks/chunks/context.js-BUZqFfWG.js.map +1 -0
- package/build/server/chunks/chunks/core.js-xfrkaQpS.js +458 -0
- package/build/server/chunks/chunks/core.js-xfrkaQpS.js.map +1 -0
- package/build/server/chunks/chunks/env.js-l0sNRNKZ.js +2 -0
- package/build/server/chunks/chunks/env.js-l0sNRNKZ.js.map +1 -0
- package/build/server/chunks/chunks/exports.js-C0rwMMtk.js +152 -0
- package/build/server/chunks/chunks/exports.js-C0rwMMtk.js.map +1 -0
- package/build/server/chunks/chunks/folder-path.js-ytx9ucgg.js +64 -0
- package/build/server/chunks/chunks/folder-path.js-ytx9ucgg.js.map +1 -0
- package/build/server/chunks/chunks/http.js-DvopzwKh.js +100 -0
- package/build/server/chunks/chunks/http.js-DvopzwKh.js.map +1 -0
- package/build/server/chunks/chunks/internal.js-DGo2jPcg.js +5753 -0
- package/build/server/chunks/chunks/internal.js-DGo2jPcg.js.map +1 -0
- package/build/server/chunks/chunks/internal2.js-BlXt2rfE.js +22 -0
- package/build/server/chunks/chunks/internal2.js-BlXt2rfE.js.map +1 -0
- package/{dist/operations-DYM-5KVl.js → build/server/chunks/chunks/library-store.js-ZLudCJlT.js} +463 -492
- package/build/server/chunks/chunks/library-store.js-ZLudCJlT.js.map +1 -0
- package/build/server/chunks/chunks/manifest-appearance.js-DTk355LQ.js +146 -0
- package/build/server/chunks/chunks/manifest-appearance.js-DTk355LQ.js.map +1 -0
- package/build/server/chunks/chunks/routing.js-y-tryuip.js +213 -0
- package/build/server/chunks/chunks/routing.js-y-tryuip.js.map +1 -0
- package/build/server/chunks/chunks/shared.js-B1gC9MiJ.js +255 -0
- package/build/server/chunks/chunks/shared.js-B1gC9MiJ.js.map +1 -0
- package/build/server/chunks/chunks/utils.js-DnEJ3UjO.js +1048 -0
- package/build/server/chunks/chunks/utils.js-DnEJ3UjO.js.map +1 -0
- package/build/server/chunks/entries/endpoints/api/_...path_/_server.ts.js-Cq5gXVQT.js +27 -0
- package/build/server/chunks/entries/endpoints/api/_...path_/_server.ts.js-Cq5gXVQT.js.map +1 -0
- package/build/server/chunks/entries/endpoints/api/assets/_id_/_server.ts.js-RXbedi8q.js +24 -0
- package/build/server/chunks/entries/endpoints/api/assets/_id_/_server.ts.js-RXbedi8q.js.map +1 -0
- package/build/server/chunks/entries/endpoints/api/assets/_server.ts.js-D7Qae9vU.js +45 -0
- package/build/server/chunks/entries/endpoints/api/assets/_server.ts.js-D7Qae9vU.js.map +1 -0
- package/build/server/chunks/entries/endpoints/api/assets/delete/_server.ts.js-DtO20kgB.js +31 -0
- package/build/server/chunks/entries/endpoints/api/assets/delete/_server.ts.js-DtO20kgB.js.map +1 -0
- package/build/server/chunks/entries/endpoints/api/assets/move/_server.ts.js-BUebPbd5.js +31 -0
- package/build/server/chunks/entries/endpoints/api/assets/move/_server.ts.js-BUebPbd5.js.map +1 -0
- package/build/server/chunks/entries/endpoints/api/folders/_path_/_server.ts.js-BjT2qPMT.js +38 -0
- package/build/server/chunks/entries/endpoints/api/folders/_path_/_server.ts.js-BjT2qPMT.js.map +1 -0
- package/build/server/chunks/entries/endpoints/api/folders/_server.ts.js-DYRLsoT7.js +31 -0
- package/build/server/chunks/entries/endpoints/api/folders/_server.ts.js-DYRLsoT7.js.map +1 -0
- package/build/server/chunks/entries/endpoints/api/manifests/_name_/_server.ts.js-BbN2fGNN.js +24 -0
- package/build/server/chunks/entries/endpoints/api/manifests/_name_/_server.ts.js-BbN2fGNN.js.map +1 -0
- package/build/server/chunks/entries/endpoints/api/manifests/_server.ts.js-b_MKZ41b.js +31 -0
- package/build/server/chunks/entries/endpoints/api/manifests/_server.ts.js-b_MKZ41b.js.map +1 -0
- package/build/server/chunks/entries/endpoints/api/state/_server.ts.js-evEfMpvn.js +24 -0
- package/build/server/chunks/entries/endpoints/api/state/_server.ts.js-evEfMpvn.js.map +1 -0
- package/build/server/chunks/entries/endpoints/files/_...path_/_server.ts.js-C04XE_1w.js +27 -0
- package/build/server/chunks/entries/endpoints/files/_...path_/_server.ts.js-C04XE_1w.js.map +1 -0
- package/build/server/chunks/entries/endpoints/files/proxy/_...path_/_server.ts.js-DB8TdoEv.js +24 -0
- package/build/server/chunks/entries/endpoints/files/proxy/_...path_/_server.ts.js-DB8TdoEv.js.map +1 -0
- package/build/server/chunks/entries/endpoints/files/raw/_...path_/_server.ts.js-BrpaijZO.js +24 -0
- package/build/server/chunks/entries/endpoints/files/raw/_...path_/_server.ts.js-BrpaijZO.js.map +1 -0
- package/build/server/chunks/entries/hooks.server.js-BJJwZW_I.js +23 -0
- package/build/server/chunks/entries/hooks.server.js-BJJwZW_I.js.map +1 -0
- package/build/server/chunks/handler-DnbS2t1B.js +1475 -0
- package/build/server/chunks/handler-DnbS2t1B.js.map +1 -0
- package/build/server/chunks/index.js-g77q3Boj.js +3789 -0
- package/build/server/chunks/index.js-g77q3Boj.js.map +1 -0
- package/build/server/chunks/manifest.js-qmEXbstS.js +149 -0
- package/build/server/chunks/manifest.js-qmEXbstS.js.map +1 -0
- package/build/server/chunks/nodes/0.js-Bk6IZ-vD.js +11 -0
- package/build/server/chunks/nodes/0.js-Bk6IZ-vD.js.map +1 -0
- package/build/server/chunks/nodes/1.js-H-qwo4GJ.js +7 -0
- package/build/server/chunks/nodes/1.js-H-qwo4GJ.js.map +1 -0
- package/build/server/chunks/nodes/2.js-DRpXVLwp.js +7 -0
- package/build/server/chunks/nodes/2.js-DRpXVLwp.js.map +1 -0
- package/build/server/chunks/nodes/3.js-CDEzNFeU.js +7 -0
- package/build/server/chunks/nodes/3.js-CDEzNFeU.js.map +1 -0
- package/build/server/chunks/nodes/4.js-BKL7LSSm.js +7 -0
- package/build/server/chunks/nodes/4.js-BKL7LSSm.js.map +1 -0
- package/build/shims.js +33 -0
- package/build/shims.js.map +1 -0
- package/dist/cli.d.ts +2 -1
- package/dist/cli.js +116 -1336
- package/dist/config.d.ts +3 -2
- package/dist/config.js +2 -2
- package/dist/core/api-types.d.ts +141 -0
- package/dist/core/api-types.js +1 -0
- package/dist/core/asset-id.d.ts +28 -0
- package/dist/core/asset-id.js +59 -0
- package/dist/core/asset-reference.d.ts +23 -0
- package/dist/core/asset-reference.js +15 -0
- package/dist/core/canonicalize.d.ts +9 -0
- package/dist/core/canonicalize.js +36 -0
- package/dist/core/chroma-key.d.ts +30 -0
- package/dist/core/chroma-key.js +55 -0
- package/dist/core/config.d.ts +35 -0
- package/dist/core/config.js +4 -0
- package/dist/core/folder-path.d.ts +19 -0
- package/dist/core/folder-path.js +86 -0
- package/dist/core/index.d.ts +33 -499
- package/dist/core/index.js +17 -962
- package/dist/core/ingest.d.ts +24 -0
- package/dist/core/ingest.js +42 -0
- package/dist/core/library.d.ts +54 -0
- package/dist/core/library.js +138 -0
- package/dist/core/manifest-appearance.d.ts +35 -0
- package/dist/core/manifest-appearance.js +123 -0
- package/dist/core/manifest-entry.d.ts +104 -0
- package/dist/core/manifest-entry.js +1 -0
- package/dist/core/manifest-membership.d.ts +56 -0
- package/dist/core/manifest-membership.js +54 -0
- package/dist/core/plugins/audio.d.ts +26 -0
- package/dist/core/plugins/audio.js +44 -0
- package/dist/core/plugins/chroma-key-video.d.ts +29 -0
- package/dist/core/plugins/chroma-key-video.js +69 -0
- package/dist/core/plugins/contract.d.ts +35 -0
- package/dist/core/plugins/contract.js +1 -0
- package/dist/core/plugins/image.d.ts +30 -0
- package/dist/core/plugins/image.js +45 -0
- package/dist/core/plugins/registry.d.ts +16 -0
- package/dist/core/plugins/registry.js +52 -0
- package/dist/core/plugins/slice.d.ts +22 -0
- package/dist/core/plugins/slice.js +60 -0
- package/dist/core/plugins/video.d.ts +45 -0
- package/dist/core/plugins/video.js +77 -0
- package/dist/core/reference-graph.d.ts +41 -0
- package/dist/core/reference-graph.js +138 -0
- package/dist/core/slice-data.d.ts +61 -0
- package/dist/core/slice-data.js +49 -0
- package/dist/runtime/chroma-key-gl.d.ts +40 -22
- package/dist/runtime/chroma-key-gl.js +189 -183
- package/dist/runtime/components/ChromaKeyVideo.svelte +3 -3
- package/dist/runtime/components/ChromaKeyVideo.svelte.d.ts +21 -0
- package/dist/runtime/components/Image.svelte +1 -1
- package/dist/runtime/components/Image.svelte.d.ts +9 -0
- package/dist/runtime/components/Slice.svelte +1 -1
- package/dist/runtime/components/Slice.svelte.d.ts +19 -0
- package/dist/runtime/components/SliceCanvas.svelte +3 -3
- package/dist/runtime/components/SliceCanvas.svelte.d.ts +10 -0
- package/dist/runtime/components/SliceDom.svelte +3 -3
- package/dist/runtime/components/SliceDom.svelte.d.ts +10 -0
- package/dist/runtime/components/Video.svelte +2 -2
- package/dist/runtime/components/Video.svelte.d.ts +18 -0
- package/dist/runtime/geometry.d.ts +55 -35
- package/dist/runtime/geometry.js +186 -191
- package/dist/runtime/index.d.ts +9 -9
- package/dist/runtime/index.js +9 -9
- package/dist/runtime/kind-handlers.d.ts +33 -30
- package/dist/runtime/kind-handlers.js +85 -67
- package/dist/runtime/manifest.d.ts +53 -47
- package/dist/runtime/manifest.js +133 -113
- package/dist/runtime/observe-border-box-size.d.ts +1 -4
- package/dist/runtime/observe-border-box-size.js +9 -10
- package/dist/runtime/preload-registry.d.ts +22 -8
- package/dist/runtime/preload-registry.js +65 -62
- package/dist/server/build.d.ts +8 -0
- package/dist/server/build.js +25 -0
- package/dist/server/check.d.ts +24 -0
- package/dist/server/check.js +199 -0
- package/dist/server/cli-commands.d.ts +25 -0
- package/dist/server/cli-commands.js +1178 -0
- package/dist/server/cli-init.d.ts +3 -0
- package/dist/server/cli-init.js +53 -0
- package/dist/server/cli-io.d.ts +46 -0
- package/dist/server/cli-io.js +105 -0
- package/dist/server/codegen.d.ts +58 -0
- package/dist/server/codegen.js +185 -0
- package/dist/server/config-loader.d.ts +35 -0
- package/dist/server/config-loader.js +79 -0
- package/dist/server/context.d.ts +8 -0
- package/dist/server/context.js +19 -0
- package/dist/server/folder-filesystem.d.ts +7 -0
- package/dist/server/folder-filesystem.js +39 -0
- package/dist/server/http.d.ts +12 -0
- package/dist/server/http.js +100 -0
- package/dist/server/index.d.ts +17 -0
- package/dist/server/index.js +9 -0
- package/dist/server/job-hash.d.ts +10 -0
- package/dist/server/job-hash.js +23 -0
- package/dist/server/library-store.d.ts +82 -0
- package/dist/server/library-store.js +763 -0
- package/dist/server/operations.d.ts +87 -0
- package/dist/server/operations.js +427 -0
- package/dist/server/plugins/audio.d.ts +8 -0
- package/dist/server/plugins/audio.js +41 -0
- package/dist/server/plugins/chroma-key-video.d.ts +9 -0
- package/dist/server/plugins/chroma-key-video.js +40 -0
- package/dist/server/plugins/config.d.ts +13 -0
- package/dist/server/plugins/config.js +32 -0
- package/dist/server/plugins/contract.d.ts +114 -0
- package/dist/server/plugins/contract.js +16 -0
- package/dist/server/plugins/image.d.ts +9 -0
- package/dist/server/plugins/image.js +43 -0
- package/dist/server/plugins/slice.d.ts +15 -0
- package/dist/server/plugins/slice.js +76 -0
- package/dist/server/plugins/video.d.ts +7 -0
- package/dist/server/plugins/video.js +54 -0
- package/dist/server/plugins.d.ts +23 -0
- package/dist/server/plugins.js +35 -0
- package/dist/server/processing/audio-processing.d.ts +17 -0
- package/dist/server/processing/audio-processing.js +46 -0
- package/dist/server/processing/ffmpeg.d.ts +9 -0
- package/dist/server/processing/ffmpeg.js +50 -0
- package/dist/server/processing/image-processing.d.ts +16 -0
- package/dist/server/processing/image-processing.js +26 -0
- package/dist/server/processing/media-probe.d.ts +15 -0
- package/dist/server/processing/media-probe.js +27 -0
- package/dist/server/processing/processor.d.ts +50 -0
- package/dist/server/processing/processor.js +158 -0
- package/dist/server/processing/video-processing.d.ts +35 -0
- package/dist/server/processing/video-processing.js +87 -0
- package/dist/server/server.d.ts +13 -0
- package/dist/server/server.js +57 -0
- package/dist/server/start.d.ts +13 -0
- package/dist/server/start.js +80 -0
- package/package.json +31 -16
- package/dist/build-CZYFLLvl.js +0 -191
- package/dist/core/image-Dqmz8FXS.js +0 -54
- package/dist/core/reference-graph-CjuHbLDw.d.ts +0 -280
- package/dist/core/testing.d.ts +0 -27
- package/dist/core/testing.js +0 -80
- package/dist/editor/200.html +0 -37
- package/dist/editor/_app/immutable/assets/2.DIbbW7U1.css +0 -1
- package/dist/editor/_app/immutable/assets/3.C-9vFQ9A.css +0 -1
- package/dist/editor/_app/immutable/assets/4.BS8ElpOV.css +0 -1
- package/dist/editor/_app/immutable/assets/ConfirmDialog.CHEISE-L.css +0 -1
- package/dist/editor/_app/immutable/assets/LibraryContextMenu.CDjCmdV-.css +0 -1
- package/dist/editor/_app/immutable/chunks/Cx6qtxJg.js +0 -1
- package/dist/editor/_app/immutable/chunks/DjdrdRzT.js +0 -1
- package/dist/editor/_app/immutable/chunks/n7mvYc42.js +0 -5
- package/dist/editor/_app/immutable/entry/start.C8HHOLly.js +0 -1
- package/dist/editor/_app/immutable/nodes/2.BrA0Hyzu.js +0 -3
- package/dist/editor/_app/immutable/nodes/3.WO7tZH_d.js +0 -104
- package/dist/editor/_app/immutable/nodes/4.DQtx17aW.js +0 -2
- package/dist/editor/_app/version.json +0 -1
- package/dist/index.d.ts +0 -370
- package/dist/index.js +0 -4
- package/dist/start-Bhnqt9Dc.js +0 -279
- package/dist/start-D2IXOrni.js +0 -2
- /package/{dist/editor → build/client}/_app/immutable/assets/0.DLhIsYA_.css +0 -0
- /package/{dist/editor → build/client}/_app/immutable/chunks/Bjy-W4x2.js +0 -0
- /package/{dist/editor → build/client}/_app/immutable/chunks/CNRz3sSw.js +0 -0
- /package/{dist/editor → build/client}/_app/immutable/chunks/CO4RBJfa.js +0 -0
- /package/{dist/editor → build/client}/_app/immutable/chunks/xihTtKlq.js +0 -0
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
//#region src/chroma-key-gl.ts
|
|
2
1
|
const VERTEX_SHADER = `#version 300 es
|
|
3
2
|
in vec2 a_pos;
|
|
4
3
|
out vec2 v_uv;
|
|
@@ -8,6 +7,10 @@ void main() {
|
|
|
8
7
|
v_uv = vec2(a_pos.x * 0.5 + 0.5, 0.5 - a_pos.y * 0.5);
|
|
9
8
|
gl_Position = vec4(a_pos, 0.0, 1.0);
|
|
10
9
|
}`;
|
|
10
|
+
// The upstream fragment, translated HLSL → GLSL. Kept structurally identical (same
|
|
11
|
+
// function names, same sample pattern, same constants) so it can be diffed against
|
|
12
|
+
// the original; only the texel-size plumbing differs (u_texelSize is (1/w, 1/h),
|
|
13
|
+
// Unity's _MainTex_TexelSize packs (1/w, 1/h, w, h)).
|
|
11
14
|
const FRAGMENT_SHADER = `#version 300 es
|
|
12
15
|
precision highp float;
|
|
13
16
|
|
|
@@ -105,186 +108,189 @@ void main() {
|
|
|
105
108
|
fragColor = vec4(keyed.rgb * keyed.a, keyed.a);
|
|
106
109
|
}`;
|
|
107
110
|
function compileProgram(gl) {
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
111
|
+
const compile = (type, source) => {
|
|
112
|
+
const shader = gl.createShader(type);
|
|
113
|
+
gl.shaderSource(shader, source);
|
|
114
|
+
gl.compileShader(shader);
|
|
115
|
+
if (!gl.getShaderParameter(shader, gl.COMPILE_STATUS)) {
|
|
116
|
+
const log = gl.getShaderInfoLog(shader);
|
|
117
|
+
gl.deleteShader(shader);
|
|
118
|
+
throw new Error(`Chroma-key shader compilation failed: ${log}.`);
|
|
119
|
+
}
|
|
120
|
+
return shader;
|
|
121
|
+
};
|
|
122
|
+
const program = gl.createProgram();
|
|
123
|
+
gl.attachShader(program, compile(gl.VERTEX_SHADER, VERTEX_SHADER));
|
|
124
|
+
gl.attachShader(program, compile(gl.FRAGMENT_SHADER, FRAGMENT_SHADER));
|
|
125
|
+
gl.linkProgram(program);
|
|
126
|
+
if (!gl.getProgramParameter(program, gl.LINK_STATUS)) {
|
|
127
|
+
const log = gl.getProgramInfoLog(program);
|
|
128
|
+
gl.deleteProgram(program);
|
|
129
|
+
throw new Error(`Chroma-key program linking failed: ${log}.`);
|
|
130
|
+
}
|
|
131
|
+
return program;
|
|
132
|
+
}
|
|
133
|
+
export class ChromaKeyGl {
|
|
134
|
+
#gl;
|
|
135
|
+
#canvas;
|
|
136
|
+
// GL resources — recreated on context restore, so not readonly.
|
|
137
|
+
#program;
|
|
138
|
+
#quadBuffer;
|
|
139
|
+
#texture;
|
|
140
|
+
#uniforms;
|
|
141
|
+
#maskTexture;
|
|
142
|
+
/** Last mask image, kept so the texture can be re-uploaded after a context restore. */
|
|
143
|
+
#maskImage = null;
|
|
144
|
+
/** True between webglcontextlost and webglcontextrestored — draw no-ops meanwhile. */
|
|
145
|
+
#contextLost = false;
|
|
146
|
+
/** Returns null when WebGL2 is unavailable or the shader fails to compile. */
|
|
147
|
+
static create(canvas) {
|
|
148
|
+
// Premultiplied alpha — the fragment shader multiplies rgb by alpha (see the
|
|
149
|
+
// note above fragColor), which reproduces the upstream blend and survives
|
|
150
|
+
// iOS WKWebView, which composites as premultiplied no matter what this flag says.
|
|
151
|
+
const gl = canvas.getContext('webgl2', {
|
|
152
|
+
premultipliedAlpha: true,
|
|
153
|
+
alpha: true,
|
|
154
|
+
depth: false,
|
|
155
|
+
stencil: false,
|
|
156
|
+
antialias: false
|
|
157
|
+
});
|
|
158
|
+
if (!gl)
|
|
159
|
+
return null;
|
|
160
|
+
try {
|
|
161
|
+
return new ChromaKeyGl(gl, canvas);
|
|
162
|
+
}
|
|
163
|
+
catch {
|
|
164
|
+
return null;
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
constructor(gl, canvas) {
|
|
168
|
+
this.#gl = gl;
|
|
169
|
+
this.#canvas = canvas;
|
|
170
|
+
// A real context loss (Android background/foreground, GPU pressure) invalidates
|
|
171
|
+
// every GL object; preventDefault keeps the context restorable and the next
|
|
172
|
+
// draw() after the rebuild repaints from the still-playing video.
|
|
173
|
+
canvas.addEventListener('webglcontextlost', this.#handleContextLost);
|
|
174
|
+
canvas.addEventListener('webglcontextrestored', this.#handleContextRestored);
|
|
175
|
+
this.#initResources();
|
|
176
|
+
}
|
|
177
|
+
#handleContextLost = (event) => {
|
|
178
|
+
event.preventDefault();
|
|
179
|
+
this.#contextLost = true;
|
|
180
|
+
};
|
|
181
|
+
#handleContextRestored = () => {
|
|
182
|
+
try {
|
|
183
|
+
this.#initResources();
|
|
184
|
+
this.#contextLost = false;
|
|
185
|
+
}
|
|
186
|
+
catch {
|
|
187
|
+
this.#contextLost = true;
|
|
188
|
+
}
|
|
189
|
+
};
|
|
190
|
+
/** (Re)create all GL resources on the current context — at construction and after restore. */
|
|
191
|
+
#initResources() {
|
|
192
|
+
const gl = this.#gl;
|
|
193
|
+
this.#program = compileProgram(gl);
|
|
194
|
+
gl.useProgram(this.#program);
|
|
195
|
+
const location = (name) => gl.getUniformLocation(this.#program, name);
|
|
196
|
+
this.#uniforms = {
|
|
197
|
+
texelSize: location('u_texelSize'),
|
|
198
|
+
keyColor: location('u_keyColor'),
|
|
199
|
+
tintColor: location('u_tintColor'),
|
|
200
|
+
colorCutoff: location('u_colorCutoff'),
|
|
201
|
+
colorFeathering: location('u_colorFeathering'),
|
|
202
|
+
maskFeathering: location('u_maskFeathering'),
|
|
203
|
+
sharpening: location('u_sharpening'),
|
|
204
|
+
despill: location('u_despill'),
|
|
205
|
+
despillLuminanceAdd: location('u_despillLuminanceAdd')
|
|
206
|
+
};
|
|
207
|
+
gl.uniform1i(gl.getUniformLocation(this.#program, 'u_texture'), 0);
|
|
208
|
+
gl.uniform1i(gl.getUniformLocation(this.#program, 'u_mask'), 1);
|
|
209
|
+
// Tint stays constant white; presentation styling belongs to the host.
|
|
210
|
+
gl.uniform4f(this.#uniforms.tintColor, 1, 1, 1, 1);
|
|
211
|
+
this.#quadBuffer = gl.createBuffer();
|
|
212
|
+
gl.bindBuffer(gl.ARRAY_BUFFER, this.#quadBuffer);
|
|
213
|
+
gl.bufferData(gl.ARRAY_BUFFER, new Float32Array([-1, -1, 1, -1, -1, 1, 1, 1]), gl.STATIC_DRAW);
|
|
214
|
+
const positionLocation = gl.getAttribLocation(this.#program, 'a_pos');
|
|
215
|
+
gl.enableVertexAttribArray(positionLocation);
|
|
216
|
+
gl.vertexAttribPointer(positionLocation, 2, gl.FLOAT, false, 0, 0);
|
|
217
|
+
this.#texture = gl.createTexture();
|
|
218
|
+
gl.bindTexture(gl.TEXTURE_2D, this.#texture);
|
|
219
|
+
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE);
|
|
220
|
+
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE);
|
|
221
|
+
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.LINEAR);
|
|
222
|
+
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.LINEAR);
|
|
223
|
+
this.#maskTexture = gl.createTexture();
|
|
224
|
+
gl.bindTexture(gl.TEXTURE_2D, this.#maskTexture);
|
|
225
|
+
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE);
|
|
226
|
+
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE);
|
|
227
|
+
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.LINEAR);
|
|
228
|
+
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.LINEAR);
|
|
229
|
+
// The old mask texture is invalid after a context loss; re-upload the kept image.
|
|
230
|
+
this.#uploadMask();
|
|
231
|
+
gl.disable(gl.DEPTH_TEST);
|
|
232
|
+
gl.disable(gl.BLEND);
|
|
233
|
+
gl.clearColor(0, 0, 0, 0);
|
|
234
|
+
}
|
|
235
|
+
/**
|
|
236
|
+
* Set (or clear) the grayscale shape mask multiplied onto the output alpha. The
|
|
237
|
+
* mask is stretched over the full video frame, so author it at the video's aspect
|
|
238
|
+
* ratio. Pass null to remove the mask.
|
|
239
|
+
*/
|
|
240
|
+
setMask(image) {
|
|
241
|
+
this.#maskImage = image;
|
|
242
|
+
if (!this.#contextLost)
|
|
243
|
+
this.#uploadMask();
|
|
244
|
+
}
|
|
245
|
+
#uploadMask() {
|
|
246
|
+
const gl = this.#gl;
|
|
247
|
+
gl.bindTexture(gl.TEXTURE_2D, this.#maskTexture);
|
|
248
|
+
if (this.#maskImage) {
|
|
249
|
+
gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, gl.RGBA, gl.UNSIGNED_BYTE, this.#maskImage);
|
|
250
|
+
}
|
|
251
|
+
else {
|
|
252
|
+
// 1×1 white — the mask multiply becomes a no-op.
|
|
253
|
+
gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, 1, 1, 0, gl.RGBA, gl.UNSIGNED_BYTE, new Uint8Array([255, 255, 255, 255]));
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
/**
|
|
257
|
+
* Upload the video's current frame and render it keyed. Sizes the drawing buffer to
|
|
258
|
+
* the video's intrinsic size on first draw (and after a size change).
|
|
259
|
+
*/
|
|
260
|
+
draw(video, parameters) {
|
|
261
|
+
if (this.#contextLost || video.videoWidth === 0)
|
|
262
|
+
return;
|
|
263
|
+
const gl = this.#gl;
|
|
264
|
+
if (this.#canvas.width !== video.videoWidth || this.#canvas.height !== video.videoHeight) {
|
|
265
|
+
this.#canvas.width = video.videoWidth;
|
|
266
|
+
this.#canvas.height = video.videoHeight;
|
|
267
|
+
gl.viewport(0, 0, video.videoWidth, video.videoHeight);
|
|
268
|
+
}
|
|
269
|
+
gl.activeTexture(gl.TEXTURE1);
|
|
270
|
+
gl.bindTexture(gl.TEXTURE_2D, this.#maskTexture);
|
|
271
|
+
gl.activeTexture(gl.TEXTURE0);
|
|
272
|
+
gl.bindTexture(gl.TEXTURE_2D, this.#texture);
|
|
273
|
+
gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, gl.RGBA, gl.UNSIGNED_BYTE, video);
|
|
274
|
+
gl.useProgram(this.#program);
|
|
275
|
+
gl.uniform2f(this.#uniforms.texelSize, 1 / video.videoWidth, 1 / video.videoHeight);
|
|
276
|
+
gl.uniform3fv(this.#uniforms.keyColor, parameters.keyColor);
|
|
277
|
+
gl.uniform1f(this.#uniforms.colorCutoff, parameters.colorCutoff);
|
|
278
|
+
gl.uniform1f(this.#uniforms.colorFeathering, parameters.colorFeathering);
|
|
279
|
+
gl.uniform1f(this.#uniforms.maskFeathering, parameters.maskFeathering);
|
|
280
|
+
gl.uniform1f(this.#uniforms.sharpening, parameters.sharpening);
|
|
281
|
+
gl.uniform1f(this.#uniforms.despill, parameters.despill);
|
|
282
|
+
gl.uniform1f(this.#uniforms.despillLuminanceAdd, parameters.despillLuminanceAdd);
|
|
283
|
+
gl.clear(gl.COLOR_BUFFER_BIT);
|
|
284
|
+
gl.drawArrays(gl.TRIANGLE_STRIP, 0, 4);
|
|
285
|
+
}
|
|
286
|
+
dispose() {
|
|
287
|
+
this.#canvas.removeEventListener('webglcontextlost', this.#handleContextLost);
|
|
288
|
+
this.#canvas.removeEventListener('webglcontextrestored', this.#handleContextRestored);
|
|
289
|
+
const gl = this.#gl;
|
|
290
|
+
gl.deleteBuffer(this.#quadBuffer);
|
|
291
|
+
gl.deleteTexture(this.#texture);
|
|
292
|
+
gl.deleteTexture(this.#maskTexture);
|
|
293
|
+
gl.deleteProgram(this.#program);
|
|
294
|
+
gl.getExtension('WEBGL_lose_context')?.loseContext();
|
|
295
|
+
}
|
|
129
296
|
}
|
|
130
|
-
var ChromaKeyGl = class ChromaKeyGl {
|
|
131
|
-
#gl;
|
|
132
|
-
#canvas;
|
|
133
|
-
#program;
|
|
134
|
-
#quadBuffer;
|
|
135
|
-
#texture;
|
|
136
|
-
#uniforms;
|
|
137
|
-
#maskTexture;
|
|
138
|
-
/** Last mask image, kept so the texture can be re-uploaded after a context restore. */
|
|
139
|
-
#maskImage = null;
|
|
140
|
-
/** True between webglcontextlost and webglcontextrestored — draw no-ops meanwhile. */
|
|
141
|
-
#contextLost = false;
|
|
142
|
-
/** Returns null when WebGL2 is unavailable or the shader fails to compile. */
|
|
143
|
-
static create(canvas) {
|
|
144
|
-
const gl = canvas.getContext("webgl2", {
|
|
145
|
-
premultipliedAlpha: true,
|
|
146
|
-
alpha: true,
|
|
147
|
-
depth: false,
|
|
148
|
-
stencil: false,
|
|
149
|
-
antialias: false
|
|
150
|
-
});
|
|
151
|
-
if (!gl) return null;
|
|
152
|
-
try {
|
|
153
|
-
return new ChromaKeyGl(gl, canvas);
|
|
154
|
-
} catch {
|
|
155
|
-
return null;
|
|
156
|
-
}
|
|
157
|
-
}
|
|
158
|
-
constructor(gl, canvas) {
|
|
159
|
-
this.#gl = gl;
|
|
160
|
-
this.#canvas = canvas;
|
|
161
|
-
canvas.addEventListener("webglcontextlost", this.#handleContextLost);
|
|
162
|
-
canvas.addEventListener("webglcontextrestored", this.#handleContextRestored);
|
|
163
|
-
this.#initResources();
|
|
164
|
-
}
|
|
165
|
-
#handleContextLost = (event) => {
|
|
166
|
-
event.preventDefault();
|
|
167
|
-
this.#contextLost = true;
|
|
168
|
-
};
|
|
169
|
-
#handleContextRestored = () => {
|
|
170
|
-
try {
|
|
171
|
-
this.#initResources();
|
|
172
|
-
this.#contextLost = false;
|
|
173
|
-
} catch {
|
|
174
|
-
this.#contextLost = true;
|
|
175
|
-
}
|
|
176
|
-
};
|
|
177
|
-
/** (Re)create all GL resources on the current context — at construction and after restore. */
|
|
178
|
-
#initResources() {
|
|
179
|
-
const gl = this.#gl;
|
|
180
|
-
this.#program = compileProgram(gl);
|
|
181
|
-
gl.useProgram(this.#program);
|
|
182
|
-
const location = (name) => gl.getUniformLocation(this.#program, name);
|
|
183
|
-
this.#uniforms = {
|
|
184
|
-
texelSize: location("u_texelSize"),
|
|
185
|
-
keyColor: location("u_keyColor"),
|
|
186
|
-
tintColor: location("u_tintColor"),
|
|
187
|
-
colorCutoff: location("u_colorCutoff"),
|
|
188
|
-
colorFeathering: location("u_colorFeathering"),
|
|
189
|
-
maskFeathering: location("u_maskFeathering"),
|
|
190
|
-
sharpening: location("u_sharpening"),
|
|
191
|
-
despill: location("u_despill"),
|
|
192
|
-
despillLuminanceAdd: location("u_despillLuminanceAdd")
|
|
193
|
-
};
|
|
194
|
-
gl.uniform1i(gl.getUniformLocation(this.#program, "u_texture"), 0);
|
|
195
|
-
gl.uniform1i(gl.getUniformLocation(this.#program, "u_mask"), 1);
|
|
196
|
-
gl.uniform4f(this.#uniforms.tintColor, 1, 1, 1, 1);
|
|
197
|
-
this.#quadBuffer = gl.createBuffer();
|
|
198
|
-
gl.bindBuffer(gl.ARRAY_BUFFER, this.#quadBuffer);
|
|
199
|
-
gl.bufferData(gl.ARRAY_BUFFER, new Float32Array([
|
|
200
|
-
-1,
|
|
201
|
-
-1,
|
|
202
|
-
1,
|
|
203
|
-
-1,
|
|
204
|
-
-1,
|
|
205
|
-
1,
|
|
206
|
-
1,
|
|
207
|
-
1
|
|
208
|
-
]), gl.STATIC_DRAW);
|
|
209
|
-
const positionLocation = gl.getAttribLocation(this.#program, "a_pos");
|
|
210
|
-
gl.enableVertexAttribArray(positionLocation);
|
|
211
|
-
gl.vertexAttribPointer(positionLocation, 2, gl.FLOAT, false, 0, 0);
|
|
212
|
-
this.#texture = gl.createTexture();
|
|
213
|
-
gl.bindTexture(gl.TEXTURE_2D, this.#texture);
|
|
214
|
-
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE);
|
|
215
|
-
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE);
|
|
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
|
-
this.#maskTexture = gl.createTexture();
|
|
219
|
-
gl.bindTexture(gl.TEXTURE_2D, this.#maskTexture);
|
|
220
|
-
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE);
|
|
221
|
-
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE);
|
|
222
|
-
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.LINEAR);
|
|
223
|
-
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.LINEAR);
|
|
224
|
-
this.#uploadMask();
|
|
225
|
-
gl.disable(gl.DEPTH_TEST);
|
|
226
|
-
gl.disable(gl.BLEND);
|
|
227
|
-
gl.clearColor(0, 0, 0, 0);
|
|
228
|
-
}
|
|
229
|
-
/**
|
|
230
|
-
* Set (or clear) the grayscale shape mask multiplied onto the output alpha. The
|
|
231
|
-
* mask is stretched over the full video frame, so author it at the video's aspect
|
|
232
|
-
* ratio. Pass null to remove the mask.
|
|
233
|
-
*/
|
|
234
|
-
setMask(image) {
|
|
235
|
-
this.#maskImage = image;
|
|
236
|
-
if (!this.#contextLost) this.#uploadMask();
|
|
237
|
-
}
|
|
238
|
-
#uploadMask() {
|
|
239
|
-
const gl = this.#gl;
|
|
240
|
-
gl.bindTexture(gl.TEXTURE_2D, this.#maskTexture);
|
|
241
|
-
if (this.#maskImage) gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, gl.RGBA, gl.UNSIGNED_BYTE, this.#maskImage);
|
|
242
|
-
else gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, 1, 1, 0, gl.RGBA, gl.UNSIGNED_BYTE, new Uint8Array([
|
|
243
|
-
255,
|
|
244
|
-
255,
|
|
245
|
-
255,
|
|
246
|
-
255
|
|
247
|
-
]));
|
|
248
|
-
}
|
|
249
|
-
/**
|
|
250
|
-
* Upload the video's current frame and render it keyed. Sizes the drawing buffer to
|
|
251
|
-
* the video's intrinsic size on first draw (and after a size change).
|
|
252
|
-
*/
|
|
253
|
-
draw(video, parameters) {
|
|
254
|
-
if (this.#contextLost || video.videoWidth === 0) return;
|
|
255
|
-
const gl = this.#gl;
|
|
256
|
-
if (this.#canvas.width !== video.videoWidth || this.#canvas.height !== video.videoHeight) {
|
|
257
|
-
this.#canvas.width = video.videoWidth;
|
|
258
|
-
this.#canvas.height = video.videoHeight;
|
|
259
|
-
gl.viewport(0, 0, video.videoWidth, video.videoHeight);
|
|
260
|
-
}
|
|
261
|
-
gl.activeTexture(gl.TEXTURE1);
|
|
262
|
-
gl.bindTexture(gl.TEXTURE_2D, this.#maskTexture);
|
|
263
|
-
gl.activeTexture(gl.TEXTURE0);
|
|
264
|
-
gl.bindTexture(gl.TEXTURE_2D, this.#texture);
|
|
265
|
-
gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, gl.RGBA, gl.UNSIGNED_BYTE, video);
|
|
266
|
-
gl.useProgram(this.#program);
|
|
267
|
-
gl.uniform2f(this.#uniforms.texelSize, 1 / video.videoWidth, 1 / video.videoHeight);
|
|
268
|
-
gl.uniform3fv(this.#uniforms.keyColor, parameters.keyColor);
|
|
269
|
-
gl.uniform1f(this.#uniforms.colorCutoff, parameters.colorCutoff);
|
|
270
|
-
gl.uniform1f(this.#uniforms.colorFeathering, parameters.colorFeathering);
|
|
271
|
-
gl.uniform1f(this.#uniforms.maskFeathering, parameters.maskFeathering);
|
|
272
|
-
gl.uniform1f(this.#uniforms.sharpening, parameters.sharpening);
|
|
273
|
-
gl.uniform1f(this.#uniforms.despill, parameters.despill);
|
|
274
|
-
gl.uniform1f(this.#uniforms.despillLuminanceAdd, parameters.despillLuminanceAdd);
|
|
275
|
-
gl.clear(gl.COLOR_BUFFER_BIT);
|
|
276
|
-
gl.drawArrays(gl.TRIANGLE_STRIP, 0, 4);
|
|
277
|
-
}
|
|
278
|
-
dispose() {
|
|
279
|
-
this.#canvas.removeEventListener("webglcontextlost", this.#handleContextLost);
|
|
280
|
-
this.#canvas.removeEventListener("webglcontextrestored", this.#handleContextRestored);
|
|
281
|
-
const gl = this.#gl;
|
|
282
|
-
gl.deleteBuffer(this.#quadBuffer);
|
|
283
|
-
gl.deleteTexture(this.#texture);
|
|
284
|
-
gl.deleteTexture(this.#maskTexture);
|
|
285
|
-
gl.deleteProgram(this.#program);
|
|
286
|
-
gl.getExtension("WEBGL_lose_context")?.loseContext();
|
|
287
|
-
}
|
|
288
|
-
};
|
|
289
|
-
//#endregion
|
|
290
|
-
export { ChromaKeyGl };
|
|
@@ -4,9 +4,9 @@
|
|
|
4
4
|
-->
|
|
5
5
|
<script lang="ts">
|
|
6
6
|
import { onMount, type Snippet } from 'svelte';
|
|
7
|
-
import type { ChromaKeyVideoManifestEntry } from '
|
|
8
|
-
import { ChromaKeyGl } from '../chroma-key-gl';
|
|
9
|
-
import { resolveRetainedSource } from '../preload-registry';
|
|
7
|
+
import type { ChromaKeyVideoManifestEntry } from '../../core/index.js';
|
|
8
|
+
import { ChromaKeyGl } from '../chroma-key-gl.js';
|
|
9
|
+
import { resolveRetainedSource } from '../preload-registry.js';
|
|
10
10
|
|
|
11
11
|
interface Props {
|
|
12
12
|
src: ChromaKeyVideoManifestEntry;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { type Snippet } from 'svelte';
|
|
2
|
+
import type { ChromaKeyVideoManifestEntry } from '../../core/index.js';
|
|
3
|
+
interface Props {
|
|
4
|
+
src: ChromaKeyVideoManifestEntry;
|
|
5
|
+
/** Loop playback (default true for keyed clips). */
|
|
6
|
+
loop?: boolean;
|
|
7
|
+
/**
|
|
8
|
+
* Playback on/off (default true) — false pauses the video AND the render loop,
|
|
9
|
+
* so an off-screen instance costs nothing. The canvas keeps showing the last
|
|
10
|
+
* keyed frame; a keying-parameter change repaints that still frame in place.
|
|
11
|
+
*/
|
|
12
|
+
playing?: boolean;
|
|
13
|
+
/** Rendered instead of the canvas when WebGL2 is unavailable; overrides the entry's fallback image. */
|
|
14
|
+
fallback?: Snippet;
|
|
15
|
+
/** Bindable handle on the (hidden) source element, so a host can drive playback itself. */
|
|
16
|
+
videoElement?: HTMLVideoElement;
|
|
17
|
+
class?: string;
|
|
18
|
+
}
|
|
19
|
+
declare const ChromaKeyVideo: import("svelte").Component<Props, {}, "videoElement">;
|
|
20
|
+
type ChromaKeyVideo = ReturnType<typeof ChromaKeyVideo>;
|
|
21
|
+
export default ChromaKeyVideo;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { ImageManifestEntry } from '../../core/index.js';
|
|
2
|
+
interface Props {
|
|
3
|
+
src: ImageManifestEntry;
|
|
4
|
+
alt?: string;
|
|
5
|
+
class?: string;
|
|
6
|
+
}
|
|
7
|
+
declare const Image: import("svelte").Component<Props, {}, "">;
|
|
8
|
+
type Image = ReturnType<typeof Image>;
|
|
9
|
+
export default Image;
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
(`computeRenderCells`) and therefore render the same cells.
|
|
6
6
|
-->
|
|
7
7
|
<script lang="ts">
|
|
8
|
-
import type { SliceManifestEntry } from '
|
|
8
|
+
import type { SliceManifestEntry } from '../../core/index.js';
|
|
9
9
|
import SliceDom from './SliceDom.svelte';
|
|
10
10
|
import SliceCanvas from './SliceCanvas.svelte';
|
|
11
11
|
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { SliceManifestEntry } from '../../core/index.js';
|
|
2
|
+
interface Props {
|
|
3
|
+
src: SliceManifestEntry;
|
|
4
|
+
/**
|
|
5
|
+
* Rendering backend. `dom` (default) paints one absolutely-positioned
|
|
6
|
+
* `<img>` window per cell; `canvas` draws every cell into a single
|
|
7
|
+
* `<canvas>`. Both produce the same cells — but the DOM backend can
|
|
8
|
+
* flicker in some situations (cells are separate elements the browser
|
|
9
|
+
* composites independently, so a resize mid-animation can tear), so
|
|
10
|
+
* hosts pick `canvas` where that hurts.
|
|
11
|
+
*/
|
|
12
|
+
backend?: 'dom' | 'canvas';
|
|
13
|
+
/** Accessible label for the rendered graphic. */
|
|
14
|
+
alt?: string;
|
|
15
|
+
class?: string;
|
|
16
|
+
}
|
|
17
|
+
declare const Slice: import("svelte").Component<Props, {}, "">;
|
|
18
|
+
type Slice = ReturnType<typeof Slice>;
|
|
19
|
+
export default Slice;
|
|
@@ -16,9 +16,9 @@
|
|
|
16
16
|
size — exactly where the DOM backend positions its overdraw cells.
|
|
17
17
|
-->
|
|
18
18
|
<script lang="ts">
|
|
19
|
-
import type { SliceManifestEntry } from '
|
|
20
|
-
import { computeCanvasPaintLayout, computeRenderCells } from '../geometry';
|
|
21
|
-
import { observeBorderBoxSize } from '../observe-border-box-size';
|
|
19
|
+
import type { SliceManifestEntry } from '../../core/index.js';
|
|
20
|
+
import { computeCanvasPaintLayout, computeRenderCells } from '../geometry.js';
|
|
21
|
+
import { observeBorderBoxSize } from '../observe-border-box-size.js';
|
|
22
22
|
|
|
23
23
|
interface Props {
|
|
24
24
|
src: SliceManifestEntry;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { SliceManifestEntry } from '../../core/index.js';
|
|
2
|
+
interface Props {
|
|
3
|
+
src: SliceManifestEntry;
|
|
4
|
+
/** Accessible label for the rendered graphic. */
|
|
5
|
+
alt?: string;
|
|
6
|
+
class?: string;
|
|
7
|
+
}
|
|
8
|
+
declare const SliceCanvas: import("svelte").Component<Props, {}, "">;
|
|
9
|
+
type SliceCanvas = ReturnType<typeof SliceCanvas>;
|
|
10
|
+
export default SliceCanvas;
|
|
@@ -15,9 +15,9 @@
|
|
|
15
15
|
layout box.
|
|
16
16
|
-->
|
|
17
17
|
<script lang="ts">
|
|
18
|
-
import type { SliceManifestEntry } from '
|
|
19
|
-
import { computeRenderCells, effectiveOverdraw } from '../geometry';
|
|
20
|
-
import { observeBorderBoxSize } from '../observe-border-box-size';
|
|
18
|
+
import type { SliceManifestEntry } from '../../core/index.js';
|
|
19
|
+
import { computeRenderCells, effectiveOverdraw } from '../geometry.js';
|
|
20
|
+
import { observeBorderBoxSize } from '../observe-border-box-size.js';
|
|
21
21
|
|
|
22
22
|
interface Props {
|
|
23
23
|
src: SliceManifestEntry;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { SliceManifestEntry } from '../../core/index.js';
|
|
2
|
+
interface Props {
|
|
3
|
+
src: SliceManifestEntry;
|
|
4
|
+
/** Accessible label for the rendered graphic. */
|
|
5
|
+
alt?: string;
|
|
6
|
+
class?: string;
|
|
7
|
+
}
|
|
8
|
+
declare const SliceDom: import("svelte").Component<Props, {}, "">;
|
|
9
|
+
type SliceDom = ReturnType<typeof SliceDom>;
|
|
10
|
+
export default SliceDom;
|
|
@@ -5,8 +5,8 @@
|
|
|
5
5
|
where and how it plays is host behavior, so loop/playing/muted/controls stay props.
|
|
6
6
|
-->
|
|
7
7
|
<script lang="ts">
|
|
8
|
-
import type { VideoManifestEntry } from '
|
|
9
|
-
import { resolveRetainedSource } from '../preload-registry';
|
|
8
|
+
import type { VideoManifestEntry } from '../../core/index.js';
|
|
9
|
+
import { resolveRetainedSource } from '../preload-registry.js';
|
|
10
10
|
|
|
11
11
|
interface Props {
|
|
12
12
|
src: VideoManifestEntry;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { VideoManifestEntry } from '../../core/index.js';
|
|
2
|
+
interface Props {
|
|
3
|
+
src: VideoManifestEntry;
|
|
4
|
+
/** Loop playback (default false — a plain clip ends unless the host says otherwise). */
|
|
5
|
+
loop?: boolean;
|
|
6
|
+
/** Playback on/off (default true). */
|
|
7
|
+
playing?: boolean;
|
|
8
|
+
/** Muted (default true — required for autoplay in every mobile browser). */
|
|
9
|
+
muted?: boolean;
|
|
10
|
+
/** Show native playback controls (default false). */
|
|
11
|
+
controls?: boolean;
|
|
12
|
+
/** Bindable handle on the underlying element, so a host can drive playback itself. */
|
|
13
|
+
videoElement?: HTMLVideoElement;
|
|
14
|
+
class?: string;
|
|
15
|
+
}
|
|
16
|
+
declare const Video: import("svelte").Component<Props, {}, "videoElement">;
|
|
17
|
+
type Video = ReturnType<typeof Video>;
|
|
18
|
+
export default Video;
|