//
//  UIImage+Extension.h
//  SLAiELTS
//
//  Created by Gusont on 2023/3/10.
//

#import <UIKit/UIKit.h>

NS_ASSUME_NONNULL_BEGIN

@interface UIImage (Extension)

+ (NSData *)compressImage:(UIImage *)image;

//纯色图
+ (UIImage *)imageWithColor:(UIColor *)color size:(CGSize)size;
//纯色图-圆角
+ (UIImage *)imageWithColor:(UIColor *)color
                       size:(CGSize)size
               cornerRadius:(CGFloat)cornerRadius;
//渐变图
+ (UIImage *)gradientImageSize:(CGSize)size
                    startPoint:(CGPoint)startPoint
                      endPoint:(CGPoint)endPoint
                        colors:(NSArray <UIColor *> *)colorStrs;
//渐变图-圆角
+ (UIImage *)gradientImageSize:(CGSize)size
                    startPoint:(CGPoint)startPoint
                      endPoint:(CGPoint)endPoint
                        colors:(NSArray <UIColor *> *)colorStrs

                  cornerRadius:(CGFloat)cornerRadius;

/// 字符串转图片
/// @param string base64String
+ (UIImage *)imageFromBase64String:(NSString *)string;

#pragma mark - 压缩图片到指定大小(单位KB)
+ (NSData *)resetSizeOfImageData:(UIImage *)sourceImage
                         maxSize:(NSInteger)maxSize;

@end

NS_ASSUME_NONNULL_END
