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

Function iLoadDataInternal

DevIL/src-IL/src/il_rawdata.cpp:70–94  ·  view source on GitHub ↗

Internal function to load a raw data image

Source from the content-addressed store, hash-verified

68
69// Internal function to load a raw data image
70ILboolean 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

Callers 2

ILAPIENTRY ilLoadDataFFunction · 0.85
ILAPIENTRY ilLoadDataLFunction · 0.85

Calls 2

ilSetErrorFunction · 0.85
ilFixImageFunction · 0.85

Tested by

no test coverage detected