| 240 | } |
| 241 | |
| 242 | static void |
| 243 | Line( Mat& img, Point pt1, Point pt2, |
| 244 | const void* _color, int connectivity = 8 ) |
| 245 | { |
| 246 | if( connectivity == 0 ) |
| 247 | connectivity = 8; |
| 248 | else if( connectivity == 1 ) |
| 249 | connectivity = 4; |
| 250 | |
| 251 | LineIterator iterator(img, pt1, pt2, connectivity, true); |
| 252 | int i, count = iterator.count; |
| 253 | int pix_size = (int)img.elemSize(); |
| 254 | const uchar* color = (const uchar*)_color; |
| 255 | |
| 256 | for( i = 0; i < count; i++, ++iterator ) |
| 257 | { |
| 258 | uchar* ptr = *iterator; |
| 259 | if( pix_size == 1 ) |
| 260 | ptr[0] = color[0]; |
| 261 | else if( pix_size == 3 ) |
| 262 | { |
| 263 | ptr[0] = color[0]; |
| 264 | ptr[1] = color[1]; |
| 265 | ptr[2] = color[2]; |
| 266 | } |
| 267 | else |
| 268 | memcpy( *iterator, color, pix_size ); |
| 269 | } |
| 270 | } |
| 271 | |
| 272 | |
| 273 | /* Correction table depent on the slope */ |
no test coverage detected