CGBitMapContextCreate Method Causes Compiler Warning Xcode 5 not Xcode 4 CGBitMapContextCreate Method Causes Compiler Warning Xcode 5 not Xcode 4 ios ios

CGBitMapContextCreate Method Causes Compiler Warning Xcode 5 not Xcode 4


The kCGImageAlpha* enum values are supposed to fill the first five bits in CGBitmapInfo. However, since the C type system can't express this, you get a warning that the types don't match, even though they were intended to.

The correct solution is to cast your alpha enum value to CGBitmapInfo, since that's what it is:

(CGBitmapInfo)kCGImageAlphaPremultipliedFirst


Saw a comment https://github.com/inkling/Subliminal/issues/23 by aegolden that the intention of the new XCode warning might be directing you to use different masks on these enum types to construct and concatenate various flags. So instead of just using kCGImageAlphaPremultipliedFirst, use

(kCGBitmapAlphaInfoMask & kCGImageAlphaPremultipliedFirst)

The warning will disappear after this change.


matomo