from a third party component I am receiving a PBitmap which is a pointer to Windows.tagBitmap record.
{ Bitmap Header Definition }
PBitmap = ^TBitmap;
{$EXTERNALSYM tagBITMAP}
tagBITMAP = record
bmType: Longint;
bmWidth: Longint;
bmHeight: Longint;
bmWidthBytes: Longint;
bmPlanes: Word;
bmBitsPixel: Word;
bmBits: Pointer;
end;
TBitmap = tagBITMAP;
{$EXTERNALSYM TBitmap}
BITMAP = tagBITMAP;
{$EXTERNALSYM BITMAP}
I would like to convert data contained in this pointer to a regular DIB and save this data to a stream. Just as Graphics.TBitmap.SaveToStream does.
So preferably I would like to have a procedure like:
procedure SavetagBitmapAsDIBToStream(const ABitmap: PBitmap; var AStream: TStream);
I've tried to find information about this structure on MSDN, but none of the headers described there (BITMAPFILEHEADER, BITMAPINFOHEADER etc.) seems to conform tagBITMAP.
Could someone experienced in the matter could help me?
edited: An example in in C \ C++ would also be fine for me.
Here is a draft of the solution. It should help someone to built a proper one with error handling / prettier code etc.
Thanks Remy for help and thanks for downvotes to my question. Keep them pouring! :)