Skip to content

Instantly share code, notes, and snippets.

View guidedways's full-sized avatar
😑
Focusing

Beehive Innovations guidedways

😑
Focusing
View GitHub Profile
@guidedways
guidedways / masking-image.m
Created December 29, 2019 12:08 — forked from toddlee/masking-image.m
Masking a UIImage with a mask UIImage in iOS
- (UIImage*) maskImageWithMask:(UIImage *) mask
{
CGImageRef imageReference = self.CGImage;
CGImageRef maskReference = mask.CGImage;
CGImageRef imageMask = CGImageMaskCreate(CGImageGetWidth(maskReference),
CGImageGetHeight(maskReference),
CGImageGetBitsPerComponent(maskReference),
CGImageGetBitsPerPixel(maskReference),
CGImageGetBytesPerRow(maskReference),