UIImage+Extension.h 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. //
  2. // UIImage+Extension.h
  3. // SmartLightForBigFish
  4. //
  5. // Created by coderYK on 2017/8/7.
  6. // Copyright © 2017年 RD-iOS. All rights reserved.
  7. //
  8. #import <UIKit/UIKit.h>
  9. @class RDSRgbColor;
  10. @interface UIImage (Extension)
  11. /// 颜色生成图片
  12. + (UIImage *)rds_imageWithColor:(UIColor *)color;
  13. /// 生成渐变色图片
  14. + (UIImage *)rds_imageWithColor:(UIColor *)startColor toColor:(UIColor *)toColor imgSize:(CGSize)imgSize;
  15. /**
  16. 用于合成用户占位头像
  17. @param imageName 展位头像原图
  18. @param backgroundColor 占位图背景色
  19. @return 合成头像(圆形)
  20. */
  21. + (UIImage *)rds_imageWithName:(NSString *)imageName andBackgroundColor:(UIColor *)backgroundColor;
  22. /**
  23. * 根据传入的字符串以及指定的大小生成一张二维码图片
  24. *
  25. * @param string 传入的字符串
  26. * @param size 指定的尺寸大小
  27. *
  28. * @return 二维码图片
  29. */
  30. + (UIImage *)rds_creatQRCodeWithString:(NSString *)string withSize:(CGFloat)size;
  31. /**
  32. * 根据传入的数据以及指定的大小生成一张二维码图片
  33. *
  34. * @param data 传入的数据
  35. * @param size 指定的尺寸大小
  36. *
  37. * @return 二维码图片
  38. */
  39. + (UIImage *)rds_creatQRCodeWithData:(NSData *)data withSize:(CGFloat)size;
  40. /**
  41. 返回一张不被渲染的原始图片
  42. */
  43. + (UIImage *)rds_renderingOriginalimageWithName:(NSString *)imageName;
  44. - (RDSRgbColor *)rds_colorAtPixel:(CGPoint)point;
  45. /// 修改图片大小
  46. /// @param size CGRectMake
  47. - (UIImage *)rds_imageScaleToSize:(CGSize)size;
  48. /// 修改图片颜色
  49. - (UIImage *)rds_changeColorWithRed:(CGFloat)red green:(CGFloat)green blue:(CGFloat)blue;
  50. @end