Android Canvas Save and Restoretocount

Source: Internet
Author: User

@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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.