I am currently implementing some application using cocos2d that requires capturing image from camera and applying some effects. In order to apply these effects images should be added to CCNode. So my question is: how can I capture image from camera and save it to CCSprite or somehow add it to CCLayer? I would much appreciate your help!
1 Answers
2
votes
yes you can do that and it is quite easy! Once you use the camera to get an image you will have an UIImage object. Then all you have to do is this:
CGImageRef imageref = [image CGImage]; //image is the UIImage retrieved from the camera or photo library.
CCSprite * mySprite =[CCSprite spriteWithCGImage:imageref key:nil];
You can then treat mySprite as any regular sprite.