怎样的android绘制三角形,星形,正方形,心脏在画布上
我能够用path.addCircle()和path.addRect(绘制圆形和矩形在画布上)。喜欢,我想触摸我能够画出三角形,星形广场和心脏。 我该怎么办呢? 给我带样品示例的方式。 谢谢
I am able to draw circle and rectangle on canvas by using path.addCircle() and path.addRect().Like that i want on touch i am able to draw triangle, star, square and heart. How can I do that? Give me a way with sample examples. Thanks
您必须找出数学背后的数字。三角形和启动是相当容易的,但在这里是你如何画一个心脏:http://www.mathematische-basteleien.de/heart.htm
You have to find out the math behind that figures. The triangle and the start are quite easy but here is how you can draw a heart: http://www.mathematische-basteleien.de/heart.htm
要提请大家特别的路径,你应该创建它们加点,椭圆形等,画布支持裁剪指定路径的面具,所以你可以设置一个心脏的剪贴蒙版推pasth到矩阵,画出心脏的内容十再次弹出它。
To draw special paths you should create them adding points, ellipses etc, the canvas supports clipping mask of a specified path and so you can set the clipping mask of a heart push the pasth to the matrix, draw the content of the heart and ten pop it again.
这是我在做什么,以实现在Andriod的模拟2D页面卷曲的效果:http://$c$c.google.com/p/android-page-curl/
That's what I'm doing to achieve a simulated 2D page curl effect on andriod: http://code.google.com/p/android-page-curl/
希望这有助于!