(by @andrestaltz)
If you prefer to watch video tutorials with live-coding, then check out this series I recorded with the same contents as in this article: Egghead.io - Introduction to Reactive Programming.
- (UIColor *)getAverageColor:(UIImage *)image{ | |
CGSize size = {1, 1}; | |
UIGraphicsBeginImageContext(size); | |
CGContextRef ctx = UIGraphicsGetCurrentContext(); | |
CGContextSetInterpolationQuality(ctx, kCGInterpolationMedium); | |
[image drawInRect:(CGRect){.size = size} blendMode:kCGBlendModeCopy alpha:1]; | |
uint8_t *data = CGBitmapContextGetData(ctx); | |
UIColor *color = [UIColor colorWithRed:data[2] / 255.0f | |
green:data[1] / 255.0f |
(by @andrestaltz)
If you prefer to watch video tutorials with live-coding, then check out this series I recorded with the same contents as in this article: Egghead.io - Introduction to Reactive Programming.