Skip to content

Conversation

@drelaptop
Copy link
Contributor

@drelaptop drelaptop commented Aug 31, 2018

增加一个 button,用以验证保存文件到本地

保存文件的主要测试代码:

            let data = this.renderTexture.readPixels();
            let width = this.renderTexture.width;
            let height = this.renderTexture.height;
            let filePath = jsb.fileUtils.getWritablePath() + 'render_to_sprite_image.png';
            let success = jsb.saveImageData(data, width, height, filePath);
            if (success) {
                cc.log("save image data success, file: " + filePath);
            }

保存后的图片:

mac 平台:

image

android 平台:

android-screenshot

"x": 0.796875,
"y": 0.796875,
"x": 0.3828125,
"y": 0.3828125,
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这个 scale 值的含义是什么,我没手动调整过 scale,它自己减半

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

没关系,这是场景在编辑器中的缩放,无关紧要

@pandamicro pandamicro merged commit afe54f1 into cocos:v2.0 Sep 2, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants