Slide 13
Slide 13 text
Dispatch Global
CGContextScaleCTM(c, 1.0, -1.0);
CGContextTranslateCTM(c, 0, -height);
CGMutablePathRef circlePath = CGPathCreateMutable();
CGPathAddEllipseInRect( circlePath , NULL ,
CGRectMake(1, 1, width-2, height-2) );
CGContextAddPath(c, circlePath);
CGContextClip(c);
UIImage * personImage = [UIImage imageWithContentsOfFile:path];
CGContextDrawImage(c, CGRectMake(0, 0, width, height),
personImage.CGImage);
CGContextRelease(c);
CGColorSpaceRelease(genericRGBColorspace);
GLubyte *imageData = (GLubyte *) calloc(1, width * height * 4);
CGColorSpaceRef genericRGBColorspace = CGColorSpaceCreateDeviceRGB();
CGContextRef c = CGBitmapContextCreate(imageData, width, height, 8, width * 4,
genericRGBColorspace,
kCGBitmapByteOrder32Little
| kCGImageAlphaPremultipliedFirst);