Implicit conversion from enumeration type 'enum CGImageAlphaInfo' to different enumeration type 'CGB
Implicit conversion from enumeration type 'enum CGImageAlphaInfo' to different enumeration type 'CGB
在使用xcode5 sdk iOS7环境,创建图形上下文进行图形绘制,合并,裁剪,特效处理等时避免不了使用如下方法创建位图:
在 iOS7以前,是使用如下方法创建的:
CG_EXTERN CGContextRef CGBitmapContextCreate(void *data, size_t width,
size_t height, size_t bitsPerComponent, size_t bytesPerRow,
CGColorSpaceRef space,CGImageAlphaInfo bitmapInfo)
注意最后一个参数类型是 CGImageAlphaInfo 枚举类型中的kCGImageAlphaPremultipliedLast值。其整型值为1。
但是在iOS7版本中,这个最后的参会类型发生了变化。看一下定义:
CGContextRef CGBitmapContextCreate(void *data,size_t width,
size_t height,size_t bitsPerComponent, size_t bytesPerRow,
CGColorSpaceRef space,CGBitmapInfo bitmapInfo)
很明显最后一个参数由CGImageAlphaInfo 变化为 CGBitmapInfo,看一下这个类型的定义
从头到尾没有发现值为1的枚举量值。故在使用的时候会出现如下警告:
Implicit conversion from enumeration type 'enum CGImageAlphaInfo' to different enumeration type 'CGBitmapInfo' (aka 'enum CGBitmapInfo')
意思很明显不过,类型不匹配非法。
以下给出解决方法:
第一种方法,定义宏:
这样就会直接映射出一个值为1的宏,原有方法不用改变。
第二种方法:原理和第一个一样,目的 还是为了生产出一个为1的值,直接修改代码。
其实所有的做法,不外乎为了使这里的值为1,类型匹配。你也直接可以传1,不用麻烦的各种写代码。也可以直接进行类型强制转换,这个你随便。只是每个人的习惯不一样,故,如何解决,自己参考决定 。
Implicit conversion from enumeration type 'enum CGImageAlphaInfo' to different enumeration type 'CGB的更多相关文章
- Implicit conversion from enumeration type 'enum CGImageAlphaInfo' to different enumeration type 'CGBitmapinfo' (aka) 'enum CGBitmapInfo')
The constants for specifying the alpha channel information are declared with the CGImageAlphaInfo ty ...
- 解决spring mvc 上传报错,Field [] isn't an enum value,Failed to convert value of type 'java.lang.String[]' to required type '
没有选择附件,但是点击上传按钮的时候会报错. 之前不选择文件,直接上传空文件是可以的,后来不知道改了什么就不行了. 错误信息: -- :: [http--] TRACE org.springframe ...
- solidity智能合约implicit conversion异常
问题场景 在使用^0.5.10版本的solidity时,如果使用this关键字会出现以下问题. 代码: require(tokenContract.balanceOf(this) >= _num ...
- Cannot convert value of type [java.lang.String] to required type [java.util.Date] for property 'xxx': no matching editors or conversion strategy found
今天在完成项目的时候遇到了下面的异常信息: 04-Aug-2014 15:49:27.894 SEVERE [http-apr-8080-exec-5] org.apache.catalina.cor ...
- (转)怎么去掉Xcode工程中的某种类型的警告 Implicit conversion loses integer precision: 'NSInteger' (aka 'long') to 'int32
问题描述 在我们的项目中,通常使用了大量的第三方代码,这些代码可能很复杂,我们不敢改动他们,可是作者已经停止更新了,当sdk升级或者是编译器升级后,这些遗留的代码可能会出现许许多多的警告,那么我们有 ...
- Type mismatch: cannot convert from Enumeration<String> to Enumeration<Object>
完整的错误信息: Description Resource Path Location TypeType mismatch: cannot convert from Enumeration<St ...
- 怎么去掉Xcode工程中的某种类型的警告 Implicit conversion loses integer precision: 'NSInteger' (aka 'long') to 'int32
unsigned long numComponents = CGColorGetNumberOfComponents([[UIColor blackColor] CGColor]); 2014年12月 ...
- 怎么去掉Xcodeproject中的某种类型的警告 Implicit conversion loses integer precision: 'NSInteger' (aka 'long') to 'int32
问题描写叙述 在我们的项目中,通常使用了大量的第三方代码,这些代码可能非常复杂,我们不敢修改他们,但是作者已经停止更新了,当sdk升级或者是编译器升级后,这些遗留的代码可能会出现许很多多的警告,那么 ...
- Cannot convert value of type [java.lang.String] to required type [javax.sql.DataSource] for property 'dataSource': no matching editors or conversion strategy found
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sqlSessionFa ...
随机推荐
- F(x)
Problem Description For a decimal number x with n digits (AnAn-1An-2 ... A2A1), we define its weight ...
- nyoj 84阶乘后0的个数
描述 计算n!的十进制表示最后有多少个0 输入 第一行输入一个整数N表示测试数据的组数(1<=N<=100)每组测试数据占一行,都只有一个整数M(0<=M<=10000000) ...
- Dynamic Vertex Buffers
ynamic vertex buffers on the other hand allow us to manipulate the information inside the vertex buf ...
- (5)I2C总线的10bit地址以及通用广播地址
其实,10bit地址我没用过,通用广播地址更没用过.通用广播地址应该是在多个mcu之间用i2c进行通信时使用的.虽说没用到,但还是做了翻译,说不定以后有机会用到: 10bit地址 10bit的寻址扩展 ...
- oracle 对象上锁,不能插入或删除情况
ora-00054:resource busy and acquire with nowait specified解决方法 当某个数据库用户在数据库中插入.更新.删除一个表的数据,或者增加一个表的主键 ...
- makefile for VCS from Syn@psys
已调试通过 未来将修改成verdi的FSDB版本 下载后把 Makefile_VCS.txt 修改为 Makefile 就可以使用 链接地址: http://files.cnblogs.com/all ...
- (原)Struts 相关资源下载
官网:http://struts.apache.org 点击[Download],进入页面如下,可以看到下载的资源: 点击[struts-2.3.20-all.zip],就能获取Struts2项目所有 ...
- PAT 1038 体验Python之美
1038. Recover the Smallest Number (30) 时间限制 400 ms 内存限制 32000 kB 代码长度限制 16000 B 判题程序 Standard 作者 CHE ...
- [delphi技术]Delphi常见图象格式转换技术
TJPEGScale = (jsFullSize, jsHalf, jsQuarter, jsEighth);//图片大小(全部,1/2,1/4,1/8)TBitmap.pixelFormat:=pf ...
- 问题-Delphi编译时提示缺少delphi自己的单元文件
问题现象:在编译工程是,提示缺少DELPHI自己的很多单元. 问题原因:这可能是因为手动误删除,或是第三方控件安装时误删除DELPHI自己的目录引起的(如果说错了,希望高人指点). 问题处理: 方法一 ...