You can create a bitmap context with no alpha channel. You just can't create a bitmap context with three bytes per pixel. Here's the secret handshake:
CGContextRef gc = CGBitmapContextCreate(NULL, myWidth, myHeight, 8, 0,
myColorSpace, kCGImageAlphaNoneSkipLast);
In Swift:
let gc = CGContext(
data: nil,
width: myWidth, height: myHeight,
bitsPerComponent: 8, bytesPerRow: 0,
space: myColorSpace,
bitmapInfo: CGImageAlphaInfo.noneSkipLast.rawValue)
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…