XE5 ImageList的BUG?
今天做界面, 在imagelist里加载一个带有半透明通道的PNG图, 结果发现图片居然发暗, 如下:
原图: IDE里加载以后的图:
明显变暗...查询了源码, 无果
然后又用2010去测试, 发现没问题...可惜2010版本看不到ImageListEditer的源码, 所以无从比较
随后我又用代码去动态加载图片, 发现仍然会有图片变暗的问题:
var
nWIC: TWICImage;
nBmp: TBitmap;
begin
nWIC := TWICImage.Create;
nWIC.LoadFromFile('d:\542725.png'); nBmp := TBitmap.Create;
nBmp.Assign(nWIC); ImageList1.Add(nBmp, nil);
nBmp.Free;
nWIC.Free;
end;
继续查找源码, 经过1个多小时的各种郁闷, 终于发现了一个以前被忽略过的属性: nBmp.AlphaFormat
从帮助上看到其描述:
Vcl.Graphics.TAlphaFormat
Delphi
TAlphaFormat = (afIgnored, afDefined, afPremultiplied);
C++
enum DECLSPEC_DENUM TAlphaFormat : unsigned char { afIgnored, afDefined, afPremultiplied };
Properties
Type | Visibility | Source | Unit | Parent |
---|---|---|---|---|
enum | public |
Vcl.Graphics.pas
Vcl.Graphics.hpp
|
Vcl.Graphics | Vcl.Graphics |
Description
TAlphaFormat indicates how the reserved byte of each pixel is used in a 32 bit bitmap.
TAlphaFormat has the following values:
Value | Meaning |
---|---|
afIgnored |
The Reserved byte in the TRGBQuad is ignored. |
afDefined |
The reserved byte in the TRGBQuad contains an alpha value. |
afPremultiplied |
The reserved byte in the TRGBQuad contains an alpha value. The red, green, and blue values have been premultiplied with the alpha value. |
似乎应该使用afDefined值, 可以让BMP理解透明通道的值, 可是写了测试代码, 却无效果
试试其他的值, 发现使用afIgnored的时候是正常的...-_- 不知道为啥
var
nWIC: TWICImage;
nBmp: TBitmap;
begin
nWIC := TWICImage.Create;
nWIC.LoadFromFile('d:\542725.png'); nBmp := TBitmap.Create;
nBmp.Assign(nwic);
nBmp.AlphaFormat := afIgnored; ImageList1.Add(nbmp, nil);
nBmp.Free;
nWIC.Free;
end;
可惜在IDE界面里, 直接使用编辑器向ImageList添加图像仍然是灰色的, 无解....只好通过代码从资源文件中加载了.....先这么办吧
XE5 ImageList的BUG?的更多相关文章
- ImageList半透明,Alpha通道bug处理。
由于ImageList的先天障碍,对alpha通道支持不好.虽然到xp有所改善,但瑕疵依然存在. 通过reflactor发现ImageList通过windows api来进行读写的.写入数据时会对原始 ...
- 修正 XE5 Android 键盘三个问题
说明:XE5 在 Android 平台上存在这一些键盘操作的问题,目前发现有下列几种: 按键盘上的隐藏键后,无法按上一页(需要修改 XE5 源码「FMX.VirtualKeyboard.Android ...
- DevExpress VCL 13.1.4支持Delphi /C++Builder XE5
DevExpress VCL 13.1.4支持Delphi /C++Builder XE5 重大变化 ExpressLibrary dxHalfOfPi常数声明已经从cxGeometry单元移到了cx ...
- ERROR (ClientException) nova image-list
nova image-listERROR (ClientException): The server has either erred or is incapable of performi9e-6c ...
- 解决EnableVisualStyles Bug
一位朋友碰到了一个WinForm的问题,在网上搜了一通,没找到能解决问题的方案, 正好我以前以碰到过,在这里把解决方案呈上,以便有遇到此问题的朋友能有帮助. 问题是这样的,当启用了虚拟样式后,设置好的 ...
- CnPack for delphi xe5
CnPack Team is made up of Chinese Programmers and Delphi / C++ Builder fans across the Internet. Our ...
- DataSnap服务器从xe2升级到xe5报错的处理
DataSnap服务器从xe2升级到xe5环境下,能够正常编译,但运行后会报错,如下图: 处理参考: http://blogs.embarcadero.com/pawelglowacki/2013/0 ...
- Delphi Compiler Bug?
I found a Bug of Delphi XE3 Compiler,It may exists in XE4,XE5. Here is the code to show the bug proc ...
- 继续吐槽XE5中的boost::thread问题:找不到CC32130MT.DLL
在XE5中,随便创建一个HelloWorld程序,加入boost::thread的功能,编译链接后,无法运行,无法调试,提示找不到CC32130MT.DLL 这个DLL名字看上去好像是跟多线程有关的, ...
随机推荐
- HDU5008 Boring String Problem(后缀数组 + 二分 + 线段树)
题目 Source http://acm.hdu.edu.cn/showproblem.php?pid=5008 Description In this problem, you are given ...
- OA
OA(政府) http://zw.wuzhitong.com/oa_wuzhitong/index.asp http://www.wuzhitong.com/Information_ZW.html O ...
- 【SAP BO】【DI】DataService 服务无法启动。错误1069:由于登录失败而无法启动服务
重启BI服务器后,突然发现DataServices服务无法启动,提示: 错误 1069:由于登录失败而无法启动服务. 解决方法: (1)打开控制面板--> 服务 --> 右键点击Data ...
- 【Oracle】配置oracle数据库最大连接数
数据库中教你如何修改ORACLE最大连接数 Oracle的连接数相关参数:processes.sessions. Oracle的sessions是个派生值,由processes的值决定,session ...
- AngularJS进阶学习
参考:http://***/class/54f3ba65e564e50cfccbad4b 1. AJAX:Asynchronous JavaScript and XML(异步的 JavaScript ...
- 移动前端头部标签(HTML5 head meta)
移动前端开发中添加一些webkit专属的HTML5头部标签,帮助浏览器更好解析html代码,更好地将移动web前端页面表现出来.本文整理一些常用的meta标签. <!DOCTYPE html&g ...
- BNUOJ48605International Collegiate Routing Contest 题解
题目大意: 给你一些子网,求它们在整个网段的补集. 思路: 将子网转换成二进制建一棵Trie,直接DFS搜到没有了就记下来输出.注意:所给的子网会有交集,若搜到结尾就不向下搜了. 代码: #inclu ...
- Andriod phoneGap 入门
1.下载phoneGap(我之前用还是cordova-1.5.0.jar) http://phonegap.com/download/#autodownload 解压出来,找到lib/android目 ...
- topcoder SRM 610 DIV2 TheMatrix
题目的意思是给一个01的字符串数组,让你去求解满足棋盘条件的最大棋盘 棋盘的条件是: 相邻元素的值不能相同 此题有点像求全1的最大子矩阵,当时求全1的最大子矩阵是用直方图求解的 本题可以利用直方图求解 ...
- 如何伪装成为一名前端(JS方向)
作为一个菜鸟级别的.NET开发者,在连服务器都没搞定的情况下,要研究前端,这是在扯淡,不过,迫于工作的需要,时常需要去前端打杂,所以经常伪装成为一名前端,有时候竟产生错觉,去应聘Y一份前端work吧. ...