mirror of
https://github.com/love2d/megasource.git
synced 2026-08-17 03:02:49 +02:00
Add DevIL 1.7.8.
This commit is contained in:
@@ -0,0 +1,535 @@
|
||||
'-----------------------------------------------------------------------------
|
||||
'
|
||||
' ImageLib Sources
|
||||
' Copyright (C) 2000-2002 by Denton Woods
|
||||
' Last modified: 06/22/2002 <--Y2K Compliant! =]
|
||||
'
|
||||
' Filename: il/il.h
|
||||
'
|
||||
' Description: The main include file for DevIL
|
||||
'
|
||||
'-----------------------------------------------------------------------------
|
||||
'-----------------------------------------------------------------------------
|
||||
'
|
||||
' Translated to Powerbasic by Peter Scheutz, Scheutz & Clementsen Design
|
||||
' Web: http://www.scheutz.dk
|
||||
' e-mail: sourcecode@scheutz.dk
|
||||
'
|
||||
' Last modified: 06/22/2002
|
||||
' Based on DevIL Ver. 1.6.1 headers
|
||||
'
|
||||
' Filename: il.inc
|
||||
'
|
||||
' Description: PB main include file for DevIL
|
||||
'
|
||||
' For information on use and download of DevIL goto: http://openil.sourceforge.net/
|
||||
' (Get docs and "End User Package")
|
||||
'
|
||||
' Report errors in the Powerbasic includes to e-mail above.
|
||||
'
|
||||
' For general help on Powerbasic and DevIL, try the forums at:
|
||||
' http://www.powerbasic.com
|
||||
'-----------------------------------------------------------------------------
|
||||
|
||||
' #ifndef __il_h_
|
||||
' #ifndef __IL_H__
|
||||
|
||||
' %__il_h_
|
||||
' %__IL_H__
|
||||
|
||||
' #ifdef __cplusplus
|
||||
' extern "C" {
|
||||
' #endif
|
||||
|
||||
'%IL_NO_BMP
|
||||
'%IL_NO_CUT
|
||||
'%IL_NO_CHEAD
|
||||
'%IL_NO_DDS
|
||||
'%IL_NO_DOOM
|
||||
'%IL_NO_ICO
|
||||
'%IL_NO_JPG
|
||||
'%IL_NO_LIF
|
||||
'%IL_NO_LBM
|
||||
'%IL_NO_MDL
|
||||
'%IL_NO_PCD
|
||||
'%IL_NO_PCX
|
||||
'%IL_NO_PIC
|
||||
'%IL_NO_PNG
|
||||
'%IL_NO_PNM
|
||||
'%IL_NO_RAW
|
||||
'%IL_NO_SGI
|
||||
'%IL_NO_TGA
|
||||
'%IL_NO_TIF
|
||||
'%IL_NO_WAL
|
||||
'%IL_NO_DDS
|
||||
'%IL_NO_DCX
|
||||
'%IL_NO_PSD
|
||||
'%IL_NO_PSP
|
||||
'%IL_NO_PXR
|
||||
'%IL_NO_RAW
|
||||
'%IL_NO_SGI
|
||||
'%IL_NO_TGA
|
||||
'%IL_NO_TIF
|
||||
'%IL_NO_WAL
|
||||
'%IL_NO_XPM
|
||||
|
||||
'%IL_USE_IJL ' Whether we use the Intel Jpeg Library (else use libjpeg).
|
||||
|
||||
|
||||
' #ifdef _WIN32
|
||||
'%WIN32_LEAN_AND_MEAN ' Exclude rarely-used stuff from Windows headers
|
||||
'#include <windows.h>
|
||||
' #ifdef _MSC_VER
|
||||
' #ifndef _IL_BUILD_LIBRARY
|
||||
' #ifdef _DEBUG
|
||||
' #pragma comment(lib, "devil-d.lib")
|
||||
' #else
|
||||
' #pragma comment(lib, "devil.lib")
|
||||
' #endif'_DEBUG
|
||||
' #endif'_IL_BUILD_LIBRARY
|
||||
' #endif'_MSC_VER
|
||||
' #endif'_WIN32
|
||||
|
||||
' #include <stdio.h>
|
||||
|
||||
' typedef unsigned int ILenum;
|
||||
' typedef unsigned char ILboolean;
|
||||
' typedef unsigned int ILbitfield;
|
||||
' typedef char ILbyte;
|
||||
' typedef short ILshort;
|
||||
' typedef int ILint;
|
||||
' typedef int ILsizei;
|
||||
' typedef unsigned char ILubyte;
|
||||
' typedef unsigned short ILushort;
|
||||
' typedef unsigned int ILuint;
|
||||
' typedef float ILfloat;
|
||||
' typedef float ILclampf;
|
||||
' typedef double ILdouble;
|
||||
' typedef double ILclampd;
|
||||
' typedef void ILvoid;
|
||||
|
||||
|
||||
%IL_FALSE = 0
|
||||
%IL_TRUE = 1
|
||||
|
||||
|
||||
' Matches OpenGL's right now.
|
||||
%IL_COLOUR_INDEX = &H1900&
|
||||
%IL_COLOR_INDEX = &H1900&
|
||||
%IL_RGB = &H1907&
|
||||
%IL_RGBA = &H1908&
|
||||
%IL_BGR = &H80E0&
|
||||
%IL_BGRA = &H80E1&
|
||||
%IL_LUMINANCE = &H1909&
|
||||
|
||||
|
||||
%IL_BYTE = &H1400&
|
||||
%IL_UNSIGNED_BYTE = &H1401&
|
||||
%IL_SHORT = &H1402&
|
||||
%IL_UNSIGNED_SHORT = &H1403&
|
||||
%IL_INT = &H1404&
|
||||
%IL_UNSIGNED_INT = &H1405&
|
||||
%IL_FLOAT = &H1406&
|
||||
%GL_DOUBLE = &H140A&
|
||||
|
||||
|
||||
%IL_VENDOR = &H1F00&
|
||||
|
||||
|
||||
'
|
||||
' IL-specific #define's
|
||||
'
|
||||
|
||||
%IL_VERSION_1_5_6 = 1
|
||||
%IL_VERSION = 156
|
||||
%IL_LOAD_EXT = &H1F01&
|
||||
%IL_SAVE_EXT = &H1F02&
|
||||
|
||||
|
||||
' Attribute Bits
|
||||
%IL_ORIGIN_BIT = &H00000001&
|
||||
%IL_FILE_BIT = &H00000002&
|
||||
%IL_PAL_BIT = &H00000004&
|
||||
%IL_FORMAT_BIT = &H00000008&
|
||||
%IL_TYPE_BIT = &H00000010&
|
||||
%IL_COMPRESS_BIT = &H00000020&
|
||||
%IL_LOADFAIL_BIT = &H00000040&
|
||||
%IL_ALL_ATTRIB_BITS = &H000FFFFF&
|
||||
|
||||
|
||||
' Palette types
|
||||
%IL_PAL_NONE = &H0400&
|
||||
%IL_PAL_RGB24 = &H0401&
|
||||
%IL_PAL_RGB32 = &H0402&
|
||||
%IL_PAL_RGBA32 = &H0403&
|
||||
%IL_PAL_BGR24 = &H0404&
|
||||
%IL_PAL_BGR32 = &H0405&
|
||||
%IL_PAL_BGRA32 = &H0406&
|
||||
|
||||
|
||||
' Image types
|
||||
%IL_TYPE_UNKNOWN = &H0000&
|
||||
%IL_BMP = &H0420&
|
||||
%IL_CUT = &H0421&
|
||||
%IL_DOOM = &H0422&
|
||||
%IL_DOOM_FLAT = &H0423&
|
||||
%IL_ICO = &H0424&
|
||||
%IL_JPG = &H0425&
|
||||
%IL_LBM = &H0426&
|
||||
%IL_PCD = &H0427&
|
||||
%IL_PCX = &H0428&
|
||||
%IL_PIC = &H0429&
|
||||
%IL_PNG = &H042A&
|
||||
%IL_PNM = &H042B&
|
||||
%IL_SGI = &H042C&
|
||||
%IL_TGA = &H042D&
|
||||
%IL_TIF = &H042E&
|
||||
%IL_CHEAD = &H042F&
|
||||
%IL_RAW = &H0430&
|
||||
%IL_MDL = &H0431&
|
||||
%IL_WAL = &H0432&
|
||||
%IL_LIF = &H0434&
|
||||
%IL_MNG = &H0435&
|
||||
%IL_JNG = &H0435&
|
||||
%IL_GIF = &H0436&
|
||||
%IL_DDS = &H0437&
|
||||
%IL_DCX = &H0438&
|
||||
%IL_PSD = &H0439&
|
||||
%IL_EXIF = &H043A&
|
||||
%IL_PSP = &H043B&
|
||||
%IL_PIX = &H043C&
|
||||
%IL_PXR = &H043D&
|
||||
%IL_XPM = &H043E&
|
||||
|
||||
%IL_JASC_PAL = &H0475&
|
||||
|
||||
|
||||
' Error Types
|
||||
%IL_NO_ERROR = &H0000&
|
||||
%IL_INVALID_ENUM = &H0501&
|
||||
%IL_OUT_OF_MEMORY = &H0502&
|
||||
%IL_FORMAT_NOT_SUPPORTED = &H0503&
|
||||
%IL_INTERNAL_ERROR = &H0504&
|
||||
%IL_INVALID_VALUE = &H0505&
|
||||
%IL_ILLEGAL_OPERATION = &H0506&
|
||||
%IL_ILLEGAL_FILE_VALUE = &H0507&
|
||||
%IL_INVALID_FILE_HEADER = &H0508&
|
||||
%IL_INVALID_PARAM = &H0509&
|
||||
%IL_COULD_NOT_OPEN_FILE = &H050A&
|
||||
%IL_INVALID_EXTENSION = &H050B&
|
||||
%IL_FILE_ALREADY_EXISTS = &H050C&
|
||||
%IL_OUT_FORMAT_SAME = &H050D&
|
||||
%IL_STACK_OVERFLOW = &H050E&
|
||||
%IL_STACK_UNDERFLOW = &H050F&
|
||||
%IL_INVALID_CONVERSION = &H0510&
|
||||
%IL_BAD_DIMENSIONS = &H0511&
|
||||
%IL_FILE_READ_ERROR = &H0512&
|
||||
|
||||
%IL_LIB_GIF_ERROR = &H05E1&
|
||||
%IL_LIB_JPEG_ERROR = &H05E2&
|
||||
%IL_LIB_PNG_ERROR = &H05E3&
|
||||
%IL_LIB_TIFF_ERROR = &H05E4&
|
||||
%IL_LIB_MNG_ERROR = &H05E5&
|
||||
%IL_UNKNOWN_ERROR = &H05FF&
|
||||
|
||||
|
||||
' Origin Definitions
|
||||
%IL_ORIGIN_SET = &H0600&
|
||||
%IL_ORIGIN_LOWER_LEFT = &H0601&
|
||||
%IL_ORIGIN_UPPER_LEFT = &H0602&
|
||||
%IL_ORIGIN_MODE = &H0603&
|
||||
|
||||
|
||||
' Format and Type Mode Definitions
|
||||
%IL_FORMAT_SET = &H0610&
|
||||
%IL_FORMAT_MODE = &H0611&
|
||||
%IL_TYPE_SET = &H0612&
|
||||
%IL_TYPE_MODE = &H0613&
|
||||
|
||||
|
||||
' File definitions
|
||||
%IL_FILE_OVERWRITE = &H0620&
|
||||
%IL_FILE_MODE = &H0621&
|
||||
|
||||
|
||||
' Palette definitions
|
||||
%IL_CONV_PAL = &H0630&
|
||||
|
||||
|
||||
' Load fail definitions
|
||||
%IL_DEFAULT_ON_FAIL = &H0632&
|
||||
|
||||
|
||||
' Key colour definitions
|
||||
%IL_USE_KEY_COLOUR = &H0635&
|
||||
%IL_USE_KEY_COLOR = &H0635&
|
||||
|
||||
|
||||
' Interlace definitions
|
||||
%IL_SAVE_INTERLACED = &H0639&
|
||||
%IL_INTERLACE_MODE = &H063A&
|
||||
|
||||
|
||||
' Quantization definitions
|
||||
%IL_QUANTIZATION_MODE = &H0640&
|
||||
%IL_WU_QUANT = &H0641&
|
||||
%IL_NEU_QUANT = &H0642&
|
||||
%IL_NEU_QUANT_SAMPLE = &H0643&
|
||||
|
||||
|
||||
' Hints
|
||||
%IL_FASTEST = &H0660&
|
||||
%IL_LESS_MEM = &H0661&
|
||||
%IL_DONT_CARE = &H0662&
|
||||
%IL_MEM_SPEED_HINT = &H0665&
|
||||
%IL_USE_COMPRESSION = &H0666&
|
||||
%IL_NO_COMPRESSION = &H0667&
|
||||
%IL_COMPRESSION_HINT = &H0668&
|
||||
|
||||
|
||||
' Subimage types
|
||||
%IL_SUB_NEXT = &H0680&
|
||||
%IL_SUB_MIPMAP = &H0681&
|
||||
%IL_SUB_LAYER = &H0682&
|
||||
|
||||
|
||||
' Compression definitions
|
||||
%IL_COMPRESS_MODE = &H0700&
|
||||
%IL_COMPRESS_NONE = &H0701&
|
||||
%IL_COMPRESS_RLE = &H0702&
|
||||
%IL_COMPRESS_LZO = &H0703&
|
||||
%IL_COMPRESS_ZLIB = &H0704&
|
||||
|
||||
|
||||
' File format-specific values
|
||||
%IL_TGA_CREATE_STAMP = &H0710&
|
||||
%IL_JPG_QUALITY = &H0711&
|
||||
%IL_PNG_INTERLACE = &H0712&
|
||||
%IL_TGA_RLE = &H0713&
|
||||
%IL_BMP_RLE = &H0714&
|
||||
%IL_SGI_RLE = &H0715&
|
||||
%IL_TGA_CREATE_STAMP = &H0710&
|
||||
%IL_JPG_QUALITY = &H0711&
|
||||
%IL_PNG_INTERLACE = &H0712&
|
||||
%IL_TGA_RLE = &H0713&
|
||||
%IL_BMP_RLE = &H0714&
|
||||
%IL_SGI_RLE = &H0715&
|
||||
%IL_TGA_ID_STRING = &H0717&
|
||||
%IL_TGA_AUTHNAME_STRING = &H0718&
|
||||
%IL_TGA_AUTHCOMMENT_STRING = &H0719&
|
||||
%IL_PNG_AUTHNAME_STRING = &H071A&
|
||||
%IL_PNG_TITLE_STRING = &H071B&
|
||||
%IL_PNG_DESCRIPTION_STRING = &H071C&
|
||||
%IL_TIF_DESCRIPTION_STRING = &H071D&
|
||||
%IL_TIF_HOSTCOMPUTER_STRING = &H071E&
|
||||
%IL_TIF_DOCUMENTNAME_STRING = &H071F&
|
||||
%IL_TIF_AUTHNAME_STRING = &H0720&
|
||||
%IL_JPG_SAVE_FORMAT = &H0721&
|
||||
%IL_CHEAD_HEADER_STRING = &H0722&
|
||||
%IL_PCD_PICNUM = &H0723&
|
||||
|
||||
|
||||
' DXTC definitions
|
||||
%IL_DXTC_FORMAT = &H0705&
|
||||
%IL_DXT1 = &H0706&
|
||||
%IL_DXT2 = &H0707&
|
||||
%IL_DXT3 = &H0708&
|
||||
%IL_DXT4 = &H0709&
|
||||
%IL_DXT5 = &H070A&
|
||||
%IL_DXT_NO_COMP = &H070B&
|
||||
%IL_KEEP_DXTC_DATA = &H070C&
|
||||
%IL_DXTC_DATA_FORMAT = &H070D&
|
||||
|
||||
|
||||
' Cube map definitions
|
||||
%IL_CUBEMAP_POSITIVEX = &H00000400&
|
||||
%IL_CUBEMAP_NEGATIVEX = &H00000800&
|
||||
%IL_CUBEMAP_POSITIVEY = &H00001000&
|
||||
%IL_CUBEMAP_NEGATIVEY = &H00002000&
|
||||
%IL_CUBEMAP_POSITIVEZ = &H00004000&
|
||||
%IL_CUBEMAP_NEGATIVEZ = &H00008000&
|
||||
|
||||
|
||||
' Values
|
||||
%IL_VERSION_NUM = &H0DE2&
|
||||
%IL_IMAGE_WIDTH = &H0DE4&
|
||||
%IL_IMAGE_HEIGHT = &H0DE5&
|
||||
%IL_IMAGE_DEPTH = &H0DE6&
|
||||
%IL_IMAGE_SIZE_OF_DATA = &H0DE7&
|
||||
%IL_IMAGE_BPP = &H0DE8&
|
||||
%IL_IMAGE_BYTES_PER_PIXEL = &H0DE8&
|
||||
%IL_IMAGE_BITS_PER_PIXEL = &H0DE9&
|
||||
%IL_IMAGE_FORMAT = &H0DEA&
|
||||
%IL_IMAGE_TYPE = &H0DEB&
|
||||
%IL_PALETTE_TYPE = &H0DEC&
|
||||
%IL_PALETTE_SIZE = &H0DED&
|
||||
%IL_PALETTE_BPP = &H0DEE&
|
||||
%IL_PALETTE_NUM_COLS = &H0DEF&
|
||||
%IL_PALETTE_BASE_TYPE = &H0DF0&
|
||||
%IL_NUM_IMAGES = &H0DF1&
|
||||
%IL_NUM_MIPMAPS = &H0DF2&
|
||||
%IL_NUM_LAYERS = &H0DF3&
|
||||
%IL_ACTIVE_IMAGE = &H0DF4&
|
||||
%IL_ACTIVE_MIPMAP = &H0DF5&
|
||||
%IL_ACTIVE_LAYER = &H0DF6&
|
||||
%IL_CUR_IMAGE = &H0DF7&
|
||||
%IL_IMAGE_DURATION = &H0DF8&
|
||||
|
||||
|
||||
'
|
||||
' Section shamelessly modified from the glut header.
|
||||
'
|
||||
|
||||
' This is from Win32's <windef.h>
|
||||
' #if (_MSC_VER >= 800) || defined(_STDCALL_SUPPORTED) || defined(__BORLANDC__) || defined(__LCC__)
|
||||
' = %ILAPIENTRY = __stdcall
|
||||
' %IL_PACKSTRUCT
|
||||
' #else
|
||||
' %ILAPIENTRY
|
||||
' = %IL_PACKSTRUCT = __attribute__ = ((packed))
|
||||
' #endif
|
||||
' This is from Win32's <wingdi.h> and <winnt.h>
|
||||
' #if defined(__LCC__)
|
||||
' = %ILAPI = __stdcall
|
||||
' #elif _WIN32
|
||||
' #ifdef _IL_BUILD_LIBRARY
|
||||
' = %ILAPI = __declspec(dllexport)
|
||||
' #else
|
||||
' = %ILAPI = __declspec(dllimport)
|
||||
' #endif
|
||||
' #else
|
||||
' %ILAPI
|
||||
' #endif
|
||||
|
||||
|
||||
%IL_SEEK_SET = 0
|
||||
%IL_SEEK_CUR = 1
|
||||
%IL_SEEK_END = 2
|
||||
%IL_EOF = -1
|
||||
|
||||
|
||||
' Callback functions for file reading
|
||||
' typedef void* ILHANDLE;
|
||||
' typedef ILvoid (ILAPIENTRY *fCloseRProc) (ILHANDLE);
|
||||
' typedef ILboolean (ILAPIENTRY *fEofProc) (ILHANDLE);
|
||||
' typedef ILint (ILAPIENTRY *fGetcProc) (ILHANDLE);
|
||||
' typedef ILHANDLE (ILAPIENTRY *fOpenRProc) (char*);
|
||||
' typedef ILint (ILAPIENTRY *fReadProc) (void*, ILuint, ILuint, ILHANDLE);
|
||||
' typedef ILint (ILAPIENTRY *fSeekRProc) (ILHANDLE, ILint, ILint);
|
||||
' typedef ILint (ILAPIENTRY *fTellRProc) (ILHANDLE);
|
||||
|
||||
' Callback functions for file writing
|
||||
' typedef ILvoid (ILAPIENTRY *fCloseWProc) (ILHANDLE);
|
||||
' typedef ILHANDLE (ILAPIENTRY *fOpenWProc) (char*);
|
||||
' typedef ILint (ILAPIENTRY *fPutcProc) (ILubyte, ILHANDLE);
|
||||
' typedef ILint (ILAPIENTRY *fSeekWProc) (ILHANDLE, ILint, ILint);
|
||||
' typedef ILint (ILAPIENTRY *fTellWProc) (ILHANDLE);
|
||||
' typedef ILint (ILAPIENTRY *fWriteProc) (void*, ILuint, ILuint, ILHANDLE);
|
||||
|
||||
|
||||
' Registered format procedures
|
||||
' typedef ILboolean (ILAPIENTRY *IL_LOADPROC) (char*);
|
||||
' typedef ILboolean (ILAPIENTRY *IL_SAVEPROC) (char*);
|
||||
|
||||
|
||||
' ImageLib Functions
|
||||
Declare Function ilActiveImage Lib "DevIL.dll" Alias "ilActiveImage" (ByVal pb_Number As Dword) As Byte
|
||||
Declare Function ilActiveLayer Lib "DevIL.dll" Alias "ilActiveLayer" (ByVal pb_Number As Dword) As Byte
|
||||
Declare Function ilActiveMipmap Lib "DevIL.dll" Alias "ilActiveMipmap" (ByVal pb_Number As Dword) As Byte
|
||||
Declare Function ilApplyPal Lib "DevIL.dll" Alias "ilApplyPal" (ByRef pb_FileName As Asciiz) As Byte
|
||||
Declare Function ilApplyProfile Lib "DevIL.dll" Alias "ilApplyProfile" (ByRef pb_InProfile
|
||||
As Asciiz, ByRef pb_OutProfile As Asciiz) As Byte
|
||||
Declare Sub ilBindImage Lib "DevIL.dll" Alias "ilBindImage" (ByVal pb_Image As Dword)
|
||||
Declare Function ilBlit Lib "DevIL.dll" Alias "ilBlit" (ByVal pb_Src As Long, ByVal pb_DestX As Long, ByVal pb_DestY As Long, ByVal pb_DestZ as Dword, ByVal pb_SrcX As Dword, ByVal pb_SrcY As Dword, ByVal pb_SrcZ As Dword, ByVal pb_Width As Dword, ByVal pb_Height As Dword, ByVal pb_Depth As Dword) As Byte
|
||||
Declare Sub ilClearColour Lib "DevIL.dll" Alias "ilClearColour" (ByVal pb_Red As Single, ByVal pb_Green As Single, ByVal pb_Blue As Single, ByVal pb_Alpha As Single)
|
||||
Declare Function ilClearImage Lib "DevIL.dll" Alias "ilClearImage" () As Byte
|
||||
Declare Function ilCloneCurImage Lib "DevIL.dll" Alias "ilCloneCurImage" () As Dword
|
||||
Declare Function ilCompressFunc Lib "DevIL.dll" Alias "ilCompressFunc" (ByVal pb_Mode As Dword) As Byte
|
||||
Declare Function ilConvertImage Lib "DevIL.dll" Alias "ilConvertImage" (ByVal pb_DestFormat As Dword, ByVal pb_DestType As Dword) As Byte
|
||||
Declare Function ilConvertPal Lib "DevIL.dll" Alias "ilConvertPal" (ByVal pb_DestFormat As Dword) As Byte
|
||||
Declare Function ilCopyImage Lib "DevIL.dll" Alias "ilCopyImage" (ByVal pb_Src As Dword) As Byte
|
||||
Declare Function ilCopyPixels Lib "DevIL.dll" Alias "ilCopyPixels" (ByVal pb_XOff As Dword, ByVal pb_YOff As Dword, ByVal pb_ZOff As Dword, ByVal pb_Width As Dword, ByVal pb_Height As Dword, ByVal pb_Depth As Dword, ByVal pb_Format As Dword, ByVal pb_Type As Dword, ByRef pb_Data As Long) As Dword
|
||||
Declare Function ilCreateSubImage Lib "DevIL.dll" Alias "ilCreateSubImage" (ByVal pb_Type As Dword, ByVal pb_Num As Dword) As Dword
|
||||
Declare Function ilDefaultImage Lib "DevIL.dll" Alias "ilDefaultImage" () As Byte
|
||||
Declare Sub ilDeleteImages Lib "DevIL.dll" Alias "ilDeleteImages" (ByVal pb_Num As Long, ByRef pb_Images As Dword)
|
||||
Declare Function ilDisable Lib "DevIL.dll" Alias "ilDisable" (ByVal pb_Mode As Dword) As Byte
|
||||
Declare Function ilEnable Lib "DevIL.dll" Alias "ilEnable" (ByVal pb_Mode As Dword) As Byte
|
||||
Declare Function ilFormatFunc Lib "DevIL.dll" Alias "ilFormatFunc" (ByVal pb_Mode As Dword) As Byte
|
||||
Declare Sub ilGenImages Lib "DevIL.dll" Alias "ilGenImages" (ByVal pb_Num As Long, ByRef pb_Images As Dword)
|
||||
Declare Function ilGetAlpha Lib "DevIL.dll" Alias "ilGetAlpha" (ByVal pb_Type As Dword) As Long
|
||||
Declare Function ilGetBoolean Lib "DevIL.dll" Alias "ilGetBoolean" (ByVal pb_Mode As Dword) As Byte
|
||||
Declare Sub ilGetBooleanv Lib "DevIL.dll" Alias "ilGetBooleanv" (ByVal pb_Mode As Dword, ByRef pb_Param As Byte)
|
||||
Declare Function ilGetData Lib "DevIL.dll" Alias "ilGetData" () As Long
|
||||
Declare Function ilGetError Lib "DevIL.dll" Alias "ilGetError" () As Dword
|
||||
Declare Function ilGetInteger Lib "DevIL.dll" Alias "ilGetInteger" (ByVal pb_Mode As Dword) As Long
|
||||
Declare Sub ilGetIntegerv Lib "DevIL.dll" Alias "ilGetIntegerv" (ByVal pb_Mode As Dword, ByRef pb_Param As Long)
|
||||
Declare Function ilGetLumpPos Lib "DevIL.dll" Alias "ilGetLumpPos" () As Dword
|
||||
Declare Function ilGetPalette Lib "DevIL.dll" Alias "ilGetPalette" () As Long
|
||||
Declare Function ilGetString Lib "DevIL.dll" Alias "ilGetString" (ByVal pb_StringName As Dword) As String
|
||||
Declare Sub ilHint Lib "DevIL.dll" Alias "ilHint" (ByVal pb_Target As Dword, ByVal pb_Mode As Dword)
|
||||
Declare Sub ilInit Lib "DevIL.dll" Alias "ilInit" ()
|
||||
Declare Function ilIsDisabled Lib "DevIL.dll" Alias "ilIsDisabled" (ByVal pb_Mode As Dword) As Byte
|
||||
Declare Function ilIsEnabled Lib "DevIL.dll" Alias "ilIsEnabled" (ByVal pb_Mode As Dword) As Byte
|
||||
Declare Function ilIsImage Lib "DevIL.dll" Alias "ilIsImage" (ByVal pb_Image As Dword) As Byte
|
||||
Declare Function ilIsValid Lib "DevIL.dll" Alias "ilIsValid" (ByVal pb_Type As Dword, ByRef pb_FileName As Asciiz) As Byte
|
||||
Declare Function ilIsValidF Lib "DevIL.dll" Alias "ilIsValidF" (ByVal pb_Type As Dword, ByVal pb_File As Long) As Byte
|
||||
Declare Function ilIsValidL Lib "DevIL.dll" Alias "ilIsValidL" (ByVal pb_Type As Dword, ByRef pb_Lump As Long, ByVal pb_Size As Dword) As Byte
|
||||
Declare Sub ilKeyColour Lib "DevIL.dll" Alias "ilKeyColour" (ByVal pb_Red As Single, ByVal pb_Green As Single, ByVal pb_Blue As Single, ByVal pb_Alpha As Single)
|
||||
Declare Function ilLoad Lib "DevIL.dll" Alias "ilLoad" (ByVal pb_Type As Dword, ByRef pb_FileName As Asciiz) As Byte
|
||||
Declare Function ilLoadF Lib "DevIL.dll" Alias "ilLoadF" (ByVal pb_Type As Dword, ByVal pb_File As Long) As Byte
|
||||
Declare Function ilLoadImage Lib "DevIL.dll" Alias "ilLoadImage" (ByRef pb_FileName As Asciiz) As Byte
|
||||
Declare Function ilLoadL Lib "DevIL.dll" Alias "ilLoadL" (ByVal pb_Type As Dword, ByRef pb_Lump As Long, ByVal pb_Size As Dword) As Byte
|
||||
Declare Function ilLoadPal Lib "DevIL.dll" Alias "ilLoadPal" (ByRef pb_FileName As Asciiz) As Byte
|
||||
Declare Function ilOriginFunc Lib "DevIL.dll" Alias "ilOriginFunc" (ByVal pb_Mode As Dword) As Byte
|
||||
Declare Function ilOverlayImage Lib "DevIL.dll" Alias "ilOverlayImage" (ByVal pb_Src As Dword, ByVal pb_XCoord As Long, ByVal pb_YCoord As Long, ByVal pb_ZCoord As Long) As Byte
|
||||
Declare Sub ilPopAttrib Lib "DevIL.dll" Alias "ilPopAttrib" ()
|
||||
Declare Sub ilPushAttrib Lib "DevIL.dll" Alias "ilPushAttrib" (ByVal pb_Bits As Dword)
|
||||
Declare Sub ilRegisterFormat Lib "DevIL.dll" Alias "ilRegisterFormat" (ByVal pb_Format As Dword)
|
||||
Declare Function ilRegisterLoad Lib "DevIL.dll" Alias "ilRegisterLoad" (ByRef pb_Ext As Asciiz, ByVal pb_Load As Dword) As Byte
|
||||
Declare Function ilRegisterMipNum Lib "DevIL.dll" Alias "ilRegisterMipNum" (ByVal pb_Num As Dword) As Byte
|
||||
Declare Function ilRegisterNumImages Lib "DevIL.dll" Alias "ilRegisterNumImages" (ByVal pb_Num As Dword) As Byte
|
||||
Declare Sub ilRegisterOrigin Lib "DevIL.dll" Alias "ilRegisterOrigin" (ByVal pb_Origin As Dword)
|
||||
Declare Sub ilRegisterPal Lib "DevIL.dll" Alias "ilRegisterPal" (ByRef pb_Pal As Long, ByVal pb_Size As Dword, ByVal pb_Type As Dword)
|
||||
Declare Function ilRegisterSave Lib "DevIL.dll" Alias "ilRegisterSave" (ByRef pb_Ext As Asciiz, ByVal pb_Save As Dword) As Byte
|
||||
Declare Sub ilRegisterType Lib "DevIL.dll" Alias "ilRegisterType" (ByVal pb_Type As Dword)
|
||||
Declare Function ilRemoveLoad Lib "DevIL.dll" Alias "ilRemoveLoad" (ByRef pb_Ext As Asciiz) As Byte
|
||||
Declare Function ilRemoveSave Lib "DevIL.dll" Alias "ilRemoveSave" (ByRef pb_Ext As Asciiz) As Byte
|
||||
Declare Sub ilResetRead Lib "DevIL.dll" Alias "ilResetRead" ()
|
||||
Declare Sub ilResetWrite Lib "DevIL.dll" Alias "ilResetWrite" ()
|
||||
Declare Function ilSave Lib "DevIL.dll" Alias "ilSave" (ByVal pb_Type As Dword, ByRef pb_FileName As Asciiz) As Byte
|
||||
Declare Function ilSaveF Lib "DevIL.dll" Alias "ilSaveF" (ByVal pb_Type As Dword, ByVal pb_File As Long) As Byte
|
||||
Declare Function ilSaveImage Lib "DevIL.dll" Alias "ilSaveImage" (ByRef pb_FileName As Asciiz) As Byte
|
||||
Declare Function ilSaveL Lib "DevIL.dll" Alias "ilSaveL" (ByVal pb_Type As Dword, ByRef pb_Lump As Long, ByVal pb_Size As Dword) As Byte
|
||||
Declare Function ilSavePal Lib "DevIL.dll" Alias "ilSavePal" (ByRef pb_FileName As Asciiz) As Byte
|
||||
Declare Function ilSetData Lib "DevIL.dll" Alias "ilSetData" (ByRef pb_Data As Long) As Byte
|
||||
Declare Function ilSetDuration Lib "DevIL.dll" Alias "ilSetDuration" (ByVal pb_Duration As Dword) As Byte
|
||||
Declare Sub ilSetInteger Lib "DevIL.dll" Alias "ilSetInteger" (ByVal pb_Mode As Dword, ByVal pb_Param As Dword)
|
||||
Declare Sub ilSetPixels Lib "DevIL.dll" Alias "ilSetPixels" (ByVal pb_XOff As Dword, ByVal pb_YOff As Dword, ByVal pb_ZOff As Dword, ByVal pb_Width As Dword, ByVal pb_Height As Dword, ByVal pb_Depth As Dword, ByVal pb_Format As Dword, ByVal pb_Type As _
|
||||
Dword, ByRef pb_Data As Long)
|
||||
Declare Sub ilSetRead Lib "DevIL.dll" Alias "ilSetRead" (ByVal pb_fOpenRProc As Dword, ByVal pb_fCloseRProc As Dword, ByVal pb_fEofProc As Dword, ByVal pb_fGetcProc As Dword, ByVal pb_fReadProc As Dword, _
|
||||
ByVal pb_fSeekRProc As Dword, ByVal pb_fTellRProc As Dword)
|
||||
Declare Sub ilSetWrite Lib "DevIL.dll" Alias "ilSetWrite" (ByVal pb_fOpenWProc As Dword, ByVal pb_fCloseWProc As Dword, ByVal pb_fPutcProc As Dword, ByVal pb_fSeekWProc As Dword, _
|
||||
ByVal pb_fTellWProc As Dword, ByVal pb_fWriteProc As Dword)
|
||||
Declare Function ilTexImage Lib "DevIL.dll" Alias "ilTexImage" (ByVal pb_Width As Dword, ByVal pb_Height As Dword, ByVal pb_Depth As Dword, ByVal pb_Bpp As Byte, ByVal pb_Format As Dword, ByVal pb_Type As Dword, ByRef pb_Data As Long) As Byte
|
||||
Declare Function ilTypeFunc Lib "DevIL.dll" Alias "ilTypeFunc" (ByVal pb_Mode As Dword) As Byte
|
||||
|
||||
Declare Function ilLoadData Lib "DevIL.dll" Alias "ilLoadData" (ByRef pb_FileName As Asciiz, ByVal pb_Width As Dword, ByVal pb_Height As Dword, ByVal pb_Depth As Dword, ByVal pb_Bpp As Byte) As Byte
|
||||
Declare Function ilLoadDataF Lib "DevIL.dll" Alias "ilLoadDataF" (ByVal pb_File As Long, ByVal pb_Width As Dword, ByVal pb_Height As Dword, ByVal pb_Depth As Dword, ByVal pb_Bpp As Byte) As Byte
|
||||
Declare Function ilLoadDataL Lib "DevIL.dll" Alias "ilLoadDataL" (ByRef pb_Lump As Long, ByVal pb_Size As Dword, ByVal pb_Width As Dword, ByVal pb_Height As Dword, ByVal pb_Depth As Dword, ByVal pb_Bpp As Byte) As Byte
|
||||
Declare Function ilSaveData Lib "DevIL.dll" Alias "ilSaveData" (ByRef pb_FileName As Asciiz) As Byte
|
||||
|
||||
'%ilClearColor = ilClearColour
|
||||
'%ilKeyColor = ilKeyColour
|
||||
|
||||
|
||||
' #if (DJGPP || LINUX)
|
||||
' static void GccMain() __attribute__((constructor));
|
||||
' #endif
|
||||
|
||||
|
||||
' #ifdef __cplusplus
|
||||
' }
|
||||
' #endif
|
||||
|
||||
' #endif /* __IL_H__ */
|
||||
' #endif /* __il_h_ */
|
||||
@@ -0,0 +1,188 @@
|
||||
'-----------------------------------------------------------------------------
|
||||
'
|
||||
' ImageLib Utility Sources
|
||||
' Copyright (C) 2000-2002 by Denton Woods
|
||||
' Last modified: 06/22/2002 <--Y2K Compliant! =]
|
||||
'
|
||||
' Filename: il/ilu.h
|
||||
'
|
||||
' Description: The main include file for OpenILU
|
||||
'
|
||||
'-----------------------------------------------------------------------------
|
||||
'-----------------------------------------------------------------------------
|
||||
'
|
||||
' Translated to Powerbasic by Peter Scheutz, Scheutz & Clementsen Design
|
||||
' Web: http://www.scheutz.dk
|
||||
' e-mail: sourcecode@scheutz.dk
|
||||
'
|
||||
' Last modified: 06/22/2002
|
||||
' Based on DevIL Ver. 1.6.1 headers
|
||||
'
|
||||
' Filename: ilu.inc
|
||||
'
|
||||
' Description: PB main include file for OpenILU
|
||||
'
|
||||
' For information on use and download of OpenIL goto: http://openil.sourceforge.net/
|
||||
' (Get docs and "End User Package")
|
||||
'
|
||||
' Report errors in the Powerbasic includes to e-mail above.
|
||||
'
|
||||
' For general help on Powerbasic and OpenIL, try the forums at:
|
||||
' http://www.powerbasic.com
|
||||
'-----------------------------------------------------------------------------
|
||||
|
||||
' #ifndef __ilu_h_
|
||||
' #ifndef __ILU_H__
|
||||
|
||||
' %__ilu_h_
|
||||
' %__ILU_H__
|
||||
|
||||
' #include <il/il.h>
|
||||
|
||||
' #ifdef __cplusplus
|
||||
' extern "C" {
|
||||
' #endif
|
||||
|
||||
|
||||
' #ifdef _WIN32
|
||||
' #ifdef _MSC_VER
|
||||
' #ifndef _ILU_BUILD_LIBRARY
|
||||
' #ifdef _DEBUG
|
||||
' #pragma comment(lib, "ilu-d.lib")
|
||||
' #else
|
||||
' #pragma comment(lib, "ilu.lib")
|
||||
' #endif'_DEBUG
|
||||
' #endif'_ILU_BUILD_LIBRARY
|
||||
' #endif'_MSC_VER
|
||||
' #endif'_WIN32
|
||||
|
||||
|
||||
%ILU_VERSION_1_5_6 = 1
|
||||
%ILU_VERSION = 156
|
||||
|
||||
|
||||
%ILU_FILTER = &H2600&
|
||||
%ILU_NEAREST = &H2601&
|
||||
%ILU_LINEAR = &H2602&
|
||||
%ILU_BILINEAR = &H2603&
|
||||
%ILU_SCALE_BOX = &H2604&
|
||||
%ILU_SCALE_TRIANGLE = &H2605&
|
||||
%ILU_SCALE_BELL = &H2606&
|
||||
%ILU_SCALE_BSPLINE = &H2607&
|
||||
%ILU_SCALE_LANCZOS3 = &H2608&
|
||||
%ILU_SCALE_MITCHELL = &H2609&
|
||||
|
||||
|
||||
' Error types
|
||||
%ILU_INVALID_ENUM = &H0501&
|
||||
%ILU_OUT_OF_MEMORY = &H0502&
|
||||
%ILU_INTERNAL_ERROR = &H0504&
|
||||
%ILU_INVALID_VALUE = &H0505&
|
||||
%ILU_ILLEGAL_OPERATION = &H0506&
|
||||
%ILU_INVALID_PARAM = &H0509&
|
||||
|
||||
|
||||
' Values
|
||||
%ILU_PLACEMENT = &H0700&
|
||||
%ILU_LOWER_LEFT = &H0701&
|
||||
%ILU_LOWER_RIGHT = &H0702&
|
||||
%ILU_UPPER_LEFT = &H0703&
|
||||
%ILU_UPPER_RIGHT = &H0704&
|
||||
%ILU_CENTER = &H0705&
|
||||
%ILU_CONVOLUTION_MATRIX = &H0710&
|
||||
%ILU_VERSION_NUM = &H0DE2&
|
||||
|
||||
|
||||
' Filters
|
||||
%ILU_FILTER_BLUR = &H0803&
|
||||
%ILU_FILTER_GAUSSIAN_3x3 = &H0804&
|
||||
%ILU_FILTER_GAUSSIAN_5X5 = &H0805&
|
||||
%ILU_FILTER_EMBOSS1 = &H0807&
|
||||
%ILU_FILTER_EMBOSS2 = &H0808&
|
||||
%ILU_FILTER_LAPLACIAN1 = &H080A&
|
||||
%ILU_FILTER_LAPLACIAN2 = &H080B&
|
||||
%ILU_FILTER_LAPLACIAN3 = &H080C&
|
||||
%ILU_FILTER_LAPLACIAN4 = &H080D&
|
||||
%ILU_FILTER_SHARPEN1 = &H080E&
|
||||
%ILU_FILTER_SHARPEN2 = &H080F&
|
||||
%ILU_FILTER_SHARPEN3 = &H0810&
|
||||
|
||||
|
||||
' typedef struct ILinfo
|
||||
Type ILinfo Dword
|
||||
iId As Dword'ILuint Id; ' the image's id
|
||||
iData As Dword '(should this be Byte Ptr? )'ILubyte *Data; ' the image's data
|
||||
iWidth As Dword 'ILuint Width; ' the image's width
|
||||
iHeight As Dword 'ILuint Height; ' the image's height
|
||||
iDepth As Dword 'ILuint Depth; ' the image's depth
|
||||
iBpp As Byte'ILubyte Bpp; ' bytes per pixel (not bits) of the image
|
||||
iSizeOfData As Dword 'ILuint SizeOfData; ' the total size of the data (in bytes)
|
||||
iFormat As Dword 'ILenum Format; ' image format (in IL enum style)
|
||||
iType As Dword 'ILenum Type; ' image type (in IL enum style)
|
||||
iOrigin As Dword 'ILenum Origin; ' origin of the image
|
||||
iPalette As Long 'ILubyte *Palette; ' the image's palette
|
||||
iPalType As Dword 'ILenum PalType; ' palette type
|
||||
iPalSize As Dword 'ILuint PalSize; ' palette size
|
||||
iNumNext As Dword'ILuint NumNext; ' number of images following
|
||||
iNumMips As Dword 'ILuint NumMips; ' number of mipmaps
|
||||
iNumLayers As Dword'ILuint NumLayers; ' number of layers
|
||||
End Type
|
||||
|
||||
|
||||
' ImageLib Utility Functions
|
||||
Declare Function iluAlienify Lib "ilu.dll" Alias "iluAlienify" () As Byte
|
||||
Declare Function iluApplyProfile Lib "ilu.dll" Alias "iluApplyProfile" (ByRef pb_InProfile As Asciiz, ByRef pb_OutProfile As Asciiz) As Byte
|
||||
Declare Function iluBlurAvg Lib "ilu.dll" Alias "iluBlurAvg" (ByVal pb_Iter As Dword) As Byte
|
||||
Declare Function iluBlurGaussian Lib "ilu.dll" Alias "iluBlurGaussian" (ByVal pb_Iter As Dword) As Byte
|
||||
Declare Function iluBuildMipmaps Lib "ilu.dll" Alias "iluBuildMipmaps" () As Byte
|
||||
Declare Function iluColoursUsed Lib "ilu.dll" Alias "iluColoursUsed" () As Dword
|
||||
Declare Function iluCompareImage Lib "ilu.dll" Alias "iluCompareImage" (ByVal pb_Comp As Dword) As Byte
|
||||
Declare Function iluContrast Lib "ilu.dll" Alias "iluContrast" (ByVal pb_Contrast As Single) As Byte
|
||||
Declare Function iluCrop Lib "ilu.dll" Alias "iluCrop" (ByVal pb_XOff As Dword, ByVal pb_YOff As Dword, ByVal pb_ZOff As Dword, ByVal pb_Width As Dword, ByVal pb_Height As Dword, ByVal pb_Depth As Dword) As Byte
|
||||
Declare Sub iluDeleteImage Lib "ilu.dll" Alias "iluDeleteImage" (ByVal pb_Id As Dword)
|
||||
Declare Function iluEdgeDetectE Lib "ilu.dll" Alias "iluEdgeDetectE" () As Byte
|
||||
Declare Function iluEdgeDetectP Lib "ilu.dll" Alias "iluEdgeDetectP" () As Byte
|
||||
Declare Function iluEdgeDetectS Lib "ilu.dll" Alias "iluEdgeDetectS" () As Byte
|
||||
Declare Function iluEmboss Lib "ilu.dll" Alias "iluEmboss" () As Byte
|
||||
Declare Function iluEnlargeCanvas Lib "ilu.dll" Alias "iluEnlargeCanvas" (ByVal pb_Width As Dword, ByVal pb_Height As Dword, ByVal pb_Depth As Dword) As Byte
|
||||
Declare Function iluEnlargeImage Lib "ilu.dll" Alias "iluEnlargeImage" (ByVal pb_XDim As Single, ByVal pb_YDim As Single, ByVal pb_ZDim As Single) As Byte
|
||||
Declare Function iluEqualize Lib "ilu.dll" Alias "iluEqualize" () As Byte
|
||||
Declare Function iluErrorString Lib "ilu.dll" Alias "iluErrorString" (ByVal pb_Error As Dword) As String
|
||||
Declare Function iluFlipImage Lib "ilu.dll" Alias "iluFlipImage" () As Byte
|
||||
Declare Function iluGammaCorrect Lib "ilu.dll" Alias "iluGammaCorrect" (ByVal pb_Gamma As Single) As Byte
|
||||
Declare Function iluGenImage Lib "ilu.dll" Alias "iluGenImage" () As Dword
|
||||
Declare Sub iluGetImageInfo Lib "ilu.dll" Alias "iluGetImageInfo" (ByRef pb_Info As ILinfo)
|
||||
Declare Function iluGetInteger Lib "ilu.dll" Alias "iluGetInteger" (ByVal pb_Mode As Dword) As Long
|
||||
Declare Sub iluGetIntegerv Lib "ilu.dll" Alias "iluGetIntegerv" (ByVal pb_Mode As Dword, ByRef pb_Param As Long)
|
||||
Declare Function iluGetString Lib "ilu.dll" Alias "iluGetString" (ByVal pb_StringName As Dword) As String
|
||||
Declare Sub iluInit Lib "ilu.dll" Alias "iluInit" ()
|
||||
Declare Function iluInvertAlpha Lib "ilu.dll" Alias "iluInvertAlpha" () As Byte
|
||||
Declare Function iluLoadImage Lib "ilu.dll" Alias "iluLoadImage" (ByRef pb_FileName As Asciiz) As Dword
|
||||
Declare Sub iluImageParameter Lib "ilu.dll" Alias "iluImageParameter" (ByVal pb_PName As Dword, ByVal pb_Param As Dword)
|
||||
Declare Function iluMirror Lib "ilu.dll" Alias "iluMirror" () As Byte
|
||||
Declare Function iluNegative Lib "ilu.dll" Alias "iluNegative" () As Byte
|
||||
Declare Function iluNoisify Lib "ilu.dll" Alias "iluNoisify" (ByVal pb_Tolerance As Single) As Byte
|
||||
Declare Function iluPixelize Lib "ilu.dll" Alias "iluPixelize" (ByVal pb_PixSize As Dword) As Byte
|
||||
'Declare Sub iluRegionf Lib "ilu.dll" Alias "iluRegionf" (ByVal pb_ULx As Single, ByVal pb_ULy As Single, ByVal pb_BRx As Single, ByVal pb_BRy As Single)
|
||||
'Declare Sub iluRegioni Lib "ilu.dll" Alias "iluRegioni" (ByVal pb_ULx As Dword, ByVal pb_ULy As Dword, ByVal pb_BRx As Dword, ByVal pb_BRy As Dword)
|
||||
Declare Function iluReplaceColour Lib "ilu.dll" Alias "iluReplaceColour" (ByVal pb_Red As Byte, ByVal pb_Green As Byte, ByVal pb_Blue As Byte, ByVal pb_Tolerance As Single) As Byte
|
||||
Declare Function iluRotate Lib "ilu.dll" Alias "iluRotate" (ByVal pb_Angle As Single) As Byte
|
||||
Declare Function iluRotate3D Lib "ilu.dll" Alias "iluRotate3D" (ByVal pb_x As Single, ByVal pb_y As Single, ByVal pb_z As Single, ByVal pb_Angle As Single) As Byte
|
||||
Declare Function iluSaturate1f Lib "ilu.dll" Alias "iluSaturate1f" (ByVal pb_Saturation As Single) As Byte
|
||||
Declare Function iluSaturate4f Lib "ilu.dll" Alias "iluSaturate4f" (ByVal pb_r As Single, ByVal pb_g As Single, ByVal pb_b As Single, ByVal pb_Saturation As Single) As Byte
|
||||
Declare Function iluScale Lib "ilu.dll" Alias "iluScale" (ByVal pb_Width As Dword, ByVal pb_Height As Dword, ByVal pb_Depth As Dword) As Byte
|
||||
Declare Function iluScaleColours Lib "ilu.dll" Alias "iluScaleColours" (ByVal pb_r As Single, ByVal pb_g As Single, ByVal pb_b As Single) As Byte
|
||||
Declare Function iluSharpen Lib "ilu.dll" Alias "iluSharpen" (ByVal pb_Factor As Single, ByVal pb_Iter As Dword) As Byte
|
||||
Declare Function iluSwapColours Lib "ilu.dll" Alias "iluSwapColours" () As Byte
|
||||
Declare Function iluWave Lib "ilu.dll" Alias "iluWave" (ByVal pb_Angle As Single) As Byte
|
||||
|
||||
'%iluColorsUsed = iluColoursUsed
|
||||
'%iluSwapColors = iluSwapColours
|
||||
|
||||
|
||||
' #ifdef __cplusplus
|
||||
' }
|
||||
' #endif
|
||||
|
||||
' #endif /* __ILU_H__ */
|
||||
' #endif /* __ilu_h_ */
|
||||
@@ -0,0 +1,212 @@
|
||||
'-----------------------------------------------------------------------------
|
||||
'
|
||||
' ImageLib Utility Toolkit Sources
|
||||
' Copyright (C) 2000-2002 by Denton Woods
|
||||
' Last modified: 06/22/2002 <--Y2K Compliant! =]
|
||||
'
|
||||
' Filename: il/ilut.h
|
||||
'
|
||||
' Description: The main include file for ILUT
|
||||
'
|
||||
'-----------------------------------------------------------------------------
|
||||
'-----------------------------------------------------------------------------
|
||||
'
|
||||
' Translated to Powerbasic by Peter Scheutz, Scheutz & Clementsen Design
|
||||
' Web: http://www.scheutz.dk
|
||||
' e-mail: sourcecode@scheutz.dk
|
||||
'
|
||||
' Last modified: 06/22/2002
|
||||
' Based on DevIL Ver. 1.6.1 headers
|
||||
'
|
||||
' Filename: ilut.inc
|
||||
'
|
||||
' Description: PB main include file for OpenILUT
|
||||
'
|
||||
' For information on use and download of DevIL goto: http://openil.sourceforge.net/
|
||||
' (Get docs and "End User Package")
|
||||
'
|
||||
' Report errors in the Powerbasic includes to e-mail above.
|
||||
'
|
||||
' For general help on Powerbasic and DevIL, try the forums at:
|
||||
' http://www.powerbasic.com
|
||||
'-----------------------------------------------------------------------------
|
||||
|
||||
|
||||
|
||||
|
||||
#If Not %Def(%WINAPI)
|
||||
#Include "win32api.inc"
|
||||
#EndIf
|
||||
|
||||
|
||||
' #ifndef __ilut_h_
|
||||
' #ifndef __ILUT_H__
|
||||
|
||||
' %__ilut_h_
|
||||
' %__ILUT_H__
|
||||
|
||||
' #include <il/il.h>
|
||||
' #include <il/ilu.h>
|
||||
|
||||
' #ifdef __cplusplus
|
||||
' extern "C" {
|
||||
' #endif
|
||||
|
||||
|
||||
' #ifdef _WIN32
|
||||
' #ifdef _MSC_VER
|
||||
' #ifndef _ILUT_BUILD_LIBRARY
|
||||
' #ifdef _DEBUG
|
||||
' #pragma comment(lib, "ilut-d.lib")
|
||||
' #else
|
||||
' #pragma comment(lib, "ilut.lib")
|
||||
' #endif'_DEBUG
|
||||
' #endif'_ILUT_BUILD_LIBRARY
|
||||
' #endif'_MSC_VER
|
||||
' #endif'_WIN32
|
||||
|
||||
|
||||
%ILUT_VERSION_1_5_6 = 1
|
||||
%ILUT_VERSION = 156
|
||||
|
||||
|
||||
' Attribute Bits
|
||||
%ILUT_OPENGL_BIT = &H00000001&
|
||||
%ILUT_D3D_BIT = &H00000002&
|
||||
%ILUT_ALL_ATTRIB_BITS = &H000FFFFF&
|
||||
|
||||
|
||||
' Error Types
|
||||
%ILUT_INVALID_ENUM = &H0501&
|
||||
%ILUT_OUT_OF_MEMORY = &H0502&
|
||||
%ILUT_INVALID_VALUE = &H0505&
|
||||
%ILUT_ILLEGAL_OPERATION = &H0506&
|
||||
%ILUT_INVALID_PARAM = &H0509&
|
||||
%ILUT_COULD_NOT_OPEN_FILE = &H050A&
|
||||
%ILUT_STACK_OVERFLOW = &H050E&
|
||||
%ILUT_STACK_UNDERFLOW = &H050F&
|
||||
%ILUT_NOT_SUPPORTED = &H0550&
|
||||
|
||||
|
||||
' State Definitions
|
||||
%ILUT_PALETTE_MODE = &H0600&
|
||||
%ILUT_OPENGL_CONV = &H0610&
|
||||
%ILUT_D3D_MIPLEVELS = &H0620&
|
||||
%ILUT_MAXTEX_WIDTH = &H0630&
|
||||
%ILUT_MAXTEX_HEIGHT = &H0631&
|
||||
%ILUT_MAXTEX_DEPTH = &H0632&
|
||||
%ILUT_GL_USE_S3TC = &H0634
|
||||
%ILUT_D3D_USE_DXTC = &H0634
|
||||
%ILUT_GL_GEN_S3TC = &H0635
|
||||
%ILUT_D3D_GEN_DXTC = &H0635
|
||||
%ILUT_S3TC_FORMAT = &H0705
|
||||
%ILUT_DXTC_FORMAT = &H0706
|
||||
|
||||
|
||||
' Values
|
||||
%ILUT_VERSION_NUM = &H0DE2&
|
||||
|
||||
|
||||
' ImageLib Utility Toolkit Functions
|
||||
Declare Function ilutDisable Lib "ilut.dll" Alias "ilutDisable" (ByVal pb_Mode As Dword) As Byte
|
||||
Declare Function ilutEnable Lib "ilut.dll" Alias "ilutEnable" (ByVal pb_Mode As Dword) As Byte
|
||||
Declare Function ilutGetBoolean Lib "ilut.dll" Alias "ilutGetBoolean" (ByVal pb_Mode As Dword) As Byte
|
||||
Declare Sub ilutGetBooleanv Lib "ilut.dll" Alias "ilutGetBooleanv" (ByVal pb_Mode As Dword, ByRef pb_Param As Byte)
|
||||
Declare Function ilutGetInteger Lib "ilut.dll" Alias "ilutGetInteger" (ByVal pb_Mode As Dword) As Long
|
||||
Declare Sub ilutGetIntegerv Lib "ilut.dll" Alias "ilutGetIntegerv" (ByVal pb_Mode As Dword, ByRef pb_Param As Long)
|
||||
Declare Function ilutGetString Lib "ilut.dll" Alias "ilutGetString" (ByVal pb_StringName As Dword) As Long
|
||||
Declare Sub ilutInit Lib "ilut.dll" Alias "ilutInit" ()
|
||||
Declare Function ilutIsDisabled Lib "ilut.dll" Alias "ilutIsDisabled" (ByVal pb_Mode As Dword) As Byte
|
||||
Declare Function ilutIsEnabled Lib "ilut.dll" Alias "ilutIsEnabled" (ByVal pb_Mode As Dword) As Byte
|
||||
Declare Sub ilutPopAttrib Lib "ilut.dll" Alias "ilutPopAttrib" ()
|
||||
Declare Sub ilutPushAttrib Lib "ilut.dll" Alias "ilutPushAttrib" (ByVal pb_Bits As Dword)
|
||||
Declare Sub ilutSetInteger Lib "ilut.dll" Alias "ilutSetInteger" (ByVal pb_Mode As Dword, ByVal pb_Param As Dword)
|
||||
|
||||
|
||||
' #ifdef DJGPP
|
||||
' %ILUT_USE_ALLEGRO
|
||||
' #elif _WIN32
|
||||
' %ILUT_USE_WIN32
|
||||
' %ILUT_USE_OPENGL
|
||||
' #else
|
||||
' %ILUT_USE_OPENGL
|
||||
' #endif
|
||||
|
||||
'%ILUT_USE_ALLEGRO
|
||||
'%ILUT_USE_WIN32
|
||||
'%ILUT_USE_OPENGL
|
||||
|
||||
|
||||
' The different rendering api's...more to be added later?
|
||||
%ILUT_OPENGL = 0
|
||||
%ILUT_ALLEGRO = 1
|
||||
%ILUT_WIN32 = 2
|
||||
|
||||
|
||||
Declare Function ilutRenderer Lib "ilut.dll" Alias "ilutRenderer" (ByVal pb_Renderer As Dword) As Byte
|
||||
|
||||
|
||||
' ImageLib Utility Toolkit's OpenGL Functions
|
||||
' #ifdef ILUT_USE_OPENGL
|
||||
' #ifdef _MSC_VER
|
||||
' %WIN32_LEAN_AND_MEAN
|
||||
' #include <windows.h>
|
||||
' #endif'_MSC_VER
|
||||
' #include <GL/gl.h>
|
||||
' #include <GL/glu.h>
|
||||
' #include <GL/glext.h>
|
||||
' #ifdef _MSC_VER
|
||||
' #pragma comment(lib, "opengl32.lib")
|
||||
' #pragma comment(lib, "glu32.lib")
|
||||
' #endif'_MSC_VER
|
||||
Declare Function ilutGLBindTexImage Lib "ilut.dll" Alias "ilutGLBindTexImage" () As Dword
|
||||
Declare Function ilutGLBindMipCompressed Lib "ilut.dll" Alias "ilutGLBindMipCompressed" () As Dword
|
||||
Declare Function ilutGLBuildMipmaps Lib "ilut.dll" Alias "ilutGLBuildMipmaps" () As Byte
|
||||
Declare Function ilutGLLoadImage Lib "ilut.dll" Alias "ilutGLLoadImage" (ByRef pb_FileName As Asciiz) As Dword
|
||||
Declare Function ilutGLScreen Lib "ilut.dll" Alias "ilutGLScreen" () As Byte
|
||||
Declare Function ilutGLScreenie Lib "ilut.dll" Alias "ilutGLScreenie" () As Byte
|
||||
Declare Function ilutGLSaveImage Lib "ilut.dll" Alias "ilutGLSaveImage" (ByRef pb_FileName As Asciiz, ByVal pb_TexID As Dword) As Byte
|
||||
Declare Function ilutGLSetTex Lib "ilut.dll" Alias "ilutGLSetTex" (ByVal pb_TexID As Dword) As Byte
|
||||
Declare Function ilutGLTexImage Lib "ilut.dll" Alias "ilutGLTexImage" (ByVal pb_Level As Dword) As Byte
|
||||
' #endif'ILUT_USE_OPENGL
|
||||
|
||||
|
||||
' ImageLib Utility ToolKit's Allegro Functions
|
||||
' #ifdef ILUT_USE_ALLEGRO
|
||||
' #include <allegro.h>
|
||||
Declare Function ilutAllegLoadImage Lib "ilut.dll" Alias "ilutAllegLoadImage" (ByRef pb_FileName As Asciiz) As Long
|
||||
'Declare Function ilutConvertToAlleg Lib "ilut.dll" Alias "ilutConvertToAlleg" (ByVal pb_Pal As PALETTE) As Long
|
||||
' #endif'ILUT_USE_ALLEGRO
|
||||
|
||||
|
||||
' ImageLib Utility Toolkit's Win32 (DirectX/GDI) Functions
|
||||
' #ifdef ILUT_USE_WIN32
|
||||
' #ifdef _WIN32
|
||||
' %WIN32_LEAN_AND_MEAN
|
||||
' #include <windows.h>
|
||||
Declare Function ilutConvertToHBitmap Lib "ilut.dll" Alias "ilutConvertToHBitmap" (ByVal pb_hDC As Long) As Long
|
||||
Declare Sub ilutGetBmpInfo Lib "ilut.dll" Alias "ilutGetBmpInfo" (ByRef pb_Info As BITMAPINFO)
|
||||
Declare Function ilutGetHPal Lib "ilut.dll" Alias "ilutGetHPal" () As Long
|
||||
Declare Function ilutGetPaddedData Lib "ilut.dll" Alias "ilutGetPaddedData" () As Long
|
||||
Declare Function ilutGetWinClipboard Lib "ilut.dll" Alias "ilutGetWinClipboard" () As Byte
|
||||
Declare Function ilutLoadResource Lib "ilut.dll" Alias "ilutLoadResource" (ByVal pb_hInst As Long, ByVal pb_ID As Long, ByRef pb_ResourceType As Asciiz, ByVal pb_Type As Dword) As Byte
|
||||
Declare Function ilutSetHBitmap Lib "ilut.dll" Alias "ilutSetHBitmap" (ByVal pb_Bitmap As Long) As Byte
|
||||
Declare Function ilutSetHPal Lib "ilut.dll" Alias "ilutSetHPal" (ByVal pb_Pal As Long) As Byte
|
||||
Declare Function ilutSetWinClipboard Lib "ilut.dll" Alias "ilutSetWinClipboard" () As Byte
|
||||
Declare Function ilutWinLoadImage Lib "ilut.dll" Alias "ilutWinLoadImage" (ByRef pb_FileName As Asciiz, ByVal pb_hDC As Long) As Long
|
||||
Declare Function ilutWinLoadUrl Lib "ilut.dll" Alias "ilutWinLoadUrl" (ByRef pb_Url As Asciiz) As Byte
|
||||
Declare Function ilutWinSaveImage Lib "ilut.dll" Alias "ilutWinSaveImage" (ByRef pb_FileName As Asciiz, ByVal pb_Bitmap As Long) As Byte
|
||||
|
||||
' #ifdef ILUT_USE_DIRECTX7
|
||||
' LPDIRECTDRAWSURFACE7 ILAPIENTRY ilutDX7Surface(char *FileName, LPDIRECTDRAW7 DDraw);
|
||||
' #endif'ILUT_USE_DIRECTX7
|
||||
' #endif'_WIN32
|
||||
' #endif'ILUT_USE_WIN32
|
||||
|
||||
|
||||
' #ifdef __cplusplus
|
||||
' }
|
||||
' #endif
|
||||
|
||||
' #endif /* __ILUT_H__ */
|
||||
' #endif /* __ilut_h_ */
|
||||
@@ -0,0 +1,175 @@
|
||||
'-----------------------------------------------------------------------------
|
||||
' Convert Image using DevIL
|
||||
' DevIL Sample program using Powerbasic.
|
||||
'
|
||||
' by Peter Scheutz, Scheutz & Clementsen Design
|
||||
' Web: http://www.scheutz.dk
|
||||
' e-mail: sourcecode@scheutz.dk
|
||||
'
|
||||
' Last modified: 06/22/2002
|
||||
' Based on DevIL Ver. 1.6.1 PB incs
|
||||
' Filename: imgview.bas
|
||||
'
|
||||
' Released under the GNU Lesser General Public License:
|
||||
' http://www.gnu.org/copyleft/lesser.html
|
||||
'
|
||||
' For information on use and download of DevIL goto: http://openil.sourceforge.net/
|
||||
' (Get docs and "End User Package")
|
||||
'
|
||||
' Report errors in the Powerbasic includes to e-mail above.
|
||||
'
|
||||
' For general help on Powerbasic and DevIL, try the forums at:
|
||||
' http://www.powerbasic.com
|
||||
'-----------------------------------------------------------------------------
|
||||
|
||||
|
||||
#Register None
|
||||
#Compile Exe "imgconv.exe"
|
||||
Option Explicit
|
||||
|
||||
|
||||
#Include "il.inc"
|
||||
#Include "ilu.inc"
|
||||
#Include "ilut.inc"
|
||||
|
||||
$If Not %Def(%TRUE)
|
||||
%TRUE = 1
|
||||
%FALSE = 0
|
||||
#EndIf
|
||||
|
||||
|
||||
|
||||
$If Not %Def(%MAX_PATH )
|
||||
%MAX_PATH = 260
|
||||
#EndIf
|
||||
|
||||
%OVERWRITE = %False '%True
|
||||
|
||||
Function PbMain() As Long
|
||||
|
||||
Local ILErr As Dword
|
||||
Local info As ILinfo
|
||||
Local ID As Dword
|
||||
Local errString As Asciiz*1024
|
||||
Local Infile As Asciiz*%MAX_PATH
|
||||
Local Outfile As Asciiz*%MAX_PATH
|
||||
|
||||
Infile="C:\test.bmp" ' OBS: Change this !
|
||||
Outfile="C:\test.tga" ' OBS: Change this !
|
||||
|
||||
ilInit
|
||||
|
||||
ilPushAttrib %IL_ALL_ATTRIB_BITS
|
||||
ILErr=ilGetError()
|
||||
If ILErr <> 0 Then
|
||||
errString = iluErrorString(ILErr)
|
||||
MsgBox "Error in ilPushAttrib" & $CRLF & errString
|
||||
Exit Function
|
||||
End If
|
||||
|
||||
ilGenImages ByVal 1, ID
|
||||
ILErr=ilGetError()
|
||||
If ILErr <> 0 Then
|
||||
errString = iluErrorString(ILErr)
|
||||
MsgBox "Error in ilGenImages" & $CRLF & errString
|
||||
Exit Function
|
||||
End If
|
||||
|
||||
|
||||
ilBindImage ID
|
||||
ILErr=ilGetError()
|
||||
If ILErr <> 0 Then
|
||||
errString = iluErrorString(ILErr)
|
||||
MsgBox "Error in ilBindImage" & $CRLF & errString
|
||||
GoTo done
|
||||
End If
|
||||
|
||||
' ilEnable %IL_FORMAT_SET
|
||||
' ilEnable %IL_ORIGIN_SET
|
||||
' ilEnable %IL_TYPE_SET
|
||||
|
||||
' ilFormatFunc %IL_RGB
|
||||
' ilOriginFunc %IL_ORIGIN_LOWER_LEFT
|
||||
' ilTypeFunc %IL_UNSIGNED_BYTE
|
||||
'
|
||||
' ilEnable %IL_CONV_PAL
|
||||
|
||||
' Do
|
||||
' ILErr = ilGetError()
|
||||
' If ILErr<>0 Then
|
||||
' errString = iluErrorString(ILErr)
|
||||
' MsgBox "Error in ..Func or ilEnable" & $CRLF & errString
|
||||
' End If
|
||||
' Loop While (ILErr <> 0)
|
||||
|
||||
|
||||
|
||||
ilLoadImage infile
|
||||
ILErr=ilGetError()
|
||||
If ILErr <> 0 Then
|
||||
errString = iluErrorString(ILErr)
|
||||
MsgBox "Error in ilLoadImage" & $CRLF & errString
|
||||
GoTo done
|
||||
End If
|
||||
|
||||
' unrem to test these effects.
|
||||
|
||||
' iluRotate 50
|
||||
' iluPixelize 5
|
||||
' iluEnlargeImage 2,2,4
|
||||
' iluBlurGaussian 4
|
||||
|
||||
' Do
|
||||
' ILErr = ilGetError()
|
||||
' If ILErr<>0 Then
|
||||
' errString = iluErrorString(ILErr)
|
||||
' MsgBox "Error in Effect" & $CRLF & errString
|
||||
' End If
|
||||
' Loop While (ILErr <> 0)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
If %OVERWRITE=%True And ilIsDisabled(%IL_FILE_OVERWRITE) Then
|
||||
ilEnable %IL_FILE_OVERWRITE
|
||||
ilSaveImage outfile
|
||||
'ilDisable %IL_FILE_OVERWRITE ' done by ilPushAttrib/ilPopAttrib
|
||||
Else
|
||||
ilSaveImage outfile
|
||||
|
||||
End If
|
||||
|
||||
ILErr=ilGetError()
|
||||
If ILErr <> 0 Then
|
||||
errString = iluErrorString(ILErr)
|
||||
MsgBox "Error in ilSaveImage" & $CRLF & errString
|
||||
GoTo done
|
||||
Else
|
||||
MsgBox "Picture converted"
|
||||
End If
|
||||
|
||||
done:
|
||||
ilDeleteImages 1 , ID
|
||||
|
||||
ilPopAttrib
|
||||
|
||||
|
||||
' clear additional errors
|
||||
Do
|
||||
ILErr = ilGetError()
|
||||
Loop While (ILErr <> 0)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
End Function
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,216 @@
|
||||
'-----------------------------------------------------------------------------
|
||||
' Get Image info using DevIL
|
||||
' DevIL Sample program using Powerbasic.
|
||||
'
|
||||
' by Peter Scheutz, Scheutz & Clementsen Design
|
||||
' Web: http://www.scheutz.dk
|
||||
' e-mail: sourcecode@scheutz.dk
|
||||
'
|
||||
' Last modified: 06/22/2002
|
||||
' Based on DevIL Ver. 1.6.1 PB incs
|
||||
' Filename: imgview.bas
|
||||
'
|
||||
' Released under the GNU Lesser General Public License:
|
||||
' http://www.gnu.org/copyleft/lesser.html
|
||||
'
|
||||
' For information on use and download of DevIL goto: http://openil.sourceforge.net/
|
||||
' (Get docs and "End User Package")
|
||||
'
|
||||
' Report errors in the Powerbasic includes to e-mail above.
|
||||
'
|
||||
' For general help on Powerbasic and DevIL, try the forums at:
|
||||
' http://www.powerbasic.com
|
||||
'-----------------------------------------------------------------------------
|
||||
|
||||
|
||||
#Register None
|
||||
#Compile Exe "imginfo.exe"
|
||||
Option Explicit
|
||||
|
||||
|
||||
#Include "il.inc"
|
||||
#Include "ilu.inc"
|
||||
#Include "ilut.inc"
|
||||
|
||||
|
||||
Function OpenIL_TypeString(ByVal il_const As Dword) As String
|
||||
|
||||
Select Case il_const
|
||||
Case %IL_BYTE : Function = "IL_BYTE"
|
||||
Case %IL_UNSIGNED_BYTE : Function = "IL_UNSIGNED_BYTE"
|
||||
Case %IL_SHORT : Function = "IL_SHORT"
|
||||
Case %IL_UNSIGNED_SHORT : Function = "IL_UNSIGNED_SHORT"
|
||||
Case %IL_INT : Function = "IL_INT"
|
||||
Case %IL_UNSIGNED_INT : Function = "IL_UNSIGNED_INT"
|
||||
Case %IL_FLOAT : Function = "IL_FLOAT"
|
||||
Case %GL_DOUBLE : Function = "GL_DOUBLE"
|
||||
|
||||
Case Else : Function = "Type not defined"
|
||||
|
||||
|
||||
End Select
|
||||
|
||||
End Function
|
||||
|
||||
|
||||
|
||||
|
||||
Function OpenIL_FormatString(ByVal il_const As Dword) As String
|
||||
|
||||
Select Case il_const
|
||||
Case %IL_COLOUR_INDEX : Function = "IL_COLOUR_INDEX"
|
||||
Case %IL_COLOR_INDEX : Function = "IL_COLOR_INDEX"
|
||||
Case %IL_RGB : Function = "IL_RGB"
|
||||
Case %IL_RGBA : Function = "IL_RGBA"
|
||||
Case %IL_BGR : Function = "IL_BGR"
|
||||
Case %IL_BGRA : Function = "IL_BGRA"
|
||||
Case %IL_LUMINANCE : Function = "IL_LUMINANCE"
|
||||
|
||||
Case Else : Function = "Format not defined"
|
||||
|
||||
|
||||
End Select
|
||||
|
||||
End Function
|
||||
|
||||
|
||||
|
||||
Function OpenIL_OriginString(ByVal il_const As Dword) As String
|
||||
|
||||
' Origin Definitions
|
||||
Select Case il_const
|
||||
Case %IL_ORIGIN_LOWER_LEFT : Function = "IL_ORIGIN_LOWER_LEFT"
|
||||
Case %IL_ORIGIN_UPPER_LEFT : Function = "IL_ORIGIN_UPPER_LEFT"
|
||||
|
||||
Case Else : Function = "Origin type not defined"
|
||||
End Select
|
||||
|
||||
End Function
|
||||
|
||||
|
||||
|
||||
Function OpenIL_PalTypeString(ByVal il_const As Dword) As String
|
||||
|
||||
' Palette types
|
||||
Select Case il_const
|
||||
Case %IL_PAL_NONE : Function = "IL_PAL_NONE"
|
||||
Case %IL_PAL_RGB24 : Function = "IL_PAL_RGB24"
|
||||
Case %IL_PAL_RGB32 : Function = "IL_PAL_RGB32"
|
||||
Case %IL_PAL_RGBA32 : Function = "IL_PAL_RGBA32"
|
||||
Case %IL_PAL_BGR24 : Function = "IL_PAL_BGR24"
|
||||
Case %IL_PAL_BGR32 : Function = "IL_PAL_BGR32"
|
||||
Case %IL_PAL_BGRA32 : Function = "IL_PAL_BGRA32"
|
||||
|
||||
Case Else : Function = "Pallete type not defined"
|
||||
End Select
|
||||
|
||||
End Function
|
||||
|
||||
|
||||
Function PbMain() As Long
|
||||
|
||||
Local ILErr As Dword
|
||||
Local info As ILinfo
|
||||
Local ID As Dword
|
||||
Local errString As Asciiz*1024
|
||||
|
||||
|
||||
If Len(Command$)=0 Then
|
||||
MsgBox "Usage: imginfo.exe filename"
|
||||
Exit Function
|
||||
End If
|
||||
|
||||
ilInit
|
||||
|
||||
ilGenImages ByVal 1, ID
|
||||
ILErr=ilGetError()
|
||||
If ILErr <> 0 Then
|
||||
errString = iluErrorString(ILErr)
|
||||
MsgBox "Error in ilGenImages" & $CRLF & errString
|
||||
Exit Function
|
||||
End If
|
||||
|
||||
|
||||
ilBindImage ID
|
||||
ILErr=ilGetError()
|
||||
If ILErr <> 0 Then
|
||||
errString = iluErrorString(ILErr)
|
||||
MsgBox "Error in ilBindImage" & $CRLF & errString
|
||||
GoTo done
|
||||
End If
|
||||
|
||||
|
||||
|
||||
' ilEnable %IL_FORMAT_SET
|
||||
' ilEnable %IL_ORIGIN_SET
|
||||
' ilEnable %IL_TYPE_SET
|
||||
'
|
||||
' ilFormatFunc %IL_RGB
|
||||
' ilOriginFunc %IL_ORIGIN_LOWER_LEFT
|
||||
' ilTypeFunc %IL_UNSIGNED_BYTE
|
||||
'
|
||||
' ilEnable %IL_CONV_PAL
|
||||
' Do
|
||||
' ILErr = ilGetError()
|
||||
' Loop While (ILErr <> 0)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
ilLoadImage Command$
|
||||
ILErr=ilGetError()
|
||||
If ILErr <> 0 Then
|
||||
errString = iluErrorString(ILErr)
|
||||
MsgBox "Error in ilLoadImage" & $CRLF & errString
|
||||
GoTo done
|
||||
End If
|
||||
|
||||
|
||||
iluGetImageInfo info
|
||||
ILErr=ilGetError()
|
||||
If ILErr <> 0 Then
|
||||
errString = iluErrorString(ILErr)
|
||||
MsgBox "Error in iluGetImageInfo" & $CRLF & errString
|
||||
GoTo done
|
||||
Else
|
||||
|
||||
MsgBox "DevIL Image info: " & $CRLF & $CRLF & _
|
||||
"Id: " & $TAB & $TAB & Format$(info.iId) & $CRLF & _
|
||||
"Data Pointer" & $TAB & Format$(info.iData) & $CRLF & _
|
||||
"Width: " & $TAB & $TAB & Format$(info.iWidth) & $CRLF & _
|
||||
"Height: " & $TAB & $TAB & Format$(info.iHeight) & $CRLF & _
|
||||
"Depth: " & $TAB & $TAB & Format$(info.iDepth) & $CRLF & _
|
||||
"Bpp: " & $TAB & $TAB & Format$(info.iBpp) & $CRLF & _
|
||||
"SizeOfData: " & $TAB & Format$(info.iSizeOfData) & $CRLF & _
|
||||
"Format: " & $TAB & $TAB & OpenIL_FormatString(info.iFormat) & $CRLF & _
|
||||
"Type: " & $TAB & $TAB & OpenIL_TypeString(info.iType) & $CRLF & _
|
||||
"Origin: " & $TAB & $TAB & OpenIL_OriginString(info.iOrigin) & $CRLF & _
|
||||
"PalType: " & $TAB & $TAB & OpenIL_PalTypeString(info.iPalType) & $CRLF & _
|
||||
"PalSize: " & $TAB & $TAB & Format$(info.iPalSize) & $CRLF & _
|
||||
"NumNext: " & $TAB & Format$(info.iNumNext) & $CRLF & _
|
||||
"NumMips: " & $TAB & Format$(info.iNumMips) & $CRLF & _
|
||||
"NumLayers: " & $TAB & Format$(info.iNumLayers)
|
||||
|
||||
End If
|
||||
|
||||
|
||||
|
||||
done:
|
||||
ilDeleteImages 1 , ID
|
||||
|
||||
' clear additional errors
|
||||
Do
|
||||
ILErr = ilGetError()
|
||||
Loop While (ILErr <> 0)
|
||||
|
||||
|
||||
|
||||
End Function
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,168 @@
|
||||
'-----------------------------------------------------------------------------
|
||||
' Minimal Image viewer using DevIL
|
||||
' DevIL Sample program using Powerbasic.
|
||||
'
|
||||
' by Peter Scheutz, Scheutz & Clementsen Design
|
||||
' Web: http://www.scheutz.dk
|
||||
' e-mail: sourcecode@scheutz.dk
|
||||
'
|
||||
' Last modified: 06/22/2002
|
||||
' Based on DevIL Ver. 1.6.1 PB incs
|
||||
' Filename: imgview.bas
|
||||
'
|
||||
' Released under the GNU Lesser General Public License:
|
||||
' http://www.gnu.org/copyleft/lesser.html
|
||||
'
|
||||
' For information on use and download of DevIL goto: http://openil.sourceforge.net/
|
||||
' (Get docs and "End User Package")
|
||||
'
|
||||
' Report errors in the Powerbasic includes to e-mail above.
|
||||
'
|
||||
' For general help on Powerbasic and DevIL, try the forums at:
|
||||
' http://www.powerbasic.com
|
||||
'-----------------------------------------------------------------------------
|
||||
|
||||
|
||||
#Register None
|
||||
#Compile Exe "imgview.exe"
|
||||
|
||||
Option Explicit
|
||||
|
||||
#Include "win32api.inc"
|
||||
|
||||
#Include "il.inc"
|
||||
#Include "ilu.inc"
|
||||
#Include "ilut.inc"
|
||||
|
||||
|
||||
Global hDCBmp As Long
|
||||
Global pic As BITMAP
|
||||
|
||||
CallBack Function mainCallback()
|
||||
Local ps As PAINTSTRUCT
|
||||
Local hDC As Long
|
||||
Select Case CbMsg
|
||||
Case %WM_PAINT
|
||||
hDC = BeginPaint( CbHndl, ps )
|
||||
If hDCBmp<>0 Then
|
||||
BitBlt hDC, 0, 0, pic.bmWidth, pic.bmHeight , hDCBmp, 0, 0, %SRCCOPY
|
||||
End If
|
||||
Call EndPaint( CbHndl, ps )
|
||||
|
||||
End Select
|
||||
|
||||
End Function
|
||||
|
||||
|
||||
Sub SetWindowClientSize (ByVal hWnd As Long,ByVal PixX As Long,ByVal PixY As Long)
|
||||
' set window by client size in pixels
|
||||
' centers window and clips to screen
|
||||
|
||||
Local cRect As RECT
|
||||
Local diffX As Long
|
||||
Local diffY As Long
|
||||
|
||||
|
||||
GetWindowRect hWnd,cRect
|
||||
diffX=cRect.nRight-cRect.nLeft
|
||||
diffY=cRect.nBottom-cRect.nTop
|
||||
|
||||
GetClientRect hWnd,cRect
|
||||
diffX=diffX-(cRect.nRight-cRect.nLeft)
|
||||
diffY=diffY-(cRect.nBottom-cRect.nTop)
|
||||
|
||||
PixX=PixX+diffX
|
||||
PixY=PixY+diffY
|
||||
|
||||
If PixX> GetSystemMetrics(%SM_CXSCREEN) Then PixX = GetSystemMetrics(%SM_CXSCREEN)
|
||||
If PixY> GetSystemMetrics(%SM_CYSCREEN) Then PixY = GetSystemMetrics(%SM_CYSCREEN)
|
||||
|
||||
SetWindowPos hWnd, 0, (GetSystemMetrics(%SM_CXSCREEN) - PixX) / 2, _
|
||||
(GetSystemMetrics(%SM_CYSCREEN) - PixY) / 2, PixX, PixY, 0
|
||||
|
||||
|
||||
End Sub
|
||||
|
||||
|
||||
|
||||
Function PbMain() As Long
|
||||
|
||||
Local ILErr As Dword
|
||||
Local hBmp As Long
|
||||
|
||||
Local hWnd As Long
|
||||
Local hDC As Long
|
||||
|
||||
Local hBmpOld As Long
|
||||
Local errString As Asciiz*1024
|
||||
|
||||
|
||||
If Len(Command$)=0 Then
|
||||
MsgBox "Usage: imgview.exe filename"
|
||||
Exit Function
|
||||
End If
|
||||
|
||||
ilInit
|
||||
|
||||
ilEnable %IL_FORMAT_SET
|
||||
ilEnable %IL_ORIGIN_SET
|
||||
ilEnable %IL_TYPE_SET
|
||||
|
||||
ilFormatFunc %IL_RGB
|
||||
ilOriginFunc %IL_ORIGIN_LOWER_LEFT
|
||||
ilTypeFunc %IL_UNSIGNED_BYTE
|
||||
|
||||
ilEnable %IL_CONV_PAL
|
||||
|
||||
Do
|
||||
ILErr = ilGetError()
|
||||
If ILErr <>0 Then
|
||||
errString = iluErrorString(ILErr)
|
||||
MsgBox "Error in Set or enable:" & $CRLF & errString
|
||||
End If
|
||||
Loop While (ILErr <> 0)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Dialog New 0, "DevIL Mini imageviewer in PB " & Command$, , , 100, 100 , %WS_SYSMENU Or %WS_CAPTION To hWnd
|
||||
hDC = getDC (hWnd)
|
||||
If hDC<>0 Then
|
||||
hBmp = ilutWinLoadImage (Command$,getDC (hWnd) )
|
||||
ILErr=ilGetError()
|
||||
If ILErr<>0 Then
|
||||
errString = iluErrorString(ILErr)
|
||||
MsgBox "Error in ilutWinLoadImage:" & $CRLF & errString
|
||||
Exit Function
|
||||
Else
|
||||
GetObject hBmp, SizeOf( pic ), pic
|
||||
SetWindowClientSize hWnd ,pic.bmWidth, pic.bmHeight
|
||||
|
||||
hDCBmp = CreateCompatibleDC( hDC )
|
||||
hBmpOld = SelectObject( hDCBmp, hBmp )
|
||||
|
||||
Dialog Show Modal hWnd Call mainCallback
|
||||
End If
|
||||
|
||||
|
||||
End If
|
||||
|
||||
If hBmp < > 0 Then
|
||||
SelectObject hDCBmp, hBmpOld
|
||||
DeleteObject hBmp
|
||||
hBmp = 0
|
||||
End If
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
End Function
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user