将Sprite转换为Image。
// //获取精灵的CCImage Image*HelloWorld::createImageFromSprite(Sprite*sp) { Sprite*pNewSpr=Sprite::createWithSpriteFrame(sp->getSpriteFrame()); pNewSpr->setAnchorPoint(Vec2::ZERO); RenderTexture*pRender=RenderTexture::create(pNewSpr->getContentSize().width,pNewSpr->getContentSize().height,Texture2D::PixelFormat::RGBA8888); pRender->begin(); pNewSpr->visit(); pRender->end(); returnpRender->newImage(); } //