question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

PIXI.utils.snap() ? PIXI.RenderTexture (printScreen)

See original GitHub issue

hi , 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:closed
  • Created 6 years ago
  • Comments:10 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
ivanpopelyshevcommented, Feb 26, 2018

Go sleep 😃

1reaction
djmisterjoncommented, Feb 26, 2018

sorry to disturb you, I think it’s fatigue. Its work, i just forget my map have limited width in the editor. grrrrrrrrrrrr

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found