How do I capture the entire canvas

  • The manual says that canvas snapshot only captures the current display into an image string. Is there any way to capture the whole canvas as an image string? I wish to draw a canvas image and regardless of the viewport size, save the canvas as a whole to either a printable image file or pdf file. Or am I not reading it right regarding the canvas snapshot?

    Snapshot canvas

    Take a screenshot of the current display. This triggers On canvas snapshot when the snapshot is ready, and the resulting image can be accessed with the CanvasSnapshot system expression. This can then be loaded in to a sprite or tiled background, sent to a server, or opened with the Browser object in a new tab.

  • I'm not too sure if there is an 'official'/ correct solution to this, but a workaround that could work (though I'm not sure if it would be hugely effective) would be to momentarily change the view to encompass the entire layout for the moment before the snapshot is taken, before returning to the regular view. That way even if the snapshot is purely the current view, it would be a view of the entire canvas.

    If you did it within a small space of time, chances are the user wouldn't even notice.

    I hope this helps somehow!

    Regards,

    Gideon

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • GideonG thanks but that didn't really help. I want to be able to save the entire canvas so I can later email it and print it out. Expanding the canvas might lose something during printing due to the pixels suddenly becoming so small. Thank you though it will probably help someone.

  • How big is the layout / would capturing it on an image a max 2048x work 1:1 for example, or will you have to accept losing some resolution to cover the width/height of the laout?

    No matter, I would suggest trying to use either the Canvas plugin (which lets you paste layers) or the Paster plugin (to which you can paste families and it's faster than Canvas). You can download either as an imageURL using the Browser invoke download action. I couldn't get Canvas to work with umbra just now (don't know why), so Paster seems like a better option IMO, even if you'll need to code a few lines of object pasting to get the image you're after.

  • Yeah, I thought that may be the case. Figured it was worth a suggestion in case it worked. As Colludium says, you may need to look into 3rd party plugins and such. All the best in trying to solve your problem!

  • my problem is save the screenshot at smartphones... work nice on web , but I can´t do this work at my android. Any tip?

  • Why yes Alemar I'm using a combination of plugins to accomplish my goal. I use the canvas plugin to capture an entire layer and paste it to a sprite. Then I use paster plugin to save the data from the sprite and use it however I wish.

  • thank you lanceal I´ll try paster plugin. Right now I´m triyng to use cranberry screencapture cordova plugin , but no luck...

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)