views:

384

answers:

1

Is it possible to encode CGPathRef variables? I mean is there an encodeObject:forKey like method for CGPathRef variables?

+1  A: 

CGPaths are objects, but I don't think you can encode them—at least, if you can, it's not documented. You'll need to generate a saveable representation of the path yourself, and encode that, and then, when you decode that representation, reincarnate the path from it yourself.

Peter Hosey
Is there any relationship between `CGPathRef` and `NSBezierPath`? `NSBezierPath` should be serializable, and if there's a way to convert one to the other, you could encode the `NSBezierPath` and convert to a CGPath as needed. `NSBezierPath` strikes me as a bit less opaque than CGPath.
Alex
No, there is none. You would have to convert manually using an applier function. This is usually not that hard, but if the CGPath contains a quadratic curve (one with one control point), you'd have to convert that to a cubic curve (two control points).
Peter Hosey