Sprite to UIImage

+(UIImage *) convertSpriteToImage:(CCSprite *)sprite{    CGPoint p = sprite.anchorPoint;    [sprite setAnchorPoint:ccp(0,0)];CCRenderTexture *renderer = [CCRenderTexture renderTextureWithWidth:sprite.contentSize.width height:sprite.contentSize.height];[renderer begin];[sprite visit];[renderer end];    [sprite setAnchorPoint:p];    return [UIImage imageWithData:[renderer getUIImageAsDataFromBuffer:kCCImageFormatPNG]];}





   

你可能感兴趣的:(Sprite to UIImage)