ios - How to get a list of points from a UIBezierPath? -


i have uibezierpath need take list of points from.

in qt there function called pointatpercent fit needs can't find equivalent in objective-c.

does know how this?

you might try this:

uibezierpath *yourpath; // assume has points in cgpath yourcgpath = yourpath.cgpath; nsmutablearray *bezierpoints = [nsmutablearray array]; cgpathapply(yourcgpath, bezierpoints, mycgpathapplierfunc); 

the path applier function handed each of path's path elements in turn.
check out cgpathapplierfunction , cgpathapply.

the path applier function might this

void mycgpathapplierfunc (void *info, const cgpathelement *element) {     nsmutablearray *bezierpoints = (nsmutablearray *)info;      cgpoint *points = element->points;     cgpathelementtype type = element->type;      switch(type) {         case kcgpathelementmovetopoint: // contains 1 point             [bezierpoints addobject:[nsvalue valuewithcgpoint:points[0]]];             break;          case kcgpathelementaddlinetopoint: // contains 1 point             [bezierpoints addobject:[nsvalue valuewithcgpoint:points[0]]];                         break;          case kcgpathelementaddquadcurvetopoint: // contains 2 points             [bezierpoints addobject:[nsvalue valuewithcgpoint:points[0]]];             [bezierpoints addobject:[nsvalue valuewithcgpoint:points[1]]];                         break;          case kcgpathelementaddcurvetopoint: // contains 3 points             [bezierpoints addobject:[nsvalue valuewithcgpoint:points[0]]];             [bezierpoints addobject:[nsvalue valuewithcgpoint:points[1]]];             [bezierpoints addobject:[nsvalue valuewithcgpoint:points[2]]];             break;          case kcgpathelementclosesubpath: // contains no point             break;     } } 

Comments

Popular posts from this blog

How to provide Authorization & Authentication using Asp.net, C#? -

toolbar - How to add link to user registration inside toobar in admin joomla 3 custom component -

How to use Authorization & Authentication in Asp.net, C#? -