- (UIImage*)convertToInverseWhiteMask: (UIImage *) image {
UIGraphicsBeginImageContextWithOptions(image.size, NO, image.scale);
CGRect imageRect = CGRectMake(0.0f, 0.0f, image.size.width, image.size.height);
CGContextRef ctx = UIGraphicsGetCurrentContext();
// Draw a white background (for white mask)
CGContextSetRGBFillColor(ctx, 0.0f, 0.0f, 0.0f, 0.75f);
CGContextFillRect(ctx, imageRect);
// Apply the source image's alpha
[image drawInRect:imageRect blendMode:kCGBlendModeDestinationOut alpha:1.0f];
CGContextScaleCTM(ctx, 1.0, -1.0);
UIImage* mask = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
return mask;
}
Решение. Отдаем картинку, получаем обратную.