如何画一个封闭的弯曲的形状? [英] How to draw a closed curved shape?
问题描述
我怎么能画(用手指)在Android脆封闭的形状。我可以得到一系列的点froim触摸输入,我需要把它对应(没有通过点去精确地)自定义曲线形状的点。
How can I draw (with finger) crisp CLOSED shape on Android. I can get the series of points froim touch input and I need to put custom curved shape which corresponds (doesn't have to go exactly through the points) the points.
推荐答案
跟踪您的接触点,并以构建一个路径
(文档链接)可以得出。 路径
是建立在这样你可以每个点追加到它,因为他们来的方式,你可以决定什么连接类型(直线,圆弧,贝塞尔),以在中间绘制。
Track your touch points and apply them in order to construct a Path
(docs link) that can be drawn. Path
is set up in such a way that you can append each point to it as they come in, and you can decide what type of connection (line, arc, bezier) to draw in between.
您可以使用初始力度和当前触摸或类似的逻辑之间的接近,以确定何时关闭轮廓,然后就叫的close()
。
You can use proximity between the initial touch and current touch or similar logic to determine when to close the contour, and then just call close()
.
这篇关于如何画一个封闭的弯曲的形状?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!