One Logo Pool Ball
Accelerate · IOS API REFERENCE

MultiplePlanePixelFormat

protocol · iOS 16.0+ · SDK 27.1

protocol MultiplePlanePixelFormat : PixelFormat

A pixel format that contains multiple homogeneous planes represented by multiple underlying vImage buffers. Use multiplane pixel buffers to store image data as discrete planar buffers that represent individual channels. For example, the following code deinterleaves an interleaved buffer and applies different gamma adjustments to different color channels. The code calls `PixelBuffer.convert(to:)` to reinterleave the image data and generates a `CGImage` instance of the final output. ``` let srcImage = #imageLiteral(resourceName: "...").cgImage( forProposedRect: nil, context: nil, hints: nil)! var cgImageFormat = vImage_CGImageFormat( bitsPerComponent: 8, bitsPerPixel: 8 * 3, colorSpace: CGColorSpaceCreateDeviceRGB(), bitmapInfo: CGBitmapInfo(rawValue: CGImageAlphaInfo.none.rawValue))! let interleaved = try vImage.PixelBuffer( cgImage: srcImage, cgImageFormat: &cgImageFormat, pixelFormat: vImage.Interleaved8x3.self) let multiplane = vImage.PixelBuffer<vImage.Planar8x3>(interleavedBuffer: interleaved) multiplane.withUnsafePixelBuffers { pixelBuffers in // Apply gamma to red channel. pixelBuffers[0].applyGamma(.nineOverElevenHalfPrecision, destination: pixelBuffers[0]) // Apply gamma to green channel. pixelBuffers[1].applyGamma(.fiveOverElevenHalfPrecision, destination: pixelBuffers[1]) } multiplane.convert(to: interleaved) let outputImage = interleaved.makeCGImage(cgImageFormat: cgImageFormat) ```

Members (0)

This type has no directly callable members in this snapshot. See the framework’s skipped declarations for unsupported APIs.

Skipped declarations

No declarations were skipped in this snapshot.

All Accelerate types →