Closed baleksey closed 1 year ago
I've found solution/workaround: recreate canvas on node side or do the following: canvas.width=canvas.height=0; and assign old width/height values again. Do it every time before drawing new frame.
Reason: generally on doing animation you just clear canvas every time and draw new content. While on JS/Web side it works perfectly well - in rust skia canvas it records everything you do every time. So on N frame it will reproduce N frames and N canvas clears before you see your final frame. Using my solution above - you reset picture recorder and remove all commands it has already.
I'm trying to create a video from canvas frames. Every time I use saveAs option (BTW, saveAsSync works much better but still failed) it starts from saving frames in 15 ms (for 60 frames or so), then pretty quickly becomes very slow, 250 ms per frame on 90-ish frame.
It looks like it's the same issue which was closed, but the problem still exists. It doesn't matter if I get buffer, getImageData or do saveAs, everything becomes slower every step pretty fast.
Is there anything I can do? Probably somehow get raw canvas pixels directly from memory? Thanks!