Contents

permuteChannels(to:destination:)

Permutes the channels of an 8-bit-per-channel, 3-channel interleaved pixel buffer.

Declaration

func permuteChannels(to permuteMap: (UInt8, UInt8, UInt8), destination: vImage.PixelBuffer<Format>)

Parameters

  • permuteMap:

    A tuple of three 8-bit integers with the values 0, 1, and 2 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.Interleaved8x3>(
    pixelValues: [10, 20, 30],
    size: vImage.Size(width: 1,
                      height: 1))

buffer.permuteChannels(to: (2, 1, 0),
                       destination: buffer)

// Prints "[30, 20, 10]"
print(buffer.array)

See Also

Permuting Channels