Image control - placed into Viewbox. For automatic scaling when the window size changes. Everything works perfect.
Is it possible to change the type of interpolation in my case? For example select Bicubic or Bilinear. Or for automatic scaling of such a choice is not available?
BitmapImage bmp=new BitmapImage(new Uri("c:/temp/1.jpg"));
ImageSource pic = bmp;
Viewbox vb = new Viewbox();
vb.Stretch = Stretch.UniformToFill;
vb.StretchDirection = StretchDirection.DownOnly;
Image img=new Image();
img.Source = pic;
vb.Child = img;
As far as I know you can't specify bicubic or bilinear interpolation for a bitmap in WPF, (the default is linear) but you can set RenderOptions.BitmapScalingMode
option to get better control of the display quality of the scaled bitmap. For example:
RenderOptions.BitmapScalingMode="NearestNeighbor"
or RenderOptions.BitmapScalingMode="HighQuality"
There's more info on each of the scaling modes on MSDN http://msdn.microsoft.com/en-us/library/system.windows.media.bitmapscalingmode
If you still have issues with blurry graphics try setting UseLayoutRounding="True"
in your root element. This will disable sub-pixel positioning of elements that can can cause jagged lines in WPF applications