如何实现DrawLine函数?
问题:除了在输入点上画圆之外,还有没有更好的方法来实现在屏幕上画线的功能?
详细信息:我正在尝试编写一个基本上会画一条线的函数。但是该线不会是常规的彩色线。这条线将允许用户通过该线将像素从一张图像复制到另一张图像,你可以认为它就像 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
Bresenham 直线算法
Bresenham's line algorithm
BitmapShader 不是您要找的吗?
Isn't the BitmapShader what you're looking for?