Skip to content

Instantly share code, notes, and snippets.

View beta-yu's full-sized avatar
🇨🇳
Focusing

beta-yu beta-yu

🇨🇳
Focusing
View GitHub Profile
@ygit
ygit / gist:ff8b591b7373ba740a04
Created November 3, 2015 08:18
Get Average Color of UIImage
- (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
@staltz
staltz / introrx.md
Last active July 6, 2024 17:07
The introduction to Reactive Programming you've been missing