For my iPhone 3D applications, I am currently using CoreGraphics to download png files that have pre-multiplied alpha. Here is the basic information:
CGContextRef context =
CGBitmapContextCreate(data, width, height, 8, num_channels * width, colorSpace,
kCGImageAlphaPremultipliedLast | kCGBitmapByteOrder32Big);
CGRect rect = CGRectMake(0, 0, width, height);
CGContextDrawImage(context, rect, image);
CGContextRelease(context);
Then I continue to use the data as a texture in OpenGL.
My question is: by specifying pre-multiplied alpha - kCGImageAlphaPremultipliedLast - I - inadvertently - tell CoreGraphics to multiply rgb channels by alpha, or - what I assumed - I just indicate that the input image format has a preliminary format, multiplied alpha?
Thanks Doug
dugla source
share