@JASON New routine created 28/03/2001 Mirrors an image over its y axis
| 293 | //@JASON New routine created 28/03/2001 |
| 294 | //! Mirrors an image over its y axis |
| 295 | ILboolean ILAPIENTRY iMirror() { |
| 296 | ILubyte *Data, *DataPtr, *Temp; |
| 297 | ILuint y, d, PixLine; |
| 298 | ILint x, c; |
| 299 | ILushort *ShortPtr, *TempShort; |
| 300 | ILuint *IntPtr, *TempInt; |
| 301 | ILdouble *DblPtr, *TempDbl; |
| 302 | |
| 303 | if (iCurImage == NULL) { |
| 304 | ilSetError(IL_ILLEGAL_OPERATION); |
| 305 | return IL_FALSE; |
| 306 | } |
| 307 | |
| 308 | Data = (ILubyte*)ialloc(iCurImage->SizeOfData); |
| 309 | if (Data == NULL) |
| 310 | return IL_FALSE; |
| 311 | |
| 312 | PixLine = iCurImage->Bps / iCurImage->Bpc; |
| 313 | switch (iCurImage->Bpc) |
| 314 | { |
| 315 | case 1: |
| 316 | Temp = iCurImage->Data; |
| 317 | for (d = 0; d < iCurImage->Depth; d++) { |
| 318 | DataPtr = Data + d * iCurImage->SizeOfPlane; |
| 319 | for (y = 0; y < iCurImage->Height; y++) { |
| 320 | for (x = iCurImage->Width - 1; x >= 0; x--) { |
| 321 | for (c = 0; c < iCurImage->Bpp; c++, Temp++) { |
| 322 | DataPtr[y * PixLine + x * iCurImage->Bpp + c] = *Temp; |
| 323 | } |
| 324 | } |
| 325 | } |
| 326 | } |
| 327 | break; |
| 328 | |
| 329 | case 2: |
| 330 | TempShort = (ILushort*)iCurImage->Data; |
| 331 | for (d = 0; d < iCurImage->Depth; d++) { |
| 332 | ShortPtr = (ILushort*)(Data + d * iCurImage->SizeOfPlane); |
| 333 | for (y = 0; y < iCurImage->Height; y++) { |
| 334 | for (x = iCurImage->Width - 1; x >= 0; x--) { |
| 335 | for (c = 0; c < iCurImage->Bpp; c++, TempShort++) { |
| 336 | ShortPtr[y * PixLine + x * iCurImage->Bpp + c] = *TempShort; |
| 337 | } |
| 338 | } |
| 339 | } |
| 340 | } |
| 341 | break; |
| 342 | |
| 343 | case 4: |
| 344 | TempInt = (ILuint*)iCurImage->Data; |
| 345 | for (d = 0; d < iCurImage->Depth; d++) { |
| 346 | IntPtr = (ILuint*)(Data + d * iCurImage->SizeOfPlane); |
| 347 | for (y = 0; y < iCurImage->Height; y++) { |
| 348 | for (x = iCurImage->Width - 1; x >= 0; x--) { |
| 349 | for (c = 0; c < iCurImage->Bpp; c++, TempInt++) { |
| 350 | IntPtr[y * PixLine + x * iCurImage->Bpp + c] = *TempInt; |
| 351 | } |
| 352 | } |
nothing calls this directly
no test coverage detected