如何使用Graphics2D平滑手绘线条(how to smooth a hand

编程入门 行业动态 更新时间:2024-10-13 06:14:36
如何使用Graphics2D平滑手绘线条(how to smooth a hand-drawn line with Graphics2D)

我已经使用这段代码在Java和Graphics2D中实现了一个徒手绘图工具。 所以我有一个由很多点组成的Path2D。 有没有算法来平滑这条线? 我不是指抗锯齿,我的意思是将路径转换为贝塞尔曲线的路径。 像这样的东西,但有一个Path2D作为输入。 我认为这是一个反复出现的问题,但我真的找不到有用的东西。

I've used this code to implement a freehand drawing tool in Java and Graphics2D. So I have a Path2D made up of a lot points. Is there an algorithm to smooth this line? I don't mean anti-aliasing, I mean something like converting the path to a path of bezier curves. Something like this, but with a Path2D as input. I would think this a recurring problem but I couldn't really find something useful.

最满意答案

我找到了我需要的东西: http : //javagraphics.blogspot.com/2010/06/shapes-implementing-freehand-pencil.html

编辑:因为我现在知道这个问题的确切术语(曲线拟合)我可以更好地谷歌它也发现这篇文章: Java曲线拟合库

编辑:另请参阅http://johnsogg.blogspot.com/2010/01/cardinal-splines-and-catmull-rom.html

I've found what I needed at: http://javagraphics.blogspot.com/2010/06/shapes-implementing-freehand-pencil.html

Edit: and since I now know the exact term for this problem (curve fitting) I can google it better and also found this post: Java curve fitting library

Edit: also look at http://johnsogg.blogspot.com/2010/01/cardinal-splines-and-catmull-rom.html

更多推荐

本文发布于:2023-07-30 15:48:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1338860.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:平滑   手绘   如何使用   线条   hand

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!