2

Does anyone know how to apply effects to the entire screen, in c# or any programming language. I'm mostly interested in making the screen monochrome (specifically green-white instead of black white).

I know a cross-graphic card solution is possible because I found a program that can do it: http://www.freedomscientific.com/products/lv/magic-bl-product-page.asp

Anyone knows how to accomplish something this or where to look?

Thanks !!

animuson
  • 53,861
  • 28
  • 137
  • 147
Dyte
  • 259
  • 3
  • 13
  • 1
    What makes you think that the software you linked to is *cross-platform*? All I can see is references to various Windows versions. – thkala Jan 27 '11 at 20:17
  • 1
    I stand corrected. I meant that it works on different versions of windows, cross platform was very poorly formulated. – Dyte Jan 27 '11 at 20:36
  • 1
    You may need to create a Driver or apply `Wide System Hooks`... It won't be simple specially with managed code. – fardjad Jan 27 '11 at 23:27
  • Wide System Hooks, pretty interesting subject. I'm going to investigate in that. – Dyte Jan 28 '11 at 09:41

2 Answers2

2

To help people in the future who are interested in this:

This is possible with the Magnification API's color effect method. This allows one to use a matrix that can be applied to the whole screen.

NegativeScreen is an open source project that implements the feature you are describing in C#.

Unfortunately, this only works with affine transformations, as the API takes only an augmented matrices rather than a delegate or something.

Michael Tang
  • 4,686
  • 5
  • 25
  • 24
2

There is no easy Windows API to modify the entire screen contents. But this could be done at the device driver level.

Otherwise you have to resort to some Windows API tricks: place a "fake" window over the entire desktop, in a loop: grab the entire screen contents without grabbing fake window contents, do your processing to get the monochrome effect, then display that on the fake window. Yes, it's hacky and slow, but possible. Even more hacky, when you get mouse clicks to "go through" the fake window (lots of SetWindowsRgn calls).

So cross-platform here means using GDI, though some older DirectDraw APIs might work, in that case, you have a much easier time with hardware overlays (and better performance). Though I'm not sure how many cards actually support hardware overlays, and if newer versions of windows support the older DirectDraw APIs.

One more possibility is if the video card has a C# or C++ or C API, then you can do whatever you want with the card without writing device driver code.

Then there's CUDA, but I haven't yet tried that out. I know it's for stream processing on nVidia boards, but I wonder if it could get you an easy backdoor into the video display stuff.

Chris O
  • 5,017
  • 3
  • 35
  • 42
  • The device driver level you say. Could you point me to where I can find more information about interacting with that? Yeah I was also considering the "fake window" solution, but since there's no straightforward way to take a screenshot "underneath" the active window, I would have to use a loop in which I hide the active window, take the shot, and show it again, which would cause a horrible flicker. Thanks for the other suggestions and brainstorming! – Dyte Jan 28 '11 at 10:00
  • I've never written a device driver, so I can't give you any real advice on that. For the flickering "fake" window, there's a GDI trick, the fake window has 99% opacity, then you use BitBlt (basic screen capture) without the CAPTUREBLT flag. This causes the screen capture to miss any window with transparency. Good for missing the fake window, bad for missing real window contents. – Chris O Jan 28 '11 at 13:53
  • I heard about this workaround. But does this also work on Windows 7? Because after all, it's not really that way by design? – Dyte Jan 28 '11 at 15:11
  • Yes, each of the smaller tricks are in fact part of the official windows API, but stringing them all together for this particular feature feels hacky, since what you really want for this feature is to have a nice, friendly, reliable, performant API to modify the screen contents as needed, without having to write a driver. – Chris O Feb 01 '11 at 15:01
  • With these small tricks work in Vista/Win7? Probably, but I would bet they have some quirky behavior or perhaps additional performance problems because of DWM. One thing to try is the "magnifier" feature in Microsoft IntelliPoint software, free but requires a MS-brand mouse. On Vista/Win7, this magnifier definitely has some drawing problems, but only on some systems. – Chris O Feb 01 '11 at 15:02