d3d screenshots -> returning RGB values and coordinates ?

Just starting out? Need help? Post your questions and find answers here.
K.puts
New User
New User
Posts: 6
Joined: Tue Sep 12, 2006 9:23 pm

d3d screenshots -> returning RGB values and coordinates ?

Post by K.puts »

hello,
i found code in this forum to make screenshots with d3d engine,
thank u very much for that !

is it possible to return the rgb values and x,y, coordinates from the captured image (in an array?), before saving as image.

this is the code :

Code: Select all

If d3d\CreateDevice(#D3DADAPTER_DEFAULT, #D3DDEVTYPE_HAL, hWnd, #D3DCREATE_SOFTWARE_VERTEXPROCESSING , @d3dpp, @d3dDevice.IDirect3DDevice8) = #D3D_OK
  If d3dDevice\CreateImageSurface(ddm\Width, ddm\Height, #D3DFMT_A8R8G8B8, @surface.IDirect3DSurface8) = #D3D_OK
    If d3dDevice\GetFrontBuffer(surface) = #D3D_OK
      
;-
  If D3DXSaveSurfaceToFileA("c:\filename.bmp", #D3DXIFF_BMP, surface, #Null, #Null) = #D3D_OK
        Debug "screenshot saved!"
;- 

     EndIf
    EndIf
  EndIf
EndIf 
traumatic
PureBasic Expert
PureBasic Expert
Posts: 1661
Joined: Sun Apr 27, 2003 4:41 pm
Location: Germany
Contact:

Re: d3d screenshots -> returning RGB values and coordinat

Post by traumatic »

K.puts wrote:thank u very much for that !
You're welcome! ;)

Why not try using D3DXSaveSurfaceToFileInMemory() ?

The D3DXBUFFER the image is being saved to contains the method GetBufferPointer()
which should give you the entire image as a BMP. It's fairly easy to retrieve the needed
rgb values from that.
Good programmers don't comment their code. It was hard to write, should be hard to read.
K.puts
New User
New User
Posts: 6
Joined: Tue Sep 12, 2006 9:23 pm

Post by K.puts »

Hi,
wonderful, thanx for this information, i will see to get some infos about how the bits are sorted in memory after using this function - to handle them correct.

i am new in this stuff, i just wanted to prog a little color-choose and color-search tool and used getpixel_(), but it was aweful slow :-)

i have searched several pure,vb, directx and c forums for code examples last days (bitblts, getdibits,...), my head's burning, but now i give it a new try
:twisted:

cya

Edit: I'm coming from germany, too, berlin ->Grüss Dich :)
traumatic
PureBasic Expert
PureBasic Expert
Posts: 1661
Joined: Sun Apr 27, 2003 4:41 pm
Location: Germany
Contact:

Post by traumatic »

K.puts wrote:Edit: I'm coming from germany, too, berlin ->Grüss Dich :)
Ik glob ik tille, wa ;)

Welcome to the forums, have fun exploring the breathtaking world of DX. :)
Good programmers don't comment their code. It was hard to write, should be hard to read.
Post Reply