I have a piece of code that creates a mask using the alpha channel of an image. Before upgrading to Mavericks, it worked great, and I never received a single warning or error in the Xcode debug console. Since upgrading, I'm receiving this warning:
Implicit conversion from enumeration type 'enum CGImageAlphaInfo' to different enumeration type 'CGBitmapInfo' (aka 'enum CGBitmapInfo')
The line marked as being the problem:
CGBitmapContextCreate(alphaData, width, height, 8, rowBytes, NULL, kCGImageAlphaOnly);
Here's what the documentation says for the last argument (aka kCGImageAlphaOnly
):
bitmapInfo
Constants that specify whether the bitmap should contain an alpha channel, the alpha channel’s relative location in a pixel, and information about whether the pixel components are floating-point or integer values. The constants for specifying the alpha channel information are declared with the
CGImageAlphaInfo
type but can be passed to this parameter safely. You can also pass the other constants associated with theCGBitmapInfo
type.
Strangely, in the documentation (Alpha Information for Images), Apple's typedef doesn't list the option I'm using. However, in the term list that follows, it does! Here's what it says:
kCGImageAlphaOnly
There is no color data, only an alpha channel. Available in OS X v10.3 and later. Declared inCGImage.h
.
Considering that I want to create an alpha mask, I'm not interested in any color data, so the argument I'm using is the only one that makes sense. I'm not sure what it wants me to do. Regardless, the method works, and all is well when the app runs. With that said, the warnings are really annoying. Is there a special CLANG directive to silence it? Any help would be appreciated. Cheers.