Create Bitmap using GDI+ FromBitmapInfo() from IMediaDet::GetBitmapBits

Create Bitmap using GDI+ FromBitmapInfo() from IMediaDet::GetBitmapBits

Post by amupatk » Thu, 19 Oct 2006 15:54:21


I used GetBitmapBits() of IMediaDet. I got the bitmap buffer.
Now I created a Bitmap from this buffer. I tried painting this Bitmap
in a Graphics object using the DrawImage().
It draws the specified bitmap but with change in color.
Can you help me to correct colors?

My code:
HRESULT hr = (*pMediaDet)->GetBitmapBits (0, 0, pBuff,
pvih->bmiHeader.biWidth,
pvih->bmiHeader.biHeight);


if (SUCCEEDED (hr))
{
BITMAPINFO bi;
ZeroMemory (&bi, sizeof BITMAPINFO);
CopyMemory (&bi.bmiHeader, pBuff, sizeof BITMAPINFOHEADER);


Bitmap bitmap (&bi, pBuff);


graphics.SetCompositingMode (CompositingModeSourceCopy));
graphics.SetCompositingQuality (CompositingQualityHighQuality));
graphics.SetInterpolationMode(InterpolationModeHighQualityBicubic);
graphics.DrawImage(&bitmap, rVideo.left + 1, rVideo.top + 40 ,
rVideo.right,rVideo.bottom);
 
 
 

1. Create Bitmap using GDI+ FromBitmapInfo() from IMediaDet::GetBitmapBits

2. GDI+ Using FromBITMAPINFO to create a Bitmap

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

3. Reverse the Bitmap buffer extracted from IMediaDet GetBitmapBits funtion

4. Using IMediaDet GetBitmapBits in C#

5. the performance of IMediaDet::GetBitmapBits

6. IMediaDet::GetBitmapBits()

7. Creating a GDI+ Bitmap from an 8-bit Bitmap

8. Create and array of Bitmaps using GDI+

9. Create Bitmap, paint on that bitmap and then create form region like that bitmap

10. GDI+ question: Convert TBitmap to GDI+ Bitmap

11. GDI+ Bitmap drawing vs GDI+ PrintDocument drawing

12. how to use "new" to create a Bitmap or image in GDI+