| 391 | |
| 392 | |
| 393 | ILimage *ilReadBitPbm(PPMINFO *Info) |
| 394 | { |
| 395 | ILuint m, j, x, CurrByte; |
| 396 | |
| 397 | if (!ilTexImage(Info->Width, Info->Height, 1, (ILubyte)(Info->Bpp), 0, IL_UNSIGNED_BYTE, NULL)) { |
| 398 | return IL_FALSE; |
| 399 | } |
| 400 | iCurImage->Origin = IL_ORIGIN_UPPER_LEFT; |
| 401 | |
| 402 | x = 0; |
| 403 | for (j = 0; j < iCurImage->SizeOfData;) { |
| 404 | CurrByte = igetc(); |
| 405 | for (m = 128; m > 0 && x < Info->Width; m >>= 1, ++x, ++j) { |
| 406 | iCurImage->Data[j] = (CurrByte & m)?255:0; |
| 407 | } |
| 408 | if (x == Info->Width) |
| 409 | x = 0; |
| 410 | } |
| 411 | |
| 412 | return iCurImage; |
| 413 | } |
| 414 | |
| 415 | |
| 416 | ILboolean iGetWord(ILboolean final) |