Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- - (CGContextRef) RFS_blackAndWhiteImageContextOfWidth:(int)pixelsWidth andHeight:(int)pixelsHeight
- {
- CGContextRef theContext=NULL;
- CGColorSpaceRef colorSpace;
- void *bitmapData;
- int bitmapByteCount;
- int bitmapBytePerRow;
- bitmapBytePerRow = pixelsWidth;
- bitmapByteCount = (bitmapBytePerRow * pixelsHeight);
- colorSpace = CGColorSpaceCreateDeviceGray();
- bitmapData = malloc(bitmapByteCount);
- if(bitmapData == NULL) {
- printf("Error");
- return NULL;
- }
- theContext = CGBitmapContextCreate(bitmapData,
- pixelsWidth,
- pixelsHeight,
- 8,
- bitmapBytePerRow,
- colorSpace,
- kCGImageAlphaNoneSkipLast);
- if(theContext == NULL) {
- free(bitmapData);
- printf("ERROR");
- return NULL;
- }
- }
- // get error: CGBitmapContextCreate: unsupported parameter combination: 8 integer bits/component; 16 bits/pixel; 1-component color space; kCGImageAlphaNoneSkipLast; 320 bytes/row.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement