使用 Cocos2d (v 1.01),如果我按原样显示精灵,我会得到很好的质量,但如果我使用 CCRenderTexture,图像质量很差。仅当我放大图像时才会发生这种情况。
见附件截图,原始图像在左边。 这是我的代码:
CCScene* pScene = CCDirector::sharedDirector()->getRunningScene();
CCSprite* origSprite = CCSprite::spriteWithFile("jigsaw/11.png");
origSprite->setPosition(CCPoint(250,250));
origSprite->setScale(1.3);
pScene->addChild(origSprite, 500);
CCSprite* imageSprite = CCSprite::spriteWithFile("jigsaw/11.png");
CCSize imageSize = imageSprite->boundingBox().size;
CCRenderTexture *rt = CCRenderTexture::renderTextureWithWidthAndHeight(imageSize.width, imageSize.height);
imageSprite->setPosition(ccp(imageSize.width/2, imageSize.height/2));
rt->begin();
imageSprite->visit();
rt->end();
CCSprite *newSprite = CCSprite::spriteWithTexture(rt->getSprite()->getTexture());
delete rt;
newSprite->setFlipY(true);
newSprite->setPosition(CCPoint(750,750));
newSprite->setScale(1.3);
pScene->addChild(newSprite, 500);