Magnifier: An Interesting Discovery

I’ve been playing around with some of the accessibility and UI automation features in Windows Vista recently, with the view to writing a short article on the topic. En route, I came across a somewhat remarkable discovery (to me, at least).

I’m sure that most people are familiar with the Desktop Window Manager or DWM in Windows Vista (we’re recording an interview for Channel 9 with Greg Schechter, one of the architects, tomorrow). You’re probably aware that the role of the DWM is to composite the desktop based on in-memory buffers to which applications render themselves, as opposed to rendering directly to screen in previous Windows releases. Since the DWM controls desktop rendering, it can do clever things like showing those groovy Flip 3D effects when a user hits Win+Tab, automatically scaling windows for high-DPI displays, or displaying live thumbnails when a user hovers the mouse over a minimized window in the taskbar. Not everyone knows that the DWM does its dirty work through the unmanaged lower tiers of WPF, known as the Media Integration Layer or MIL.

Anyway, as I was saying, I was experimenting with some of the accessibility features in Windows Vista, specifically the Magnifier tool, which can be used by partially sighted users to zoom in on the area of the screen that the mouse is hovering over. Using this tool feels a little like viewing VGA 640×480 on a 24″ monitor – that is to say, the pixels are up to 16x their normal size. So it’s big, but it’s also blocky. But I just chanced to hover the mouse over a WPF application that I had running at the time, and… wow!

Here’s a screenshot so that you can see the effect (cropped, click the image to see a larger, lossless version).

In the lower window, I’m viewing a XAML sample that was created by converting the Yellowstone Map image from Adobe Illustrator using Mike Swanson’s XAML exporter tool for that application. In the upper window, I have Magnifier running at 4x normal resolution. But instead of just scaling each pixel to be a 4×4 pixel square, the DWM works in concert with WPF to actually scale the original canvas to its new size. So rather than simply magnifying the existing rendered bitmap, it actually uses every pixel so that the magnified view is actually four times more detailed than the original.

I showed this to one of my customers that builds large engineering displays, and the product manager was blown away – the ability to zoom in on one part of that display without affecting the overall screen was something he considered a “killer feature” for their application. And of course, you get it free with WPF.

If you want to try this out yourself, simply click the Start menu, type Magnifier in the search box and execute it; open a WPF application, and then hover the mouse over the application. Of course, you’ll need a Windows Vista machine with the DWM running (if you can’t see the Aero Glass experience, then the DWM isn’t running, and it won’t work). I should also caution that this feature is pretty buggy in the February CTP release of Windows Vista (the most current external release at the time of writing) – it works, but you probably need to toggle the DWM on and off after enabling Magnifier and before starting the WPF application.

Anyway, I thought this was cool, and nobody I’ve shown this to was expecting to see this, so I figured I’d share it with you too!

Comments (3)

  1. Moldavia says:

    Actually I’m not that surprised. Maybe because many months ago I tried a simple WPF sample app building its own magnifying glass using VisualBrush (of course…).

    Doing a quick search I found it in Windows SDK WPF samples subfolder GraphicsMM_BrushesUsingVisualBrush – works with 2006-Feb CTP.

    Anyway, thanks, nice to know Vista’s general purpose magnify tool can do independently.

  2. Kevin Daly says:

    This reminds me of something that surprised me when using the zoom feature of the Cider design surface yesterday (just on a Tablet PC, not running Vista) – except this relates to a bitmap, which I would have exected to appear blocky. It was a jpeg of the Mona Lisa that I was using to play around with the Image tag…so anyway, when I zoomed the designer the Image was magnified without any apparent blockiness at all.

    A very pleasant surprise, but it makes me wonder exactly what happens when you include bitmap image content in a WPF application (and whether it depends on the image format and degree of lossiness etc.).

  3. GreenReaper says:

    It’s a neat feature, indeed. I do find it rather sad that the Magnifier is the only app in Vista (other than the DWM and the .NET portion of Avalon) to make use of milcore. It seems like it could be useful in numerous other ways. Maybe in 2010. 🙂