问题描述
我可以使用
path.addCircle()
和
path.addRect()
。
现在我是想知道如何绘制三角形,星形,正方形或心形?
And now I am wondering how to draw a triangle or a star or a square or a heart?
推荐答案
您必须找出其背后的数学原理数字。三角形和星形很容易绘制。您可以通过以下方法画出一颗心:
You have to find out the math behind that figures. The triangle and the star are quite easy to draw. Here is how you can draw a heart: http://www.mathematische-basteleien.de/heart.htm
要绘制特殊路径,应通过添加点,椭圆等来创建它们。画布支持指定路径的剪贴蒙版,因此您可以设置心脏的剪贴蒙版,将路径推到矩阵,绘制心脏的内容,然后再次弹出。
To draw special paths you should create them by adding points, ellipses etc. The canvas supports a clipping mask of a specified path, so you can set the clipping mask of a heart, push the paths to the matrix, draw the content of the heart, and then pop it again.
这就是我要做的在andriod上实现模拟的2D页面卷曲效果:
That's what I'm doing to achieve a simulated 2D page curl effect on andriod: http://code.google.com/p/android-page-curl/
希望这会有所帮助!
这篇关于如何在画布上绘制三角形,星形,正方形或心形?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!