13

In android what is the difference between path.reset() and path.rewind() ?

The docs say that

public void reset ()

Clear any lines and curves from the path, making it empty. This does NOT change the fill-type setting.

public void rewind ()

Rewinds the path: clears any lines and curves from the path but keeps the internal data structure for faster reuse.

but what does that really mean ?

when should either one be used ?

1 Answer 1

16

Path.reset => Your Path is reseter. Returns to create one: new Path()

Path.rewind => Just empty the contents of the Path, Returns to make .clear() from a list

2
  • 4
    Should also mention that rewind is only useful if your paths have the same number of points. Otherwise, it is actually more expensive than reset
    – smac89
    Jun 13, 2016 at 21:19
  • 3
    @smac89 I'm curious, how is rewind more expensive than reset in that case?
    – stkent
    May 11, 2018 at 20:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.