diff options
38 files changed, 5635 insertions, 0 deletions
diff --git a/DevIL/examples/Makefile.am b/DevIL/examples/Makefile.am new file mode 100644 index 00000000..7801eec9 --- /dev/null +++ b/DevIL/examples/Makefile.am @@ -0,0 +1,85 @@ +AM_CPPFLAGS = -I ../include/ + +devildir = @datadir@/devil +examplesdir = $(devildir)/examples + +if BUILD_MONOLITHIC +ilu_library = ../lib/libDevIL.la +ilut_library = ../lib/libDevIL.la +else #NOT BUILD_MONOLITHIC +ilu_library = ../lib/libILU.la +ilut_library = ../lib/libILUT.la +endif #BUILD_MONOLITHIC + +EXTRA_DIST = +examples_PROGRAMS = + +if BUILD_ILUT + +if USE_ALLEGRO +examples_PROGRAMS += ILUT_allegro +endif #USE_ALLEGRO + +if USE_DIRECTX +examples_PROGRAMS += ILUT_d3d ILUT_windows +endif #USE_DIRECTX + +if USE_SDL +examples_PROGRAMS += ILUT_sdl +endif #USE_SDL + +if USE_W32 +examples_PROGRAMS += ILUT_animation +endif #USE_W32 + +if USE_OPENGL +if USE_X11 +examples_PROGRAMS += ILUT_gl ILUT_volume +endif #USE_X11 +endif #USE_OPENGL + +endif #BUILD_ILUT + +if BUILD_ILU + +examples_PROGRAMS += ILU_overwrite ILU_read ILU_simple + +endif #BUILD_ILU + +ILUT_allegro_SOURCES = allegro_example/allegtest.c +ILUT_allegro_CFLAGS = $(alleg_CFLAGS) +ILUT_allegro_LDFLAGS = $(ilut_library) + +ILUT_sdl_SOURCES = sdl_example/sdl_test.c +ILUT_sdl_CFLAGS = $(SDL_CFLAGS) +ILUT_sdl_LDFLAGS = $(ilut_library) + +ILUT_animation_SOURCES = animation_example/AnimTest.cpp animation_example/resource.h animation_example/AnimTest.rc +#ILUT_animation_CFLAGS = +ILUT_animation_LDFLAGS = $(ilut_library) +EXTRA_DIST += animation_example/resources/OpenIL.ico + +ILUT_d3d_SOURCES = direct3d_example/d3dtest.cpp +ILUT_d3d_LDFLAGS = $(ilut_library) + +ILU_overwrite_SOURCES = file_overwrite_example/iotest.c +ILU_overwrite_LDFLAGS = $(ilu_library) + +ILUT_gl_SOURCES = opengl_example/gltest.c opengl_example/gltest.h +ILUT_gl_LDFLAGS = $(ilut_library) + +ILU_read_SOURCES = register_read_example/readtest.c +ILU_read_LDFLAGS = $(ilu_library) + +ILU_simple_SOURCES = simple_example/simple.c +ILU_simple_LDFLAGS = $(ilu_library) + +ILUT_volume_SOURCES = volume_example/3dtest.h volume_example/3dtest.c +ILUT_volume_LDFLAGS = $(ilut_library) + +ILUT_windows_SOURCES = windows_example/BatchConv.cpp windows_example/IL_windows.cpp windows_example/resource.h windows_example/IL_windows.rc +ILUT_windows_LDFLAGS = $(ilut_library) +EXTRA_DIST += windows_example/resources/OpenIL.ico + +.rc.o: + $(RC) $(RCFLAGS) $< -o $@ diff --git a/DevIL/examples/allegro_example/allegtest.c b/DevIL/examples/allegro_example/allegtest.c new file mode 100644 index 00000000..578f2ad1 --- /dev/null +++ b/DevIL/examples/allegro_example/allegtest.c @@ -0,0 +1,51 @@ +// Almost identical to Allegro's ex15.c + +#include <IL/il.h> +#include <IL/ilu.h> +#include <IL/ilut.h> +#include <allegro.h> +#include <stdlib.h> +#include <stdio.h> + + +int main(int argc, char *argv[]) +{ + BITMAP *Image; + PALETTE Pal; + ILuint Id; + + if (argc != 2) { + printf("Please specify a filename.\n"); + return 1; + } + + ilInit(); + ilGenImages(1, &Id); + ilBindImage(Id); + ilLoadImage(argv[1]); + +// if (ilGetInteger(IL_IMAGE_FORMAT) == GL_BGR || +// ilGetInteger(IL_IMAGE_FORMAT) == GL_BGRA) + ilSwapColours(); + + Image = (BITMAP*)ilutConvertToAlleg(Pal); + + allegro_init(); + install_keyboard(); + if (ilGetInteger(IL_IMAGE_BYTES_PER_PIXEL) == 8) { + set_color_depth(8); + set_palette(Pal); + } + else + set_color_depth(32); + set_gfx_mode(GFX_AUTODETECT, 640, 480, 0, 0); + + blit(Image, screen, 0, 0, (SCREEN_W - Image->w) / 2, + (SCREEN_H - Image->h) / 2, Image->w, Image->h); + + destroy_bitmap(Image); + + readkey(); + + return 0; +} diff --git a/DevIL/examples/animation_example/AnimTest.cpp b/DevIL/examples/animation_example/AnimTest.cpp new file mode 100644 index 00000000..dadd174f --- /dev/null +++ b/DevIL/examples/animation_example/AnimTest.cpp @@ -0,0 +1,379 @@ +//----------------------------------------------------------------------------- +// +// ImageLib Windows (GDI) Test Source +// Copyright (C) 2000 by Denton Woods +// Last modified: 08/26/2001 <--Y2K Compliant! =] +// +// Filename: testil/animtest/animtest.c +// +// Description: Animation test application for DevIL. +// +//----------------------------------------------------------------------------- + +#include <windows.h> +#ifdef _DEBUG +#define IL_DEBUG +#endif +#include <il/il.h> +#include <il/ilu.h> +#include <il/ilut.h> +#include "resource.h" + + +// Evil globals! +HINSTANCE hInstance; +HDC hDC, hMemDC = NULL; +HWND HWnd; + +#define BORDER_W 8 +#define MENU_H 46 +#define MIN_W 205 // Accomodate the menu bar. +#define MAX_W 400 +#define MAX_H 400 +#define TITLE "DevIL Animation Test" + +ILuint FilterType; +ILuint FilterParamInt; +ILfloat FilterParamFloat; +char FilterEditString[255]; +char NewTitle[512]; + +BITMAPINFOHEADER *BmpInfo = NULL; +HBITMAP *Bitmaps = NULL; +ILuint *Durations = NULL; +ILuint NumImages = 0, CurImage = 0; + +__int64 StartTime, TimerFreq; +double TimerRes; +bool IsPaused = false; + + +LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam); +void GenFilterString(char *Out, char **Strings); +void DisplayImage(void); +void LoadImages(char *FileName); + + +int APIENTRY WinMain(HINSTANCE hInst, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) +{ + MSG msg; + WNDCLASSEX wcex; + HACCEL hAccelTable; + + hInstance = hInst; + + wcex.cbSize = sizeof(WNDCLASSEX); + + wcex.style = CS_HREDRAW | CS_VREDRAW; + wcex.lpfnWndProc = (WNDPROC)WndProc; + wcex.cbClsExtra = 0; + wcex.cbWndExtra = 0; + wcex.hInstance = hInstance; + wcex.hIcon = LoadIcon(hInstance, MAKEINTRESOURCE(IDI_ICON1)); + wcex.hCursor = LoadCursor(NULL, IDC_ARROW); + wcex.hbrBackground = (HBRUSH)(COLOR_WINDOW+1); + wcex.lpszMenuName = (LPCSTR)IDR_MENU1; + wcex.lpszClassName = TITLE; + wcex.hIconSm = LoadIcon(wcex.hInstance, (LPCTSTR)IDI_ICON1); + + RegisterClassEx(&wcex); + + HWnd = CreateWindow(TITLE, TITLE, WS_OVERLAPPEDWINDOW | WS_VISIBLE, + 50, 50, 400, 300, NULL, NULL, hInstance, NULL); + if (HWnd == NULL) + return FALSE; + + // Display the window + ShowWindow(HWnd, nCmdShow); + UpdateWindow(HWnd); + + ilInit(); + ilEnable(IL_ORIGIN_SET); + ilEnable(IL_TYPE_SET); + ilEnable(IL_FORMAT_SET); + + ilOriginFunc(IL_ORIGIN_LOWER_LEFT); + ilTypeFunc(IL_UNSIGNED_BYTE); + ilFormatFunc(IL_BGR); + + // Is there a file to load from the command-line? + if (__argc > 1) { + LoadImages(__argv[1]); + } + + hAccelTable = LoadAccelerators(hInstance, (LPCTSTR)IDR_MENU1); + + while (GetMessage(&msg, NULL, 0, 0)) { + if (!TranslateAccelerator(msg.hwnd, hAccelTable, &msg)) { + TranslateMessage(&msg); + DispatchMessage(&msg); + } + } + + return msg.wParam; +} + + +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; +} + + +void DestroyGDI() +{ + ILuint i; + + if (Bitmaps) { + for (i = 0; i < NumImages; i++) { + DeleteObject(*(Bitmaps + i)); + } + } + + if (hMemDC) + DeleteDC(hMemDC); + + if (Bitmaps) + delete []Bitmaps; + if (BmpInfo) + delete []BmpInfo; + + Bitmaps = NULL; + BmpInfo = NULL; + hMemDC = NULL; + + return; +} + + +void DisplayImage() +{ + static PAINTSTRUCT ps; + static __int64 CurTime; + static double TimeElapsed; + + // Not created yet. + if (Durations == NULL || BmpInfo == NULL || Bitmaps == NULL) + return; + + if (!IsPaused) { + QueryPerformanceCounter((LARGE_INTEGER*)&CurTime); + TimeElapsed = (CurTime - StartTime) * TimerRes; + if (TimeElapsed * 1000 > Durations[CurImage]) { + StartTime = CurTime; + CurImage++; + if (CurImage >= NumImages) { + CurImage = 0; + } + SelectObject(hMemDC, Bitmaps[CurImage]); + } + } + + hDC = BeginPaint(HWnd, &ps); + BitBlt(hDC, 0, 0, (WORD)BmpInfo[CurImage].biWidth, (WORD)BmpInfo[CurImage].biHeight, + hMemDC, 0, 0, SRCCOPY); + EndPaint(HWnd, &ps); + + return; +} + + +// 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 HDROP hDrop; + + static char OpenFileName[2048]; + static char OpenFilter[2048]; + static char *OFilter[] = { + "All Files (*.*)", "*.*", + "Half-Life Model Files (*.mdl)", "*.mdl", + "Homeworld Image Files (*.lif)", "*.lif", + "Image Files (All Supported Types)", "*.jpe;*.jpg;*.jpeg;*.lif;*.bmp;*.ico;*.pbm;*.pgm;*.pnm;*.ppm;*.png;*.bw;*.rgb;*.rgba;*.sgi;*.tga;*.tif;*.tiff;*.pcx", + "Jpeg Files (*.jpe, *.jpg, *.jpeg)", "*.jpe;*.jpg;*.jpeg", + "Microsoft Bitmap Files (*.bmp)", "*.bmp", + "Microsoft Icon Files (*.ico)", "*.ico", + "OpenIL Files (*.oil)", "*.oil", + "Portable AnyMap Files (*.pbm, *.pgm, *.pnm, *.ppm)", "*.pbm;*.pgm;*.pnm;*.ppm", + "Portable Network Graphics Files (*.png)", "*.png", + "Sgi Files (*.sgi)", "*.bw;*.rgb;*.rgba;*.sgi", + "Targa Files (*.tga)", "*.tga", + "Tiff Files (*.tif)", "*.tif;*.tiff", + "Quake Wal Files (*.wal)", "*.wal", + "ZSoft Pcx Files (*.pcx)", "*.pcx", + "\0\0" + }; + + static OPENFILENAME Ofn = { + sizeof(OPENFILENAME), + hWnd, + NULL, + OpenFilter, + NULL, + 0, + 0, + OpenFileName, + 512, + NULL, + 0, + NULL, + NULL, + OFN_HIDEREADONLY | OFN_FILEMUSTEXIST | OFN_PATHMUSTEXIST, + 0, + 0, + NULL, + NULL, + NULL, + NULL + }; + + switch (message) + { + case WM_CREATE: + GenFilterString(OpenFilter, OFilter); + + hDC = GetDC(hWnd); + DragAcceptFiles(hWnd, TRUE); + + break; + + case WM_CLOSE: + DestroyGDI(); + ReleaseDC(hWnd, hDC); + DestroyWindow(hWnd); + UnregisterClass(TITLE, hInstance); + break; + + case WM_DESTROY: + PostQuitMessage(0); + break; + + case WM_PAINT: + DisplayImage(); + InvalidateRect(hWnd, NULL, FALSE); + break; + + case WM_KEYDOWN: + if (wParam == VK_ESCAPE) + PostQuitMessage(0); + InvalidateRect(hWnd, NULL, FALSE); + break; + + case WM_DROPFILES: + hDrop = (HDROP)wParam; + DragQueryFile(hDrop, 0, OpenFileName, 512); + + DestroyGDI(); + LoadImages(OpenFileName); + + 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_FILE_LOAD: + sprintf(OpenFileName, "*.*"); + Ofn.lpstrFilter = OpenFilter; + Ofn.lpstrFile = OpenFileName; + Ofn.lpstrTitle = "Open File"; + Ofn.nFilterIndex = 1; + Ofn.Flags = OFN_HIDEREADONLY | OFN_FILEMUSTEXIST | OFN_PATHMUSTEXIST; + + if (!GetOpenFileName(&Ofn)) + return (0L); + + DestroyGDI(); + LoadImages(OpenFileName); + + return (0L); + + case ID_EDIT_PAUSE: + IsPaused = true; + return 0; + + case ID_EDIT_RESUME: + IsPaused = false; + QueryPerformanceCounter((LARGE_INTEGER*)&StartTime); + return 0; + } + + default: + return (DefWindowProc(hWnd, message, wParam, lParam)); + } + + return (0L); +} + + +void GenFilterString(char *Out, char **Strings) +{ + int OutPos = 0, StringPos = 0; + + while (Strings[StringPos][0] != 0) { + sprintf(Out + OutPos, Strings[StringPos]); + OutPos += strlen(Strings[StringPos++]) + 1; + } + + Out[OutPos++] = 0; + Out[OutPos] = 0; + + return; +} diff --git a/DevIL/examples/animation_example/AnimTest.dsp b/DevIL/examples/animation_example/AnimTest.dsp new file mode 100644 index 00000000..cdbe6425 --- /dev/null +++ b/DevIL/examples/animation_example/AnimTest.dsp @@ -0,0 +1,121 @@ +# Microsoft Developer Studio Project File - Name="AnimTest" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Application" 0x0101
+
+CFG=AnimTest - Win32 Debug
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,
+!MESSAGE use the Export Makefile command and run
+!MESSAGE
+!MESSAGE NMAKE /f "AnimTest.mak".
+!MESSAGE
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE
+!MESSAGE NMAKE /f "AnimTest.mak" CFG="AnimTest - Win32 Debug"
+!MESSAGE
+!MESSAGE Possible choices for configuration are:
+!MESSAGE
+!MESSAGE "AnimTest - Win32 Release" (based on "Win32 (x86) Application")
+!MESSAGE "AnimTest - Win32 Debug" (based on "Win32 (x86) Application")
+!MESSAGE
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+CPP=cl.exe
+MTL=midl.exe
+RSC=rc.exe
+
+!IF "$(CFG)" == "AnimTest - Win32 Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "Release"
+# PROP BASE Intermediate_Dir "Release"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "../bin"
+# PROP Intermediate_Dir "obj"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /YX /FD /c
+# ADD CPP /nologo /MD /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /FD /c
+# SUBTRACT CPP /YX
+# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
+# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
+# ADD BASE RSC /l 0x409 /d "NDEBUG"
+# ADD RSC /l 0x409 /d "NDEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /machine:I386
+# ADD LINK32 user32.lib gdi32.lib comdlg32.lib shell32.lib /nologo /subsystem:windows /machine:I386
+
+!ELSEIF "$(CFG)" == "AnimTest - Win32 Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "Debug"
+# PROP BASE Intermediate_Dir "Debug"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir "../bin/debug"
+# PROP Intermediate_Dir "obj/debug"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /YX /FD /GZ /c
+# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /FD /GZ /c
+# SUBTRACT CPP /YX
+# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
+# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
+# ADD BASE RSC /l 0x409 /d "_DEBUG"
+# ADD RSC /l 0x409 /d "_DEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept
+# ADD LINK32 user32.lib gdi32.lib comdlg32.lib shell32.lib /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept
+
+!ENDIF
+
+# Begin Target
+
+# Name "AnimTest - Win32 Release"
+# Name "AnimTest - Win32 Debug"
+# Begin Group "Source Files"
+
+# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
+# Begin Source File
+
+SOURCE=.\AnimTest.cpp
+# End Source File
+# End Group
+# Begin Group "Header Files"
+
+# PROP Default_Filter "h;hpp;hxx;hm;inl"
+# Begin Source File
+
+SOURCE=.\resource.h
+# End Source File
+# End Group
+# Begin Group "Resource Files"
+
+# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
+# Begin Source File
+
+SOURCE=.\AnimTest.rc
+# End Source File
+# Begin Source File
+
+SOURCE=".\OpenIL.ico"
+# End Source File
+# End Group
+# End Target
+# End Project
diff --git a/DevIL/examples/animation_example/AnimTest.rc b/DevIL/examples/animation_example/AnimTest.rc new file mode 100644 index 00000000..2cc6902c --- /dev/null +++ b/DevIL/examples/animation_example/AnimTest.rc @@ -0,0 +1,109 @@ +//Microsoft Developer Studio generated resource script.
+//
+#include "resource.h"
+
+#define APSTUDIO_READONLY_SYMBOLS
+/////////////////////////////////////////////////////////////////////////////
+//
+// Generated from the TEXTINCLUDE 2 resource.
+//
+#define APSTUDIO_HIDDEN_SYMBOLS
+#include "windows.h"
+#undef APSTUDIO_HIDDEN_SYMBOLS
+#include "resource.h"
+
+/////////////////////////////////////////////////////////////////////////////
+#undef APSTUDIO_READONLY_SYMBOLS
+
+/////////////////////////////////////////////////////////////////////////////
+// English (U.S.) resources
+
+#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
+#ifdef _WIN32
+LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
+#pragma code_page(1252)
+#endif //_WIN32
+
+#ifdef APSTUDIO_INVOKED
+/////////////////////////////////////////////////////////////////////////////
+//
+// TEXTINCLUDE
+//
+
+2 TEXTINCLUDE DISCARDABLE
+BEGIN
+ "#define APSTUDIO_HIDDEN_SYMBOLS\r\n"
+ "#include ""windows.h""\r\n"
+ "#undef APSTUDIO_HIDDEN_SYMBOLS\r\n"
+ "#include ""resource.h""\r\n"
+ "\0"
+END
+
+3 TEXTINCLUDE DISCARDABLE
+BEGIN
+ "\r\n"
+ "\0"
+END
+
+1 TEXTINCLUDE DISCARDABLE
+BEGIN
+ "resource.h\0"
+END
+
+#endif // APSTUDIO_INVOKED
+
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Menu
+//
+
+IDR_MENU1 MENU DISCARDABLE
+BEGIN
+ POPUP "&File"
+ BEGIN
+ MENUITEM "&Open...\tCtrl+O", ID_FILE_LOAD
+ MENUITEM "E&xit\tEsc", ID_FILE_EXIT
+ END
+ POPUP "&Edit"
+ BEGIN
+ MENUITEM "&Pause", ID_EDIT_PAUSE
+ MENUITEM "&Resume", ID_EDIT_RESUME
+ END
+END
+
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Icon
+//
+
+// Icon with lowest ID value placed first to ensure application icon
+// remains consistent on all systems.
+IDI_ICON1 ICON DISCARDABLE "OpenIL.ico"
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Accelerator
+//
+
+IDR_MENU1 ACCELERATORS DISCARDABLE
+BEGIN
+ "O", ID_FILE_LOAD, VIRTKEY, CONTROL, NOINVERT
+END
+
+#endif // English (U.S.) resources
+/////////////////////////////////////////////////////////////////////////////
+
+
+
+#ifndef APSTUDIO_INVOKED
+/////////////////////////////////////////////////////////////////////////////
+//
+// Generated from the TEXTINCLUDE 3 resource.
+//
+
+
+/////////////////////////////////////////////////////////////////////////////
+#endif // not APSTUDIO_INVOKED
+
diff --git a/DevIL/examples/animation_example/OpenIL.ico b/DevIL/examples/animation_example/OpenIL.ico Binary files differnew file mode 100644 index 00000000..98900848 --- /dev/null +++ b/DevIL/examples/animation_example/OpenIL.ico diff --git a/DevIL/examples/animation_example/resource.h b/DevIL/examples/animation_example/resource.h new file mode 100644 index 00000000..7ff26234 --- /dev/null +++ b/DevIL/examples/animation_example/resource.h @@ -0,0 +1,75 @@ +//{{NO_DEPENDENCIES}} +// Microsoft Developer Studio generated include file. +// Used by AnimTest.rc +// +#define IDC_MYICON 2 +#define IDD_ABOUTBOX 103 +#define IDS_APP_TITLE 103 +#define IDM_ABOUT 104 +#define IDM_EXIT 105 +#define IDC_OPENIL 109 +#define IDR_MAINFRAME 128 +#define IDI_ICON1 155 +#define IDR_MENU1 167 +#define IDD_DIALOG_ABOUT 168 +#define IDC_ABOUT_VENDOR 1001 +#define IDC_ABOUT_VER_STRING 1002 +#define IDC_ABOUT_VER_NUM 1003 +#define IDC_FILTER_EDIT 1004 +#define IDC_FILTER_DESC_TEXT 1005 +#define IDC_ERROR1 1014 +#define IDC_ERROR2 1015 +#define IDC_ERROR3 1016 +#define IDC_ERROR4 1017 +#define IDC_ERROR5 1018 +#define IDC_ERROR6 1019 +#define IDC_OPENIL_LINK 1020 +#define ID_FILE_EXIT 32771 +#define ID_HELP_ABOUT 32772 +#define ID_CONVERT_RGB 32773 +#define ID_CONVERT_RGBA 32774 +#define ID_CONVERT_BGR 32775 +#define ID_CONVERT_BGRA 32776 +#define ID_CONVERT_LUMINANCE 32777 +#define ID_FILE_LOAD 32778 +#define ID_FILE_SAVE 32779 +#define ID_FILTER_BITFILTER1 32780 +#define ID_FILTER_BITFILTER2 32781 +#define ID_FILTER_BITFILTER3 32782 +#define ID_FILTER_EMBOSS 32783 +#define ID_FILTER_NOISE 32784 +#define ID_FILTER_PIXELIZE 32785 +#define ID_EFFECTS_FILTERS_SCALE 32786 +#define ID_EFFECTS_FILTERS_EDGEDETECT_SOBEL 32787 +#define ID_EFFECTS_FILTERS_EDGEDETECT_PREWITT 32788 +#define ID_EDIT_UNDO 32789 +#define ID_EDIT_UNDOLEVEL 32790 +#define ID_FILTERS_BLUR_AVERAGE 32791 +#define ID_FILTERS_BLUR_GAUSSIAN 32792 +#define ID_FILTER_GAMMACORRECT 32793 +#define ID_FILTER_ALIENIFY 32794 +#define ID_FILTER_SHARPEN 32795 +#define ID_FILTER_NEGATIVE 32796 +#define ID_EFFECTS_FLIP 32797 +#define ID_EFFECTS_MIRROR 32798 +#define ID_EFFECTS_COUNTCOLORS 32799 +#define ID_EDIT_COPY 32800 +#define ID_EDIT_PASTE 32801 +#define ID_EFFECTS_FILTERS_ROTATE 32802 +#define ID_EFFECTS_FILTERS_EDGEDETECT_EMBOSS 32804 +#define ID_FILE_OPENURL 32808 +#define ID_CONVERT_PALETTE 32809 +#define ID_EDIT_PAUSE 32810 +#define ID_EDIT_RESUME 32811 +#define IDC_STATIC -1 + +// Next default values for new objects +// +#ifdef APSTUDIO_INVOKED +#ifndef APSTUDIO_READONLY_SYMBOLS +#define _APS_NEXT_RESOURCE_VALUE 182 +#define _APS_NEXT_COMMAND_VALUE 32812 +#define _APS_NEXT_CONTROL_VALUE 1021 +#define _APS_NEXT_SYMED_VALUE 110 +#endif +#endif diff --git a/DevIL/examples/direct3d_example/CMakeLists.txt b/DevIL/examples/direct3d_example/CMakeLists.txt new file mode 100644 index 00000000..f45b11df --- /dev/null +++ b/DevIL/examples/direct3d_example/CMakeLists.txt @@ -0,0 +1,50 @@ +PROJECT(Example_D3D) + +FILE(GLOB Example_D3D_SRCS *.c *.cpp *.h ) + +INCLUDE_DIRECTORIES( + + ${CMAKE_CURRENT_SOURCE_DIR} + ${DevIL_SOURCE_DIR}/include + ${DevIL_SOURCE_DIR}/../include +) + + + +# +# for windows add the .def and .rc files to the source list +# +IF(WIN32) + IF(BUILD_SHARED_LIBS) + ENDIF(BUILD_SHARED_LIBS) +ENDIF(WIN32) + +ADD_EXECUTABLE(Example_D3D Example_D3D_SRCS) + +## add link sub library info + +TARGET_LINK_LIBRARIES(Example_D3D + + DevIL + DevILU + DevILUT + lcms + libjpeg + libmng + libpng + libtiff + zlib +) + +INCLUDE_DIRECTORIES( + + ${DevIL_SOURCE_DIR} + ${DevILU_SOURCE_DIR} + ${DevILUT_SOURCE_DIR} + ${LCMS_SOURCE_DIR} + ${LIBJPEG_SOURCE_DIR} + ${LIBMNG_SOURCE_DIR} + ${LIBPNG_SOURCE_DIR} + ${LIBTIFF_SOURCE_DIR} + ${ZLIB_SOURCE_DIR} +) diff --git a/DevIL/examples/direct3d_example/D3DTest.dsp b/DevIL/examples/direct3d_example/D3DTest.dsp new file mode 100644 index 00000000..a0c6bc07 --- /dev/null +++ b/DevIL/examples/direct3d_example/D3DTest.dsp @@ -0,0 +1,129 @@ +# Microsoft Developer Studio Project File - Name="D3DTest" - Package Owner=<4> +# Microsoft Developer Studio Generated Build File, Format Version 6.00 +# ** DO NOT EDIT ** + +# TARGTYPE "Win32 (x86) Application" 0x0101 + +CFG=D3DTest - Win32 Debug +!MESSAGE This is not a valid makefile. To build this project using NMAKE, +!MESSAGE use the Export Makefile command and run +!MESSAGE +!MESSAGE NMAKE /f "D3DTest.mak". +!MESSAGE +!MESSAGE You can specify a configuration when running NMAKE +!MESSAGE by defining the macro CFG on the command line. For example: +!MESSAGE +!MESSAGE NMAKE /f "D3DTest.mak" CFG="D3DTest - Win32 Debug" +!MESSAGE +!MESSAGE Possible choices for configuration are: +!MESSAGE +!MESSAGE "D3DTest - Win32 Release" (based on "Win32 (x86) Application") +!MESSAGE "D3DTest - Win32 Debug" (based on "Win32 (x86) Application") +!MESSAGE + +# Begin Project +# PROP AllowPerConfigDependencies 0 +# PROP Scc_ProjName "" +# PROP Scc_LocalPath "" +CPP=cl.exe +MTL=midl.exe +RSC=rc.exe + +!IF "$(CFG)" == "D3DTest - Win32 Release" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "Release" +# PROP BASE Intermediate_Dir "Release" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "obj" +# PROP Intermediate_Dir "obj" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /YX /FD /c +# ADD CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /FD /c +# SUBTRACT CPP /YX +# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 +# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 +# ADD BASE RSC /l 0x409 /d "NDEBUG" +# ADD RSC /l 0x409 /d "NDEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /machine:I386 +# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /machine:I386 /out:"..\bin\D3DTest.exe" + +!ELSEIF "$(CFG)" == "D3DTest - Win32 Debug" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "Debug" +# PROP BASE Intermediate_Dir "Debug" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "obj/debug" +# PROP Intermediate_Dir "obj/debug" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /YX /FD /GZ /c +# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /FR /FD /GZ /c +# SUBTRACT CPP /YX +# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 +# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 +# ADD BASE RSC /l 0x409 /d "_DEBUG" +# ADD RSC /l 0x409 /d "_DEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept +# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /debug /machine:I386 /out:"..\bin\debug\D3DTest.exe" /pdbtype:sept + +!ENDIF + +# Begin Target + +# Name "D3DTest - Win32 Release" +# Name "D3DTest - Win32 Debug" +# Begin Group "Source Files" + +# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" +# Begin Source File + +SOURCE=.\d3dtest.cpp +# End Source File +# End Group +# Begin Group "Header Files" + +# PROP Default_Filter "h;hpp;hxx;hm;inl" +# End Group +# Begin Group "Resource Files" + +# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe" +# End Group +# Begin Group "Common" + +# PROP Default_Filter "" +# Begin Source File + +SOURCE="..\..\..\MSVC\DirectX SDK\samples\Multimedia\Common\src\d3dapp.cpp" +# End Source File +# Begin Source File + +SOURCE="..\..\..\MSVC\DirectX SDK\samples\Multimedia\Common\src\d3dfont.cpp" +# End Source File +# Begin Source File + +SOURCE="..\..\..\MSVC\DirectX SDK\samples\Multimedia\Common\src\d3dutil.cpp" +# End Source File +# Begin Source File + +SOURCE="..\..\..\MSVC\DirectX SDK\samples\Multimedia\Common\src\dxutil.cpp" +# End Source File +# End Group +# End Target +# End Project diff --git a/DevIL/examples/direct3d_example/d3dtest.cpp b/DevIL/examples/direct3d_example/d3dtest.cpp new file mode 100644 index 00000000..fc2b77e9 --- /dev/null +++ b/DevIL/examples/direct3d_example/d3dtest.cpp @@ -0,0 +1,335 @@ +//----------------------------------------------------------------------------- +// +// ImageLib GL Test Source +// Copyright (C) 2000-2002 by Denton Woods +// Last modified: 04/28/2001 <--Y2K Compliant! =] +// +// Filename: testil/d3dtest/d3dtest.cpp +// +// Description: Sample implementation of a Direct3D 8.0a image viewer. +// +// +// 20040801 XIX: DX9 update, hopefully :) +// +//----------------------------------------------------------------------------- + + +#define STRICT +#include <stdio.h> +#include <math.h> + +#include <D3DX9.h> + +#include "dxstdafx.h" + +#include "D3DApp.h" +#include "D3DFile.h" +#include "D3DFont.h" +#include "D3DUtil.h" + +#ifdef _DEBUG +#define IL_DEBUG +#endif//_DEBUG +#include <il/ilut.h> + + +#pragma comment(lib, "d3d9.lib") +#pragma comment(lib, "d3dx9.lib") +#pragma comment(lib, "winmm.lib") + + +// +// +// Taken from the D3D 8.0a SDK Volumetric Texture Sample. +// +// + + +//----------------------------------------------------------------------------- +// Defines, constants, and global variables +//----------------------------------------------------------------------------- +struct VERTEX +{ + FLOAT x, y, z; + DWORD color; + FLOAT tu, tv; +}; + +#define D3DFVF_VERTEX (D3DFVF_XYZ|D3DFVF_DIFFUSE|D3DFVF_TEX1|D3DFVF_TEXCOORDSIZE2(0)) + +VERTEX g_vVertices[4] = +{ + { 1.0f,-1.0f, 0.0f, 0xffffffff, 1.0f, 1.0f }, + {-1.0f,-1.0f, 0.0f, 0xffffffff, 0.0f, 1.0f }, + { 1.0f, 1.0f, 0.0f, 0xffffffff, 1.0f, 0.0f }, + {-1.0f, 1.0f, 0.0f, 0xffffffff, 0.0f, 0.0f } +}; + + + + +//----------------------------------------------------------------------------- +// Name: class CMyD3DApplication +// Desc: Application class. The base class (CD3DApplication) provides the +// generic functionality needed in all Direct3D samples. CMyD3DApplication +// adds functionality specific to this sample program. +//----------------------------------------------------------------------------- +class CMyD3DApplication : public CD3DApplication +{ + CD3DFont* m_pFont; + LPDIRECT3DTEXTURE9 m_pTexture; + LPDIRECT3DVERTEXBUFFER9 m_pVB; + + HRESULT ConfirmDevice( D3DCAPS9*, DWORD, D3DFORMAT ); + +protected: + HRESULT OneTimeSceneInit(); + HRESULT InitDeviceObjects(); + HRESULT RestoreDeviceObjects(); + HRESULT InvalidateDeviceObjects(); + HRESULT DeleteDeviceObjects(); + HRESULT FinalCleanup(); + HRESULT Render(); + HRESULT FrameMove(); + +public: + CMyD3DApplication(); +}; + + + + +//----------------------------------------------------------------------------- +// Name: WinMain() +// Desc: Entry point to the program. Initializes everything, and goes into a +// message-processing loop. Idle time is used to render the scene. +//----------------------------------------------------------------------------- +INT WINAPI WinMain( HINSTANCE hInst, HINSTANCE, LPSTR, INT ) +{ + CMyD3DApplication d3dApp; + + if (__argc <= 1) + return 1; + + if( FAILED( d3dApp.Create( hInst ) ) ) + return 0; + + return d3dApp.Run(); +} + + + + +//----------------------------------------------------------------------------- +// Name: CMyD3DApplication() +// Desc: Application constructor. Sets attributes for the app. +//----------------------------------------------------------------------------- +CMyD3DApplication::CMyD3DApplication() +{ + m_strWindowTitle = _T("DevIL Direct3D Test"); +// m_bUseDepthBuffer = TRUE; + + m_pFont = new CD3DFont( _T("Arial"), 12, D3DFONT_BOLD ); + m_pTexture = NULL; + m_pVB = NULL; +} + + + + +//----------------------------------------------------------------------------- +// Name: OneTimeSceneInit() +// Desc: Called during initial app startup, this function performs all the +// permanent initialization. +//----------------------------------------------------------------------------- +HRESULT CMyD3DApplication::OneTimeSceneInit() +{ + return S_OK; +} + + + + +//----------------------------------------------------------------------------- +// Name: FrameMove() +// Desc: Called once per frame, the call is the entry point for animating +// the scene. +//----------------------------------------------------------------------------- +HRESULT CMyD3DApplication::FrameMove() +{ + return S_OK; +} + + + + +//----------------------------------------------------------------------------- +// Name: Render() +// Desc: Called once per frame, the call is the entry point for 3d +// rendering. This function sets up render states, clears the +// viewport, and renders the scene. +//----------------------------------------------------------------------------- +HRESULT CMyD3DApplication::Render() +{ + // Clear the viewport + m_pd3dDevice->Clear( 0L, NULL, D3DCLEAR_TARGET|D3DCLEAR_ZBUFFER, + 0x00000000, 1.0f, 0L ); + + // Begin the scene + if( SUCCEEDED( m_pd3dDevice->BeginScene() ) ) + { + // Draw the quad, with the volume texture + m_pd3dDevice->SetTexture( 0, m_pTexture ); +// m_pd3dDevice->SetVertexShader( D3DFVF_VERTEX ); + m_pd3dDevice->SetStreamSource( 0, m_pVB, sizeof(VERTEX) ); + m_pd3dDevice->DrawPrimitive( D3DPT_TRIANGLESTRIP, 0, 2); + + // Output statistics + m_pFont->DrawText( 2, 0, D3DCOLOR_ARGB(255,255,255,0), m_strFrameStats ); + m_pFont->DrawText( 2, 20, D3DCOLOR_ARGB(255,255,255,0), m_strDeviceStats ); + + // End the scene. + m_pd3dDevice->EndScene(); + } + + return S_OK; +} + + + + +//----------------------------------------------------------------------------- +// Name: InitDeviceObjects() +// Desc: Initialize scene objects. +//----------------------------------------------------------------------------- +HRESULT CMyD3DApplication::InitDeviceObjects() +{ + HRESULT hr; + + m_pFont->InitDeviceObjects( m_pd3dDevice ); + + ilInit(); + iluInit(); + ilutInit(); + ilutD3D8TexFromFile(m_pd3dDevice, __argv[1], &m_pTexture); + //D3DXCreateTextureFromFile(m_pd3dDevice, __argv[1], &m_pTexture); + + // Create a vertex buffer + { + if( FAILED( hr = m_pd3dDevice->CreateVertexBuffer( 4*sizeof(VERTEX), + D3DUSAGE_WRITEONLY, + D3DFVF_VERTEX, + D3DPOOL_MANAGED, &m_pVB ) ) ) + return hr; + + VERTEX* pVertices; + m_pVB->Lock( 0, 4*sizeof(VERTEX), (BYTE**)&pVertices, 0 ); + memcpy( pVertices, g_vVertices, sizeof(VERTEX)*4 ); + m_pVB->Unlock(); + } + + return S_OK; +} + + + + +//----------------------------------------------------------------------------- +// Name: RestoreDeviceObjects() +// Desc: Initialize scene objects. +//----------------------------------------------------------------------------- +HRESULT CMyD3DApplication::RestoreDeviceObjects() +{ + m_pFont->RestoreDeviceObjects(); + + // Set the matrices + D3DXVECTOR3 vEye( 0.0f, 0.0f,-3.0f ); + D3DXVECTOR3 vAt( 0.0f, 0.0f, 0.0f ); + D3DXVECTOR3 vUp( 0.0f, 1.0f, 0.0f ); + D3DXMATRIX matWorld, matView, matProj; + D3DXMatrixIdentity( &matWorld ); + D3DXMatrixLookAtLH( &matView, &vEye,&vAt, &vUp ); + FLOAT fAspect = m_d3dsdBackBuffer.Width / (FLOAT)m_d3dsdBackBuffer.Height; + D3DXMatrixPerspectiveFovLH( &matProj, D3DX_PI/4, fAspect, 1.0f, 100.0f ); + m_pd3dDevice->SetTransform( D3DTS_WORLD, &matWorld ); + m_pd3dDevice->SetTransform( D3DTS_VIEW, &matView ); + m_pd3dDevice->SetTransform( D3DTS_PROJECTION, &matProj ); + + // Set state + m_pd3dDevice->SetRenderState( D3DRS_DITHERENABLE, FALSE ); + m_pd3dDevice->SetRenderState( D3DRS_CLIPPING, FALSE ); + m_pd3dDevice->SetRenderState( D3DRS_CULLMODE, D3DCULL_NONE ); + m_pd3dDevice->SetRenderState( D3DRS_CLIPPING, FALSE ); + m_pd3dDevice->SetRenderState( D3DRS_LIGHTING, FALSE ); + m_pd3dDevice->SetRenderState( D3DRS_ZENABLE, FALSE ); + m_pd3dDevice->SetRenderState( D3DRS_ZWRITEENABLE, FALSE ); + + m_pd3dDevice->SetTextureStageState( 0, D3DTSS_COLOROP, D3DTOP_SELECTARG1 ); + m_pd3dDevice->SetTextureStageState( 0, D3DTSS_COLORARG1, D3DTA_TEXTURE ); + m_pd3dDevice->SetTextureStageState( 0, D3DTSS_COLORARG2, D3DTA_DIFFUSE ); + m_pd3dDevice->SetTextureStageState( 0, D3DTSS_ALPHAOP, D3DTOP_SELECTARG1 ); + m_pd3dDevice->SetTextureStageState( 0, D3DTSS_ALPHAARG1, D3DTA_TEXTURE ); + m_pd3dDevice->SetTextureStageState( 0, D3DTSS_ALPHAARG2, D3DTA_DIFFUSE ); + m_pd3dDevice->SetTextureStageState( 0, D3DTSS_MINFILTER, D3DTEXF_LINEAR ); + m_pd3dDevice->SetTextureStageState( 0, D3DTSS_MAGFILTER, D3DTEXF_LINEAR ); + + return S_OK; +} + + + + +//----------------------------------------------------------------------------- +// Name: InvalidateDeviceObjects() +// Desc: +//----------------------------------------------------------------------------- +HRESULT CMyD3DApplication::InvalidateDeviceObjects() +{ + m_pFont->InvalidateDeviceObjects(); + return S_OK; +} + + + + +//----------------------------------------------------------------------------- +// Name: DeleteDeviceObjects() +// Desc: Called when the app is exiting, or the device is being changed, +// this function deletes any device dependent objects. +//----------------------------------------------------------------------------- +HRESULT CMyD3DApplication::DeleteDeviceObjects() +{ + m_pFont->DeleteDeviceObjects(); + SAFE_RELEASE( m_pTexture ); + SAFE_RELEASE( m_pVB ); + + return S_OK; +} + + + + +//----------------------------------------------------------------------------- +// Name: FinalCleanup() +// Desc: Called before the app exits, this function gives the app the chance +// to cleanup after itself. +//----------------------------------------------------------------------------- +HRESULT CMyD3DApplication::FinalCleanup() +{ + SAFE_DELETE( m_pFont ); + return S_OK; +} + + + + +//----------------------------------------------------------------------------- +// Name: ConfirmDevice() +// Desc: Called during device intialization, this code checks the device +// for some minimum set of capabilities +//----------------------------------------------------------------------------- +HRESULT CMyD3DApplication::ConfirmDevice( D3DCAPS8* pCaps, DWORD dwBehavior, + D3DFORMAT Format ) +{ + return S_OK; +} diff --git a/DevIL/examples/opengl_example/CMakeLists.txt b/DevIL/examples/opengl_example/CMakeLists.txt new file mode 100644 index 00000000..218b8aca --- /dev/null +++ b/DevIL/examples/opengl_example/CMakeLists.txt @@ -0,0 +1,69 @@ +PROJECT(Example_GL) + +FILE(GLOB Example_GL_SRCS *.c *.cpp *.h ) + +INCLUDE_DIRECTORIES( + + ${CMAKE_CURRENT_SOURCE_DIR} + ${DevIL_SOURCE_DIR}/include + ${DevIL_SOURCE_DIR}/../include + ${DevIL_XTRA_SOURCE_DIR}/freeglut +) + +LINK_DIRECTORIES( + + ${DEVIL_LIB_DEST_DIR} + ${CMAKE_CURRENT_SOURCE_DIR} + ${DevIL_XTRA_SOURCE_DIR}/freeglut +) + +# +# for windows add the .def and .rc files to the source list +# +IF(WIN32) + ADD_DEFINITIONS(-DIL_USE_PRAGMA_LIBS) + + IF(BUILD_SHARED_LIBS) + ELSE(BUILD_SHARED_LIBS) + ADD_DEFINITIONS(-DIL_STATIC_LIB) + ENDIF(BUILD_SHARED_LIBS) +ENDIF(WIN32) + +SOURCE_GROUP(code FILES ${Example_GL_SRCS} ) + +ADD_EXECUTABLE(Example_GL Example_GL_SRCS) + +## add link sub library info + +TARGET_LINK_LIBRARIES(Example_GL + + DevIL + DevILU + DevILUT +) + +INCLUDE_DIRECTORIES( + + ${DevIL_SOURCE_DIR} + ${DevILU_SOURCE_DIR} + ${DevILUT_SOURCE_DIR} +) + +# +# Copy dlls into the output dir, so stuff just works from vcc +# +IF(WIN32) + + ADD_CUSTOM_COMMAND( TARGET Example_GL POST_BUILD COMMAND ${CMAKE_COMMAND} ARGS -E copy + ${DevIL_XTRA_SOURCE_DIR}/freeglut/freeglut.dll + ${CMAKE_CFG_INTDIR} + ) + + IF(BUILD_SHARED_LIBS) + ADD_CUSTOM_COMMAND( TARGET Example_GL POST_BUILD COMMAND ${CMAKE_COMMAND} ARGS -E copy + ${DEVIL_LIB_DEST_DIR}/*.dll + ${CMAKE_CFG_INTDIR} + ) + ENDIF(BUILD_SHARED_LIBS) + +ENDIF(WIN32) diff --git a/DevIL/examples/opengl_example/gltest.c b/DevIL/examples/opengl_example/gltest.c new file mode 100644 index 00000000..9c2cfebd --- /dev/null +++ b/DevIL/examples/opengl_example/gltest.c @@ -0,0 +1,250 @@ +//----------------------------------------------------------------------------- +// +// ImageLib GL Test Source +// Copyright (C) 2000-2002 by Denton Woods +// Last modified: 05/17/2002 <--Y2K Compliant! =] +// +// Filename: examples/gl example/gl example.c +// +// Description: Sample implementation of an OpenGL image viewer. +// +//----------------------------------------------------------------------------- + +// +// We use FreeGlut in Windows, because it's more stable. +// +#ifdef _WIN32 +#include <GL/freeglut.h> +#else +#include <GL/glut.h> +#endif + +#ifdef _DEBUG +#define IL_DEBUG +#endif//_DEBUG + +#include <IL/il.h> +#include <IL/ilu.h> +#include <IL/ilut.h> +#include "gltest.h" +#include <math.h> +#include <string.h> +#include <stdlib.h> +#include <stdio.h> + +// +// Easier to do this than change the project's settings in MSVC++. (I'm lazy!) +// +#ifdef _MSC_VER + + #pragma comment(lib, "freeglut.lib") + +// Prevent the console window from popping up. +//#pragma comment(linker, "/entry:mainCRTStartup") +//#pragma comment(linker, "/subsystem:windows") + +#endif + +char *FileName; +ILuint Width, Height, Window; + + + +void HandleDevILErrors () +{ + ILenum error = ilGetError (); + + if (error != IL_NO_ERROR) { + do { + printf ("\n\n%s\n", iluErrorString (error)); + } while ((error = ilGetError ())); + + exit (1); + } +} + +extern int main(int argc, char** argv); + +int main(int argc, char** argv) +{ + // No filename is specified on the command-line. + if (argc < 2) { + printf ("Please run as:\n\nDevIL_testGL image_filename\n"); + return 1; + } + FileName = argv[1]; // Set filename equal to the first argument. + + // + // Check if the shared lib's version matches the executable's version. + // + + + +// +// fixed to get the right numbers from the right library call... +// + if (ilGetInteger(IL_VERSION_NUM) < IL_VERSION || + iluGetInteger(ILU_VERSION_NUM) < ILU_VERSION || + ilutGetInteger(ILUT_VERSION_NUM) < ILUT_VERSION) { + printf ("DevIL library is out of date! Please upgrade\n"); + return 2; + } + + // Needed to initialize DevIL. + ilInit (); + + // GL cannot use palettes anyway, so convert early. + ilEnable (IL_CONV_PAL); + + // Gets rid of dithering on some nVidia-based cards. + ilutEnable (ILUT_OPENGL_CONV); + + // Generate the main image name to use. + ilGenImages (1, &ImgId); + + // Bind this image name. + ilBindImage (ImgId); + + // Loads the image specified by File into the ImgId image. + if (!ilLoadImage (FileName)) { + HandleDevILErrors (); + } + + // Make sure the window is in the same proportions as the image. + // Generate the appropriate width x height less than or equal to MAX_X x MAX_Y. + // Instead of just clipping Width x Height to MAX_X x MAX_Y, we scale to + // an appropriate size, so the image isn't stretched/squished. + Width = ilGetInteger (IL_IMAGE_WIDTH); + Height = ilGetInteger (IL_IMAGE_HEIGHT); + + if (Width > 0) { // Don't want a divide by 0... + if (Width > MAX_X) { + Width = MAX_X; + Height = (ILuint)(MAX_X / (ILfloat)ilGetInteger(IL_IMAGE_WIDTH) * Height); + } + } + if (Height > 0) { // Don't want a divide by 0... + if (Height > MAX_Y) { + Height = MAX_Y; + Width = (ILuint)(MAX_Y / (ILfloat)ilGetInteger(IL_IMAGE_HEIGHT) * Width); + } + } + + HandleDevILErrors (); + + // Standard glut initializations. + glutInit (&argc, argv); // Standard glut initialization. + glutInitDisplayMode (GLUT_RGB | GLUT_DOUBLE); + glutInitWindowPosition (100, 100); + glutInitWindowSize (Width, Height); + + Window = glutCreateWindow("Developer's Image Library (DevIL) Test"); + + glutDisplayFunc (DisplayFunc); + glutKeyboardFunc (KeyboardFunc); + + // Goes into our setup function. + if (Setup() == IL_FALSE) + return 1; + + // Enter the main (Free)GLUT processing loop + glutMainLoop(); + + // Clean up any loose ends. + CleanUp(); + + return 0; +} + + +// +// Standard glut resize function. +// +void ResizeFunc(int NewWidth, int NewHeight) +{ + glMatrixMode (GL_PROJECTION); + glLoadIdentity (); + + glViewport (0, 0, NewWidth, NewHeight); + glOrtho (0, Width, Height, 0, -1, 1); +} + + +// +// Standard glut display function. +// +void DisplayFunc() +{ + glClear(GL_COLOR_BUFFER_BIT); // Clear the colour buffer. + + // Texture a quad with our image that fills the entire window. + glBindTexture (GL_TEXTURE_2D, TexID); + + glBegin (GL_QUADS); + glTexCoord2f (0.0f, 0.0f); glVertex3i (0, 0, 0); + glTexCoord2f (1.0f, 0.0f); glVertex3i (Width, 0, 0); + glTexCoord2f (1.0f, 1.0f); glVertex3i (Width, Height, 0); + glTexCoord2f (0.0f, 1.0f); glVertex3i (0, Height, 0); + glEnd(); + + glutSwapBuffers(); // We use double buffering, so swap the buffers. +} + + +// +// Standard glut idle function +// +void IdleFunc() +{ + glutShowWindow (); + glutPostRedisplay (); +} + + +// +// Any keypress closes the window - standard glut keypress function. +// +void KeyboardFunc(unsigned char cChar, int nMouseX, int nMouseY) +{ + CleanUp(); // Clean up OpenGL. + glutDestroyWindow(Window); // Destroy the window. +#ifndef _WIN32 + // Must use this with regular glut, since it never returns control to main(). + exit(0); +#endif +} + + +// +// Setup OpenGL to use our image. +// +ILboolean Setup() +{ + glEnable (GL_TEXTURE_2D); // Enable texturing. + glMatrixMode (GL_PROJECTION); // We want to use the projection matrix. + glLoadIdentity (); // Loads the identity matrix into the current matrix. + + // Lets ILUT know to use its OpenGL functions. + ilutRenderer (ILUT_OPENGL); + + // Goes through all steps of sending the image to OpenGL. + TexID = ilutGLBindTexImage(); + + // We're done with our image, so we go ahead and delete it. + ilDeleteImages(1, &ImgId); + + glOrtho(0, Width, Height, 0, -1, 1); // Set up an orthographic projection with OpenGL. + + return IL_TRUE; +} + + +// +// Cleans up any loose ends. +// +void CleanUp() +{ + if (!bCleaned) // Can only delete the texture once. + glDeleteTextures (1, &TexID); // Delete our OpenGL texture. + bCleaned = IL_TRUE; // Want to make sure we only delete it once. +} diff --git a/DevIL/examples/opengl_example/gltest.h b/DevIL/examples/opengl_example/gltest.h new file mode 100644 index 00000000..e43f9d04 --- /dev/null +++ b/DevIL/examples/opengl_example/gltest.h @@ -0,0 +1,36 @@ +//----------------------------------------------------------------------------- +// +// ImageLib GL Test Source +// Copyright (C) 2000-2002 by Denton Woods +// Last modified: 10/13/2000 <--Y2K Compliant! =] +// +// Filename: examples/gl example/gl example.h +// +// Description: Sample implementation of an OpenGL image viewer. +// +//----------------------------------------------------------------------------- + +#ifndef GLTEST_H +#define GLTEST_H + +// We don't want a larger window than this. +#define MAX_X 640 +#define MAX_Y 480 + +// Function prototypes. +void DisplayFunc(void); +void CleanUp(void); +void ResizeFunc(int NewWidth, int NewHeight); +void IdleFunc(void); +void KeyboardFunc(unsigned char cChar, int nMouseX, int nMouseY); +ILboolean Setup(); + +// Has the main GL texture been deleted? +ILboolean bCleaned = 0; + +// GL texture ID +GLuint TexID = 0; +// IL image ID +ILuint ImgId = 0; + +#endif//GLTEST_H diff --git a/DevIL/examples/override_example/iotest.c b/DevIL/examples/override_example/iotest.c new file mode 100644 index 00000000..16f0e18a --- /dev/null +++ b/DevIL/examples/override_example/iotest.c @@ -0,0 +1,157 @@ +//----------------------------------------------------------------------------- +// +// ImageLib Source Example +// Copyright (C) 2000-2001 by Denton Woods +// Last modified: 09/06/2001 <--Y2K Compliant! =] +// +// Filename: examples/file override/file override.c +// +// Description: An example of overriding the DevIL reading and +// writing functions via ilSetRead and ilSetWrite. +// +//----------------------------------------------------------------------------- + +// Required include files. +#include <IL/il.h> +#include <IL/ilu.h> + +#include <stdio.h> + + +ILHANDLE ILAPIENTRY iOpenRead(const char *FileName) +{ + return (ILHANDLE)fopen(FileName, "rb"); +} + +ILvoid ILAPIENTRY iCloseRead(ILHANDLE Handle) +{ + fclose((FILE*)Handle); + return; +} + +ILHANDLE ILAPIENTRY iOpenWrite(const char *FileName) +{ + return (ILHANDLE)fopen(FileName, "wb"); +} + +ILvoid ILAPIENTRY iCloseWrite(ILHANDLE Handle) +{ + fclose((FILE*)Handle); + return; +} + +ILboolean ILAPIENTRY iEof(ILHANDLE Handle) +{ + return (feof((FILE*)Handle) != 0); +} + +ILint ILAPIENTRY iGetc(ILHANDLE Handle) +{ + return fgetc((FILE*)Handle); +} + +ILint ILAPIENTRY iPutc(ILubyte Char, ILHANDLE Handle) +{ + return fputc(Char, (FILE*)Handle); +} + +ILint ILAPIENTRY iRead(ILvoid *Buffer, ILuint Size, ILuint Number, ILHANDLE Handle) +{ + return fread(Buffer, Size, Number, (FILE*)Handle); +} + +ILint ILAPIENTRY iWrite(const ILvoid *Buffer, ILuint Size, ILuint Number, ILHANDLE Handle) +{ + return fwrite(Buffer, Size, Number, (FILE*)Handle); +} + +ILint ILAPIENTRY iReadSeek(ILHANDLE Handle, ILint Offset, ILint Mode) +{ + return fseek((FILE*)Handle, Offset, Mode); +} + +ILint ILAPIENTRY iWriteSeek(ILHANDLE Handle, ILint Offset, ILint Mode) +{ + return fseek((FILE*)Handle, Offset, Mode); +} + +ILint ILAPIENTRY iReadTell(ILHANDLE Handle) +{ + return ftell((FILE*)Handle); +} + +ILint ILAPIENTRY iWriteTell(ILHANDLE Handle) +{ + return ftell((FILE*)Handle); +} + + + + +int main(int argc, char **argv) +{ + ILuint ImgId; + ILenum Error; + + // We use the filename specified in the first argument of the command-line. + if (argc < 2) { + printf("Please specify a file to open.\n"); + return 1; + } + + // Check if the shared lib's version matches the executable's version. + if (ilGetInteger(IL_VERSION_NUM) < IL_VERSION || + iluGetInteger(ILU_VERSION_NUM) < ILU_VERSION) { + printf("DevIL version is different...exiting!\n"); + return 2; + } + + // Initialize DevIL. + ilInit(); + // Generate the main image name to use. + ilGenImages(1, &ImgId); + // Bind this image name. + ilBindImage(ImgId); + + + // Override the reading functions. + ilSetRead(iOpenRead, iCloseRead, iEof, iGetc, iRead, iReadSeek, iReadTell); + ilSetWrite(iOpenWrite, iCloseWrite, iPutc, iWriteSeek, iWriteTell, iWrite); + + + // Loads the image specified by File into the image named by ImgId. + if (!ilLoadImage(argv[1])) { + printf("Could not open file...exiting.\n"); + return 3; + } + + // Display the image's dimensions to the end user. + printf("Width: %d Height: %d Depth: %d Bpp: %d\n", ilGetInteger(IL_IMAGE_WIDTH), + ilGetInteger(IL_IMAGE_HEIGHT), ilGetInteger(IL_IMAGE_DEPTH), ilGetInteger(IL_IMAGE_BYTES_PER_PIXEL)); + + // Enable this to let us overwrite the destination file if it already exists. + ilEnable(IL_FILE_OVERWRITE); + + // If argv[2] is present, we save to this filename, else we save to test.tga. + if (argc > 2) + ilSaveImage(argv[2]); + else + ilSaveImage("test.tga"); + + + // Reset the reading / writing functions when we're done loading specially. + // This isn't required here, since we're exiting, but here's how it's done: + ilResetRead(); + ilResetWrite(); + + + // We're done with the image, so let's delete it. + ilDeleteImages(1, &ImgId); + + // Simple Error detection loop that displays the Error to the user in a human-readable form. + while ((Error = ilGetError())) { + printf("Error: %s\n", iluErrorString(Error)); + } + + return 0; +} diff --git a/DevIL/examples/register_read_example/readtest.c b/DevIL/examples/register_read_example/readtest.c new file mode 100644 index 00000000..b24113b1 --- /dev/null +++ b/DevIL/examples/register_read_example/readtest.c @@ -0,0 +1,108 @@ +//----------------------------------------------------------------------------- +// +// ImageLib Source Example +// Copyright (C) 2000-2001 by Denton Woods +// Last modified: 09/07/2001 <--Y2K Compliant! =] +// +// Filename: examples/register read/register read.c +// +// Description: An example of creating your own loading routine +// to use with DevIL -- uses a hypothetical format. +// +//----------------------------------------------------------------------------- + +// Required include files. +#include <IL/il.h> +#include <IL/ilu.h> +#include <stdio.h> + +ILboolean ILAPIENTRY LoadFunction(const char *FileName) +{ + ILuint Width, Height; + FILE *f = fopen(FileName, "rb"); + + if (f == NULL) + return IL_FALSE; + fread(&Width, 1, 4, f); + fread(&Height, 1, 4, f); + + if (!ilTexImage(Width, Height, 1, 3, IL_RGB, IL_UNSIGNED_BYTE, NULL)) { + fclose(f); + return IL_FALSE; + } + + // Set the origin via the register functions. + ilRegisterOrigin(IL_ORIGIN_UPPER_LEFT); + + fread(ilGetData(), 1, Width * Height * 3, f); + fclose(f); + + return IL_TRUE; +} + + +int main(int argc, char **argv) +{ + ILuint ImgId; + ILenum Error; + + // We use the filename specified in the first argument of the command-line. + if (argc < 2) { + printf("Please specify a file to open.\n"); + return 1; + } + + // Check if the shared lib's version matches the executable's version. + if (ilGetInteger(IL_VERSION_NUM) < IL_VERSION || + iluGetInteger(ILU_VERSION_NUM) < ILU_VERSION) { + printf("DevIL version is different...exiting!\n"); + return 2; + } + + // Initialize DevIL. + ilInit(); + + + // Set the loading function here. + ilRegisterLoad("xxx", LoadFunction); + + + // Generate the main image name to use. + ilGenImages(1, &ImgId); + // Bind this image name. + ilBindImage(ImgId); + // Loads the image specified by File into the image named by ImgId. + if (!ilLoadImage(argv[1])) { + printf("Could not open file...exiting.\n"); + return 3; + } + + // Display the image's dimensions to the end user. + printf("Width: %d Height: %d Depth: %d Bpp: %d\n", ilGetInteger(IL_IMAGE_WIDTH), + ilGetInteger(IL_IMAGE_HEIGHT), ilGetInteger(IL_IMAGE_DEPTH), ilGetInteger(IL_IMAGE_BYTES_PER_PIXEL)); + + // Enable this to let us overwrite the destination file if it already exists. + ilEnable(IL_FILE_OVERWRITE); + + // If argv[2] is present, we save to this filename, else we save to test.tga. + if (argc > 2) + ilSaveImage(argv[2]); + else + ilSaveImage("test.tga"); + + + // Remove the loading function when we're done using it or want to change it. + // This isn't required here, since we're exiting, but here's how it's done: + ilRemoveLoad("xxx"); + + + // We're done with the image, so let's delete it. + ilDeleteImages(1, &ImgId); + + // Simple Error detection loop that displays the Error to the user in a human-readable form. + while ((Error = ilGetError())) { + printf("Error: %s\n", iluErrorString(Error)); + } + + return 0; +} diff --git a/DevIL/examples/sdl_example/sdl_test.c b/DevIL/examples/sdl_example/sdl_test.c new file mode 100644 index 00000000..890c18a2 --- /dev/null +++ b/DevIL/examples/sdl_example/sdl_test.c @@ -0,0 +1,389 @@ +//----------------------------------------------------------------------------- +// +// ImageLib SDL Test Source +// Copyright (C) 2000 by Denton Woods +// Copyright (C) 2001 Nelson Rush. +// Last modified: 7/02/2001 +// +// Filename: testil/sdltest/sdl_test.c +// +// Description: SDL test application for DevIL. +// +//----------------------------------------------------------------------------- + +#include <IL/il.h> +#include <IL/ilu.h> +#include <IL/ilut.h> +#include <SDL.h> + +#include <stdlib.h> +#include <stdio.h> +#include <string.h> + + +#ifdef _WIN32 + #ifdef _DEBUG + #pragma comment(linker, "/NODEFAULTLIB:msvcrt.lib") + #endif//_DEBUG +#endif + + + +/* Bring up a window and play with it */ + +#define BENCHMARK_SDL + +#define NOTICE(X) printf("%s", X); + + +void DrawPict(SDL_Surface *screen, char *bmpfile, + int speedy, int flip, int nofade) +{ + SDL_Surface *picture; + SDL_Rect dest, update; + int i, centered; + int ncolors; + SDL_Color *colors, *cmap; + + /* Load the image into a surface */ + if ( bmpfile == NULL ) { + bmpfile = "sample.bmp"; /* Sample image */ + } +fprintf(stderr, "Loading picture: %s\n", bmpfile); + //picture = SDL_LoadBMP(bmpfile); + picture = ilutSDLSurfaceLoadImage(bmpfile); + if ( picture == NULL ) { + fprintf(stderr, "Couldn't load %s: %s\n", bmpfile, + SDL_GetError()); + return; + } + + /* Set the display colors -- on a hicolor display this is a no-op */ + if ( picture->format->palette ) { + ncolors = picture->format->palette->ncolors; + colors = (SDL_Color *)malloc(ncolors*sizeof(SDL_Color)); + cmap = (SDL_Color *)malloc(ncolors*sizeof(SDL_Color)); + memcpy(colors, picture->format->palette->colors, + ncolors*sizeof(SDL_Color)); + } else { + int r, g, b; + + /* Allocate 256 color palette */ + ncolors = 256; + colors = (SDL_Color *)malloc(ncolors*sizeof(SDL_Color)); + cmap = (SDL_Color *)malloc(ncolors*sizeof(SDL_Color)); + + /* Set a 3,3,2 color cube */ + for ( r=0; r<8; ++r ) { + for ( g=0; g<8; ++g ) { + for ( b=0; b<4; ++b ) { + i = ((r<<5)|(g<<2)|b); + colors[i].r = r<<5; + colors[i].g = g<<5; + colors[i].b = b<<6; + } + } + } + } +NOTICE("testwin: setting colors\n"); + if ( ! SDL_SetColors(screen, colors, 0, ncolors) && + (screen->format->palette != NULL) ) { + fprintf(stderr, +"Warning: Couldn't set all of the colors, but SDL will map the image\n" +" (colormap fading will suffer - try the -warp option)\n" + ); + } + + /* Set the screen to black (not really necessary) */ + if ( SDL_LockSurface(screen) == 0 ) { + Uint32 black; + Uint8 *pixels; + + black = SDL_MapRGB(screen->format, 0, 0, 0); + pixels = (Uint8 *)screen->pixels; + for ( i=0; i<screen->h; ++i ) { + memset(pixels, black, + screen->w*screen->format->BytesPerPixel); + pixels += screen->pitch; + } + SDL_UnlockSurface(screen); + SDL_UpdateRect(screen, 0, 0, 0, 0); + } + + /* Display the picture */ + if ( speedy ) { + SDL_Surface *displayfmt; + +fprintf(stderr, "Converting picture\n"); + displayfmt = SDL_DisplayFormat(picture); + if ( displayfmt == NULL ) { + fprintf(stderr, + "Couldn't convert image: %s\n", SDL_GetError()); + goto done; + } + SDL_FreeSurface(picture); + picture = displayfmt; + } + printf("(image surface located in %s memory)\n", + (picture->flags&SDL_HWSURFACE) ? "video" : "system"); + centered = (screen->w - picture->w)/2; + if ( centered < 0 ) { + centered = 0; + } + dest.y = (screen->h - picture->h)/2; + dest.w = picture->w; + dest.h = picture->h; +NOTICE("testwin: moving image\n"); + for ( i=0; i<=centered; ++i ) { + dest.x = i; + update = dest; + if ( SDL_BlitSurface(picture, NULL, screen, &update) < 0 ) { + fprintf(stderr, "Blit failed: %s\n", SDL_GetError()); + break; + } + if ( flip ) { + SDL_Flip(screen); + } else { + SDL_UpdateRects(screen, 1, &update); + } + } + +#ifdef SCREENSHOT + if ( SDL_SaveBMP(screen, "screen.bmp") < 0 ) + printf("Couldn't save screen: %s\n", SDL_GetError()); +#endif + +#ifndef BENCHMARK_SDL + /* Let it sit there for a while */ + SDL_Delay(5*1000); +#endif + /* Fade the colormap */ + if ( ! nofade ) { + int maxstep; + SDL_Color final; + SDL_Color palcolors[256]; + struct { + Sint16 r, g, b; + } cdist[256]; + +NOTICE("testwin: fading out...\n"); + memcpy(cmap, colors, ncolors*sizeof(SDL_Color)); + maxstep = 32-1; + final.r = 0xFF; + final.g = 0x00; + final.b = 0x00; + memcpy(palcolors, colors, ncolors*sizeof(SDL_Color)); + for ( i=0; i<ncolors; ++i ) { + cdist[i].r = final.r-palcolors[i].r; + cdist[i].g = final.g-palcolors[i].g; + cdist[i].b = final.b-palcolors[i].b; + } + for ( i=0; i<=maxstep/2; ++i ) { /* halfway fade */ + int c; + for ( c=0; c<ncolors; ++c ) { + colors[c].r = + palcolors[c].r+((cdist[c].r*i))/maxstep; + colors[c].g = + palcolors[c].g+((cdist[c].g*i))/maxstep; + colors[c].b = + palcolors[c].b+((cdist[c].b*i))/maxstep; + } + SDL_SetColors(screen, colors, 0, ncolors); + SDL_Delay(1); + } + final.r = 0x00; + final.g = 0x00; + final.b = 0x00; + memcpy(palcolors, colors, ncolors*sizeof(SDL_Color)); + for ( i=0; i<ncolors; ++i ) { + cdist[i].r = final.r-palcolors[i].r; + cdist[i].g = final.g-palcolors[i].g; + cdist[i].b = final.b-palcolors[i].b; + } + maxstep /= 2; + for ( i=0; i<=maxstep; ++i ) { /* finish fade out */ + int c; + for ( c=0; c<ncolors; ++c ) { + colors[c].r = + palcolors[c].r+((cdist[c].r*i))/maxstep; + colors[c].g = + palcolors[c].g+((cdist[c].g*i))/maxstep; + colors[c].b = + palcolors[c].b+((cdist[c].b*i))/maxstep; + } + SDL_SetColors(screen, colors, 0, ncolors); + SDL_Delay(1); + } + for ( i=0; i<ncolors; ++i ) { + colors[i].r = final.r; + colors[i].g = final.g; + colors[i].b = final.b; + } + SDL_SetColors(screen, colors, 0, ncolors); +NOTICE("testwin: fading in...\n"); + memcpy(palcolors, colors, ncolors*sizeof(SDL_Color)); + for ( i=0; i<ncolors; ++i ) { + cdist[i].r = cmap[i].r-palcolors[i].r; + cdist[i].g = cmap[i].g-palcolors[i].g; + cdist[i].b = cmap[i].b-palcolors[i].b; + } + for ( i=0; i<=maxstep; ++i ) { /* 32 step fade in */ + int c; + for ( c=0; c<ncolors; ++c ) { + colors[c].r = + palcolors[c].r+((cdist[c].r*i))/maxstep; + colors[c].g = + palcolors[c].g+((cdist[c].g*i))/maxstep; + colors[c].b = + palcolors[c].b+((cdist[c].b*i))/maxstep; + } + SDL_SetColors(screen, colors, 0, ncolors); + SDL_Delay(1); + } +NOTICE("testwin: fading over\n"); + } + +done: + /* Free the picture and return */ + SDL_FreeSurface(picture); + free(colors); free(cmap); + return; +} + +int main(int argc, char *argv[]) +{ + SDL_Surface *screen; + /* Options */ + int speedy, flip, nofade; + int delay; + int w, h; + int desired_bpp; + Uint32 video_flags; +#ifdef BENCHMARK_SDL + Uint32 then, now; +#endif + /* Set default options and check command-line */ + + ilInit(); + speedy = 0; + flip = 0; + nofade = 0; + delay = 1; + w = 640; + h = 480; + desired_bpp = 0; + video_flags = 0; + while ( argc > 1 ) { + if ( strcmp(argv[1], "-speedy") == 0 ) { + speedy = 1; + argv += 1; + argc -= 1; + } else + if ( strcmp(argv[1], "-nofade") == 0 ) { + nofade = 1; + argv += 1; + argc -= 1; + } else + if ( strcmp(argv[1], "-delay") == 0 ) { + if ( argv[2] ) { + delay = atoi(argv[2]); + argv += 2; + argc -= 2; + } else { + fprintf(stderr, + "The -delay option requires an argument\n"); + exit(1); + } + } else + if ( strcmp(argv[1], "-width") == 0 ) { + if ( argv[2] && ((w = atoi(argv[2])) > 0) ) { + argv += 2; + argc -= 2; + } else { + fprintf(stderr, + "The -width option requires an argument\n"); + exit(1); + } + } else + if ( strcmp(argv[1], "-height") == 0 ) { + if ( argv[2] && ((h = atoi(argv[2])) > 0) ) { + argv += 2; + argc -= 2; + } else { + fprintf(stderr, + "The -height option requires an argument\n"); + exit(1); + } + } else + if ( strcmp(argv[1], "-bpp") == 0 ) { + if ( argv[2] ) { + desired_bpp = atoi(argv[2]); + argv += 2; + argc -= 2; + } else { + fprintf(stderr, + "The -bpp option requires an argument\n"); + exit(1); + } + } else + if ( strcmp(argv[1], "-warp") == 0 ) { + video_flags |= SDL_HWPALETTE; + argv += 1; + argc -= 1; + } else + if ( strcmp(argv[1], "-hw") == 0 ) { + video_flags |= SDL_HWSURFACE; + argv += 1; + argc -= 1; + } else + if ( strcmp(argv[1], "-flip") == 0 ) { + video_flags |= SDL_DOUBLEBUF; + argv += 1; + argc -= 1; + } else + if ( strcmp(argv[1], "-fullscreen") == 0 ) { + video_flags |= SDL_FULLSCREEN; + argv += 1; + argc -= 1; + } else + break; + } + + if ( SDL_Init(SDL_INIT_VIDEO) < 0 ) { + fprintf(stderr, + "Couldn't initialize SDL: %s\n", SDL_GetError()); + exit(1); + } + atexit(SDL_Quit); /* Clean up on exit */ + + /* Initialize the display */ + screen = SDL_SetVideoMode(w, h, desired_bpp, video_flags); + if ( screen == NULL ) { + fprintf(stderr, "Couldn't set %dx%dx%d video mode: %s\n", + w, h, desired_bpp, SDL_GetError()); + exit(1); + } + printf("Set %dx%dx%d mode\n", + screen->w, screen->h, screen->format->BitsPerPixel); + printf("(video surface located in %s memory)\n", + (screen->flags&SDL_HWSURFACE) ? "video" : "system"); + if ( screen->flags & SDL_DOUBLEBUF ) { + printf("Double-buffering enabled\n"); + flip = 1; + } + + /* Set the window manager title bar */ + SDL_WM_SetCaption("SDL test window", "testwin"); + + /* Do all the drawing work */ +#ifdef BENCHMARK_SDL + then = SDL_GetTicks(); + DrawPict(screen, argv[1], speedy, flip, nofade); + now = SDL_GetTicks(); + printf("Time: %d milliseconds\n", now-then); +#else + DrawPict(screen, argv[1], speedy, flip, nofade); +#endif + SDL_Delay(delay*1000); + return(0); +} diff --git a/DevIL/examples/simple_example/simple.c b/DevIL/examples/simple_example/simple.c new file mode 100644 index 00000000..b0451fc5 --- /dev/null +++ b/DevIL/examples/simple_example/simple.c @@ -0,0 +1,81 @@ +//----------------------------------------------------------------------------- +// +// DevIL Source Example +// Copyright (C) 2000-2002 by Denton Woods +// Last modified: 4/22/2002 <--Y2K Compliant! =] +// +// Filename: examples/Simple Example/simple.c +// +// Description: Simplest implementation of an DevIL application. +// Loads an image and saves it to a new image. +// The images can be of any format and can be different. +// +//----------------------------------------------------------------------------- + +// Required include files. +#include <IL/il.h> +#include <IL/ilu.h> +#include <stdio.h> + +int main(int argc, char **argv) +{ + ILuint ImgId; + ILenum Error; + + // We use the filename specified in the first argument of the command-line. + if (argc < 2) { + fprintf(stderr, "DevIL_test : DevIL simple command line application.\n"); + fprintf(stderr, "Usage : DevIL_test <file> [output]\n"); + fprintf(stderr, "Default output is test.tga\n"); + return 1; + } + + // Check if the shared lib's version matches the executable's version. + if (ilGetInteger(IL_VERSION_NUM) < IL_VERSION || + iluGetInteger(ILU_VERSION_NUM) < ILU_VERSION) { + printf("DevIL version is different...exiting!\n"); + return 2; + } + + // Initialize DevIL. + ilInit(); + + // Generate the main image name to use. + ilGenImages(1, &ImgId); + + // Bind this image name. + ilBindImage(ImgId); + + // Loads the image specified by File into the image named by ImgId. + if (!ilLoadImage(argv[1])) { + printf("Could not open file...exiting.\n"); + return 3; + } + + // Display the image's dimensions to the end user. + printf("Width: %d Height: %d Depth: %d Bpp: %d\n", + ilGetInteger(IL_IMAGE_WIDTH), + ilGetInteger(IL_IMAGE_HEIGHT), + ilGetInteger(IL_IMAGE_DEPTH), + ilGetInteger(IL_IMAGE_BITS_PER_PIXEL)); + + // Enable this to let us overwrite the destination file if it already exists. + ilEnable(IL_FILE_OVERWRITE); + + // If argv[2] is present, we save to this filename, else we save to test.tga. + if (argc > 2) + ilSaveImage(argv[2]); + else + ilSaveImage("test.tga"); + + // We're done with the image, so let's delete it. + ilDeleteImages(1, &ImgId); + + // Simple Error detection loop that displays the Error to the user in a human-readable form. + while ((Error = ilGetError())) { + printf("Error: %s\n", iluErrorString(Error)); + } + + return 0; + +} diff --git a/DevIL/examples/volume_example/3dtest.c b/DevIL/examples/volume_example/3dtest.c new file mode 100644 index 00000000..1b5b868d --- /dev/null +++ b/DevIL/examples/volume_example/3dtest.c @@ -0,0 +1,379 @@ +#ifdef _WIN32 +#include <GL/freeglut.h> +#else +#include <GL/glut.h> +#endif +#include <IL/il.h> +#include <IL/ilu.h> +//#define ILUT_USE_OPENGL +#include <IL/ilut.h> +#include "3dtest.h" +#include <math.h> +#include <string.h> +#include <stdio.h> +#include <stdlib.h> +#include <malloc.h> + +#ifdef _MSC_VER + #pragma comment(lib, "opengl32.lib") + #pragma comment(lib, "freeglut13.lib") + + // Prevent the console window from popping up. + #pragma comment(linker, "/entry:mainCRTStartup") + #pragma comment(linker, "/subsystem:windows") +#endif + +char *File; +ILint Width, Height, Depth, Window; +ILuint ActiveImage = 0; + +int main(int argc, char** argv) +{ + //char Test[6] = { 0, 0, 0, 0, 0, 0 }; + + if (argc < 2) { + //cout << "Please specify a filename." << endl; + return 1; + } + File = argv[1]; + + if (argc > 2) { + TransFactor = atoi(argv[2]) != 0 ? -atoi(argv[2]) : TransFactor; + } + + if (ilGetInteger(IL_VERSION_NUM) < IL_VERSION || + ilGetInteger(ILU_VERSION_NUM) < ILU_VERSION || + ilGetInteger(ILUT_VERSION_NUM) < ILUT_VERSION) { + //cout << "OpenIL version is different...exiting!" << endl; + return 2; + } + + ilInit(); + //ilEnable(IL_CONV_PAL); + ilutEnable(ILUT_OPENGL_CONV); + + glutInit(&argc, argv); + + ilGenImages(1, &ImgId); + ilBindImage(ImgId); + ilLoadImage(File); + + // Generate the appropriate width x height less than or equal to MAX_X x MAX_Y. + // Instead of just clipping Width x Height to MAX_X x MAX_Y, we scale to + // an appropriate size, so the image isn't stretched/squished. + Width = ilGetInteger(IL_IMAGE_WIDTH); + Height = ilGetInteger(IL_IMAGE_HEIGHT); + if (Width > 0) { // Don't want a divide by 0... + if (Width > MAX_X) { + Width = MAX_X; + Height = (ILuint)(MAX_X / (ILfloat)ilGetInteger(IL_IMAGE_WIDTH) * Height); + } + } + if (Height > 0) { // Don't want a divide by 0... + if (Height > MAX_Y) { + Height = MAX_Y; + Width = (ILuint)(MAX_Y / (ILfloat)ilGetInteger(IL_IMAGE_HEIGHT) * Width); + } + } + + glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH); + glutInitWindowPosition(100, 100); + glutInitWindowSize(Width, Height); + + Window = glutCreateWindow("Open Image Library (OpenIL) Test"); + glutDisplayFunc(DisplayFunc); + glutKeyboardFunc(KeyboardFunc); + glutSpecialFunc(KeySpecialFunc); + if (Setup() == IL_FALSE) + return 1; + + // Enter the main (Free)GLUT processing loop + glutMainLoop(); + + CleanUp(); + + return 0; +} + + +void ResizeFunc(int NewWidth, int NewHeight) +{ + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + + glViewport(0, 0, NewWidth, NewHeight); + //glOrtho(0, Width, 0, Height, -100, 1); + SetPerspective(50.0f); +} + + +void DisplayFunc() +{ + glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); + + glLoadIdentity(); + SetPerspective(50.0f); + glTranslatef(0.0f, 0.0f, TransFactor); + glRotatef(Angle, 0.0f, 1.0f, 0.0f); + + glBindTexture(GL_TEXTURE_2D, TexID1); + glBegin(GL_QUADS); + glTexCoord2f(0.0f, 0.0f); + glVertex3i(-Width, -Height, Depth); + glTexCoord2f(1.0f, 0.0f); + glVertex3i(Width, -Height, Depth); + glTexCoord2f(1.0f, 1.0f); + glVertex3i(Width, Height, Depth); + glTexCoord2f(0.0f, 1.0f); + glVertex3i(-Width, Height, Depth); + glEnd(); + + glBindTexture(GL_TEXTURE_2D, TexID2); + glBegin(GL_QUADS); + glTexCoord2f(0.0f, 0.0f); + glVertex3i(-Width, -Height, Depth); + glTexCoord2f(1.0f, 0.0f); + glVertex3i(-Width, -Height, -Depth); + glTexCoord2f(1.0f, 1.0f); + glVertex3i(-Width, Height, -Depth); + glTexCoord2f(0.0f, 1.0f); + glVertex3i(-Width, Height, Depth); + glEnd(); + + glBindTexture(GL_TEXTURE_2D, TexID3); + glBegin(GL_QUADS); + glTexCoord2f(0.0f, 0.0f); + glVertex3i(Width, -Height, Depth); + glTexCoord2f(1.0f, 0.0f); + glVertex3i(Width, -Height, -Depth); + glTexCoord2f(1.0f, 1.0f); + glVertex3i(Width, Height, -Depth); + glTexCoord2f(0.0f, 1.0f); + glVertex3i(Width, Height, Depth); + glEnd(); + + glBindTexture(GL_TEXTURE_2D, TexID4); + glBegin(GL_QUADS); + glTexCoord2f(0.0f, 0.0f); + glVertex3i(-Width, -Height, -Depth); + glTexCoord2f(1.0f, 0.0f); + glVertex3i(Width, -Height, -Depth); + glTexCoord2f(1.0f, 1.0f); + glVertex3i(Width, Height, -Depth); + glTexCoord2f(0.0f, 1.0f); + glVertex3i(-Width, Height, -Depth); + glEnd(); + + + glFlush(); + glFinish(); + glutSwapBuffers(); +} + + +void IdleFunc() +{ + glutShowWindow(); + glutPostRedisplay(); +} + + +void KeyboardFunc(unsigned char cChar, int nMouseX, int nMouseY) +{ + if (cChar >= '0' && cChar <= '9') { + ActiveImage = cChar - '0'; + CleanUp(); + GenSides(); + return; + } + if (cChar == '+' || cChar == '=') { + ActiveImage++; + CleanUp(); + GenSides(); + return; + } + if (cChar == '-' || cChar == '_') { + if (ActiveImage == 0) + return; + ActiveImage--; + CleanUp(); + GenSides(); + return; + } + + CleanUp(); + glutDestroyWindow(Window); +#ifndef _WIN32 + /* Siigron: added exit(), since glutDestroyWindow() doesn't exit the + program with "normal" GLUT */ + exit(0); +#endif +} + + +void KeySpecialFunc(int Key, int x, int y) +{ + switch (Key) + { + case GLUT_KEY_UP: + TransFactor += 10.0f; + //glTranslatef(0.0f, 0.0f, 10.0f); + break; + case GLUT_KEY_DOWN: + TransFactor -= 10.0f; + //glTranslatef(0.0f, 0.0f, -10.0f); + break; + case GLUT_KEY_RIGHT: + Angle += 10.0f; + //glRotatef(10.0f, 0.0f, 1.0f, 0.0f); + break; + case GLUT_KEY_LEFT: + Angle -= 10.0f; + //glRotatef(-10.0f, 0.0f, 1.0f, 0.0f); + break; + } + glutPostRedisplay(); + + return; +} + + +#define PI 3.14159265 +void SetPerspective(float Fov) +{ + float fov = (float)tan(Fov * .5f * PI / 180.0f); + float Aspect = 0.0f; + + if (Height != 0) + Aspect = Width / (float)Height; + + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + glFrustum(-fov * Aspect, fov * Aspect, -fov, fov, 1.0f, 10000.0f); + + return; +} + + +ILboolean Setup() +{ + glEnable(GL_DEPTH_TEST); + glDepthFunc(GL_LEQUAL); // or should this be GL_LESS? + glClearDepth(1); + + glEnable(GL_TEXTURE_2D); + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + + ilutRenderer(ILUT_OPENGL); + + if (!GenSides()) + return IL_FALSE; + + TransFactor += -Depth; + + glTranslatef(0.0f, 0.0f, -100.0f); + + return IL_TRUE; +} + + +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; +} + + +void CleanUp() +{ + glDeleteTextures(1, &TexID1); + glDeleteTextures(1, &TexID2); + glDeleteTextures(1, &TexID3); + glDeleteTextures(1, &TexID4); + return; +} + + +void ExitClean() +{ + if (!bCleaned) { + glDeleteTextures(1, &TexID1); + glDeleteTextures(1, &TexID2); + glDeleteTextures(1, &TexID3); + glDeleteTextures(1, &TexID4); + ilDeleteImages(1, &ImgId); + } + bCleaned = IL_TRUE; + return; +} diff --git a/DevIL/examples/volume_example/3dtest.h b/DevIL/examples/volume_example/3dtest.h new file mode 100644 index 00000000..b85139c3 --- /dev/null +++ b/DevIL/examples/volume_example/3dtest.h @@ -0,0 +1,25 @@ +#ifndef TEST3D_H +#define TEST3D_H + +#define MAX_X 640 +#define MAX_Y 480 + +void DisplayFunc(void); +void CleanUp(void); +void ExitClean(void); +void ResizeFunc(int NewWidth, int NewHeight); +void IdleFunc(void); +void KeyboardFunc(unsigned char cChar, int nMouseX, int nMouseY); +void KeySpecialFunc(int Key, int x, int y); +void SetPerspective(float Fov); +ILboolean Setup(void); +ILboolean GenSides(void); + +ILboolean bCleaned = IL_FALSE; + +GLuint TexID1 = 0, TexID2 = 0, TexID3 = 0, TexID4 = 0; +ILuint ImgId; + +float Angle = 0.0, TransFactor = -470.0; + +#endif//TEST3D_H diff --git a/DevIL/examples/windows_example/BatchConv.cpp b/DevIL/examples/windows_example/BatchConv.cpp new file mode 100644 index 00000000..9c8fd1f5 --- /dev/null +++ b/DevIL/examples/windows_example/BatchConv.cpp @@ -0,0 +1,161 @@ +#ifdef _DEBUG +#define IL_DEBUG +#endif//_DEBUG + +#include <il\il.h> +#include <windows.h> +#include <direct.h> +#include <string> +using namespace std; + +char *ImageExtArray[] = +{ + "jpe", "jpg", "jpeg", + "bmp", + "ico", + "pbm", "pgm", "pnm", "ppm", + "png", + "bw", "rgb", "rgba", "sgi", + "tga", "tif", "tiff", + "pcx", + NULL +}; + + +void ParseDirs(const string &_Dir, char **ExtList, char *ConvExt, bool Recurse); +bool IsDir(WIN32_FIND_DATA *_Data); +char *GetExtension(const char *FileName); +bool CheckExtension(char *Arg, char *Ext); + + +char *Ext; +string NewExt; +int i, j; + + +void BatchConv(char *Directory, char *ExtList, char *ConvExt, bool Recurse) +{ + ILuint Id, OrigId; + ilGenImages(1, &Id); + OrigId = ilGetInteger(IL_CUR_IMAGE); + ilBindImage(Id); + if (ExtList == NULL) + ParseDirs(string(Directory), ImageExtArray, ConvExt, Recurse); + else { + /*char **List = ConvertExtList(ExtList); + ParseDirs(string(Directory), ConvertExtList(ExtList), ConvExt, Recurse); + DestroyExtList(List);*/ + } + ilDeleteImages(1, &Id); + ilBindImage(OrigId); + return; +} + + +void ParseDirs(const string &_Dir, char **ExtList, char *ConvExt, bool Recurse) +{ + HANDLE Search; + WIN32_FIND_DATA FindData; + + _chdir(_Dir.c_str()); + Search = FindFirstFile("*.*", &FindData); + + do { + if (!strcmp(FindData.cFileName, ".") || !strcmp(FindData.cFileName, "..")) + continue; + if (IsDir(&FindData) && Recurse) { + _chdir(FindData.cFileName); + string NewDir = _Dir + string("\\"); + NewDir += FindData.cFileName; + ParseDirs(NewDir, ExtList, ConvExt, Recurse); + _chdir(".."); + } + Ext = GetExtension(FindData.cFileName); + if (Ext == NULL) + continue; + if (!_stricmp(Ext, ConvExt)) // Already has that extension. + continue; + for (j = 0; ExtList[j] != NULL; j++) { + if (CheckExtension(FindData.cFileName, ExtList[j])) { + string NewName; + for (i = 0; i < Ext - FindData.cFileName; i++) { + NewName += FindData.cFileName[i]; + } + NewName += ConvExt; + if (!ilLoadImage(FindData.cFileName)) + break; + ilSaveImage((char*)NewName.c_str()); + break; + } + } + } while (FindNextFile(Search, &FindData)); + + FindClose(Search); + return; +} + + +// Is the file actually a directory? +bool IsDir(WIN32_FIND_DATA *_Data) +{ + if (_Data->dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) + return true; + return false; +} + + +char *GetExtension(const char *FileName) +{ + bool PeriodFound = false; + char *Ext = (char*)FileName; + long i, Len = (long)strlen(FileName); + + if (FileName == NULL || !Len) // if not a good filename/extension, exit early + return NULL; + + Ext += Len; // start at the end + + for (i = Len; i >= 0; i--) { + if (*Ext == '.') { // try to find a period + PeriodFound = true; + break; + } + Ext--; + } + + if (!PeriodFound) // if no period, no extension + return NULL; + + return Ext+1; +} + + +// Simple function to test if a filename has a given extension, disregarding case +bool CheckExtension(char *Arg, char *Ext) +{ + bool PeriodFound = false; + char *Argu = Arg; // pointer to arg so we don't destroy arg + unsigned int i; + + if (Arg == NULL || Ext == NULL || !strlen(Arg) || !strlen(Ext)) // if not a good filename/extension, exit early + return false; + + Argu += strlen(Arg); // start at the end + + + for (i = (int)strlen(Arg); i >= 0; i--) { + if (*Argu == '.') { // try to find a period + PeriodFound = true; + break; + } + Argu--; + } + + if (!PeriodFound) // if no period, no extension + return false; + + if (!_stricmp(Argu+1, Ext)) // extension and ext match? + return true; + + return false; // if all else fails, return IL_FALSE +} diff --git a/DevIL/examples/windows_example/WindowsTest.aps b/DevIL/examples/windows_example/WindowsTest.aps Binary files differnew file mode 100644 index 00000000..83334898 --- /dev/null +++ b/DevIL/examples/windows_example/WindowsTest.aps diff --git a/DevIL/examples/windows_example/WindowsTest.cpp b/DevIL/examples/windows_example/WindowsTest.cpp new file mode 100644 index 00000000..4d9864e5 --- /dev/null +++ b/DevIL/examples/windows_example/WindowsTest.cpp @@ -0,0 +1,1161 @@ +//-------------------------------------------------------------------------------- +// +// ImageLib Windows (GDI) Test Source +// Copyright (C) 2000-2008 by Denton Woods +// Last modified: 08/22/2008 +// +// Filename: testil/windowstest/windowstest.c +// +// Description: Full GDI test application for DevIL. +// +// Note: This requires FluidStudio's Colour Picker library to compile +// properly (available at http://www.fluidstudios.com/publications.html). +// +//-------------------------------------------------------------------------------- + +#ifdef _DEBUG +#define IL_DEBUG +#endif//_DEBUG + +#define _UNICODE + +// Memory leak detection +#ifdef _DEBUG + #define _CRTDBG_MAP_ALLOC + #include <stdlib.h> + #include <crtdbg.h> +#endif + +#include <windows.h> +#include <IL/il.h> +#include <IL/ilu.h> +#include <IL/ilut.h> +//#include <sdl.h> +#include "resource.h" +#include <stdlib.h> +#include <wchar.h> + +//#pragma comment(lib, "sdl.lib") +//#pragma comment(lib, "sdlmain.lib") +#pragma comment(lib, "colorpicker.lib") + + +// Evil globals! +HINSTANCE hInstance; +HBITMAP hBitmap; +BITMAPINFOHEADER BmpInfo; +HDC hDC = 0, hMemDC = 0; +HWND HWnd; +HBRUSH BackBrush; + +#define BORDER_W 8 +#define MENU_H 54 +#define MIN_W 250 // Accomodate the menu bar. +#define MAX_W 400 +#define MAX_H 400 +#define TITLE L"DevIL Windows Test" +ILuint NumUndosAllowed = 4, UndoSize = 0; +ILuint Undos[11] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +ILuint Width, Height, Depth, CurImage; // Main image +TCHAR CurFileName[2048]; + +ILint XOff, YOff; + +ILdouble last_elapsed, cur_elapsed, elapsed; + +ILuint FilterType; +ILuint FilterParamInt; +ILfloat FilterParamFloat; +TCHAR FilterEditString[255]; + +TCHAR NewTitle[512]; + +LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam); +BOOL APIENTRY AboutDlgProc (HWND hDlg, UINT message, UINT wParam, LONG lParam); +BOOL APIENTRY PropertiesDlgProc (HWND hDlg, UINT message, UINT wParam, LONG lParam); +BOOL APIENTRY FilterDlgProc(HWND hDlg, UINT message, UINT wParam, LONG lParam); +BOOL APIENTRY ResizeDlgProc(HWND hDlg, UINT message, UINT wParam, LONG lParam); +BOOL APIENTRY BatchDlgProc(HWND hDlg, UINT message, UINT wParam, LONG lParam); +void BatchConv(char *Directory, char *ExtList, char *ConvExt, bool Recurse); +void GenFilterString(TCHAR *Out, TCHAR **Strings); +void ResizeWin(void); +void CreateGDI(void); +bool IsOpenable(TCHAR *FileName); + +extern "C" +// Colour picker export +__declspec( dllimport ) bool WINAPI FSColorPickerDoModal(unsigned int * currentColor, const bool currentColorIsDefault, unsigned int * originalColor, const bool originalColorIsDefault, const int initialExpansionState); + + + +int APIENTRY WinMain(HINSTANCE hInst, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) +{ + MSG msg; + WNDCLASSEX wcex; + HACCEL hAccelTable; + + hInstance = hInst; + + BackBrush = CreateSolidBrush(RGB(128,128,128)); + + wcex.cbSize = sizeof(WNDCLASSEX); + wcex.style = CS_HREDRAW | CS_VREDRAW; + wcex.lpfnWndProc = (WNDPROC)WndProc; + wcex.cbClsExtra = 0; + wcex.cbWndExtra = 0; + wcex.hInstance = hInstance; + wcex.hIcon = LoadIcon(hInstance, MAKEINTRESOURCE(IDI_ICON1)); + wcex.hCursor = LoadCursor(NULL, IDC_ARROW); + wcex.hbrBackground = BackBrush; + wcex.lpszMenuName = (LPCWSTR)IDR_MENU1; //@TODO: (LPCSTR)IDR_MENU1; + wcex.lpszClassName = TITLE; + wcex.hIconSm = LoadIcon(wcex.hInstance, (LPCTSTR)IDI_ICON1); + + RegisterClassEx(&wcex); + + HWnd = CreateWindow(TITLE, TITLE, WS_OVERLAPPEDWINDOW | WS_VISIBLE, + 50, 50, 400, 300, NULL, NULL, hInstance, NULL); + if (HWnd == NULL) + return FALSE; + + //if (SDL_Init(SDL_INIT_TIMER) < 0) + // return FALSE; + //atexit(SDL_Quit); + + // Display the window + ShowWindow(HWnd, nCmdShow); + UpdateWindow(HWnd); + + // Initialize DevIL + ilInit(); + iluInit(); + ilutRenderer(ILUT_WIN32); + + // Is there a file to load from the command-line? + if (__argc > 1) { + ilGenImages(1, Undos); + ilBindImage(Undos[0]); + /*if (ilLoadImage(__argv[1])) { + CurImage = 0; + //ilConvertImage(IL_BGRA); + ilutRenderer(ILUT_WIN32); + ResizeWin(); + CreateGDI(); + sprintf(NewTitle, "%s - %s", TITLE, __argv[1]); + SetWindowText(HWnd, NewTitle); + }*/ + } + + hAccelTable = LoadAccelerators(hInstance, (LPCTSTR)IDR_MENU1); + + while (GetMessage(&msg, NULL, 0, 0)) { + if (!TranslateAccelerator(msg.hwnd, hAccelTable, &msg)) { + TranslateMessage(&msg); + DispatchMessage(&msg); + } + } + +#ifdef _DEBUG + _CrtDumpMemoryLeaks(); +#endif + + return (int)msg.wParam; +} + + +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; +} + + +void DestroyGDI() +{ + if (hMemDC) { + DeleteObject(hBitmap); + DeleteDC(hMemDC); + } + if (hDC) { + ReleaseDC(HWnd, hDC); + } + hBitmap = NULL; + hMemDC = NULL; + hDC = NULL; + + return; +} + + +void ResizeWin() +{ + static RECT Rect1, Rect2; + static ILint NewW, NewH; + + SystemParametersInfo(SPI_GETWORKAREA, 0, &Rect1, 0); + + GetWindowRect(HWnd, &Rect2); + + Width = ilGetInteger(IL_IMAGE_WIDTH); + Height = ilGetInteger(IL_IMAGE_HEIGHT); + Depth = ilGetInteger(IL_IMAGE_DEPTH); + + NewW = Width < MIN_W ? MIN_W : Width + BORDER_W; + if (NewW + Rect2.left > Rect1.right) + NewW = Rect1.right - Rect2.left; + NewH = Height + MENU_H; + if (NewH + Rect2.top > Rect1.bottom) + NewH = Rect1.bottom - Rect2.top; + + SetWindowPos(HWnd, HWND_TOP, Rect2.left, Rect2.top, NewW, NewH, SWP_SHOWWINDOW); + InvalidateRect(HWnd, NULL, FALSE); + + return; +} + + +// 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 OpenFileName[2048]; + static TCHAR OpenFilter[2048]; + static TCHAR SaveFileName[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"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); + + 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(¤tColor, true, &originalColor, true, 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 = "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(); + ilDeleteImages(UndoSize, Undos); + UndoSize = 0; + XOff = 0; + YOff = 0; + + ilGenImages(1, Undos); + ilBindImage(Undos[0]); + + //last_elapsed = SDL_GetTicks(); + ilLoadImage(OpenFileName); + CurImage = 0; + //cur_elapsed = SDL_GetTicks(); + //elapsed = cur_elapsed - last_elapsed; + //last_elapsed = cur_elapsed; + elapsed = 0; + + ilutRenderer(ILUT_WIN32); + ResizeWin(); + CreateGDI(); + + wsprintf(CurFileName, L"%s", OpenFileName); + wsprintf(NewTitle, L"%s - %s: %g ms", TITLE, OpenFileName, 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); + ilSaveImage(SaveFileName); + + wsprintf(CurFileName, L"%s", SaveFileName); + wsprintf(NewTitle, L"%s - %s", TITLE, SaveFileName); + 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_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); +} + + +void GenFilterString(TCHAR *Out, TCHAR **Strings) +{ + int OutPos = 0, StringPos = 0; + + while (Strings[StringPos][0] != 0) { + wsprintf(Out + OutPos, Strings[StringPos]); + OutPos += (int)wcslen(Strings[StringPos++]) + 1; + } + + Out[OutPos++] = 0; + Out[OutPos] = 0; + + return; +} + + +BOOL APIENTRY AboutDlgProc(HWND hDlg, UINT message, UINT wParam, LONG lParam) +{ + switch (message) + { + case WM_INITDIALOG: + { + int i; + ILenum ilError; + TCHAR VersionNum[256]; + + wsprintf(VersionNum, L"Num: %d", ilGetInteger(IL_VERSION_NUM)); + + SetDlgItemText(hDlg, IDC_ABOUT_VENDOR, ilGetString(IL_VENDOR)); + SetDlgItemText(hDlg, IDC_ABOUT_VER_STRING, ilGetString(IL_VERSION_NUM)); + SetDlgItemText(hDlg, IDC_ABOUT_VER_NUM, VersionNum); + + for (i = 0; i < 6; i++) { + ilError = ilGetError(); + if (ilError == IL_NO_ERROR) + break; + SetDlgItemText(hDlg, IDC_ERROR1+i, iluErrorString(ilError)); + } + + return (TRUE); + } + break; + + case WM_COMMAND: + { + if (LOWORD(wParam) == IDOK) + EndDialog(hDlg, TRUE); + if (LOWORD(wParam) == IDCANCEL) + EndDialog(hDlg, FALSE); + } + break; + + case WM_CLOSE: + EndDialog(hDlg, TRUE); + break; + } + + return FALSE; +} + + +BOOL APIENTRY PropertiesDlgProc(HWND hDlg, UINT message, UINT wParam, LONG lParam) +{ + switch (message) + { + case WM_INITDIALOG: + { + TCHAR Temp[256]; + + SetDlgItemText(hDlg, IDC_PROP_FILENAME, CurFileName); + wsprintf(Temp, L"%d", ilGetInteger(IL_IMAGE_WIDTH)); + SetDlgItemText(hDlg, IDC_PROP_WIDTH, Temp); + wsprintf(Temp, L"%d", ilGetInteger(IL_IMAGE_HEIGHT)); + SetDlgItemText(hDlg, IDC_PROP_HEIGHT, Temp); + wsprintf(Temp, L"%d", ilGetInteger(IL_IMAGE_DEPTH)); + SetDlgItemText(hDlg, IDC_PROP_DEPTH, Temp); + wsprintf(Temp, L"%d", ilGetInteger(IL_IMAGE_SIZE_OF_DATA)); + SetDlgItemText(hDlg, IDC_PROP_SIZE, Temp); + + return (TRUE); + } + break; + + case WM_COMMAND: + { + if (LOWORD(wParam) == IDOK) + EndDialog(hDlg, TRUE); + if (LOWORD(wParam) == IDCANCEL) + EndDialog(hDlg, FALSE); + } + break; + + case WM_CLOSE: + EndDialog(hDlg, TRUE); + break; + } + + return FALSE; +} + + +BOOL APIENTRY FilterDlgProc(HWND hDlg, UINT message, UINT wParam, LONG lParam) +{ + switch (message) + { + case WM_INITDIALOG: + { + switch (FilterType) + { + case ID_FILTER_PIXELIZE: + SetDlgItemText(hDlg, IDC_FILTER_DESC_TEXT, L"Width of pixelized block:"); + SetDlgItemText(hDlg, IDC_FILTER_EDIT, L"1"); + break; + case ID_FILTER_NOISE: + SetDlgItemText(hDlg, IDC_FILTER_DESC_TEXT, L"Amount of noise threshold:"); + SetDlgItemText(hDlg, IDC_FILTER_EDIT, L"1.0"); + break; + case ID_EFFECTS_FILTERS_WAVE: + SetDlgItemText(hDlg, IDC_FILTER_DESC_TEXT, L"Angle of wave to apply:"); + SetDlgItemText(hDlg, IDC_FILTER_EDIT, L"0.0"); + break; + case ID_FILTERS_BLUR_AVERAGE: + SetDlgItemText(hDlg, IDC_FILTER_DESC_TEXT, L"Number of iterations:"); + SetDlgItemText(hDlg, IDC_FILTER_EDIT, L"1"); + break; + case ID_FILTERS_BLUR_GAUSSIAN: + SetDlgItemText(hDlg, IDC_FILTER_DESC_TEXT, L"Number of iterations:"); + SetDlgItemText(hDlg, IDC_FILTER_EDIT, L"1"); + break; + case ID_FILTER_GAMMACORRECT: + SetDlgItemText(hDlg, IDC_FILTER_DESC_TEXT, L"Amount of gamma correction:"); + SetDlgItemText(hDlg, IDC_FILTER_EDIT, L"1.0"); + break; + case ID_FILTER_SHARPEN: + SetDlgItemText(hDlg, IDC_FILTER_DESC_TEXT, L"Sharpening factor:"); + SetDlgItemText(hDlg, IDC_FILTER_EDIT, L"1.0"); + break; + case ID_EFFECTS_FILTERS_ROTATE: + SetDlgItemText(hDlg, IDC_FILTER_DESC_TEXT, L"Number of degress to rotate:"); + SetDlgItemText(hDlg, IDC_FILTER_EDIT, L"0.0"); + break; + + case ID_EDIT_UNDOLEVEL: + SetDlgItemText(hDlg, IDC_FILTER_DESC_TEXT, L"Set level of undo:"); + SetDlgItemText(hDlg, IDC_FILTER_EDIT, L"4"); + break; + case ID_EDIT_VIEWIMAGENUM: + SetDlgItemText(hDlg, IDC_FILTER_DESC_TEXT, L"Enter image number:"); + SetDlgItemText(hDlg, IDC_FILTER_EDIT, L"0"); + break; + case ID_EDIT_VIEWMIPMAP: + SetDlgItemText(hDlg, IDC_FILTER_DESC_TEXT, L"Enter mipmap number:"); + SetDlgItemText(hDlg, IDC_FILTER_EDIT, L"0"); + break; + case ID_FILE_OPENURL: + SetDlgItemText(hDlg, IDC_FILTER_DESC_TEXT, L"Enter url of image:"); + SetDlgItemText(hDlg, IDC_FILTER_EDIT, L""); + break; + } + + return TRUE; + } + break; + + case WM_COMMAND: + { + if (LOWORD(wParam) == IDOK) { + GetDlgItemText(hDlg, IDC_FILTER_EDIT, FilterEditString, 255); + FilterParamInt = _wtoi(FilterEditString); + FilterParamFloat = (float)_wtof(FilterEditString); + EndDialog(hDlg, TRUE); + } + if (LOWORD(wParam) == IDCANCEL) { + EndDialog(hDlg, FALSE); + } + } + break; + + case WM_CLOSE: + EndDialog(hDlg, TRUE); + break; + } + + return FALSE; +} + + +BOOL APIENTRY ResizeDlgProc(HWND hDlg, UINT message, UINT wParam, LONG lParam) +{ + static TCHAR x[255], y[255], z[255]; + static ILuint xsize, ysize, zsize; + static RECT Rect; + + switch (message) + { + case WM_INITDIALOG: + { + wsprintf(x, L"%d", Width); + wsprintf(y, L"%d", Height); + wsprintf(z, L"%d", Depth); + SetDlgItemText(hDlg, IDC_EDIT_RESIZE_X, x); + SetDlgItemText(hDlg, IDC_EDIT_RESIZE_Y, y); + SetDlgItemText(hDlg, IDC_EDIT_RESIZE_Z, z); + return TRUE; + } + break; + + case WM_COMMAND: + { + if (LOWORD(wParam) == IDOK) { + GetDlgItemText(hDlg, IDC_EDIT_RESIZE_X, x, 255); + GetDlgItemText(hDlg, IDC_EDIT_RESIZE_Y, y, 255); + GetDlgItemText(hDlg, IDC_EDIT_RESIZE_Z, z, 255); + xsize = _wtoi(x); + ysize = _wtoi(y); + zsize = _wtoi(z); + if (xsize && ysize && zsize) { + iluScale(xsize, ysize, zsize); + + Width = ilGetInteger(IL_IMAGE_WIDTH); + Height = ilGetInteger(IL_IMAGE_HEIGHT); + Depth = ilGetInteger(IL_IMAGE_DEPTH); + + GetWindowRect(HWnd, &Rect); + SetWindowPos(HWnd, HWND_TOP, Rect.left, Rect.top, + Width < MIN_W ? MIN_W + BORDER_W : Width + BORDER_W, + Height + MENU_H, SWP_SHOWWINDOW); + + InvalidateRect(HWnd, NULL, FALSE); + } + EndDialog(hDlg, TRUE); + } + if (LOWORD(wParam) == IDCANCEL) { + EndDialog(hDlg, FALSE); + } + } + break; + + case WM_CLOSE: + EndDialog(hDlg, TRUE); + break; + } + + return FALSE; +} + + +BOOL APIENTRY BatchDlgProc(HWND hDlg, UINT message, UINT wParam, LONG lParam) +{ + static TCHAR Dir[255], NewExt[255]; + static bool Recurse; + static RECT Rect; + + switch (message) + { + case WM_INITDIALOG: + { + wsprintf(Dir, L""); + wsprintf(NewExt, L"tga"); + SetDlgItemText(hDlg, IDC_BATCH_DIR, Dir); + SetDlgItemText(hDlg, IDC_BATCH_NEWEXT, NewExt); + return TRUE; + } + break; + + case WM_COMMAND: + { + if (LOWORD(wParam) == IDOK) { + GetDlgItemText(hDlg, IDC_BATCH_DIR, Dir, 255); + GetDlgItemText(hDlg, IDC_BATCH_NEWEXT, NewExt, 255); + Recurse = IsDlgButtonChecked(hDlg, IDC_BATCH_CHECK1) == BST_CHECKED; + + // Do shit here. + + //BatchConv(Dir, NULL, NewExt, Recurse); + + EndDialog(hDlg, TRUE); + } + if (LOWORD(wParam) == IDCANCEL) { + EndDialog(hDlg, FALSE); + } + } + break; + + case WM_CLOSE: + EndDialog(hDlg, TRUE); + break; + } + + return FALSE; +} diff --git a/DevIL/examples/windows_example/WindowsTest.dep b/DevIL/examples/windows_example/WindowsTest.dep new file mode 100644 index 00000000..4846ecdc --- /dev/null +++ b/DevIL/examples/windows_example/WindowsTest.dep @@ -0,0 +1,20 @@ +# Microsoft Developer Studio Generated Dependency File, included by WindowsTest.mak + +.\BatchConv.cpp : \ + "..\..\..\vc98\include\basetsd.h"\ + {$(INCLUDE)}"il\il.h"\ + + +.\WindowsTest.cpp : \ + "..\..\..\msvc\directx sdk\include\d3d8.h"\ + "..\..\..\msvc\directx sdk\include\d3d8caps.h"\ + "..\..\..\msvc\directx sdk\include\d3d8types.h"\ + "..\..\..\vc98\include\basetsd.h"\ + "..\..\include\il\ilu.h"\ + "..\..\include\il\ilut.h"\ + {$(INCLUDE)}"il\il.h"\ + + +.\WindowsTest.rc : \ + ".\resources\OpenIL.ico"\ + diff --git a/DevIL/examples/windows_example/WindowsTest.dsp b/DevIL/examples/windows_example/WindowsTest.dsp new file mode 100644 index 00000000..82a49780 --- /dev/null +++ b/DevIL/examples/windows_example/WindowsTest.dsp @@ -0,0 +1,157 @@ +# Microsoft Developer Studio Project File - Name="WindowsTest" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Application" 0x0101
+
+CFG=WindowsTest - Win32 Debug
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,
+!MESSAGE use the Export Makefile command and run
+!MESSAGE
+!MESSAGE NMAKE /f "WindowsTest.mak".
+!MESSAGE
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE
+!MESSAGE NMAKE /f "WindowsTest.mak" CFG="WindowsTest - Win32 Debug"
+!MESSAGE
+!MESSAGE Possible choices for configuration are:
+!MESSAGE
+!MESSAGE "WindowsTest - Win32 Release" (based on "Win32 (x86) Application")
+!MESSAGE "WindowsTest - Win32 Debug" (based on "Win32 (x86) Application")
+!MESSAGE "WindowsTest - Win32 Dynamic" (based on "Win32 (x86) Application")
+!MESSAGE
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+CPP=cl.exe
+MTL=midl.exe
+RSC=rc.exe
+
+!IF "$(CFG)" == "WindowsTest - Win32 Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "Release"
+# PROP BASE Intermediate_Dir "Release"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "../bin"
+# PROP Intermediate_Dir "obj"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /YX /FD /c
+# ADD CPP /nologo /MD /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /FD /c
+# SUBTRACT CPP /YX
+# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
+# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
+# ADD BASE RSC /l 0x409 /d "NDEBUG"
+# ADD RSC /l 0x409 /d "NDEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /machine:I386
+# ADD LINK32 user32.lib gdi32.lib comdlg32.lib shell32.lib /nologo /subsystem:windows /machine:I386
+
+!ELSEIF "$(CFG)" == "WindowsTest - Win32 Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "Debug"
+# PROP BASE Intermediate_Dir "Debug"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir "../bin/debug"
+# PROP Intermediate_Dir "obj/debug"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /YX /FD /GZ /c
+# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /FD /GZ /c
+# SUBTRACT CPP /YX
+# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
+# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
+# ADD BASE RSC /l 0x409 /d "_DEBUG"
+# ADD RSC /l 0x409 /d "_DEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept
+# ADD LINK32 user32.lib gdi32.lib comdlg32.lib shell32.lib /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept
+
+!ELSEIF "$(CFG)" == "WindowsTest - Win32 Dynamic"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "WindowsTest___Win32_Dynamic"
+# PROP BASE Intermediate_Dir "WindowsTest___Win32_Dynamic"
+# PROP BASE Ignore_Export_Lib 0
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "WindowsTest___Win32_Dynamic"
+# PROP Intermediate_Dir "WindowsTest___Win32_Dynamic"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /MD /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /FD /c
+# SUBTRACT BASE CPP /YX
+# ADD CPP /nologo /MD /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /FD /c
+# SUBTRACT CPP /YX
+# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
+# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
+# ADD BASE RSC /l 0x409 /d "NDEBUG"
+# ADD RSC /l 0x409 /d "NDEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 user32.lib gdi32.lib comdlg32.lib shell32.lib colorpicker.lib /nologo /subsystem:windows /machine:I386
+# ADD LINK32 user32.lib gdi32.lib comdlg32.lib shell32.lib /nologo /subsystem:windows /pdb:"../bin/debug/WindowsTest.pdb" /machine:I386 /out:"../bin/WindowsTest.exe"
+# SUBTRACT LINK32 /pdb:none
+
+!ENDIF
+
+# Begin Target
+
+# Name "WindowsTest - Win32 Release"
+# Name "WindowsTest - Win32 Debug"
+# Name "WindowsTest - Win32 Dynamic"
+# Begin Group "Source Files"
+
+# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
+# Begin Source File
+
+SOURCE=.\BatchConv.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\WindowsTest.cpp
+# End Source File
+# End Group
+# Begin Group "Header Files"
+
+# PROP Default_Filter "h;hpp;hxx;hm;inl"
+# Begin Source File
+
+SOURCE=.\resource.h
+# End Source File
+# End Group
+# Begin Group "Resource Files"
+
+# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
+# Begin Source File
+
+SOURCE=".\resources\OpenIL.ico"
+# End Source File
+# Begin Source File
+
+SOURCE=.\WindowsTest.rc
+# End Source File
+# End Group
+# End Target
+# End Project
diff --git a/DevIL/examples/windows_example/WindowsTest.h b/DevIL/examples/windows_example/WindowsTest.h new file mode 100644 index 00000000..d00d47e7 --- /dev/null +++ b/DevIL/examples/windows_example/WindowsTest.h @@ -0,0 +1,3 @@ +#pragma once + +#include "resource.h" diff --git a/DevIL/examples/windows_example/WindowsTest.mak b/DevIL/examples/windows_example/WindowsTest.mak new file mode 100644 index 00000000..b1827c4f --- /dev/null +++ b/DevIL/examples/windows_example/WindowsTest.mak @@ -0,0 +1,379 @@ +# Microsoft Developer Studio Generated NMAKE File, Based on WindowsTest.dsp +!IF "$(CFG)" == "" +CFG=WindowsTest - Win32 Debug +!MESSAGE No configuration specified. Defaulting to WindowsTest - Win32 Debug. +!ENDIF + +!IF "$(CFG)" != "WindowsTest - Win32 Release" && "$(CFG)" != "WindowsTest - Win32 Debug" && "$(CFG)" != "WindowsTest - Win32 Dynamic" +!MESSAGE Invalid configuration "$(CFG)" specified. +!MESSAGE You can specify a configuration when running NMAKE +!MESSAGE by defining the macro CFG on the command line. For example: +!MESSAGE +!MESSAGE NMAKE /f "WindowsTest.mak" CFG="WindowsTest - Win32 Debug" +!MESSAGE +!MESSAGE Possible choices for configuration are: +!MESSAGE +!MESSAGE "WindowsTest - Win32 Release" (based on "Win32 (x86) Application") +!MESSAGE "WindowsTest - Win32 Debug" (based on "Win32 (x86) Application") +!MESSAGE "WindowsTest - Win32 Dynamic" (based on "Win32 (x86) Application") +!MESSAGE +!ERROR An invalid configuration is specified. +!ENDIF + +!IF "$(OS)" == "Windows_NT" +NULL= +!ELSE +NULL=nul +!ENDIF + +CPP=cl.exe +MTL=midl.exe +RSC=rc.exe + +!IF "$(CFG)" == "WindowsTest - Win32 Release" + +OUTDIR=.\../bin +INTDIR=.\obj +# Begin Custom Macros +OutDir=.\../bin +# End Custom Macros + +!IF "$(RECURSE)" == "0" + +ALL : "$(OUTDIR)\WindowsTest.exe" + +!ELSE + +ALL : "ILU - Win32 Release" "IL - Win32 Release" "ILUT - Win32 Release" "$(OUTDIR)\WindowsTest.exe" + +!ENDIF + +!IF "$(RECURSE)" == "1" +CLEAN :"ILUT - Win32 ReleaseCLEAN" "IL - Win32 ReleaseCLEAN" "ILU - Win32 ReleaseCLEAN" +!ELSE +CLEAN : +!ENDIF + -@erase "$(INTDIR)\BatchConv.obj" + -@erase "$(INTDIR)\vc60.idb" + -@erase "$(INTDIR)\WindowsTest.obj" + -@erase "$(INTDIR)\WindowsTest.res" + -@erase "$(OUTDIR)\WindowsTest.exe" + +"$(OUTDIR)" : + if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)" + +"$(INTDIR)" : + if not exist "$(INTDIR)/$(NULL)" mkdir "$(INTDIR)" + +CPP_PROJ=/nologo /MD /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /c +MTL_PROJ=/nologo /D "NDEBUG" /mktyplib203 /win32 +RSC_PROJ=/l 0x409 /fo"$(INTDIR)\WindowsTest.res" /d "NDEBUG" +BSC32=bscmake.exe +BSC32_FLAGS=/nologo /o"$(OUTDIR)\WindowsTest.bsc" +BSC32_SBRS= \ + +LINK32=link.exe +LINK32_FLAGS=user32.lib gdi32.lib comdlg32.lib shell32.lib /nologo /subsystem:windows /incremental:no /pdb:"$(OUTDIR)\WindowsTest.pdb" /machine:I386 /out:"$(OUTDIR)\WindowsTest.exe" +LINK32_OBJS= \ + "$(INTDIR)\BatchConv.obj" \ + "$(INTDIR)\WindowsTest.obj" \ + "$(INTDIR)\WindowsTest.res" \ + "..\..\lib\ILUT.lib" \ + "..\..\lib\DevIL.lib" \ + "..\..\lib\ILU.lib" + +"$(OUTDIR)\WindowsTest.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS) + $(LINK32) @<< + $(LINK32_FLAGS) $(LINK32_OBJS) +<< + +!ELSEIF "$(CFG)" == "WindowsTest - Win32 Debug" + +OUTDIR=.\../bin/debug +INTDIR=.\obj/debug +# Begin Custom Macros +OutDir=.\../bin/debug +# End Custom Macros + +!IF "$(RECURSE)" == "0" + +ALL : "$(OUTDIR)\WindowsTest.exe" + +!ELSE + +ALL : "ILU - Win32 Debug" "IL - Win32 Debug" "ILUT - Win32 Debug" "$(OUTDIR)\WindowsTest.exe" + +!ENDIF + +!IF "$(RECURSE)" == "1" +CLEAN :"ILUT - Win32 DebugCLEAN" "IL - Win32 DebugCLEAN" "ILU - Win32 DebugCLEAN" +!ELSE +CLEAN : +!ENDIF + -@erase "$(INTDIR)\BatchConv.obj" + -@erase "$(INTDIR)\vc60.idb" + -@erase "$(INTDIR)\vc60.pdb" + -@erase "$(INTDIR)\WindowsTest.obj" + -@erase "$(INTDIR)\WindowsTest.res" + -@erase "$(OUTDIR)\WindowsTest.exe" + -@erase "$(OUTDIR)\WindowsTest.ilk" + -@erase "$(OUTDIR)\WindowsTest.pdb" + +"$(OUTDIR)" : + if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)" + +"$(INTDIR)" : + if not exist "$(INTDIR)/$(NULL)" mkdir "$(INTDIR)" + +CPP_PROJ=/nologo /MDd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /GZ /c +MTL_PROJ=/nologo /D "_DEBUG" /mktyplib203 /win32 +RSC_PROJ=/l 0x409 /fo"$(INTDIR)\WindowsTest.res" /d "_DEBUG" +BSC32=bscmake.exe +BSC32_FLAGS=/nologo /o"$(OUTDIR)\WindowsTest.bsc" +BSC32_SBRS= \ + +LINK32=link.exe +LINK32_FLAGS=user32.lib gdi32.lib comdlg32.lib shell32.lib /nologo /subsystem:windows /incremental:yes /pdb:"$(OUTDIR)\WindowsTest.pdb" /debug /machine:I386 /out:"$(OUTDIR)\WindowsTest.exe" /pdbtype:sept +LINK32_OBJS= \ + "$(INTDIR)\BatchConv.obj" \ + "$(INTDIR)\WindowsTest.obj" \ + "$(INTDIR)\WindowsTest.res" \ + "..\..\lib\debug\ilut-d.lib" \ + "..\..\lib\debug\DevIL-d.lib" \ + "..\..\lib\debug\ilu-d.lib" + +"$(OUTDIR)\WindowsTest.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS) + $(LINK32) @<< + $(LINK32_FLAGS) $(LINK32_OBJS) +<< + +!ELSEIF "$(CFG)" == "WindowsTest - Win32 Dynamic" + +OUTDIR=.\WindowsTest___Win32_Dynamic +INTDIR=.\WindowsTest___Win32_Dynamic +# Begin Custom Macros +OutDir=.\WindowsTest___Win32_Dynamic +# End Custom Macros + +!IF "$(RECURSE)" == "0" + +ALL : "$(OUTDIR)\WindowsTest.exe" + +!ELSE + +ALL : "ILU - Win32 Dynamic" "IL - Win32 Dynamic" "ILUT - Win32 Dynamic" "$(OUTDIR)\WindowsTest.exe" + +!ENDIF + +!IF "$(RECURSE)" == "1" +CLEAN :"ILUT - Win32 DynamicCLEAN" "IL - Win32 DynamicCLEAN" "ILU - Win32 DynamicCLEAN" +!ELSE +CLEAN : +!ENDIF + -@erase "$(INTDIR)\BatchConv.obj" + -@erase "$(INTDIR)\vc60.idb" + -@erase "$(INTDIR)\WindowsTest.obj" + -@erase "$(INTDIR)\WindowsTest.res" + -@erase "$(OUTDIR)\WindowsTest.exe" + +"$(OUTDIR)" : + if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)" + +CPP_PROJ=/nologo /MD /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /c +MTL_PROJ=/nologo /D "NDEBUG" /mktyplib203 /win32 +RSC_PROJ=/l 0x409 /fo"$(INTDIR)\WindowsTest.res" /d "NDEBUG" +BSC32=bscmake.exe +BSC32_FLAGS=/nologo /o"$(OUTDIR)\WindowsTest.bsc" +BSC32_SBRS= \ + +LINK32=link.exe +LINK32_FLAGS=user32.lib gdi32.lib comdlg32.lib shell32.lib /nologo /subsystem:windows /incremental:no /pdb:"$(OUTDIR)\WindowsTest.pdb" /machine:I386 /out:"$(OUTDIR)\WindowsTest.exe" +LINK32_OBJS= \ + "$(INTDIR)\BatchConv.obj" \ + "$(INTDIR)\WindowsTest.obj" \ + "$(INTDIR)\WindowsTest.res" \ + "..\..\lib\ilut-l.lib" \ + "..\..\lib\DevIL-l.lib" \ + "..\..\lib\ilu-l.lib" + +"$(OUTDIR)\WindowsTest.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS) + $(LINK32) @<< + $(LINK32_FLAGS) $(LINK32_OBJS) +<< + +!ENDIF + +.c{$(INTDIR)}.obj:: + $(CPP) @<< + $(CPP_PROJ) $< +<< + +.cpp{$(INTDIR)}.obj:: + $(CPP) @<< + $(CPP_PROJ) $< +<< + +.cxx{$(INTDIR)}.obj:: + $(CPP) @<< + $(CPP_PROJ) $< +<< + +.c{$(INTDIR)}.sbr:: + $(CPP) @<< + $(CPP_PROJ) $< +<< + +.cpp{$(INTDIR)}.sbr:: + $(CPP) @<< + $(CPP_PROJ) $< +<< + +.cxx{$(INTDIR)}.sbr:: + $(CPP) @<< + $(CPP_PROJ) $< +<< + + +!IF "$(NO_EXTERNAL_DEPS)" != "1" +!IF EXISTS("WindowsTest.dep") +!INCLUDE "WindowsTest.dep" +!ELSE +!MESSAGE Warning: cannot find "WindowsTest.dep" +!ENDIF +!ENDIF + + +!IF "$(CFG)" == "WindowsTest - Win32 Release" || "$(CFG)" == "WindowsTest - Win32 Debug" || "$(CFG)" == "WindowsTest - Win32 Dynamic" +SOURCE=.\BatchConv.cpp + +"$(INTDIR)\BatchConv.obj" : $(SOURCE) "$(INTDIR)" + + +SOURCE=.\WindowsTest.cpp + +"$(INTDIR)\WindowsTest.obj" : $(SOURCE) "$(INTDIR)" + + +SOURCE=.\WindowsTest.rc + +"$(INTDIR)\WindowsTest.res" : $(SOURCE) "$(INTDIR)" + $(RSC) $(RSC_PROJ) $(SOURCE) + + +!IF "$(CFG)" == "WindowsTest - Win32 Release" + +"ILUT - Win32 Release" : + cd "\DevIL\src-ILUT\msvc" + $(MAKE) /$(MAKEFLAGS) /F ".\ILUT.mak" CFG="ILUT - Win32 Release" + cd "..\..\Examples\WindowsTest" + +"ILUT - Win32 ReleaseCLEAN" : + cd "\DevIL\src-ILUT\msvc" + $(MAKE) /$(MAKEFLAGS) /F ".\ILUT.mak" CFG="ILUT - Win32 Release" RECURSE=1 CLEAN + cd "..\..\Examples\WindowsTest" + +!ELSEIF "$(CFG)" == "WindowsTest - Win32 Debug" + +"ILUT - Win32 Debug" : + cd "\DevIL\src-ILUT\msvc" + $(MAKE) /$(MAKEFLAGS) /F ".\ILUT.mak" CFG="ILUT - Win32 Debug" + cd "..\..\Examples\WindowsTest" + +"ILUT - Win32 DebugCLEAN" : + cd "\DevIL\src-ILUT\msvc" + $(MAKE) /$(MAKEFLAGS) /F ".\ILUT.mak" CFG="ILUT - Win32 Debug" RECURSE=1 CLEAN + cd "..\..\Examples\WindowsTest" + +!ELSEIF "$(CFG)" == "WindowsTest - Win32 Dynamic" + +"ILUT - Win32 Dynamic" : + cd "\DevIL\src-ILUT\msvc" + $(MAKE) /$(MAKEFLAGS) /F ".\ILUT.mak" CFG="ILUT - Win32 Dynamic" + cd "..\..\Examples\WindowsTest" + +"ILUT - Win32 DynamicCLEAN" : + cd "\DevIL\src-ILUT\msvc" + $(MAKE) /$(MAKEFLAGS) /F ".\ILUT.mak" CFG="ILUT - Win32 Dynamic" RECURSE=1 CLEAN + cd "..\..\Examples\WindowsTest" + +!ENDIF + +!IF "$(CFG)" == "WindowsTest - Win32 Release" + +"IL - Win32 Release" : + cd "\DevIL\src-IL\msvc" + $(MAKE) /$(MAKEFLAGS) /F ".\IL.mak" CFG="IL - Win32 Release" + cd "..\..\Examples\WindowsTest" + +"IL - Win32 ReleaseCLEAN" : + cd "\DevIL\src-IL\msvc" + $(MAKE) /$(MAKEFLAGS) /F ".\IL.mak" CFG="IL - Win32 Release" RECURSE=1 CLEAN + cd "..\..\Examples\WindowsTest" + +!ELSEIF "$(CFG)" == "WindowsTest - Win32 Debug" + +"IL - Win32 Debug" : + cd "\DevIL\src-IL\msvc" + $(MAKE) /$(MAKEFLAGS) /F ".\IL.mak" CFG="IL - Win32 Debug" + cd "..\..\Examples\WindowsTest" + +"IL - Win32 DebugCLEAN" : + cd "\DevIL\src-IL\msvc" + $(MAKE) /$(MAKEFLAGS) /F ".\IL.mak" CFG="IL - Win32 Debug" RECURSE=1 CLEAN + cd "..\..\Examples\WindowsTest" + +!ELSEIF "$(CFG)" == "WindowsTest - Win32 Dynamic" + +"IL - Win32 Dynamic" : + cd "\DevIL\src-IL\msvc" + $(MAKE) /$(MAKEFLAGS) /F ".\IL.mak" CFG="IL - Win32 Dynamic" + cd "..\..\Examples\WindowsTest" + +"IL - Win32 DynamicCLEAN" : + cd "\DevIL\src-IL\msvc" + $(MAKE) /$(MAKEFLAGS) /F ".\IL.mak" CFG="IL - Win32 Dynamic" RECURSE=1 CLEAN + cd "..\..\Examples\WindowsTest" + +!ENDIF + +!IF "$(CFG)" == "WindowsTest - Win32 Release" + +"ILU - Win32 Release" : + cd "\DevIL\src-ILU\msvc" + $(MAKE) /$(MAKEFLAGS) /F ".\ILU.mak" CFG="ILU - Win32 Release" + cd "..\..\Examples\WindowsTest" + +"ILU - Win32 ReleaseCLEAN" : + cd "\DevIL\src-ILU\msvc" + $(MAKE) /$(MAKEFLAGS) /F ".\ILU.mak" CFG="ILU - Win32 Release" RECURSE=1 CLEAN + cd "..\..\Examples\WindowsTest" + +!ELSEIF "$(CFG)" == "WindowsTest - Win32 Debug" + +"ILU - Win32 Debug" : + cd "\DevIL\src-ILU\msvc" + $(MAKE) /$(MAKEFLAGS) /F ".\ILU.mak" CFG="ILU - Win32 Debug" + cd "..\..\Examples\WindowsTest" + +"ILU - Win32 DebugCLEAN" : + cd "\DevIL\src-ILU\msvc" + $(MAKE) /$(MAKEFLAGS) /F ".\ILU.mak" CFG="ILU - Win32 Debug" RECURSE=1 CLEAN + cd "..\..\Examples\WindowsTest" + +!ELSEIF "$(CFG)" == "WindowsTest - Win32 Dynamic" + +"ILU - Win32 Dynamic" : + cd "\DevIL\src-ILU\msvc" + $(MAKE) /$(MAKEFLAGS) /F ".\ILU.mak" CFG="ILU - Win32 Dynamic" + cd "..\..\Examples\WindowsTest" + +"ILU - Win32 DynamicCLEAN" : + cd "\DevIL\src-ILU\msvc" + $(MAKE) /$(MAKEFLAGS) /F ".\ILU.mak" CFG="ILU - Win32 Dynamic" RECURSE=1 CLEAN + cd "..\..\Examples\WindowsTest" + +!ENDIF + + +!ENDIF + diff --git a/DevIL/examples/windows_example/WindowsTest.rc b/DevIL/examples/windows_example/WindowsTest.rc new file mode 100644 index 00000000..f0ae907b --- /dev/null +++ b/DevIL/examples/windows_example/WindowsTest.rc @@ -0,0 +1,201 @@ +// Generated by ResEdit 1.4.3 +// Copyright (C) 2006-2008 +// http://www.resedit.net + +#include "resource.h" +#include "windows.h" + + +// +// Dialog resources +// +LANGUAGE LANG_ENGLISH, SUBLANG_DEFAULT +IDD_DIALOG_ABOUT DIALOGEX 0, 0, 278, 220 +STYLE DS_MODALFRAME | DS_SETFONT | WS_BORDER | WS_CAPTION | WS_DLGFRAME | WS_POPUP | WS_SYSMENU +CAPTION "About DevIL" +FONT 8, "MS Sans Serif", 0, 0, 1 +BEGIN + DEFPUSHBUTTON "OK", IDOK, 113, 198, 50, 14 + GROUPBOX "Info", IDC_STATIC, 7, 7, 264, 69 + GROUPBOX "Errors", IDC_STATIC, 7, 86, 264, 76 + LTEXT "Vendor:", IDC_STATIC, 27, 22, 27, 8 + LTEXT "Version:", IDC_STATIC, 26, 35, 26, 8 + CTEXT "", IDC_ERROR1, 40, 98, 79, 8 + LTEXT "Vendor", IDC_ABOUT_VENDOR, 68, 22, 126, 8 + LTEXT "Version String", IDC_ABOUT_VER_STRING, 68, 35, 125, 8 + LTEXT "Version Num", IDC_ABOUT_VER_NUM, 68, 46, 38, 8 + CTEXT "", IDC_ERROR4, 158, 98, 79, 8 + CTEXT "", IDC_ERROR6, 158, 142, 79, 8 + CTEXT "", IDC_ERROR2, 40, 119, 79, 8 + CTEXT "", IDC_ERROR5, 158, 120, 79, 8 + CTEXT "", IDC_ERROR3, 40, 142, 79, 8 + LTEXT "Visit the DevIL website at http://openil.sf.net.", IDC_OPENIL_LINK, 56, 182, 164, 8 + ICON "", IDC_STATIC, 243, 15, 20, 20, SS_ICON +END + +LANGUAGE LANG_ENGLISH, SUBLANG_DEFAULT +IDD_DIALOG_FILTER DIALOGEX 0, 0, 186, 95 +STYLE DS_MODALFRAME | DS_SETFONT | WS_BORDER | WS_CAPTION | WS_DLGFRAME | WS_POPUP | WS_SYSMENU +CAPTION "Dialog Options" +FONT 8, "MS Sans Serif", 400, 0, 0 +BEGIN + DEFPUSHBUTTON "OK", IDOK, 129, 14, 50, 14 + PUSHBUTTON "Cancel", IDCANCEL, 129, 31, 50, 14 + LTEXT "Enter number of iterations, monkey foo!", IDC_FILTER_DESC_TEXT, 21, 14, 95, 31 + EDITTEXT IDC_FILTER_EDIT, 13, 54, 160, 14, ES_AUTOHSCROLL +END + +LANGUAGE LANG_ENGLISH, SUBLANG_DEFAULT +IDD_DIALOG_RESIZE DIALOGEX 0, 0, 266, 95 +STYLE DS_MODALFRAME | DS_SETFONT | WS_BORDER | WS_CAPTION | WS_DLGFRAME | WS_POPUP | WS_SYSMENU +CAPTION "Resize Options" +FONT 8, "MS Sans Serif", 400, 0, 0 +BEGIN + DEFPUSHBUTTON "OK", IDOK, 77, 65, 50, 14 + PUSHBUTTON "Cancel", IDCANCEL, 137, 65, 50, 14 + LTEXT "Enter new image size:", IDC_STATIC, 97, 15, 70, 8 + EDITTEXT IDC_EDIT_RESIZE_X, 33, 36, 40, 14, ES_AUTOHSCROLL + EDITTEXT IDC_EDIT_RESIZE_Y, 109, 36, 40, 14, ES_AUTOHSCROLL + EDITTEXT IDC_EDIT_RESIZE_Z, 187, 37, 40, 14, ES_AUTOHSCROLL + LTEXT "X:", IDC_STATIC, 20, 39, 8, 8 + LTEXT "Y:", IDC_STATIC, 96, 38, 8, 8 + LTEXT "Z:", IDC_STATIC, 173, 39, 8, 8 +END + +LANGUAGE LANG_ENGLISH, SUBLANG_DEFAULT +IDD_DIALOG_BATCHCONV DIALOGEX 0, 0, 200, 138 +STYLE DS_MODALFRAME | DS_SETFONT | WS_BORDER | WS_CAPTION | WS_DLGFRAME | WS_POPUP | WS_SYSMENU +CAPTION "Batch Conversion Options" +FONT 8, "MS Sans Serif", 400, 0, 0 +BEGIN + DEFPUSHBUTTON "OK", IDOK, 43, 108, 50, 14 + PUSHBUTTON "Cancel", IDCANCEL, 107, 108, 50, 14 + LTEXT "Enter Directory:", IDC_FILTER_DESC_TEXT, 21, 14, 95, 14 + EDITTEXT IDC_BATCH_DIR, 21, 30, 160, 14, ES_AUTOHSCROLL + AUTOCHECKBOX "Parse Subdirectories?", IDC_BATCH_CHECK1, 57, 89, 85, 10 + LTEXT "Enter New Extension:", IDC_STATIC, 21, 55, 69, 8 + EDITTEXT IDC_BATCH_NEWEXT, 21, 66, 44, 14, ES_AUTOHSCROLL +END + +LANGUAGE LANG_ENGLISH, SUBLANG_DEFAULT +IDD_DIALOG_PROPERTIES DIALOGEX 0, 0, 243, 158 +STYLE DS_MODALFRAME | DS_SETFONT | WS_BORDER | WS_CAPTION | WS_DLGFRAME | WS_POPUP | WS_SYSMENU +CAPTION "Image Properties" +FONT 8, "MS Sans Serif", 400, 0, 0 +BEGIN + DEFPUSHBUTTON "OK", IDOK, 81, 137, 50, 14 + GROUPBOX "Info", IDC_STATIC, 7, 7, 229, 119 + LTEXT "Filename:", IDC_STATIC, 16, 24, 31, 8 + LTEXT "Width:", IDC_STATIC, 25, 43, 22, 8 + LTEXT "Height:", IDC_STATIC, 23, 62, 24, 8 + LTEXT "Depth:", IDC_STATIC, 25, 81, 22, 8 + LTEXT "Filename", IDC_PROP_FILENAME, 61, 24, 169, 8 + LTEXT "Width", IDC_PROP_WIDTH, 61, 43, 42, 8 + LTEXT "Height", IDC_PROP_HEIGHT, 61, 62, 42, 8 + LTEXT "Depth", IDC_PROP_DEPTH, 61, 81, 42, 8 + LTEXT "Size:", IDC_STATIC, 31, 100, 16, 8 + LTEXT "Size", IDC_PROP_SIZE, 61, 100, 41, 8 + LTEXT "byte(s)", IDC_STATIC, 111, 100, 22, 8 + LTEXT "pixel(s)", IDC_STATIC, 111, 81, 22, 8 + LTEXT "pixel(s)", IDC_STATIC, 111, 62, 22, 8 + LTEXT "pixel(s)", IDC_STATIC, 111, 43, 22, 8 +END + + +// +// Menu resources +// +LANGUAGE LANG_ENGLISH, SUBLANG_DEFAULT +IDR_MENU1 MENU +BEGIN + POPUP "&File" + BEGIN + MENUITEM "&Open...\tCtrl+O", ID_FILE_LOAD + MENUITEM "Open &URL...\tCtrl+U", ID_FILE_OPENURL + MENUITEM "&Save...\tCtrl+S", ID_FILE_SAVE + MENUITEM "&Image Properties", ID_FILE_PROPERTIES + MENUITEM "&Print", ID_FILE_PRINT + MENUITEM "E&xit\tEsc", ID_FILE_EXIT + END + POPUP "&Convert" + BEGIN + MENUITEM "&Colour Indexed", ID_CONVERT_PALETTE + MENUITEM "&Luminance", ID_CONVERT_LUMINANCE + MENUITEM "L&uminance Alpha", ID_CONVERT_LUMINANCEALPHA + MENUITEM "&Rgb", ID_CONVERT_RGB + MENUITEM "Rgba", ID_CONVERT_RGBA + MENUITEM "&Bgr", ID_CONVERT_BGR + MENUITEM "Bgra", ID_CONVERT_BGRA + MENUITEM "&Alpha", ID_EDIT_VIEWALPHA + MENUITEM "Batch Convert", ID_BATCHCONVERT + END + POPUP "&Edit" + BEGIN + MENUITEM "&Undo", ID_EDIT_UNDO + MENUITEM "Undo &Level", ID_EDIT_UNDOLEVEL + MENUITEM "&Copy\tCtrl+C", ID_EDIT_COPY + MENUITEM "&Paste\tCtrl+V", ID_EDIT_PASTE + MENUITEM "View ImageNum", ID_EDIT_VIEWIMAGENUM + MENUITEM "View Mipmap", ID_EDIT_VIEWMIPMAP + MENUITEM "Next Image", ID_EDIT_NEXT + MENUITEM "Previous Image", ID_EDIT_PREV + END + POPUP "&Tools" + BEGIN + MENUITEM "&Count Colours", ID_EFFECTS_COUNTCOLORS + MENUITEM "&Background Colour", ID_EFFECTSTOOLS_BACKGROUNDCOLOUR + POPUP "&Filters" + BEGIN + MENUITEM "&Alienify", ID_FILTER_ALIENIFY + MENUITEM "Apply &Wave", ID_EFFECTS_FILTERS_WAVE + POPUP "Blur" + BEGIN + MENUITEM "&Average", ID_FILTERS_BLUR_AVERAGE + MENUITEM "&Gaussian", ID_FILTERS_BLUR_GAUSSIAN + END + POPUP "Ed&ge Detect" + BEGIN + MENUITEM "&Emboss", ID_EFFECTS_FILTERS_EDGEDETECT_EMBOSS + MENUITEM "Prewitt", ID_EFFECTS_FILTERS_EDGEDETECT_PREWITT + MENUITEM "Sobel", ID_EFFECTS_FILTERS_EDGEDETECT_SOBEL + END + MENUITEM "&Emboss", ID_FILTER_EMBOSS + MENUITEM "E&qualize", ID_FILTER_EQUALIZE + MENUITEM "&Gamma Correct", ID_FILTER_GAMMACORRECT + MENUITEM "&Negative", ID_FILTER_NEGATIVE + MENUITEM "N&oise", ID_FILTER_NOISE + MENUITEM "&Pixelize", ID_FILTER_PIXELIZE + MENUITEM "&Sharpen", ID_FILTER_SHARPEN + END + MENUITEM "Fli&p", ID_EFFECTS_FLIP + MENUITEM "&Mirror", ID_EFFECTS_MIRROR + MENUITEM "&Rotate", ID_EFFECTS_FILTERS_ROTATE + MENUITEM "&Scale", ID_EFFECTS_FILTERS_SCALE + MENUITEM "&ScaleBOX", ID_EFFECTS_FILTERS_SCALEBOX + END + POPUP "&Help" + BEGIN + MENUITEM "&About", ID_HELP_ABOUT + END +END + + +// +// Accelerator resources +// +LANGUAGE LANG_ENGLISH, SUBLANG_DEFAULT +IDR_MENU1 ACCELERATORS +BEGIN + "C", ID_EDIT_COPY, VIRTKEY, CONTROL + "O", ID_FILE_LOAD, VIRTKEY, CONTROL + "S", ID_FILE_SAVE, VIRTKEY, CONTROL + "U", ID_FILE_OPENURL, VIRTKEY, CONTROL + "V", ID_EDIT_PASTE, VIRTKEY, CONTROL +END + + +// +// Icon resources +// +LANGUAGE LANG_ENGLISH, SUBLANG_DEFAULT +IDI_ICON1 ICON "./resources/OpenIL.ico" diff --git a/DevIL/examples/windows_example/WindowsTest.vcproj b/DevIL/examples/windows_example/WindowsTest.vcproj new file mode 100644 index 00000000..b89e4bd6 --- /dev/null +++ b/DevIL/examples/windows_example/WindowsTest.vcproj @@ -0,0 +1,263 @@ +<?xml version="1.0" encoding="Windows-1252"?> +<VisualStudioProject + ProjectType="Visual C++" + Version="9.00" + Name="WindowsTest" + ProjectGUID="{DEA982DD-5797-4D77-A33A-367D0395612B}" + RootNamespace="WindowsTest" + TargetFrameworkVersion="131072" + > + <Platforms> + <Platform + Name="Win32" + /> + </Platforms> + <ToolFiles> + </ToolFiles> + <Configurations> + <Configuration + Name="Release|Win32" + OutputDirectory=".\../bin" + IntermediateDirectory=".\obj" + ConfigurationType="1" + InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops" + UseOfMFC="0" + ATLMinimizesCRunTimeLibraryUsage="false" + CharacterSet="1" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + PreprocessorDefinitions="NDEBUG" + MkTypLibCompatible="true" + SuppressStartupBanner="true" + TargetEnvironment="1" + TypeLibraryName=".\../bin/WindowsTest.tlb" + HeaderFileName="" + /> + <Tool + Name="VCCLCompilerTool" + AdditionalOptions="/D "_CRT_SECURE_NO_DEPRECATE" /D "_CRT_NONSTDC_NO_DEPRECATE"" + Optimization="2" + InlineFunctionExpansion="1" + AdditionalIncludeDirectories="../../include" + PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS" + StringPooling="true" + RuntimeLibrary="0" + EnableFunctionLevelLinking="true" + PrecompiledHeaderFile=".\obj/WindowsTest.pch" + AssemblerListingLocation=".\obj/" + ObjectFile=".\obj/" + ProgramDataBaseFileName=".\obj/" + WarningLevel="3" + SuppressStartupBanner="true" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + PreprocessorDefinitions="NDEBUG" + Culture="1033" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLinkerTool" + AdditionalDependencies="devil.lib ilu.lib ilut.lib" + OutputFile=".\../bin/WindowsTest.exe" + LinkIncremental="1" + SuppressStartupBanner="true" + AdditionalLibraryDirectories="E:\XIX\S\sourceforge\DevIL\lib;E:\XIX\S\sourceforge\DevIL\extlibs\ColorPicker" + ProgramDatabaseFile=".\../bin/WindowsTest.pdb" + SubSystem="2" + RandomizedBaseAddress="1" + DataExecutionPrevention="0" + TargetMachine="1" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCManifestTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCAppVerifierTool" + /> + <Tool + Name="VCPostBuildEventTool" + /> + </Configuration> + <Configuration + Name="Debug|Win32" + OutputDirectory=".\../bin/debug" + IntermediateDirectory=".\obj/debug" + ConfigurationType="1" + InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops" + UseOfMFC="0" + ATLMinimizesCRunTimeLibraryUsage="false" + CharacterSet="1" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + PreprocessorDefinitions="_DEBUG" + MkTypLibCompatible="true" + SuppressStartupBanner="true" + TargetEnvironment="1" + TypeLibraryName=".\../bin/debug/WindowsTest.tlb" + HeaderFileName="" + /> + <Tool + Name="VCCLCompilerTool" + AdditionalOptions="/D "_CRT_SECURE_NO_DEPRECATE" /D "_CRT_NONSTDC_NO_DEPRECATE"" + Optimization="0" + AdditionalIncludeDirectories="../../include" + PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS" + BasicRuntimeChecks="3" + RuntimeLibrary="1" + PrecompiledHeaderFile=".\obj/debug/WindowsTest.pch" + AssemblerListingLocation=".\obj/debug/" + ObjectFile=".\obj/debug/" + ProgramDataBaseFileName=".\obj/debug/" + WarningLevel="3" + SuppressStartupBanner="true" + DebugInformationFormat="4" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + PreprocessorDefinitions="_DEBUG" + Culture="1033" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLinkerTool" + AdditionalDependencies="devil.lib ilu.lib ilut.lib" + OutputFile=".\../bin/debug/WindowsTest.exe" + LinkIncremental="1" + SuppressStartupBanner="true" + AdditionalLibraryDirectories="E:\XIX\S\sourceforge\DevIL\lib;E:\XIX\S\sourceforge\DevIL\extlibs\ColorPicker" + GenerateDebugInformation="true" + ProgramDatabaseFile=".\../bin/debug/WindowsTest.pdb" + SubSystem="2" + RandomizedBaseAddress="1" + DataExecutionPrevention="0" + TargetMachine="1" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCManifestTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCAppVerifierTool" + /> + <Tool + Name="VCPostBuildEventTool" + /> + </Configuration> + </Configurations> + <References> + </References> + <Files> + <Filter + Name="Source Files" + Filter="cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" + > + <File + RelativePath="WindowsTest.cpp" + > + <FileConfiguration + Name="Release|Win32" + > + <Tool + Name="VCCLCompilerTool" + Optimization="2" + PreprocessorDefinitions="" + /> + </FileConfiguration> + <FileConfiguration + Name="Debug|Win32" + > + <Tool + Name="VCCLCompilerTool" + Optimization="0" + PreprocessorDefinitions="" + BasicRuntimeChecks="3" + /> + </FileConfiguration> + </File> + </Filter> + <Filter + Name="Header Files" + Filter="h;hpp;hxx;hm;inl" + > + <File + RelativePath="resource.h" + > + </File> + </Filter> + <Filter + Name="Resource Files" + Filter="ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe" + > + <File + RelativePath="resources\OpenIL.ico" + > + </File> + <File + RelativePath="WindowsTest.rc" + > + </File> + </Filter> + </Files> + <Globals> + </Globals> +</VisualStudioProject> diff --git a/DevIL/examples/windows_example/resource.h b/DevIL/examples/windows_example/resource.h new file mode 100644 index 00000000..ebf3cf7e --- /dev/null +++ b/DevIL/examples/windows_example/resource.h @@ -0,0 +1,79 @@ +#ifndef IDC_STATIC +#define IDC_STATIC (-1) +#endif + +#define IDR_MENU1 167 +#define IDD_DIALOG_ABOUT 168 +#define IDD_DIALOG_FILTER 169 +#define IDD_DIALOG_RESIZE 170 +#define IDD_DIALOG_BATCHCONV 171 +#define IDD_DIALOG_PROPERTIES 183 +#define IDC_ABOUT_VENDOR 1001 +#define IDC_ABOUT_VER_STRING 1002 +#define IDC_ABOUT_VER_NUM 1003 +#define IDC_FILTER_EDIT 1004 +#define IDC_FILTER_DESC_TEXT 1005 +#define IDC_ERROR1 1014 +#define IDC_EDIT_RESIZE_X 1015 +#define IDC_ERROR2 1015 +#define IDC_EDIT_RESIZE_Y 1016 +#define IDC_ERROR3 1016 +#define IDC_EDIT_RESIZE_Z 1017 +#define IDC_ERROR4 1017 +#define IDC_ERROR5 1018 +#define IDC_ERROR6 1019 +#define IDC_OPENIL_LINK 1020 +#define IDC_BATCH_CHECK1 1021 +#define IDC_BATCH_NEWEXT 1022 +#define IDC_BATCH_DIR 1023 +#define IDC_PROP_FILENAME 1028 +#define IDC_PROP_WIDTH 1029 +#define IDC_PROP_HEIGHT 1030 +#define IDC_PROP_DEPTH 1031 +#define IDC_PROP_SIZE 1032 +#define IDI_ICON1 1033 +#define ID_FILE_EXIT 32771 +#define ID_HELP_ABOUT 32772 +#define ID_CONVERT_RGB 32773 +#define ID_CONVERT_RGBA 32774 +#define ID_CONVERT_BGR 32775 +#define ID_CONVERT_BGRA 32776 +#define ID_CONVERT_LUMINANCE 32777 +#define ID_FILE_LOAD 32778 +#define ID_FILE_SAVE 32779 +#define ID_FILTER_EMBOSS 32783 +#define ID_FILTER_NOISE 32784 +#define ID_FILTER_PIXELIZE 32785 +#define ID_EFFECTS_FILTERS_SCALE 32786 +#define ID_EFFECTS_FILTERS_EDGEDETECT_SOBEL 32787 +#define ID_EFFECTS_FILTERS_EDGEDETECT_PREWITT 32788 +#define ID_EDIT_UNDO 32789 +#define ID_EDIT_UNDOLEVEL 32790 +#define ID_FILTERS_BLUR_AVERAGE 32791 +#define ID_FILTERS_BLUR_GAUSSIAN 32792 +#define ID_FILTER_GAMMACORRECT 32793 +#define ID_FILTER_ALIENIFY 32794 +#define ID_FILTER_SHARPEN 32795 +#define ID_FILTER_NEGATIVE 32796 +#define ID_EFFECTS_FLIP 32797 +#define ID_EFFECTS_MIRROR 32798 +#define ID_EFFECTS_COUNTCOLORS 32799 +#define ID_EDIT_COPY 32800 +#define ID_EDIT_PASTE 32801 +#define ID_EFFECTS_FILTERS_ROTATE 32802 +#define ID_EFFECTS_FILTERS_EDGEDETECT_EMBOSS 32804 +#define ID_FILE_PRINT 32805 +#define ID_EDIT_VIEWMIPMAP 32806 +#define ID_EDIT_VIEWIMAGENUM 32807 +#define ID_FILE_OPENURL 32808 +#define ID_CONVERT_PALETTE 32809 +#define ID_BATCHCONVERT 32810 +#define ID_EFFECTS_FILTERS_WAVE 32811 +#define ID_FILTER_EQUALIZE 32812 +#define ID_EFFECTSTOOLS_BACKGROUNDCOLOUR 32813 +#define ID_EDIT_VIEWALPHA 32814 +#define ID_FILE_PROPERTIES 32815 +#define ID_CONVERT_LUMINANCEALPHA 32816 +#define ID_EFFECTS_FILTERS_SCALEBOX 32817 +#define ID_EDIT_NEXT 40000 +#define ID_EDIT_PREV 40001 diff --git a/DevIL/examples/windows_example/resources/3d.ico b/DevIL/examples/windows_example/resources/3d.ico Binary files differnew file mode 100644 index 00000000..8baab5f2 --- /dev/null +++ b/DevIL/examples/windows_example/resources/3d.ico diff --git a/DevIL/examples/windows_example/resources/OpenIL.ico b/DevIL/examples/windows_example/resources/OpenIL.ico Binary files differnew file mode 100644 index 00000000..29a27904 --- /dev/null +++ b/DevIL/examples/windows_example/resources/OpenIL.ico diff --git a/DevIL/examples/windows_example/resources/OpenIL_address_bar.ico b/DevIL/examples/windows_example/resources/OpenIL_address_bar.ico Binary files differnew file mode 100644 index 00000000..d3d1d76b --- /dev/null +++ b/DevIL/examples/windows_example/resources/OpenIL_address_bar.ico diff --git a/DevIL/examples/windows_example/resources/bmp.ico b/DevIL/examples/windows_example/resources/bmp.ico Binary files differnew file mode 100644 index 00000000..33c818b9 --- /dev/null +++ b/DevIL/examples/windows_example/resources/bmp.ico diff --git a/DevIL/examples/windows_example/resources/gif.ico b/DevIL/examples/windows_example/resources/gif.ico Binary files differnew file mode 100644 index 00000000..33c818b9 --- /dev/null +++ b/DevIL/examples/windows_example/resources/gif.ico diff --git a/DevIL/examples/windows_example/resources/graphic.ico b/DevIL/examples/windows_example/resources/graphic.ico Binary files differnew file mode 100644 index 00000000..e74f8588 --- /dev/null +++ b/DevIL/examples/windows_example/resources/graphic.ico diff --git a/DevIL/examples/windows_example/resources/jpg.ico b/DevIL/examples/windows_example/resources/jpg.ico Binary files differnew file mode 100644 index 00000000..e74f8588 --- /dev/null +++ b/DevIL/examples/windows_example/resources/jpg.ico diff --git a/DevIL/examples/windows_example/resources/psd.ico b/DevIL/examples/windows_example/resources/psd.ico Binary files differnew file mode 100644 index 00000000..33c818b9 --- /dev/null +++ b/DevIL/examples/windows_example/resources/psd.ico diff --git a/DevIL/examples/windows_example/windowstest-vc8.vcproj b/DevIL/examples/windows_example/windowstest-vc8.vcproj new file mode 100644 index 00000000..f19a4280 --- /dev/null +++ b/DevIL/examples/windows_example/windowstest-vc8.vcproj @@ -0,0 +1,383 @@ +<?xml version="1.0" encoding="Windows-1252"?> +<VisualStudioProject + ProjectType="Visual C++" + Version="8.00" + Name="WindowsTest" + ProjectGUID="{22B03048-FD11-4D7F-88F5-C2628F8B6777}" + TargetFrameworkVersion="131072" + > + <Platforms> + <Platform + Name="Win32" + /> + </Platforms> + <ToolFiles> + </ToolFiles> + <Configurations> + <Configuration + Name="Release|Win32" + OutputDirectory=".\../bin" + IntermediateDirectory=".\obj" + ConfigurationType="1" + InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops" + UseOfMFC="0" + ATLMinimizesCRunTimeLibraryUsage="false" + CharacterSet="1" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + PreprocessorDefinitions="NDEBUG" + MkTypLibCompatible="true" + SuppressStartupBanner="true" + TargetEnvironment="1" + TypeLibraryName=".\../bin/WindowsTest.tlb" + HeaderFileName="" + /> + <Tool + Name="VCCLCompilerTool" + AdditionalOptions="/D _CRT_SECURE_NO_DEPRECATE" + Optimization="2" + InlineFunctionExpansion="1" + PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS" + StringPooling="true" + RuntimeLibrary="2" + EnableFunctionLevelLinking="true" + PrecompiledHeaderFile=".\obj/WindowsTest.pch" + AssemblerListingLocation=".\obj/" + ObjectFile=".\obj/" + ProgramDataBaseFileName=".\obj/" + WarningLevel="3" + SuppressStartupBanner="true" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + PreprocessorDefinitions="NDEBUG" + Culture="1033" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLinkerTool" + AdditionalDependencies="devil.lib ilu.lib ilut.lib comdlg32.lib user32.lib advapi32.lib gdi32.lib shell32.lib" + OutputFile=".\../bin/WindowsTest.exe" + LinkIncremental="1" + SuppressStartupBanner="true" + ProgramDatabaseFile=".\../bin/WindowsTest.pdb" + SubSystem="2" + RandomizedBaseAddress="1" + DataExecutionPrevention="0" + TargetMachine="1" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCManifestTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + SuppressStartupBanner="true" + OutputFile=".\../bin/WindowsTest.bsc" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCAppVerifierTool" + /> + <Tool + Name="VCPostBuildEventTool" + /> + </Configuration> + <Configuration + Name="Debug|Win32" + OutputDirectory=".\../bin/debug" + IntermediateDirectory=".\obj/debug" + ConfigurationType="1" + InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops" + UseOfMFC="0" + ATLMinimizesCRunTimeLibraryUsage="false" + CharacterSet="1" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + PreprocessorDefinitions="_DEBUG" + MkTypLibCompatible="true" + SuppressStartupBanner="true" + TargetEnvironment="1" + TypeLibraryName=".\../bin/debug/WindowsTest.tlb" + HeaderFileName="" + /> + <Tool + Name="VCCLCompilerTool" + Optimization="0" + PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS" + MinimalRebuild="true" + BasicRuntimeChecks="3" + RuntimeLibrary="3" + PrecompiledHeaderFile=".\obj/debug/WindowsTest.pch" + AssemblerListingLocation=".\obj/debug/" + ObjectFile=".\obj/debug/" + ProgramDataBaseFileName=".\obj/debug/" + WarningLevel="3" + SuppressStartupBanner="true" + DebugInformationFormat="4" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + PreprocessorDefinitions="_DEBUG" + Culture="1033" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLinkerTool" + AdditionalDependencies="comdlg32.lib user32.lib advapi32.lib gdi32.lib shell32.lib" + OutputFile=".\../bin/debug/WindowsTest.exe" + LinkIncremental="2" + SuppressStartupBanner="true" + GenerateDebugInformation="true" + ProgramDatabaseFile=".\../bin/debug/WindowsTest.pdb" + SubSystem="2" + RandomizedBaseAddress="1" + DataExecutionPrevention="0" + TargetMachine="1" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCManifestTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + SuppressStartupBanner="true" + OutputFile=".\../bin/debug/WindowsTest.bsc" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCAppVerifierTool" + /> + <Tool + Name="VCPostBuildEventTool" + /> + </Configuration> + <Configuration + Name="Dynamic|Win32" + OutputDirectory=".\WindowsTest___Win32_Dynamic" + IntermediateDirectory=".\WindowsTest___Win32_Dynamic" + ConfigurationType="1" + InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops" + UseOfMFC="0" + ATLMinimizesCRunTimeLibraryUsage="false" + CharacterSet="2" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + PreprocessorDefinitions="NDEBUG" + MkTypLibCompatible="true" + SuppressStartupBanner="true" + TargetEnvironment="1" + TypeLibraryName=".\WindowsTest___Win32_Dynamic/WindowsTest.tlb" + HeaderFileName="" + /> + <Tool + Name="VCCLCompilerTool" + Optimization="2" + InlineFunctionExpansion="1" + PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS" + StringPooling="true" + RuntimeLibrary="2" + EnableFunctionLevelLinking="true" + PrecompiledHeaderFile=".\WindowsTest___Win32_Dynamic/WindowsTest.pch" + AssemblerListingLocation=".\WindowsTest___Win32_Dynamic/" + ObjectFile=".\WindowsTest___Win32_Dynamic/" + ProgramDataBaseFileName=".\WindowsTest___Win32_Dynamic/" + WarningLevel="3" + SuppressStartupBanner="true" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + PreprocessorDefinitions="NDEBUG" + Culture="1033" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLinkerTool" + OutputFile="../bin/WindowsTest.exe" + LinkIncremental="1" + SuppressStartupBanner="true" + ProgramDatabaseFile="../bin/debug/WindowsTest.pdb" + SubSystem="2" + RandomizedBaseAddress="1" + DataExecutionPrevention="0" + TargetMachine="1" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCManifestTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + SuppressStartupBanner="true" + OutputFile=".\WindowsTest___Win32_Dynamic/WindowsTest.bsc" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCAppVerifierTool" + /> + <Tool + Name="VCPostBuildEventTool" + /> + </Configuration> + </Configurations> + <References> + </References> + <Files> + <Filter + Name="Source Files" + Filter="cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" + > + <File + RelativePath="WindowsTest.cpp" + > + <FileConfiguration + Name="Release|Win32" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + <FileConfiguration + Name="Debug|Win32" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + <FileConfiguration + Name="Dynamic|Win32" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + </File> + </Filter> + <Filter + Name="Header Files" + Filter="h;hpp;hxx;hm;inl" + > + <File + RelativePath="resource.h" + > + </File> + </Filter> + <Filter + Name="Resource Files" + Filter="ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe" + > + <File + RelativePath="resources\OpenIL.ico" + > + </File> + <File + RelativePath="WindowsTest.rc" + > + <FileConfiguration + Name="Release|Win32" + > + <Tool + Name="VCResourceCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + <FileConfiguration + Name="Debug|Win32" + > + <Tool + Name="VCResourceCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + <FileConfiguration + Name="Dynamic|Win32" + > + <Tool + Name="VCResourceCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + </File> + </Filter> + </Files> + <Globals> + </Globals> +</VisualStudioProject> |