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

Function LoadImages

DevIL/examples/animation_example/AnimTest.cpp:117–168  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

115
116
117void LoadImages(char *FileName)
118{
119 ILuint Image, i;
120
121 hDC = GetDC(HWnd);
122 hMemDC = CreateCompatibleDC(hDC);
123
124 ilGenImages(1, &Image);
125 ilBindImage(Image);
126 if (!ilLoadImage(FileName)) {
127 ilDeleteImages(1, &Image);
128 return;
129 }
130
131 ilEnable(IL_ORIGIN_SET);
132 ilEnable(IL_FORMAT_SET);
133 ilOriginFunc(IL_ORIGIN_LOWER_LEFT);
134 //ilFormatFunc(IL_BGRA);
135 ilConvertImage(IL_BGR, IL_UNSIGNED_BYTE);
136 ilutRenderer(ILUT_WIN32);
137
138 CurImage = 0;
139 NumImages = ilGetInteger(IL_NUM_IMAGES) + 1;
140 Bitmaps = new HBITMAP[NumImages];
141 BmpInfo = new BITMAPINFOHEADER[NumImages];
142 Durations = new ILuint[NumImages];
143 if (Bitmaps == NULL || BmpInfo == NULL || Durations == NULL) {
144 ilDeleteImages(1, &Image);
145 return;
146 }
147
148 for (i = 0; i < NumImages; i++) {
149 ilActiveImage(0);
150 ilActiveImage(i);
151 Durations[i] = ilGetInteger(IL_IMAGE_DURATION);
152 *(Bitmaps + i) = ilutConvertToHBitmap(hDC);
153 ilutGetBmpInfo((BITMAPINFO*)(BmpInfo + i));
154 }
155
156 SelectObject(hMemDC, Bitmaps[0]);
157
158 ilDeleteImages(1, &Image);
159
160 sprintf(NewTitle, "%s - %s", TITLE, FileName);
161 SetWindowText(HWnd, NewTitle);
162
163 QueryPerformanceFrequency((LARGE_INTEGER*)&TimerFreq);
164 TimerRes = 1.0 / TimerFreq;
165 QueryPerformanceCounter((LARGE_INTEGER*)&StartTime);
166
167 return;
168}
169
170
171void DestroyGDI()

Callers 2

WinMainFunction · 0.85
WndProcFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected