Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Capturing data from a bitmap in OnDraw in MFC 1

Status
Not open for further replies.

knighthead

Programmer
Aug 1, 2001
2
US
I have been able to get data out of a bitmap in an MFC OnDraw method if I use the GetPixel method. This approach is, however, too slow.

Does anyone know how to get a pointer to the current
bitmap so that the data could be copied. I have
tried various things that seem should work but cannot
get the data. All a seem to get is a null pointer
to the bitmap.
 
you could create a window with null background. When it shows, it will contain all pixels. So, get its DC and BitBlt/StrechBlt the bitmap. John Fill
1c.bmp


ivfmd@mail.md
 
Are you suggesting to create another window and BitBlt the data to the new window? Why would that help, I can't get the data from the current window, what would be different about the new one.

I have tried two things:
1- Creating a memory DC and BitBlt to it.
2- Doing a GetCurrentBitmap on the DC provided in the OnDraw method.

I have been unable to get any bitmap data either way.
The only thing that works is sampling each bit using the GetPixel method of the DC.

It may be that the techniques I have tried should work but some detail in my syntax is incorrect. If I could see an example of saving a bitmap (perhaps to a file) I'm sure it would give me my answer.

 
No, you should create a bitmap and get data from thats window DC in it, or just transfer data rfom one DC to other DC without creating memory DC. I'll try to do it myself and will put my code. John Fill
1c.bmp


ivfmd@mail.md
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top