In Delphi 7, I have to deal with pretty large 24bpp bitmaps (several 100 MB). Since I want to use the Graphcis32 library for further processing, they have to be converted to 32bpp (TBitmap32). The LoadFromFile method of TBitmap32, however, creates a temporary conventional TBitmap to load the original 24bpp bitmap which is then assigned to the TBitmap32 to do the required format conversion. Of course, memory load is roughly doubled by having two of these huge bitmaps in memory, and this can be fatal to my application.
What I am thinking of is a way to load the 24bpp bitmap into a preallocated buffer which is dimensioned such that the 32 bpp bitmap fits in. Then, starting from the buffer end, I want to move the RGB bytes to the offsets needed for 32bpp.
Is this possible? How can I load a bitmap into a preallocated buffer? Any idea?