简体   繁体   中英

Double buffering on MIT App Inventor?

I noticed on MIT app inventor that there is no way to clear a canvas without using the .clear method. This means that you would have to manually redraw the whole screen every time you update it, right? So, what do you do in order to avoid blinking when you redraw your objects. Is there a way to have a whole canvas behind the first in order to avoid blinking, and then update it, or do you just have to deal with the blinking how it is.

I realize that it is quite possible to make an array/list of every pixel on the screen, with an int for the RGB value of each pixel, and then just draw to that list. Then you can simply copy the array to the screen to render. I think this would be excessively slow and tedious in a language as simple as MIT app inventor.

what you could do is to store your canvas as image and later assign that image to the canvas background again... see also How to Save a Canvas

You also might be interested in Scott's Paintpot mod undo and redo example here

I realize that it is quite possible to make an array/list of every pixel on the screen, with an int for the RGB value of each pixel, and then just draw to that list.

exactly, this will be slow
btw, you can find more Canvas examples (and also other stuff) from Scott here

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM