locked
Does WPF 4.0 default to lower-quality scaling algorithm? RRS feed

  • Question

  • I installed VS 2010 B2 onto a Virtual PC and recompiled my application.  Now it is using low-quality scaling for the images.  Has the default on WPF 4.0 changed?  Or is it doing this because of the Virtual PC's video capabilities?
    Tuesday, October 20, 2009 7:40 PM

Answers

  • Aha!  "The default RenderOptions.BitmapScalingMode (Unspecified) is now Linear instead of Fant. If you still want Fant, you can re-enable it."

    http://blogs.msdn.com/wpf3d/archive/2009/06/24/what-s-new-in-graphics-for-4-0-beta-1.aspx

    Does anyone know if this can be changed system-wide?  For my app, I added:
       xmlns:Media="clr-namespace:System.Windows.Media;assembly=PresentationCore"
       Media:RenderOptions.BitmapScalingMode="Fant"
    to the main Window and that seems to be working... oohh... but will that work for child windows... hmmm...
    • Marked as answer by Moby Disk Tuesday, October 20, 2009 9:20 PM
    Tuesday, October 20, 2009 9:20 PM

All replies

  • Aha!  "The default RenderOptions.BitmapScalingMode (Unspecified) is now Linear instead of Fant. If you still want Fant, you can re-enable it."

    http://blogs.msdn.com/wpf3d/archive/2009/06/24/what-s-new-in-graphics-for-4-0-beta-1.aspx

    Does anyone know if this can be changed system-wide?  For my app, I added:
       xmlns:Media="clr-namespace:System.Windows.Media;assembly=PresentationCore"
       Media:RenderOptions.BitmapScalingMode="Fant"
    to the main Window and that seems to be working... oohh... but will that work for child windows... hmmm...
    • Marked as answer by Moby Disk Tuesday, October 20, 2009 9:20 PM
    Tuesday, October 20, 2009 9:20 PM
  • As the blog describes we did change the default behavior. The main reason for the change was for performance because the Fant scaler is much more CPU intensive than bilinear filtering alone (bilinear is entirly handled by the GPU). The change was motivated by various customers who ran into perf problems due to the Fant scaler, but were not able to discover the underlying cause or how to change to a lower quality, but faster filtering mode.

    Unfortunately, we did not add a global way to reset the default back to Fant. Adding the ability to change the global default is a great suggestion and something we should consider for future releases. In the meantime, you could derive from the Window class to override the default behavior. Same for Popups  - note that for Popups you need to set the scaling mode on the Popup child since the Popup element is in the parent's window element tree.

    Wednesday, October 21, 2009 7:18 AM
  • This doesn't really help though in code that doesn't have any concept of a Window. Take for example a console app or Windows Service which pre-processes images. Is there no solution for fixing that case?

    It seems pretty arbitrary to change it to a lower quality because people weren't able to figure out how to change it. Now the rest of us have to figure out how to change it back. It seems the real problem is the inability to set this property directly.

    Thursday, June 3, 2010 11:12 PM
  • The problem is that setting the RenderOptions.BitmapScalingMode="HighQuality" does not work for all cases. For example the application icon that is shown in the task bar now is all jagged and ugly looking since moving to .NET 4.0. How do you propose we set that rendering back to HighQuality?
    Saturday, December 11, 2010 9:43 AM