Summary of common methods of canvas in Android
1、 Operate on canvas
A series of operations on canvas refer to the operations such as rotation, translation and zoom on canvas.
These operations can make the canvas object more convenient to use.
2、 Canvas translation
3、 Canvas zoom
4、 Canvas rotation
5、 Canvas operation example
6、 Canvas save and restore
Canvas provides several methods to easily change and restore the state of canvas.
These methods are: save (), restore (), restoretocount (int savecount).
When translating, rotating and zooming in the canvas, we can call the save () method to save the currently modified canvas state. After calling the restore () method, the canvas will be restored to the latest save () state.
The save () method also has a return value. We can also call the restoretocount (int savecount) method and pass this return value as a parameter to restore the canvas to a specific save () state.
6、 Canvas drawing example
1. Draw text
2. Draw a circle
3. Draw a line
4. Draw an ellipse
5. Draw radian
6. Rectangle
7. Polygon
8. Draw Bessel curve
9. Draw point
10. Draw pictures
7、 Summary
The above is the whole content of this article. I hope it can help you in your study or work. If you have any questions, you can leave a message.