MCPcopy Create free account
hub / github.com/Vanilagy/webcodecs-polyfill / ParseRotation

Function ParseRotation

src/video_frame.ts:852–860  ·  view source on GitHub ↗
(rotation?: number)

Source from the content-addressed store, hash-verified

850};
851
852const ParseRotation = (rotation?: number): number => {
853 if (rotation === undefined) return 0;
854 // Let alignedRotation be the nearest multiple of 90 to rotation, rounding ties towards positive infinity.
855 const alignedRotation = Math.ceil(rotation / 90) * 90;
856 // Let fullTurns be the greatest multiple of 360 less than or equal to alignedRotation.
857 const fullTurns = Math.floor(alignedRotation / 360) * 360;
858 // Return |alignedRotation| - |fullTurns|.
859 return Math.abs(alignedRotation) - Math.abs(fullTurns);
860};
861
862const PickColorSpace = (
863 overrideColorSpace: VideoColorSpaceInit | undefined,

Callers 2

constructorMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected