Permalink
Browse files

Add alternative color masking implementation

  • Loading branch information...
1 parent 9ec6478 commit 37051ac061a72e1ef842d8a1bf495c0288f5bc93 @marcuswestin committed Feb 12, 2014
Showing with 20 additions and 0 deletions.
  1. +20 −0 Classes/FunObjc/FunUI/Images/UIImage+Fun.m
View
20 Classes/FunObjc/FunUI/Images/UIImage+Fun.m
@@ -73,6 +73,26 @@ - (UIImage *)maskWithColor:(UIColor *)tintColor {
}
return img;
+
+// CGFloat width = self.size.width;
+// CGFloat height = self.size.height;
+// CGRect bounds = CGRectMake(0,0,width,height);
+//
+// CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB();
+// CGContextRef bitmapContext = CGBitmapContextCreate(NULL, width, height, 8, 0, colorSpace, kCGImageAlphaPremultipliedLast);
+// CGContextClipToMask(bitmapContext, bounds, self.CGImage);
+// CGContextSetFillColorWithColor(bitmapContext, color.CGColor);
+// CGContextFillRect(bitmapContext, bounds);
+//
+// CGImageRef cImage = CGBitmapContextCreateImage(bitmapContext);
+// UIImage *coloredImage = [UIImage imageWithCGImage:cImage];
+//
+// CGContextRelease(bitmapContext);
+// CGColorSpaceRelease(colorSpace);
+// CGImageRelease(cImage);
+//
+// return coloredImage;
+
}
@end

0 comments on commit 37051ac

Please sign in to comment.