@Override Public void Draw (canvas canvas) { if (mdrawable!=null) { int sc= Canvas.save (); if (manimation!=null) { manimation.gettransformation ( Animationutils.currentanimationtimemillis (), mtransformation); Canvas.concat (Mtransformation.getmatrix ()); } Mdrawable.draw (canvas); Canvas.restoretocount (SC); } }
Canvas.save () and Canvas.restoretocount (SC) are used to save and reply to the state of the canvas (properties such as Maxtrix) because we need to modify the matrix properties of the canvas, The Canvas.concat method will perform a matrix operation with the matrix of the current canvas, and if we do not save the previous matrix property, each time will be multiplied by the result of the last array operation, and for this example, the distance between each translation will be greater and larger.
Ext.: http://blog.csdn.net/gaomatrix/article/details/6525240
Android Canvas Save and Restoretocount