简体   繁体   English

Delphi TImageList PNG alpha渲染太暗

[英]Delphi TImageList PNG alpha renders too dark

I have PNG icons for my Delphi XE3 application toolbar that, when added to a TActionToolbar via a TImageList , the alpha channel renders darker than it should, causing the icons to look bad. 我有PNG图标,当添加到我的Delphi XE3应用工具栏TActionToolbar通过TImageList ,alpha通道呈现比它应该更暗,导致图标看起来很糟糕。 I think the issue has to do with the TImageList and not something specifically with the TActionToolbar . 我认为问题与TImageList ,而与TActionToolbar

Photoshop mockup: Photoshop样机:

Photoshop样机

Actual look after importing to TActionToolbar (alpha is darker blue for the folder fill): 导入到TActionToolbar后的实际外观(对于文件夹填充,alpha为深蓝色):

实际

Here are my Delphi Object Inspector settings for the TImageList (no, the issue is not the BlendColor property): 这是我的TImageList Delphi对象检查器设置(不,问题不是BlendColor属性):

TImageList对象检查器

Is there a way to get Delphi/Windows/whoever the culprit is to render the alpha channel properly? 是否有办法使Delphi / Windows /无论罪魁祸首是正确渲染Alpha通道? An option is to make the icons all bitmaps, but I'd rather not go through the headache of editing bitmaps with a transparent color because, well, I'd rather not revert to the days of the dinosaurs... TIA. 一种选择是使图标全部为位图,但是我宁愿不费力用透明的颜色编辑位图,因为,我宁愿不回到恐龙时代……TIA。

The best way I found to deal with this is to paint the background color of your Delphi toolbar (or whatever UI element) underneath every pixel that contains transparency in Photoshop before saving the PNG image. 我发现最好的解决方法是在保存PNG图像之前,在Photoshop中每个包含透明性的像素下方绘制Delphi工具栏(或任何UI元素)的背景色。 This way, the toolbar icons are totally opaque except for the 100% transparent pixels, so there is no alpha blending that takes place--and hence no ugliness. 这样,除了100%透明像素外,工具栏图标都是完全不透明的,因此不会发生alpha混合-因此不会出现丑陋的情况。

Use RRUZ's code here to make the disabled toolbar icons look better. 在此处使用RRUZ的代码可使禁用的工具栏图标看起来更好。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM