When drawing a dynamic image in the canvas, if a fixed background image is used, only one small genie is moving!
In this case, you have to re-draw the background image without frame, reducing the efficiency! I tried various methods and eventually failed!
If anyone has a good method, please provide it. Thank you!
The following are some examples of the exploration process:
1. An article about redrawing images. However, it can only be applied to the change of the genie at a fixed position, and the background is not changed!
If it is used on the mobile genie, the whole screen will be filled with the moving pictures and bugs of the genie.
Address: How to overwrite and refresh dirty rectangles in Android SurfaceView
2. About SuffaceView and other knowledge, canvas = sfh. lockCanvas (); and sfh. unlockCanvasAndPost (canvas); the canvas is constantly drawn up, so you need to overwrite the canvas and re-draw it!
Reference: SurfaceView, SurfaceHolder, SurfaceHolder. CallBackhttp: // www.bkjia.com/kf/201202/119622.html
3. tried to use the layer method, but the canvas. saveLayer () method does not know what it means!
4. Do not know how to use transparent rendering!
This article is just a record, not a solution ......
From Akai's column