Thursday 15 April 2010

ios - How do I create an alpha only bitmap context -


Apple Tech Note "To create an alpha-only bitmap context simply pass the null to the color scheme parameter."

However, I'm not sure what to pass for the bitmapInfo parameter

I was trying to do something like this, with kCGImageAlpha Only:

  CGContextRef ctx = CGBitmapContextCreate (NULL, scaledSize.width, scaledSize.height, 8, scaledSize.width, NULL, kCGImageAlphaOnly);   

But it gives me a warning about being wrong. What should I do instead?

The docs clearly states that you can CGImageAlphaInfo even if the parameter is < Code> CGBitmapInfo is defined according to the requirement of a value from enum.

A solution value must be entered:

  (CGITMapInfo) KCGImage Alpha only   

This will make the compiler happy.

No comments:

Post a Comment