- (UIImage *)colorImage:(UIImage *)origImage withColor:(UIColor *)color { UIGraphicsBeginImageContextWithOptions(origImage.size, YES, 0); CGContextRef context = UIGraphicsGetCurrentContext(); CGContextSetFillColorWithColor(context, [color CGColor]); CGContextFillRect(context, (CGRect){ {0,0}, origImage.size} ); CGAffineTransform flipVertical = CGAffineTransformMake(1, 0, 0, -1, 0, origImage.size.height); CGContextConcatCTM(context, flipVertical); CGContextDrawImage(context, (CGRect){ pt, origImage.size }, [origImage CGImage]); UIImage *image = UIGraphicsGetImageFromCurrentImageContext(); UIGraphicsEndImageContext(); return image; }
Home
» Image
» iOS
» Objective-C
» Objective-C Tutorial
» Changing The Color Of Your Image Programmatically In iOS Objective-C
Changing The Color Of Your Image Programmatically In iOS Objective-C
in
Image,
iOS,
Objective-C,
Objective-C Tutorial
- on 9:10 AM
- No comments
Post a Comment