| 2332 | |
| 2333 | |
| 2334 | void cv::polylines(InputOutputArray _img, InputArrayOfArrays pts, |
| 2335 | bool isClosed, const Scalar& color, |
| 2336 | int thickness, int lineType, int shift ) |
| 2337 | { |
| 2338 | Mat img = _img.getMat(); |
| 2339 | bool manyContours = pts.kind() == _InputArray::STD_VECTOR_VECTOR || |
| 2340 | pts.kind() == _InputArray::STD_VECTOR_MAT; |
| 2341 | int i, ncontours = manyContours ? (int)pts.total() : 1; |
| 2342 | if( ncontours == 0 ) |
| 2343 | return; |
| 2344 | AutoBuffer<Point*> _ptsptr(ncontours); |
| 2345 | AutoBuffer<int> _npts(ncontours); |
| 2346 | Point** ptsptr = _ptsptr; |
| 2347 | int* npts = _npts; |
| 2348 | |
| 2349 | for( i = 0; i < ncontours; i++ ) |
| 2350 | { |
| 2351 | Mat p = pts.getMat(manyContours ? i : -1); |
| 2352 | if( p.total() == 0 ) |
| 2353 | { |
| 2354 | ptsptr[i] = NULL; |
| 2355 | npts[i] = 0; |
| 2356 | continue; |
| 2357 | } |
| 2358 | CV_Assert(p.checkVector(2, CV_32S) >= 0); |
| 2359 | ptsptr[i] = (Point*)p.data; |
| 2360 | npts[i] = p.rows*p.cols*p.channels()/2; |
| 2361 | } |
| 2362 | polylines(img, (const Point**)ptsptr, npts, (int)ncontours, isClosed, color, thickness, lineType, shift); |
| 2363 | } |
| 2364 | |
| 2365 | |
| 2366 | static const int CodeDeltas[8][2] = |