Skip to content

Instantly share code, notes, and snippets.

@jordandobson
Created June 10, 2015 22:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jordandobson/852c4c6ef5e19966ee1a to your computer and use it in GitHub Desktop.
Save jordandobson/852c4c6ef5e19966ee1a to your computer and use it in GitHub Desktop.
Objective-c Apply Blending mode to an image
- (UIImage *)createDimImage:(UIImage *)image; {
CGSize size = image.size;
CGRect bounds = CGRectMake(0, 0,size.width, size.height);
UIImage * dimImage;
UIGraphicsBeginImageContextWithOptions(size, NO, 0.0f);
[msColorNeutralLight setFill];
UIRectFill(bounds);
[image drawInRect:bounds blendMode:kCGBlendModeMultiply alpha:1.0f];
dimImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
return dimImage;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment