Get rid of GetDC
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.
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.
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).
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement