PIXI.utils.snap() ? PIXI.RenderTexture (printScreen)
See original GitHub issuehi , when i try to make a snap screenMap or my rendering scene, i get a png black picture ? Do pixi have a tool for make printScreen Rendering, or is my function are correct ?
example when i try this PIXI.snapFullMap(SceneManager._scene); i get a file but with only black ?
PIXI.snapFullMap = function(target) {
const width = target.width, height = target.height;
let bitmap = new Bitmap(width, height);
let context = bitmap._context;
let renderTexture = PIXI.RenderTexture.create(width, height);
Graphics._renderer.render(target, renderTexture);
//target.worldTransform.identity();
let canvas = Graphics._renderer.extract.canvas(renderTexture);
context.drawImage(canvas, 0, 0);
//renderTexture.destroy({ destroyBase: true });
//bitmap._setDirty();
// make data
let urlData = bitmap._canvas.toDataURL();
let base64Data = urlData.replace(/^data:image\/png;base64,/, "");
// write file png
let fs = require('fs'), fileName = 'test.png';
fs.writeFile(fileName, base64Data, 'base64', function(error){
if (error !== undefined && error !== null) {
console.error('An error occured while saving the screenshot', error);
}
});
};
Issue Analytics
- State:
- Created 6 years ago
- Comments:10 (4 by maintainers)
Top Results From Across the Web
PIXI.RenderTexture - PixiJS API Documentation
PIXI.RenderTexture. A RenderTexture is a special texture that allows any PixiJS display object to be rendered to it.
Read more >Shader screenshot · Issue #6498 · pixijs/pixijs - GitHub
Hello, I render an image with a fragment shader: var app = new PIXI.Application({ width: window.innerWidth, height: window.
Read more >PIXI.RenderTexture no render - Stack Overflow
Fixed it. I think it's a problem with the autodetect renderer option, you can simply use the renderer from the app instead and...
Read more >PIXI.RenderTexture
A RenderTexture is a special texture that allows any PixiJS display object to be rendered to it. Hint: All DisplayObjects (i.e. Sprites) that...
Read more >How to get the screen buffer as an image - Pixi.js
I need to get only what is shown on the screen like a screenshot. var renderTexture = new PIXI.RenderTexture(renderer, renderer.width, ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Go sleep 😃
sorry to disturb you, I think it’s fatigue. Its work, i just forget my map have limited width in the editor. grrrrrrrrrrrr