CCRenderTexture实现保存CCsprite图片

    CCSprite *sprite = CCSprite::create();

    CCPoint p = sprite->getAnchorPoint();

    sprite->setAnchorPoint(ccp(0, 0));

    CCRenderTexture *renderer=CCRenderTexture::create(sprite->getContentSize().width,sprite->getContentSize().height);

    renderer->begin();

    sprite->visit();

    renderer->end();

    sprite->setAnchorPoint(p);

    CCImage *image = renderer->newCCImage();

    image->saveToFile("", false);


你可能感兴趣的:(CCRenderTexture实现保存CCsprite图片)