An idea how to speed up the drawing of lines #1471
Replies: 6 comments 7 replies
-
By the way: |
Beta Was this translation helpful? Give feedback.
-
Hi, thanks for the suggestion. I will move to the "Discussions" area as it is more of a topic of interest than an issue. The algorithm works well and runs fast. I usually run the "graphicstest" sketch to check for performance deltas on the algorithms. There are a few anomlies in the line at the ends, I think this may be because the end pixels should be excluded in calculations. Existing algorithm plot from graphicstest: The suggested code output: These look very similar until the bottom and right edges are inspected closely where there is a large final adjustment to the line in the new algorithm: |
Beta Was this translation helpful? Give feedback.
-
The "near" 45 deg angle also has the correction at the end. The line should consist of single pixels with the small discontinuity in the middle: I think a simple tweak to the algorithm is all that is needed. |
Beta Was this translation helpful? Give feedback.
-
Thank you for the discussion. I'm working on the tweak. Looks promising. But optimizing and testing all cases will take some time. |
Beta Was this translation helpful? Give feedback.
-
You were right to be suspicious of a glitch at 255. This is a byte roll over point so can be in code or hardware. At the hardware level a bus transition from 0xFF to 0x00 tests the grounding and signal integrity. Try a quickly drawn alternating black and white pixel chequerboard to test the display and interface. Write a dedicated fill algorithm rather than draw single pixels since single pixels require address window commands for every pixel. I have only had one defective screen and that was duff pixels that showed in all screen operations. |
Beta Was this translation helpful? Give feedback.
-
Hi, I just joining the community, hence be patient....
Since some days I'm diving into the world of TFT's, hardware and software. Looking into the standard method of drawing free lines by using Bresenham Algorithm I got an idea how to simplify and speed up this time consuming routine. Finally - why not to share the solution with the community for discussion.
Line_en.pdf
Beta Was this translation helpful? Give feedback.
All reactions