eMage - Opening 16-color bitmaps with Turbo C++ 3.0


Links
Home
Open Bitmaps with Turbo-C++
Mouse Events Tutorial - 1
Mouse Events Tutorial - 2
Mouse Events Tutorial - 3
Algorithms
Feedback

Support writeKA
writeKA Language Tools

First uploaded on 08-Mar-2003.
Standardised html and moved to new domain on 04-Mar-2006.



16-color Bitmap Code
When I needed to open bitmaps for a DOS game I was making, I couldn't find a way. I needed to open them because it was easier to create and modify them with the available graphics editors like MS Paint. So I fiddled around with the bitmap files until the header made sense to me. I ought to have documented the information properly, but I didn't so I am giving you the code below. I may elaborate on the format later on but until then you'll have to make sense out of the following function ;-).

The following code has been written for Turbo C++ 3.0. You'll have to #include <graphics.h> and call initgraph() before calling the function since the function in the current form uses functions present in the graphics.h library provided by Turbo C++. You can port the code easily by changing all the graphics output functions. Fseek(), fopen() etc are standard C/C++ functions of course. I thank Rajeev Sharma for pointing out the error in the originally posted code.

You would have noticed the function getcol(int). This is because the numbers used to represent Turbo C++ colors differ from that of the bitmap format.

Its pretty easy to make sense of the headers if you spend some time on it. You may find the 256 color header a bit more difficult but RGB is pretty simple. I'll add those too at a later date.

Your feedback/questions/requests are welcome.