CIContext

class CIContext : NSObject
  • Factory for creating a CIContext using the available graphics API.

    Declaration

    Swift

    public class func createDefaultCIContext(_ mtlDevice: MTLDevice? = nil) -> CIContext?

    Parameters

    mtlDevice

    Processor for computing

    Return Value

    Default configuration rendering context, otherwise nil.

  • Creates a UIImage from the given sample buffer input

    Declaration

    Swift

    public func uiimage(withSampleBuffer sampleBuffer: CMSampleBuffer) -> UIImage?

    Parameters

    sampleBuffer

    sample buffer input

    Return Value

    UIImage from the sample buffer, otherwise nil

  • Creates a UIImage from the given pixel buffer input

    Declaration

    Swift

    public func uiimage(withPixelBuffer pixelBuffer: CVPixelBuffer) -> UIImage?

    Parameters

    pixelBuffer

    Pixel buffer input

    Return Value

    UIImage from the pixel buffer, otherwise nil

  • Orient a pixel buffer using an exif orientation value.

    Declaration

    Swift

    @available(iOS 11.0, *)
    public func createPixelBuffer(fromPixelBuffer pixelBuffer: CVPixelBuffer, withOrientation orientation: CGImagePropertyOrientation, pixelBufferPool: CVPixelBufferPool) -> CVPixelBuffer?

    Parameters

    pixelBuffer

    Pixel buffer input

    orientation

    CGImage orientation for the new pixel buffer

    pixelBufferPool

    Pixel buffer pool at which to allocate the new buffer

    Return Value

    Oriented pixel buffer, otherwise nil

  • Create a pixel buffer from a MTLTexture and orientation value.

    Declaration

    Swift

    @available(iOS 11.0, *)
    public func createPixelBuffer(fromMTLTexture mtlTexture: MTLTexture, withOrientation orientation: CGImagePropertyOrientation, pixelBufferPool: CVPixelBufferPool) -> CVPixelBuffer?

    Parameters

    mtlTexture

    Input texture to render

    orientation

    CGImage orientation for the new pixel buffer

    pixelBufferPool

    Pixel buffer pool at which to allocate the new buffer

    Return Value

    Oriented pixel buffer, otherwise nil