在MonoTouch中做实时运动模糊的方法是什么?
滚动惯性图片库时,我需要在UIImageView上应用运动模糊效果,并使用强度和方向作为参数,就像在Photoshop中一样。
我在CocoaTouch、CoreAnimation或iOS SDK的任何地方都找不到任何模糊或运动模糊滤镜。
有没有一些2D特效库可以从MonoTouch上使用,它带有实时模糊滤镜,对iPhone很好?
提前谢谢。
发布于 2011-09-23 05:36:23
我找到了一个很好的开源库,可以在UIImage上做很多效果:
https://github.com/gdawg/uiimage-dsp
它还使用加速框架在iOS 4.0上略微加快了速度。
现在,如果有一个MonoTouch包装器就好了……
发布于 2011-09-21 08:57:28
这篇文章描述了一种可能的方法:
http://martinbowling.com/post/Recreating-the-Awesome-UrbanSpoon-UI-Effect-In-MonoTouch.aspx
发布于 2014-02-18 06:19:36
如果你想使用在WWDC上演示的模糊苹果(虽然不是实时的!)我为他们的UIImage类别做了一个原生端口。
获取模糊效果有点单调乏味,但可以做到:
// Helper method to create an image snapshot of the view hierarchy
UIImage SnapshotImageWithScale (UIView view, float scale)
{
UIGraphics.BeginImageContextWithOptions (view.Bounds.Size, false, scale);
view.DrawViewHierarchy (view.Bounds, true);
UIImage image = UIGraphics.GetImageFromCurrentImageContext ();
UIGraphics.EndImageContext ();
return image;
}
...
// Create snapshot of the parent view controller (this can be the superview or anything else)
UIImage snapshot = SnapshotImageWithScale (parentView, UIScreen.MainScreen.Scale);
// Blur the snapshot with the specified radius and tint color
snapshot = snapshot.ApplyBlur (6.0f, UIColor.FromWhiteAlpha (0.0f, 0.6f), 0.8f, null);
// Create an UIImageView to display the blurred snapshot
UIImageView snapshotView = new UIImageView {
Frame = new RectangleF (0, 0, View.Bounds.Width, View.Bounds.Height),
Image = snapshot,
};
View.AddSubview (snapshotView);https://stackoverflow.com/questions/7475610
复制相似问题