Slide 20
Slide 20 text
[self.queue addOperationWithBlock:^{
CIImage *ciImage = [CIImage imageWithContentsOfURL:sourceURL];
CIFilter *depthOfFieldFilter = [CIFilter filterWithName:@"CIDepthOfField"];
...
CIImage *finalImage = [alphaFilter valueForKey:kCIOutputImageKey];
CGContextRef cgContext = CGBitmapContextCreate(NULL, size.width, size.height, 8,
size.width * 4, colorSpace, kCGImageAlphaPremultipliedLast);
CIContext *context = [CIContext contextWithCGContext:cgContext options:nil];
CGImageRef outputImage = [context createCGImage:finalImage fromRect:ciImage.extent];
...
CGImageDestinationAddImage(destination, outputImage, nil);
CGImageDestinationFinalize(destination);
}];