Jump to navigation

Poupou's Corner of the Web

Looking for perfect security? Try a wireless brick.
Otherwise you may find some unperfect stuff here...

Weblog

Codecs - ICO

I was about to blog about metafiles when I realized I didn't talk, well blog, about icons, so let start with them...

Icon support exists in two ways in System.Drawing and libgdiplus. First there's the Icon class which, for some unknown (to me) reason, doesn't inherit from the Image class. This part existed, up to recently, in a fully managed implementation. However this implementation wasn't able to coexist with native code when using handles e.g. Bitmap.FromHicon(icon.GetHandle);.

The second place where icons could be used, which was totally missing in Mono 1.2.0, is in the ICO codec. This allows the creation of a Bitmap instances from any ICO file. Well almost any ICO as it turns out GDI+ ICO codec is more limited than what GDI (and System.Drawing.Icon) support (e.g. 32bpp icons).

So what's new ? The latest (and greatedt) Mono, version 1.2.3, has full support for both icon cases, including native interoperability. This means that libgdiplus has a (unmanaged) ICO codec and that the System.Drawing.Icon reuse this to provide handle support under Linux (and other platforms using libgdiplus). Under Windows the GDI API is used to support native interoperability.

The only known missing, and untested, icon feature are the new Vista icons. They are larger than before (like the rest of the OS ;-) and use another storage format (compressed PNG from what I've read). Actually I'm not sure how, or even if, they are supported by the existing .NET frameworks... considering that GDI+ doesn't seems to like (and neither does VS.NET 2005 really support) the 32bpp icons introduced in XP. Anyway let me know if you have some totally free Vista icons to add to the test suite. Who knows, we could be the first to support them ;-)


2/12/2007 16:53:45 | Comments

The views expressed on this website/weblog are mine alone and do not necessarily reflect the views of my employer.