Advertisement

Get rid of GetDC

Started by October 31, 2001 04:51 PM
4 comments, last by kmsixpence 23 years ago
I''ve been wanting to get the color of the positon of which the mouse is on with DirectX7. I have it on a directdraw surface and I''ve been using GetDC and ReleaseDC with the surface along with GetPixel to find the pixel color. I was wondering if there''s anyother way to do it. Maybe by locking the surface or something because I know this isn''t very fast.
Please, anyone? I really need to know this fast.
Advertisement
Don''t know much detail about how directdraw surfaces work.

If it were a bimap, maybe get the x,y pos of the mouse and the width,height of your surface. Use those to calculate an offset then get the information from the buffer where the bitmap data is stored.
But thats my whole question, how do i get it from the buffer or whatever it is stored.
Lock the surface with ->Lock() and then just read the byte (or bytes if more than 8 bpp).
Ahhh, but thats the problem, how do i read the bytes...

This topic is closed to new replies.

Advertisement