Last active
August 29, 2015 13:56
-
-
Save ChristianSch/9294098 to your computer and use it in GitHub Desktop.
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
// Größe | |
int viewHeight = 800; | |
int viewWidth = 800; | |
// Initialisieren des CGContext nach Dokumentation | |
int bitmapBytesPerRow = (pixelsWide * 4); | |
int bitmapByteCount = (bitmapBytesPerRow * pixelsHigh); | |
CGColorSpaceRef colorSpace = CGColorSpaceCreateWithName(kCGColorSpaceGenericRGB); | |
void *bitmapData = malloc( bitmapByteCount ); | |
if (bitmapData == NULL) | |
NSLog(@"Memory not allocated!"); | |
CGContextRef contextRef = CGBitmapContextCreate(bitmapData, | |
pixelsWide, | |
pixelsHigh, | |
8, | |
bitmapBytesPerRow, | |
colorSpace, | |
(CGBitmapInfo)kCGImageAlphaPremultipliedFirst); | |
if (contextRef == NULL) | |
{ | |
free(bitmapData); | |
NSLog(@"Context could not be created!"); | |
} | |
CGColorSpaceRelease(colorSpace); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment