How to create and display a bitmap programatically?
I'm trying to create a random 50x50 pixel 256 color bitmap programatically. I have studied several instructions about bitmap creation, but the process is still unclear for me.
I have tried to do following:
- filled the bitmapfileinfoheader with correct values
- created a BYTE table with some random values
- used StretchDIBits to show the bitmap on the screen
As a result I was able to show some kind of bitmap on the screen, but probably not correctly. I don't understand how the color of the one pixel is constructed from the BYTE table that I have created.
How do I define which 256 colors the bitmap is using?
Do I have to define the RGBQUAD -structure for the bitmap?