Solid Fluid System Solutions  
Home Software About Hardware Firmware
Current Document Icon LibWinImage
Document Icon Description
Document Icon Download


The LibWinImage Logo
The LGPL Logo

LibWinImage is a suite of C helper routines specifically designed to help manipulate Microsoft Windows bitmaps, at the top level.

LibWinImage is as simple as it gets. For similar reasons to those of LibRLE, this library is available as an open source offering. In addition it is notable that all of our interfaces to the common open source image file formats are similar. They require and produce Windows bitmap formats, without the BITMAPINFOHEADER that would normally be associated. This library has three key aims;

  • To allow addition and stripping of BITMAPFILEHEADERS on anonyomous memory blocks that contain Windows bitmaps.

  • To allow the conversion of BITMAPINFOHEADER versions on anonyomous memory blocks that contain Windows bitmaps.

  • To produce a metadata format, in the form of an anonymous struct, that allows easier progrmmatic manipulation of Windows bitmaps.

All of these things are relatively easy to do, but all are only subtly different. It's tremendously easy to create errors as a result of supporting these subtle differences in a disparate way. We're fairly sure that this code is robust, but even if it's not we're satisfied that any potential problems with bitmap interpretation are confined to this code. Where a problem is identified, it can be resolved in a generic way, which is hugely important.

In addition to these benefits, the metadata required by the InfoStructs passed to the image import filters (like LibPNG) require specific information about the size of an image, and the details of the packing within that image. The metadata can be reliably calculated by these routines and simply transferred to the InfoStructs passed to each of the import filters.

This library does not offer the capacity to convert between different sizes or colour depths of Windows bitmap. When it comes to resampling, resizing and masking bitmap images, actions are performed at a higher level in our C++ libraries. These C++ libraries are not available (currently) as open source code. If you need those capabilities then you must implement them yourself, or perhaps contact us to do a deal. In truth, it would probably have to be a good deal, because this isn't a capability that we're keen to release, except as a part of an application.

Despite these constraints we think that the scheme offered here is a useful integration of a variety of image formats on any computer platform. Obviously it's going to be most useful on Windows, simply because the central format is Windows bitmap. Nevertheless, a bitmap is a bitmap wherever you go! The open source part of this offering, including the parts that we didn't write, will allow conversions between different file formats. The difficulty is that it does not offer conversion between all possible types within that set, merely a subset.

These libraries (LibPNG, LibJPEG et al.) do 70% of the work, resampling makes that 95% and masking the final 5%. An icon editor is perhaps the only application that might require the last 5%. Indeed, if you're not using Windows, Windows icons probably don't interest you anyhow. There is information on the internet which explains how to do all the resampling and error diffusion. With just a little lateral thinking one can get a fairly comprehensive capability. Why not give it a go!

Copyright © Solid Fluid 2007-2022
Last modified: SolFlu  Wed, 17 Jun 2009 18:43:31 GMT