Click here to Skip to main content
15,886,110 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Using SetBitmapBits is confusing me. Is its sole purpose to transfer my array of pixel info to a buffer owned by the handle "HBITMAP" ?

Is there a way to know where this buffer is located and write to it directly?

Seems like a waste of time to draw on your own array and then perform a huge array copy by calling SetBitmapBits(HBITMAP, size, source[])

Or am I out of my mind and there's something I'm missing about all this? (It's happened before...)

I have looked everywhere for what SetBitmapBits/GetBitmapBits actually do and have found nothing other than the fact you must call them. (Or their newer counterparts SetDIBits/GetDIBits: but these seem they should be even slower.)

Thanks in advance!
Posted

1 solution

GDI object's internal data don't belong to your process but to the GDI subsystem. You cannot read/write to them directly because there is a "process boundary" in between (they can even be on another machine!).

The memory itself can be moved around by the GDI functions, without your program even notice. It would be quite hard to give you a memory address to that.
 
Share this answer
 
Comments
Bob Namenottaken 11-Jul-11 8:38am    
Thank you. I understand that - I just don't like the idea of wasting the time with the copy. But I'm ok if "that's the way it is". I was just wondering if experienced programmers had a tcehnique to avoid the copy.
Emilio Garavaglia 11-Jul-11 10:25am    
unfortunately, it is not a matter of experience. Simply, the system is not designed to work that way.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900