Reputation: 699
I think the title is very much explanatory but here's a bit more detail what I'm trying to do. Basically say I have a BITMAP loaded in Memory.
I would like to extract the BITMAPINFOHEADER from it and add it to my packet structure which will be transferred over a socket.*
Transferring it is not a problem, but once it arrives I'd like to turn it back into a BITMAP so that I can work with it.
I've been struggling with this and I've searched high and low without any luck. An example and a list of functions I will need to accomplish this would be helpful.
Many thanks. I need this in win32 c++. [no .NET or MFC] Appreciated.
Upvotes: 2
Views: 1677
Reputation: 69632
Sender:
HBITMAP
GetObject
CreateDIBSection
to create another HBITMAP
of the same resolution 24/32-bit RGB with VOID*
pointer which points to raw byte; you will initialize BITMAPINFOHEDER
in code - you should already have all data you need by that pointBitBlt
from original bitmap into this oneBITMAPINFOHEDER
+ bytes at helper bitmap data pointer to network (sizeof BITMAPINFOHEDER
+ BITMAPINFOHEDER::biSizeImage
bytes)Receiver:
CreateDIBSection
to create bitmap using BITMAPINFOHEDER
you received; you are getting again a pointer to raw datamemcpy
image data into the memory location under the given pointer or just progressively receive data thereHBITMAP
againUpvotes: 7