Eug*_*nko 13 wpf image-processing wpf-controls
我有 
我需要 
XAML:
<Image Height="500"
MouseLeftButtonDown="image_MouseLeftButtonDown"
MouseRightButtonDown="image_MouseRightButtonDown"
Name="image"
Stretch="Fill"
Width="500" />`
Run Code Online (Sandbox Code Playgroud)
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;
Run Code Online (Sandbox Code Playgroud)
SwD*_*n81 25
作为tkerwin提到的,改变BitmapScalingMode给NearestNeighbor你XAML代码的图像:
RenderOptions.BitmapScalingMode="NearestNeighbor"
Run Code Online (Sandbox Code Playgroud)
tke*_*win 15
也许您需要将位图缩放模式更改为最近邻居.
添加RenderOptions.BitmapScalingMode="NearestNeighbor"到您的图片代码.