void test_ilLoad(wchar_t* sourceFN, wchar_t* targetFN) { testHeap(); ilInit(); testHeap(); ILuint handle = ilGenImage(); testHeap(); ilBindImage(handle); testHeap(); //printf("Loading " PathCharMod "\n", sourceFN); ilResetRead(); ILenum sourceType = ilDetermineType(sourceFN); if (!ilLoad(sourceType, sourceFN)) { printf("test_ilLoad: Failed to load %S\n", sourceFN); ++errors; return; } testHeap(); //ilConvertImage(IL_BGR, IL_UNSIGNED_BYTE); //ilConvertImage(IL_LUMINANCE, IL_UNSIGNED_BYTE); //iluScale(150, 150, 1); testHeap(); DeleteFile(targetFN); //printf("Saving " PathCharMod "\n", targetFN); if (!ilSaveImage(targetFN)) { printf("test_ilLoad: Failed to save " PathCharMod "\n", targetFN); ++errors; } testHeap(); ilDeleteImage(handle); }
// ONLY call at startup. ILvoid ILAPIENTRY ilInit() { // if it is already initialized skip initialization if (IsInit == IL_TRUE ) return; //ilSetMemory(NULL, NULL); Now useless 3/4/2006 (due to modification in il_alloc.c) ilSetError(IL_NO_ERROR); ilDefaultStates(); // Set states to their defaults. // Sets default file-reading callbacks. ilResetRead(); ilResetWrite(); #if (!defined(_WIN32_WCE)) && (!defined(IL_STATIC_LIB)) atexit((void*)ilRemoveRegistered); #endif //_WIN32_WCE //ilShutDown(); iSetImage0(); // Beware! Clears all existing textures! iBindImageTemp(); // Go ahead and create the temporary image. IsInit = IL_TRUE; return; }