vImageCVImageFormat_GetAlphaHint(_:)
Returns the alpha hint of a Core Video image format.
Declaration
func vImageCVImageFormat_GetAlphaHint(_ format: vImageConstCVImageFormat) -> Int32Parameters
- format:
The Core Video image format to query.
Return Value
Zero if the alpha hint isn’t opaque, or if the hint isn’t set. Nonzero if the alpha hint is fully opaque, even if the encoded values for alpha in the image aren’t 1.0.
Discussion
The functions that create Core Video image formats, such as vImageCVImageFormat_CreateWithCVPixelBuffer(_:), return a vImageCVImageFormat. The following code shows how you create a vImageConstCVImageFormat representation of a vImageCVImageFormat instance to pass to vImageCVImageFormat_GetAlphaHint(_:):
let alphaHint = withUnsafeBytes(of: cvImageFormat) { bytes in
let format = bytes.assumingMemoryBound(
to: vImageConstCVImageFormat.self).first!
return vImageCVImageFormat_GetAlphaHint(format)
}