Halt on Canvas Snapshot?

0 favourites
  • 3 posts
From the Asset Store
Pixel Destruction like in "Worms" (Drawing Canvas based)
  • I just found out that I could replicate one of my Paster-only tricks right in C2 by combining 'CanvasSnapshot' with the Sprite action 'Load image from URL' (which can take a dataURI as well) to paste a copy of my current screen to a sprite image.

    In my case I'm using it to 'flatten' a number of layers together and apply a blur to it. By using this approach, I can smoothly 'fade-in' a blur effect even on my modest android device, which isn't possible when I apply blur to multiple layers. I can't blur the whole layout because I have an overlay that I want to stay unblurred.

    The problem is, whenever I grab a canvas snapshot and past it to a sprite, the engine halts for a few frames (more than a few on android). I notice that we only have the option of grabbing the canvas as a png/jpeg. Is the on-the-fly (de)compression the reason behind this slowdown? Or is this just a demanding operation that takes a ton of CPU on its own?

  • You are not only compressing then decompressing but probably also hitting the disk which means IO latency... IO is far slower than in-memory operations.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I think I saw something like that hapenning, which is why I prefer to use the paster (as paster seems more adapted for real time interactions). I wonder why too however.

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