@nodetool-ai/timeline 0.8.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.
- package/README.md +55 -0
- package/dist/.nodetool-build-stamp +1 -0
- package/dist/animation/bakedAnimation.d.ts +84 -0
- package/dist/animation/bakedAnimation.d.ts.map +1 -0
- package/dist/animation/bakedAnimation.js +95 -0
- package/dist/animation/bakedAnimation.js.map +1 -0
- package/dist/animation/beat.d.ts +7 -0
- package/dist/animation/beat.d.ts.map +1 -0
- package/dist/animation/beat.js +36 -0
- package/dist/animation/beat.js.map +1 -0
- package/dist/animation/compile.d.ts +184 -0
- package/dist/animation/compile.d.ts.map +1 -0
- package/dist/animation/compile.js +312 -0
- package/dist/animation/compile.js.map +1 -0
- package/dist/animation/custom.d.ts +183 -0
- package/dist/animation/custom.d.ts.map +1 -0
- package/dist/animation/custom.js +583 -0
- package/dist/animation/custom.js.map +1 -0
- package/dist/animation/easing.d.ts +34 -0
- package/dist/animation/easing.d.ts.map +1 -0
- package/dist/animation/easing.js +332 -0
- package/dist/animation/easing.js.map +1 -0
- package/dist/animation/index.d.ts +20 -0
- package/dist/animation/index.d.ts.map +1 -0
- package/dist/animation/index.js +20 -0
- package/dist/animation/index.js.map +1 -0
- package/dist/animation/links.d.ts +33 -0
- package/dist/animation/links.d.ts.map +1 -0
- package/dist/animation/links.js +126 -0
- package/dist/animation/links.js.map +1 -0
- package/dist/animation/presets.d.ts +86 -0
- package/dist/animation/presets.d.ts.map +1 -0
- package/dist/animation/presets.js +642 -0
- package/dist/animation/presets.js.map +1 -0
- package/dist/animation/sample.d.ts +145 -0
- package/dist/animation/sample.d.ts.map +1 -0
- package/dist/animation/sample.js +390 -0
- package/dist/animation/sample.js.map +1 -0
- package/dist/animation/simplify.d.ts +70 -0
- package/dist/animation/simplify.d.ts.map +1 -0
- package/dist/animation/simplify.js +278 -0
- package/dist/animation/simplify.js.map +1 -0
- package/dist/animation/sourceCurves.d.ts +45 -0
- package/dist/animation/sourceCurves.d.ts.map +1 -0
- package/dist/animation/sourceCurves.js +168 -0
- package/dist/animation/sourceCurves.js.map +1 -0
- package/dist/animation/styleTracks.d.ts +23 -0
- package/dist/animation/styleTracks.d.ts.map +1 -0
- package/dist/animation/styleTracks.js +341 -0
- package/dist/animation/styleTracks.js.map +1 -0
- package/dist/animation/types.d.ts +269 -0
- package/dist/animation/types.d.ts.map +1 -0
- package/dist/animation/types.js +173 -0
- package/dist/animation/types.js.map +1 -0
- package/dist/animation/typewriter.d.ts +8 -0
- package/dist/animation/typewriter.d.ts.map +1 -0
- package/dist/animation/typewriter.js +32 -0
- package/dist/animation/typewriter.js.map +1 -0
- package/dist/audioFade.d.ts +73 -0
- package/dist/audioFade.d.ts.map +1 -0
- package/dist/audioFade.js +134 -0
- package/dist/audioFade.js.map +1 -0
- package/dist/authoredStyles.d.ts +61 -0
- package/dist/authoredStyles.d.ts.map +1 -0
- package/dist/authoredStyles.js +90 -0
- package/dist/authoredStyles.js.map +1 -0
- package/dist/authoring.d.ts +50 -0
- package/dist/authoring.d.ts.map +1 -0
- package/dist/authoring.js +207 -0
- package/dist/authoring.js.map +1 -0
- package/dist/beats.d.ts +103 -0
- package/dist/beats.d.ts.map +1 -0
- package/dist/beats.js +228 -0
- package/dist/beats.js.map +1 -0
- package/dist/clone.d.ts +32 -0
- package/dist/clone.d.ts.map +1 -0
- package/dist/clone.js +53 -0
- package/dist/clone.js.map +1 -0
- package/dist/composition.d.ts +87 -0
- package/dist/composition.d.ts.map +1 -0
- package/dist/composition.js +253 -0
- package/dist/composition.js.map +1 -0
- package/dist/crop.d.ts +48 -0
- package/dist/crop.d.ts.map +1 -0
- package/dist/crop.js +75 -0
- package/dist/crop.js.map +1 -0
- package/dist/defaults.d.ts +142 -0
- package/dist/defaults.d.ts.map +1 -0
- package/dist/defaults.js +335 -0
- package/dist/defaults.js.map +1 -0
- package/dist/dependencyHash.d.ts +14 -0
- package/dist/dependencyHash.d.ts.map +1 -0
- package/dist/dependencyHash.js +19 -0
- package/dist/dependencyHash.js.map +1 -0
- package/dist/dropResolve.d.ts +40 -0
- package/dist/dropResolve.d.ts.map +1 -0
- package/dist/dropResolve.js +137 -0
- package/dist/dropResolve.js.map +1 -0
- package/dist/examples/node.d.ts +11 -0
- package/dist/examples/node.d.ts.map +1 -0
- package/dist/examples/node.js +87 -0
- package/dist/examples/node.js.map +1 -0
- package/dist/extension.d.ts +52 -0
- package/dist/extension.d.ts.map +1 -0
- package/dist/extension.js +269 -0
- package/dist/extension.js.map +1 -0
- package/dist/extensionRequest.d.ts +40 -0
- package/dist/extensionRequest.d.ts.map +1 -0
- package/dist/extensionRequest.js +135 -0
- package/dist/extensionRequest.js.map +1 -0
- package/dist/fill-text.d.ts +30 -0
- package/dist/fill-text.d.ts.map +1 -0
- package/dist/fill-text.js +73 -0
- package/dist/fill-text.js.map +1 -0
- package/dist/fonts/catalog.d.ts +97 -0
- package/dist/fonts/catalog.d.ts.map +1 -0
- package/dist/fonts/catalog.js +276 -0
- package/dist/fonts/catalog.js.map +1 -0
- package/dist/fonts/css.d.ts +24 -0
- package/dist/fonts/css.d.ts.map +1 -0
- package/dist/fonts/css.js +50 -0
- package/dist/fonts/css.js.map +1 -0
- package/dist/fonts/index.d.ts +10 -0
- package/dist/fonts/index.d.ts.map +1 -0
- package/dist/fonts/index.js +10 -0
- package/dist/fonts/index.js.map +1 -0
- package/dist/fonts/register-node.d.ts +45 -0
- package/dist/fonts/register-node.d.ts.map +1 -0
- package/dist/fonts/register-node.js +71 -0
- package/dist/fonts/register-node.js.map +1 -0
- package/dist/generatedMatte.d.ts +86 -0
- package/dist/generatedMatte.d.ts.map +1 -0
- package/dist/generatedMatte.js +152 -0
- package/dist/generatedMatte.js.map +1 -0
- package/dist/generative.d.ts +145 -0
- package/dist/generative.d.ts.map +1 -0
- package/dist/generative.js +396 -0
- package/dist/generative.js.map +1 -0
- package/dist/group.d.ts +47 -0
- package/dist/group.d.ts.map +1 -0
- package/dist/group.js +131 -0
- package/dist/group.js.map +1 -0
- package/dist/index.d.ts +55 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +58 -0
- package/dist/index.js.map +1 -0
- package/dist/interchange.d.ts +47 -0
- package/dist/interchange.d.ts.map +1 -0
- package/dist/interchange.js +158 -0
- package/dist/interchange.js.map +1 -0
- package/dist/keyframes.d.ts +44 -0
- package/dist/keyframes.d.ts.map +1 -0
- package/dist/keyframes.js +148 -0
- package/dist/keyframes.js.map +1 -0
- package/dist/lineDelivery.d.ts +108 -0
- package/dist/lineDelivery.d.ts.map +1 -0
- package/dist/lineDelivery.js +154 -0
- package/dist/lineDelivery.js.map +1 -0
- package/dist/linked.d.ts +41 -0
- package/dist/linked.d.ts.map +1 -0
- package/dist/linked.js +166 -0
- package/dist/linked.js.map +1 -0
- package/dist/lipSyncRequest.d.ts +65 -0
- package/dist/lipSyncRequest.d.ts.map +1 -0
- package/dist/lipSyncRequest.js +73 -0
- package/dist/lipSyncRequest.js.map +1 -0
- package/dist/measureClipDurations.d.ts +7 -0
- package/dist/measureClipDurations.d.ts.map +1 -0
- package/dist/measureClipDurations.js +17 -0
- package/dist/measureClipDurations.js.map +1 -0
- package/dist/mediaTrack.d.ts +120 -0
- package/dist/mediaTrack.d.ts.map +1 -0
- package/dist/mediaTrack.js +269 -0
- package/dist/mediaTrack.js.map +1 -0
- package/dist/midi/cacheKey.d.ts +25 -0
- package/dist/midi/cacheKey.d.ts.map +1 -0
- package/dist/midi/cacheKey.js +54 -0
- package/dist/midi/cacheKey.js.map +1 -0
- package/dist/midi/edit.d.ts +48 -0
- package/dist/midi/edit.d.ts.map +1 -0
- package/dist/midi/edit.js +93 -0
- package/dist/midi/edit.js.map +1 -0
- package/dist/midi/engines/bl1.d.ts +29 -0
- package/dist/midi/engines/bl1.d.ts.map +1 -0
- package/dist/midi/engines/bl1.js +128 -0
- package/dist/midi/engines/bl1.js.map +1 -0
- package/dist/midi/engines/dr1.d.ts +28 -0
- package/dist/midi/engines/dr1.d.ts.map +1 -0
- package/dist/midi/engines/dr1.js +101 -0
- package/dist/midi/engines/dr1.js.map +1 -0
- package/dist/midi/engines/dsp.d.ts +126 -0
- package/dist/midi/engines/dsp.d.ts.map +1 -0
- package/dist/midi/engines/dsp.js +371 -0
- package/dist/midi/engines/dsp.js.map +1 -0
- package/dist/midi/engines/index.d.ts +13 -0
- package/dist/midi/engines/index.d.ts.map +1 -0
- package/dist/midi/engines/index.js +13 -0
- package/dist/midi/engines/index.js.map +1 -0
- package/dist/midi/engines/kits.d.ts +12 -0
- package/dist/midi/engines/kits.d.ts.map +1 -0
- package/dist/midi/engines/kits.js +121 -0
- package/dist/midi/engines/kits.js.map +1 -0
- package/dist/midi/engines/wavetables.d.ts +45 -0
- package/dist/midi/engines/wavetables.d.ts.map +1 -0
- package/dist/midi/engines/wavetables.js +334 -0
- package/dist/midi/engines/wavetables.js.map +1 -0
- package/dist/midi/engines/wt1.d.ts +30 -0
- package/dist/midi/engines/wt1.d.ts.map +1 -0
- package/dist/midi/engines/wt1.js +91 -0
- package/dist/midi/engines/wt1.js.map +1 -0
- package/dist/midi/grid.d.ts +51 -0
- package/dist/midi/grid.d.ts.map +1 -0
- package/dist/midi/grid.js +104 -0
- package/dist/midi/grid.js.map +1 -0
- package/dist/midi/index.d.ts +20 -0
- package/dist/midi/index.d.ts.map +1 -0
- package/dist/midi/index.js +20 -0
- package/dist/midi/index.js.map +1 -0
- package/dist/midi/instrument.d.ts +32 -0
- package/dist/midi/instrument.d.ts.map +1 -0
- package/dist/midi/instrument.js +73 -0
- package/dist/midi/instrument.js.map +1 -0
- package/dist/midi/notes.d.ts +46 -0
- package/dist/midi/notes.d.ts.map +1 -0
- package/dist/midi/notes.js +121 -0
- package/dist/midi/notes.js.map +1 -0
- package/dist/midi/notesEdit.d.ts +94 -0
- package/dist/midi/notesEdit.d.ts.map +1 -0
- package/dist/midi/notesEdit.js +159 -0
- package/dist/midi/notesEdit.js.map +1 -0
- package/dist/midi/presets.d.ts +29 -0
- package/dist/midi/presets.d.ts.map +1 -0
- package/dist/midi/presets.js +281 -0
- package/dist/midi/presets.js.map +1 -0
- package/dist/midi/tempo.d.ts +27 -0
- package/dist/midi/tempo.d.ts.map +1 -0
- package/dist/midi/tempo.js +57 -0
- package/dist/midi/tempo.js.map +1 -0
- package/dist/midi/ticks.d.ts +25 -0
- package/dist/midi/ticks.d.ts.map +1 -0
- package/dist/midi/ticks.js +35 -0
- package/dist/midi/ticks.js.map +1 -0
- package/dist/midi/voice.d.ts +148 -0
- package/dist/midi/voice.d.ts.map +1 -0
- package/dist/midi/voice.js +348 -0
- package/dist/midi/voice.js.map +1 -0
- package/dist/midi/wav.d.ts +14 -0
- package/dist/midi/wav.d.ts.map +1 -0
- package/dist/midi/wav.js +51 -0
- package/dist/midi/wav.js.map +1 -0
- package/dist/model3d.d.ts +41 -0
- package/dist/model3d.d.ts.map +1 -0
- package/dist/model3d.js +39 -0
- package/dist/model3d.js.map +1 -0
- package/dist/model3dBake.d.ts +80 -0
- package/dist/model3dBake.d.ts.map +1 -0
- package/dist/model3dBake.js +127 -0
- package/dist/model3dBake.js.map +1 -0
- package/dist/ops/apply.d.ts +32 -0
- package/dist/ops/apply.d.ts.map +1 -0
- package/dist/ops/apply.js +1595 -0
- package/dist/ops/apply.js.map +1 -0
- package/dist/ops/index.d.ts +13 -0
- package/dist/ops/index.d.ts.map +1 -0
- package/dist/ops/index.js +13 -0
- package/dist/ops/index.js.map +1 -0
- package/dist/ops/op.d.ts +407 -0
- package/dist/ops/op.d.ts.map +1 -0
- package/dist/ops/op.js +61 -0
- package/dist/ops/op.js.map +1 -0
- package/dist/ops/serialize.d.ts +77 -0
- package/dist/ops/serialize.d.ts.map +1 -0
- package/dist/ops/serialize.js +81 -0
- package/dist/ops/serialize.js.map +1 -0
- package/dist/ops/types.d.ts +150 -0
- package/dist/ops/types.d.ts.map +1 -0
- package/dist/ops/types.js +12 -0
- package/dist/ops/types.js.map +1 -0
- package/dist/pathSampling.d.ts +51 -0
- package/dist/pathSampling.d.ts.map +1 -0
- package/dist/pathSampling.js +111 -0
- package/dist/pathSampling.js.map +1 -0
- package/dist/placement/index.d.ts +2 -0
- package/dist/placement/index.d.ts.map +1 -0
- package/dist/placement/index.js +2 -0
- package/dist/placement/index.js.map +1 -0
- package/dist/placement/resolveTrackPlacement.d.ts +40 -0
- package/dist/placement/resolveTrackPlacement.d.ts.map +1 -0
- package/dist/placement/resolveTrackPlacement.js +71 -0
- package/dist/placement/resolveTrackPlacement.js.map +1 -0
- package/dist/production.d.ts +99 -0
- package/dist/production.d.ts.map +1 -0
- package/dist/production.js +328 -0
- package/dist/production.js.map +1 -0
- package/dist/reassemble.d.ts +68 -0
- package/dist/reassemble.d.ts.map +1 -0
- package/dist/reassemble.js +187 -0
- package/dist/reassemble.js.map +1 -0
- package/dist/recipe.d.ts +24 -0
- package/dist/recipe.d.ts.map +1 -0
- package/dist/recipe.js +89 -0
- package/dist/recipe.js.map +1 -0
- package/dist/recordedVoiceReplacement.d.ts +70 -0
- package/dist/recordedVoiceReplacement.d.ts.map +1 -0
- package/dist/recordedVoiceReplacement.js +82 -0
- package/dist/recordedVoiceReplacement.js.map +1 -0
- package/dist/reframe.d.ts +31 -0
- package/dist/reframe.d.ts.map +1 -0
- package/dist/reframe.js +227 -0
- package/dist/reframe.js.map +1 -0
- package/dist/render/canvas2d.d.ts +419 -0
- package/dist/render/canvas2d.d.ts.map +1 -0
- package/dist/render/canvas2d.js +1392 -0
- package/dist/render/canvas2d.js.map +1 -0
- package/dist/render/color.d.ts +26 -0
- package/dist/render/color.d.ts.map +1 -0
- package/dist/render/color.js +305 -0
- package/dist/render/color.js.map +1 -0
- package/dist/render/cpuLegacyEffects.d.ts +17 -0
- package/dist/render/cpuLegacyEffects.d.ts.map +1 -0
- package/dist/render/cpuLegacyEffects.js +347 -0
- package/dist/render/cpuLegacyEffects.js.map +1 -0
- package/dist/render/cpuVisualEffects.d.ts +13 -0
- package/dist/render/cpuVisualEffects.d.ts.map +1 -0
- package/dist/render/cpuVisualEffects.js +388 -0
- package/dist/render/cpuVisualEffects.js.map +1 -0
- package/dist/render/cubeLut.d.ts +12 -0
- package/dist/render/cubeLut.d.ts.map +1 -0
- package/dist/render/cubeLut.js +81 -0
- package/dist/render/cubeLut.js.map +1 -0
- package/dist/render/curveFitting.d.ts +28 -0
- package/dist/render/curveFitting.d.ts.map +1 -0
- package/dist/render/curveFitting.js +94 -0
- package/dist/render/curveFitting.js.map +1 -0
- package/dist/render/draw.d.ts +265 -0
- package/dist/render/draw.d.ts.map +1 -0
- package/dist/render/draw.js +929 -0
- package/dist/render/draw.js.map +1 -0
- package/dist/render/effects.d.ts +120 -0
- package/dist/render/effects.d.ts.map +1 -0
- package/dist/render/effects.js +804 -0
- package/dist/render/effects.js.map +1 -0
- package/dist/render/frameCompositor.d.ts +502 -0
- package/dist/render/frameCompositor.d.ts.map +1 -0
- package/dist/render/frameCompositor.js +1331 -0
- package/dist/render/frameCompositor.js.map +1 -0
- package/dist/render/index.d.ts +27 -0
- package/dist/render/index.d.ts.map +1 -0
- package/dist/render/index.js +27 -0
- package/dist/render/index.js.map +1 -0
- package/dist/render/layout.d.ts +17 -0
- package/dist/render/layout.d.ts.map +1 -0
- package/dist/render/layout.js +197 -0
- package/dist/render/layout.js.map +1 -0
- package/dist/render/model3dBakeSamples.d.ts +45 -0
- package/dist/render/model3dBakeSamples.d.ts.map +1 -0
- package/dist/render/model3dBakeSamples.js +68 -0
- package/dist/render/model3dBakeSamples.js.map +1 -0
- package/dist/render/motionBlur.d.ts +170 -0
- package/dist/render/motionBlur.d.ts.map +1 -0
- package/dist/render/motionBlur.js +193 -0
- package/dist/render/motionBlur.js.map +1 -0
- package/dist/render/sceneModel.d.ts +577 -0
- package/dist/render/sceneModel.d.ts.map +1 -0
- package/dist/render/sceneModel.js +1460 -0
- package/dist/render/sceneModel.js.map +1 -0
- package/dist/render/shapeGeometry.d.ts +81 -0
- package/dist/render/shapeGeometry.d.ts.map +1 -0
- package/dist/render/shapeGeometry.js +460 -0
- package/dist/render/shapeGeometry.js.map +1 -0
- package/dist/render/spatial.d.ts +9 -0
- package/dist/render/spatial.d.ts.map +1 -0
- package/dist/render/spatial.js +58 -0
- package/dist/render/spatial.js.map +1 -0
- package/dist/render/svgPath.d.ts +80 -0
- package/dist/render/svgPath.d.ts.map +1 -0
- package/dist/render/svgPath.js +199 -0
- package/dist/render/svgPath.js.map +1 -0
- package/dist/render/temporal.d.ts +6 -0
- package/dist/render/temporal.d.ts.map +1 -0
- package/dist/render/temporal.js +74 -0
- package/dist/render/temporal.js.map +1 -0
- package/dist/render/textLayout.d.ts +159 -0
- package/dist/render/textLayout.d.ts.map +1 -0
- package/dist/render/textLayout.js +301 -0
- package/dist/render/textLayout.js.map +1 -0
- package/dist/render/trackEffects.d.ts +23 -0
- package/dist/render/trackEffects.d.ts.map +1 -0
- package/dist/render/trackEffects.js +93 -0
- package/dist/render/trackEffects.js.map +1 -0
- package/dist/render/transform.d.ts +54 -0
- package/dist/render/transform.d.ts.map +1 -0
- package/dist/render/transform.js +222 -0
- package/dist/render/transform.js.map +1 -0
- package/dist/render/transition.d.ts +109 -0
- package/dist/render/transition.d.ts.map +1 -0
- package/dist/render/transition.js +351 -0
- package/dist/render/transition.js.map +1 -0
- package/dist/retarget.d.ts +73 -0
- package/dist/retarget.d.ts.map +1 -0
- package/dist/retarget.js +305 -0
- package/dist/retarget.js.map +1 -0
- package/dist/rippleEdit.d.ts +83 -0
- package/dist/rippleEdit.d.ts.map +1 -0
- package/dist/rippleEdit.js +184 -0
- package/dist/rippleEdit.js.map +1 -0
- package/dist/scene.d.ts +28 -0
- package/dist/scene.d.ts.map +1 -0
- package/dist/scene.js +28 -0
- package/dist/scene.js.map +1 -0
- package/dist/script-link.d.ts +52 -0
- package/dist/script-link.d.ts.map +1 -0
- package/dist/script-link.js +78 -0
- package/dist/script-link.js.map +1 -0
- package/dist/script.d.ts +52 -0
- package/dist/script.d.ts.map +1 -0
- package/dist/script.js +93 -0
- package/dist/script.js.map +1 -0
- package/dist/snap.d.ts +2 -0
- package/dist/snap.d.ts.map +1 -0
- package/dist/snap.js +21 -0
- package/dist/snap.js.map +1 -0
- package/dist/snapping/buildSnapPoints.d.ts +16 -0
- package/dist/snapping/buildSnapPoints.d.ts.map +1 -0
- package/dist/snapping/buildSnapPoints.js +39 -0
- package/dist/snapping/buildSnapPoints.js.map +1 -0
- package/dist/snapping/index.d.ts +3 -0
- package/dist/snapping/index.d.ts.map +1 -0
- package/dist/snapping/index.js +3 -0
- package/dist/snapping/index.js.map +1 -0
- package/dist/snapping/resolveSnap.d.ts +19 -0
- package/dist/snapping/resolveSnap.d.ts.map +1 -0
- package/dist/snapping/resolveSnap.js +39 -0
- package/dist/snapping/resolveSnap.js.map +1 -0
- package/dist/sourceRate.d.ts +12 -0
- package/dist/sourceRate.d.ts.map +1 -0
- package/dist/sourceRate.js +13 -0
- package/dist/sourceRate.js.map +1 -0
- package/dist/spatialVideoRequest.d.ts +91 -0
- package/dist/spatialVideoRequest.d.ts.map +1 -0
- package/dist/spatialVideoRequest.js +175 -0
- package/dist/spatialVideoRequest.js.map +1 -0
- package/dist/splitClip.d.ts +3 -0
- package/dist/splitClip.d.ts.map +1 -0
- package/dist/splitClip.js +190 -0
- package/dist/splitClip.js.map +1 -0
- package/dist/stableSerialize.d.ts +11 -0
- package/dist/stableSerialize.d.ts.map +1 -0
- package/dist/stableSerialize.js +31 -0
- package/dist/stableSerialize.js.map +1 -0
- package/dist/staleSet.d.ts +41 -0
- package/dist/staleSet.d.ts.map +1 -0
- package/dist/staleSet.js +106 -0
- package/dist/staleSet.js.map +1 -0
- package/dist/storyboard.d.ts +221 -0
- package/dist/storyboard.d.ts.map +1 -0
- package/dist/storyboard.js +417 -0
- package/dist/storyboard.js.map +1 -0
- package/dist/subtitles.d.ts +61 -0
- package/dist/subtitles.d.ts.map +1 -0
- package/dist/subtitles.js +92 -0
- package/dist/subtitles.js.map +1 -0
- package/dist/takes.d.ts +76 -0
- package/dist/takes.d.ts.map +1 -0
- package/dist/takes.js +238 -0
- package/dist/takes.js.map +1 -0
- package/dist/timeRemap.d.ts +101 -0
- package/dist/timeRemap.d.ts.map +1 -0
- package/dist/timeRemap.js +183 -0
- package/dist/timeRemap.js.map +1 -0
- package/dist/trackOrder.d.ts +38 -0
- package/dist/trackOrder.d.ts.map +1 -0
- package/dist/trackOrder.js +54 -0
- package/dist/trackOrder.js.map +1 -0
- package/dist/transitionAtCut.d.ts +89 -0
- package/dist/transitionAtCut.d.ts.map +1 -0
- package/dist/transitionAtCut.js +217 -0
- package/dist/transitionAtCut.js.map +1 -0
- package/dist/trimClip.d.ts +13 -0
- package/dist/trimClip.d.ts.map +1 -0
- package/dist/trimClip.js +60 -0
- package/dist/trimClip.js.map +1 -0
- package/dist/types.d.ts +1772 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +84 -0
- package/dist/types.js.map +1 -0
- package/fonts/BebasNeue-Regular.ttf +0 -0
- package/fonts/Inter-ExtraBold.ttf +0 -0
- package/fonts/Inter-Italic-Variable.ttf +0 -0
- package/fonts/Inter-SemiBold.ttf +0 -0
- package/fonts/Inter-Variable.ttf +0 -0
- package/fonts/JetBrainsMono-Italic-Variable.ttf +0 -0
- package/fonts/JetBrainsMono-Variable.ttf +0 -0
- package/fonts/Lora-Italic-Variable.ttf +0 -0
- package/fonts/Lora-Variable.ttf +0 -0
- package/fonts/OFL-BebasNeue.txt +93 -0
- package/fonts/OFL-Inter.txt +93 -0
- package/fonts/OFL-JetBrainsMono.txt +93 -0
- package/fonts/OFL-Lora.txt +93 -0
- package/fonts/OFL-PlayfairDisplay.txt +93 -0
- package/fonts/OFL-SpaceGrotesk.txt +93 -0
- package/fonts/PlayfairDisplay-Italic-Variable.ttf +0 -0
- package/fonts/PlayfairDisplay-Variable.ttf +0 -0
- package/fonts/SpaceGrotesk-Variable.ttf +0 -0
- package/package.json +108 -0
|
@@ -0,0 +1,804 @@
|
|
|
1
|
+
import { fitCurve, channelMidtones } from "./curveFitting.js";
|
|
2
|
+
import { GENERATOR_MODES, STYLIZE_MODES } from "../types.js";
|
|
3
|
+
import { isClipBlurEffect, isClipChromaKeyEffect, isClipColorEffect, isClipCurvesEffect, isClipDropShadowEffect, isClipGlowEffect, isClipLevelsEffect, isClipLiftGammaGainEffect, isClipSharpenEffect, isClipVignetteEffect, isClipGrainEffect } from "../types.js";
|
|
4
|
+
import { createDefaultRegistry, createGPUContextFromDevice, createExecutor, createLabeledTexture, createRecipeRunner, LabeledTexture, colorCdlV1, colorCurvesV1, colorGradeV1, colorLevelsV1, colorLiftGammaGainV1, blurGaussianV1, filtersGlowV1, mixerDropShadowV1, sharpenUnsharpMaskV1, vignetteV1, filtersGrainV1, filtersPixelateV1, colorPosterizeV1, colorCubeLutV1, transformSpherizeV1, filtersVisualFxV1, chromaKeyV1, maskApplyV1, maskFromImageV1, alphaPremulToStraightV1, alphaStraightToPremulV1 } from "@nodetool-ai/gpu/pool";
|
|
5
|
+
import * as d from "typegpu/data";
|
|
6
|
+
import { parseCssColorOrBlack } from "./color.js";
|
|
7
|
+
import { parseCubeLut } from "./cubeLut.js";
|
|
8
|
+
import { trackEffectsAsClipEffects } from "./trackEffects.js";
|
|
9
|
+
const NEUTRAL_COLOR = {
|
|
10
|
+
brightness: 0,
|
|
11
|
+
contrast: 1,
|
|
12
|
+
saturation: 1,
|
|
13
|
+
hue: 0,
|
|
14
|
+
temperature: 0,
|
|
15
|
+
tint: 0,
|
|
16
|
+
shadows: 0,
|
|
17
|
+
highlights: 0
|
|
18
|
+
};
|
|
19
|
+
const floatBits = new DataView(new ArrayBuffer(4));
|
|
20
|
+
function float16Bits(value) {
|
|
21
|
+
floatBits.setFloat32(0, value, true);
|
|
22
|
+
const bits = floatBits.getUint32(0, true);
|
|
23
|
+
const sign = (bits >>> 16) & 0x8000;
|
|
24
|
+
const exponent = ((bits >>> 23) & 0xff) - 112;
|
|
25
|
+
const fraction = bits & 0x7fffff;
|
|
26
|
+
if (exponent <= 0) {
|
|
27
|
+
if (exponent < -10)
|
|
28
|
+
return sign;
|
|
29
|
+
const subnormal = (fraction | 0x800000) >>> (1 - exponent);
|
|
30
|
+
return sign | ((subnormal + 0x1000) >>> 13);
|
|
31
|
+
}
|
|
32
|
+
if (exponent >= 31)
|
|
33
|
+
return sign | 0x7bff;
|
|
34
|
+
return sign | ((exponent << 10) + ((fraction + 0x1000) >>> 13));
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Read at pool-allocation time, not module load: under Node the WebGPU flag
|
|
38
|
+
* namespaces are installed on `globalThis` by the Dawn adapter when a device is
|
|
39
|
+
* acquired, so a module-scope read would throw on import in every server
|
|
40
|
+
* process — including the ones that only want the scene model.
|
|
41
|
+
*/
|
|
42
|
+
function intermediateUsage() {
|
|
43
|
+
return (GPUTextureUsage.TEXTURE_BINDING |
|
|
44
|
+
GPUTextureUsage.STORAGE_BINDING |
|
|
45
|
+
GPUTextureUsage.COPY_SRC |
|
|
46
|
+
GPUTextureUsage.COPY_DST |
|
|
47
|
+
// The mask modules are fragment passes, so an intermediate they write into
|
|
48
|
+
// is a render attachment as well as a storage texture.
|
|
49
|
+
GPUTextureUsage.RENDER_ATTACHMENT);
|
|
50
|
+
}
|
|
51
|
+
/** `mask.fromImage@1`'s channel selector: 0 alpha, 1 luminance. */
|
|
52
|
+
const MASK_FROM_IMAGE_MODE = { alpha: 0, luma: 1 };
|
|
53
|
+
/**
|
|
54
|
+
* GPU pre-pass for a clip's effect chain. The caller passes a source GPU
|
|
55
|
+
* texture + `ClipEffect[]` and gets back a texture — the original if nothing
|
|
56
|
+
* applies, otherwise a processed intermediate. Intermediates are pooled by
|
|
57
|
+
* layer id + source dimensions, so a clip sitting still reallocates nothing.
|
|
58
|
+
*
|
|
59
|
+
* Every effect is a shared module from `@nodetool-ai/gpu` — a `ShaderModule`
|
|
60
|
+
* through the shared `Executor`, or, for glow and drop shadow, a
|
|
61
|
+
* `RecipeModule` through the `RecipeRunner` (D7). No host-side uniform packing
|
|
62
|
+
* or bind-group construction lives here, and the parameters each type takes
|
|
63
|
+
* are the ones `packages/image-nodes` already settled for the same modules.
|
|
64
|
+
*/
|
|
65
|
+
export class WebGPUEffectsProcessor {
|
|
66
|
+
device;
|
|
67
|
+
ctx;
|
|
68
|
+
executor;
|
|
69
|
+
/** Glow and drop shadow are recipes — a small DAG of the single-pass
|
|
70
|
+
* modules — so they need the runner and a registry to resolve their ops. */
|
|
71
|
+
recipes;
|
|
72
|
+
registry;
|
|
73
|
+
pools = new Map();
|
|
74
|
+
lutTextures = new Map();
|
|
75
|
+
constructor(device) {
|
|
76
|
+
this.device = device;
|
|
77
|
+
this.ctx = createGPUContextFromDevice(device);
|
|
78
|
+
this.executor = createExecutor();
|
|
79
|
+
this.recipes = createRecipeRunner();
|
|
80
|
+
this.registry = createDefaultRegistry();
|
|
81
|
+
}
|
|
82
|
+
/** Start a frame whose effect passes share the caller's command buffer. */
|
|
83
|
+
beginSubmission() {
|
|
84
|
+
this.ctx.uniformRing.beginSubmission();
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* Run the effects chain on `source` and return a GPU texture with the
|
|
88
|
+
* processed pixels. If no effects are enabled, returns `source` itself
|
|
89
|
+
* (caller should not destroy it on the assumption it's owned).
|
|
90
|
+
*
|
|
91
|
+
* `sourceAlpha` is how `source` stores its color, and it is also how the
|
|
92
|
+
* result comes back: decoded media arrives straight and leaves straight, a
|
|
93
|
+
* precomposite's own accumulation arrives premultiplied and leaves
|
|
94
|
+
* premultiplied. Every effect module writes premultiplied, so a straight
|
|
95
|
+
* source ends with one convert back — which is the pass that was missing.
|
|
96
|
+
* Without it the blend shader read a graded layer's premultiplied RGB as
|
|
97
|
+
* straight and darkened it by its own alpha a second time, invisible only
|
|
98
|
+
* because an opaque layer's two conventions coincide.
|
|
99
|
+
*
|
|
100
|
+
* `trackEffects` arrives in the legacy track spelling and is converted to
|
|
101
|
+
* clip effects at the door, so every stage below reads one vocabulary and
|
|
102
|
+
* {@link WebGPUEffectsProcessor.stepClipEffect} is the only place that knows
|
|
103
|
+
* which shader module an effect type is.
|
|
104
|
+
*
|
|
105
|
+
* Order: the track key first, on pixels nothing has graded; then the clip's
|
|
106
|
+
* own new-type effects in the order the document lists them; then the
|
|
107
|
+
* aggregated clip+track colour and blur, and the track sharpen and vignette.
|
|
108
|
+
* The aggregate is one pass over both scopes, so a clip `color` cannot hold
|
|
109
|
+
* a position in the document order — that is what makes the two halves
|
|
110
|
+
* separate stages rather than one list.
|
|
111
|
+
*/
|
|
112
|
+
process(poolKey, source, width, height, clipEffects, trackEffects = [], sourceAlpha = "straight",
|
|
113
|
+
/**
|
|
114
|
+
* Record into the caller's encoder instead of one of this call's own.
|
|
115
|
+
*
|
|
116
|
+
* A frame with several graded layers, a precomposite and a matte used to
|
|
117
|
+
* submit one command buffer per call — each submit is a queue round trip,
|
|
118
|
+
* and the GPU idles between them. Given an encoder, this records and lets
|
|
119
|
+
* the caller submit the frame once. Omitted, it behaves as it always did.
|
|
120
|
+
*/
|
|
121
|
+
frameEncoder) {
|
|
122
|
+
const enabledClip = clipEffects.filter((e) => e.enabled);
|
|
123
|
+
const enabledTrack = trackEffectsAsClipEffects(trackEffects).filter((e) => e.enabled);
|
|
124
|
+
// Aggregate color & blur across clip + track scopes.
|
|
125
|
+
const color = aggregateColor(enabledClip, enabledTrack);
|
|
126
|
+
const blurRadius = aggregateBlurRadius(enabledClip, enabledTrack);
|
|
127
|
+
const sharpen = enabledTrack.find(isClipSharpenEffect);
|
|
128
|
+
const vignette = enabledTrack.find(isClipVignetteEffect);
|
|
129
|
+
const chromaKey = enabledTrack.find(isClipChromaKeyEffect);
|
|
130
|
+
const colorActive = isColorActive(color);
|
|
131
|
+
const blurActive = blurRadius >= 0.5;
|
|
132
|
+
const sharpenActive = sharpen != null && sharpen.amount > 0.001;
|
|
133
|
+
const vignetteActive = vignette != null && vignette.amount > 0.001;
|
|
134
|
+
const chromaKeyActive = chromaKey != null && chromaKey.tolerance > 0.001;
|
|
135
|
+
const shaderClip = enabledClip.filter(isShaderStepEffect);
|
|
136
|
+
if (!colorActive &&
|
|
137
|
+
!blurActive &&
|
|
138
|
+
!sharpenActive &&
|
|
139
|
+
!vignetteActive &&
|
|
140
|
+
!chromaKeyActive &&
|
|
141
|
+
shaderClip.length === 0) {
|
|
142
|
+
return source;
|
|
143
|
+
}
|
|
144
|
+
if (!frameEncoder) {
|
|
145
|
+
this.ctx.uniformRing.beginSubmission();
|
|
146
|
+
}
|
|
147
|
+
const pool = this.getPool(poolKey, width, height);
|
|
148
|
+
const encoder = frameEncoder ??
|
|
149
|
+
this.device.createCommandEncoder({
|
|
150
|
+
label: `preview-effects-${poolKey}`
|
|
151
|
+
});
|
|
152
|
+
// Decoded media arrives straight-alpha (uploaded with
|
|
153
|
+
// `premultipliedAlpha: false`), which is what `sourceAlpha` defaults to.
|
|
154
|
+
// Wrap it with that label and feed it to the first
|
|
155
|
+
// effect: the Executor's auto-bridge inserts `alphaStraightToPremulV1`
|
|
156
|
+
// ahead of effects that need premul input (everything except chromaKey),
|
|
157
|
+
// and chromaKey itself takes straight directly — so there's no redundant
|
|
158
|
+
// straight→premul→straight round-trip when chromaKey runs first.
|
|
159
|
+
const sourceLabeled = new LabeledTexture(source, {
|
|
160
|
+
label: `preview-effects-${poolKey}-src`,
|
|
161
|
+
format: "rgba8unorm",
|
|
162
|
+
width,
|
|
163
|
+
height,
|
|
164
|
+
meta: { colorSpace: "srgb", alpha: sourceAlpha, bindingKind: "texture_2d" }
|
|
165
|
+
});
|
|
166
|
+
let pendingFirst = true;
|
|
167
|
+
/** The texture the next pass reads, and the pool slot it writes. */
|
|
168
|
+
const pick = () => ({
|
|
169
|
+
input: pendingFirst ? sourceLabeled : pool.textures[pool.currentIndex],
|
|
170
|
+
outIdx: pendingFirst ? 0 : (1 - pool.currentIndex)
|
|
171
|
+
});
|
|
172
|
+
/**
|
|
173
|
+
* Record what the pass just wrote. The label is the module's own declared
|
|
174
|
+
* output alpha, so the next pass's contract is checked — and bridged —
|
|
175
|
+
* against what is actually in the texture rather than against the
|
|
176
|
+
* allocation-time guess.
|
|
177
|
+
*/
|
|
178
|
+
const settle = (outIdx, alpha) => {
|
|
179
|
+
pool.textures[outIdx].meta.alpha = alpha;
|
|
180
|
+
pool.currentIndex = outIdx;
|
|
181
|
+
pendingFirst = false;
|
|
182
|
+
};
|
|
183
|
+
const step = (module, params) => {
|
|
184
|
+
const { input, outIdx } = pick();
|
|
185
|
+
const [wgX, wgY] = module.workgroupSize;
|
|
186
|
+
this.executor.encode({
|
|
187
|
+
ctx: this.ctx,
|
|
188
|
+
module,
|
|
189
|
+
encoder,
|
|
190
|
+
inputs: { source: input },
|
|
191
|
+
output: pool.textures[outIdx],
|
|
192
|
+
params,
|
|
193
|
+
dispatch: module.kind === "fragment"
|
|
194
|
+
? { kind: "fragment" }
|
|
195
|
+
: {
|
|
196
|
+
kind: "compute",
|
|
197
|
+
x: Math.ceil(width / wgX),
|
|
198
|
+
y: Math.ceil(height / wgY),
|
|
199
|
+
z: 1
|
|
200
|
+
}
|
|
201
|
+
});
|
|
202
|
+
settle(outIdx, module.io.output.alpha);
|
|
203
|
+
};
|
|
204
|
+
const stepRecipe = (module, params) => {
|
|
205
|
+
const { input, outIdx } = pick();
|
|
206
|
+
this.recipes.encode({
|
|
207
|
+
ctx: this.ctx,
|
|
208
|
+
module,
|
|
209
|
+
encoder,
|
|
210
|
+
inputs: { source: input },
|
|
211
|
+
output: pool.textures[outIdx],
|
|
212
|
+
params,
|
|
213
|
+
registry: this.registry,
|
|
214
|
+
executor: this.executor
|
|
215
|
+
});
|
|
216
|
+
settle(outIdx, module.io.output.alpha);
|
|
217
|
+
};
|
|
218
|
+
if (chromaKeyActive && chromaKey) {
|
|
219
|
+
this.stepClipEffect(chromaKey, width, height, step, stepRecipe);
|
|
220
|
+
}
|
|
221
|
+
for (const effect of shaderClip) {
|
|
222
|
+
if (effect.type === "lut" && typeof effect.cube === "string") {
|
|
223
|
+
const { texture: lut, parsed } = this.getLutTexture(effect.cube);
|
|
224
|
+
const { input, outIdx } = pick();
|
|
225
|
+
this.executor.encode({
|
|
226
|
+
ctx: this.ctx,
|
|
227
|
+
module: colorCubeLutV1,
|
|
228
|
+
encoder,
|
|
229
|
+
inputs: { source: input, lut },
|
|
230
|
+
output: pool.textures[outIdx],
|
|
231
|
+
params: {
|
|
232
|
+
size: parsed.size,
|
|
233
|
+
intensity: typeof effect.intensity === "number" ? effect.intensity : 1,
|
|
234
|
+
domainMin: d.vec4f(...parsed.domainMin, 0),
|
|
235
|
+
domainMax: d.vec4f(...parsed.domainMax, 0)
|
|
236
|
+
},
|
|
237
|
+
dispatch: { kind: "fragment" }
|
|
238
|
+
});
|
|
239
|
+
settle(outIdx, colorCubeLutV1.io.output.alpha);
|
|
240
|
+
}
|
|
241
|
+
else {
|
|
242
|
+
this.stepClipEffect(effect, width, height, step, stepRecipe);
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
if (colorActive) {
|
|
246
|
+
step(colorGradeV1, { ...color });
|
|
247
|
+
}
|
|
248
|
+
if (blurActive) {
|
|
249
|
+
const sigma = blurRadius / 3;
|
|
250
|
+
step(blurGaussianV1, {
|
|
251
|
+
radius: blurRadius,
|
|
252
|
+
sigma,
|
|
253
|
+
direction: d.vec2f(1, 0)
|
|
254
|
+
});
|
|
255
|
+
step(blurGaussianV1, {
|
|
256
|
+
radius: blurRadius,
|
|
257
|
+
sigma,
|
|
258
|
+
direction: d.vec2f(0, 1)
|
|
259
|
+
});
|
|
260
|
+
}
|
|
261
|
+
if (sharpenActive && sharpen) {
|
|
262
|
+
this.stepClipEffect(sharpen, width, height, step, stepRecipe);
|
|
263
|
+
}
|
|
264
|
+
if (vignetteActive && vignette) {
|
|
265
|
+
this.stepClipEffect(vignette, width, height, step, stepRecipe);
|
|
266
|
+
}
|
|
267
|
+
// Hand back what the caller gave us. Nothing downstream re-reads the
|
|
268
|
+
// module contracts, so a mislabeled texture here is a silently wrong
|
|
269
|
+
// picture rather than a loud failure.
|
|
270
|
+
if (!pendingFirst &&
|
|
271
|
+
sourceAlpha === "straight" &&
|
|
272
|
+
pool.textures[pool.currentIndex].meta.alpha === "premultiplied") {
|
|
273
|
+
step(alphaPremulToStraightV1, alphaPremulToStraightV1.paramDefaults);
|
|
274
|
+
}
|
|
275
|
+
if (!frameEncoder)
|
|
276
|
+
this.device.queue.submit([encoder.finish()]);
|
|
277
|
+
return pool.textures[pool.currentIndex].texture;
|
|
278
|
+
}
|
|
279
|
+
/**
|
|
280
|
+
* Encode one clip effect as its shader step, with the parameters
|
|
281
|
+
* `packages/image-nodes/src/nodes/lib-image-*.ts` already settled for the
|
|
282
|
+
* same modules (D7). Only the units the timeline document differs in are
|
|
283
|
+
* converted here: pixel offsets become UV, a control-point curve becomes the
|
|
284
|
+
* parametric knobs `color.curves@1` takes.
|
|
285
|
+
*/
|
|
286
|
+
stepClipEffect(effect, width, height, step, stepRecipe) {
|
|
287
|
+
if (effect.type === "stylize" && typeof effect.mode === "string") {
|
|
288
|
+
const index = STYLIZE_MODES.indexOf(effect.mode);
|
|
289
|
+
if (index >= 0) {
|
|
290
|
+
const [r, g, b] = colorChannels(typeof effect.color === "string" ? effect.color : "#ffffff");
|
|
291
|
+
step(filtersVisualFxV1, {
|
|
292
|
+
mode: index,
|
|
293
|
+
amount: typeof effect.amount === "number" ? effect.amount : 0.5,
|
|
294
|
+
scale: typeof effect.scale === "number" ? effect.scale : 8,
|
|
295
|
+
angle: (typeof effect.angle === "number" ? effect.angle : 0) * Math.PI / 180,
|
|
296
|
+
time: typeof effect.time === "number" ? effect.time : 0,
|
|
297
|
+
seed: typeof effect.seed === "number" ? effect.seed : 0,
|
|
298
|
+
softness: typeof effect.softness === "number" ? effect.softness : 0.1,
|
|
299
|
+
colorA: d.vec4f(0, 0, 0, 1),
|
|
300
|
+
colorB: d.vec4f(r, g, b, 1)
|
|
301
|
+
});
|
|
302
|
+
}
|
|
303
|
+
return;
|
|
304
|
+
}
|
|
305
|
+
if (effect.type === "generator" && typeof effect.mode === "string") {
|
|
306
|
+
const index = GENERATOR_MODES.indexOf(effect.mode);
|
|
307
|
+
if (index >= 0) {
|
|
308
|
+
const [ar, ag, ab] = colorChannels(typeof effect.colorA === "string" ? effect.colorA : "#101a33");
|
|
309
|
+
const [br, bg, bb] = colorChannels(typeof effect.colorB === "string" ? effect.colorB : "#ffb45e");
|
|
310
|
+
step(filtersVisualFxV1, {
|
|
311
|
+
mode: index + STYLIZE_MODES.length,
|
|
312
|
+
amount: typeof effect.amount === "number" ? effect.amount : 1,
|
|
313
|
+
scale: typeof effect.scale === "number" ? effect.scale : 8,
|
|
314
|
+
angle: (typeof effect.angle === "number" ? effect.angle : 0) * Math.PI / 180,
|
|
315
|
+
time: typeof effect.time === "number" ? effect.time : 0,
|
|
316
|
+
seed: typeof effect.seed === "number" ? effect.seed : 0,
|
|
317
|
+
softness: 0.1,
|
|
318
|
+
colorA: d.vec4f(ar, ag, ab, 1),
|
|
319
|
+
colorB: d.vec4f(br, bg, bb, 1)
|
|
320
|
+
});
|
|
321
|
+
}
|
|
322
|
+
return;
|
|
323
|
+
}
|
|
324
|
+
if (effect.type === "pixelate" && typeof effect.cellSize === "number") {
|
|
325
|
+
step(filtersPixelateV1, { cellSize: effect.cellSize });
|
|
326
|
+
return;
|
|
327
|
+
}
|
|
328
|
+
if (effect.type === "posterize" && typeof effect.levels === "number") {
|
|
329
|
+
step(colorPosterizeV1, { levels: effect.levels });
|
|
330
|
+
return;
|
|
331
|
+
}
|
|
332
|
+
if (effect.type === "directionalBlur" && typeof effect.radius === "number" && typeof effect.angle === "number") {
|
|
333
|
+
const angle = (effect.angle * Math.PI) / 180;
|
|
334
|
+
step(blurGaussianV1, {
|
|
335
|
+
radius: effect.radius,
|
|
336
|
+
sigma: Math.max(0.001, effect.radius / 3),
|
|
337
|
+
direction: d.vec2f(Math.cos(angle), Math.sin(angle))
|
|
338
|
+
});
|
|
339
|
+
return;
|
|
340
|
+
}
|
|
341
|
+
if (effect.type === "lensDistortion" && typeof effect.amount === "number") {
|
|
342
|
+
step(transformSpherizeV1, { amount: effect.amount });
|
|
343
|
+
return;
|
|
344
|
+
}
|
|
345
|
+
if (isClipGlowEffect(effect)) {
|
|
346
|
+
// `color` tints the bloom, which `filters.glow@1` has no knob for; the
|
|
347
|
+
// bloom takes the source's own colour. Threshold and softness are the
|
|
348
|
+
// recipe's defaults, which is what `lib.image.effects.Glow` ships.
|
|
349
|
+
stepRecipe(filtersGlowV1, {
|
|
350
|
+
threshold: filtersGlowV1.paramDefaults.threshold,
|
|
351
|
+
softness: filtersGlowV1.paramDefaults.softness,
|
|
352
|
+
radius: effect.radius,
|
|
353
|
+
intensity: effect.intensity
|
|
354
|
+
});
|
|
355
|
+
return;
|
|
356
|
+
}
|
|
357
|
+
if (isClipDropShadowEffect(effect)) {
|
|
358
|
+
const [r, g, b] = colorChannels(effect.color);
|
|
359
|
+
// The document offsets in source pixels the way a layer's transform
|
|
360
|
+
// does; `mixer.shadowCompose@1` samples the shadow at `uv - offset`, so
|
|
361
|
+
// a positive offset already casts right and down.
|
|
362
|
+
stepRecipe(mixerDropShadowV1, {
|
|
363
|
+
color: d.vec4f(r, g, b, 1),
|
|
364
|
+
offsetX: effect.offsetX / Math.max(1, width),
|
|
365
|
+
offsetY: effect.offsetY / Math.max(1, height),
|
|
366
|
+
radius: effect.blur,
|
|
367
|
+
intensity: effect.opacity ?? 1
|
|
368
|
+
});
|
|
369
|
+
return;
|
|
370
|
+
}
|
|
371
|
+
if (isClipVignetteEffect(effect)) {
|
|
372
|
+
// Without a midpoint the vignette starts where `lib.image.filter.Vignette`
|
|
373
|
+
// starts. A track vignette always carries one.
|
|
374
|
+
step(vignetteV1, {
|
|
375
|
+
intensity: effect.amount,
|
|
376
|
+
radius: effect.radius ?? vignetteV1.paramDefaults.radius,
|
|
377
|
+
softness: effect.softness
|
|
378
|
+
});
|
|
379
|
+
return;
|
|
380
|
+
}
|
|
381
|
+
if (isClipSharpenEffect(effect)) {
|
|
382
|
+
// `radius` has no knob on `filters.sharpen.unsharpMask@1` — its kernel
|
|
383
|
+
// is fixed — so it is carried in the document and not applied here.
|
|
384
|
+
step(sharpenUnsharpMaskV1, {
|
|
385
|
+
amount: effect.amount,
|
|
386
|
+
threshold: effect.threshold ?? sharpenUnsharpMaskV1.paramDefaults.threshold
|
|
387
|
+
});
|
|
388
|
+
return;
|
|
389
|
+
}
|
|
390
|
+
if (isClipChromaKeyEffect(effect)) {
|
|
391
|
+
const [r, g, b] = colorChannels(effect.color);
|
|
392
|
+
step(chromaKeyV1, {
|
|
393
|
+
keyColor: d.vec3f(r, g, b),
|
|
394
|
+
tolerance: effect.tolerance,
|
|
395
|
+
softness: effect.softness,
|
|
396
|
+
spill: effect.spill ?? chromaKeyV1.paramDefaults.spill
|
|
397
|
+
});
|
|
398
|
+
return;
|
|
399
|
+
}
|
|
400
|
+
if (isClipGrainEffect(effect)) {
|
|
401
|
+
// `animate` is not a knob here: the scene model has already stamped the
|
|
402
|
+
// frame's seed on the effect, so this only ever draws the pattern it is
|
|
403
|
+
// handed. That is what keeps a render reproducible.
|
|
404
|
+
step(filtersGrainV1, {
|
|
405
|
+
amount: effect.amount,
|
|
406
|
+
size: effect.size ?? filtersGrainV1.paramDefaults.size,
|
|
407
|
+
colorAmount: effect.colorAmount ?? filtersGrainV1.paramDefaults.colorAmount,
|
|
408
|
+
seed: effect.seed ?? filtersGrainV1.paramDefaults.seed
|
|
409
|
+
});
|
|
410
|
+
return;
|
|
411
|
+
}
|
|
412
|
+
if (isClipCurvesEffect(effect)) {
|
|
413
|
+
const master = fitCurve(effect.master);
|
|
414
|
+
step(colorCurvesV1, {
|
|
415
|
+
blackPoint: master.blackPoint,
|
|
416
|
+
whitePoint: master.whitePoint,
|
|
417
|
+
shadows: master.shadows,
|
|
418
|
+
midtones: master.midtones,
|
|
419
|
+
highlights: master.highlights,
|
|
420
|
+
redMidtones: channelMidtones(effect.r),
|
|
421
|
+
greenMidtones: channelMidtones(effect.g),
|
|
422
|
+
blueMidtones: channelMidtones(effect.b)
|
|
423
|
+
});
|
|
424
|
+
return;
|
|
425
|
+
}
|
|
426
|
+
if (isClipLevelsEffect(effect)) {
|
|
427
|
+
// `color.levels@1` is per-channel and the clip effect is not, so the one
|
|
428
|
+
// triple drives all three. It has no output range, so a narrowed one is
|
|
429
|
+
// a second pass: `color.cdl@1` with power 1 is exactly `in × slope +
|
|
430
|
+
// offset`.
|
|
431
|
+
step(colorLevelsV1, {
|
|
432
|
+
rBlack: effect.inBlack,
|
|
433
|
+
rGamma: effect.gamma,
|
|
434
|
+
rWhite: effect.inWhite,
|
|
435
|
+
gBlack: effect.inBlack,
|
|
436
|
+
gGamma: effect.gamma,
|
|
437
|
+
gWhite: effect.inWhite,
|
|
438
|
+
bBlack: effect.inBlack,
|
|
439
|
+
bGamma: effect.gamma,
|
|
440
|
+
bWhite: effect.inWhite
|
|
441
|
+
});
|
|
442
|
+
const slope = effect.outWhite - effect.outBlack;
|
|
443
|
+
if (Math.abs(slope - 1) > 0.001 || Math.abs(effect.outBlack) > 0.001) {
|
|
444
|
+
step(colorCdlV1, {
|
|
445
|
+
...colorCdlV1.paramDefaults,
|
|
446
|
+
slopeR: slope,
|
|
447
|
+
slopeG: slope,
|
|
448
|
+
slopeB: slope,
|
|
449
|
+
offsetR: effect.outBlack,
|
|
450
|
+
offsetG: effect.outBlack,
|
|
451
|
+
offsetB: effect.outBlack
|
|
452
|
+
});
|
|
453
|
+
}
|
|
454
|
+
return;
|
|
455
|
+
}
|
|
456
|
+
if (isClipLiftGammaGainEffect(effect)) {
|
|
457
|
+
const [liftR, liftG, liftB] = effect.lift;
|
|
458
|
+
const [gammaR, gammaG, gammaB] = effect.gamma;
|
|
459
|
+
const [gainR, gainG, gainB] = effect.gain;
|
|
460
|
+
// The masters are the shader's neutrals: the document expresses the whole
|
|
461
|
+
// grade per channel, the way `lib.image.color_grading.LiftGammaGain`
|
|
462
|
+
// passes its own per-channel props alongside untouched masters.
|
|
463
|
+
step(colorLiftGammaGainV1, {
|
|
464
|
+
...colorLiftGammaGainV1.paramDefaults,
|
|
465
|
+
liftR,
|
|
466
|
+
liftG,
|
|
467
|
+
liftB,
|
|
468
|
+
gammaR,
|
|
469
|
+
gammaG,
|
|
470
|
+
gammaB,
|
|
471
|
+
gainR,
|
|
472
|
+
gainG,
|
|
473
|
+
gainB
|
|
474
|
+
});
|
|
475
|
+
}
|
|
476
|
+
}
|
|
477
|
+
/**
|
|
478
|
+
* Multiply a coverage texture's alpha into `source`'s and answer the masked
|
|
479
|
+
* pixels, straight-alpha — which is how the blend shader reads a source.
|
|
480
|
+
*
|
|
481
|
+
* `mask.apply@1` works in premultiplied space (it scales RGB by coverage too,
|
|
482
|
+
* so the result stays valid premultiplied), so a straight source is bridged
|
|
483
|
+
* in by the Executor and converted back here. Skipping that second convert is
|
|
484
|
+
* what darkened a half-covered pixel: the blend shader would scale RGB by
|
|
485
|
+
* alpha a second time.
|
|
486
|
+
*
|
|
487
|
+
* `coverage` may be any size — it is sampled in normalized space, so a mask
|
|
488
|
+
* rasterized at the source's own resolution and one rasterized smaller both
|
|
489
|
+
* land on the same pixels.
|
|
490
|
+
*/
|
|
491
|
+
applyMask(poolKey, source, width, height, coverage, coverageWidth, coverageHeight, sourceAlpha = "straight",
|
|
492
|
+
/** Record into the frame's encoder. See {@link EffectChain.process}. */
|
|
493
|
+
frameEncoder) {
|
|
494
|
+
if (!frameEncoder) {
|
|
495
|
+
this.ctx.uniformRing.beginSubmission();
|
|
496
|
+
}
|
|
497
|
+
const pool = this.getPool(poolKey, width, height);
|
|
498
|
+
const encoder = frameEncoder ??
|
|
499
|
+
this.device.createCommandEncoder({
|
|
500
|
+
label: `preview-mask-${poolKey}`
|
|
501
|
+
});
|
|
502
|
+
this.executor.encode({
|
|
503
|
+
ctx: this.ctx,
|
|
504
|
+
module: maskApplyV1,
|
|
505
|
+
encoder,
|
|
506
|
+
inputs: {
|
|
507
|
+
source: this.label(source, `${poolKey}-src`, width, height, sourceAlpha),
|
|
508
|
+
// The raster carries its coverage in alpha with white RGB, which is
|
|
509
|
+
// already valid premultiplied — labelling it so skips a bridge pass
|
|
510
|
+
// that would change nothing.
|
|
511
|
+
mask: this.label(coverage, `${poolKey}-cov`, coverageWidth, coverageHeight, "premultiplied")
|
|
512
|
+
},
|
|
513
|
+
output: pool.textures[0],
|
|
514
|
+
params: { invert: 0 },
|
|
515
|
+
dispatch: { kind: "fragment" }
|
|
516
|
+
});
|
|
517
|
+
pool.textures[0].meta.alpha = maskApplyV1.io.output.alpha;
|
|
518
|
+
const [wgX, wgY] = alphaPremulToStraightV1.workgroupSize;
|
|
519
|
+
this.executor.encode({
|
|
520
|
+
ctx: this.ctx,
|
|
521
|
+
module: alphaPremulToStraightV1,
|
|
522
|
+
encoder,
|
|
523
|
+
inputs: { source: pool.textures[0] },
|
|
524
|
+
output: pool.textures[1],
|
|
525
|
+
params: alphaPremulToStraightV1.paramDefaults,
|
|
526
|
+
dispatch: {
|
|
527
|
+
kind: "compute",
|
|
528
|
+
x: Math.ceil(width / wgX),
|
|
529
|
+
y: Math.ceil(height / wgY),
|
|
530
|
+
z: 1
|
|
531
|
+
}
|
|
532
|
+
});
|
|
533
|
+
pool.textures[1].meta.alpha = alphaPremulToStraightV1.io.output.alpha;
|
|
534
|
+
pool.currentIndex = 1;
|
|
535
|
+
if (!frameEncoder)
|
|
536
|
+
this.device.queue.submit([encoder.finish()]);
|
|
537
|
+
return pool.textures[1].texture;
|
|
538
|
+
}
|
|
539
|
+
/**
|
|
540
|
+
* Read a matte source's alpha or luminance out as coverage — RGB zeroed,
|
|
541
|
+
* value in alpha — which is the shape {@link applyMask} consumes.
|
|
542
|
+
*
|
|
543
|
+
* A luma matte weights the luminance by the coverage the matte source was
|
|
544
|
+
* drawn with, the way the Canvas 2D path does: outside the matte clip's own
|
|
545
|
+
* pixels there is no picture, and an unweighted read would key on whatever
|
|
546
|
+
* colour the transparent region happens to carry. `mask.fromImage@1` divides
|
|
547
|
+
* its premultiplied input back out to read straight colour, so the weight is
|
|
548
|
+
* put back by premultiplying once more before the pass — the texture handed
|
|
549
|
+
* to the Executor is premultiplied and labelled straight, and the bridge it
|
|
550
|
+
* inserts is the second multiply.
|
|
551
|
+
*/
|
|
552
|
+
deriveMask(poolKey, source, width, height, mode, invert, sourceAlpha = "straight",
|
|
553
|
+
/** Record into the frame's encoder. See {@link EffectChain.process}. */
|
|
554
|
+
frameEncoder) {
|
|
555
|
+
if (!frameEncoder) {
|
|
556
|
+
this.ctx.uniformRing.beginSubmission();
|
|
557
|
+
}
|
|
558
|
+
const pool = this.getPool(poolKey, width, height);
|
|
559
|
+
const encoder = frameEncoder ??
|
|
560
|
+
this.device.createCommandEncoder({
|
|
561
|
+
label: `preview-matte-${poolKey}`
|
|
562
|
+
});
|
|
563
|
+
const weighted = mode === "luma"
|
|
564
|
+
? this.premultiplyForLuma(encoder, pool, source, poolKey, width, height, sourceAlpha)
|
|
565
|
+
: this.label(source, `${poolKey}-src`, width, height, sourceAlpha);
|
|
566
|
+
this.executor.encode({
|
|
567
|
+
ctx: this.ctx,
|
|
568
|
+
module: maskFromImageV1,
|
|
569
|
+
encoder,
|
|
570
|
+
inputs: {
|
|
571
|
+
source: weighted
|
|
572
|
+
},
|
|
573
|
+
output: pool.textures[0],
|
|
574
|
+
params: { mode: MASK_FROM_IMAGE_MODE[mode], invert: invert ? 1 : 0 },
|
|
575
|
+
dispatch: { kind: "fragment" }
|
|
576
|
+
});
|
|
577
|
+
pool.textures[0].meta.alpha = maskFromImageV1.io.output.alpha;
|
|
578
|
+
pool.currentIndex = 0;
|
|
579
|
+
if (!frameEncoder)
|
|
580
|
+
this.device.queue.submit([encoder.finish()]);
|
|
581
|
+
return pool.textures[0].texture;
|
|
582
|
+
}
|
|
583
|
+
/**
|
|
584
|
+
* The matte source with its coverage folded into RGB, labelled straight so
|
|
585
|
+
* the Executor's bridge multiplies it in a second time — which is what
|
|
586
|
+
* survives `mask.fromImage@1` dividing the association back out.
|
|
587
|
+
*/
|
|
588
|
+
premultiplyForLuma(encoder, pool, source, poolKey, width, height, sourceAlpha) {
|
|
589
|
+
if (sourceAlpha === "premultiplied") {
|
|
590
|
+
return this.label(source, `${poolKey}-src`, width, height, "straight");
|
|
591
|
+
}
|
|
592
|
+
const [wgX, wgY] = alphaStraightToPremulV1.workgroupSize;
|
|
593
|
+
this.executor.encode({
|
|
594
|
+
ctx: this.ctx,
|
|
595
|
+
module: alphaStraightToPremulV1,
|
|
596
|
+
encoder,
|
|
597
|
+
inputs: {
|
|
598
|
+
source: this.label(source, `${poolKey}-src`, width, height, "straight")
|
|
599
|
+
},
|
|
600
|
+
output: pool.textures[1],
|
|
601
|
+
params: alphaStraightToPremulV1.paramDefaults,
|
|
602
|
+
dispatch: {
|
|
603
|
+
kind: "compute",
|
|
604
|
+
x: Math.ceil(width / wgX),
|
|
605
|
+
y: Math.ceil(height / wgY),
|
|
606
|
+
z: 1
|
|
607
|
+
}
|
|
608
|
+
});
|
|
609
|
+
pool.textures[1].meta.alpha = alphaStraightToPremulV1.io.output.alpha;
|
|
610
|
+
return this.label(pool.textures[1].texture, `${poolKey}-weighted`, width, height, "straight");
|
|
611
|
+
}
|
|
612
|
+
/** Wrap a raw texture with the metadata the Executor validates against. */
|
|
613
|
+
label(texture, label, width, height, alpha) {
|
|
614
|
+
return new LabeledTexture(texture, {
|
|
615
|
+
label: `preview-effects-${label}`,
|
|
616
|
+
format: "rgba8unorm",
|
|
617
|
+
width,
|
|
618
|
+
height,
|
|
619
|
+
meta: { colorSpace: "srgb", alpha, bindingKind: "texture_2d" }
|
|
620
|
+
});
|
|
621
|
+
}
|
|
622
|
+
getPool(key, width, height) {
|
|
623
|
+
const existing = this.pools.get(key);
|
|
624
|
+
if (existing && existing.width === width && existing.height === height) {
|
|
625
|
+
return existing;
|
|
626
|
+
}
|
|
627
|
+
if (existing) {
|
|
628
|
+
existing.textures[0].destroy();
|
|
629
|
+
existing.textures[1].destroy();
|
|
630
|
+
}
|
|
631
|
+
// `alpha` here is only the label a fresh, never-written texture carries.
|
|
632
|
+
// Every pass re-labels its output with what that module declares it wrote,
|
|
633
|
+
// so the Executor bridges against the pixels rather than the allocation.
|
|
634
|
+
const make = (label) => createLabeledTexture(this.device, {
|
|
635
|
+
label,
|
|
636
|
+
width,
|
|
637
|
+
height,
|
|
638
|
+
format: "rgba8unorm",
|
|
639
|
+
usage: intermediateUsage(),
|
|
640
|
+
meta: { colorSpace: "srgb", alpha: "premultiplied" }
|
|
641
|
+
});
|
|
642
|
+
const pool = {
|
|
643
|
+
width,
|
|
644
|
+
height,
|
|
645
|
+
textures: [make(`preview-effects-${key}-a`), make(`preview-effects-${key}-b`)],
|
|
646
|
+
currentIndex: 0
|
|
647
|
+
};
|
|
648
|
+
this.pools.set(key, pool);
|
|
649
|
+
return pool;
|
|
650
|
+
}
|
|
651
|
+
getLutTexture(cube) {
|
|
652
|
+
const cached = this.lutTextures.get(cube);
|
|
653
|
+
if (cached)
|
|
654
|
+
return cached;
|
|
655
|
+
const parsed = parseCubeLut(cube);
|
|
656
|
+
const width = parsed.size * parsed.size;
|
|
657
|
+
const height = parsed.size;
|
|
658
|
+
const bytesPerRow = Math.ceil(width * 8 / 256) * 256;
|
|
659
|
+
const halvesPerRow = bytesPerRow / Uint16Array.BYTES_PER_ELEMENT;
|
|
660
|
+
const pixels = new Uint16Array(halvesPerRow * height);
|
|
661
|
+
for (let b = 0; b < parsed.size; b++) {
|
|
662
|
+
for (let g = 0; g < parsed.size; g++) {
|
|
663
|
+
for (let r = 0; r < parsed.size; r++) {
|
|
664
|
+
const source = ((b * parsed.size + g) * parsed.size + r) * 3;
|
|
665
|
+
const target = g * halvesPerRow + (b * parsed.size + r) * 4;
|
|
666
|
+
for (let channel = 0; channel < 3; channel++) {
|
|
667
|
+
pixels[target + channel] = float16Bits(parsed.rgb[source + channel] ?? 0);
|
|
668
|
+
}
|
|
669
|
+
pixels[target + 3] = float16Bits(1);
|
|
670
|
+
}
|
|
671
|
+
}
|
|
672
|
+
}
|
|
673
|
+
const texture = this.device.createTexture({
|
|
674
|
+
label: "timeline-cube-lut",
|
|
675
|
+
size: [width, height],
|
|
676
|
+
format: "rgba16float",
|
|
677
|
+
usage: GPUTextureUsage.COPY_DST | GPUTextureUsage.TEXTURE_BINDING
|
|
678
|
+
});
|
|
679
|
+
this.device.queue.writeTexture({ texture }, new Uint8Array(pixels.buffer), { bytesPerRow, rowsPerImage: height }, { width, height });
|
|
680
|
+
const labeled = new LabeledTexture(texture, {
|
|
681
|
+
label: "timeline-cube-lut",
|
|
682
|
+
format: "rgba16float",
|
|
683
|
+
width,
|
|
684
|
+
height,
|
|
685
|
+
meta: { colorSpace: "srgb", alpha: "premultiplied", bindingKind: "texture_2d" }
|
|
686
|
+
});
|
|
687
|
+
const entry = { texture: labeled, parsed };
|
|
688
|
+
this.lutTextures.set(cube, entry);
|
|
689
|
+
return entry;
|
|
690
|
+
}
|
|
691
|
+
releasePool(key) {
|
|
692
|
+
const pool = this.pools.get(key);
|
|
693
|
+
if (!pool)
|
|
694
|
+
return;
|
|
695
|
+
pool.textures[0].destroy();
|
|
696
|
+
pool.textures[1].destroy();
|
|
697
|
+
this.pools.delete(key);
|
|
698
|
+
}
|
|
699
|
+
retainOnly(keys) {
|
|
700
|
+
const keep = new Set(keys);
|
|
701
|
+
for (const key of [...this.pools.keys()]) {
|
|
702
|
+
if (!keep.has(key))
|
|
703
|
+
this.releasePool(key);
|
|
704
|
+
}
|
|
705
|
+
}
|
|
706
|
+
dispose() {
|
|
707
|
+
for (const pool of this.pools.values()) {
|
|
708
|
+
pool.textures[0].destroy();
|
|
709
|
+
pool.textures[1].destroy();
|
|
710
|
+
}
|
|
711
|
+
this.pools.clear();
|
|
712
|
+
for (const lut of this.lutTextures.values())
|
|
713
|
+
lut.texture.destroy();
|
|
714
|
+
this.lutTextures.clear();
|
|
715
|
+
this.ctx.scratch.dispose();
|
|
716
|
+
this.ctx.uniformRing.dispose();
|
|
717
|
+
}
|
|
718
|
+
}
|
|
719
|
+
function accumulateColor(effects, out) {
|
|
720
|
+
for (const e of effects) {
|
|
721
|
+
if (!isClipColorEffect(e))
|
|
722
|
+
continue;
|
|
723
|
+
out.brightness += e.brightness ?? 0;
|
|
724
|
+
out.contrast *= e.contrast ?? 1;
|
|
725
|
+
out.saturation *= e.saturation ?? 1;
|
|
726
|
+
out.hue += e.hue ?? 0;
|
|
727
|
+
out.temperature += e.temperature ?? 0;
|
|
728
|
+
out.tint += e.tint ?? 0;
|
|
729
|
+
out.shadows += e.shadows ?? 0;
|
|
730
|
+
out.highlights += e.highlights ?? 0;
|
|
731
|
+
}
|
|
732
|
+
}
|
|
733
|
+
function aggregateColor(clipEffects, trackEffects) {
|
|
734
|
+
const out = { ...NEUTRAL_COLOR };
|
|
735
|
+
accumulateColor(clipEffects, out);
|
|
736
|
+
accumulateColor(trackEffects, out);
|
|
737
|
+
out.brightness = clamp(out.brightness, -1, 1);
|
|
738
|
+
out.contrast = clamp(out.contrast, 0, 4);
|
|
739
|
+
out.saturation = clamp(out.saturation, 0, 4);
|
|
740
|
+
out.hue = ((out.hue % 360) + 540) % 360 - 180;
|
|
741
|
+
out.temperature = clamp(out.temperature, -1, 1);
|
|
742
|
+
out.tint = clamp(out.tint, -1, 1);
|
|
743
|
+
out.shadows = clamp(out.shadows, -1, 1);
|
|
744
|
+
out.highlights = clamp(out.highlights, -1, 1);
|
|
745
|
+
return out;
|
|
746
|
+
}
|
|
747
|
+
export function aggregateBlurRadius(clipEffects, trackEffects) {
|
|
748
|
+
const sum = (effects) => {
|
|
749
|
+
let radius = 0;
|
|
750
|
+
for (const e of effects) {
|
|
751
|
+
if (isClipBlurEffect(e))
|
|
752
|
+
radius += e.radius;
|
|
753
|
+
}
|
|
754
|
+
return radius;
|
|
755
|
+
};
|
|
756
|
+
return Math.min(256, sum(clipEffects) + sum(trackEffects));
|
|
757
|
+
}
|
|
758
|
+
/**
|
|
759
|
+
* A document colour to shader channels. The Canvas 2D path hands the same
|
|
760
|
+
* string to `fillStyle`, so anything CSS accepts has to arrive here as the
|
|
761
|
+
* same colour; an unparseable one falls back to opaque black rather than to a
|
|
762
|
+
* colour that is in the frame on one host and not the other.
|
|
763
|
+
*/
|
|
764
|
+
function colorChannels(color) {
|
|
765
|
+
const { r, g, b } = parseCssColorOrBlack(color);
|
|
766
|
+
return [r, g, b];
|
|
767
|
+
}
|
|
768
|
+
function isColorActive(c) {
|
|
769
|
+
return (Math.abs(c.brightness) > 0.001 ||
|
|
770
|
+
Math.abs(c.contrast - 1) > 0.001 ||
|
|
771
|
+
Math.abs(c.saturation - 1) > 0.001 ||
|
|
772
|
+
Math.abs(c.hue) > 0.001 ||
|
|
773
|
+
Math.abs(c.temperature) > 0.001 ||
|
|
774
|
+
Math.abs(c.tint) > 0.001 ||
|
|
775
|
+
Math.abs(c.shadows) > 0.001 ||
|
|
776
|
+
Math.abs(c.highlights) > 0.001);
|
|
777
|
+
}
|
|
778
|
+
function clamp(v, lo, hi) {
|
|
779
|
+
return Math.min(hi, Math.max(lo, v));
|
|
780
|
+
}
|
|
781
|
+
/**
|
|
782
|
+
* The clip effects that run as their own step, in document order — everything
|
|
783
|
+
* but `color` and `blur`, which fold into one aggregate pass across the clip
|
|
784
|
+
* and track scopes.
|
|
785
|
+
*/
|
|
786
|
+
function isShaderStepEffect(effect) {
|
|
787
|
+
return (effect.type === "lut" ||
|
|
788
|
+
effect.type === "stylize" ||
|
|
789
|
+
effect.type === "generator" ||
|
|
790
|
+
effect.type === "pixelate" ||
|
|
791
|
+
effect.type === "posterize" ||
|
|
792
|
+
effect.type === "directionalBlur" ||
|
|
793
|
+
effect.type === "lensDistortion" ||
|
|
794
|
+
isClipGlowEffect(effect) ||
|
|
795
|
+
isClipDropShadowEffect(effect) ||
|
|
796
|
+
isClipVignetteEffect(effect) ||
|
|
797
|
+
isClipSharpenEffect(effect) ||
|
|
798
|
+
isClipChromaKeyEffect(effect) ||
|
|
799
|
+
isClipCurvesEffect(effect) ||
|
|
800
|
+
isClipLevelsEffect(effect) ||
|
|
801
|
+
isClipLiftGammaGainEffect(effect) ||
|
|
802
|
+
isClipGrainEffect(effect));
|
|
803
|
+
}
|
|
804
|
+
//# sourceMappingURL=effects.js.map
|