Is it possible to draw only part of a Path? Let’s say my Path is from x = 0 to x = 2000, the whole Path is calculated on start, and the Canvas is placed on HorizontalScrollView. When scroll x = 500, I want to draw only from 500 to 1000 of that Path; when x = 0 draw 0 to 1000, when x = 1500, draw 1000 to 1500 and when x = 2000 draw 1000 to 2000.
Path is a bezier curve, so if the calculation needs to be done all the time, it’s damaging performance.
Thanks.
Got the solution by drawing the whole line, and after that calculate Rect to draw on top of it, to hide particular part on visible part.
This is to demonstrate how I did this, I am drawing the whole Path, and to get it clip, I draw a rectangle on top of it to right position of screen, so it looks like the path is clipping.