Capture screen with bitblt is too slow

Apr 22, 2015 at 11:31am
My code used GetDC(0) to get the Desktop DC and GetDIBSection & BitBlt to get RGB pixel array.

Actually it would work well for a single screenshot , but when i need to capture the frame by frame in real-time , it seems to be going slower.

Is there other API that i could capture screenshot fast (I only want to capture the desktop screenshot instead of in a game .)
Apr 23, 2015 at 10:58am
I think you want to use a combination of Windows Imaging Component(WIC) and Direct2D. You can initialize a WIC bitmap from various sources (memory buffer, HBITMAP, image file) and access its pixels with bitmap->CopyPixels(). Direct2D is a hardware-accelerated 2D rendering API and it's much MUCH better and faster than GDI.
Apr 23, 2015 at 12:47pm
lol thanks for reply , so ...with direct2D I can get the pixels of DC(Device Context) too?
Apr 23, 2015 at 12:59pm
Yes, it is made to interoperate with GDI. It is essentially the modern replacement for GDI. Just a bit more difficult to learn but there are plenty of examples and documentation on MSDN.

Actually, scratch that. I don't believe Direct2D gives access to bitmap pixel data, but WIC bitmaps do. Direct2D allows you to create D2D bitmaps from WIC bitmaps for rendering.
Last edited on Apr 23, 2015 at 1:01pm
Apr 23, 2015 at 2:41pm
thanks again dude, I think I shall start to learn WIC and direct2D now.
Last edited on Apr 23, 2015 at 2:49pm
Topic archived. No new replies allowed.