Sign in to follow this  
biowarrior

Copy the contents of DC to an array

Recommended Posts

biowarrior    127
It's looks simple, but I would like to hear better solutions. How can I copy the contents of an handle to memory device context to an array? I would like to transfer the data (pixels) from an off-screen buffer to an array, anyone know how to do that? BitBlt(/* my array here??? */, 0, 0, chartWidth, chartHeight, hdcMem, 0, 0, SRCCOPY); The original code is to transfer from one device context (memory off-screen) to a screen device context, but instead, I want to transfer to an array, how can I do that? Thanks!

Share this post


Link to post
Share on other sites
doynax    850
Try GetDIBits.
Of course you'll also have to figure out which format you want it in and create a BITMAPINFO structure desribing it.
Alternatively you could create the source bitmap with CreateDIBSection to get direct access to it's internal buffer.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this