Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

CGPath as a string

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!

like image 609
user1082474 Avatar asked Dec 22 '11 02:12

user1082474


1 Answers

There is a post about saving CGPathRefs 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);
like image 97
Sergey Kalinichenko Avatar answered Oct 18 '22 12:10

Sergey Kalinichenko