Link to home
Start Free TrialLog in
Avatar of Christian de Bellefeuille
Christian de BellefeuilleFlag for Canada

asked on

Screen Capture & Manipulation, what's the best method/performance?

I've coded an application using GDI to do screen capture using BitBlt.

In my application, i'm doing theses operations:
Desktop Screen Capture
Masking using Regions to hide some part of the capture
Image comparisons to see if there's any changes
"DownScale" the images if desired (from 32 bits down to 8 bits palette)
Sending the image over network stream

I would like to know if there's better alternative than GDI for all these operations?
(I know there's DirectX, GDI+, but i don't know anything about their performance)

If you have any sample of codes, it would be appreciated.

(Our application should be able to run on older systems, not only Windows 7 & Vista)

Thanks for your help
ASKER CERTIFIED SOLUTION
Avatar of jgordos
jgordos
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Christian de Bellefeuille

ASKER

and you don't want to use anything like DirectX

It's not that we don't want to use, it's that we don't have much experience with DirectX, and there must be someone on this planet who already tried to do Desktop Capture with DirectX.

Apparently, DirectX is not the best thing to accomplish this task according to your article
No, it *can* be.

It's just that if you need to support everything since Win95, then you're going to be in DLL hell with DirectX.

I like DirectX just fine.   It's easy to use, and a nice, full featured API.

But when you get down to it, it's not doing much more than you're doing with GDI in this instance.

And, when I say the old ways are "slow", I'm still talking about sub-second times to complete.

Are you capturing/transmitting the bitmaps in real-time?

-john
Yes we do capture & transmit parts of the bitmap in real-time.  (We check for part of it that changed.  We do not transmit the whole 1920x1200 bitmap).  And sometime, if the bandwidth is too low, we downscale the image to 8 bits image instead of 32 bits.
So you're transmitting the "dirty bits" in real-time?

ie, 60 or 72 hz?

Which versions of windows do you need to support?

I didn't realize you had a real-time component to it, or that your resolutions were that large.

I don't believe any of the older GDI systems I was thinking of (win95,win98) will support resolutions that large, but I haven't run those OSes in quite some time.

I think the approach I would take...

Check to see if directx is installed already.  if it's available, go ahead and use the DirectX methods (they're in Direct3d now-a-days; Direct2d is an obsolete spec, but might be still available).   WinXP was the first windows OS to ship with DirectX included.

If DirectX is not available, gracefully downgrade the code to the GDI section.

Again, the only part that would need to be done would be grabbing the latest bitmap...

Hope this helps,
-john
Well, if "Real Time" mean 60-72 hz, we are bellow that.  We plan to send 3-4 images per second.  

We want to support down to Windows XP SP3.

At the moment with GDI, we are able to grab an image every 50 ms if my memory is correct.  This doesn't include image comparison and usage of regions.

Let me do some test with DirectX, i'll advise you to see the result.  It might take sometime since we need to get used to DX to learn how every operations need to be done.

Thanks for the link you provided
SOLUTION
Avatar of ambience
ambience
Flag of Pakistan image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
I don't think capturing screen will have a huge impact on the performance.   But what i wanted to know is if DirectX offer set of functions to compare images to determine what changes, and if it deal correctly with Regions because our application is a bit heavy on Regions because we build up a mask from the applications that we want and don't want to show on the screen.  When you consider an application juste like "One Window", it's simple, but it's not like this that Windows is built.  Even a tooltip have it's own window.

I could use CBT to detect changes of size and stuff like that, but that's not really interresting.

Compression work good at the moment.  We might tweek it to compress a little more, but in term of speed that's good.

Thanks for the help & hints you have provided!  I really appreciate!