ma11hew28
ma11hew28

Reputation: 126309

Must you call CGContextClosePath after CGContextBeginPath?

If my path ends where it starts, then is it OK to omit the call to CGContextClosePath?

Upvotes: 1

Views: 2014

Answers (1)

StephenAshley.developer
StephenAshley.developer

Reputation: 1064

Not necessarily, only if you want to close the subpath. According to iOS Developer Library : Quartz 2D Programming Guide:

Closing a Subpath

To close the current subpath, your application should call CGContextClosePath. This function adds a line segment from the current point to the starting point of the subpath and closes the subpath. Lines, arcs, and curves that end at the starting point of a subpath do not actually close the subpath. You must explicitly call CGContextClosePath to close a subpath.

Upvotes: 2

Related Questions