iOS学习 --- UIImage方法(imageWithCGImage: scale: orientation:)

 

UIImage *imaged = [UIImage imageWithCGImage:image.CGImage scale:1.0 orientation:UIImageOrientationUp];

 


/*

cgImage:cgImage = image.CGImage  image为原始图片

scale:原始图片放大倍数

orientation:即UIImage的imageOrientation属性   控制image的绘制方向

*/


+ (UIImage *)imageWithCGImage:(CGImageRef)cgImage scale:(CGFloat)scale orientation:(UIImageOrientation)orientation API_AVAILABLE(ios(4.0));

/*
typedef NS_ENUM(NSInteger, UIImageOrientation) {
    UIImageOrientationUp,            // default orientation
    UIImageOrientationDown,          // 180 deg rotation
    UIImageOrientationLeft,          // 90 deg CCW
    UIImageOrientationRight,         // 90 deg CW
    UIImageOrientationUpMirrored,    // as above but image mirrored along other axis. horizontal flip
    UIImageOrientationDownMirrored,  // horizontal flip
    UIImageOrientationLeftMirrored,  // vertical flip
    UIImageOrientationRightMirrored, // vertical flip
};
*/

UIImageOrientationUp:表示图片的正常状态

UIImageOrientationDown:表示图片被翻转180°

UIImageOrientationLeft:表示图片被逆时针翻转90°

UIImageOrientationRight:表示图片被顺时针翻转90°

UIImageOrientationUpMirrored:表示图片的正常状态的镜面图像

UIImageOrientationDownMirrored:表示图片被翻转180°后的镜面图像

UIImageOrientationLeftMirrored:表示图片被逆时针翻转90°后的镜面图像

UIImageOrientationRightMirrored:表示图片被顺时针翻转90°后的镜面图像
 

 

相关文章

image图片大小调整和方向调整(UIImageOrientation)

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章