I am trying to convert images/textures (for SpriteKit) to grayscale with CoreImage in Swift :
I found this answer : https://stackoverflow.com/a/17218546/836501 which I try to convert to swift for iOS7/8
But kCGImageAlphaNone
doesn't exist. Instead I can use CGImageAlphaInfo.None
but the function CGBitmapContextCreate()
doesn't like it as its last parameter. I am obliged to use the enum CGBitmapInfo
but there doesn't seem to be the kCGImageAlphaNone
equivalent inside.
This is the full line with the wrong parameter (last one) :
var context = CGBitmapContextCreate(nil, UInt(width), UInt(height), 8, 0, colorSpace, kCGImageAlphaNone)
I just need a way to convert UIImage to grayscale in Swift.