Windows with C++: Windows Imaging Component (Part 2 of ... oops!)
In April 2007 MSDN Magazine published part 1 of a 3 part series of articles on the Windows Imaging Component. Part 1 provides a good introduction to using WIC to encode and decode various image formats using this new imaging API. Part 2 and 3 were meant to show you how to extend WIC with your own image formats. Unfortunately it didn’t quite work out as planned.
I chose the ICO format as an example since the WIC codec provides very limited support for this format and in particular does not support the new PNG-based icons in Windows Vista. Unfortunately it was decided that it would not be a good idea for MSDN Magazine to showcase a codec to replace the one that ships with Windows and the .NET Framework even if it was only meant to serve as an example.
It was however too late in the publishing cycle and the article had to ship. Part 3 was scrapped but you can now read the “wrap-up” of the WIC series. It still provides some useful information if you’re curious about the ICO format in Windows Vista and some tips on writing a WIC codec.
Windows with C++: Decoding Windows Vista Icons with WIC
As with many facets of Windows, the icon format is steeped in history. In the early days of the 16-bit Windows operating system only the device-dependent bitmap (DDB) format was supported. Such a bitmap specified a width and height in pixels as well as a table that mapped pixels to entries in a particular device's color palette. Because different devices naturally supported different resolutions and had different color capabilities, these bitmaps were not easily moved from one device to another. DDBs were, however, very efficient and are in fact still used today for certain operations. A device-independent bitmap (DIB) format was introduced to correct all of the problems inherent in DDBs. Such a bitmap included its own color table independent of any particular device. The bitmap's pixels then mapped to the bitmap's color table, which unambiguously defined the pixel colors using red, green, and blue (RGB) color values...
For more information about extending WIC you can read the following lengthy article on MSDN:
How to Write a WIC-Enabled CODEC and Get Full Platform Support for Your Image Format
Lesson of the day: avoid publishing multi-part articles until all parts have been reviewed.