Ejemplo n.º 1
0
void LoadImages(char *FileName)
{
    ILuint Image, i;

    hDC = GetDC(HWnd);
    hMemDC = CreateCompatibleDC(hDC);

    ilGenImages(1, &Image);
    ilBindImage(Image);
    if (!ilLoadImage(FileName)) {
        ilDeleteImages(1, &Image);
        return;
    }

    ilEnable(IL_ORIGIN_SET);
    ilEnable(IL_FORMAT_SET);
    ilOriginFunc(IL_ORIGIN_LOWER_LEFT);
    //ilFormatFunc(IL_BGRA);
    ilConvertImage(IL_BGR, IL_UNSIGNED_BYTE);
    ilutRenderer(ILUT_WIN32);

    CurImage = 0;
    NumImages = ilGetInteger(IL_NUM_IMAGES) + 1;
    Bitmaps = new HBITMAP[NumImages];
    BmpInfo = new BITMAPINFOHEADER[NumImages];
    Durations = new ILuint[NumImages];
    if (Bitmaps == NULL || BmpInfo == NULL || Durations == NULL) {
        ilDeleteImages(1, &Image);
        return;
    }

    for (i = 0; i < NumImages; i++) {
        ilActiveImage(0);
        ilActiveImage(i);
        Durations[i] = ilGetInteger(IL_IMAGE_DURATION);
        *(Bitmaps + i) = ilutConvertToHBitmap(hDC);
        ilutGetBmpInfo((BITMAPINFO*)(BmpInfo + i));
    }

    SelectObject(hMemDC, Bitmaps[0]);

    ilDeleteImages(1, &Image);

    sprintf(NewTitle, "%s - %s", TITLE, FileName);
    SetWindowText(HWnd, NewTitle);

    QueryPerformanceFrequency((LARGE_INTEGER*)&TimerFreq);
    TimerRes = 1.0 / TimerFreq;
    QueryPerformanceCounter((LARGE_INTEGER*)&StartTime);

    return;
}
Ejemplo n.º 2
0
//
// ImageLib functions
//
ILboolean ilImage::ActiveImage(ILuint Number)
{
	if (this->Id) {
		this->Bind();
		return ilActiveImage(Number);
	}
	return IL_FALSE;
}
Ejemplo n.º 3
0
// Completely replaces the current image and the version in the image stack.
ILAPI void ILAPIENTRY ilReplaceCurImage(ILimage *Image)
{
	if (iCurImage) {
		ilActiveImage(0);
		ilCloseImage(iCurImage);
	}
	ImageStack[ilGetCurName()] = Image;
	iCurImage = Image;
	return;
}
Ejemplo n.º 4
0
void CreateGDI()
{
	ILuint CopyName, CurName, CurImg, CurMip;

	hDC = GetDC(HWnd);
	hMemDC = CreateCompatibleDC(hDC);
	CurName = ilGetInteger(IL_CUR_IMAGE);
	CurImg = ilGetInteger(IL_ACTIVE_IMAGE);
	CurMip = ilGetInteger(IL_ACTIVE_MIPMAP);
	CopyName = ilCloneCurImage();
	ilBindImage(CopyName);
	//ilConvertImage(IL_BGR, IL_UNSIGNED_BYTE);
	hBitmap = ilutConvertToHBitmap(hDC);
	ilutGetBmpInfo((BITMAPINFO*)&BmpInfo);
	DeleteObject(SelectObject(hMemDC, hBitmap));
	ilBindImage(CurName);
	if (CurImg)
		ilActiveImage(CurImg);//ilBindImage(Undos[0]);
	if (CurMip)
		ilActiveMipmap(CurMip);
	ilDeleteImages(1, &CopyName);

	return;
}
Ejemplo n.º 5
0
ILboolean GenSides()
{
	ILubyte	*Buffer, *Data, Bpp, Bpc;
	ILuint	TempImage;
	ILenum	Format, Type;
	ILint	SizePlane, Bps, c, y, z, i;

	ilActiveImage(ActiveImage);
	Bpp = ilGetInteger(IL_IMAGE_BPP);
	Bpc = ilGetInteger(IL_IMAGE_BPC);
	Format = ilGetInteger(IL_IMAGE_FORMAT);
	Type = ilGetInteger(IL_IMAGE_TYPE);

	// Front
	TexID1 = ilutGLBindTexImage();
	Width = ilGetInteger(IL_IMAGE_WIDTH);
	Height = ilGetInteger(IL_IMAGE_HEIGHT);
	Depth = ilGetInteger(IL_IMAGE_DEPTH);
	ilGenImages(1, &TempImage);

	SizePlane = ilGetInteger(IL_IMAGE_PLANESIZE);

	SizePlane = Width * Height * Bpp * Bpc;
	Bps = Width * Bpp * Bpc;
	Data = ilGetData();

	// Left
	i = 0;
	Buffer = (ILubyte*)malloc(Height * Depth * Bpp * Bpc);
	for (y = 0; y < Height; y++) {
		for (z = 0; z < Depth; z++) {
			for (c = 0; c < Bpp * Bpc; c++) {
				Buffer[i++] = Data[z * SizePlane + y * Bps + c];
			}
		}
	}
	ilBindImage(TempImage);
	ilTexImage(Depth, Height, 1, Bpp, Format, Type, Buffer);
	TexID2 = ilutGLBindTexImage();
	free(Buffer);

	// Right
	ilBindImage(ImgId);
	ilActiveImage(ActiveImage);
	i = 0;
	Buffer = (ILubyte*)malloc(Height * Depth * Bpp * Bpc);
	for (y = 0; y < Height; y++) {
		for (z = 0; z < Depth; z++) {
			for (c = 0; c < Bpp * Bpc; c++) {
				Buffer[i++] = Data[z * SizePlane + y * Bps + (Width - 1) * Bpp * Bpc + c];
			}
		}
	}
	ilBindImage(TempImage);
	ilTexImage(Depth, Height, 1, Bpp, Format, Type, Buffer);
	TexID3 = ilutGLBindTexImage();
	free(Buffer);

	// Back
	ilBindImage(ImgId);
	ilActiveImage(ActiveImage);
	Buffer = (ILubyte*)malloc(Width * Height * Bpp * Bpc);
	ilCopyPixels(0, 0, Depth-1, Width, Height, 1, Format, Type, Buffer);
	ilBindImage(TempImage);
	ilTexImage(Width, Height, 1, Bpp, Format, Type, Buffer);
	TexID4 = ilutGLBindTexImage();
	free(Buffer);

	//ilDeleteImages(1, &ImgId);
	ilDeleteImages(1, &TempImage);

	ilBindImage(ImgId);

	return IL_TRUE;
}
Ejemplo n.º 6
0
// Window procedure, handles all messages for this program
LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
	static HMENU		hMenu;
	static ILuint		Colours;
	static RECT			Rect;
	static PAINTSTRUCT	ps;
    static HDROP		hDrop;

	static TCHAR OpenFilter[2048];
	static TCHAR SaveFilter[2048];
	static TCHAR *OFilter[] = {
		L"All Files (*.*)", L"*.*",
		L"Alias|Wavefront Files (*.pix)", L"*.pix",
		L"Cut Files (*.cut)", L"*.cut",
		L"Dcx Files (*.dcx)", L"*.dcx",
		L"Graphics Interchange Format (*.gif)", L"*.gif",
		L"Half-Life Model Files (*.mdl)", L"*.mdl",
		L"Homeworld Image Files (*.lif)", L"*.lif",
		L"Image Files (All Supported Types)", L"*.jpe;*.jpg;*.jpeg;*.lif;*.bmp;*.ico;*.pbm;*.pgm;*.pnm;*.ppm;*.png;*.bw;*.rgb;*.rgba;*.sgi;*.tga;*.tif;*.tiff;*.pcx;*.xpm;*.psp;*.psd;*.pix;*.pxr;*.cut;*.dcx",
		L"Jpeg Files (*.jpe, *.jpg, *.jpeg)", L"*.jpe;*.jpg;*.jpeg",
		L"Kodak Photo CD Files (*.pcd)", L"*.pcd",
		L"Microsoft Bitmap Files (*.bmp)", L"*.bmp",
		L"Microsoft DirectDraw Surface (*.dds)", L"*.dds",
		L"Microsoft Icon Files (*.ico, *.cur)", L"*.ico, *.cur",
		L"Multiple Network Graphics Files (*.mng)", L"*.mng",
		L"Paint Shop Pro Files (*.psp)", L"*.psp",
		L"PhotoShop Files (*.psd)", L"*.psd",
		L"Pic Files (*.pic)", L"*.pic",
		L"Pixar Files (*.pix)", L"*.pix",
		L"Portable AnyMap Files (*.pbm, *.pgm, *.pnm, *.ppm)", L"*.pbm;*.pgm;*.pnm;*.ppm",
		L"Portable Network Graphics Files (*.png)", L"*.png",
		L"Sgi Files (*.sgi)", L"*.bw;*.rgb;*.rgba;*.sgi",
		L"Targa Files (*.tga, *.vda, *.icb, *.vst)", L"*.tga;*.vda;*.icb;*.vst",
		L"Tiff Files (*.tif)", L"*.tif;*.tiff",
		L"Valve Texture Files (*.vtf)", L"*.vtf",
		L"Quake Wal Files (*.wal)", L"*.wal",
		L"X PixelMap (*.xpm)", L"*.xpm",
		L"ZSoft Pcx Files (*.pcx)", L"*.pcx",
		L"\0\0"
	};
	static TCHAR *SFilter[] = {
		L"All Files (*.*)", L"*.*",
		L"C-Style Header (*.h)", L"*.h",
		L"Jpeg Files (*.jpe, *.jpg, *.jpeg)", L"*.jpe;*.jpg;*.jpeg",
		L"Microsoft Bitmap Files (*.bmp)", L"*.bmp",
		L"Microsoft DirectDraw Surface (*.dds)", L"*.dds",
		L"PhotoShop Files (*.psd)", L"*.psd",
		L"Portable AnyMap Files (*.pbm, *.pgm, *.ppm)", L"*.pbm;*.pgm;*.ppm",
		L"Portable Network Graphics Files (*.png)", L"*.png",
		L"Sgi Files (*.sgi)", L"*.bw;*.rgb;*.rgba;*.sgi",
		L"Targa Files (*.tga)", L"*.tga",
		L"Tiff Files (*.tif)", L"*.tif",
		L"ZSoft Pcx Files (*.pcx)", L"*.pcx",
		L"\0\0"
	};
	static OPENFILENAME Ofn = {
		sizeof(OPENFILENAME),
		hWnd,
		NULL,
		OpenFilter,
		NULL,
		0,
		0,
		OpenFileName,
		2048,
		NULL,
		0,
		NULL,
		NULL,
		OFN_HIDEREADONLY | OFN_FILEMUSTEXIST | OFN_PATHMUSTEXIST,
		0,
		0,
		NULL,
		NULL,
		NULL,
		NULL
	};

	POINT  CurMouse;
	static POINT		PrevMouse;
	static ILboolean	MouseDown = IL_FALSE;

	static RECT			WinSize;

	unsigned int		currentColor = 0x80000000;
	unsigned int		originalColor = 0x80000000;
	bool				userClickedOK;
	ILclampf			Red = 255, Green = 255, Blue = 255;
	ILubyte				*AlphaChannel;
	ILenum				Origin;

	switch (message)
	{
		case WM_CREATE:
			GenFilterString(OpenFilter, OFilter);
			GenFilterString(SaveFilter, SFilter);

			hDC = GetDC(hWnd);
			DragAcceptFiles(hWnd, TRUE);

			ReleaseDC(hWnd, hDC);
			break;

		case WM_CLOSE:

#ifdef _DEBUG
		_CrtDumpMemoryLeaks();
#endif
			DestroyGDI();
			DestroyWindow(hWnd);
			UnregisterClass(TITLE, hInstance);
			break;

		case WM_DESTROY:
			PostQuitMessage(0);
			break;

		case WM_PAINT:
			GetWindowRect(HWnd, &WinSize);  // Shouldn't be here!
			hDC = BeginPaint(hWnd, &ps);
			//StretchBlt(hDC, 0, 0, WinSize.right - WinSize.left,
			//	WinSize.bottom - WinSize.top, BackHDC, 0, 0, 1, 1, SRCCOPY);
			WinSize.right -= WinSize.left;
			WinSize.bottom -= WinSize.top;
			WinSize.top = 0;
			WinSize.left = 0;
			FillRect(hDC, &WinSize, BackBrush);

            BitBlt(hDC, XOff, YOff, (WORD)BmpInfo.biWidth, (WORD)BmpInfo.biHeight, 
				  hMemDC, 0, 0, SRCCOPY);
			EndPaint(hWnd, &ps);
			ValidateRect(hWnd, NULL);
			break;

		case WM_KEYDOWN:
			if (wParam == VK_ESCAPE)
				PostQuitMessage(0);

			// View the next image in the animation chain.
			if (wParam == VK_RIGHT) {
				ilBindImage(Undos[0]);  // @TODO: Implement undos better with this.
				CurImage++;
				if (CurImage > ilGetInteger(IL_NUM_IMAGES))
					CurImage = 0;  // Go back to the beginning of the animation.
				ilActiveImage(CurImage);
				ilutRenderer(ILUT_WIN32);
				ResizeWin();
				CreateGDI();
			}

			if (wParam == '0') {
				ilBindImage(Undos[0]);  // @TODO: Implement undos better with this.
				ilutRenderer(ILUT_WIN32);
				ResizeWin();
				CreateGDI();
			}

			if (wParam == '1') {
				ilActiveMipmap(1);
				ilutRenderer(ILUT_WIN32);
				ResizeWin();
				CreateGDI();
			}
			else if (wParam == '2') {
				ilActiveMipmap(2);
				ilutRenderer(ILUT_WIN32);
				ResizeWin();
				CreateGDI();
			}
			else if (wParam == '3') {
				ilActiveMipmap(3);
				ilutRenderer(ILUT_WIN32);
				ResizeWin();
				CreateGDI();
			}
			else if (wParam == '4') {
				ilActiveMipmap(4);
				ilutRenderer(ILUT_WIN32);
				ResizeWin();
				CreateGDI();
			}
			else if (wParam == '5') {
				ilActiveMipmap(5);
				ilutRenderer(ILUT_WIN32);
				ResizeWin();
				CreateGDI();
			}
			else if (wParam == '6') {
				ilActiveMipmap(6);
				ilutRenderer(ILUT_WIN32);
				ResizeWin();
				CreateGDI();
			}
			else if (wParam == '7') {
				ilActiveMipmap(7);
				ilutRenderer(ILUT_WIN32);
				ResizeWin();
				CreateGDI();
			}
			else if (wParam == '8') {
				ilActiveMipmap(8);
				ilutRenderer(ILUT_WIN32);
				ResizeWin();
				CreateGDI();
			}
			else if (wParam == '9') {
				ilActiveMipmap(9);
				ilutRenderer(ILUT_WIN32);
				ResizeWin();
				CreateGDI();
			}

			// View the previous image in the animation chain.
			if (wParam == VK_LEFT) {
				ilBindImage(Undos[0]);  // @TODO: Implement undos better with this.
				CurImage--;
				if (CurImage < 0)
					CurImage = 0;
				ilActiveImage(CurImage);
				ilutRenderer(ILUT_WIN32);
				ResizeWin();
				CreateGDI();
			}

			if (wParam == VK_PRIOR) {
				if (!GetPrevImage())
					break;

				DestroyGDI();
				if (UndoSize == 0)
					UndoSize = 1;
				ilDeleteImages(UndoSize, Undos);
				UndoSize = 0;
				XOff = 0;
				YOff = 0;

				ilGenImages(1, Undos);
				ilBindImage(Undos[0]);

				//last_elapsed = SDL_GetTicks();
				if (!ilLoadImage(OpenFileName)) {
					wsprintf(CurFileName, L"%s", OpenFileName);
					wsprintf(NewTitle, L"%s - Could not open %s", TITLE, OpenFileName);
					SetWindowText(hWnd, NewTitle);
					return (0L);
				}
				CurImage = 0;
				//cur_elapsed = SDL_GetTicks();
				elapsed = cur_elapsed - last_elapsed;
				last_elapsed = cur_elapsed;

				ilutRenderer(ILUT_WIN32);
				ResizeWin();
				CreateGDI();

				wsprintf(CurFileName, L"%s", OpenFileName);
				wsprintf(NewTitle, L"%s - %s:  %u ms", TITLE, OpenFileName, (unsigned int)elapsed);
				SetWindowText(hWnd, NewTitle);
			}

			if (wParam == VK_NEXT) {
				if (!GetNextImage())
					break;

				DestroyGDI();
				if (UndoSize == 0)
					UndoSize = 1;
				ilDeleteImages(UndoSize, Undos);
				UndoSize = 0;
				XOff = 0;
				YOff = 0;

				ilGenImages(1, Undos);
				ilBindImage(Undos[0]);

				//last_elapsed = SDL_GetTicks();
				if (!ilLoadImage(OpenFileName)) {
					wsprintf(CurFileName, L"%s", OpenFileName);
					wsprintf(NewTitle, L"%s - Could not open %s", TITLE, OpenFileName);
					SetWindowText(hWnd, NewTitle);
					return (0L);
				}
				CurImage = 0;
				//cur_elapsed = SDL_GetTicks();
				elapsed = cur_elapsed - last_elapsed;
				last_elapsed = cur_elapsed;

				ilutRenderer(ILUT_WIN32);
				ResizeWin();
				CreateGDI();

				wsprintf(CurFileName, L"%s", OpenFileName);
				wsprintf(NewTitle, L"%s - %s:  %u ms", TITLE, OpenFileName, (unsigned int)elapsed);
				SetWindowText(hWnd, NewTitle);
			}

			InvalidateRect(hWnd, NULL, FALSE);
			break;

		// Moves the "viewport"
		case WM_MOUSEMOVE:
			if (!MouseDown)
				break;
			GetCursorPos(&CurMouse);

			XOff += CurMouse.x - PrevMouse.x;
			YOff += CurMouse.y - PrevMouse.y;

			PrevMouse.x = CurMouse.x;
			PrevMouse.y = CurMouse.y;
			InvalidateRect(hWnd, NULL, FALSE);
			break;

		case WM_LBUTTONDOWN:
			MouseDown = IL_TRUE;
			GetCursorPos(&PrevMouse);
			break;

		case WM_LBUTTONUP:
			MouseDown = IL_FALSE;
			break;

		case WM_DROPFILES:
			hDrop = (HDROP)wParam;
			DragQueryFile(hDrop, 0, OpenFileName, 512);

			DestroyGDI();
			ilDeleteImages(UndoSize, Undos);
			UndoSize = 0;

			ilGenImages(1, Undos);
			ilBindImage(Undos[0]);
			ilLoadImage(OpenFileName);
			CurImage = 0;

			ilutRenderer(ILUT_WIN32);
			ResizeWin();
			CreateGDI();

			wsprintf(CurFileName, L"%s", OpenFileName);
			wsprintf(NewTitle, L"%s - %s", TITLE, OpenFileName);
			SetWindowText(hWnd, NewTitle);

			DragFinish(hDrop);
			return 0;

		case WM_COMMAND:
			FilterType = LOWORD(wParam);
	
			switch (LOWORD(wParam))
			{
				case ID_FILE_EXIT:
					PostMessage(hWnd, WM_CLOSE, 0, 0);
					return (0L);

				case ID_HELP_ABOUT:
					DialogBox (hInstance,
						MAKEINTRESOURCE(IDD_DIALOG_ABOUT),
						hWnd,
						AboutDlgProc);
					return (0L);

				case ID_FILE_PROPERTIES:
					DialogBox (hInstance,
						MAKEINTRESOURCE(IDD_DIALOG_PROPERTIES),
						hWnd,
						PropertiesDlgProc);
					return (0L);

				case ID_BATCHCONVERT:
					DialogBox (hInstance,
						MAKEINTRESOURCE(IDD_DIALOG_BATCHCONV),
						hWnd,
						BatchDlgProc);
					return (0L);

				case ID_EFFECTS_COUNTCOLORS:
					Colours = iluColoursUsed();
					TCHAR ColourString[255];
					wsprintf(ColourString, L"The number of colours in this image is:  %d", Colours);
					MessageBox(NULL, ColourString, L"Colour Count", MB_OK);
					return (0L);

				case ID_EFFECTSTOOLS_BACKGROUNDCOLOUR:
					//userClickedOK = FSColorPickerDoModal(&currentColor, true, &originalColor, true, 0);
					userClickedOK = 0;

					if (userClickedOK) {
						Red = (ILfloat)((currentColor & 0xff0000) >> 16) / 255.0f;
						Green = (ILfloat)((currentColor & 0xff00) >> 8) / 255.0f;
						Blue = (ILfloat)(currentColor & 0xff) / 255.0f;

						ilClearColour(Red, Green, Blue, 1.0f);
					}

					return (0L);

				case ID_EDIT_COPY:
					ilutSetWinClipboard();
					return (0L);

				case ID_EDIT_PASTE:
					ILuint Test;
					ilGenImages(1, &Test);
					ilBindImage(Test);

					// Check if there's anything in the clipboard.
					if (!ilutGetWinClipboard()) {
						ilDeleteImages(1, &Test);
						return (0L);
					}
					ilDeleteImages(1, &Test);

					DestroyGDI();
					ilDeleteImages(UndoSize, Undos);
					UndoSize = 0;
					XOff = 0;
					YOff = 0;

					ilGenImages(1, Undos);
					ilBindImage(Undos[0]);
					ilutGetWinClipboard();

					wsprintf(CurFileName, L"Clipboard Paste");
					wsprintf(NewTitle, L"%s - Pasted from the Clipboard", TITLE);
					SetWindowText(hWnd, NewTitle);

					//ilConvertImage(IL_BGRA);
					ilutRenderer(ILUT_WIN32);
					ResizeWin();
					CreateGDI();
					return (0L);

				// @TODO:  Will probably fail if no image loaded!
				case ID_FILE_PRINT:
					/*PRINTDLG	Pd;
					DOCINFO		Di;
					//HDC			PrintDC;
					//HBITMAP		PrintReplace;

					memset(&Pd, 0, sizeof(PRINTDLG));
					Pd.lStructSize = sizeof(PRINTDLG);
					Pd.hwndOwner = hWnd;
					Pd.Flags = PD_RETURNDC;
					Pd.nCopies = 1;
					Pd.nFromPage = 0xFFFF;
					Pd.nToPage = 0xFFFF;
					Pd.nMinPage = 1;
					Pd.nMaxPage = 0xFFFF;

					if (!PrintDlg(&Pd))
						return (0L);

					Di.cbSize = sizeof(DOCINFO);
					Di.lpszDocName = L"DevIL Printing Test";
					Di.lpszOutput = NULL;
					Di.lpszDatatype = NULL;
					Di.fwType = 0;

					StartDoc(Pd.hDC, &Di);
					StartPage(Pd.hDC);

					//PrintDC = CreateCompatibleDC(Pd.hDC);
					//PrintReplace = (HBITMAP)SelectObject(PrintDC, hBitmap);
					StretchBlt(Pd.hDC, 0, 0, Width * 2, Height * 2, hMemDC, 0, 0, Width, Height, SRCCOPY);

					EndPage(Pd.hDC);
					EndDoc(Pd.hDC);
					//DeleteObject(PrintReplace);
					//DeleteDC(PrintDC);
					DeleteDC(Pd.hDC);*/

					ilutWinPrint(0, 0, ilGetInteger(IL_IMAGE_WIDTH) * 2, ilGetInteger(IL_IMAGE_HEIGHT) * 2, hDC);

					return (0L);

				case ID_FILE_LOAD:
					wsprintf(OpenFileName, L"*.*");
					Ofn.lpstrFilter = OpenFilter;
					Ofn.lpstrFile = OpenFileName;
					Ofn.lpstrTitle = L"Open File";
					Ofn.nFilterIndex = 1;
					Ofn.Flags = OFN_HIDEREADONLY | OFN_FILEMUSTEXIST | OFN_PATHMUSTEXIST;

					if (!GetOpenFileName(&Ofn))
						return (0L);

					DestroyGDI();
					if (UndoSize == 0)
						UndoSize = 1;
					ilDeleteImages(UndoSize, Undos);
					UndoSize = 0;
					XOff = 0;
					YOff = 0;

					ilGenImages(1, Undos);
					ilBindImage(Undos[0]);

					//last_elapsed = SDL_GetTicks();
					if (!ilLoadImage(OpenFileName))
						return (0L);
					CurImage = 0;
					//cur_elapsed = SDL_GetTicks();
					elapsed = cur_elapsed - last_elapsed;
					last_elapsed = cur_elapsed;

					//iluBuildMipmaps();

					//ilConvertImage(IL_RGBA, IL_UNSIGNED_BYTE);
					//ilEnable(IL_NVIDIA_COMPRESS);
					//ilEnable(IL_SQUISH_COMPRESS);
					//ilSetInteger(IL_DXTC_FORMAT, IL_DXT5);
					//free(ilCompressDXT(ilGetData(), ilGetInteger(IL_IMAGE_WIDTH), ilGetInteger(IL_IMAGE_HEIGHT), 1, IL_DXT5, &Size));
					//free(ilNVidiaCompressDXT(ilGetData(), ilGetInteger(IL_IMAGE_WIDTH), ilGetInteger(IL_IMAGE_HEIGHT), 1, IL_DXT5));

					ilutRenderer(ILUT_WIN32);
					ResizeWin();
					CreateGDI();

					wsprintf(CurFileName, L"%s", OpenFileName);
					wsprintf(NewTitle, L"%s - %s:  %u ms", TITLE, OpenFileName, (unsigned int)elapsed);
					SetWindowText(hWnd, NewTitle);

					return (0L);

				case ID_FILE_OPENURL:
					if (DialogBox(hInstance, MAKEINTRESOURCE(IDD_DIALOG_FILTER),
						hWnd, FilterDlgProc) != TRUE) {
						return (0L);
					}

					DestroyGDI();
					ilDeleteImages(UndoSize, Undos);
					UndoSize = 0;
					XOff = 0;
					YOff = 0;

					ilGenImages(1, Undos);
					ilBindImage(Undos[0]);
					/*if (!ilutWinLoadUrl(FilterEditString))
						return (0L);*/

					ilutRenderer(ILUT_WIN32);
					ResizeWin();
					CreateGDI();
					
					wsprintf(NewTitle, L"%s - %s", TITLE, FilterEditString);
					SetWindowText(hWnd, NewTitle);

					return (0L);

				case ID_FILE_SAVE:
					wsprintf(SaveFileName, L"monkey.tga");
					Ofn.lpstrFilter = SaveFilter;
					Ofn.lpstrFile = SaveFileName;
					Ofn.lpstrTitle = L"Save File";
					Ofn.nFilterIndex = 1;
					Ofn.Flags = OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT;

					if (!GetSaveFileName(&Ofn))
						return (0L);

					ilEnable(IL_FILE_OVERWRITE);
					//ilBindImage(Undos[0]);  //@TODO: Do better here...

					//last_elapsed = SDL_GetTicks();
					ilSaveImage(SaveFileName);

					//cur_elapsed = SDL_GetTicks();
					elapsed = cur_elapsed - last_elapsed;
					last_elapsed = cur_elapsed;

					wsprintf(CurFileName, L"%s", SaveFileName);
					wsprintf(NewTitle, L"%s - %s:  %u ms", TITLE, SaveFileName, (unsigned int)elapsed);
					SetWindowText(hWnd, NewTitle);

					return (0L);

				case ID_EDIT_UNDOLEVEL:
					if (DialogBox(hInstance, MAKEINTRESOURCE(IDD_DIALOG_FILTER),
						hWnd, FilterDlgProc) == TRUE) {
						NumUndosAllowed = FilterParamInt <= 10 ? FilterParamInt : 10;
					}
					return (0L);

				case ID_EDIT_UNDO:
					if (UndoSize && NumUndosAllowed) {
						ilDeleteImages(1, &Undos[UndoSize]);
						ilBindImage(Undos[--UndoSize]);
						ResizeWin();
						CreateGDI();
					}
					return (0L);

				case ID_EDIT_VIEWIMAGENUM:
					if (DialogBox(hInstance, MAKEINTRESOURCE(IDD_DIALOG_FILTER),
						hWnd, FilterDlgProc) == TRUE) {
						ilBindImage(Undos[0]);  // @TODO: Implement undos better with this.
						ilActiveImage(FilterParamInt);
						ilutRenderer(ILUT_WIN32);
						ResizeWin();
						CreateGDI();
					}
					return (0L);

				case ID_EDIT_VIEWFACE:
					if (DialogBox(hInstance, MAKEINTRESOURCE(IDD_DIALOG_FILTER),
						hWnd, FilterDlgProc) == TRUE) {
						ilActiveFace(FilterParamInt);
						ilutRenderer(ILUT_WIN32);
						ResizeWin();
						CreateGDI();
					}
					return (0L);

				case ID_EDIT_VIEWMIPMAP:
					if (DialogBox(hInstance, MAKEINTRESOURCE(IDD_DIALOG_FILTER),
						hWnd, FilterDlgProc) == TRUE) {
						ilActiveMipmap(FilterParamInt);
						ilutRenderer(ILUT_WIN32);
						ResizeWin();
						CreateGDI();
					}
					return (0L);

				case ID_EDIT_NEXT:
					ilBindImage(Undos[0]);  // @TODO: Implement undos better with this.
					CurImage++;
					ilActiveImage(CurImage);
					ilutRenderer(ILUT_WIN32);
					ResizeWin();
					CreateGDI();
					return (0L);

				case ID_EDIT_PREV:
					ilBindImage(Undos[0]);  // @TODO: Implement undos better with this.
					CurImage--;
					ilActiveImage(CurImage);
					ilutRenderer(ILUT_WIN32);
					ResizeWin();
					CreateGDI();
					return (0L);
			}


			if (++UndoSize > NumUndosAllowed) {
				if (NumUndosAllowed > 0) {
					UndoSize = NumUndosAllowed;
					ilDeleteImages(1, &Undos[0]);
					memcpy(Undos, Undos+1, NumUndosAllowed * sizeof(ILuint));
					ilBindImage(Undos[UndoSize]);
				}
			}

			if (NumUndosAllowed > 0) {
				ilGetIntegerv(IL_ACTIVE_IMAGE, (ILint*)&Undos[UndoSize]);
				/*ilGenImages(1, &Undos[UndoSize]);
				ilBindImage(Undos[UndoSize]);
				ilCopyImage(Undos[UndoSize-1]);*/
				Undos[UndoSize] = ilCloneCurImage();
				ilBindImage(Undos[UndoSize]);
			}

			DestroyGDI();
			switch (LOWORD(wParam))
			{
				case ID_CONVERT_PALETTE:
					ilConvertImage(IL_COLOUR_INDEX, IL_UNSIGNED_BYTE);
					break;

				case ID_CONVERT_RGB:
					ilConvertImage(IL_RGB, ilGetInteger(IL_IMAGE_TYPE));
					break;

				case ID_CONVERT_RGBA:
					ilConvertImage(IL_RGBA, ilGetInteger(IL_IMAGE_TYPE));
					break;

				case ID_CONVERT_BGR:
					ilConvertImage(IL_BGR, ilGetInteger(IL_IMAGE_TYPE));
					break;

				case ID_CONVERT_BGRA:
					ilConvertImage(IL_BGRA, ilGetInteger(IL_IMAGE_TYPE));
					break;

				case ID_CONVERT_LUMINANCE:
					ilConvertImage(IL_LUMINANCE, ilGetInteger(IL_IMAGE_TYPE));
					break;

				case ID_CONVERT_LUMINANCEALPHA:
					ilConvertImage(IL_LUMINANCE_ALPHA, ilGetInteger(IL_IMAGE_TYPE));
					break;

				case ID_EDIT_VIEWALPHA:
					Origin = ilGetInteger(IL_ORIGIN_MODE);
					AlphaChannel = ilGetAlpha(IL_UNSIGNED_BYTE);
					ilTexImage(ilGetInteger(IL_IMAGE_WIDTH), ilGetInteger(IL_IMAGE_HEIGHT),
						ilGetInteger(IL_IMAGE_DEPTH), 1, IL_LUMINANCE, IL_UNSIGNED_BYTE, AlphaChannel);
					free(AlphaChannel);
					ilRegisterOrigin(Origin);
					break;

				case ID_EFFECTS_FLIP:
					iluFlipImage();
					break;

				case ID_EFFECTS_MIRROR:
					iluMirror();
					break;

				case ID_FILTER_EMBOSS:
					iluEmboss();
					break;

				case ID_FILTER_EQUALIZE:
					iluEqualize();
					break;

				case ID_FILTER_ALIENIFY:
					iluAlienify();
					break;

				case ID_FILTER_NEGATIVE:
					iluNegative();
					break;

				case ID_EFFECTS_FILTERS_EDGEDETECT_EMBOSS:
					iluEdgeDetectE();
					break;

				case ID_EFFECTS_FILTERS_EDGEDETECT_SOBEL:
					iluEdgeDetectS();
					break;

				case ID_EFFECTS_FILTERS_EDGEDETECT_PREWITT:
					iluEdgeDetectP();
					break;

				case ID_FILTER_NOISE:
					if (DialogBox(hInstance, MAKEINTRESOURCE(IDD_DIALOG_FILTER),
						hWnd, FilterDlgProc) == TRUE) {
						iluNoisify(FilterParamFloat);
					}
					break;

				case ID_EFFECTS_FILTERS_WAVE:
					if (DialogBox(hInstance, MAKEINTRESOURCE(IDD_DIALOG_FILTER),
						hWnd, FilterDlgProc) == TRUE) {
						iluWave(FilterParamFloat);
					}
					break;

				case ID_FILTER_PIXELIZE:
					if (DialogBox(hInstance, MAKEINTRESOURCE(IDD_DIALOG_FILTER),
						hWnd, FilterDlgProc) == TRUE) {
						iluPixelize(FilterParamInt);
					}
					break;

				case ID_FILTERS_BLUR_AVERAGE:
					if (DialogBox(hInstance, MAKEINTRESOURCE(IDD_DIALOG_FILTER),
						hWnd, FilterDlgProc) == TRUE) {
						iluBlurAvg(FilterParamInt);
					}
					break;

				case ID_FILTERS_BLUR_GAUSSIAN:
					if (DialogBox(hInstance, MAKEINTRESOURCE(IDD_DIALOG_FILTER),
						hWnd, FilterDlgProc) == TRUE) {
						iluBlurGaussian(FilterParamInt);
						/*iluMatrixMode(ILU_CONVOLUTION_MATRIX);
						iluLoadFilter(ILU_FILTER_GAUSSIAN_5X5);
						iluApplyMatrix();*/
					}
					break;

				case ID_FILTER_GAMMACORRECT:
					if (DialogBox(hInstance, MAKEINTRESOURCE(IDD_DIALOG_FILTER),
						hWnd, FilterDlgProc) == TRUE) {
						iluGammaCorrect(FilterParamFloat);
					}
					break;

				case ID_FILTER_SHARPEN:
					if (DialogBox(hInstance, MAKEINTRESOURCE(IDD_DIALOG_FILTER),
						hWnd, FilterDlgProc) == TRUE) {
						iluSharpen(FilterParamFloat, 1);
					}
					break;

				case ID_EFFECTS_FILTERS_ROTATE:
					if (DialogBox(hInstance, MAKEINTRESOURCE(IDD_DIALOG_FILTER),
						hWnd, FilterDlgProc) == TRUE) {
						iluRotate(FilterParamFloat);
						ResizeWin();
					}
					break;

				case ID_EFFECTS_FILTERS_SCALE:
					HWnd = hWnd;
					iluImageParameter(ILU_FILTER, ILU_BILINEAR);
					DialogBox(hInstance, MAKEINTRESOURCE(IDD_DIALOG_RESIZE), hWnd, ResizeDlgProc);
					break;

			}

			CreateGDI();
			InvalidateRect(hWnd, NULL, FALSE);
			break;

		default:
		  return (DefWindowProc(hWnd, message, wParam, lParam));
	}

    return (0L);
}
Ejemplo n.º 7
0
    //---------------------------------------------------------------------
    Codec::DecodeResult ILImageCodec::decode(DataStreamPtr& input) const
    {

        // DevIL variables
        ILuint ImageName;

        ILint ImageFormat, BytesPerPixel, ImageType;
        ImageData* imgData = new ImageData();
        MemoryDataStreamPtr output;

        // Load the image
        ilGenImages( 1, &ImageName );
        ilBindImage( ImageName );

        // Put it right side up
        ilEnable(IL_ORIGIN_SET);
        ilSetInteger(IL_ORIGIN_MODE, IL_ORIGIN_UPPER_LEFT);

        // Keep DXTC(compressed) data if present
        ilSetInteger(IL_KEEP_DXTC_DATA, IL_TRUE);

        // Load image from stream, cache into memory
        MemoryDataStream memInput(input);
        ilLoadL( 
            mIlType, 
            memInput.getPtr(), 
            static_cast< ILuint >(memInput.size()));

        // Check if everything was ok
        ILenum PossibleError = ilGetError() ;
        if( PossibleError != IL_NO_ERROR ) {
            OGRE_EXCEPT( Exception::ERR_NOT_IMPLEMENTED,
                "IL Error",
                iluErrorString(PossibleError) ) ;
        }

        ImageFormat = ilGetInteger( IL_IMAGE_FORMAT );
        ImageType = ilGetInteger( IL_IMAGE_TYPE );

        // Convert image if ImageType is incompatible with us (double or long)
        if(ImageType != IL_BYTE && ImageType != IL_UNSIGNED_BYTE && 
			ImageType != IL_FLOAT &&
			ImageType != IL_UNSIGNED_SHORT && ImageType != IL_SHORT) {
            ilConvertImage(ImageFormat, IL_FLOAT);
			ImageType = IL_FLOAT;
        }
		// Converted paletted images
		if(ImageFormat == IL_COLOUR_INDEX)
		{
			ilConvertImage(IL_BGRA, IL_UNSIGNED_BYTE);
			ImageFormat = IL_BGRA;
			ImageType = IL_UNSIGNED_BYTE;
		}

        // Now sets some variables
        BytesPerPixel = ilGetInteger( IL_IMAGE_BYTES_PER_PIXEL ); 

        imgData->format = ILUtil::ilFormat2OgreFormat( ImageFormat, ImageType );
        imgData->width = ilGetInteger( IL_IMAGE_WIDTH );
        imgData->height = ilGetInteger( IL_IMAGE_HEIGHT );
        imgData->depth = ilGetInteger( IL_IMAGE_DEPTH );
        imgData->num_mipmaps = ilGetInteger ( IL_NUM_MIPMAPS );
        imgData->flags = 0;
		
		if(imgData->format == PF_UNKNOWN)
		{
			std::stringstream err;
			err << "Unsupported devil format ImageFormat=" << std::hex << ImageFormat << 
				" ImageType="<< ImageType << std::dec;
			ilDeleteImages( 1, &ImageName );
			
			OGRE_EXCEPT( Exception::ERR_NOT_IMPLEMENTED,
                err.str(),
                "ILImageCodec::decode" ) ;
		}

        // Check for cubemap
        //ILuint cubeflags = ilGetInteger ( IL_IMAGE_CUBEFLAGS );
		size_t numFaces = ilGetInteger ( IL_NUM_IMAGES ) + 1;
        if(numFaces == 6) 
			imgData->flags |= IF_CUBEMAP;
        else
            numFaces = 1; // Support only 1 or 6 face images for now
  
        // Keep DXT data (if present at all and the GPU supports it)
        ILuint dxtFormat = ilGetInteger( IL_DXTC_DATA_FORMAT );
        if(dxtFormat != IL_DXT_NO_COMP && Root::getSingleton().getRenderSystem()->getCapabilities()->hasCapability( RSC_TEXTURE_COMPRESSION_DXT ))
        {
			imgData->format = ILUtil::ilFormat2OgreFormat( dxtFormat, ImageType );
            imgData->flags |= IF_COMPRESSED;
            
            // Validate that this devil version saves DXT mipmaps
            if(imgData->num_mipmaps>0)
            {
                ilBindImage(ImageName);
                ilActiveMipmap(1);
                if((size_t)ilGetInteger( IL_DXTC_DATA_FORMAT ) != dxtFormat)
                {
                    imgData->num_mipmaps=0;
                    LogManager::getSingleton().logMessage(
                    "Warning: Custom mipmaps for compressed image "+input->getName()+" were ignored because they are not loaded by this DevIL version");
                }
            }
        }
        
        // Calculate total size from number of mipmaps, faces and size
        imgData->size = Image::calculateSize(imgData->num_mipmaps, numFaces, 
            imgData->width, imgData->height, imgData->depth, imgData->format);

        // Bind output buffer
        output.bind(new MemoryDataStream(imgData->size));
        size_t offset = 0;
        
        // Dimensions of current mipmap
        size_t width = imgData->width;
        size_t height = imgData->height;
        size_t depth = imgData->depth;
        
        // Transfer data
        for(size_t mip=0; mip<=imgData->num_mipmaps; ++mip)
        {   
            for(size_t i = 0; i < numFaces; ++i)
            {
                ilBindImage(ImageName);
                if(numFaces > 1)
                    ilActiveImage(i);
                if(imgData->num_mipmaps > 0)
                    ilActiveMipmap(mip);
                /// Size of this face
                size_t imageSize = PixelUtil::getMemorySize(
                        width, height, depth, imgData->format);
                if(imgData->flags & IF_COMPRESSED)
                {

                    // Compare DXT size returned by DevIL with our idea of the compressed size
                    if(imageSize == ilGetDXTCData(NULL, 0, dxtFormat))
                    {
                        // Retrieve data from DevIL
                        ilGetDXTCData((unsigned char*)output->getPtr()+offset, imageSize, dxtFormat);
                    } else
                    {
                        LogManager::getSingleton().logMessage(
                            "Warning: compressed image "+input->getName()+" size mismatch, devilsize="+StringConverter::toString(ilGetDXTCData(NULL, 0, dxtFormat))+" oursize="+
                            StringConverter::toString(imageSize));
                    }
                }
                else
                {
                    /// Retrieve data from DevIL
                    PixelBox dst(width, height, depth, imgData->format, (unsigned char*)output->getPtr()+offset);
                    ILUtil::toOgre(dst);
                }
                offset += imageSize;
            }
            /// Next mip
            if(width!=1) width /= 2;
            if(height!=1) height /= 2;
            if(depth!=1) depth /= 2;
        }

        // Restore IL state
        ilDisable(IL_ORIGIN_SET);
        ilDisable(IL_FORMAT_SET);

        ilDeleteImages( 1, &ImageName );

        DecodeResult ret;
        ret.first = output;
        ret.second = CodecDataPtr(imgData);


        return ret;
    }
Ejemplo n.º 8
0
UInt32 GUCEF_PLUGIN_CALLSPEC_PREFIX
IMGCODECPLUGIN_EncodeImage( void* pluginData      ,
                            void* codecData       ,
                            const char* codecType ,
                            TImage* inputImage    ,
                            TIOAccess* output     )
{
    UInt32 i = 0;
    UInt32 n = 0;
    TImageInfo* imageInfo = NULL;
    char codecTypeExt[ 256 ];

    /* generate an image ID and make that ID the ID of the current image */
    ilBindImage( ilGenImage() );

    /* Only 1 layer is supported atm */
    ilActiveLayer( 0 );

    imageInfo = &inputImage->imageInfo;
    for ( i=0; i<imageInfo->nrOfFramesInImage; ++i )
    {
        TImageFrameInfo* imageFrameInfo = &inputImage->frames[ i ].frameInfo;
        
        /* activate the frame */
        ilActiveImage( i );        

        for ( n=0; n<imageFrameInfo->nrOfMipmapLevels; ++n )
        {
            /* create a shortcut */
            TImageMipMapLevelInfo* mipInfo = &inputImage->frames[ i ].mipmapLevel[ n ].mipLevelInfo;
            void* imageBuffer = inputImage->frames[ i ].mipmapLevel[ n ].pixelData;

            /* activate the mip-map */
            ilActiveMipmap( n );
            
            /* hand the data over to DevIL */
            if ( IL_TRUE != ilTexImage( (ILuint)mipInfo->frameWidth                                                   ,
                                        (ILuint)mipInfo->frameHeight                                                  ,
                                        (ILuint)1                                                                     ,
                                        (ILubyte) GetChannelCountForFormat( mipInfo->pixelStorageFormat )             ,
                                        (ILenum)ConvertGUCEFPixelFormatToILPixelFormat( mipInfo->pixelStorageFormat ) ,
                                        (ILenum)ConvertGUCEFTypeToILType( mipInfo->pixelComponentDataType )           ,
                                        (void*)imageBuffer                                                            ) )
            {
                /* Failed to transfer the data over to DevIL */
                return 0;
            }
                        
        }
    }
    
    /* Make sure we prefix a dot before the codecType */    
    strcpy_s( codecTypeExt+1, 255, codecType );
    codecTypeExt[ 0 ] = '.';

    /* now we can perform the actual save */
    currentResource = output;
    if ( IL_TRUE == ilSaveF( ilTypeFromExt( codecTypeExt ), output ) )
    {
        currentResource = NULL;
        return 1;
    }
    
    currentResource = NULL;
    return 0;
}
Ejemplo n.º 9
0
UInt32 GUCEF_PLUGIN_CALLSPEC_PREFIX
IMGCODECPLUGIN_DecodeImage( void* pluginData      ,
                            void* codecData       ,
                            const char* codecType ,
                            TIOAccess* input      ,
                            TImage** imageOutput  ,
                            void** imageData      )
{
    UInt32 i=0, n=0, mipmapCount=0, frameCount=0;
    ILint imageID = 0, imageSize = 0;
    TImage* image = NULL;

    if ( ( NULL == codecType ) || ( NULL == input ) ) 
        return 0;
    
    /* generate an image ID and make that ID the ID of the current image */
    imageID = ilGenImage();
    ilBindImage( imageID );
    
    currentResource = input;
    
    if ( IL_TRUE == ilLoadF( ilTypeFromExt( codecType ), input ) )
    {        
        image = malloc( sizeof(TImage) );
        image->version = GUCEF_IMAGE_TIMAGE_VERSION;
        image->imageInfo.version = GUCEF_IMAGE_TIMAGEINFO_VERSION;
        frameCount = image->imageInfo.nrOfFramesInImage = (UInt32) ilGetInteger( IL_NUM_IMAGES );
        if ( frameCount == 0 )
        {
            /* DevIL returns a image count of 0 for single-image images */
            frameCount = image->imageInfo.nrOfFramesInImage = 1;
        }
        image->frames = (TImageFrame*) malloc( frameCount * sizeof( TImageFrame ) );

        /* Only 1 layer is supported atm */
        ilActiveLayer( 0 );
        
        for ( i=0; i<frameCount; ++i )
        {
            TImageFrame* imageFrame = &image->frames[ i ]; 
            imageFrame->version = GUCEF_IMAGE_TIMAGEFRAME_VERSION;

            /* activate the frame */
            ilActiveImage( i );
            
            /* init the TImageFrameInfo section */
            imageFrame->frameInfo.version = GUCEF_IMAGE_TIMAGEFRAMEINFO_VERSION;
            mipmapCount = imageFrame->frameInfo.nrOfMipmapLevels = (UInt32) ilGetInteger( IL_NUM_MIPMAPS );
            if ( mipmapCount == 0 )
            {
                /* DevIL returns a mipmap count of 0 images without mipmapping, we use 0 for the base image */
                mipmapCount = imageFrame->frameInfo.nrOfMipmapLevels = 1;
            }
            imageFrame->mipmapLevel = (TImageMipMapLevel*) malloc( mipmapCount * sizeof(TImageMipMapLevel) );
        
            for ( n=0; n<mipmapCount; ++n )
            {
                TImageMipMapLevel* mipmapLevel = &imageFrame->mipmapLevel[ n ]; 
                mipmapLevel->version = GUCEF_IMAGE_TIMAGEMIPMAPLEVEL_VERSION;
                
                /* activate the mip-map */
                ilActiveMipmap( n );
                
                // Converted paletted images
                if( ilGetInteger( IL_IMAGE_FORMAT ) == IL_COLOUR_INDEX )
                {
                    ilConvertImage( IL_BGRA, IL_UNSIGNED_BYTE );
                }
                
                /* init the TImageMipMapLevelInfo section */
                mipmapLevel->mipLevelInfo.version = GUCEF_IMAGE_TIMAGEMIPMAPLEVELINFO_VERSION;
                mipmapLevel->mipLevelInfo.pixelComponentDataType = DATATYPE_UINT8; /* DevIL only supports this type */
                mipmapLevel->mipLevelInfo.frameHeight = ilGetInteger( IL_IMAGE_HEIGHT );
                mipmapLevel->mipLevelInfo.frameWidth = ilGetInteger( IL_IMAGE_WIDTH );
                mipmapLevel->mipLevelInfo.pixelStorageFormat = ConvertILPixelFormatToGUCEFPixelFormat( ilGetInteger( IL_IMAGE_FORMAT ) );

                /* now we grab the pixel data */
                ilCompressFunc( IL_COMPRESS_NONE );
                mipmapLevel->pixelDataSizeInBytes = ilGetInteger( IL_IMAGE_SIZE_OF_DATA );
                mipmapLevel->pixelData = malloc( mipmapLevel->pixelDataSizeInBytes );
                memcpy( mipmapLevel->pixelData, ilGetData(), mipmapLevel->pixelDataSizeInBytes );
            }
        }
    }
    
    /*
     *  the image has been loaded into our GUCEF structures so we have no need for
     *  DevIL to store the data any more 
     */
    ilDeleteImage( imageID );
    
    *imageOutput = image;
    currentResource = NULL;
    
    return 1;
}
Ejemplo n.º 10
0
void ilFActiveMipmap_(int *RetVal, int *Number)
{
	*RetVal = ilActiveImage((unsigned int)*Number);
	return;
}