Reputation: 119
Is there any way to get at the actual data of a CGPath, so it can be saved to a file and restored later?
And is there any documentation on how that data is structured?
I would like to write it as a string (like a SVG path string), or some way with the dictionary object and PList XML files, but I'll take what I can get!
Upvotes: 6
Views: 1590
Reputation: 726579
There is a post about saving CGPathRef
s here. The guy is using CGPathApply
function to enumerate through the elements of the path:
static void saveApplier(void* info, const CGPathElement* element) {
...
}
...
NSMutableArray* a = [NSMutableArray arrayWithObject:[NSNumber numberWithBool:YES]];
CGPathApply(path, a, saveApplier);
Upvotes: 3