Internal function to load a raw data image
| 68 | |
| 69 | // Internal function to load a raw data image |
| 70 | ILboolean iLoadDataInternal(ILuint Width, ILuint Height, ILuint Depth, ILubyte Bpp) |
| 71 | { |
| 72 | if (iCurImage == NULL || ((Bpp != 1) && (Bpp != 3) && (Bpp != 4))) { |
| 73 | ilSetError(IL_ILLEGAL_OPERATION); |
| 74 | return IL_FALSE; |
| 75 | } |
| 76 | |
| 77 | if (!ilTexImage(Width, Height, Depth, Bpp, 0, IL_UNSIGNED_BYTE, NULL)) { |
| 78 | return IL_FALSE; |
| 79 | } |
| 80 | iCurImage->Origin = IL_ORIGIN_UPPER_LEFT; |
| 81 | |
| 82 | // Tries to read the correct amount of data |
| 83 | if (iread(iCurImage->Data, Width * Height * Depth * Bpp, 1) != 1) |
| 84 | return IL_FALSE; |
| 85 | |
| 86 | if (iCurImage->Bpp == 1) |
| 87 | iCurImage->Format = IL_LUMINANCE; |
| 88 | else if (iCurImage->Bpp == 3) |
| 89 | iCurImage->Format = IL_RGB; |
| 90 | else // 4 |
| 91 | iCurImage->Format = IL_RGBA; |
| 92 | |
| 93 | return ilFixImage(); |
| 94 | } |
| 95 | |
| 96 | |
| 97 | //! Save the current image to FileName as raw data |
no test coverage detected