On retrieving bits from a device context
Posted on 2004-11-24
I have two bitmaps which are selected into memory device context's
I do an Alpha Blend:
AlphaBlend(dcComparisonMem, 0,0, m_Width, m_Height, dcImageMem, 0,0,m_Width, m_Height,m_bf);
I need to now pull the bits out of dcComparisonMem into a buffer:
BYTE* pData = new BYTE(3000000)
for further processing post alpha-blend (rather than immediately blitting it to the display)
I thought I had to do something like this:
HBITMAP hBlended = ::CreateDIBSection(dcComparisonMem, pbmInfo, DIB_RGB_COLORS, &pbitsBW, NULL, NULL);
int iGetCount = ::GetDIBits(dcComparisonMem, hBlended, 0, m_Height, pData, pbmInfo, DIB_RGB_COLORS);
but iGetCount is only then equal to 1000 and my pData buffer doesn't hold the right data.
How do I retrived the bits into pData out of the DC to which the AlphaBlend method blended the two?