Contents

withMutablePixelBufferIfAvailable(_:)

Writes to the underlying pixel buffer.

Declaration

mutating func withMutablePixelBufferIfAvailable<R>(_ body: (CVPixelBuffer) throws -> R) rethrows -> R?

Parameters

  • body:

    The closure to run with the pixel buffer.

Discussion

Use this method to writes the contents of the underlying pixel buffer.

let array = MLShapedArray<Float16>(mutating: pixelBuffer, shape: [2, 3])
array.withMutablePixelBuffer { backingPixelBuffer in
     // write backingPixelBuffer here.
}

See Also

Reading and writing the pixel buffer