本文介绍了WPF图像,如何消除模糊?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有
我需要
XAML:
<Image Height="500"
MouseLeftButtonDown="image_MouseLeftButtonDown"
MouseRightButtonDown="image_MouseRightButtonDown"
Name="image"
Stretch="Fill"
Width="500" />`
C#:
wbmap = new WriteableBitmap(50, 50, 500, 500, PixelFormats.Indexed8, palette);
wbmap.WritePixels(new Int32Rect(0, 0, wbmap.PixelWidth, wbmap.PixelHeight), pixels, wbmap.PixelWidth * wbmap.Format.BitsPerPixel / 8, 0);
image.Source = wbmap;
推荐答案
正如tkerwin所述,更改 BitmapScalingMode 到您的XAML图像代码中的NearestNeighbor
:
As tkerwin mentioned, change the BitmapScalingMode to NearestNeighbor
in you XAML Image code:
RenderOptions.BitmapScalingMode="NearestNeighbor"
这篇关于WPF图像,如何消除模糊?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!