6

I have developed a GUI for a random application using WPF. I have a bunch of out of box WPF controls laid on the application window. I haven't customized anything, didn't use bitmaps, etc.

When running my application and zooming using Magnifier application in Windows 7 (Win key + Plus key, the magnified GUI is showing pixels.I am probably wrong, because I can't explain it otherwise, but isn't WPF supposed to provide vector like control rendering?

Thanks for participating in the discussion.

Bonus Reading

Ian Boyd
  • 246,734
  • 253
  • 869
  • 1,219
Boris
  • 9,986
  • 34
  • 110
  • 147

4 Answers4

19

Back when Vista first shipped, and when WPF was on version 3.0, zooming with the built-in magnifier would actually do vector-based scaling.

This stopped working when WPF 3.5 service pack 1 shipped. (It worked in 3.5 before sp1.) The reason it worked before then is that the DWM (Desktop Window Manager) - the part of Windows responsible for presenting everything you see on screen - uses MILCORE.DLL to do its rendering. Version 3.0 and 3.5 of WPF also used this same component to render - this meant that all WPF content was native content, so to speak. (In fact, on Windows XP, which doesn't have the DWM, MILCORE.DLL is something that WPF puts on your system for its own benefit. But it's built into Vista and Windows 7.) When WPF was using MILCORE.DLL to render on Vista, any effects applied by the DWM such as scaling would also apply in the way you want to WPF - it really did scale without pixelating.

Unfortunately, this is no longer the case. And the reason is that WPF started adding new rendering features. In 3.5 sp1, the new feature in question was support for custom pixel shaders. To enable that, Microsoft had to release an update to the MIL. (The Media Integration Layer - the bit that does the actual rendering.) However, they weren't really in a position to update MILCORE.DLL, because that's part of Windows - it's how everything you see on screen gets to be on screen. Releasing a new version of MILCORE.DLL effectively means pushing out an update to Windows. The release schedule for Windows is independent of that for .NET, and so the only way the WPF team could reasonably add new features was to ship a new MIL. (In theory they could have done it via Windows Update, but since WPF is now owned by a different division of Microsoft than Windows, that sort of thing doesn't seem to happen in practice.)

As of .NET 3.5 sp1, the MIL is in a different DLL called wpf_gfx_vXXXX.dll where vXXXX is the version number. In .NET 4.0, it's wpf_gfx_v0400.dll.

The upside is that WPF gets to add new rendering features with each new version, without needing Windows itself to be updated. The downside is that WPF's rendering is no longer as tightly integrated with Windows as it was briefly back when Vista shipped. And the upshot is, as you've seen, that magnifying is not as much fun as it used to be.

Ian Griffiths
  • 14,302
  • 2
  • 64
  • 88
  • 1
    Wow, such a complete answer! Well done and thanks for the clarification! – Boris Nov 29 '10 at 12:33
  • 1
    A very thorough answer, +1! And what a damn shame, that was an amazing feature and I thought we were only 5 minutes away from being able to change zoom separately for each window on the OS level and without the blur... oh well, one can dream. – Roman Starkov Mar 22 '15 at 12:14
  • I actually got here from one of Mr. Griffiths' Pluralsight videos in which he demonstrated the magnifier back on Vista, and saw it didn't work for me on Windows 10 - just to find an update by Ian himself on StackOverflow - nice! – Ray Oct 09 '17 at 13:09
  • 1
    Glad to be of service! – Ian Griffiths Oct 13 '17 at 15:07
3

The magnifier application implements its own zoomed image rendering, so that's why you are seeing pixels. WPF does use vector graphics, but in this situation it's not the WPF application itself that is rendering the zoomed image.

If you use something like Snoop you can see zoomed and scaled WPF vector graphics rendering in action.

Tim Lloyd
  • 37,954
  • 10
  • 100
  • 130
  • Thank you for your answer. Would you agree that it is a bit silly on Microsoft's side to develop a Magnifier application in such manner, while promoting and pushing its own new UI rendering paradigm (WPF) and boasting off that Windows Vista and Windows 7 UIs are developed using the very one at the same time? – Boris Nov 27 '10 at 14:24
  • @Boris It is unfortunate that the magnifier application cannot handle WPF specially. It certainly looks feasible given that Snoop does something similar, although it only zooms a single application. I would say though, that WPF is minimally used in the UIs of Windows Vista and Windows 7 OSs. – Tim Lloyd Nov 27 '10 at 14:28
  • @chibacity How right you are. Well, personally I think it's a shame. I think WPF is great and I know how Microsoft is tedious with its in-house policies; thus, it just doesn't make sense to me not to embrace something quite progressive as WPF. – Boris Nov 27 '10 at 14:35
  • Everyone, feel free to post your thoughts on the topic here in the comments. I would like to hear the thoughts from the developers perspective, especially those who are close with the UI development: In your opinion, is WPF the way to go? I for one vote yes. – Boris Nov 27 '10 at 14:36
  • @Boris I would suggest starting a new question for that purpose. However, it will be difficult to ask it in a way that won't be closed quite quickly. – Tim Lloyd Nov 27 '10 at 14:38
  • @chibacity That's why I am running this little underground operation of mine here ;) Just kidding, thanks for all your comments. – Boris Nov 28 '10 at 08:48
0

I suppose, Windows 7 magnifier takes a snapshot of actual application on-screen UI, and then magnifies it itself (not making a special case for WPF applications). Of course what it can access is just the pixels, not the vector graphics which works behind the scene.

Vlad
  • 35,022
  • 6
  • 77
  • 199
-1

The Windows-7-Magnifier is pixel based, but there is a difference in magnifier mode depending on wether an Aero-theme is active or not.

  • with Areo theme the zoom is pixelated.
  • without Areo theme the zoom is smoothed (blurry).

Only with Areo theme other Views (except "Docked") are selectable.

Joachim
  • 891
  • 9
  • 12