Skip to content

v1.1.0 — reorder the filter stack

Latest

Choose a tag to compare

@SteliyanH SteliyanH released this 31 Aug 14:59
· 3 commits to main since this release
eb93a6f

VideoClip.moveFilters(fromOffsets:toOffset:)

Filter order is render order — a blur before a vignette is not the same image as a vignette before a blur — and there was no way to change it.

This was a hole rather than an absence: kadr-ui 0.19 shipped an onFilterMove callback, so the UI package had been asking consumers to perform a move the engine could not express.

By hand it meant moving three parallel arrays by the same offsets and rebuilding the clip through a strip-and-re-add cycle — seventeen lines that fail silently when they drift, because the arrays stay the same length and an animation simply starts driving the wrong filter.

clip.moveFilters(fromOffsets: from, toOffset: to)

Offsets follow onMove's convention, so a callback's values pass straight through.

One implementation note

Array.move(fromOffsets:toOffset:) is a SwiftUI extension, not a standard library one — found at link time. kadr core has no SwiftUI dependency and a headless consumer should not acquire one to reorder a filter, so the reorder is implemented here. The tests use SwiftUI's version as an oracle, comparing exhaustively across every source and destination pair, which is a better check than trusting the reimplementation.

658 tests. Additive and source-compatible.