我正在将 Apple 的UIImageEffects
示例代码从 Objective-C 重写为 Swift,我对以下行有疑问:
vImage_CGImageFormat format = {
.bitsPerComponent = 8,
.bitsPerPixel = 32,
.colorSpace = NULL,
.bitmapInfo = kCGImageAlphaPremultipliedFirst | kCGBitmapByteOrder32Little,
.version = 0,
.decode = NULL,
.renderingIntent = kCGRenderingIntentDefault
};
这是我在 Swift 中的版本:
let bitmapInfo = CGBitmapInfo(rawValue: CGImageAlphaInfo.PremultipliedFirst.rawValue | CGBitmapInfo.ByteOrder32Little.rawValue)
let format = vImage_CGImageFormat(bitsPerComponent: 8, bitsPerPixel: 32, colorSpace: nil, bitmapInfo: bitmapInfo, version: 0, decode: nil, renderingIntent: .RenderingIntentDefault)
这是bitmapInfo
在 Swift 中创建的最简单的方法吗?