Search code examples
cwindowsdirectxgdidib

What is Windows DIB?


I was just discussing if there was an alternative windows graphics library to GDI & Direct X in a forum. Someone mentioned WinDIB. Sadly, he didn't explain more about it.

Now I've searched google.

  • There seems to be no Wikipedia article on Windows DIB.

  • It appears that some graphics libraries such as SDL use a WinDIB backend.

So what exactly is WinDIB? Is there any documentation to it? Where can I learn more about it?


Solution

  • DIB stands for Device Independent Bitmap. It is a Windows-specific general bitmap format. Essentially it is the format of a Windows [.bmp] file. It is very useful as an intermediate format in order to e.g. present OpenCV pictures in native Windows windows.

    As an example, my ColorDib.h file, from the last few days, supports a limited subset of the DIB formats, namely palette-free RGB pictures. I have used that to display OpenCV video in a native Windows window. Actually, complete source for that is at the Bitbucket repository that the link goes to.

    Microsoft does not offer very much Windows API level functionality for reading or writing BMP/DIB files. In the old days all that was there was OleLoadPicturePath and friends, plus reusing the web browser if you liked to do in very inefficient, complex and weird ways, plus some horrid code presented in the documentation. Then came GDI+, which, although far from perfect, simplified a lot. And nowadays it’s no problem except when programming purely at the API level, where a class such as the one I linked to above comes in very handy.