Contents

vImageConverter_CreateForCVToCGImageFormat(_:_:_:_:_:)

Creates a vImage converter that converts a Core Video-formatted image to a Core Graphics-formatted image.

Declaration

func vImageConverter_CreateForCVToCGImageFormat(_ srcFormat: vImageCVImageFormat, _ destFormat: UnsafePointer<vImage_CGImageFormat>, _ backgroundColor: UnsafePointer<CGFloat>!, _ flags: vImage_Flags, _ error: UnsafeMutablePointer<vImage_Error>!) -> Unmanaged<vImageConverter>!

Parameters

  • srcFormat:

    The Vimagecvimageformat structure that describes the pixel format associated with the source image buffers.

  • destFormat:

    The Vimage_cgimageformat structure that describes the pixel format associated with the destination buffers.

  • backgroundColor:

    In cases where the source format has an alpha channel and the destination doesn’t (or is Noneskipfirst or Noneskiplast) the conversion removes the alpha channel by flattening it against an opaque background color. The background color is specified as three Cgfloat Swift.struct values corresponding to red, green, and blue in sRGB.

  • flags:

    The options to use when performing this operation. The following flags are supported:

    Name

    Description

    Kvimageprintdiagnosticstoconsole

    Prints a debug message if the operation fails..

    Kvimagehighqualityresampling

    Instructs the converter to spend extra time to achieve better image quality in cases where chroma is upsampled or downsampled as part of the conversion.

    Kvimagedonottile

    Operates as if Kvimagedonottile was passed to Vimageconvert_anytoany(_:_:_:_:_:).

Return Value

kvImageNoError; otherwise, one of the error codes that Data Types and Constants describes.

Discussion

This function creates a vImageConverter instance that’s used with vImageConvert_AnyToAny(_:_:_:_:_:) to convert a Core Video formatted image, described by vImageCVImageFormat, to Core Graphics image data, described by vImage_CGImageFormat.

See Also

Creating a converter