hi how can i use directdraw to get the screen picture ?
Posted on 2001-02-24 14:17:00 by eko
You could use the win32 api. 1)Use CreateCompatibleDc function to create a device context. 2)Use CreateCompatibleBitmap function to generate a bitmap. 3)Use SelectObject Function to assign the bitmap to the device context. 4)Use Deleteobject function to destroy the bitmap(not the dc!) Now that you have a Device Context 1)Use the GetWindowDc function to get the device context of the window. 2)Now that you have the device context to the window use bitblt function to copy the dc of your window to the dc you created before. 3)Use the GetBitmapBits Function to load the picture data into an array. 4)Then use native assembly to save it to a file 5)Then use the unloadDc function to free the dc(do this or you will get memory leaks!) Whats cool about this method is that you can manipulate the data quickly in your array and use another function called SetBitmapBits to add your own effects such as graying,brightness,etc. Then when you want to save it as a file you can make your own formats, add compression, and such. If this does not help then try these sites, www.vbexplorer.com/game_tutorials.asp <-- Good Api Tutorials www.vbexplorer.com/directx4vb <-- 100 Direct X Tutorials www.chez.com/scribe/en/assembly.htm <-- Mixes DirectX 8 and Asm Hope my ramblings helped :)
Posted on 2001-02-24 22:51:00 by JDog
If you are sure that want to use DirectDraw... Initialize DirectDraw to non full screen non exclusive Make a IDirecdraw::Surface (big enough and in system memory) call GetDC method on that surface Use GDI BitBlit to copy screeen to that surface then Release DC... now you can Lock() and do whatever you want with the pixels.. save them to disk...(as TGA or PCX i assume) etc then UNLock() the surface.. Then release surface and IDirectDraw objects Now please tell me WHY?
Posted on 2001-02-25 01:21:00 by BogdanOntanu
hi thanks for your answers i just want the fastest way that there is to get the screen picture,and the fastest way there is the getpixel and setpixel cuz i know set/getpixel are very very slow function. so if any 1 have faster function, please give me example and help about it or place on the net that i can get help about it
Posted on 2001-02-25 10:16:00 by eko
When you have your dc loaded with your picture data, use the GetBitmapBits function. It fills an array with picture data. Then you can manipulate the data and then set it back in the dc with the SetBimapBits function.Fastest you can get with the windows gdi. Read the 3 graphics tutorials at, Explains the Windows GDI and How to use them in games. >www.vbexplorer.com/game_tutorials.asp You can use DirectX To access the surface memory, but that could easily crash your system if you don't know what your doing. Go to this site to learn how to access the surface memory. >www.ancientcode.f2s.com/Tut_DD_Mem.html
Posted on 2001-02-25 14:53:00 by JDog