MCPcopy Create free account
hub / github.com/DentonW/DevIL / ilReadBitPbm

Function ilReadBitPbm

DevIL/src-IL/src/il_pnm.cpp:393–413  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

391
392
393ILimage *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
416ILboolean iGetWord(ILboolean final)

Callers 1

iLoadPnmInternalFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected