123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119 |
- //
- // UIImage+RQExtension.h
- // RQCommon
- //
- // Created by 张嵘 on 2018/11/16.
- // Copyright © 2018 张嵘. All rights reserved.
- //
- #import <UIKit/UIKit.h>
- @interface UIImage (RQExtension)
- + (UIImage *)fixOrientation:(UIImage *)image;
- /**
- * 根据图片名返回一张能够自由拉伸的图片 (从中间拉伸)
- */
- + (UIImage *)rq_resizableImage:(NSString *)imgName;
- + (UIImage *)rq_resizableImage:(NSString *)imgName capInsets:(UIEdgeInsets)capInsets;
- /// 返回一张未被渲染的图片
- + (UIImage *)rq_imageAlwaysShowOriginalImageWithImageName:(NSString *)imageName;
- /// 获取视频某个时间的帧图片
- + (UIImage *)rq_thumbnailImageForVideo:(NSURL *)videoURL atTime:(NSTimeInterval)time;
- /// /// 获取屏幕截图
- ///
- /// @return 屏幕截图图像
- + (UIImage *)rq_screenShot;
- - (UIImage *)rq_fixOrientation;
- /**生成新尺寸 不裁剪图片
- */
- - (UIImage *)scaledToSize:(CGSize)newSize;
- /**生成新尺寸 裁剪图片
- */
- - (UIImage *)scaledAndCutToSize:(CGSize)newSize;
- - (UIImage*)imageRotatedByDegrees:(CGFloat)degrees;
- /// 压缩图片到指定大小(单位KB)
- + (NSData *)resetSizeOfImageData:(UIImage *)sourceImage maxSize:(NSInteger)maxSize;
- /// 调整图片分辨率/尺寸(等比例缩放)
- + (UIImage *)newSizeImage:(CGSize)size image:(UIImage *)sourceImage;
- /**
- * 给图片加水印图片
- *
- * @param image 水印图片
- * @param imgRect 水印图片所在位置,大小
- * @param alpha 水印图片的透明度,0~1之间,透明度太大会完全遮盖被加水印图片的那一部分
- *
- * @return 加完水印的图片
- */
- - (UIImage*)imageWaterMarkWithImage:(UIImage *)image imageRect:(CGRect)imgRect alpha:(CGFloat)alpha;
- /**
- * 同上
- *
- * @param image 同上
- * @param imgPoint 水印图片(0,0)所在位置
- * @param alpha 同上
- *
- * @return 同上
- */
- - (UIImage*)imageWaterMarkWithImage:(UIImage*)image imagePoint:(CGPoint)imgPoint alpha:(CGFloat)alpha;
- /**
- * 给图片加文字水印
- *
- * @param str 水印文字
- * @param strRect 文字所在的位置大小
- * @param attri 文字的相关属性,自行设置
- *
- * @return 加完水印文字的图片
- */
- - (UIImage*)imageWaterMarkWithString:(NSString*)str rect:(CGRect)strRect attribute:(NSDictionary *)attri;
- /**
- * 同上
- *
- * @param str 同上
- * @param strPoint 文字(0,0)点所在位置
- * @param attri 同上
- *
- * @return 同上
- */
- - (UIImage*)imageWaterMarkWithString:(NSString*)str point:(CGPoint)strPoint attribute:(NSDictionary*)attri;
- /**
- * 返回加水印文字和图片的图片
- *
- * @param str 水印文字
- * @param strPoint 文字(0,0)点所在位置
- * @param attri 文字属性
- * @param image 水印图片
- * @param imgPoint 图片(0,0)点所在位置
- * @param alpha 透明度
- *
- * @return 加完水印的图片
- */
- - (UIImage*)imageWaterMarkWithString:(NSString*)str point:(CGPoint)strPoint attribute:(NSDictionary*)attri image:(UIImage*)image imagePoint:(CGPoint)imgPoint alpha:(CGFloat)alpha;
- /**
- * 同上
- *
- * @param str 同上
- * @param strRect 文字的位置大小
- * @param attri 同上
- * @param image 同上
- * @param imgRect 图片的位置大小
- * @param alpha 透明度
- *
- * @return 同上
- */
- - (UIImage*)imageWaterMarkWithString:(NSString*)str rect:(CGRect)strRect attribute:(NSDictionary *)attri image:(UIImage *)image imageRect:(CGRect)imgRect alpha:(CGFloat)alpha;
- - (UIImage *)imageAddCornerWithCornerRadiusArray:(NSArray<NSNumber *> *)cornerRadius lineWidth:(CGFloat)lineWidth borderPosition:(QMUIImageBorderPosition)borderPosition lineColor:(NSString *)lineColor andSize:(CGSize)size;
- @end
|