简体   繁体   English

模糊效果:Silverlight Windows Phone 8.1

[英]Blur Effect : Silverlight Windows Phone 8.1

I am writing windows phone 8.1 silverlight app, 我正在编写Windows Phone 8.1 Silverlight应用程序,

I have a Stackpanel in my XAML page, I want to create its background "Blur". 我的XAML页面中有一个Stackpanel,我想创建其背景“ Blur”。

Is there any way to do it? 有什么办法吗?

There is no easy way to apply effects such as blur to elements. 没有简单的方法可以将诸如模糊之类的效果应用于元素。 More typical would be to dim them by placing a partially transparent rectangle over the disabled element. 更典型的是通过在禁用元素上放置一个部分透明的矩形来使它们变暗。

If you really want blur you would need to render the element to a bitmap, but the bitmap contents, and then place that image over the original element. 如果确实要模糊,则需要将元素渲染为位图,但要渲染位图的内容,然后将该图像放在原始元素上。

If you have an image as background you could add the blurred effect by modifying the image before setting it as background. 如果您有图像作为背景,则可以通过在设置为背景之前修改图像来添加模糊效果。 There's multiple libraries that allow you do to this eg. 有多个库可以帮助您做到这一点,例如。 Win2D and Lumia Imaging SDK 2.0. Win2D和Lumia Imaging SDK 2.0。 They are both fairly simple to work with and have pro's and con's. 它们都非常易于使用,并且具有优缺点。

Nokia Imaging SDK allows you to work directly with bitmaps / writeablebitmaps while Win2D has a more smooth blur rendering. 诺基亚影像SDK使您可以直接使用位图/可写位图,而Win2D具有更平滑的模糊渲染。 Here's a guide to how you can implement and work with both: http://www.blendrocks.com/code-blend/2015/1/29/implementing-image-blur-in-a-windows-universal-app 这是有关如何实现和使用两者的指南: http : //www.blendrocks.com/code-blend/2015/1/29/implementing-image-blur-in-a-windows-universal-app

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM