// // UIImage+Category.h // Sleeper // // Created by Luo yuntao on 15/7/16. // Copyright © 2019年 YJJ. All rights reserved. // #import <UIKit/UIKit.h> typedef NS_ENUM(NSInteger, GradientDirection) { GradientDirectionTopToBottom = 0, // 从上往下 渐变 GradientDirectionLeftToRight, // 从左往右 GradientDirectionBottomToTop, // 从下往上 GradientDirectionRightToLeft // 从右往左 }; typedef void(^compoundImageResult)(int resultCode,UIImage *image,NSError *error); @interface UIImage (Category) + (UIImage *)drawImageWithSize:(CGSize)size color:(UIColor *)color; + (UIImage *)drawImageWithSize:(CGSize)size color:(UIColor *)color cornerRadius:(CGFloat)cornerRadius; + (UIImage *)streImageNamed:(NSString *)imageName; /* 图片指定位置不拉伸*/ + (UIImage *)streImageNamed:(NSString *)imageName capX:(CGFloat)x capY:(CGFloat)y; - (UIImage *)scaleImageWithSize:(CGSize)size; - (UIImage *)scaleImageWithScale:(CGFloat)scale; - (UIImage *)roundedCornerImageWithCornerRadius:(CGFloat)cornerRadius; //压缩图片 - (UIImage *)drawImageFromImage:(UIImage*)originImage; //改变图片颜色 - (UIImage *)imageWithColor:(UIColor *)color; + (UIImage *)drawImageFromView:(UIView *)view size:(CGSize)size; + (UIImage *)drawImageFromTableView:(UITableView *)tableView; + (UIImage *)drawImageFromScrollView:(UIScrollView *)view; //压缩图片 + (UIImage *)compressImageFromSourceImage:(UIImage *)image; + (UIImage *)fp_resizableImage:(NSString *)imageName; + (UIImage*)gradientImageWithBounds:(CGRect)bounds andColors:(NSArray*)colors andGradientType:(GradientDirection)gradientType; @end