Contents

vImageConverter_CreateWithCGImageFormat(_:_:_:_:_:)

Creates a vImage converter that converts from one vImage Core Graphics image format to another.

Declaration

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

Parameters

  • srcFormat:

    A pointer to a populated Vimage_cgimageformat structure describing the image format of the source image. If the Cgcolorspace value is NULL, sRGB is used as the default value. The Cgcolorspace reference is retained by this function and is released when the Vimageconverter is destroyed.

  • destFormat:

    A pointer to a populated Vimage_cgimageformat structure describing the image format of the destination image. If the Cgcolorspace value is NULL, sRGB is used as the default value. The Cgcolorspace reference is retained by this function and is released when the Vimageconverter is destroyed.

  • backgroundColor:

    An array of floats to be used as a background color if one is needed. The backgroundColor range is assumed to be [0,1]. The channel ordering and number of color channels must match the natural order of the destination colorspace (for example, RGB or CMYK). The backgroundColor value may be NULL if no background color is needed.

  • flags:

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

    Kvimageprintdiagnosticstoconsole

    Prints a debug message if the operation fails.

    Kvimagedonottile

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

Mentioned in

Return Value

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

Discussion

This function creates a vImageConverter instance to convert between image formats described by vImage_CGImageFormat. The vImageConverter is intended to be used and reused with vImageConvert_AnyToAny(_:_:_:_:_:) to convert images from one format to another.

See Also

Creating a converter