UIImage-ImageWithColor颜色创建图像工具
UIImage-ImageWithColor 是一款使用颜色创建图像的工具。
用法
- 用另一张图像制作模糊的图像
#import "UIImage+Blur.h" ... // jpeg quality image data float quality = .00001f; // intensity of blurred float blurred = .5f; NSData *imageData = UIImageJPEGRepresentation([self.imageViewNormal image], quality); UIImage *blurredImage = [[UIImage imageWithData:imageData] blurredImage:blurred]; self.imageViewBlurred.image = blurredImage;
- 截屏
#import "UIImage+Screenshot.h" ... UIImage *image = [UIImage screenshot]; self.imageView.image = image;
- 生成彩色图像
#import "UIImage+ImageWithColor.h" ... UIColor *purpleColor = [UIColor colorWithRed:.927f green:.264f blue:.03f alpha:1]; UIImage *image = [UIImage imageWithColor:purpleColor]; [self.navigationBar setBackgroundImage:image forBarMetrics:UIBarMetricsDefault];
评论