iOS开发_对图片进行缩放和翻转

/**
 对图片进行缩放和翻转
 
 @param cgImage            图片
 @param scale                比例: < 1 放大, > 1 缩小
 @param orientation   翻转方式
 @return     返回一张缩放和翻转过的图片
 */
+ (UIImage *)imageWithCGImage:(CGImageRef)cgImage
                        scale:(CGFloat)scale
                  orientation:(UIImageOrientation)orientation;
=> orientation   翻转方式
    UIImageOrientationUp,              // 不反转
    UIImageOrientationDown,            // 逆时针旋转 180 度
    UIImageOrientationLeft,            // 逆时针旋转 90 度,只垂直方向放大
    UIImageOrientationRight,           // 顺时针旋转 90 度,只垂直方向放大
    UIImageOrientationUpMirrored,      // 水平镜像反转
    UIImageOrientationDownMirrored,    // 垂直镜像反转
    UIImageOrientationLeftMirrored,    // 水平镜像反转,逆时针旋转 90 度,只垂直方向放大
    UIImageOrientationRightMirrored,   // 水平镜像反转,顺时针旋转 90 度,只垂直方向放大

UIImage *image = [UIImage imageWithCGImage:image.CGImage scale:0.5 orientation:UIImageOrientationUpMirrored];
posted @ 2022-11-09 10:54  CH520  阅读(180)  评论(0编辑  收藏  举报