Not logged in, Join Here! or Log In Below:  
 
News Articles Search    
 

 Home / General Programming / Obtaining device context handle (DC) of a surface Account Manager
 
Archive Notice: This thread is old and no longer active. It is here for reference purposes. This thread was created on an older version of the flipcode forums, before the site closed in 2005. Please keep that in mind as you view this thread, as many of the topics and opinions may be outdated.
 
itzfaraz

February 19, 2005, 11:31 AM

Hello

I use DX 8.1 on VB6. I believe there is a function in the Surface9 object in DirectX 9 called GetDC with which we can get the DC of the surface.

Is there a way to find out the DC of the surface object for DX 8.1 ?

I want to know this because I want to know the color of the graphic which is underneath the mouse pointer. I can use the GetPixel API for the front buffer by providing the hDC of the main window, but I have an offscreen buffer here and I want to read the color from a given (x,y) position.

Faraz Azhar

 
juhnu

February 20, 2005, 07:17 PM

you can't get a DC for the DX8 surface (and in dx9 it's only supported for 24-bit format so it has only very limited uses). But you don't really need it. You can lock the buffer IDirect3DSurface8::Lock()/Unlock() and read pixel value from the buffer Lock() returned to you.


juhani






 
itzfaraz

February 21, 2005, 01:30 PM

Ok thanks.. but I heard locking and unlocking is a "VERY" slow process and should be avoided. Is that true?

 
Gerald Knizia (cgk)

February 23, 2005, 11:54 AM

Yes, that is true. Locking a backbuffer is very slow. But getting a DC would most probably be equally bad, even if it worked.

 
This thread contains 4 messages.
 
 
Hosting by Solid Eight Studios, maker of PhotoTangler Collage Maker.