Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

D2007 (December 2007 update) BRCC32, ICO, RES and colour depth issue / clarification

Tags:

delphi

After far more investigation that I'd like, I have arrived at the conclusion (maybe erroneously), that BRCC32 has a problem creating resource files that have ICO images of varying color depths.

To be specific, if you have icons in an ICO file that have both 8 bit 256 color and 24 bit XP (alpha) images, then BRCC32 will produce a RES file containing these, but both the 8 bit and 24 bit images will be flagged as 24 bit. The issue is then that systems wanting to display the 24 bit images i.e. those capable of more than 256 colors, will pick the first image matching that requirement. In my case at least, that happens to be the "pseudo" 24 bit 256 color icon. Thus you get a lower resolution icon on your desktop than you should do.

Using HeavenTools' "Resource Tuner", the "Group Icon" information can clearly be seen to hold 24 bit descriptors for the 8 bit images.

Two ways forward for me. Remove the 256 color ico images, which results in only the "correct" 24 bit XP Alpha images in the resulting RES file. The downside is that you have no 256 color icons should you need them. A better way forward is to use GoRC.exe (resource compiler) from http://www.godevtool.com/#rc as an alternative to BRCC32. This correctly handles the combination of 8 and 24 bit images. The result is that windows can select the correct icon, appropriate to the display resolution of the system.

As a side issue I've also seen that BRCC32 doesn't appear to handle PNG compressed images (you get error 15 Allocate failed). It was looking for this error that I came across GoRC (via Jan Wichers blog).

Has anyone had similar experiences that confirm any of my findings, or am I missing some key knowledge ? My follow on would be, is this still an issue in D2009 / D2010 ??

Paul.

like image 581
Paul Avatar asked Mar 18 '10 13:03

Paul


1 Answers

I recently had the same issue - the BRCC32 resource compiler definitely gets confused if you have 256-colour and 32-bit colour subicons in the same icon. After lots of investigation, it seems that when the icon group header is written to the .res file, it always puts a value of 32-bit in, ignoring the actual colour depth.

I had to produce an app to resolve this, and I've attached it below with source. Bearing in mind this is a quick fix I did which makes some assumptions about what's going to be found in the resource file, I thought it might help you out:

ResFix.zip

like image 56
Kieran Avatar answered Oct 04 '22 09:10

Kieran