Files
featherVoice/QXLive/Tools/Category/UIImage+QX.h
2025-08-08 10:49:36 +08:00

81 lines
1.9 KiB
Objective-C
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

//
// UIImage+QX.h
// QXLive
//
// Created by 启星 on 2025/4/28.
//
#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
@interface UIImage (QX)
typedef NS_ENUM(NSUInteger, GradientType) {
GradientTypeTopToBottom = 0,//从上到小
GradientTypeLeftToRight = 1,//从左到右
GradientTypeUpleftToLowright = 2,//左上到右下
GradientTypeUprightToLowleft = 3,//右上到左下
};
// 指定尺寸 进行图片压缩
- (NSData *)qx_compressImageQualityWithToByte:(NSInteger)maxLength;
/**
把view生成UIImage图片
@param view 传入view
@return 生成的UIImage
*/
+ (UIImage *)qx_convertViewToImageWith:(UIView *)view;
+ (UIImage *)qx_gradientColorImageFromColors:(NSArray*)colors gradientType:(GradientType)gradientType imgSize:(CGSize)imgSize;
/**
根据颜色生成UIImage对象
@param color color对象
@return UIImage 实例对象
*/
+ (instancetype)qx_imageWithColor:(UIColor *)color;
/**
把图片image对象的size 缩放到控件的实际大小
@param size 控件实际尺寸
@param fillColor 周围颜色
@return 新的image对象
*/
- (instancetype)qx_imageFitWithSize:(CGSize)size fillColor:(UIColor *)fillColor;
/**
把图片image对象处理成圆角
@param radius 圆角半径
@param corners 控制圆角的位置
@param fillColor 被裁减掉区域的颜色
@param zoomSize 缩放尺寸,应等于控件的尺寸
@return 新的image对象
*/
- (instancetype)qx_imageCornerWithRadius:(CGFloat)radius byRoundingCorners:(UIRectCorner)corners fillColor:(UIColor *)fillColor zoomSize:(CGSize)zoomSize;
/**
设置图片圆角
@param radius 圆角半径
@param fillColor 被裁减掉区域的颜色
@param zoomSize 缩放尺寸,应等于控件的尺寸
@return 新的image对象
*/
- (instancetype)qx_imageCornerWithRadius:(CGFloat)radius fillColor:(UIColor *)fillColor zoomSize:(CGSize)zoomSize;
/*
获取系统启动页的图片
*/
+ (instancetype)qx_getAppLauchImage;
@end
NS_ASSUME_NONNULL_END