permuteChannels(to:destination:)
Permutes the channels of a floating-point 16-bit-per-channel, 4-channel interleaved pixel buffer.
Declaration
func permuteChannels(to permuteMap: (UInt8, UInt8, UInt8, UInt8), destination: vImage.PixelBuffer<Format>)Parameters
- permuteMap:
A tuple of four 8-bit integers with the values 0, 1, 2, and 3, in some order.
- destination:
The destination pixel buffer.
Discussion
For example, the following code reverses the channel ordering of a pixel buffer:
let buffer = vImage.PixelBuffer<vImage.Interleaved16Fx4>(
pixelValues: [10, 20, 30, 40],
size: vImage.Size(width: 1,
height: 1))
buffer.permuteChannels(to: (3, 2, 1, 0),
destination: buffer)
// Prints "[40, 30, 20, 10]".
print(buffer.array)