我试图在swift中创建一个CGContext。它编译,但在运行时抛出错误。
let colorSpace:CGColorSpace = CGColorSpaceCreateDeviceRGB() let context:CGContext = CGBitmapContextCreate(nil,20,8,colorSpace,CGBitmapInfo.AlphaInfoMask) CGColorSpaceRelease(colorSpace); ....
错误是:
Error: CGBitmapContextCreate: unsupported parameter combination: 8 integer bits/component; 32 bits/pixel; 3-component color space; unrecognized; 96 bytes/row. fatal error: Can't unwrap Optional.None