zoukankan      html  css  js  c++  java
  • 转载---CGImageSource对图像数据读取任务的抽象

    转载地址:http://www.tanhao.me/pieces/1019.html

    CGImageSource是对图像数据读取任务的抽象,通过它可以获得图像对象、缩略图、图像的属性(包括Exif信息)。

    1.创建CGImageSourceRef

    2.获取图像

    3.创建图像的缩略图

    4.获取图像的属性信息

    其中获取到的kCGImagePropertyPixelHeight和kCGImagePropertyPixelHeight的数值是原始的值,也就是旋转之前的数值,所以要获取到显示图像的宽和高,需要对应kCGImagePropertyOrientation的值,而通过查看kCGImagePropertyOrientation的文档介绍,值分别从1-8,但其解释却让人看不懂,经过测试,得出与UIImageOrientation有以下的映射关系:

    UIImageOrientationUp:             1      正常方向(默认值)   如图:UIImageOrientationUp

    UIImageOrientationDown:           3       旋转180度(朝左朝右当然是一样的)    如图:UIImageOrientationDown

    UIImageOrientationLeft:           8      向左逆时针旋转90度    如图:UIImageOrientationLeft

    UIImageOrientationRight:          6      向右顺时针旋转90度    如图:UIImageOrientationRight

    UIImageOrientationUpMirrored:     2      将原图水平的翻转到背面    如图:UIImageOrientationUpMirrored

    UIImageOrientationDownMirrored:   4      在水平翻转之后再旋转180度    如图:UIImageOrientationDownMirrored

    UIImageOrientationLeftMirrored:   5      在水平翻转之后向左逆时针旋转90度    如图:UIImageOrientationLeftMirrored

    UIImageOrientationRightMirrored:  7      在水平翻译之后向右顺时针旋转90度    如图:UIImageOrientationRightMirrored

    相关的Demo:头像裁剪选择器McAvatarView

  • 相关阅读:
    JavaScript小笔记の经典算法等....
    SEO
    幻灯片の纯CSS,NO JavaScript
    试说明采用双缓冲技术如何进行I/O操作
    常用的缓冲技术有哪几种?
    什么是缓冲,引入缓冲的原因是什么?
    什么是设备控制块,它主要包括什么内容,简述其作用?
    进程的逻辑设备如何与一个物理设备建立对应的关系?
    什么是设备独立性,引入这一概念有什么好处?
    试叙述段页式地址变换过程。
  • 原文地址:https://www.cnblogs.com/yunis/p/4290774.html
Copyright © 2011-2022 走看看