如何实现DrawLine函数?

发布于 2024-10-08 20:22:51 字数 291 浏览 0 评论 0原文

问题:除了在输入点上画圆之外,还有没有更好的方法来实现在屏幕上画线的功能?

详细信息:我正在尝试编写一个基本上会画一条线的函数。但是该线不会是常规的彩色线。这条线将允许用户通过该线将像素从一张图像复制到另一张图像,你可以认为它就像 Photoshop 上的“历史画笔”或“图章”。我的第一个想法是获取点并在每个点上画圆圈。这是有效的,但并不顺利,并且有一些错误。第一个问题是,如果用户滑动手指太快,它就不起作用。我认为如果我可以填充两点之间的点,然后画一条线,这会解决问题,这是一种工作,但这次绘图变得非常慢。另一个问题是它看起来从来都不是一帆风顺的。

Question : Is there any better way to implement a function that draws line on the screen other than drawing circles on the input points ?

Details : I am trying to write a function which basically will draw a line.However the line will not be a regular colored line. This line will let user to copy pixels from one image to another trough that line , you can think It like "history brush" or "stamp" on Photoshop . My first thought was just get the points and draw circles on each point. Which is working but not smooth and have some bugs. The first problem is it is not working if user sweep his finger too fast. I thought it would solve problem if i can fill the dots between two points and then draw the line which is kind of work but this time drawing gets very slow. One other problem is that it never looks smooth.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

眼泪淡了忧伤 2024-10-15 20:22:51

BitmapShader 不是您要找的吗?

Isn't the BitmapShader what you're looking for?

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文