Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/image/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Image 如何使用WriteableBitmapExtension库模糊图像?_Image_Windows 8_Windows Runtime_Microsoft Metro_Winrt Xaml - Fatal编程技术网

Image 如何使用WriteableBitmapExtension库模糊图像?

Image 如何使用WriteableBitmapExtension库模糊图像?,image,windows-8,windows-runtime,microsoft-metro,winrt-xaml,Image,Windows 8,Windows Runtime,Microsoft Metro,Winrt Xaml,这没有给我任何结果。代码怎么了 var-ImgFile=wait-Windows.Storage.StorageFile.getfilefromApplicationUrisync(新Uri(“ms”)-appx:///Assets/search.png")); var wb=新的可写比特图(1,1); 使用(var strm=await ImgFile.OpenReadAsync()) { wb.SetSource(strm); } var wb2=新的可写比图(wb.PixelWidth,w

这没有给我任何结果。代码怎么了

var-ImgFile=wait-Windows.Storage.StorageFile.getfilefromApplicationUrisync(新Uri(“ms”)-appx:///Assets/search.png"));
var wb=新的可写比特图(1,1);
使用(var strm=await ImgFile.OpenReadAsync())
{
wb.SetSource(strm);
}
var wb2=新的可写比图(wb.PixelWidth,wb.PixelHeight);
var wb3=writeablebitmappextensions.convolume(wb2,writeablebitmappextensions.KernelGaussianBlur5x5);
PageBackground.Source=wb3;
您正在将图像加载到wb图像中,但您没有使用它来模糊(相反,您只是模糊空的wb2)。 这应该起作用:

var-ImgFile=wait-Windows.Storage.StorageFile.getfilefromApplicationUrisync(新Uri(“ms”)-appx:///Assets/search.png"));
var wb=新的可写比特图(1,1);
使用(var strm=await ImgFile.OpenReadAsync())
{
wb=等待wb.FromStream(strm);
}
var wb3=writeablebitmappextensions.convolume(wb,writeablebitmappextensions.KernelGaussianBlur5x5);
PageBackground.Source=wb3;

Getting
System.AccessViolationException-试图读取或写入受保护内存。这通常表示其他内存已损坏。
我刚刚尝试了该代码,如果在SetSource之后添加断点,您将注意到WriteableBitmap尚未加载(像素数已设置,但缓冲区尚未填充),作为一种解决方法,使用wb=wait wb.FromStream(strm);似乎有效。否则,您也可以将流加载到内存中,并在SetSource中使用MemoryStream进行设置,它也应该可以工作。