VideoFlint / Cabbage

A video composition framework build on top of AVFoundation. It's simple to use and easy to extend.
MIT License
1.52k stars 221 forks source link

Applying user transform before content mode in TrackConfiguration #58

Closed gazadge closed 3 years ago

gazadge commented 3 years ago

Context: TrackConfiguration's transform property lets developers applying custom transformations on TrackItem while TrackConfiguration's contentMode is responsible for how the TrackItem's content is displayed on screen (aspectFit/aspectFill/custom).

Issue: The CGAffineTransform stored in TrackConfiguration's transform property gets applied only after the contentMode transformations, so if a user transformation (e.g. rotation by 90 degrees) is set then .aspectFit and .aspectFill content modes won't work as expected:

https://github.com/VideoFlint/Cabbage/blob/e65b80fc04c026d14ca0a3a3ed0567d597233f86/Cabbage/Sources/Track/Configuration/TrackConfiguration.swift#L61-L84

Proposed solution: Move the user transform implementation just before the contentMode transformations.

Closes #57