Created
September 6, 2011 00:57
-
-
Save EverythingSolution/1196284 to your computer and use it in GitHub Desktop.
5 bits per pixel, no alpha
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
static const CGBitmapInfo kDefault16CGBitmapInfoNoAlpha = (kCGImageAlphaNoneSkipFirst | kCGBitmapByteOrder16Host); | |
CGContextRef CreateCGBitmapContextForWidthAndHeight(void *data, unsigned int width, unsigned int height) | |
{ | |
CGColorSpaceRef colorSpace = GetDeviceRGBColorSpace(); // function to get static color space instance | |
CGBitmapInfo alphaInfo = kDefault16CGBitmapInfoNoAlpha; | |
return CGBitmapContextCreate( | |
data, | |
width, | |
height, | |
5, /* Bits per component */ | |
width*2, /* Bytes per row (3 components per pixel, 5 bits per component, 15 bits per pixel (round up to 16), 2 bytes per pixel) */ | |
colorSpace, | |
alphaInfo | |
); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment