简体   繁体   English

在Xamarin.iOS中模糊UIImage异步

[英]Blur UIImage async in Xamarin.iOS

I want to blur an image asynchronously in Xamarin.iOS, but when I try, I get an exception telling me I cannot do this outside the main thread (it calls EnsureUIThread ). 我想在Xamarin.iOS中异步模糊图像,但是当我尝试时,出现一个异常告诉我我不能在主线程之外执行此操作(它调用EnsureUIThread )。

I have tried 2 ways of doing this: FXBlurView and ImageEffects , but they both don't allow asynchronous blurring. 我尝试了两种方法: FXBlurViewImageEffects ,但是它们都不允许异步模糊。

How can I make the blurring happen asynchronously? 如何使模糊异步发生?

There's a simple answer, separate the blurring and the actual creation of the UIImage . 有一个简单的答案,将模糊和实际创建UIImage分开。 The blurring can happen on an other thread or async, and the actual usage of the image should happen on the UI thread. 模糊可能发生在其他线程或异步上,并且图像的实际使用应发生在UI线程上。

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

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