Simbey Interchange Format (SIF)
The SIF library is a project I started in 2005 when I first began playing with OpenGL
programming. One of the first problems I encountered with OpenGL programming was how
to store and load images, especially those with alpha channels. And thus I began
writing the SIF library to deal with loading and storing images with alpha channels.
There's really no magic to what the SIF library does, but it does abstract away all the
image handling. It can become confusing quickly working with premultiplied alpha and
trying to remember whether the red and blue color channels need to be swapped. The SIF
library uses two rules when working with images: raw SIF bits are stored in RGBA
format, are not premultiplied with the alpha channel, and are stored top-down; 32 bpp DIBs
are assumed to be BGRA, premultiplied, and stored bottom-up.
When loading images into a SIF, most formats are loaded internally using GdiPlus, so
whatever can be loaded by GdiPlus can be loaded through the SIF. 32 bpp BMPs stored
with BI_RGB are loaded directly to preserve the alpha channel, however, because GdiPlus does
not recognize alpha channels in BMPs.
After loading images into the library, a SIF file is produced. I've included a simple
tool called Visual SIF that uses the library to load images into SIF files, but everything
the tool does with SIF files is done using public SIF library calls. I've found that a
good practice for using the SIF library is to create a custom build step in Visual Studio
that ties together all the PNGs in the project into a SIF file, and then the SIF file itself
is embedded into the EXE as a resource. The SIF library includes an API specifically
designed for loading a SIF from a resource.
All the images you add to a SIF are stored as layers. They can overlap, and they can
be flattened at run time to produce a single blended texture, or the layers can be retrieved
individually. It's a snap using the SIF to host icons used for the Windows Ribbon
Icons from an embedded SIF
Using Visual SIF to manage multiple layers
Rendering from a flattened texture in OpenGL
As of 7/25/2012, the SIF library contains an object for drawing text to OpenGL
scenes! Click here for details!
As of 9/20/2012, the SIF library can write 24-bit and 32-bit image bits to PNG format using
the LodePNG library internally. Visual SIF has
a menu option to export the canvas to PNG format using the SIF's new export.
As of 10/30/2013, the SIF library attempts first to load all images without premultiplied
alpha channels, if possible. Failing that, it then loads with premultiplied alpha
channels and expands the alpha channels manually (original behavior).
The SIF library was written in native C++ and should run on Windows XP+. If you use it
and find it useful, please let me know!
Download the SIF library - Updated on 10/30/2013