withUnsafeVImageBuffers(_:)
Calls the given closure with the underlying vImage buffers.
Declaration
func withUnsafeVImageBuffers<R>(_ body: ([vImage_Buffer]) throws -> R) rethrows -> RParameters
- body:
A closure with a Vimage_buffer parameter that points to the underlying vImage buffers of the pixel buffer.
Return Value
The return value, if any, of the body closure parameter.
Discussion
Use this function to incorporate pixel buffer based image processing code with existing vImage code. For example, the following code accesses each multiple-plane pixel buffer’s underlying vImage buffers’ rowBytes property:
let src = vImage.PixelBuffer<vImage.Planar8x4>(size: vImage.Size(width: 32,
height: 64))
src.withUnsafeVImageBuffers { vImageBuffers in
for buffer in vImageBuffers {
print(buffer.rowBytes)
}
}