Monday, July 9, 2012

ios texture from UIImage

CGContextRef spriteContext = CGBitmapContextCreate(spriteData, width, height, 8, width*4, CGImageGetColorSpace(spriteImage), kCGImageAlphaPremultipliedLast);

This function is employed in many tutorials. There is trick with alpha channel. It seems to fill no zero alpha pixels only. spriteData here has to be set to zero first. Otherwise, the background will be random.

No comments:

Post a Comment