On retrieving bits from a device context

Posted on 2004-11-24
Medium Priority
Last Modified: 2013-11-20
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:

VOID *pbitsBW;      
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?


Question by:PMH4514
1 Comment
LVL 48

Accepted Solution

AlexFM earned 320 total points
ID: 12672568
If memory bitmap is created using CreateDIBSection, use GetBitmapBits to extract bits from it.

Featured Post

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction: Displaying information on the statusbar.   Continuing from the third article about sudoku.   Open the project in visual studio. Status bar – let’s display the timestamp there.  We need to get the timestamp from the document s…
Ready to get certified? Check out some courses that help you prepare for third-party exams.
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
Are you ready to place your question in front of subject-matter experts for more timely responses? With the release of Priority Question, Premium Members, Team Accounts and Qualified Experts can now identify the emergent level of their issue, signal…
Suggested Courses
Course of the Month13 days, 23 hours left to enroll

809 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question