如何将镜头效果应用到我的UIImage? [英] How can i apply lens effect to my UIImage?

查看:104
本文介绍了如何将镜头效果应用到我的UIImage?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何将镜头效果应用于我的UIImage,如此处所示 http://processing.org /learning/topics/lens.html 的?

How can i apply lens effect to my UIImage like it shown here http://processing.org/learning/topics/lens.html?

推荐答案

您可以使用 Cocos2D 框架来做到这一点。

You can use the Cocos2D framework to do that.

如果您选择使用它,以下是您可以轻松应用镜头效果的方法:

If you choose to use it, here is how you can easily apply a lens effect:

- (void)aFunction
{
    const CGSize size = [[CCDirector sharedDirector] winSize];

    // Init and position your image
    CCSprite *img = [CCSprite spriteWithFile:@"images.png"];
    img.position = ccp(size.width/2.f, size.height/2.f);
    [self addChild:img];

    // Create action and start it
    id lens = [CCLens3D actionWithPosition:ccp(size.width/2.f, size.height/2.f)
                                    radius:240.f
                                      grid:ccg(15.f,10.f)
                                  duration:0.f];
    [img runAction:lens];
}

你的项目可能是一个UIKit项目,所以你不想重启你的从头开始。所以,在cocos2d-ios Xcode项目中,有很多你可以做的例子。

Your project is probably a UIKit project so you don't want to restart your project from scratch. So, in the cocos2d-ios Xcode project there are a lot of examples of what you can do.

还有一个名为AttachTest的例子,它向您展示如何在UIKit项目中实现EAGLView(它是UIView的子类)。

And there is an exemple which is called AttachTest and it show you how implement an EAGLView (which is a subclass of UIView) in an UIKit project.

这篇关于如何将镜头效果应用到我的UIImage?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆