GDI+ Using FromBITMAPINFO to create a Bitmap

GDI+ Using FromBITMAPINFO to create a Bitmap

Post by izk » Fri, 02 Jul 2004 21:33:52


When using the FromBITMAPINFO option to create a Bitmap, does GDI+
make a copy of the gdiBitmapInfo and gdiBitmapData buffers?
I assumed that GDI+ makes a copy of the memory when it creates the
bitmap, but if I free the memory after the Bitmap is created, it
crashes later when the Bitmap is used. Will GDI+ free the memory when
the Bitmap gets deleted, or do I have to free it myself ?

yitz
 
 
 

GDI+ Using FromBITMAPINFO to create a Bitmap

Post by Kousay Ala » Sat, 03 Jul 2004 05:19:03

Not exactly sure about FromBITMAPINFO.
However the Bitmap::Bitmap(..., BYTE* scan0) MSDN documentation states that:
"The caller is responsible for allocating and freeing the block of memory
pointed to by this parameter."
I presume FromBITMAPINFO will eventually call this constructor and the
behavior is the same.

Hope this helps
Kousay Alani
http://www.yqcomputer.com/