The code you wrote there won’t do what you want because it’s only going to tell you whether the last pixel in the loop intersects. If you wanted to fix it, you’d have to add a check inside the inner loop and return early if path.contains() is true.
But this doesn’t seem like a great solution to begin with because you have to do 8 * 8 = 64 separate checks. Imagine if you want to increase the padding size: the time it takes to check will increase parabolically.
See if you can come up with something simpler, that only involves a couple of checks regardless of the size. If the Path you are dealing with is a rectangle, then you can do something like Rectangle(8, 8).withCentre({x, y}).intersects(pathRectangle);
Thank you for the reply I figured it out I drew two fake paths above and below and checked in between if it mathches either above or below then hit test returns true only painting the real path