------------------------------------------------------------------------------ Convert char data without changing format
| 288 | //------------------------------------------------------------------------------ |
| 289 | // Convert char data without changing format |
| 290 | static void vtkImageMapperCopy(const unsigned char* inPtr, unsigned char* outPtr, int ncols, |
| 291 | int nrows, int numComp, vtkIdType inIncX, vtkIdType inIncY, vtkIdType outIncY) |
| 292 | { |
| 293 | // loop through the data and copy it for the texture |
| 294 | if (numComp == 1) |
| 295 | { |
| 296 | for (int idy = 0; idy < nrows; idy++) |
| 297 | { |
| 298 | for (int idx = 0; idx < ncols; idx++) |
| 299 | { |
| 300 | *outPtr = *inPtr; |
| 301 | outPtr++; |
| 302 | inPtr += inIncX; |
| 303 | } |
| 304 | outPtr += outIncY; |
| 305 | inPtr += inIncY; |
| 306 | } |
| 307 | } |
| 308 | else if (numComp == 2) |
| 309 | { |
| 310 | for (int idy = 0; idy < nrows; idy++) |
| 311 | { |
| 312 | for (int idx = 0; idx < ncols; idx++) |
| 313 | { |
| 314 | outPtr[0] = inPtr[0]; |
| 315 | outPtr[1] = inPtr[1]; |
| 316 | outPtr += 2; |
| 317 | inPtr += inIncX; |
| 318 | } |
| 319 | outPtr += outIncY; |
| 320 | inPtr += inIncY; |
| 321 | } |
| 322 | } |
| 323 | else if (numComp == 3) |
| 324 | { |
| 325 | for (int idy = 0; idy < nrows; idy++) |
| 326 | { |
| 327 | for (int idx = 0; idx < ncols; idx++) |
| 328 | { |
| 329 | outPtr[0] = inPtr[0]; |
| 330 | outPtr[1] = inPtr[1]; |
| 331 | outPtr[2] = inPtr[2]; |
| 332 | outPtr += 3; |
| 333 | inPtr += inIncX; |
| 334 | } |
| 335 | outPtr += outIncY; |
| 336 | inPtr += inIncY; |
| 337 | } |
| 338 | } |
| 339 | else // if (numComp == 4) |
| 340 | { |
| 341 | for (int idy = 0; idy < nrows; idy++) |
| 342 | { |
| 343 | for (int idx = 0; idx < ncols; idx++) |
| 344 | { |
| 345 | outPtr[0] = inPtr[0]; |
| 346 | outPtr[1] = inPtr[1]; |
| 347 | outPtr[2] = inPtr[2]; |