Sign in to follow this  
spinnerbox

Generate image data from current Phaser Scene and pass it into second Scene?

Recommended Posts

I was wondering is there function in Phaser that will allow me to generate pixel data object from current Phaser Scene (cover the whole canvas or part of it) and pass this object in I don't know which form to the second Phaser Stage and display it as it is at certain position?

Something like this: https://developer.mozilla.org/en-US/docs/Web/API/Canvas_API/Tutorial/Pixel_manipulation_with_canvas

Or I just fall back to plain Canvas API and use ImageData object?

Share this post


Link to post
Share on other sites

If you're in Canvas mode you can exactly follow that tutorial and maybe make an BitmapData object with the pixels in it. You can get the canvas from "game.canvas".

If you're in WebGL it's a little trickier... I don't remember how to do it off the top of my head. 

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.