How do I save a bitmap if all I know is the pixel data of an HDC
that I want to save it from?
What I want to do is 1) read all the pixel data from the 1st HDC
(which has the original bitmap loaded into it). Then 2) blit those
pixels into another HDC with modifications. Lastly 3) save the
image that was blitted into the 2nd HDC as a bitmap.
I know how to do steps 1 and 2 with GetPixel and SetPixel, I just
don't know how to save the contents of the 2nd HDC into
a bitmap file.
I know the structure of a bitmap file and I know the file will be a
16-bit bitmap.
All I can think of would be if I have to define my own
BITMAPFILEHEADER and BITMAPINFOHEADER, populate an array
of COLORREFs (that would hold pixel data). Then use CreateFile
and WriteFile to make the bitmap. I was just wondering (hoping)
if there was a function that made it easier/less combersome than
that.
Thanks in advance for any help.